Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Add New Employee Role
function addRole() { connection.query("SELECT role.title AS Title, role.salary AS Salary FROM role", function (err, res) { inquirer.prompt([ { name: "Title", type: "input", message: "What is the title for this role?" }, { name: "Salary", type: "input", message: "What is the salary?" } ]).then(function (res) { connection.query( "INSERT INTO role SET ?", { title: res.Title, salary: res.Salary, }, function (err) { if (err) throw err console.table(res); search(); } ) }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function addRole() {\n const departments = await db.findAllDepartments();\n const departmentChoices = departments.map(({\n id,\n name\n }) => ({\n name: name,\n value: id,\n }));\n const role = await prompt([{\n name: \"title\",\n message: \"what is the name of the role?\"\n },\n {\n name: \"salary\",\n message: \"what is the salary of the role?\"\n },\n {\n type: \"list\",\n name: \"department_id\",\n message: \"which department does the role belong to?\",\n choices: departmentChoices\n }\n ]);\n\n await db.createRole(role);\n console.log(`Added ${role.title} to the database`);\n startPrompt();\n}", "async function addRole() {\n const departmentList = await departments.getListAll()\n \n const {title, salary, departmentId} = await inquirer.prompt([\n {\n message: \"What is the role's title?\",\n name: \"title\",\n validate: (answer) => roles.validateTitle(answer)\n },\n {\n message: \"What is the role's salary?\",\n name: \"salary\",\n validate: (answer) => roles.validateSalary(answer)\n },\n {\n type: \"list\",\n message: \"Which department does this role belong to?\",\n choices: departmentList,\n name: \"departmentId\"\n }\n ])\n\n await roles.add(title, salary, departmentId)\n promptMainMenu()\n}", "function addRole(role) {\n roles.push(role);\n}", "function addRole() {\n inquirer.prompt(addRoleQuestions).then(function(answers) {\n let query = \"INSERT INTO role SET \";\n query += `title = \"${answers.title}\", `;\n query += `salary = ${answers.salary}, `;\n query += `department_id = ${answers.departmentId}`\n connection.query(query, function(err, result) {\n if (err) throw err;\n console.log(\"Role has been added!\");\n start();\n });\n })\n}", "addRole(title, salary, departnemtId) {\n\t\ttry {\n\t\t\tthis.connection.query(\n\t\t\t\t\"INSERT INTO role SET ?\",\n\t\t\t\t{\n\t\t\t\t\ttitle: `${title}`,\n\t\t\t\t\tsalary: `${salary}`,\n\t\t\t\t\tdepartment_id: `${departnemtId}`,\n\t\t\t\t},\n\t\t\t\tfunction (err, res) {\n\t\t\t\t\tif (err) throw err;\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t`\\nSuccessfully added role with title:${title}, salary:${salary}, departmentId:${departnemtId}`\n\t\t\t\t\t);\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t);\n\t\t} catch (err) {\n\t\t\tconsole.log(\"Error inserting role : \" + err);\n\t\t}\n\t}", "async function addRole() {\n\tconst res = await queryAsync('SELECT * FROM department');\t\n\tconst answer = await inquirer.prompt([\n\t\t{\n\t\t\tname: 'role',\n\t\t\ttype: 'input',\n\t\t\tmessage: 'Role Name:'\n\t\t},\n\t\t{\n\t\t\tname: 'salary',\n\t\t\ttype: 'input',\n\t\t\tmessage: 'Salary:',\n\t\t\tvalidate: value => {\n\t\t\t if (isNaN(value) === false) return true;\n\t\t\t return false;\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\tname: 'department',\n\t\t\ttype: 'list',\n\t\t\tmessage: 'Department:',\n\t\t\tchoices: () => {\n\t\t\t\tconst departments = [];\n\t\t\t\tfor (let i of res) {\n\t\t\t\t\tdepartments.push(i.name);\n\t\t\t\t}\n\t\t\t\treturn departments;\n\t\t\t}\n\t\t}\n\t]);\n\tlet departmentId;\n\tfor (let i of res) {\n\t\tif (i.name === answer.department) {\n\t\t\tdepartmentId = i.id;\n \t\t}\n\t} \t \t\n\tawait queryAsync('INSERT INTO role SET ?', { title: answer.role, salary: answer.salary, departmentId: departmentId });\n\tconsole.log(chalk.bold.bgCyan('\\nSUCCESS:'), 'Role was added.');\n\tviewRoles();\n}", "async function setEmployeeRole() {\n const\n employeeList = await employees.getListAll(),\n roleList = await roles.getListAll()\n\n const {employeeId, roleId} = await inquirer.prompt([\n {\n type: \"list\",\n message: \"Which employee's role would you like to change?\",\n choices: employeeList,\n name: \"employeeId\"\n },\n {\n type: \"list\",\n message: \"What is the employee's new role?\",\n choices: roleList,\n name: \"roleId\"\n }\n ])\n\n await employees.setRole(employeeId, roleId)\n promptMainMenu()\n}", "function addRole() {\n inquirer.prompt([\n {\n type: 'input',\n message: 'Enter new role name',\n name: 'role'\n },\n {\n type: 'input',\n message: 'Enter new role salary',\n name: 'salary'\n },\n {\n type: 'input',\n message: 'enter new role department id',\n name: 'department_id'\n },\n ]).then(function(answers){\n con.query(\"INSERT INTO roles set ?\", {title: answers.role, salary: answers.salary, department_id: answers.department_id}, function(err, data) {\n if (err) throw err\n console.log(\"\\n\" + \"New role added: \" + answers.role);\n runManager();\n });\n });\n }", "createRole(role) {\r\n return this.connection.query(\"INSERT INTO role SET ?\", role);\r\n }", "function addRole(){\n connection.query(queryList.deptList, function(err, res){\n if (err) throw err;\n let deptList = res;\n let queryAdd = new q.queryAdd(\"department\", \"Which department is this role in?\", res.map(d => d.name))\n let choices = q.addRole;\n choices.push(queryAdd);\n\n inquirer\n .prompt(choices)\n .then(answer => {\n const newRole = answer;\n newRole.departmentId = deptList.filter(d => d.name === newRole.department).map(id => id.id).shift();\n connection.query(queryList.postRole, \n {\n title:newRole.role,\n salary:newRole.salary,\n department_id:newRole.departmentId\n }, \n function(err, res){\n if (err) throw err;\n startQ();\n });\n })\n .catch(err => {\n if(err) throw err;\n });\n });\n}", "function addRole() {\n inquirer.prompt([\n {\n type: \"input\",\n message: \"What's the name of the role?\",\n name: \"roleName\"\n },\n {\n type: \"input\",\n message: \"What is the salary for this role?\",\n name: \"salaryTotal\"\n },\n {\n type: \"input\",\n message: \"What is the department id number?\",\n name: \"departmentId\"\n }\n ]).then(function(answer) {\n connection.query(\"INSERT INTO role (title, salary, department_id) VALUES (?, ?,?)\" , [answer.roleName, answer.salaryTotal, answer.departmentId], function (err, res) {\n if (err) throw err;\n console.table(res);\n startPrompt();\n }); \n });\n\n }", "function addRole() {\n inquirer\n .prompt([\n {\n name: \"title\",\n message: \"Enter the role title: \",\n },\n {\n name: \"salary\",\n message: \"Enter the salary for the role: \",\n },\n {\n name: \"department\",\n type: \"list\",\n message: \"Select the department for the role:\",\n choices: departments,\n },\n ])\n .then((response) => {\n //use get id from above to get the id from the name selected in the prompt\n let departmentID = getID(departments, response.department);\n db.query(\n \"INSERT INTO role (title, salary, department_id) VALUES (?,?,?)\",\n [response.title, response.salary, departmentID],\n function (err) {\n if (err) throw err;\n viewAllRoles();\n }\n );\n });\n}", "async function addEmployee() {\n const\n employeesList = await employees.getListAll(),\n roleList = await roles.getListAll()\n\n const {givenName, surname, roleId, managerId} =\n await inquirer.prompt([\n {\n message: \"What is the employee's given name?\",\n name: \"givenName\",\n validate: (answer) => employees.validateName(answer)\n },\n {\n message: \"What is the employee's surname?\",\n name: \"surname\",\n validate: (answer) => employees.validateName(answer)\n },\n {\n type: \"list\",\n message: \"What is the employee's role?\",\n choices: roleList,\n name: \"roleId\"\n },\n {\n type: \"list\",\n message: \"Who is the employee's manager?\",\n choices: [...employeesList, none],\n name: \"managerId\"\n }\n ])\n \n await employees.add(givenName, surname, roleId, managerId)\n promptMainMenu()\n}", "async function addEmployee() {\n\tconst resR = await queryAsync('SELECT * FROM role');\n\tconst answerR = await inquirer.prompt([\n\t\t{\n\t\t\tname: 'firstName',\n\t\t\ttype: 'input',\n\t\t\tmessage: 'First Name:'\n\t\t},\n\t\t{\n\t\t\tname: 'lastName',\n\t\t\ttype: 'input',\n\t\t\tmessage: 'Last Name:'\n\t\t},\t\n\t\t{\n\t\t\tname: 'role',\n\t\t\ttype: 'list',\n\t\t\tmessage: 'Role:',\n\t\t\tchoices: () => {\n\t\t\t\tconst roles = [];\n\t\t\t\tfor (let i of resR) {\n\t\t\t\t\troles.push(i.title);\n\t\t\t\t}\n\t\t\t\treturn roles;\n\t\t\t}\n\t\t}\n\t]);\t\n\tconst resE = await queryAsync('SELECT employee.id, CONCAT(employee.firstName, \" \", employee.lastName) AS employeeName, employee.roleId, employee.managerId FROM employee');\n\tconst answerE = await inquirer.prompt({\n\t\tname: 'employee',\n\t\ttype: 'list',\n\t\tmessage: 'Manager:',\n\t\tchoices: () => {\n\t\t\tconst names = ['None'];\n\t\t\tfor (let i of resE) {\n\t\t\t\tnames.push(i.employeeName);\n\t\t\t}\n\t\t\treturn names;\n\t\t}\n\t});\t\n\tlet roleId;\n\tfor (let i of resR) {\n\t\tif (i.title === answerR.role) {\n\t\t\troleId = i.id;\n \t\t}\n\t}\t\n\tlet managerId;\n\tfor (let i of resE) {\n\t\tif (i.employeeName === answerE.employee) {\n\t\t\tmanagerId = i.id;\n\t\t}\n\t}\t\n\tawait queryAsync('INSERT INTO employee SET ?', { firstName: answerR.firstName, lastName: answerR.lastName, roleId: roleId, managerId: managerId});\n\tconsole.log(chalk.bold.bgCyan('\\nSUCCESS:'), 'Employee was added.');\n\tviewEmployees();\n}", "async function addRole () {\n \n try {\n const newRole = await inquirer.prompt([{\n name: 'title',\n type: 'input',\n message: 'Please enter new role title!',\n },\n {\n name: 'salary',\n type: 'input',\n message: 'Please enter new role salary!',\n },\n {\n name: 'department_id',\n type: 'input',\n message: 'Please enter new role department id!',\n }])\n \n \n const addedRole = await connection.addRoleNow(newRole);\n console.log(addedRole);\n \n } catch(err) {\n console.log(err);\n }\n \n employeeChoices(); \n \n }", "function addRole() {\n inquirer\n .prompt([\n {\n name: \"title\",\n type: \"input\",\n message: \"What is the role you would like added?\"\n },\n {\n name: \"salary\",\n type: \"input\",\n message: \"What is this role's salary?\"\n },\n {\n name: \"department\",\n type: \"list\",\n choices: departmentsarray,\n message: \"Please select which department this role belongs to\"\n }\n ])\n .then(function(answer) {\n if (answer.salary === isNaN) {\n console.log(\"You must enter a valid number\")\n } else {\n connection.query(\n \"INSERT INTO person_role SET ?\",\n {\n title: answer.title,\n salary: answer.salary,\n department_id: answer.department[0]\n },\n function(err) {\n if (err) throw err;\n console.log(chalk.blue(\"The role was added successfully!\"));\n start();\n }\n );\n };\n });\n}", "function createRole(roleTitle, roleSalary, deptID) {\n connection.query('INSERT INTO roles SET ?',\n {\n title: `${roleTitle}`,\n salary: `${roleSalary}`,\n department_id: `${deptID}`,\n },\n (err, res) => {\n if (err) throw err;\n }\n ); \n}", "function insertNewRole() {\n connection.query (\n // Insert the new departmenet\n `INSERT INTO role_table (\n employee_role_title,\n employee_salary,\n department_id\n ) VALUES\n (\"${newRoleTitle}\", ${newRoleSalary}, ${newRoleDepartmentID});`\n ,\n // Log the result\n (err, res) => {\n // If error log error\n if (err) throw err;\n // Otherwise Log success and display the added department\n console.log(`You have successfully added ${newRoleTitle} to the roles database!`);\n // Then call the view Roles function to display the latest data (this will also run into task completed)\n viewRoles();\n }\n )\n }", "function addRole(obj) {\n console.log(\"Inserting a new role\");\n connection.query(\"INSERT INTO employee_role SET ?\", obj, function(err, res) {\n if (err) throw err;\n console.log(`${res.affectedRows} role inserted! \\n`);\n });\n connection.query(\"SELECT * from employee_role\", function(err, res) {\n if (err) throw err;\n const newTable = table.getTable(res);\n console.log(newTable);\n });\n console.clear();\n initiation();\n}", "function addRole() {\n // prompt the user for info about the role\n inquirer\n .prompt([\n {\n name: \"title\",\n type: \"input\",\n message: \"What is the title of the role that you want to add?\",\n },\n {\n name: \"salary\",\n type: \"input\",\n message: \"What is the salary for the role that you want to add?\",\n },\n {\n name: \"department_id\",\n type: \"input\",\n message: \"What is the department_id for the role that you want to add?\",\n },\n ])\n .then(function (answer) {\n // when finished prompting, insert a new role into the db with that info\n connection.query(\n \"INSERT INTO role SET ?\",\n {\n title: answer.title,\n salary: answer.salary,\n department_id: answer.department_id,\n },\n function (err) {\n if (err) throw err;\n console.log(\"Your role was created successfully!\");\n // display the new list of roles and re-prompt the user.\n viewRole();\n }\n );\n });\n}", "getRole() {\n this.role = 'Employee';\n }", "addEmployee(firstName, lastName, roleId, managerId) {\n\t\ttry {\n\t\t\tthis.connection.query(\n\t\t\t\t\"INSERT INTO employee SET ?\",\n\t\t\t\t{\n\t\t\t\t\tfirst_name: `${firstName}`,\n\t\t\t\t\tlast_name: `${lastName}`,\n\t\t\t\t\trole_id: `${roleId}`,\n\t\t\t\t\tmanager_id: `${managerId}`,\n\t\t\t\t},\n\t\t\t\tfunction (err, res) {\n\t\t\t\t\tif (err) throw err;\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t`\\nSuccessfully added employee with firstName:${firstName}, lastName:${lastName}, roleId:${roleId}, managerId:{managerId}`\n\t\t\t\t\t);\n\t\t\t\t\treturn res;\n\t\t\t\t}\n\t\t\t);\n\t\t} catch (err) {\n\t\t\tconsole.log(\"Error inserting role : \" + err);\n\t\t}\n\t}", "async function addRole(obj) {\n // take the information from the prompts and apply it\n // need to grab the deptId first\n const id = await getDepartmentId(obj.roleDepartment);\n \n // set up insert statement based on the supplied information\n const sql = `\n INSERT INTO role (title, salary, department_id)\n VALUES (?,?,?)\n `;\n const params = [obj.roleName, obj.roleSalary, id];\n const row = await db.query(sql, params);\n console.log('\\x1b[1m\\x1b[33m%s\\x1b[40m\\x1b[0m', `${obj.roleName} has been added to the role table.\\nChoose View All Roles to see the new role.`);\n}", "function addRole() {\n console.log(\" ---------------- \\n ADD A ROLE \\n ----------------\");\n connection.query(\n \"SELECT r.title AS 'Title', r.id AS 'Id', r.department_id, d.id AS 'DeptId', d.name AS 'Department' FROM role r INNER JOIN department d ON d.id = r.department_id ORDER BY r.title;\",\n function (err, res) {\n if (err) throw err;\n const depResults = [];\n const depIdResults = [];\n for (let i = 0; i < res.length; i++) {\n // simply for CLI UI to display list of existing employees to choose to update\n let depObj = res[i].Department;\n depResults.push(depObj);\n // for comparing inquirer selected employee string to set manager id to correct employee\n let depIdObj = {\n department: res[i].Department,\n deptid: res[i].DeptId,\n };\n depIdResults.push(depIdObj);\n }\n inquirer\n .prompt([\n {\n name: \"title\",\n type: \"input\",\n message: \"Enter the new job role's title.\",\n },\n {\n name: \"salary\",\n type: \"input\",\n message: \"Enter the annual base salary for the new role.\",\n },\n {\n name: \"department\",\n type: \"list\",\n message: \"Select the department to which this role belongs.\",\n choices: depResults,\n },\n ])\n .then((answers) => {\n let chosenDepId;\n // Setting chosenDepId var to department_id that matches the department name selected\n for (let i = 0; i < depIdResults.length; i++) {\n if (depIdResults[i].department == answers.department) {\n chosenDepId = depIdResults[i].deptid;\n }\n }\n connection.query(\n \"INSERT INTO role SET ?\",\n [\n {\n title: answers.title,\n salary: answers.salary,\n department_id: chosenDepId,\n },\n ],\n function (error) {\n if (error) throw err;\n console.clear();\n console.log(\"NEW ROLE ADDED SUCCESSFULLY!\");\n actions();\n }\n );\n });\n }\n );\n}", "function addRole(name) {\n var description = \"\";\n var passive = false;\n var critical = false;\n var aggressive = false;\n\n // This is a short description used for giving the gist of the role\n switch(name) {\n case \"Villager\":\n description = \"The Villager is the basic role that has no active abilities.\";\n passive = true;\n critical = true;\n break;\n case \"Werewolf\":\n description = \"The Werewolf is the role that is against the villagers, and can kill people at night.\";\n critical = true;\n break;\n case \"Doctor\":\n description = \"The Doctor is a active villager role that can save people at night from Werewolves.\";\n break;\n case \"Seer\":\n description = \"The Seer is an active villager role that can check for werewolves at night.\";\n break;\n case \"Knight\":\n description = \"The Knight is a passive villager role that cannot be killed by werewolves at night\";\n passive = true;\n break;\n case \"Saint\":\n description = \"The Saint is a passive villager role that, if lynched, takes the nominator with them.\";\n passive = true;\n aggressive = true;\n break;\n case \"Witch\":\n description = \"The Witch is an active villager role that can silence people at night.\";\n aggressive = true;\n break;\n default:\n description = \"This role does not have a description written for it yet.\";\n passive = true;\n }\n\n Roles.insert({\n _id: name.toLowerCase(),\n name: name,\n votes: 0,\n enabled: critical,\n critical: critical,\n passive: passive,\n aggressive: aggressive,\n target: 0,\n shortDescription: description\n });\n}", "async function addEmployee() {\n const roles = await db.findAllRoles();\n const employees = await db.findAllEmployees();\n\n const employee = await prompt([{\n name: \"first_name\",\n message: \"What is the employee's first name?\"\n },\n {\n name: \"last_name\",\n message: \"What is the employee's last name?\"\n }\n ]);\n /*===============================================================================\n\n ROLE CHOICES\n\n ================================================================================*/\n const roleChoices = roles.map(({\n id,\n title\n }) => ({\n name: title,\n value: id\n }));\n\n const {\n roleId\n } = await prompt({\n type: \"list\",\n name: \"roleId\",\n message: \"what is the employee's role?\",\n choices: roleChoices\n });\n\n employee.role_id = roleId;\n /*===============================================================================\n\n MANAGER CHOICES\n\n ================================================================================*/\n const managerChoices = employees.map(({\n id,\n first_name,\n last_name\n }) => ({\n name: `${first_name} ${last_name}`,\n value: id\n }));\n managerChoices.unshift({\n name: \"None\",\n value: null\n });\n\n const {\n managerId\n } = await prompt({\n type: \"list\",\n name: \"manager\",\n message: \"Who is the employee's manager?\",\n choices: managerChoices\n });\n employee.manager_id = managerId;\n await db.createEmployee(employee);\n console.log(`Added ${employee.first_name} ${employee.last_name} to the database`);\n startPrompt();\n}", "function addRoles() {\n var roleQ = [\n {\n type: \"input\",\n message: \"What role would you like to add?\",\n name: \"title\"\n },\n {\n type: \"input\",\n message: \"Which department is the role in?\",\n name: \"id\"\n },\n {\n type: \"input\",\n message: \"What is the salary for the new role?\",\n name: \"salary\"\n }\n ]\n inquirer.prompt(roleQ).then(function (answer) {\n connection.query(\n \"INSERT INTO role SET ?\",\n {\n title: answer.title,\n department_id: answer.id,\n salary: answer.salary\n },\n function (err, res) {\n if (err) throw err\n beginTracker()\n }\n )\n })\n}", "function addEmployee() {\n inquirer.prompt([\n {\n message:'Enter new employees first name',\n name:'first',\n },\n {\n message:'Enter new employees last name?',\n name:'last',\n },\n {\n message:'Enter new employees role number.',\n name:'role',\n },\n {\n message:'Enter Employee Manager Number',\n name:'manager',\n }\n ]).then((newData) =>{\n var query = connection.query(\n \"INSERT INTO employee SET ?\",\n {\n firstName: newData.first,\n lastName: newData.last,\n role_id: newData.role,\n manager_id: newData.manager\n },\n (err, res) => {\n if (err) throw err;\n console.log(res.affectedRows + \" Roles created!\\n\");\n }\n );\n restartProcess()\n});\n}", "_setRole() {}", "function addEmployee() {\n // Declare some local variables to utilize when inserting this into the DB\n let newEmployeeFirstName;\n let newEmployeeLastName;\n let newEmployeeRoleObject;\n let newEmployeeRoleID;\n // Add an escape option to the choices array\n currentRoleNames.push(\"I dont see the role for this employee shown here\")\n // Prompt them to answer some additional questions about what role they want to add..\n addEmployeePrompt()\n // Then use the response to prepare variables for use in inserting new content to the DB...\n .then(response => {\n // If they needed to exit to create a new role first...\n if (response.newEmployeeRole === \"I dont see the role for this employee shown here\"){\n // Tell them what to do next...\n console.log(`\\n No problem! Please make sure to add the role from the main menu before coming back to create this employee!\\n`);\n // Return them to the main prompt\n startMainPrompt();\n }\n // Otherwise if they had all the info they needed....\n else{\n // Prepare the appropriate inputs as variables...\n newEmployeeFirstName = response.newEmployeeFirstName;\n newEmployeeLastName = response.newEmployeeLastName;\n newEmployeeRole = response.newEmployeeRole;\n newEmployeeRoleObject = currentRoles.find(obj=>obj.employee_role_title===newEmployeeRole);\n newEmployeeRoleID = newEmployeeRoleObject.id;\n // And call the function to insert the new role into the role_table...\n insertNewEmployee();\n } \n })\n // If there is an error, log the error\n .catch(err => {if (err) throw err});\n // Insert the appropriate data to the DB...\n function insertNewEmployee() {\n connection.query (\n // Insert the new departmenet\n `INSERT INTO employee_table (\n employee_firstname,\n employee_lastname,\n role_id,\n manager_id\n ) VALUES\n (\"${newEmployeeFirstName}\", \"${newEmployeeLastName}\", ${newEmployeeRoleID}, 1);` // Come back to manager id when its more clear how this works from the demo. hardcoding to arty B.\n ,\n // Log the result\n (err, res) => {\n // If error log error\n if (err) throw err;\n // Otherwise give a success message to the user\n console.log(`\\nYou have added ${newEmployeeFirstName} ${newEmployeeLastName} to the employee database!\\n`);\n // Then call the view All function so they can see the results of their added employee reflected in the table\n viewAll();\n }\n )\n }\n\n }", "createRole(existingRoles, application, role) {\n\t const existingRole = _.find(existingRoles, { applicationId: application.id, name: role.name });\n\t if (existingRole) {\n\t return Promise.resolve(true);\n\t }\n\n\t const payload = {\n\t name: role.name,\n\t description: role.description,\n\t applicationType: 'client',\n\t applicationId: application.id\n\t };\n\n\t return request.post({ uri: process.env.AUTHZ_API_URL + '/roles', json: payload, headers: { 'Authorization': 'Bearer ' + this.accessToken } })\n\t .then((createdRole) => {\n\t existingRoles.push(createdRole);\n\t log(chalk.green.bold('Role:'), `Created ${role.name}`);\n\t return role;\n\t });\n\t}", "function addRole() {\n connection.query(\"SELECT * FROM employee\", function (err, results) {\n if (err) throw err;\n\n inquirer\n .prompt([\n {\n name: \"newRole\",\n type: \"input\",\n message: \"What is the new role going to be?\"\n },\n\n {\n name: \"salary\",\n type: \"list\",\n choices: [50000, 70000, 90000],\n message: \"What is the starting salary?\"\n }\n ])\n .then(function (answer) {\n connection.query(\"INSERT INTO role SET ?\",\n {\n title: answer.newRole,\n salary: answer.salary\n })\n console.log(\"Role Added\");\n console.log(\"------------------\");\n mainMenu()\n })\n })\n}", "function roleAdd() {\n return inquirer.prompt([\n {\n type: \"input\",\n name: \"title\",\n message: \"What is the role title?\"\n },\n {\n type: \"input\",\n name: \"salary\",\n message: \"What is their salary?\"\n },\n {\n type: \"input\",\n name: \"department_id\",\n message: \"What is the department ID?\"\n }\n ]);\n}", "createRole() {\n // collect role data from user\n inquirer.prompt([\n questions.functions.deptId,\n questions.role.title,\n questions.role.salary\n ])\n // send results to add role function\n .then((results) => {\n dbFunctions.addRole(results)\n console.log('\\n Successfully added role! \\n')\n startManagement()\n })\n\n }", "function addRole(x) {\n this.forEach(function (user) {\n user.role = x\n });\n return this;\n}", "function addRoles() {\n inquirer\n .prompt([\n {\n type: \"input\",\n message: \"What is the name of the roles?\",\n name: \"rolesName\",\n },\n {\n type: \"input\",\n message: \"What is the salary for the roles?\",\n name: \"salaryTotal\",\n },\n {\n type: \"input\",\n message: \"In which department should we place this role?\",\n name: \"departmentID\",\n },\n ])\n .then(function (answer) {\n connection.query(\n \"INSERT INTO roles (title, salary, department_id) VALUES (?, ?, ?)\",\n [answer.rolesName, answer.salaryTotal, answer.departmentID],\n function (err, res) {\n if (err) throw err;\n console.table(res);\n start();\n }\n );\n });\n }", "addANewRole(adr) {\n\t\tconst query = `\n\t\t INSERT INTO\n\t\t staffrole\n\t\t SET ?\n\t\t`;\n\t\tconst post = {\n\t\t\ttitle: adr[0],\n\t\t\tsalary: adr[1],\n\t\t\tdepartment_id: adr[2],\n\t\t};\n\t\treturn this.connection.query(query, post);\n\t}", "function createRole() {\n\tshowSpinner(\"modalSpinnerRole\");\n\tvar json = null;\n\tvar roleName = document.getElementById(\"roleName\").value;\n\tvar boxName = null;\n\tvar dropDown = document.getElementById(\"dropDownBox\");\n\tvar isRoleCreationAllowed = false;\n\tif (dropDown.selectedIndex > 0 ) {\n\t\tboxName = dropDown.options[dropDown.selectedIndex].title;\n\t}\n\tif (roleValidation(roleName, \"popupRoleErrorMsg\")) {\n\t\t\n\t\tif (validateBoxDropDown()) {\n\t\t\tvar baseUrl = getClientStore().baseURL;\n\t\t\tvar accessor = objCommon.initializeAccessor(baseUrl,cellName,\"\",\"\");\n\t\t\tif(boxName == null || boxName == \"\" || boxName == 0) {\n\t\t\t\tboxName = undefined;\n\t\t\t}\n\t\t\tjson = {\"Name\" : roleName,\"_Box.Name\" : boxName};\n\t\t\tvar objJRole = new _pc.Role(accessor, json);\n\t\t\tvar objRoleManager = new _pc.RoleManager(accessor);\n\t\t\t\n\t\t\ttry {\n\t\t\t\t objRoleManager.retrieve(roleName,boxName);\n\t\t\t}\n\t\t\tcatch (exception) {\n\t\t\t\tisRoleCreationAllowed = true;\n\t\t\t}\n\t\t\t\n\t\t\t//var success = isExist(check, accessor, objJRole, objRoleManager);\n\t\t\tif (isRoleCreationAllowed) {\n\t\t\t\tobjRoleManager.create(objJRole);\n\t\t\t\tdisplayRoleCreateMessage (roleName);\n\t\t\t} else {\n\t\t\t\tvar existMessage = getUiProps().MSG0007;\n\t\t\t\tdocument.getElementById(\"popupRoleErrorMsg\").innerHTML = existMessage;\n\t\t\t\t$(\"#roleName\").addClass(\"errorIcon\");\n\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\n\tremoveSpinner(\"modalSpinnerRole\");\n}", "function insertRole(title, salary, departmentID){\n connection.query(\"INSERT INTO role SET ?\",\n {\n title: title,\n salary: salary,\n department_ID: departmentID\n },\n function(err, res){\n init()\n })\n }", "async function addRole(title, salary, department) {\n const depId = await getDepartmentId(department);\n const query = `\n INSERT INTO role (title, salary, department_id)\n VALUES (\"${title}\", ${salary}, ${depId})`;\n updateDB(query);\n}", "function addRole() {\n inquirer.prompt(\n [\n {\n type: \"input\",\n message: \"What is the title of this role?\",\n name: \"title\",\n },\n {\n type: \"number\",\n message: \"How much is the salary?\",\n name: \"salary\",\n },\n {\n type: \"number\",\n message: \"What is the department ID?\",\n name: \"departmentID\",\n },\n ]\n ).then(answer => {\n connection.query(\"insert into role(title,salary,department_id) values(?,?,?)\", [answer.title, answer.salary, answer.departmentID], function (error) {\n console.log(\"Role added!\")\n init()\n })\n })\n}", "function addRole(_data) {\n inquirer\n .prompt([\n {\n name: \"name\",\n type: \"input\",\n message: \"Please type in name of new role\"\n \n },\n {\n name: \"id\",\n type: \"input\",\n message: \"What id postion is your new role in\"\n \n },\n {\n name: \"salary\",\n type: \"input\",\n message: \"What is the salary of new role?\",\n \n },\n {\n name: \"department_id\",\n type: \"list\",\n message: \"Which department is the new role in?\",\n },\n ])\n .then(function(res) {\n connection.query(\n \"INSERT INTO roles SET ?\",\n {\n title: res.name,\n salary: res.salary,\n id: res.id,\n department_id: res.id\n },\n function(error, _res) {\n console.log(error);\n if (error) throw error;\n }\n );\n })\n .then(function() {\n console.log(`--This role has been added!--`);\n })\n .then(function() {\n start();\n });\n}", "function addRoleToDb(role) {\n const user = netlifyIdentity.currentUser();\n const userSchema = {\n 'name': user.user_metadata.full_name,\n 'email': user.email,\n 'role': role,\n };\n\n fetch('/.netlify/functions/add-user', {\n method: \"POST\",\n body: JSON.stringify(userSchema)\n })\n .then(response => {\n if (!response.ok) {\n return response\n .text()\n .then(err => {throw(err)});\n };\n\n response.text().then(function(result) {\n console.log('Aded user to the database');\n });\n })\n .catch(err => console.error(err));\n}", "function addEmRole() {\n inquirer.prompt([\n {\n type: \"input\",\n name: \"Title\",\n message: \"Please enter the title of the position.\"\n },\n {\n name: \"Salary\",\n type: \"input\",\n message: \"Please enter the salary for this role.\"\n },\n {\n name: \"DepartmentID\",\n type: \"input\",\n message: \"What is the department id for this role? Please enter a number. \\n1. Sales \\n2. Finance \\n3. Engineering \\n4. Legal \\n\"\n }\n ]).then((userInput) => {\n connection.query(\"INSERT INTO role SET ?\", \n { \n title: userInput.Title, \n salary: userInput.Salary, \n department_id: userInput.DepartmentID\n }, \n function(err, result) {\n if (err) {\n throw err;\n } else {\n console.log(\"New role added!\");\n console.table(userInput); \n beginApp();\n }\n });\n });\n}", "function insertUpdatedEmployeeRole() {\n connection.query (\n // Update the role volue for the specified employee\n `UPDATE employee_table\n SET\n role_id = ${updatedRoleID}\n WHERE\n id = ${updatedEmployeeID};`\n ,\n // Log the result\n (err, res) => {\n // If error log error\n if (err) throw err;\n // Otherwise give a success message to the user\n console.log(`Success`)\n // Then call the view All function so they can see the added value\n viewAll();\n }\n )\n }", "function createEmployee() {\n // add an Engineer or Intern?\n inquirer.prompt(questions.employee).then((employeeRole) => {\n switch (employeeRole.empRole) {\n case \"Engineer\":\n inquirer.prompt(questions.engineer).then((engResponses) => {\n let newEngineer = new Engineer(\n engResponses.engName,\n engResponses.engId,\n engResponses.engEmail,\n engResponses.engGithub\n );\n employees.push(newEngineer);\n console.log(\"New engineer has been added to the team: \", newEngineer);\n confirmEmployee();\n });\n break;\n case \"Intern\":\n inquirer.prompt(questions.intern).then((internResponses) => {\n let newIntern = new Intern(\n internResponses.internName,\n internResponses.internId,\n internResponses.internEmail,\n internResponses.internSchool\n );\n employees.push(newIntern);\n console.log(\"New intern has been added to the team: \", newIntern);\n confirmEmployee();\n });\n break;\n }\n });\n}", "function addRole() {\n inquirer\n .prompt([\n {\n name: \"role_type\",\n type: \"input\",\n message: \"What would you like the new Role to be?\"\n },\n {\n name: \"salary\",\n type: \"input\",\n message: \"What is the expected salary?\"\n },\n {\n name: \"department\",\n type: \"input\",\n message: \"What will be the new department?\"\n //change to adding department based on role later\n }\n ])\n .then(function (answer) {\n connection.query(\"INSERT INTO role(role_type, salary, department_id) VALUES (?,?,?) \", [answer.role_type, answer.salary, answer.department],\n function (err) {\n if (err) throw err;\n console.log(\"Added new role to database successfully\");\n initialize();\n }\n );\n });\n}", "function addRole() {\n db.viewAllDepartments()\n .then(([ans]) => {\n let departments = ans;\n const departmentChoices = departments.map(({\n id,\n name\n }) => ({\n name: name,\n value: id\n }));\n\n inquirer\n .prompt([{\n type: 'input',\n name: 'title',\n message: 'What is the name of the new role?'\n },\n {\n type: 'input',\n name: 'salary',\n message: 'What is the salary for this new role?'\n },\n {\n type: \"list\",\n name: 'all_departments',\n message: 'Which department does this new role belong to?',\n choices: departmentChoices\n }\n ])\n .then((ans) => {\n let role = ans;\n db.addNewRole(role)\n .then(() => console.log(`Added ${role.title} to the database`));\n mainPrompts();\n });\n\n });\n}", "function addRoleHandler() {\n var newRole;\n\n newRole = new Role();\n // add the currently selected Role to the org role collection\n newRole.ID = $(\"#masterRoleList\").find('option:selected').val();\n newRole.Name = $(\"#masterRoleList\").find('option:selected').text();\n newRole.Description = \"\";\n // Check to make sure the selected role is not already active for the current organization\n if ($.inArray(newRole.Name, roleNameCollection) == -1) {\n roleIDCollection.push(newRole.ID);\n roleNameCollection.push(newRole.Name);\n roleCollection.push(newRole);\n // Add the current role to the new roles collection. This will be used to save changes\n newRoles.push(newRole);\n $(\"<option value='\" + newRole.ID + \"'></option>\").text(newRole.Name).appendTo($('#orgRoleList'));\n }\n else {\n alert(\"The current selected role has already been added and cannot be added again\");\n }\n }", "function addRoleHandler() {\n var newRole;\n\n newRole = new Role();\n // add the currently selected Role to the org role collection\n newRole.ID = $(\"#masterRoleList\").find('option:selected').val();\n newRole.Name = $(\"#masterRoleList\").find('option:selected').text();\n newRole.Description = \"\";\n // Check to make sure the selected role is not already active for the current organization\n if ($.inArray(newRole.Name, roleNameCollection) == -1) {\n roleIDCollection.push(newRole.ID);\n roleNameCollection.push(newRole.Name);\n roleCollection.push(newRole);\n // Add the current role to the new roles collection. This will be used to save changes\n newRoles.push(newRole);\n $(\"<option value='\" + newRole.ID + \"'></option>\").text(newRole.Name).appendTo($('#orgRoleList'));\n }\n else {\n alert(\"The current selected role has already been added and cannot be added again\");\n }\n }", "function newRole() {\n return inquirer.prompt({\n message:'Add member to the team?',\n name: 'add',\n type: 'list',\n choices: ['Yes', 'No']\n }).then(answers => {\n if (answers.add == 'Yes') {\n promptRole()\n }else if (answers.add == 'No') {\n\n fs.writeFile(outputPath, render(employees), function (err) {\n if (err) {\n throw err\n }\n })\n console.log('all done!')\n }\n }).catch(error => {\n if (err) {\n console.log(error)\n \n }\n })\n}", "function createEmployee()\n {\n inquirer.prompt(employeePrompt).then(data => {\n if(data.role===\"Exit\")\n {\n \n renderHTML();\n console.log(\"Team Profile Generated\");\n }\n if(data.role===\"Manager\")\n {\n employees.push(new Manager(data.name, data.id, data.email, data.officeN));\n createEmployee();\n }\n if(data.role===\"Engineer\")\n {\n employees.push(new Engineer(data.name, data.id, data.email, data.github));\n createEmployee();\n }\n if(data.role===\"Intern\")\n {\n employees.push(new Intern(data.name, data.id, data.email, data.school));\n createEmployee();\n \n }\n \n });\n }", "getRole(ex, number) {\n ex.role = 'Manager';\n ex.officeNumber =`Office Number: ${number}`;\n }", "function addRolePrompt () {\n return inquirer.prompt ([\n {\n type: \"list\",\n name: \"newRoleTitle\",\n message: \"What role would you like to add?\",\n choices: [\n \"Owner\", \n \"Head Coach\",\n \"Assistant Coach\",\n \"Backup Player\",\n \"QB\",\n \"RB\",\n \"OL\",\n \"WR\",\n \"TE\",\n \"DB\",\n \"S\",\n \"LB\",\n \"DL\",\n \"K\",\n \"P\"\n ]\n },\n {\n type: \"list\",\n name: \"newRoleSalary\",\n message: \"What is the salary range for this role?\",\n choices: [\n 100.000,\n 200.000,\n 300.000,\n 400.000,\n 500.000,\n 600.000,\n 700.000,\n 800.000,\n 900.000\n ]\n },\n {\n type: \"list\",\n name: \"newRoleDepartment\",\n message: \"What departmenet will this role reside within? (If the department does not exist yet, please select that you dont see it and create a new department first)\",\n choices: currentDepartmentNames\n }\n \n ])\n }", "function addRole() {\n connection.query(\n \"SELECT name FROM department\",\n function (err, res) {\n if (err) throw err;\n inquirer.prompt([{\n type: 'input',\n name: 'role',\n message: \"Please type in the new role.\",\n },\n {\n type: 'input',\n name: 'salary',\n message: \"Please type in this role's salary.\",\n },\n {\n name: \"department\",\n type: \"list\",\n choices: function () {\n\n return res.map((department) => ({\n name: department.name\n\n }));\n\n },\n message: \"Please select the department for this role.\"\n }\n ]).then((response) => {\n var role = response.role;\n var salary = response.salary;\n var dept = response.department;\n connection.query(\n \"INSERT INTO roles (title, salary, department_id) VALUES ('\" + role + \"', '\" + salary + \"', (select deptid from department where name = '\" + dept + \"'))\",\n function (err, res) {\n if (err) throw err;\n console.log(chalk.green(\"Role Successfully Added!\"))\n reroute();\n })\n })\n })\n}", "getRole() {\n\t\treturn \"Employee\";\n\t}", "function addRoles() {\n const query = 'SELECT * FROM department';\n\n connection.query(query, (err, res) => {\n if (err) throw err;\n\n inquirer\n .prompt([{\n type: 'input',\n message: `What is the title of the new role?`,\n name: 'newRole',\n },\n {\n type: 'input',\n message: `What is the new role's salary?`,\n name: 'salary',\n },\n {\n type: 'list',\n message: `Which department is this role under?`,\n name: 'department',\n choices() {\n const choiceArray = [];\n res.forEach(({ name }) => {\n choiceArray.push(name);\n });\n return choiceArray;\n },\n },\n ])\n .then((response) => {\n connection.query(`SELECT department.id, department.name FROM department`, (err, res) => {\n if (err) throw err;\n\n let departmentInfo = res.filter((id) => {\n return response.department == id.name\n });\n let departmentID = JSON.parse(JSON.stringify(departmentInfo))[0].id;\n addDepartmentAndInfo(departmentID, response);\n })\n })\n })\n}", "function addRoles() {\n inquirer.prompt([\n {\n name: \"Title\",\n type: \"input\",\n message: \"What is the Title of the role to add?\"\n },\n {\n name: \"Salary\",\n type: \"input\",\n message: \"What is the Salary?\"\n }\n ]).then(function (response) {\n //connecting query to add title, salary\n connection.query(\n \"INSERT INTO role SET ?\",\n {\n title: response.Title,\n salary: response.Salary,\n },\n\n function (err) {\n if (err) throw err\n console.table(response);\n startQuestions();\n }\n )\n })\n}", "function addEmployee() {\n connection.query('SELECT * FROM role', function (err) {\n if (err) throw err;\n \n inquirer.prompt([\n {\n message: \"What is the employee's first name?\",\n type: \"input\",\n name: \"first_name\"\n },\n {\n message: \"What is the employee's last name?\",\n type: \"input\",\n name: \"last_name\"\n },\n {\n message: \"What is the employee's role ID?\",\n type: \"number\",\n name: \"roleID\"\n },\n {\n message: \"What is the employee's manager ID?\",\n type: \"number\",\n name: \"manager_id\"\n }\n ]).then(function(res) {\n connection.query('INSERT INTO employee (first_name, last_name, role_id, manager_id) VALUES (?, ?, ?, ?)', [res.first_name, res.last_name, res.roleID, res.manager_id], function(err) { \n if(err) throw err;\n console.log('Employee added to roster!');\n start();\n })\n });\n });\n}", "getRole(){}", "function addRoles(){\n inquirer.prompt([\n {\n name: \"title\",\n massage: \"Enter Job Title:\",\n type: \"input\",\n validate : validateInput\n },\n {\n name: \"salary\",\n massage: \"Enter Salary:\",\n type: \"input\",\n validate : validateInput\n\n },\n {\n name: \"department_id\",\n massage: \"Enter department ID:\",\n type: \"input\",\n validate : validateInput\n }\n\n]).then(answer => {\n connection.query(\"INSERT INTO role (title, salary, department_id) VALUES (?, ?, ?)\",\n [answer.title, answer.salary, answer.department_id,],\n function(err){\n if (err)throw err;\n renderAction();\n });\n})\n}", "function insertEmployee(roleID, managerID) {\n connection.query(\"INSERT INTO employee SET ?\",\n {\n first_name: firstName,\n last_name: lastName,\n role_id: roleID,\n manager_id: managerID\n },\n function(err, res){\n init()\n })\n console.log(\"Employee has been added\")\n }", "function addEmpRole(){\n console.log(\"\\nEnter Role related information as per the prmopts:\");\n\n inquirer.prompt([\n {\n type: \"input\",\n name: \"title\",\n message: \"Enter information on Title you want added to the Role Table:\"\n },\n {\n type: \"input\",\n name: \"salary\",\n message: \"Enter Salary of the Role:\"\n },\n {\n type: \"input\",\n name: \"deptId\",\n message: \"Enter the Dept-ID of this Role:\"\n }\n ]).then(function(answer){\n console.log(\"\\nInserting Role...\\n\");\n connection.query(\n \"INSERT INTO role SET ?\",\n {\n title : answer.title,\n salary: answer.salary,\n department_id: answer.deptId\n },\n function(err, res) {\n if(err){\n console.log(\"Error while inserting data into Role Table: \" + err);\n } else {\n console.log(res.affectedRows + \"role inserted!\\n\");\n }\n continuePrompt();\n }\n )\n });\n}", "function createEmployee() {\n // add an Engineer or Intern?\n inquirer.prompt(userPrompts.employee).then((employeeRole) => {\n switch (employeeRole.employeeRole) {\n case \"Engineer\":\n inquirer.prompt(userPrompts.engineer).then((engResponses) => {\n let newEngineer = new Engineer(\n engResponses.engineerName,\n engResponses.engineerId,\n engResponses.engineerEmail,\n engResponses.engineerGithub\n );\n employees.push(newEngineer);\n console.log(\"An engineer has been addred to the team: \", newEngineer);\n confirmEmployee();\n });\n break;\n case \"Intern\":\n inquirer.prompt(userPrompts.intern).then((internResponses) => {\n let newIntern = new Intern(\n internResponses.internName,\n internResponses.internId,\n internResponses.internEmail,\n internResponses.internSchool\n );\n employees.push(newIntern);\n console.log(\"An intern has been added to the team: \", newIntern);\n confirmEmployee();\n });\n break;\n }\n });\n}", "function updateRole(newRoleId, empId) {\n let sql = `UPDATE employee SET employee.role_id = ? WHERE employee.id = ?`;\n db.query(sql, [newRoleId, empId], (error) => {\n if (error) throw error;\n console.log(chalk.white.bold(`====================================================================================`));\n console.log(chalk.white.bold( ` Employee Role Successfully Updated `));\n console.log(chalk.white.bold(`====================================================================================`));\n // Display Employees by Role Table\n viewEmpByRole();\n });\n}", "function createUserrole( pData){\n console.log(\"Sending -->createUserrole \");\n// var userflname = pData.firstName.concat(' ').concat(pData.lastName);\n manageUsersService.createUserrole( pData).then(function (response) {\n console.log(\"Received response from server:\", response)\n if (response.statusCode == 400) {\n // Raise Success Message\n console.log('HelpDesk UserRoles::Success:--->');\n\n } else {\n // Raise Error Message\n console.log('HelpDesk UserRoles::Error:--->');\n }\n });\n }", "function addRole() {\n inquirer\n .prompt([\n {\n name: \"title\",\n type: \"input\",\n message: \"What is the role title?\",\n },\n {\n name: \"salary\",\n type: \"input\",\n message: \"What is this roles salary?\",\n validate: function (value) {\n let valid = !isNaN(value);\n return valid || \"Please enter a number\";\n },\n },\n {\n name: \"department_id\",\n type: \"input\",\n message: \"What is this role's department ID?\",\n },\n ])\n .then((answer) => {\n console.log(\"Adding a new role...\\n\");\n connection.query(\n `INSERT INTO roles SET ?`,\n {\n title: answer.title,\n salary: answer.salary,\n department_id: answer.department_id,\n },\n function (err, res) {\n if (err) throw err;\n console.log(\"New role added!\\n\");\n // Call updateProduct AFTER the INSERT completes\n initTracker();\n }\n );\n });\n}", "create(req, res) {\n return roles\n .create({\n rol: req.body.rol,\n })\n .then(roles => res.status(201).send(roles))\n .catch(error => res.status(400).send(error))\n }", "function addRole() {\n inquirer.prompt([{\n name: 'title',\n type: 'input',\n message: 'Enter the role title: '\n },\n {\n name: 'salary',\n type: 'number',\n message: 'Enter the roles salary: ',\n ...validateNumbers()\n },\n {\n name: 'department',\n type: 'list',\n message: 'Select a department: ',\n choices: queryDepartments()\n }\n ])\n .then(response => {\n\n // get department ID\n connection.query('SELECT id FROM department WHERE department_name = ?', [response.department], (error, result) => {\n\n if (error) throw error;\n result.forEach(id => {\n resId = id.id;\n })\n\n // add the role into the database\n connection.query(insertRole, {\n title: response.title,\n salary: response.salary,\n department_id: resId\n }, (error) => {\n if (error) throw error;\n })\n\n getRoles();\n })\n })\n}", "function addRole() {\n console.log('time to add a role')\n // using inquirer to ask user input questions\n inquirer.prompt([\n {\n message: \"What type of role would you like to add?\",\n type: \"input\",\n name: \"title\"\n },\n {\n message: \"Please enter a salary for your role:\",\n type: \"number\",\n name: \"salary\" \n },\n {\n message: \"Please enter a department ID for this role:\",\n type: \"number\",\n name: \"department_id\" \n },\n ]).then(answers => {\n // using mysql syntax to insert new role designated by user input to the role table\n connection.query(\"INSERT INTO role (title, salary, department_id) values (?, ?, ?)\", [answers.title, answers.salary, answers.department_id], function(err, res) {\n startQuestions();\n })\n })\n}", "function addEmployee() {\n let roleArray = [];\n let employeeArray = [{ name: \"None\", value: null }];\n connection.query(\"SELECT title, role_id FROM roles\", (err, results) => {\n if (err) throw err;\n for (let i = 0; i < results.length; i++) {\n roleArray.push({\n name: results[i].title,\n value: results[i].role_id,\n });\n }\n connection.query(\n \"SELECT first_name, last_name, id FROM employee\",\n (err, response) => {\n if (err) throw err;\n for (let i = 0; i < response.length; i++) {\n employeeArray.push({\n name: response[i].first_name + \" \" + response[i].last_name,\n value: response[i].id,\n });\n }\n inquirer\n .prompt([\n {\n name: \"firstName\",\n type: \"input\",\n message: \"What is the employee's first name?\",\n validate: function (value) {\n if (value === \"\") {\n console.log(\"Please enter a name.\");\n return false;\n }\n return true;\n },\n },\n {\n name: \"lastName\",\n type: \"input\",\n message: \"What is the employee's last name?\",\n validate: function (value) {\n if (value === \"\") {\n console.log(\"Please enter a name.\");\n return false;\n }\n return true;\n },\n },\n {\n name: \"role\",\n type: \"list\",\n message: \"What is the employee's role?\",\n choices: roleArray,\n },\n {\n name: \"manager\",\n type: \"list\",\n message: \"Who is the employee's manager?\",\n choices: employeeArray,\n },\n ])\n .then(function (answer) {\n for (var i = 0; i < results.length; i++) {\n if (answer.role === results[i].title) {\n answer.role = results[i].role_id;\n }\n if (answer.manager === results[i].last_name) {\n answer.manager = results[i].id;\n }\n }\n connection.query(\n \"INSERT INTO employee SET ?\",\n {\n first_name: answer.firstName,\n last_name: answer.lastName,\n role_id: answer.role,\n manager_id: answer.manager,\n },\n function (err, res) {\n if (err) throw err;\n runTracker();\n }\n );\n });\n }\n );\n });\n}", "function addRole() {\n // Gets all departments to prompt the user\n db.query(\"SELECT * FROM department\", (err, data) => {\n if (err) throw err;\n // Uses the data to set up an array to prompt about the department the user wants to select\n let depArry = [];\n data.forEach((element) => depArry.push(`${element.department_name}`));\n inquirer\n .prompt([\n {\n type: \"list\",\n message: \"Which department is the role for?\",\n choices: depArry,\n name: \"department\",\n },\n {\n type: \"input\",\n message: \"What is the name of the role?\",\n name: \"newRole\",\n },\n {\n type: \"input\",\n message: \"What is the salary of the role?\",\n name: \"roleSalary\",\n },\n ])\n .then((res) => {\n // Uses the prompt to set up a new array and creates a query to intert into the roles table\n let depId;\n let newRole = [res.newRole, res.roleSalary];\n\n data.forEach((element) => {\n if (res.department === element.department_name) {\n depId = element.id;\n newRole.push(depId);\n }\n });\n\n db.query(\n \"INSERT INTO roles(title, salary, department_id) VALUES (?, ?, ?)\",\n newRole,\n (err, data) => {\n if (err) throw err;\n console.log(\"Successfully added a new role!\");\n init();\n }\n );\n });\n });\n}", "function saveNewRoleHandler(event) {\n // get the new Master Role name\n var newRole = new MasterRole();\n newRole.Name = $(\"#txtName\").val();\n newRole.Description = \"temp\";\n newRole.isActive = 1;\n // Check the current user mode. If the current user is a SuperUser then the CompanyID vlaue here will get used. \n // Otherwise the server will assign the company ID for the current user\n if (isSuperUser) {\n newRole.CompanyID = localCompany.CompanyID;\n }\n // Add the new role to the Master role data store for this company\n SaveNewMasterRole(newRole);\n }", "function addRole() {\n // Declare some local variables to utilize in the database insertion process\n let newRoleTitle;\n let newRoleSalary;\n let newRoleDepartment;\n let newRoleDepartmentObject;\n let newRoleDepartmentID;\n // Add and escape option to the choices array\n currentDepartmentNames.push(\"I dont see my choice listed here\");\n // Prompt them to answer some additional questions about what role they want to add..\n addRolePrompt()\n // Then use the response to prepare variables for use in inserting new content to the DB...\n .then(response => {\n // If they need to escape, let them escape...\n if (response.newRoleDepartment === \"I dont see my choice listed here\"){\n // Tell them to add a new department...\n console.log(`\\nThats Ok! Please add the department you need first, then come back to adding your new role.\\n`)\n // Re-run the startprompt\n startMainPrompt();\n }\n // Otherwise...Prepare the appropriate inputs as variables...\n else{\n newRoleTitle = response.newRoleTitle;\n newRoleSalary = response.newRoleSalary;\n newRoleDepartment = response.newRoleDepartment;\n newRoleDepartmentObject = currentDepartments.find(obj=>obj.department_name===newRoleDepartment);\n newRoleDepartmentID = newRoleDepartmentObject.id;\n // Log the prepared values to the user\n console.log(`New role you want to add is set to = ${newRoleTitle} with salaray of ${newRoleSalary} working in the ${newRoleDepartment} department with department id ${newRoleDepartmentID}`);\n // And call the function to insert the new role into the role_table...\n insertNewRole();\n } \n })\n // If there is an error, log the error\n .catch(err => {if (err) throw err});\n // Insert the new role into the role_table\n function insertNewRole() {\n connection.query (\n // Insert the new departmenet\n `INSERT INTO role_table (\n employee_role_title,\n employee_salary,\n department_id\n ) VALUES\n (\"${newRoleTitle}\", ${newRoleSalary}, ${newRoleDepartmentID});`\n ,\n // Log the result\n (err, res) => {\n // If error log error\n if (err) throw err;\n // Otherwise Log success and display the added department\n console.log(`You have successfully added ${newRoleTitle} to the roles database!`);\n // Then call the view Roles function to display the latest data (this will also run into task completed)\n viewRoles();\n }\n )\n }\n }", "function makeRole() {\n\tlet role = document.createElement(\"p\");\n\tlet roleText = document.createTextNode(\"Role: \");\n\tlet roleSelect = document.createElement(\"select\");\n\troleSelect.setAttribute(\"name\", \"members_role[]\");\n\tlet committeeOption = document.createElement(\"option\");\n\tcommitteeOption.text = \"Committee\";\n\tcommitteeOption.setAttribute(\"value\", \"committee\");\n\troleSelect.appendChild(committeeOption);\n\tlet majorAdvisorOption = document.createElement(\"option\");\n\tmajorAdvisorOption.text = \"Major Advisor\";\n\tmajorAdvisorOption.setAttribute(\"value\", \"major_advisor\");\n\troleSelect.appendChild(majorAdvisorOption);\n\tlet coAdvisorOption = document.createElement(\"option\");\n\tcoAdvisorOption.text = \"Co-Major Advisor\";\n\tcoAdvisorOption.setAttribute(\"value\", \"co_advisor\");\n\troleSelect.appendChild(coAdvisorOption);\n\tlet gcrOption = document.createElement(\"option\");\n\tgcrOption.text = \"GCR\";\n\tgcrOption.setAttribute(\"value\", \"gcr\");\n\troleSelect.appendChild(gcrOption);\n\trole.appendChild(roleText);\n\trole.appendChild(roleSelect);\n\t\n\treturn role;\n}", "async function createRole() {\n try {\n // Choose a department\n const { department: { department_id, name } } = await chooseDepartment(\"add a role to\");\n if (!department_id) throw \"There aren't any departments\";\n const newRole = await inquirer.prompt([{\n // Have the user set a name for the new role\n type: \"input\",\n name: \"title\",\n message: `What is the title for this new ${name} role?`,\n filter: input => input.trim(),\n // Retrieve a list of roles in the selected department and make sure the title input doesn't already exist\n validate: async function (input) {\n return (await connection.queryPromise(\"SELECT title FROM roles WHERE department_id=?\", department_id)).map(row => row.title).includes(input) ? \"That role already exists\" : true;\n }\n }, {\n // Ask the user what the salary is in this role\n type: \"number\",\n name: \"salary\",\n message: ({ title }) => `What is the salary for ${title} employees?`,\n filter: input => isNaN(input) ? \"\" : input,\n validate: input => input === \"\" || isNaN(input) ? \"Please enter the salary as a number\" : true\n }]);\n // Add the new role to the database\n await connection.queryPromise(\"INSERT INTO roles SET ?\", { ...newRole, department_id: department_id });\n console.log(\"The role was successfully added!\");\n } catch (err) { console.error(err); }\n createMenu();\n}", "function addEmployeePrompt () {\n return inquirer.prompt ([\n {\n type: \"input\",\n name: \"newEmployeeFirstName\",\n message: \"Please enter the employee's first name\",\n validate: async(input) => {\n if(input===\"\") {\n return \"Please enter a value\"\n }\n return true\n } \n },\n {\n type: \"input\",\n name: \"newEmployeeLastName\",\n message: \"Please enter the employee's last name\",\n validate: async(input) => {\n if(input===\"\") {\n return \"Please enter a value\"\n }\n return true\n } \n },\n {\n type: \"list\",\n name: \"newEmployeeRole\",\n message: \"Please select the employees role (If the role does yet, please selecet that you dont see it and create a new role first)\",\n choices: currentRoleNames\n },\n\n ])\n }", "function addRole() {\n\n prompt([\n {\n type: \"input\",\n name: \"roleName\",\n message: \"New role title:\",\n validate: inputStr => {\n if (inputStr) return true;\n else return false;\n }\n },\n {\n type: \"input\",\n name: \"salary\",\n message: \"Salary in dollars:)\",\n validate: inputStr => {\n if (inputStr) {\n if (/^[0-9]+$/.test(inputStr)) {\n return true;\n } else {\n console.log(`\\n Enter salary in dollars, for example, 25000:`);\n return false;\n }\n // no input \n } else return false;\n }\n },\n\n ]).then(deptData => {\n let newName = deptData.roleName;\n let newSal = deptData.salary;\n\n db.selectAllDepartments()\n .then(([depts]) => {\n prompt([\n {\n type: \"list\",\n name: \"selectedDept\",\n message: `\\nSelect a department:`,\n choices: depts.map(d => ({ value: d.id, name: d.name }))\n }\n ])\n .then((newData) => {\n db.addRole(newName, newSal, newData.selectedDept)\n .then(([data]) => {\n promptAction()\n })\n })\n })\n })\n}", "function addRole() {\n //console.log(\"add role function called\");\n\n connection.query(\n \"SELECT * FROM department\",\n function (err, responseDepartment) {\n if (err) throw err;\n inquirer\n .prompt([\n {\n type: \"input\",\n message: \"Enter job title:\",\n name: \"newTitle\",\n },\n {\n type: \"input\",\n message: \"Enter annual salary:\",\n name: \"newSalary\",\n },\n {\n type: \"list\",\n message: \"Enter department:\",\n name: \"dept\",\n choices: function () {\n var departmentArray = [];\n for (var i = 0; i < responseDepartment.length; i++) {\n departmentArray.push(responseDepartment[i].name);\n }\n return departmentArray;\n },\n },\n ])\n .then((res) => {\n var chosenDepartment;\n for (var i = 0; i < responseDepartment.length; i++) {\n if (responseDepartment[i].name === res.dept) {\n chosenDepartment = responseDepartment[i].id;\n }\n }\n connection.query(\"INSERT INTO role SET ?\", {\n title: res.newTitle,\n salary: res.newSalary,\n department_id: chosenDepartment,\n });\n console.log(\"Role added\");\n start();\n });\n }\n );\n}", "createRole(roles) {\n return this.connection.promise().query(\"INSERT INTO roles SET ?\", roles);\n }", "getRole(){\r\n return 'Employee'\r\n }", "AddTheRoleToTheNode(hostname, serviceName, type) {\n let url = `/cluster/hadoop/${serviceName}/node/${hostname}/role`;\n return this.client.request('POST', url, { type });\n }", "function addRole() {\n\n connection.query('SELECT * FROM department', (err, data) => {\n if (err) throw err;\n // created an array of object-department to return values\n let deptArray = data.map(function (department) {\n return {\n name: department.name,\n value: department.id\n }\n });\n\n inquirer.prompt([\n {\n type: 'input',\n name: 'newRoleName',\n message: 'Which role would you like to add?'\n },\n {\n type: 'input',\n name: 'newRoleSalary',\n message: 'Please enter the salary for this new role.',\n validate: salaryInput => {\n if (isNaN(salaryInput)) {\n console.log('Please enter a number.')\n return false;\n } else {\n return true;\n }\n }\n },\n {\n type: 'list',\n name: 'departmentId',\n message: 'Which department does the new role belong to?',\n choices: deptArray\n }\n ]).then(function (answers) {\n connection.query(`INSERT INTO role (title, salary, department_id) VALUES ('${answers.newRoleName}', '${answers.newRoleSalary}', '${answers.departmentId}');`, (err, res) => {\n if (err) throw err;\n console.log('New role has been added!');\n console.log(res);\n options();\n })\n })\n });\n}", "function addRole(){ \n inquirer.prompt([\n {\n name: \"title\",\n type: \"input\",\n message: \"Please enter the name of the role!\",\n },\n {\n name: \"salary\",\n type: \"input\",\n message: \"Please enter the salary!\",\n },\n {\n name: \"id\",\n type: \"input\",\n message: \"Please enter the department ID!\",\n },\n ]).then(function (track){\n const tracker = \"INSERT INTO role SET ?\";\n connection.query(tracker, \n { \n title: track.title,\n salary: track.salary,\n department_id: track.id\n }, \n function(err, data) {\n if (err) throw err;\n console.log(\"New role has been saved!\");\n databaseQuestions();\n });\n });\n }", "async function addRole(roleInfo) {\n const departmentId = await getDepartmentId(roleInfo.departmentName);\n const salary = roleInfo.salary;\n const position = roleInfo.roleName;\n let query = 'INSERT into role (position, salary, department_id) VALUES (?,?,?)';\n let args = [position, salary, departmentId];\n const rows = await db.query(query, args);\n console.log(`Added role ${position}`);\n}", "function addRole() {\n for (let i in rolesArr) {\n i = rolesArr[i].title;\n rolesArr.push(i);\n }\n for (let i in departmentsArr) {\n i = departmentsArr[i].department;\n departmentsArr.push(i);\n }\n inquirer\n .prompt ([\n {\n type: \"list\",\n message: \"What type of role would you like to add?\",\n name: \"role\",\n choices: rolesArr\n },\n {\n type: \"input\",\n message: \"What is the salary for this role?\",\n name: \"money\",\n validate: sal => {\n if(isNaN(sal)) {\n return ('Please enter a number');\n } else {\n return true;\n }\n }\n },\n {\n type: \"list\",\n message: \"What department do they belong to?\",\n name: \"department\",\n choices: departmentsArr\n }\n ])\n .then(data => {\n // add this data to the roles table jpined \n const role = [ data.role, data.money];\n const roleId = rolesArr.length + 1;\n const newRole = new Role(data.role, data.money);\n\n const sql = `INSERT INTO role (title, salary) VALUES (?) `;\n connection.query(sql, newRole, (err, res) => {\n if (err) throw err;\n \n // if (role.endsWith('manager')) {\n // console.log(`Manager was added to ${data.department}.`);\n // } else {\n // } \n console.log(\"New employee added.\")\n\n rolesArr.push(newRole)\n console.table(res);\n \n start();\n })\n })\n}", "function addRole() {\n inquirer.prompt([\n {\n type: 'input',\n name: \"roleName\",\n message: \"What is the new role you would like to add?\"\n },\n {\n type: 'input',\n name: \"roleSalary\",\n message: \"How much is the salary for this new role?\"\n },\n {\n type: 'list',\n name: \"roleDept\",\n message: \"Which department does this new role belongs to?\",\n choices: departmentsList\n }\n ]).then(function(data) {\n connection.query(\"INSERT INTO role SET ? \",\n {\n title: data.roleName,\n salary: data.roleSalary,\n department_id: data.roleDept\n }, function (error, res) {\n if (error) throw error;\n });\n console.log(\"============================\");\n console.log(\"New Role Successfully Added!\");\n console.log(\"============================\");\n mainMenu();\n });\n}", "getRole() {\n const role = \"Employee\";\n return role;\n }", "function addRole(departmentNames) {\n // prompt for info about new role\n inquirer\n .prompt([\n {\n name: \"roleName\",\n type: \"input\",\n message: \"What role would you like to add?\"\n },\n {\n name: \"salary\",\n type: \"input\",\n message: \"Please enter salary:\",\n // will not except non-numerical input\n validate: function(value) {\n if (isNaN(value) === false) {\n return true;\n }\n return false;\n }\n },\n {\n name: \"deptName\",\n type: \"list\",\n message: \"What department is this role in?\",\n // list of departments obtained from chooseDepartment function become choices to select\n choices: departmentNames\n }\n ])\n .then(function(answer) {\n // after collecting dept name, find department_id to insert into role table\n // Array.find() is an inbuilt function in JavaScript which is used to get the value of the first element in the array that satisfies the provided condition\n var deptObject = globalDept.find(\n element => element.dept_name === answer.deptName\n );\n console.log(deptObject);\n connection.query(\n // insert role into database (role table)\n \"INSERT INTO role SET ?\",\n {\n title: answer.roleName,\n salary: answer.salary,\n // use the id from the matching dept entry in globalDept, now the deptObject var\n department_id: deptObject.id\n // role table id (key) should automatically update/increment starting at 1501 (including seed data)\n },\n function(err) {\n if (err) throw err;\n // console log success message plus new role name\n console.log(answer.roleName + \" Role is added!\");\n // re-prompt the user for further actions by calling \"start\" function\n start();\n }\n );\n });\n}", "function addEmployee() {\n connection.query(\"SELECT title FROM role\", (err, result) => {\n let roles = [];\n for(var i = 0; i < result.length; i++) {\n roles.push(result[i].title);\n }\n // console.log(roles);\n inquirer.prompt([\n {\n type: \"input\",\n name: \"firstName\",\n message: \"Enter the employee's first name.\"\n },\n {\n type: \"input\",\n name: \"lastName\",\n message: \"Enter the employee's last name.\"\n },\n {\n type: \"list\",\n name: \"role\",\n message: \"What is the employee's role?\",\n choices: roles\n // roles as the choices should give the current up to date list of\n // current roles in the database\n }\n // The bonus is to get managers functioning, but it is currently a \n // work in progress.\n // {\n // type: \"list\",\n // name: \"manager\",\n // message: \"Who is this employee's manager?\",\n // choices:\n // [\n // \"Alex Varela\",\n // \"Caleb Barnes\",\n // \"Drew Albacore\"\n // ]\n // }\n ]).then(userInput => {\n // console.log(roles.indexOf(\"Salesperson\"));\n const index = roles.indexOf(userInput.role) + 1;\n connection.query(\"INSERT INTO employee SET ?\",\n {\n first_name: userInput.firstName,\n last_name: userInput.lastName,\n role_id: index,\n // manager_id: userInput.manager\n },\n function(err, result){\n if (err) {\n throw err;\n } else {\n console.log(\"Employee added!\")\n beginApp();\n }\n });\n });\n });\n\n}", "function addRole(){\n inquirer.prompt(\n [\n {\n type: \"input\",\n message: \"What role would you like to add?\",\n name: \"newRole\"\n },\n {\n type: \"input\",\n message: \"What salary does this role earn?\",\n name: \"newSalary\"\n },\n {\n type: \"list\",\n message: \"What department does this role belong to?\",\n choices: deptArr,\n name: \"roleDeptID\"\n }\n\n ]).then(\n response => {\n const roleTitle = response.newRole;\n const roleSalary = response.newSalary;\n let roleID = response.roleDeptID;\n findDeptID(roleID, deptID);\n\n function findDeptID(roleID, deptID){\n connection.query(`SELECT * FROM departments WHERE department = \"${roleID}\"`, (err, res) => {\n if (err) throw err;\n let roleValueToDeptID = JSON.parse(JSON.stringify(res));\n deptID = roleValueToDeptID[0].id;\n createRole(roleTitle, roleSalary, deptID);\n });\n }\n\n console.log(\"\\n\", brkLines);\n console.log(`New Role added!\\n`);\n init();\n });\n}", "function addEmployee() {\n var roles = [];\n //Build SQL query to get all role titles\n var query = \"SELECT title FROM roles\"\n connection.query(query, function (err, res) {\n if (err) throw err;\n res.forEach(role => {\n roles.push(role.title);\n });\n inquirer\n .prompt([\n {\n type: \"input\",\n message: \"Enter first name: \",\n name: \"firstName\"\n },\n {\n type: \"input\",\n message: \"Enter last name: \",\n name: \"lastName\"\n },\n {\n type: \"list\",\n message: \"What is the employee's role? \",\n choices: roles,\n name: \"role\"\n }\n ]).then(function (data) {\n //Build SQL query to find role_id\n connection.query(\"SELECT role_id FROM roles WHERE roles.title = ?\", [data.role], function (err, res) {\n if (err) throw err;\n //SQL query to add employee into DB\n connection.query(\"INSERT INTO employees SET ?\", {\n first_name: data.firstName,\n last_name: data.lastName,\n role_id: res[0].role_id\n }, function (err, res) {\n if (err) throw err;\n console.log(\"Employee added.\");\n console.log(\"------------------------------------------\");\n start();\n });\n });\n });\n });\n}", "function onAddUserSubmit() {\n var select = document.getElementById(\"roleSelect\");\n var role = select.options[select.selectedIndex].value;\n addUser(role);\n }", "function createNewEmployee(data) {\n let newEmployee;\n if (data.role === 'Manager') {\n newEmployee = new Manager(data.name, data.id, data.email, data.roleInfo);\n managers.push(newEmployee);\n } else if (data.role === 'Engineer') {\n newEmployee = new Engineer(data.name, data.id, data.email, data.roleInfo);\n engineers.push(newEmployee);\n } else {\n newEmployee = new Intern(data.name, data.id, data.email, data.roleInfo);\n interns.push(newEmployee);\n };\n \n return inquirer.prompt([\n {\n type: 'list',\n name: 'add',\n message: 'Would you like to add another employee?',\n choices: ['Yes', 'No']\n }\n ])\n .then(userResponse => {\n if (userResponse.add === 'Yes') {\n getEmployees();\n } else {\n console.log('Checkout your index.html file in the dist folder!')\n return userResponse;\n }\n })\n}", "function newRole() {\n // placeholder for department array\n let deptList = [];\n\n connection.query(`SELECT * FROM department`, function (err, data) {\n if (err) throw err;\n // loop through to find all departments\n for (let i = 0; i < data.length; i++) { \n deptList.push(data[i].name)\n }\n // ask the user for info about the new role\n inquirer.prompt([\n {\n name: \"roleTitle\",\n message: \"What is the title of role?\",\n type: \"input\",\n validate: userEntry => {\n // if user response is not nothing\n if(userEntry !== \"\"){\n return true;\n }\n return \"You have to enter some information!\"\n },\n default: \"\" \n },\n {\n name: \"roleSalary\",\n message: \"What is the salary of the role? (no , or $ needed)\",\n type: \"input\",\n validate: userEntry => {\n // if user response is a number\n if(validator.isNumeric(userEntry)){\n return true;\n }\n return \"That's not a valid number!\";\n },\n default: \"\"\n },\n {\n name: \"roleDept\",\n message: \"What department does this role work for?\",\n type: \"list\",\n choices: deptList\n }\n ]).then(function ({ roleTitle, roleSalary, roleDept }) {\n // set the id\n let index = deptList.indexOf(roleDept)\n // add one the the returned index (SQL doesn't start at 0)\n index += 1;\n connection.query(`INSERT INTO role (title, salary, department_id) VALUES ('${roleTitle}', '${roleSalary}', ${index})`, function (err, data) {\n if (err) throw err;\n console.log('Added ' + roleTitle + ' into row ' + data.insertId)\n mainTasker();\n });\n })\n })\n }", "function addRole() {\n inquirer\n .prompt([\n {\n type: \"input\",\n message: \"What title would you like to add?\",\n name: \"title\"\n },\n {\n type: \"input\",\n message: \"What is the salary for the title?\",\n name: \"salary\"\n },\n {\n type: \"input\",\n message: \"What department ID does it belong to?\",\n name: \"deptId\"\n }\n ]).then(function (answer) {\n console.log(answer);\n connection.query(\n \"INSERT INTO employee_role SET ?\",\n {\n title: answer.title,\n salary: answer.salary,\n department_id: answer.deptId\n\n },\n function (err) {\n if (err) throw err;\n console.log(\"Role added successfully!\");\n inquirerInit();\n\n }\n );\n })\n\n}", "function addEmployee() {\n inquirer.prompt([\n {\n name: \"firstname\",\n type: \"input\",\n message: \"Enter employee first name \"\n },\n {\n name: \"lastname\",\n type: \"input\",\n message: \"Enter employee last name \"\n },\n {\n name: \"role\",\n type: \"list\",\n message: \"Which role would you like to assign? \",\n choices: getRoles()\n },\n {\n name: \"manager\",\n type: \"list\",\n message: \"Whats their managers name?\",\n choices: getManager()\n }\n ]).then(function (response) {\n // Increase index by 1 since array is 0 index based\n var roleId = roleArray.indexOf(response.role) + 1;\n var managerId = response.manager;\n\n db.addEmployee(response.firstname, response.lastname, managerId, roleId);\n mainMenu();\n })\n}", "getRole() {\n return \"Employee\";\n }", "getRole() {\n return \"Employee\";\n }", "getRole() {\n return 'Employee';\n }", "function addRole() {\n console.log(\"Adding a new role \")\n inquirer\n .prompt([\n {\n name: \"role\",\n type: \"input\",\n message: \"What is the title?\",\n \n },\n {\n name: \"salary\",\n type: \"input\",\n message: \"Please enter the salary?\",\n\n },\n {\n name: \"department_no\",\n type: \"input\",\n message: \"Please enter a new dept ID?\",\n\n }\n\n ]).then(function(answer) {\n connection.query(\"INSERT INTO role SET ? \",\n [{\n title:answer.role,\n salary:answer.salary,\n department_id:answer.department_no\n }],\n function(error,result)\n {\n if (error) throw error;\n connection.query(\"SELECT * FROM role \", function(error,result)\n {\n if (error) throw error;\n console.table(result);\n console.log(\"A new role added!\");\n mainMenu();\n });\n \n });\n });\n \n \n \n \n }" ]
[ "0.7386285", "0.73456043", "0.72563773", "0.72441345", "0.7221952", "0.71792287", "0.71648276", "0.71162015", "0.7024098", "0.7009604", "0.6980438", "0.6955104", "0.69191486", "0.69058406", "0.690205", "0.69010687", "0.68701094", "0.6848944", "0.6837454", "0.6818353", "0.67949396", "0.6793619", "0.6782969", "0.6767725", "0.6755705", "0.674742", "0.67412454", "0.67249966", "0.6723784", "0.6695516", "0.66902286", "0.6688975", "0.6672332", "0.66619176", "0.6634852", "0.6628721", "0.66225934", "0.6602976", "0.6598021", "0.65952325", "0.6594997", "0.6567371", "0.6564888", "0.6559233", "0.6549545", "0.65264946", "0.6517004", "0.65145653", "0.65034616", "0.65034616", "0.64910775", "0.64748293", "0.64728534", "0.64679676", "0.64631397", "0.64478993", "0.6446765", "0.64419585", "0.64371085", "0.64357316", "0.6435152", "0.6411145", "0.6409618", "0.6403646", "0.6400298", "0.63981104", "0.6384214", "0.63698125", "0.63543105", "0.6353718", "0.6347377", "0.6332931", "0.6326465", "0.63253194", "0.63213795", "0.6313493", "0.6311801", "0.6311602", "0.63096696", "0.63028216", "0.63015693", "0.62723905", "0.6270927", "0.6263711", "0.62629616", "0.62608784", "0.6252382", "0.6248486", "0.6244702", "0.62392133", "0.6237732", "0.6237164", "0.62257296", "0.6225012", "0.6214561", "0.6206996", "0.6199549", "0.6174356", "0.6174356", "0.6172307", "0.61674505" ]
0.0
-1
TODO amory: get team listing from Google Groups instead so that this can stay in sync.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getTeamList() {\n if (\"caches\" in window) {\n caches.match(ENDPOINT_EPL + \"teams\").then(function (response) {\n if (response) {\n response.json().then(function (data) {\n showTeamList(data);\n })\n }\n })\n }\n\n fetchAPI(ENDPOINT_EPL + \"teams\")\n .then(data => {\n showTeamList(data);\n })\n .catch(error);\n}", "function getTeamList() {\n return Team.find({}, \"team_name\").exec();\n}", "function loadTeams() {\n doAjax(TEAM_URL + '/get').then(data => {\n data.forEach(team => {\n console.log('Team ->', team.name);\n });\n });\n}", "async function getAllTeams(){\n return await season_utils.getTeamsBySeasonId(18334);\n}", "function getTeams(matches) {\n\t\t\t\t//you have the setting Id\n\t\t\t\t$http.get('api/teams/' + $stateParams.id)\n\t\t\t\t\t.then(function onSuccess(response) {\n\t\t\t\t\t\tvar theUsers = []\n\t\t\t\t\t\tresponse.data.users.forEach(function(user) {\n\t\t\t\t\t\t\t//match the user's email to the mathcing progress email\n\t\t\t\t\t\t\tmatches.forEach(function(prog) {\n\t\t\t\t\t\t\t\tif (prog.users.map(x => x.email).includes(user.email)) {\n\t\t\t\t\t\t\t\t\ttheUsers.push(prog.users)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t})\n\t\t\t\t\t\tvar usersQuery = theUsers.reduce((x,y) => {x.concat(y)})\n\t\t\t\t\t})\n\t\t\t\t\t.catch(function onError(response){\n\t\t\t\t\t\tconsole.log(response.data)\n\t\t\t\t\t})\n\t\t\t}", "function listTeams(authClient) {\n var sheets = google.sheets('v4');\n \n \n console.log(sheetsAPI);\n sheets.spreadsheets.values.get({\n spreadsheetId: '1jN26YeuCpdd82TZzKgtGchqte6da_XTnSeC0DdV8YTA', //change this to another *public* spreadsheet if you want\n range: 'Sheet1!A3:C',\n auth: authClient\n }, function(err, response) {\n if (err) {\n console.log('The API returned an error: ' + err);\n console.log(response);\n return;\n }\n var rows = response.values;\n if (rows.length == 0) {\n console.log('No data found.');\n } else {\n console.log('Team, Tourney, Days b4 Tourney Start');\n for (var i = 0; i < rows.length; i++) {\n var row = rows[i];\n // Print columns A and E, which correspond to indices 0 and 4.\n console.log('%s, %s, %s', row[0], row[1], row[2]);\n }\n }\n });\n}", "function listTeams(data){\n const listOfTeams = data.sort(groupSort).map(item => renderTeamList(item));\n $('.list-of-teams-container').append(listOfTeams);\n}", "function getShowAllTeams() {\n if ('caches' in window) {\n caches.match(ENDPOINT_SHOW_ALL_TEAMS).then(function (response) {\n if (response) {\n response.json().then((data) => getViewTeamPremierLeague(data));\n }\n });\n }\n\n fetchAPI(ENDPOINT_SHOW_ALL_TEAMS)\n .then(status)\n .then(json)\n .then(data => getViewTeamPremierLeague(data))\n .catch(error);\n}", "async getTeamByName(team) {\n const teamData = await this._client.callApi({ url: `teams/${team}` });\n return new TeamWithUsers_1.TeamWithUsers(teamData, this._client);\n }", "getTeamsByFixtures () {}", "function getTeams(){\n console.log( \"inside getTeams\");\n $.ajax({\n type: 'GET',\n url: '/teams',\n success: function (response) {\n console.log(\"Reponse from GET /teams\", response);\n newTeams = false;\n for (var i = 0; i < response.length; i++) {\n displayTeam(response[i].groupsArray);\n }\n }\n });\n }//ends ajax get getTeams", "getTeams () {\n let result = `TEAMS ${View.NEWLINE()}`\n result += `Premiership Division ${View.NEWLINE()}`\n\n for (let aTeam of this.allPDTeams) {\n result += aTeam + `${View.NEWLINE()}`\n }\n result += `Championship Division ${View.NEWLINE()}`\n for (let aTeam of this.allCDTeams) {\n result += aTeam + `${View.NEWLINE()}`\n }\n return result\n }", "function getTeams() {\n\tvar teams = [];\n\tajax.controllers.Application.getTeams().ajax({\n\t\tasync: false,\n\t success: function(data) {\n\t \tteams = data;\n\t },\n\t\terror: function(data) {\n\t\t\talert(\"Erro ao obter os times\");\n\t\t}\n\t});\n\t\n\treturn teams;\n}", "async getTeamByName(team) {\n const teamData = await this._client.callApi({ url: `teams/${team}` });\n return new TeamWithUsers(teamData, this._client);\n }", "async function getTeamsByName(name) {\n let teams_list = [];\n const teams = await axios.get(`${api_domain}/teams/search/${name}`, {\n params: {\n include: \"league\",\n api_token: process.env.api_token,\n },\n });\n // make the json\n teams.data.data.forEach(team => {\n if(team.league && team.league.data.id === LEAGUE_ID){\n teams_list.push({Team_Id:team.id ,Team_name: team.name, Team_img: team.logo_path}) \n }\n });\n return teams_list;\n}", "async function getTeamsByDivision() {\n if (!loaded) {\n return loadTeams().then((code) => (code === 200 ? teamsByDivision : code)).catch(() => '500');\n }\n\n return teamsByDivision;\n}", "async getTeam () {\n\t\tthis.team = await this.data.teams.getById(this.payload.teamId);\n\t}", "async function getTeams() {\n let teams = getFromStorage(TEAMS_KEY);\n if (!teams) {\n try {\n teams = await axios.get('https://api.football-data.org/v2/competitions/PD/teams', HEADER_OPTIONS)\n .then(res => res.data.teams)\n saveToStorage(TEAMS_KEY, teams);\n } catch (err) {\n throw new Error(\"Cant get teams from server \", err);\n }\n }\n return teams;\n}", "function getTeams() {\n sendAuthReq('GET', '/api/teams', null, '')\n .then(function(res) {\n var mainBody = document.getElementById('main-body');\n mainBody.innerHTML = res;\n selectIcon('teams');\n }).catch(function(err) {\n mainBody.innerHTML = 'Failed to get teams page. Please try again later.';\n console.log(err);\n })\n}", "function getTeam() {\n // Ambil nilai query parameter (?id=)\n let urlParams = new URLSearchParams(window.location.search);\n let idParam = urlParams.get(\"id\");\n\n fetch(`${base_url}competitions/${idParam}/teams`, {\n headers: {\n 'X-Auth-Token': authToken\n }\n })\n .then(res=>{\n return res.json()\n })\n .then(resjson=>{\n showTeam(resjson)\n })\n}", "getGamesByTeam(team) {\n TTTPost(\"/games-by-team\", {\n team_id: team.team_id\n })\n .then(res => {\n this.setState({team: team, games: res.data.games});\n });\n }", "get joinedTeams() {\r\n return new Teams(this, \"joinedTeams\");\r\n }", "getTeamsFromTournament(tournament) {\n this.restClient.getTeams(tournament.id)\n .subscribe(teams => this.teams = teams, error => this.error = error);\n }", "function getTeam() {\n teamDataService.getTeam(vm.team.id)\n .then(function (data) {\n vm.team = data;\n });\n }", "getUserTeams(){\n let teamsResult = this.props.teamsResult;\n let userTeams = new Array;\n teamsResult.forEach((team) => {\n team.members.forEach((member) => {\n if(member == this.username){\n userTeams.push(team);\n }\n });\n });\n return userTeams;\n }", "async getTeam () {\n\t\tthis.team = await this.data.teams.getById(this.tokenInfo.teamId);\n\t\tif (!this.team || this.team.get('deactivated')) {\n\t\t\tthrow this.errorHandler.error('notFound', { info: 'team' });\n\t\t}\n\t}", "async getTeams(page, limit = 25) {\n const query = {};\n if (page) {\n query.offset = ((page - 1) * limit).toString();\n }\n query.limit = limit.toString();\n const data = await this._client.callApi({\n url: 'teams',\n query\n });\n return data.teams.map(teamData => new Team_1.Team(teamData, this._client));\n }", "async processAllTeams () {\n\t\tconst result = await this.data.teams.getByQuery(\n\t\t\t{\n\t\t\t\t'providerIdentities': /slack::/,\n\t\t\t\tdeactivated: false\n\t\t\t},\n\t\t\t{\n\t\t\t\tstream: true,\n\t\t\t\toverrideHintRequired: true,\n\t\t\t\tsort: { _id: -1 }\n\t\t\t}\n\t\t);\n\n\t\tlet team;\n\t\tdo {\n\t\t\tteam = await result.next();\n\t\t\tif (team) {\n\t\t\t\tawait this.processTeam(team);\n\t\t\t\tawait Wait(ThrottleTime);\n\t\t\t}\n\t\t} while (team);\n\t\tresult.done();\n\t}", "function getTeamInfo() {\r\n //when the search button is clicked, it passes no searchTeam so we take whatever is in the input field\r\n var input = document.getElementById(\"input\").value.toLowerCase();\r\n document.getElementById(\"input\").value = \"\";\r\n\r\n var apiRequest = api + currentLeague;\r\n\r\n fetch(apiRequest)\r\n .then(response => {\r\n return response.json()\r\n }) \r\n .then(data => {\r\n var i = 0;\r\n while (i<20) {\r\n //will check both the full name and the alternative (often short) name\r\n var name1 = data.teams[i].strTeam.toLowerCase();\r\n var name2 = data.teams[i].strAlternate.toLowerCase();\r\n //enables search from incomplete input, e.g. searching for \"liv\" in the EPL will return \"Liverpool\"\r\n if (name1.includes(input) || name2.includes(input)) {\r\n break;\r\n }\r\n i++;\r\n }\r\n var team = data.teams[i];\r\n\r\n //display information about the searched team\r\n displayTeam(team.strTeam, team.strTeamBadge, team.intFormedYear, team.strTeamJersey,\r\n team.strStadium, team.strStadiumThumb, team.strDescriptionEN);\r\n })\r\n .catch(err => {\r\n console.log(err);\r\n });\r\n}", "function getTeams(leagueId) {\n fetch(`${allTeamsUrl}?${formatQueryParams({ id: leagueId })}`)\n .then((response) => {\n if (response.ok) {\n return response.json();\n }\n throw new Error(response.statusText);\n })\n .then((responseJson) => displayTeamsInput(responseJson))\n .catch((err) => {\n $(\"#js-error-message\").text(`Something went wrong:${err.message}`);\n });\n}", "function getTeamId() {\n var queryURL = 'https://www.thesportsdb.com/api/v1/json/1/searchteams.php?t=' + userTeams;\n $.ajax({\n url: queryURL,\n method: \"GET\"\n }).then(function (response) {\n console.log(response);\n var teamId = response.teams[0].idTeam;\n console.log('teamId- ' + teamId);\n pullGames(teamId);\n });\n }", "static async getTeamsForMember(userid){\n return read('memberteams',0,1,userid).then(async res => {\n let teams = [];\n if(res.rows.length){\n res.rows[0].teamids.map(async teamid => {\n const team = await this.getTeam('', teamid);\n if(team) teams.push(team);\n });\n }\n return teams;\n });\n }", "async getTeams(page, limit = 25) {\n const query = {};\n if (page) {\n query.offset = ((page - 1) * limit).toString();\n }\n query.limit = limit.toString();\n const data = await this._client.callApi({\n url: 'teams',\n query\n });\n return data.teams.map(teamData => new Team(teamData, this._client));\n }", "function getTeam(idTeam,info,n,cb) {\r\n info.group.teams.forEach((t)=> {\r\n if(t.teamID == idTeam) {\r\n info.team = t.teamName;\r\n }\r\n });\r\n\r\n info.team ? getTeamFixtures(idTeam,cb,processFixtures) : cb(404,null);\r\n\r\n\r\n function processFixtures(fix) {\r\n var lastGames=[], nextGames=[];\r\n var N = n;\r\n var i= 0, j=0;\r\n fix.fixtures.forEach((fix) => {\r\n if(j==N){ return;}\r\n if(fix.status!=\"FINISHED\"){\r\n nextGames[j++] = fix;\r\n }\r\n });\r\n\r\n fix.fixtures.reverse().forEach((fix) => {\r\n if(i==N){ return;}\r\n if(fix.status==\"FINISHED\"){\r\n lastGames[i++] = fix;\r\n }\r\n });\r\n\r\n info.lastGames = lastGames;\r\n info.nextGames = nextGames;\r\n\r\n cb(null,info);\r\n }\r\n}", "function getTeamsFromID(idTeams) {\n var urlTeam = `${get_teamURL}${idTeams}`;\n fetchAPI(urlTeam)\n .then(teamFromID => {\n showFavTeams(teamFromID);\n })\n .catch(error => {\n console.log(error)\n })\n}", "function getTeams(callback) {\n\n\t\t\tteamsFactory.get_teams(function(response) {\n\t\t\t\tvar all_teams = response;\n\t\t\t\tvar unique_teams = [];\n\n\t\t\t\t// Add the teams to $scope.teams, without adding duplicates\n\t\t\t\tunique_teams = add_teams(unique_teams, all_teams.owner, \"owner\", false);\n\t\t\t\tunique_teams = add_teams(unique_teams, all_teams.manager, \"manager\", false);\n\t\t\t\tunique_teams = add_teams(unique_teams, all_teams.player, \"player\", false);\n\n\t\t\t\t// Somehow this magic little number only calls the callback if it's actually a function\n\t\t\t\t// http://stackoverflow.com/questions/6792663/javascript-style-optional-callbacks\n\t\t\t\ttypeof callback === 'function' && callback(unique_teams);\n\t\t\t});\n\t\t}", "async function showTeams(league_id) {\n\t\treturn getTeams(league_id)\n\t\t\t.then(res => res.message)\n\t\t\t.then(res => {\n\t\t\t\tif (res.length == 0) teams.innerHTML = 'no teams'\n\t\t\t\telse teams.innerHTML = teamsResults(res)\n\t\t\t})\n\t\t\t.catch(showSearchError)\n\t}", "async function getPlayersByTeam(team_id) {\n let player_ids_list = await getPlayerIdsByTeam(team_id);\n let players_info = await getPlayersInfo(player_ids_list);\n return players_info;\n}", "async function getPlayersByTeam(team_id) {\n let player_ids_list = await getPlayerIdsByTeam(team_id);\n let players_info = await getPlayersInfo(player_ids_list);\n return players_info;\n}", "viewAllTeamInSpace (baseUrl,username,spacename){\n browser.get(baseUrl + username + \"/\" + spacename +\"/teams\");\n }", "function getUserTeam() {\n API.getTeam(user.email)\n .then(res => {\n if (res.data != null) {\n setTeam(res.data)\n setTeamPlayers(res.data.players);\n }\n })\n .catch(err => console.log(err))\n setTeam({ ...team, owner: user.email })\n }", "onTeamSelect(team) {\n this.getGamesByTeam(team);\n }", "function getTeam() {\n if (\"caches\" in window) {\n caches.match(ENDPOINT_CHELSEA).then(function (response) {\n if (response) {\n response.json().then(function (data) {\n console.log(\"Team Data: \" + data);\n showTeam(data);\n showSquad(data);\n });\n }\n });\n }\n\n fetchAPI(ENDPOINT_CHELSEA)\n .then((data) => {\n showTeam(data);\n showSquad(data);\n })\n .catch((error) => {\n console.log(error);\n });\n}", "async getTeamMembers(logger, teamId, fields) {\n let fieldsToReturn = [\"ID\", \"name\", \"teamMembers:*\"];\n if (fields) {\n fieldsToReturn = fields;\n }\n return this.api.get(\"TEAMOB\", teamId, fieldsToReturn).then((team) => {\n return team.teamMembers;\n });\n }", "getTeamsActivePromise(){\n return this.GetPromise('/v3/nfl/stats/{format}/Teams');\n }", "getTeamsAllPromise(){\n return this.GetPromise('/v3/nfl/stats/{format}/AllTeams');\n }", "teamsGet(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.TeamsApi();\n let opts = {\n // 'role': \"role_example\" // String | Filters the teams based on the authenticated user's role on each team. * **member**: returns a list of all the teams which the caller is a member of at least one team group or repository owned by the team * **contributor**: returns a list of teams which the caller has write access to at least one repository owned by the team * **admin**: returns a list teams which the caller has team administrator access\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.teamsGet(incomingOptions.opts, (error, data, response) => {\n if (error) {\n cb(error, null, response);\n } else {\n cb(null, data, response);\n }\n });\n }", "function displayTeams() {\n\tfor (var i = 0; i < teams.length; i++) {\n\t\tvar findTeam = document.getElementById(teams[i].id);\n\t\t// Logic for displaying each team's info\n\t\tfindTeam.querySelector(\".team-name\").innerHTML = teams[i].name; // Displays the Team name\n\t\tfindTeam.querySelector(\".logo\").src = \"img/\" + teams[i].id + \".png\";\n\t\tfindTeam.querySelector(\".star\").src = \"img/\" + teams[i].star + \".png\";\n\t\tfor (var u = 0; u < teams[i].facts.length; u++) {\n\t\t\tfindTeam.querySelector(\".facts\").innerHTML += \"<li>\" + teams[i].facts[u] + \"</li>\";\n\t\t}\n\t\tfor (var u = 0; u < teams[i].champs.length; u++) {\n\t\t\tfindTeam.querySelector(\".championships\").innerHTML += \"<li>\" + teams[i].champs[u] + \"</li>\";\n\t\t}\n\t}\n}", "function getTeams() {\n var teams = {}\n var TeamsRef = firebase.database().ref(\"v2/teams\");\n TeamsRef.once('value', function(snapshot){\n if(snapshot.exists()){\n snapshot.forEach(function(data){\n teams[data.key] = {\n \"teamName\": data.val().teamName\n }\n })\n }\n })\n console.log(\"got teams from firebase\")\n return teams\n}", "async getTeam () {\n\t\tthis.team = await this.data.teams.getById(this.stream.get('teamId'));\n\t}", "async getTeam () {\n\t\tthis.team = this.team || await this.data.teams.getById(this.teamId);\n\t\tif (!this.team) {\n\t\t\tthrow this.errorHandler.error('notFound', { info: 'team' });\n\t\t}\n\t}", "static async getTeam(name, uuid = null){\n const pkeyUUID = uuid ? uuid : await this.getUUIDFromName('teamnames', name);\n if(pkeyUUID === null) return null;\n return read('teams',pkeyUUID,1).then(async res => {\n const team = firstOnly(format(res, Team));\n if(team) await Promise.all(team.members.map(async userid => {\n const user = await this.getUser('', userid).catch(() => null);\n if(user) team.users.push(user);\n return userid;\n }));\n return team;\n });\n }", "setTeams() {\n const options = this.selectOrganization.options;\n const selectOrganization = options[options.selectedIndex].text;\n Team.getAllTeams(selectOrganization).then((response) => {\n this.setState(() => {\n return {\n teams: response,\n };\n });\n });\n }", "function determineTeams() {\n let matches = Object.keys(schedule);\n // loops through each match\n for (let match_id in matches) {\n let match = schedule[match_id];\n for (let team_id in match) {\n // checks to see if team is already in array\n if (teams.indexOf(match[team_id]) < 0) {\n // adds it to team list\n teams.push(match[team_id]);\n }\n }\n }\n}", "function getTeamsFn(data){\n var match = data;\n var teamArray = [];\n var rounds = match.rounds;\n\n for(var i=0; i<rounds.length; i++){ // to store all the teams in an array\n\n for(var j=0; j<rounds[i].matches.length; j++){\n\n teamArray.push(rounds[i].matches[j].team1);\n teamArray.push(rounds[i].matches[j].team2);\n\n }\n }\n return _.uniqBy(teamArray, 'code'); // to remove the duplicates from team array\n}", "function loadTeamList(displayLeague, displayElement) {\r\n var apiRequest = api + displayLeague;\r\n //fetch selected API\r\n fetch(apiRequest)\r\n .then(response => {\r\n return response.json()\r\n })\r\n .then(data => {\r\n //create the list with the teams from selected league\r\n //each team is represented by a div element that consist of name, picture and short description\r\n var i = 0;\r\n while (i<data.teams.length) {\r\n var team = data.teams[i];\r\n //the picture will be either the badge or the kits\r\n var pic = (displayElement === \"b\") ? team.strTeamBadge : team.strTeamJersey;\r\n //create display box\r\n var teamDiv = createDisplayBox(team.strTeam, pic, team.strDescriptionEN.substring(0, 149) + \"...\");\r\n //append the teamDiv\r\n document.getElementById(\"teams\").appendChild(teamDiv);\r\n i++;\r\n }\r\n })\r\n .catch(err => {\r\n console.log(err);\r\n });\r\n}", "function getDetailTeams() {\n\n isLoading()\n return new Promise(function (resolve, reject) {\n\n // Get parameter query from id\n let urlParams = new URLSearchParams(window.location.search);\n let idParam = urlParams.get(\"id\");\n\n if (\"caches\" in window) {\n caches.match(BASE_URL + \"teams/\" + idParam).then(function (response) {\n if (response) {\n response.json().then(function (data) {\n showDetailTeam(data);\n resolve(data);\n })\n }\n })\n }\n\n fetchAPI(BASE_URL + \"teams/\" + idParam)\n .then(data => {\n showDetailTeam(data);\n resolve(data);\n })\n .catch(err => {\n error(err)\n showError()\n })\n });\n}", "function fillListTeams(teams) {\r\n $(\"#selectTeam\").html(\"<option value='0'>\" + t(\"tab_view_select_team\"));\r\n for (var curTeamID in teams) {\r\n var team = teams[curTeamID];\r\n var teamName = \"\";\r\n for (var iContestant in team.contestants) {\r\n var contestant = team.contestants[iContestant];\r\n if (iContestant == 1) {\r\n teamName += \" et \"; // XXX: translate\r\n }\r\n teamName += contestant.firstName + \" \" + contestant.lastName;\r\n }\r\n $(\"#selectTeam\").append(\"<option value='\" + curTeamID + \"'>\" + teamName + \"</option>\");\r\n }\r\n}", "async getTeam () {\n\t\tthis.team = await this.request.data.teams.getById(this.stream.get('teamId'));\n\t\tif (!this.team) {\n\t\t\tthrow this.errorHandler.error('notFound', { info: 'team' }); // shouldn't happen, of course\n\t\t}\n\t}", "function getLeagueTeams(req, rsp,next) {\n debug(\"/teams for:\"+req.params.id);\n leaguesModel.getTeams(parseInt(req.params.id),(err, fixtures) => {\n if (err!==undefined) debug(\"/league read ERROR:\"+err);\n debug(\"/teams read:\"+fixtures[0]);\n rsp.render(\"teams\", {title: fixtures[0], fixtures: fixtures.fixtures })\n });\n}", "function getTeamURL(team){\n var teamURL = {\n 'ARI': 'azcardinals.com',\n 'ATL': 'atlantafalcons.com',\n 'BAL': 'baltimoreravens.com',\n 'BUF': 'buffalobills.com',\n 'CAR': 'panthers.com',\n 'CHI': 'chicagobears.com',\n 'CIN': 'bengals.com',\n 'CLE': 'clevelandbrowns.com',\n 'DAL': 'dallascowboys.com',\n 'DEN': 'denverbroncos.com',\n 'DET': 'detroitlions.com',\n 'GB': 'packers.com',\n 'HOU': 'houstontexans.com',\n 'IND': 'colts.com',\n 'JAX': 'jaguars.com',\n 'KC': 'chiefs.com',\n 'LA': 'therams.com',\n 'LAC': 'chargers.com',\n 'MIA': 'miamidolphins.com',\n 'MIN': 'vikings.com',\n 'NE': 'patriots.com',\n 'NO': 'neworleanssaints.com',\n 'NYG': 'giants.com',\n 'NYJ': 'newyorkjets.com',\n 'OAK': 'raiders.com',\n 'PHI': 'philadelphiaeagles.com',\n 'PIT': 'steelers.com',\n 'SF': '49ers.com',\n 'SEA': 'seahawks.com',\n 'TB': 'buccaneers.com',\n 'TEN': 'titansonline.com',\n 'WAS': 'redskins.com'\n };\n return teamURL[team];\n}", "static async getTeam(tournamentId, teamId) {\n const url = ENDPOINTS.TEAM_ENDPOINT;\n const parameters = {\n tournamentId: tournamentId,\n teamId: teamId\n };\n\n try {\n const team = await HTTPRequestHandler.get(url, parameters);\n return team;\n } catch(error) {\n console.log('getTeam error', error.toString());\n }\n }", "function loadTeams() {\n\tvar team1 = new Team(\"LSU\", \"LSU\", \"Baton Rouge\", \"LA\", \"SEC\"); \n\t_teams.push(team1); \n}", "static findTeamParticipants(teamName, callback) {\n this.getParticipants(function (participants) {\n callback(participants.filter(participant => participant.team === teamName));\n })\n }", "function get_teams() {\n $.ajax({\n type: \"GET\",\n url: '/datawake/plugin/teams',\n dataType: 'json',\n success: function (response) {\n console.log(\"GOT TEAMS\")\n console.log(response)\n $scope.teams = response\n $scope.$apply()\n },\n error: function (jqxhr, textStatus, reason) {\n console.error(textStatus + \" \" + reason);\n }\n\n });\n }", "function getTeams(eventCode){\n var options = {\n host: 'private-945e3-frcevents.apiary-proxy.com',\n path: '/api/v1.0/teams/2015?eventCode=' + eventCode,\n headers:\n {Authorization: 'Basic ' + auth}\n };\n callback = function(response) {\n var str = '';\n\n\n response.on('data', function(chunk) {\n str += chunk;\n });\n\n response.on('end', function() {\n var teams = JSON.parse(str);\n genTeamArray(teams);\n });\n };\n\n http.request(options, callback).end();\n}", "function getTeam() {\n if (team.includes(\"Retired\") === true) {\n return \"Retired\";\n }\n if (team.includes(\"Free Agent\") === true) {\n return \"Free Agent\";\n } else {\n return team;\n }\n }", "async function searchTeamsByName(team_name){\n const team_data = await axios.get(`${api_domain}/teams/search/${team_name}`, {\n params: {\n api_token: process.env.api_token,\n },\n })\n if (team_data.data.data.length == 0)\n return [];\n return team_data.data.data;\n}", "async function myTeam() {\n var teamInfo = await getTeamInfo();\n var queryStringParams = getQueryStringParams('my-team', teamInfo);\n var stats = await getStats(queryStringParams);\n\n var teamMap = getTeamMap(teamInfo, stats);\n var gameweekPlan = getGameweekPlan(teamMap, teamInfo);\n\n showMyPage(gameweekPlan);\n}", "function getTeam() {\n $http.get('/assets/json/people.json')\n .success(function (data) {\n $scope.team = data;\n });\n }", "async function getFutureGames(team_id) {\n let future_games_info = await getFutureGamesByTeam(team_id);\n return future_games_info;\n}", "function fetchSpecificTeamData(value) {\n fetch(`https://free-nba.p.rapidapi.com/games/${value}`, {\n method: \"GET\",\n headers: {\n \"x-rapidapi-key\": \"85d43d1b47msh7273a9c7d1d5c94p1b0a1cjsnbc483a52d1e3\",\n \"x-rapidapi-host\": \"free-nba.p.rapidapi.com\",\n },\n })\n .then((response) => response.json())\n .then((json) => fillFilteredData(json));\n}", "getGroups() {\n const slack_groups = this.bot.getGroups()._value.groups;\n\n for (let item = 0; item < slack_groups.length; item++) {\n this.groups[slack_groups[item].id] = slack_groups[item].name;\n }\n }", "function teamNames() {\n return [homeTeam().teamName, awayTeam().teamName];\n}", "function getTeamPlayers(match, teamId) {\n // since the participantIdentities portion doesn't track teamId\n // we determine it by looking at participants to find out the teamId\n // NOTE: it looks like participants is always in participantId sorted order\n \n var pOnTeam = [];\n var summoners = [];\n \n for(i = 0; i < match['participants'].length; i++) {\n if(match['participants'][i]['teamId'] == teamId) {\n pOnTeam.push(i+1);\n }\n }\n \n for(i = 0; i < match['participantIdentities'].length; i++) {\n if(pOnTeam.indexOf(match['participantIdentities'][i]['participantId']) != -1) {\n summoners.push(match['participantIdentities'][i]['player']['summonerName']);\n }\n }\n return summoners; \n}", "TeamViewInSpace (baseUrl,username,spacename,teamname){\n browser.get(baseUrl + username + \"/\" + spacename +\"/teams/\" + teamname);\n }", "async getTeams(leagueID) {\n const results = await axios.get(`${this.URL}/${this.ACTIONS.getTeams}&league_id=${leagueID}&${this.KEY}`);\n return results.data\n }", "function getTeamFromInfo(playerInfo) {\n for (var j = 0; j < Teams.length; j++) {\n if (Teams.includes(playerInfo[j])) {\n var team = playerInfo[j];\n break;\n }\n }\n return team;\n}", "function retrieve_league_teams(leagueId) \t\n\t{\n\t\tconsole.log('retrieve_league_teams called');\n\t\t$('#__rankingslash_leagueId99Form').find('span.select-league-team-span').empty();\n\t\tshow_loader();\n\t\tif(league_id_is_a_number(leagueId))\n\t\t{\n\t\t\tget_mfl_league_teams_by_league_id(leagueId).done(handle_mfl_league_teams);\t\t\n\t\t}\n\t\telse\n\t\t{\n\t\t\thide_loader();\n\t\t}\n\t}", "async function getTeamInfo() {\n try{\n let myData = await fetch('https://fantasy.premierleague.com/api/me/', {});\n let myDataJSON = await myData.json();\n\n let teamId = myDataJSON.player.entry;\n let myTeam = await fetch(`https://fantasy.premierleague.com/api/my-team/${teamId}/`, {});\n let myTeamJSON = await myTeam.json();\n\n myTeamJSON.teamId = teamId;\n //console.log(myTeamJSON);\n return myTeamJSON;\n } catch (e) {\n return {};\n }\n}", "function findTeam(){\n for(var teamIndex=0; teamIndex < Storage.teams.length; teamIndex++){\n if(Storage.teams[teamIndex].name === \"MENACE\"){\n return Storage.teams[teamIndex];\n }\n }\n return {};\n}", "async function getTeamsInfo(teams_ids_list) {\n let promises = [];\n teams_ids_list.map((id) =>\n promises.push(\n axios.get(`${api_domain}/teams/${id}`, {\n params: {\n api_token: process.env.api_token,\n include: \"coach, venue\"\n },\n })\n )\n );\n let teams_info = await Promise.all(promises);\n return await extractRelevantTeamData(teams_info);\n}", "get team() {\r\n return new Team(this);\r\n }", "getTeamUsingId(teamid) {\r\n // let sql_getTeamPlayers = `SELECT id player_id, full_name player_name\r\n // FROM user_tb WHERE team_id = ${teamid}\r\n // ORDER BY player_id ASC`;\r\n // let sql_getTeamInfo = `SELECT id, team_name, captain_id, manager_id\r\n // FROM team_tb WHERE id = ${teamid}`;\r\n let sql_getTeamInfo = `SELECT A.id, A.team_name, B.full_name captain_name, C.full_name manager_name, \r\n B.phone_no captain_contact_no, C.phone_no as manager_contact_no FROM team_tb A\r\n LEFT JOIN user_tb B ON (A.captain_id = B.id)\r\n LEFT JOIN user_tb C ON (A.manager_id = C.id)\r\n WHERE A.id = ${teamid}`;\r\n // let getTeamPlayers = this.apdao.all(sql_getTeamPlayers);\r\n let getTeamInfo = this.apdao.all(sql_getTeamInfo);\r\n // return [getTeamPlayers, getTeamInfo];\r\n return getTeamInfo;\r\n }", "function getPlayersListByMatchId(homeTeamId, awayTeamId) {\r\n var wkUrl = config.apiUrl + 'teamsListByMatchId/';\r\n return $http({\r\n url: wkUrl,\r\n params: { homeTeamId: homeTeamId, awayTeamId: awayTeamId },\r\n method: 'GET',\r\n isArray: true\r\n }).then(success, fail)\r\n function success(resp) {\r\n return resp.data;\r\n }\r\n function fail(error) {\r\n var msg = \"Error getting list: \" + error;\r\n //log.logError(msg, error, null, true);\r\n throw error; // so caller can see it\r\n }\r\n }", "async getTeamUsers () {\n\t\tthis.debug('\\tGetting users on team...');\n\t\tconst users = await this.data.users.getByQuery(\n\t\t\t{\n\t\t\t\tteamIds: this.team.id\n\t\t\t},\n\t\t\t{\n\t\t\t\thint: UserIndexes.byTeamIds\n\t\t\t}\n\t\t);\n\t\tthis.users = users.reduce((usersHash, user) => {\n\t\t\tusersHash[user.id] = user;\n\t\t\treturn usersHash;\n\t\t}, {});\n\t\tthis.debug(`\\t${Object.keys(this.users).length} users found on team`);\n\t}", "function getTeamPlayers(teamInfo){\n var idArray = [];\n for (var i = 0; i < teamInfo.length; i++) {\n var nestTeamArr = [];\n nestTeamArr.push(teamInfo[i][0]);\n nestTeamArr.push(teamInfo[i][1]);\n idArray.push(nestTeamArr)\n }\n // time to get hit the api again with current data\n console.log(idArray);\n console.log(teamInfo);\n splittingTeams(idArray)\n }", "function insertTeamsWithTBA() {\n for (let team_id in teams) { // for each team\n let team = teams[team_id];\n // gets team name via TBA call\n team_api.getTeam(\"frc\" + team, {}, function(error, data, response) {\n if (error) {\n console.error(error);\n } else {\n team_id_to_name[team] = data[\"nickname\"];\n // inserts team information into the \"teams\" page\n insertTeam(team);\n }\n });\n }\n}", "function loadAllMembers() {\n let allTeamContent = \"\";\n document.querySelector(\"#teamStatus\").innerHTML = \"<p>Team Status: \" + (6 - currentTeam.length) + \" slot(s) left on your team</p>\";\n currentTeamHTML.forEach(teamMember => {\n allTeamContent += teamMember;\n });\n document.querySelector(\"#teamInfo\").innerHTML = allTeamContent;\n}", "function team(req, res) {\n // variables defined in the Swagger document can be referenced using req.swagger.params.{parameter_name}\n // Status of users to be shown. Could be PLAYER, MEMBER, SICK, DELETED, INIT - https://pd.tymy.cz/api/users/status/player\n // now shows all users\n https.get('https://pd.tymy.cz/api/users?login=simon&password=e0fcb7fc608c79e69fdc99ff7050aa72', (resp) => {\n\n let rawdata = '';\n resp.on('data', (data) => {\n // console.log(JSON.parse(data));\n console.log('get TEAM data');\n // console.log(data.toString());\n rawdata += data.toString();\n });\n\n resp.on('end', () => {\n console.log('send TEAM data');\n // console.log(rawdata);\n if (JSON.parse(rawdata.toString()).status === \"OK\") {\n res.json(JSON.parse(rawdata.toString()).data);\n }\n });\n\n }).on(\"error\", (err) => {\n console.log(\"Error: \" + err.message);\n });\n\n // this sends back a JSON response which is a single string\n // res.json('test');\n}", "getLiveLeagueGames() {\n const query_params = {\n key: this.apiKey\n }\n return fetch(BASE_URL + DOTA_MATCHES + 'GetLiveLeagueGames/v1/?' + handleQueryParams(query_params))\n .then(response => responseHandler(response))\n .catch(e => e)\n }", "async function addTeamClick() {\n\t\tgamesForm.innerHTML = ''\n\t\tgamesRes.innerHTML = ''\n\t\tgetGamesFormButton.innerText = 'Get Games'\n\t\tgetGamesFormButton.onclick = onGetGamesButtonClick\n\n\t\t// hide last button\n\t\taddTeamButton.innerText = 'close Add Team'\n\t\taddTeamButton.onclick = function() {\n\t\t\taddTeamButton.innerText = 'Add Team'\n\t\t\taddTeamForm.innerHTML = ''\n\t\t\tshowAddTeam()\n\t\t}\n\n\t\t// get and show country list with search button\n\t\treturn getCountryList()\n\t\t\t.then(res => res.message)\n\t\t\t.then(makeCountryForm)\n\t\t\t.catch(showSearchError)\n\t}", "function getTeamListApi(callback) {\n const params = {url: teamListApi, data: {by_date: \"desc\"}, success: callback };\n $.ajax(params);\n}", "getThirdPartyProvidersPerTeam () {\n\t\tthis.providerHosts = {};\n\t\t(this.teams || []).forEach(team => {\n\t\t\tconst providers = this.getThirdPartyProvidersForTeam(team);\n\t\t\tthis.providerHosts[team.id] = {};\n\t\t\tproviders.forEach(provider => {\n\t\t\t\tthis.providerHosts[team.id][provider.id] = provider;\n\t\t\t});\n\t\t});\n\t}", "async function getPastGames(team_id) {\n let past_games_info = await getPastGamesByTeam(team_id);\n return past_games_info;\n}", "function queryTeams(){\n\t\t\tteamOnePlayers = document.querySelectorAll('.tile--team-one .tile__list .player .playername');\n\t\t\tteamTwoPlayers = document.querySelectorAll('.tile--team-two .tile__list .player .playername');\n\n\t\t\tvar modalTeamListOne = '';\n\t\t\tvar modalTeamListTwo = '';\n\n\t\t\tteamOnePlayers.forEach(function(element){\n\t\t\t\tmodalTeamListOne +='<p>' + element.innerHTML + '</p>';\n\t\t\t});\n\n\t\t\tteamTwoPlayers.forEach(function(element){\n\t\t\t\tmodalTeamListTwo +='<p>' + element.innerHTML + '</p>';\n\t\t\t});\n\n\t\t\t$('.teamone-modal').html(modalTeamListOne);\n\t\t\t$('.teamtwo-modal').html(modalTeamListTwo);\n\t\t}", "function getTeamDetail() {\n return new Promise((resolve, reject) => {\n let id = localStorage.getItem(\"team_id\") || null;\n if (!id) loadPage(\"home\");\n\n if (\"caches\" in window) {\n caches.match(`${BASE_URL}teams/${id}`).then((res) => {\n if (res) {\n res.json().then((data) => {\n renderSingleCard(data);\n resolve(data);\n });\n }\n });\n }\n\n fetch(`${BASE_URL}teams/${id}`, header)\n .then(status)\n .then(json)\n .then((data) => {\n renderSingleCard(data);\n\n resolve(data);\n })\n .catch(error);\n });\n}", "function getplayersByTeamId(teamId) {\r\n var wkUrl = config.apiUrl + 'playersListByTeam/';\r\n return $http({\r\n url: wkUrl,\r\n params: { teamId: teamId },\r\n method: 'GET',\r\n isArray: true\r\n }).then(success, fail)\r\n function success(resp) {\r\n return resp.data;\r\n }\r\n function fail(error) {\r\n var msg = \"Error getting list: \" + error;\r\n //log.logError(msg, error, null, true);\r\n throw error; // so caller can see it\r\n }\r\n }", "function getAll() {\n return new Promise(function(resolve, reject) {\n dbPromised\n .then(function(db) {\n let tx = db.transaction(\"teams\", \"readonly\");\n let store = tx.objectStore(\"teams\");\n return store.getAll();\n })\n .then(function(teams) {\n resolve(teams);\n });\n });\n}", "async function getFutureGamesByTeam(team_id){\n const currentDate = new Date();\n const timestamp = currentDate.getTime(); \n const future_games = await DButils.execQuery(\n `SELECT * FROM dbo.Games WHERE (homeTeam_id = '${team_id}' OR visitorTeam_id = '${team_id}') AND game_timestamp >= '${timestamp}' `\n );\n\n // sorting the games by date (increasing)\n future_games.sort(function(first, second) {\n return first.game_timestamp - second.game_timestamp;\n });\n return future_games\n}" ]
[ "0.7275688", "0.69188476", "0.68264294", "0.67054564", "0.6695281", "0.66427034", "0.6642136", "0.6607248", "0.6599728", "0.6587166", "0.65654695", "0.656089", "0.65212804", "0.6480112", "0.6442994", "0.6440584", "0.64404196", "0.6414064", "0.6412702", "0.6412594", "0.6408762", "0.6392699", "0.6386134", "0.6364057", "0.63525194", "0.63390285", "0.63297087", "0.6318637", "0.62893975", "0.62772286", "0.62631637", "0.62598145", "0.6253343", "0.62368536", "0.6228534", "0.62189054", "0.62180626", "0.62139827", "0.62139827", "0.62067616", "0.620077", "0.619935", "0.619608", "0.61948824", "0.61938834", "0.6189767", "0.61849684", "0.6180962", "0.61774623", "0.6155314", "0.613416", "0.6122424", "0.61208713", "0.6118335", "0.6114103", "0.61041695", "0.6096626", "0.6085887", "0.6073623", "0.60409176", "0.6038228", "0.60355014", "0.6013006", "0.60110664", "0.6005046", "0.60031223", "0.59942883", "0.59912574", "0.5969822", "0.59666413", "0.5949514", "0.59487695", "0.59396416", "0.59350634", "0.59347486", "0.5911543", "0.59105766", "0.5908254", "0.5899837", "0.5896398", "0.5895198", "0.5887359", "0.587152", "0.5864946", "0.58610904", "0.58603895", "0.5854023", "0.5840105", "0.58217376", "0.5817627", "0.58068305", "0.5799205", "0.578153", "0.5770855", "0.5763425", "0.5752259", "0.5741483", "0.57353663", "0.57280964", "0.5726632" ]
0.6400965
21
/ This will consume any overflow in the time accumulated from 'UpdateTime' in 'FixedTimeStep' chunks. / The passed functoin will be invoked for each consumed chunk. This allows us to catch up with any / fraction portions of our fixed time step that overflowed during the normal update cycle.
static ConsumeAccumulatedTime(func) { let stepped = 0; let stepRate = FIXED_TIME_STEP; while(Time._accu >= stepRate) { stepped++; func(); Time._accu -= stepRate; //this is a safety feature to ensure we never take longer than an allowed maximum time. if(Time._time - Time._lastTime > MAX_TIME_STEP) { Time._accu = 0; return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "update(timeStep) {\n\n }", "function timeStepUpdate() {\n if (incrementing == false) {\n incrementing = true;\n setTimeout(function () {\n time += 1;\n incrementing = false;\n }, timeStep * 1000);\n }\n}", "_processTick(tickTime, ticks) {\n // do the loop test\n if (this._loop.get(tickTime)) {\n if (ticks >= this._loopEnd) {\n this.emit(\"loopEnd\", tickTime);\n this._clock.setTicksAtTime(this._loopStart, tickTime);\n ticks = this._loopStart;\n this.emit(\"loopStart\", tickTime, this._clock.getSecondsAtTime(tickTime));\n this.emit(\"loop\", tickTime);\n }\n }\n // handle swing\n if (this._swingAmount > 0 &&\n ticks % this._ppq !== 0 && // not on a downbeat\n ticks % (this._swingTicks * 2) !== 0) {\n // add some swing\n const progress = (ticks % (this._swingTicks * 2)) / (this._swingTicks * 2);\n const amount = Math.sin(progress * Math.PI) * this._swingAmount;\n tickTime +=\n new TicksClass(this.context, (this._swingTicks * 2) / 3).toSeconds() * amount;\n }\n // invoke the timeline events scheduled on this tick\n enterScheduledCallback(true);\n this._timeline.forEachAtTime(ticks, (event) => event.invoke(tickTime));\n enterScheduledCallback(false);\n }", "function recomputeCallback() {\n var len = TO_CALL.length;\n CALL_TIMEOUT = null;\n while (len--) {\n (TO_CALL.shift() || NOOP).call();\n }\n\n TO_CALL.added = {};\n}", "update() {\n \n /* Run update piped methods on the corresponding frame */\n const { pipeline } = this;\n let x = 0, len = pipeline.length, item;\n \n for(x;x<len;x++)\n {\n item = pipeline[x];\n \n /* run frame delayed methods based on frame delay count */\n if(item.delay)\n {\n item.curr += 1;\n if(item.curr === item.delay)\n {\n item.curr = 0; item();\n }\n }\n \n /* run time based delayed methods based on the amount of time passed */\n else if(item.time)\n {\n const now = Date.now();\n if(now - item.curr >= item.time)\n {\n item.curr = now; item();\n }\n }\n \n /* run the item on each frame */\n else\n {\n item();\n \n /* remove items marked for single use */\n if(item.once) { pipeline.splice(x, 1); len = pipeline.length; x -= 1; }\n }\n }\n }", "update () {\n\n this.particleSystem.step(\n this.stopwatch.getElapsedMs() * 0.001)\n\n this.updateChunk ()\n\n // invalidate (needsClear, needsRender, overlayDirty)\n this.viewer.impl.invalidate(true, false, false)\n\n this.emit('fps.tick')\n }", "function loopFn() {\n\n // check that we're actually running...\n if (running) {\n\n var currentTime = new Date().getTime();\n var timeChange = currentTime - lastTime;\n var currentScroll = getScrollPos();\n\n // check if resize\n if (document.body.offsetWidth !== lastBodyWidth || document.body.offsetHeight !== lastBodyHeight) {\n // resize is true, save new sizes\n lastBodyWidth = document.body.offsetWidth;\n lastBodyHeight = document.body.offsetHeight;\n\n if (resizeTimeout)\n window.clearTimeout(resizeTimeout);\n resizeTimeout = window.setTimeout(function () {\n doLoopFunctions('resize',currentTime);\n }, resizeDebounce);\n }\n\n // check if scroll\n if (lastScroll !== currentScroll) {\n // scroll is true, save new position\n lastScroll = currentScroll;\n\n // call each function\n doLoopFunctions('scroll',currentTime);\n }\n\n // do the always functions\n doLoopFunctions('tick',currentTime);\n\n // save the new time\n lastTime = currentTime;\n\n\t\t\t// make sure we do the tick again next time\n\t requestAnimationFrame(loopFn);\n }\n }", "constructor (fixedTicksPerSeconds) {\n\t\tthis.frame = this.loop.bind(this);\n\t\tthis.fixedUpdateTimer = this.fixedInterval;\n\t\tthis.fixedTicksPerSeconds = fixedTicksPerSeconds;\n\t}", "function insulinOnBoardCalculator (iobObject) { //should update iob via formula & PUT call\n console.log(iobObject);\n //CURRENT issues:\n //Either need to make function for ONE array element at a Time OR\n //Find a way to clear all but one Set-timeout at a time\n\n let currentInsulinStack = [...iobObject.insulinStack];\n let updatedInsulinStack, bolusRate, stackLength;\n let duration = iobObject.duration;\n let iobId = $('#current-user-iob').val();\n let settingId = $('#current-user-settings').val();\n\n let totalIOBAmount = iobObject.iobAmount;\n let totalIOBTime = iobObject.iobTime;\n\n //Update Entries if there are any\n if (currentInsulinStack.length > 0) {\n\n //Updates Each Entry on insulin stack\n updatedInsulinStack = currentInsulinStack.map((el, ind) => {\n console.log(el);\n //For each element...Subtract 5 minutes, min = 0 and max = set duration\n el.timeRemaining = Math.min(Math.max((el.timeRemaining - 300000), 0), duration);\n\n //When all entries have 0 time remaining, stop recursively calling\n if (el.timeRemaining === 0) {\n //update everything to 0\n\n el.currentInsulin = 0;\n console.log('Time @ 0');\n }\n //First 15 minutes - time changes, insulin amount does not\n else if (el.timeRemaining >= (duration-900000)) {\n //Minus 5 minutes\n console.log('First 15 minutes', el.timeRemaining);\n }\n //first half of entry duration\n else if (el.timeRemaining >= (duration/2)) {\n bolusRate = ((el.entryAmount/2)/((duration-900000)/2))*300000; //5 minute increments\n el.currentInsulin = Math.max((el.currentInsulin - bolusRate), 0);\n totalIOBAmount -= bolusRate;\n console.log('First Half rate');\n }\n //second half of entry duration\n else if (el.timeRemaining < (duration/2)) {\n bolusRate = ((el.entryAmount/2)/((duration/2)))*300000; //5 minute increments\n // el.currentInsulin = Math.max((el.currentInsulin - bolusRate), 0);\n el.currentInsulin -= bolusRate;\n totalIOBAmount -= bolusRate;\n console.log('Second Half rate', bolusRate);\n }\n //Catch errors\n else {\n console.log('Something went wrong in IOB');\n return false;\n }\n\n return el;\n //Filter out entries that have zeroed out Locally and on Server\n }).filter((el)=> {\n console.log(el);\n if (el.timeRemaining === 0) deleteStackEntry(iobId, el._id);\n return !(el.timeRemaining === 0);\n });\n console.log(updatedInsulinStack);\n } else {\n updatedInsulinStack = [];\n }\n //Updating 5 minute time passage\n\n totalIOBTime = Math.min(Math.max((totalIOBTime - 300000), 0), duration);\n console.log('total Time' + totalIOBTime);\n //Set displayed IOB Totals\n $('#i-o-b').text(`${Math.round(totalIOBAmount * 100) / 100}`);\n $('#iob-time').text(`${Math.round((totalIOBTime/3600000) * 100) / 100}`);\n\n if (updatedInsulinStack.length === 0 || !updatedInsulinStack) {\n //Update each entry on insulin Stack\n updatedInsulinStack.map((el) => {\n updateStackEntry(el._id, el);\n })\n }\n //Update IOB Totals\n updateIob(iobId, {\n insulinOnBoard: {\n amount: totalIOBAmount,\n timeLeft: totalIOBTime\n }\n });\n //recursively call insulinOnBoard in 5 minutes\n setTimeout(() => {\n console.log('Timeout over', totalIOBTime, totalIOBAmount);\n\n insulinOnBoardCalculator({\n insulinStack: updatedInsulinStack,\n duration: iobObject.duration,\n iobAmount: totalIOBAmount,\n iobTime: totalIOBTime\n })\n }, 5000);//300000\n\n //If no entries left on stack, end recursive call\n// if (updatedInsulinStack.length === 0 || totalIOBAmount === 0 || totalIOBTime === 0) {\n// console.log('No entries in Insulin stack');\n//\n// updateIob(iobId, {\n// insulinOnBoard: { amount: 0, timeLeft: 0},\n// currentInsulinStack: [...updatedInsulinStack] //need to delete each entry?\n// });\n//\n// $('#i-o-b').text(`0`);\n// $('#iob-time').text(`0`);\n//\n// }\n // else {\n // console.log('Where insulinOnBoard called again')\n // //call to Update IOB Setting\n //\n // }\n}", "function update(time)\n {\n\t //console.log(\"UPDATE\");\n\t // calculation\n }", "updateR() {\n if (this.lastRUpdate==0 || globalUpdateCount - this.lastRUpdate >= DAY_LENGTH) {\n let pts = this.fields.map(f => f.pts).reduce((acc, pts) => acc.concat(pts), [])\n pts.push(...this.sender.objs.map(o => o.point))\n \n let nInfectious = 0\n const val = pts\n .map(pt => {\n if (pt.isInfectious()) {\n nInfectious += 1\n const timeInfectious = globalUpdateCount - pt.lastStatusUpdate + (pt.status == Point.INFECTIOUS2) ? Point.infectious1Interval : 0\n if (timeInfectious>0) {\n const timeRemaining = Point.infectious2Interval + Point.infectious1Interval - timeInfectious\n return pt.nInfected/timeInfectious*timeRemaining // estimated infections over duration of illness\n } else return 0\n } else return 0\n })\n .reduce((sum, ei) => sum + ei)\n \n if (nInfectious>0) {\n this.rVal = val/nInfectious\n this.rMax = this.rMax < this.rVal ? this.rVal : this.rMax\n } else this.rVal = 0\n this.lastRUpdate = globalUpdateCount\n }\n }", "update() {\n var lastTime = this.curTime;\n this.curTime += renko.fateFX.deltaTime * this.speed;\n\n this.updateSections(this.curTime, lastTime);\n\n // On update finished\n if(this.curTime > this.totalDuration) {\n this.handleUpdateFinished();\n }\n }", "update(time, delta) {\n }", "advance(numTimes, callback) {\n var _numTimes = numTimes || 1;\n\n _.times(_numTimes, () => {\n // update one time observers\n this.oneTimeFunctions.forEach(fn => fn());\n this.oneTimeFunctions = [];\n\n // update continue observers\n this.observers.forEach(observer => {\n observer.update();\n });\n\n this.currentTimeStep++; // should this go before or after updates? test!\n\n // for debugging\n if (callback) {\n callback();\n }\n });\n }", "function tick()\n {\n \t// schedule the next tick call.\n requestId = window.requestAnimationFrame(function(){ tick(); });\n \n // calculate the time since last tick in ms\n tickNow = Date.now();\n tickDelta = tickNow - tickThen;\n \n // if it's been long enough, call the given function.\n if (tickDelta >= tickInterval)\n {\n \t// adjust the tickThen time by how far OVER the tickInterval we went.\n tickThen = tickNow - (tickInterval !== 0 ? (tickDelta % tickInterval) : 0);\n \n if (obj === null)\n func(tickDelta);\n else\n func.call(obj, tickDelta);\n }\n }", "step(elapsed) {\r\n if (this.done) {\r\n return\r\n }\r\n\r\n console.log(elapsed)\r\n if (this.changes.length == 0) {\r\n console.log(\"getting more things\")\r\n this.update()\r\n }\r\n\r\n for (i in this.changes) {\r\n console.log(i, \" \", this.changes[i])\r\n if (this.changes[i].duration <= 0) {\r\n // remove, but ideally would have list sorted by duration remaining?\r\n this.changes.splice(i, 1)\r\n }\r\n\r\n }\r\n\r\n\r\n }", "_eventsUpdated() {\n this._part.clear();\n this._rescheduleSequence(this._eventsArray, this._subdivision, this.startOffset);\n // update the loopEnd\n this.loopEnd = this.loopEnd;\n }", "function part6() {\n\t\tclearImmediate(setImmediate(f6));\n\t\tclearTimeout(setTimeout(f6, 0));\n\t\tclearInterval(setInterval(f6, 0));\n\t\t//no way to stop a tick, so we won't start one here\n\t\tif (typeof requestAnimationFrame != \"undefined\") cancelAnimationFrame(requestAnimationFrame(f6));\n\t\tfunction f6() {\n\t\t\tspace(\"this should never get called!\");\n\t\t}\n\t\tpart7();\n\t}", "update() {\n if (this._futureTrackDeltaTimeCache !== -1) {\n return;\n }\n\n const currentTime = this.gameTimeSeconds;\n\n this._incrementFrame();\n this._calculateNextDeltaTime(currentTime);\n this._calculateFrameStep();\n }", "function fixedUpdate(args, ctx) {\n}", "update () {\n\n this.lastTime = this.time;\n\n this.time = Date.now();\n\n this.elapsedMS = this.time - this.lastTime;\n\n this.deltaScale = (this.elapsedMS / this._desiredFrameDurationMS) * this._timeScale;\n\n this.now = this.time;\n\n if (this.playing) {\n \n window.requestAnimationFrame(this.update.bind(this));\n\n this.eventObj.now = this.now;\n this.eventObj.elapsed = this.elapsedMS;\n this.eventObj.delta_scale = this.deltaScale;\n\n for (var i = 0, l = this._updates.length; i < l; i++) {\n this._updates[i](this.eventObj);\n }\n }\n }", "step(now) {\n let percent;\n if( this.duration === 0 ){\n percent = 1;\n } else {\n percent = (now - this.startTime) / this.duration;\n }\n\n for (let i = 0; i < this.nodeContainer.instanceCount; i++) {\n const currentPosition = this.calStep(\n { x: this.startPositions[2 * i], y: this.startPositions[2 * i +1 ]},\n { x: this.endPositions[2 * i], y: this.endPositions[2 * i +1 ]},\n percent\n );\n\n const nodeId = this.nodeContainer.idIndexMap.idFrom(i);\n const nodeSprite = this.nodeSprites[nodeId];\n nodeSprite.updateNodePosition(currentPosition);\n this.nodeContainer.nodeMoved(nodeSprite);\n }\n\n Object.values(this.edgeSprites).forEach((link) => {\n link.updatePosition();\n });\n\n if (percent > 1) {\n this.resolve();\n } else {\n requestAnimationFrame(this.step.bind(this));\n }\n }", "function d3_timer_sweep() {\n var t0,\n t1 = d3_timer_queueHead,\n time = Infinity;\n while (t1) {\n if (t1.f) {\n t1 = t0 ? t0.n = t1.n : d3_timer_queueHead = t1.n;\n } else {\n if (t1.t < time) time = t1.t;\n t1 = (t0 = t1).n;\n }\n }\n d3_timer_queueTail = t0;\n return time;\n }", "function updateEta(num){\n\tif(currentEta <= 0){\n\t currentEta = 0;\n\t}\n\telse {\n\t currentEta = totalTime - (num * (timePerStep/60)/60);\n\t}\n }", "function step() {\n callback();\n window.requestAnimationFrame(step);\n }", "function part7() {\n\t\tstart = tick();\n\t\tcount = 0;\n\t\tvar timer7 = Timer();\n\t\ttimer7.immediate(f7);\n\t\tfunction f7() {\n\t\t\tif (tick() < start + 1000) {\n\t\t\t\tcount++;\n\t\t\t\ttimer7.immediate(f7);\n\t\t\t} else {\n\t\t\t\tlog(commas(count) + \" Timer's .immediate()\");\n\t\t\t\tshut(timer7);\n\t\t\t\tpart8();\n\t\t\t}\n\t\t}\n\t}", "performFinalCorrection(amount) {\n\n console.log(\"entering performFinalCorrection()\");\n\n let who = this.sjs.id;\n\n let bumpMs = 300;\n\n let limit = 128;\n\n let acc = 0;\n\n let curMs = 0;\n\n while(acc < amount) {\n let thisOne = Math.min(limit,amount-acc);\n\n // if( (amount-limit) > 0 ) {\n // amount -= thisOne;\n // }\n\n setTimeout(()=>{\n console.log(\"run: \" + thisOne);\n this.sjs.dsp.setPartnerSfoAdvance(who, thisOne, 4, false);\n },curMs);\n\n curMs += bumpMs;\n acc += thisOne;\n }\n\n setTimeout(()=>{\n if( this.onDoneCb ) {\n this.onDoneCb();\n }\n }, curMs);\n\n }", "group( state, pattern, phase, duration, overrideIncr=null ) {\n const start = phase.clone(),\n end = start.add( duration ),\n phaseIncr = overrideIncr === null \n ? getPhaseIncr( pattern ) \n : overrideIncr\n \n let eventList = []\n\n //console.log( \n // 'type:', pattern.type, \n // 'phase:', phase.toFraction(),\n // 'incr:', phaseIncr.toFraction(),\n // 'dur:', duration.toFraction()\n //)\n \n while( phase.compare( end ) < 0 ) {\n // if pattern is a list, read using current phase, else read directly\n const member = Array.isArray( pattern.values ) === true \n ? pattern.values[ getIndex( pattern, phase ) ] \n : pattern.value\n\n // get duration of current event being processed\n const dur = calculateDuration( phase, phaseIncr, end )\n\n // if value is not a numeric or string constant (if it's a pattern)...\n if( member === undefined || (isNaN( member.value ) && typeof member.value !== 'string') ) {\n // query the pattern and remap time values appropriately \n if( member !== undefined ) member.parent = pattern\n //console.log( 'processing ', pattern.type, member.type, dur.toFraction(), phaseIncr.toFraction() )\n const events = processPattern( \n member, \n Fraction(1), \n //member.type !== 'slow' ? Fraction(0) : phase.clone(), \n Fraction(0),\n null, //getPhaseIncr(member),\n null, \n false//shouldRemap( member )\n )\n .map( evt => {\n evt.arc.start = evt.arc.start.mul( dur ).add( phase )\n evt.arc.end = evt.arc.end.mul( dur ).add( phase )\n return evt\n })\n\n eventList = eventList.concat( events )\n }else{\n // XXX shouldn't we just process all patterns???\n // member does not need further processing, so add to event list\n const evt = { \n value:member.value, \n arc:Arc( phase, phase.add( dur ) ),\n }\n if( member.uid !== undefined ) evt.uid = member.uid \n\n eventList.push( evt )\n }\n\n // assuming we are starting / ending at a regular phase increment value...\n \n if( phase.mod( phaseIncr ).valueOf() === 0 ) {\n phase = advancePhase( phase, phaseIncr, end )\n }else{\n // advance phase to next phase increment\n phase = phase.add( phaseIncr.sub( phase.mod( phaseIncr ) ) ) \n }\n }\n\n // prune any events that fall before our start phase or after our end phase\n eventList = eventList.filter( evt => {\n return evt.arc.start.valueOf() >= start.valueOf() && evt.arc.start.valueOf() < end.valueOf()\n })\n \n return state.concat( eventList )\n }", "manageTimeSlice(currentProcess, time) {\n // console.log(\"This is the quantum\", this.quantum);\n // console.log(\"This is the priorityLevel\", this.priorityLevel);\n // console.log(\"Current process and time\", currentProcess, time);\n if (currentProcess.stateChanged === true) {\n // console.log(\"What is the queu of this TRUE,\",currentProcess);\n // console.log(\"state is true, don't affect this process\");\n return currentProcess;\n }\n if (currentProcess.stateChanged === false) {\n console.log(\"What is the cpuTimeNeeded of this,\", currentProcess.cpuTimeNeeded);\n console.log(\"This is the passed in time\", time);\n let timeAfterQuantime = this.doCPUWork(time);\n if (timeAfterQuantime === 0 || timeAfterQuantime < 0) {\n console.log(\"Returned after cpuWork, time\", timeAfterQuantime);\n // this.dequeue();\n };\n if (timeAfterQuantime !== 0 || timeAfterQuantime > 0) {\n console.log(\"Returned after cpuWork, not complete, time\", timeAfterQuantime);\n // this.dequeue();\n this.doBlockingWork(timeAfterQuantime);\n };\n // currentProcess.cpuTimeNeeded -= time;\n }\n\n\n }", "function _update(deltaTime) {\n _gameTime += deltaTime;\n\n var i;\n\n // Check whether this chapter has been completed\n if ((_scoreToEndChapter > 0 && _score >= _scoreToEndChapter) || \n (_layersToEndChapter > 0 && _layersCollapsedCount >= _layersToEndChapter)) {\n _endGame(null, true);\n } else {\n input.update(deltaTime);\n\n gameWindow.update(deltaTime);\n\n game.collapseBombWindow.update(deltaTime);\n game.settleBombWindow.update(deltaTime);\n\n // Update the preview windows\n switch (game.numberOfSidesBlocksFallFrom) {\n case 4:\n for (i = 0; i < 4; ++i) {\n game.previewWindows[i].update(deltaTime);\n if (game.previewWindows[i].isCoolDownFinished()) {\n _setupNextBlock(game.previewWindows[i]);\n }\n }\n break;\n case 3:\n game.previewWindows[0].update(deltaTime);\n if (game.previewWindows[0].isCoolDownFinished()) {\n _setupNextBlock(game.previewWindows[0]);\n }\n game.previewWindows[1].update(deltaTime);\n if (game.previewWindows[1].isCoolDownFinished()) {\n _setupNextBlock(game.previewWindows[1]);\n }\n game.previewWindows[3].update(deltaTime);\n if (game.previewWindows[3].isCoolDownFinished()) {\n _setupNextBlock(game.previewWindows[3]);\n }\n break;\n case 2:\n game.previewWindows[1].update(deltaTime);\n if (game.previewWindows[1].isCoolDownFinished()) {\n _setupNextBlock(game.previewWindows[1]);\n }\n game.previewWindows[3].update(deltaTime);\n if (game.previewWindows[3].isCoolDownFinished()) {\n _setupNextBlock(game.previewWindows[3]);\n }\n break;\n case 1:\n game.previewWindows[0].update(deltaTime);\n if (game.previewWindows[0].isCoolDownFinished()) {\n _setupNextBlock(game.previewWindows[0]);\n }\n break;\n default:\n return;\n }\n }\n }", "function step () {\n // Check for scroll interference before continuing animation\n if (lastX === container.scrollLeft && lastY === container.scrollTop) {\n const elapsed = Date.now() - startTime\n lastX = container.scrollLeft = position(startX, targetX, elapsed, duration)\n lastY = container.scrollTop = position(startY, targetY, elapsed, duration)\n if (elapsed > duration && typeof options.onArrive === 'function') options.onArrive()\n else window.requestAnimationFrame(step)\n } else {\n typeof options.onInterrupt === 'function' && options.onInterrupt()\n }\n }", "async function reCalc(ev) {\n const nowTime = new Date().getTime();\n if (ev.repeatDays.length > 0) { // repeatDays is an array of days to skip\n // If it's got repeatDays set up, splice the next time, and if it runs out of times, return null\n while (nowTime > ev.eventDT && ev.repeatDays.length > 0) {\n const days = parseInt(ev.repeatDays.splice(0, 1)[0], 10);\n ev.eventDT = parseInt(ev.eventDT, 10) + parseInt(dayMS * days, 10);\n }\n if (nowTime > ev.eventDT) { // It ran out of days\n return null;\n }\n } else if (ev.repeat.repeatDay || ev.repeat.repeatHour || ev.repeat.repeatMin) { // 0d0h0m\n // Else it's using basic repeat\n while (nowTime >= ev.eventDT) {\n ev.eventDT =\n parseInt(ev.eventDT, 10) +\n (ev.repeat.repeatDay * dayMS) +\n (ev.repeat.repeatHour * hourMS) +\n (ev.repeat.repeatMin * minMS);\n }\n }\n return ev;\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 _updateCalcDuringStartup() {\n if (_measurements.length <= 10) {\n _updateSlidingWindowAggregateBandwidth();\n } else {\n _updateCalcDuringStartup = NOOP;\n }\n }", "function scheduler(part) {\n let relativeMod = relativeTime % part.loopTime,\n lookAheadMod = lookAheadTime % part.loopTime;\n\n if (lookAheadMod < relativeMod && part.iterator > 1) {\n part.iterator = 0;\n } \n\n while (part.iterator < part.schedule.length &&\n part.schedule[part.iterator].when < lookAheadMod) {\n\n part.queue(part.schedule[part.iterator].when - relativeMod);\n part.iterator += 1;\n }\n }", "function scheduler(part) {\n let relativeMod = relativeTime % part.loopTime,\n lookAheadMod = lookAheadTime % part.loopTime;\n\n if (lookAheadMod < relativeMod && part.iterator > 1) {\n part.iterator = 0;\n } \n\n while (part.iterator < part.schedule.length &&\n part.schedule[part.iterator].when < lookAheadMod) {\n\n part.queue(part.schedule[part.iterator].when - relativeMod);\n part.iterator += 1;\n }\n }", "function ProcessArrayPacked(data, handler, callback,interval,callbackInterval) {\n var maxtime = 100;\t\t// chunk processing time\n var delay = 20;\t\t// delay between processes\n var queue = data.concat();\t// clone original array\n setTimeout(function() {\n var i = 0;\n var endtime = +new Date() + maxtime;\n\n do {\n handler(queue.shift());\n } while (queue.length > 0 && endtime > +new Date() && i++ < interval );\n if (queue.length > 0) {\n\n if(i >= interval){\n i=0;\n if (callbackInterval) callbackInterval();\n }\n setTimeout(arguments.callee, delay);\n }\n else {\n if (callback) callback();\n }\n\n }, delay);\n}", "nextTickChecker() {\n let currentTime = (new Date()).getTime();\n if (currentTime > this.nextExecTime) {\n this.delayCounter++;\n this.callTick();\n this.nextExecTime = currentTime + this.options.stepPeriod;\n }\n window.requestAnimationFrame(this.nextTickChecker.bind(this));\n }", "_tryFixBufferStall (bufferInfo, stalledDurationMs) {\n const { config, fragmentTracker, media } = this;\n const currentTime = media.currentTime;\n\n const partial = fragmentTracker.getPartialFragment(currentTime);\n if (partial) {\n // Try to skip over the buffer hole caused by a partial fragment\n // This method isn't limited by the size of the gap between buffered ranges\n const targetTime = this._trySkipBufferHole(partial);\n // we return here in this case, meaning\n // the branch below only executes when we don't handle a partial fragment\n if (targetTime) {\n return;\n }\n }\n\n // if we haven't had to skip over a buffer hole of a partial fragment\n // we may just have to \"nudge\" the playlist as the browser decoding/rendering engine\n // needs to cross some sort of threshold covering all source-buffers content\n // to start playing properly.\n if (bufferInfo.len > config.maxBufferHole &&\n stalledDurationMs > config.highBufferWatchdogPeriod * 1000) {\n logger.warn('Trying to nudge playhead over buffer-hole');\n // Try to nudge currentTime over a buffer hole if we've been stalling for the configured amount of seconds\n // We only try to jump the hole if it's under the configured size\n // Reset stalled so to rearm watchdog timer\n this.stalled = null;\n this._tryNudgeBuffer();\n }\n }", "function loop(value, testFn, updateFn, bodyFn) {}", "runGameTickBatch() {\n const batchStartTimeMs = Date.now();\n for (let i = 0; i < this.ludicrousBatchSize; i++) {\n this.tickCallback();\n }\n const batchDurationMs = Date.now() - batchStartTimeMs;\n if (batchDurationMs > this.config.maxGameTickBatchDurationMs) {\n this.ludicrousBatchSize = this.ludicrousBatchSize / this.config.batchSizeAdjustmentMultiplier;\n } else if (batchDurationMs < this.config.maxGameTickBatchDurationMs / this.config.batchSizeAdjustmentMultiplier) {\n // const newValue = Math.min(1, this.ludicrousBatchSize * this.config.batchSizeAdjustmentMultiplier);\n // if (newValue > 1) {\n // newValue;\n // }\n this.ludicrousBatchSize = Math.max(this.ludicrousBatchSize * this.config.batchSizeAdjustmentMultiplier, 1);\n }\n }", "function playSFXFastFootsteps (event) {\n sfxFastFootsteps.currentTime = 0;\n $(sfxFastFootsteps).each(function(){this.play(); $(this).animate({volume:1},1000)});\n\t}", "update () {\n\n window.requestAnimationFrame(this.update.bind(this));\n\n this.lastTime = this.time;\n\n this.time = Date.now();\n\n this.elapsedMS = this.time - this.lastTime;\n\n this.deltaScale = (this.elapsedMS / this._desiredFrameDurationMS) * this._timeScale;\n\n this.now = this.time;\n\n if (this.playing) {\n\n this.eventObj.now = this.now;\n this.eventObj.elapsed = this.elapsedMS;\n this.eventObj.delta_scale = this.deltaScale;\n\n for (var i = 0, l = this._updates.length; i < l; i++) {\n this._updates[i](this.eventObj);\n }\n }\n }", "nextTickSec () {\n this.timeOfSecsInADay++;\n\n /*\n * Here is interesting, we may run \"timer.onLater\" to add another callback here,\n * So we must lock current task scope, do not run the added callback.\n */\n const currentTasksCount = this._laterTasks.length;\n\n for (let i = 0; i < currentTasksCount; i++) {\n const taskInfo = this._laterTasks[i];\n taskInfo.secsLater -= 1;\n if (taskInfo.secsLater === 0) {\n taskInfo.task(this);\n taskInfo.executed = true;\n }\n }\n\n this._laterTasks = this._laterTasks.filter(taskInfo => taskInfo.executed !== true);\n }", "function updateLoop(){\n\t\t\t\t\tvar time = this.update();\n\n\t\t\t\t\t// set timer for next update\n\t\t\t\t\tthis.updateTimer = setTimeout(updateLoop.bind(this), 1000 - time.getMilliseconds());\n\t\t\t\t}", "forceTickRate(tickStartTime){\n // If the game is over, do not force another tick\n if( this.gameState == STATE_GAME_OVER ){\n return;\n }\n var tickTime = new Date().getTime() - tickStartTime;\n if(tickTime < 0){\n tickTime = 0;\n }\n var game = this;\n if(tickTime > tickLength){\n console.log(\"Dropping Frame\");\n setTimeout(this.tickCaller,(Math.floor(tickTime/tickLength)+1)*tickLength-tickTime, game);\n }else{\n setTimeout(this.tickCaller, tickLength-tickTime, game);\n }\n }", "async listenSince (seq, ev, fn) {\n if (ev !== 'change') throw Error('can only listenSince for \"change\" events')\n let buf = []\n this.debug('adding change listener')\n this.on('change', (pg, delta) => {\n if (buf) {\n // console.log('listenSince doing buffering of delta %o', delta)\n buf.push(delta)\n } else {\n this.debug('calling listenSince listener without buffering')\n fn(pg, delta)\n }\n })\n\n this.debug('listenSince STARTING REPLAY')\n await this.replaySince(seq, ev, fn)\n // a lot can happen here; we don't come back until after a tick\n //\n // if you don't wait for a tick, you'll never start getting events\n this.debug('listenSince resuming after replaySince')\n\n // loop as long as we need to, since fn might trigger more events\n while (buf.length) {\n // console.log('BUF: %O', buf)\n const delta = buf.shift()\n this.debug('calling listenSince with buffered event')\n if (delta.subject === undefined) {\n throw Error('trap')\n }\n fn(delta.subject, delta)\n }\n buf = false // flag to stop buffering\n this.emit('stable')\n }", "step() {\n let minCount = this.minuteCount();\n let minPosition = this.minutePosition();\n\n this.updateNextMinuteData(minCount, minPosition);\n this.addNextVisitor(minPosition);\n this.moveActiveVisitors(minCount);\n this.removeDoneVisitors();\n\n this.frameCount += 1;\n this.resetIfOver(this.minuteCount(), this.minutePosition());\n }", "pollScroll () {\n const domNode = ReactDOM.findDOMNode(this);\n\n // let's update the scroll now, in a raf.\n if (this.scrollDelta > 0) {\n domNode.scrollTop += this.scrollDelta;\n this.scrollDelta = 0;\n } else if (this.scrollDelta === -1) {\n domNode.scrollTop = domNode.scrollHeight;\n this.scrollDelta = 0;\n }\n\n const { scrollTop, scrollHeight, clientHeight } = domNode;\n if (scrollTop !== this.scrollTop || this.invalidate) {\n this.invalidate = false;\n const scrollLoadThreshold = LOG_LINE_HEIGHT * SCROLL_LOAD_THRESHOLD;\n const nearTop = (scrollTop - this.fakeLineCount * LOG_LINE_HEIGHT) <= scrollLoadThreshold;\n const nearBottom = scrollTop >= (scrollHeight - clientHeight - scrollLoadThreshold);\n const atBottom = scrollTop >= (scrollHeight - clientHeight - 1);\n\n const { lines } = this.props;\n if (nearTop && nearBottom && lines.size === 1) {\n // wait until the first chunk is loaded.\n } else {\n // we are at the top/bottom, load some stuff.\n if (nearTop && !this.isLineLoaded(0)) {\n // don't dispatch in the raf, do it later\n setTimeout(() => this.loadLine(0, true), 0);\n }\n\n if (nearBottom && lines.size) {\n // if we haven't reached the end of the file yet\n if (lines.last().isMissingMarker) {\n // don't dispatch in the raf, do it later\n setTimeout(() => this.loadLine(lines.size - 1, false), 0);\n } else if (atBottom) {\n // we're tailing here.\n if (!this.props.tailing) {\n this.props.startTailing();\n }\n }\n }\n }\n\n if (!atBottom && this.props.tailing) {\n this.props.stopTailing();\n }\n // update the scroll position.\n this.scrollTop = domNode.scrollTop;\n this.scrollHeight = domNode.scrollHeight;\n }\n // do another raf.\n this.rafRequestId = window.requestAnimationFrame(this.pollScroll);\n }", "function update(aMSPERFRAME, currTimeMS) {\n framect++;\n // ANIMATE ---------------------- >\n notationObjects.forEach(function(it, ix) {\n it.animate(partsToRunEvents[ix]);\n });\n}", "run(cb) {\n const now = new Date().getTime();\n // drop any old data\n this.firedTs = this.firedTs.filter(ts => ts > now - this.seconds * 1000);\n if (this.firedTs.length < this.times) {\n this.firedTs.push(now);\n cb();\n return true;\n }\n return false;\n }", "function timeAdvance(y,vx,dt) {\n\t// evalulate numerical flux at i+1/2\n\tvar f = [];\n\tfor (var i=i0-1; i<=i1; i++) {\n\t var dyl = slopeLimiter(y[i-1],y[i],y[i+1])\n\t var dyr = slopeLimiter(y[i],y[i+1],y[i+2])\n\t var yl = y[i]+0.5*dyl;\n\t var yr = y[i+1]-0.5*dyr;\n\t f[i] = 0.5*vx*(yl+yr)+0.5*Math.abs(vx)*(yl-yr);\n\t}\n\n\t// advance in time\n\tvar dtdxi = dt/dx;\n\tfor (var i=i0; i<=i1; i++) {\n\t y[i] = y[i]-dtdxi*(f[i]-f[i-1]);\n\t}\n\n\t// apply boundary condition\n\tfor (var i=0; i<margin; i++) {\n\t y[i0-i-1] = y[i1-i];\n\t}\n\tfor (var i=0; i<margin; i++) {\n\t y[i1+i+1] = y[i0+i];\n\t}\n }", "function frame() {\n rAF = requestAnimationFrame(frame);\n\n now = performance.now();\n dt = now - last;\n last = now;\n\n // prevent updating the game with a very large dt if the game were to lose focus\n // and then regain focus later\n if (dt > 1E3) {\n return;\n }\n\n emit('tick');\n accumulator += dt;\n\n while (accumulator >= delta) {\n loop.update(step);\n\n accumulator -= delta;\n }\n\n clearFn(context);\n loop.render();\n }", "_flush( streamCallback )\n {\n // anything remaining in line buffer?\n if ( this.lineBuffer != '' )\n {\n // pass remaining buffer contents as single line\n const lines = [ this.lineBuffer ]\n\n // process and push data\n this.handleLines( streamCallback, this.transformCallback, [ this.lineBuffer ], '' )\n }\n else\n {\n // otherwise run callback immediately\n streamCallback( null )\n }\n }", "update(timestep, dt) {\n if (gameState.state == states.PLAYING) {\n // Process input.\n if (Phaser.Input.Keyboard.JustDown(gameState.cursors.up)) {\n this.playerMove(8);\n } else if (Phaser.Input.Keyboard.JustDown(gameState.cursors.down)) {\n this.playerMove(2);\n } else if (Phaser.Input.Keyboard.JustDown(gameState.cursors.left)) {\n this.playerMove(4);\n } else if (Phaser.Input.Keyboard.JustDown(gameState.cursors.right)) {\n this.playerMove(6);\n } else if (Phaser.Input.Keyboard.JustDown(gameState.cursors.space)) {\n this.absorbNumber();\n }\n // else if (Phaser.Input.Keyboard.JustDown(gameState.cursors.shift)) {\n // console.log(\"DEBUG: Level Up!\");\n // this.levelUp();\n // }\n // Process the combo timer/counter.\n this.processComboSystem(this.sys.game.loop.deltaHistory[9]);\n } \n\t}", "loopUpdate(){\n setInterval(()=>{\n this.updateNow();\n },updateSecs*1000);\n }", "updateBombs(deltaTime) {\n this.bombs.forEach(elm => elm.update(deltaTime))\n this.bombs = this.bombs.filter(elm => !elm.isDone)\n }", "update(timestep, dt) {\n this.pushBar.clear()\n //lost of energy===>\n this.energy-=this.lost_factor*dt/1000\n\n //correction of energy ever >=0\n if(this.energy<=0){\n this.energy=0\n }\n //lost of energy===>\n \n let efactor=this.energy*320/100\n\n //update position of hammer in function of energy\n this.hammer.x=this.x\n this.hammer.y= this.y-efactor\n\n this.pushBar.fillStyle(0x990099, 0.8);\n this.pushBar.fillRect(this.x-24, this.y-efactor,48,efactor);\n }", "getChunkHandler() {\n var decoder = new TextDecoder();\n var partial = false;\n return (data) => {\n var currentTime = (new Date()).getTime();\n var elapsedMillis = currentTime - this.prevChunkRecvTime;\n this.prevChunkRecvTime = currentTime;\n\n if(data.done) {\n return true;\n }\n\n var chunk = decoder.decode(data.value || new Uint8Array, {stream: !data.done});\n var startIdx = 0, msg;\n if(partial) {\n var partialEnd = chunk.indexOf(\"}{\", startIdx);\n if(partialEnd == -1) {\n console.debug(\"Another partial received in entirety, skipping chunk\");\n startIdx = chunk.length;\n } else {\n console.debug(\"Partial dropped from the start of chunk\");\n startIdx = partialEnd + 1;\n }\n }\n\n if(startIdx < chunk.length) {\n if (chunk[startIdx] != '{') {\n throw new Error(\"Invalid chunk received, cannot process this request further\");\n }\n this.callback({type: \"stat_chunk\", msg: {elapsed: elapsedMillis}});\n \n while(true) {\n if(startIdx == chunk.length) {\n break;\n }\n var msgEnd = chunk.indexOf(\"}{\", startIdx);\n if(msgEnd == -1) {\n try {\n msg = JSON.parse(chunk.substring(startIdx));\n partial = false;\n this.callback({ type: \"data\", msg: this.transformer(msg)});\n } catch (err) {\n console.debug(\"Invalid JSON, partial received at the end. Dropping it\");\n partial = true;\n }\n startIdx = chunk.length;\n } else {\n try {\n msg = JSON.parse(chunk.substring(startIdx, msgEnd + 1));\n this.callback({ type: \"data\", msg: this.transformer(msg)});\n } catch (err) {\n throw new Error(\"Invalid JSON which was unexpected here: \" + err.message); \n }\n startIdx = msgEnd + 1;\n }\n }\n }\n return false;\n };\n }", "function d3_timer_sweep() {\n var t0,\n t1 = d3_timer_queueHead,\n time = Infinity;\n while (t1) {\n if (t1.flush) {\n t1 = t0 ? t0.next = t1.next : d3_timer_queueHead = t1.next;\n } else {\n if (t1.time < time) time = t1.time;\n t1 = (t0 = t1).next;\n }\n }\n d3_timer_queueTail = t0;\n return time;\n}", "loop(timeStamp) {\n\n /* timeLastUpdate erhöht sich um den Timestamp. Dabei wird time abgezogen weil ansonsten die bereits \n erfasste Zeit mitaddiert wird und dadurch ein zu hoher Wert entsteht*/\n this.timeLastUpdate += timeStamp - this.time;\n this.time = timeStamp;\n\n /* Sicherheitsvorrichtung um zu verhindern, dass durch zu langsame Rechner die CPU Überlasted wird, weil mehrere tiles geupdated werden*/\n if (this.timeLastUpdate >= this.timeStep * 3) {\n\n this.timeLastUpdate = this.timeStep;\n }\n\n /*Wir wollen für jeden vergangenen Timestep ein Update haben, deshalb wird als Grundlage hier timeLastUpdate genutzt. timeStep wird nach jedem \n Ablauf von timeLastUpdate abgezogen. Sollten durch Geschwindigkeitsprobleme Verzögerungen entstehen werden trotzdem alle Updates durchgeführt. \n */\n while (this.timeLastUpdate >= this.timeStep) {\n\n //Substraktion um zu indizieren, dass das Update für einen Step erfolgt ist\n this.timeLastUpdate -= this.timeStep;\n\n this.update(timeStamp);\n\n // Indikator wird auf true gesetzt damit gerendert werden soll\n this.updated = true;\n\n }\n\n /* Das Spiel soll nur gerendert werden wenn, dass Spiel geupdated wurde */\n if (this.updated) {\n\n //Wird auf false gesetzt damit nicht sofort wieder gerendert wird\n this.updated = false;\n this.render(timeStamp);\n\n }\n\n //Window Funtktion die aufgerufen wird um eine Animation zu updaten\n this.requestAnimationFrame = window.requestAnimationFrame(this.handleLoop);\n\n }", "function easeFrames(tl, pl, startStamp, dataObj, onIterate) {\n // Parse easing string into floats\n let easing = parseBezier(dataObj.easing);\n\n let diffX = ((tl.x*-1) - pl.x);\n let diffY = ((tl.y*-1) - pl.y);\n let dx, dy;\n\n // Transfrom frame loop\n (function loop() {\n\n let t = (Date.now() - startStamp) / dataObj.duration;\n\n if (t > 1) t = 1.01;\n if (t < 1) {\n dx = (diffX * bezier.apply(null, easing)(t)) + tl.x;\n dy = (diffY * bezier.apply(null, easing)(t)) + tl.y;\n\n // Fix JS Rounding\n dx = Math.ceil(dx * 100) / 100;\n dy = Math.ceil(dy * 100) / 100;\n onIterate({x: dx, y: dy});\n\n window.requestAnimationFrame(loop);\n }\n }());\n}", "function tick (timestamp) {\n\t\t /* An empty timestamp argument indicates that this is the first tick occurence since ticking was turned on.\n\t\t We leverage this metadata to fully ignore the first tick pass since RAF's initial pass is fired whenever\n\t\t the browser's next tick sync time occurs, which results in the first elements subjected to Velocity\n\t\t calls being animated out of sync with any elements animated immediately thereafter. In short, we ignore\n\t\t the first RAF tick pass so that elements being immediately consecutively animated -- instead of simultaneously animated\n\t\t by the same Velocity call -- are properly batched into the same initial RAF tick and consequently remain in sync thereafter. */\n\t\t if (timestamp) {\n\t\t /* We ignore RAF's high resolution timestamp since it can be significantly offset when the browser is\n\t\t under high stress; we opt for choppiness over allowing the browser to drop huge chunks of frames. */\n\t\t var timeCurrent = (new Date).getTime();\n\t\t\n\t\t /********************\n\t\t Call Iteration\n\t\t ********************/\n\t\t\n\t\t var callsLength = Velocity.State.calls.length;\n\t\t\n\t\t /* To speed up iterating over this array, it is compacted (falsey items -- calls that have completed -- are removed)\n\t\t when its length has ballooned to a point that can impact tick performance. This only becomes necessary when animation\n\t\t has been continuous with many elements over a long period of time; whenever all active calls are completed, completeCall() clears Velocity.State.calls. */\n\t\t if (callsLength > 10000) {\n\t\t Velocity.State.calls = compactSparseArray(Velocity.State.calls);\n\t\t }\n\t\t\n\t\t /* Iterate through each active call. */\n\t\t for (var i = 0; i < callsLength; i++) {\n\t\t /* When a Velocity call is completed, its Velocity.State.calls entry is set to false. Continue on to the next call. */\n\t\t if (!Velocity.State.calls[i]) {\n\t\t continue;\n\t\t }\n\t\t\n\t\t /************************\n\t\t Call-Wide Variables\n\t\t ************************/\n\t\t\n\t\t var callContainer = Velocity.State.calls[i],\n\t\t call = callContainer[0],\n\t\t opts = callContainer[2],\n\t\t timeStart = callContainer[3],\n\t\t firstTick = !!timeStart,\n\t\t tweenDummyValue = null;\n\t\t\n\t\t /* If timeStart is undefined, then this is the first time that this call has been processed by tick().\n\t\t We assign timeStart now so that its value is as close to the real animation start time as possible.\n\t\t (Conversely, had timeStart been defined when this call was added to Velocity.State.calls, the delay\n\t\t between that time and now would cause the first few frames of the tween to be skipped since\n\t\t percentComplete is calculated relative to timeStart.) */\n\t\t /* Further, subtract 16ms (the approximate resolution of RAF) from the current time value so that the\n\t\t first tick iteration isn't wasted by animating at 0% tween completion, which would produce the\n\t\t same style value as the element's current value. */\n\t\t if (!timeStart) {\n\t\t timeStart = Velocity.State.calls[i][3] = timeCurrent - 16;\n\t\t }\n\t\t\n\t\t /* The tween's completion percentage is relative to the tween's start time, not the tween's start value\n\t\t (which would result in unpredictable tween durations since JavaScript's timers are not particularly accurate).\n\t\t Accordingly, we ensure that percentComplete does not exceed 1. */\n\t\t var percentComplete = Math.min((timeCurrent - timeStart) / opts.duration, 1);\n\t\t\n\t\t /**********************\n\t\t Element Iteration\n\t\t **********************/\n\t\t\n\t\t /* For every call, iterate through each of the elements in its set. */\n\t\t for (var j = 0, callLength = call.length; j < callLength; j++) {\n\t\t var tweensContainer = call[j],\n\t\t element = tweensContainer.element;\n\t\t\n\t\t /* Check to see if this element has been deleted midway through the animation by checking for the\n\t\t continued existence of its data cache. If it's gone, skip animating this element. */\n\t\t if (!Data(element)) {\n\t\t continue;\n\t\t }\n\t\t\n\t\t var transformPropertyExists = false;\n\t\t\n\t\t /**********************************\n\t\t Display & Visibility Toggling\n\t\t **********************************/\n\t\t\n\t\t /* If the display option is set to non-\"none\", set it upfront so that the element can become visible before tweening begins.\n\t\t (Otherwise, display's \"none\" value is set in completeCall() once the animation has completed.) */\n\t\t if (opts.display !== undefined && opts.display !== null && opts.display !== \"none\") {\n\t\t if (opts.display === \"flex\") {\n\t\t var flexValues = [ \"-webkit-box\", \"-moz-box\", \"-ms-flexbox\", \"-webkit-flex\" ];\n\t\t\n\t\t $.each(flexValues, function(i, flexValue) {\n\t\t CSS.setPropertyValue(element, \"display\", flexValue);\n\t\t });\n\t\t }\n\t\t\n\t\t CSS.setPropertyValue(element, \"display\", opts.display);\n\t\t }\n\t\t\n\t\t /* Same goes with the visibility option, but its \"none\" equivalent is \"hidden\". */\n\t\t if (opts.visibility !== undefined && opts.visibility !== \"hidden\") {\n\t\t CSS.setPropertyValue(element, \"visibility\", opts.visibility);\n\t\t }\n\t\t\n\t\t /************************\n\t\t Property Iteration\n\t\t ************************/\n\t\t\n\t\t /* For every element, iterate through each property. */\n\t\t for (var property in tweensContainer) {\n\t\t /* Note: In addition to property tween data, tweensContainer contains a reference to its associated element. */\n\t\t if (property !== \"element\") {\n\t\t var tween = tweensContainer[property],\n\t\t currentValue,\n\t\t /* Easing can either be a pre-genereated function or a string that references a pre-registered easing\n\t\t on the Velocity.Easings object. In either case, return the appropriate easing *function*. */\n\t\t easing = Type.isString(tween.easing) ? Velocity.Easings[tween.easing] : tween.easing;\n\t\t\n\t\t /******************************\n\t\t Current Value Calculation\n\t\t ******************************/\n\t\t\n\t\t /* If this is the last tick pass (if we've reached 100% completion for this tween),\n\t\t ensure that currentValue is explicitly set to its target endValue so that it's not subjected to any rounding. */\n\t\t if (percentComplete === 1) {\n\t\t currentValue = tween.endValue;\n\t\t /* Otherwise, calculate currentValue based on the current delta from startValue. */\n\t\t } else {\n\t\t var tweenDelta = tween.endValue - tween.startValue;\n\t\t currentValue = tween.startValue + (tweenDelta * easing(percentComplete, opts, tweenDelta));\n\t\t\n\t\t /* If no value change is occurring, don't proceed with DOM updating. */\n\t\t if (!firstTick && (currentValue === tween.currentValue)) {\n\t\t continue;\n\t\t }\n\t\t }\n\t\t\n\t\t tween.currentValue = currentValue;\n\t\t\n\t\t /* If we're tweening a fake 'tween' property in order to log transition values, update the one-per-call variable so that\n\t\t it can be passed into the progress callback. */\n\t\t if (property === \"tween\") {\n\t\t tweenDummyValue = currentValue;\n\t\t } else {\n\t\t /******************\n\t\t Hooks: Part I\n\t\t ******************/\n\t\t\n\t\t /* For hooked properties, the newly-updated rootPropertyValueCache is cached onto the element so that it can be used\n\t\t for subsequent hooks in this call that are associated with the same root property. If we didn't cache the updated\n\t\t rootPropertyValue, each subsequent update to the root property in this tick pass would reset the previous hook's\n\t\t updates to rootPropertyValue prior to injection. A nice performance byproduct of rootPropertyValue caching is that\n\t\t subsequently chained animations using the same hookRoot but a different hook can use this cached rootPropertyValue. */\n\t\t if (CSS.Hooks.registered[property]) {\n\t\t var hookRoot = CSS.Hooks.getRoot(property),\n\t\t rootPropertyValueCache = Data(element).rootPropertyValueCache[hookRoot];\n\t\t\n\t\t if (rootPropertyValueCache) {\n\t\t tween.rootPropertyValue = rootPropertyValueCache;\n\t\t }\n\t\t }\n\t\t\n\t\t /*****************\n\t\t DOM Update\n\t\t *****************/\n\t\t\n\t\t /* setPropertyValue() returns an array of the property name and property value post any normalization that may have been performed. */\n\t\t /* Note: To solve an IE<=8 positioning bug, the unit type is dropped when setting a property value of 0. */\n\t\t var adjustedSetData = CSS.setPropertyValue(element, /* SET */\n\t\t property,\n\t\t tween.currentValue + (parseFloat(currentValue) === 0 ? \"\" : tween.unitType),\n\t\t tween.rootPropertyValue,\n\t\t tween.scrollData);\n\t\t\n\t\t /*******************\n\t\t Hooks: Part II\n\t\t *******************/\n\t\t\n\t\t /* Now that we have the hook's updated rootPropertyValue (the post-processed value provided by adjustedSetData), cache it onto the element. */\n\t\t if (CSS.Hooks.registered[property]) {\n\t\t /* Since adjustedSetData contains normalized data ready for DOM updating, the rootPropertyValue needs to be re-extracted from its normalized form. ?? */\n\t\t if (CSS.Normalizations.registered[hookRoot]) {\n\t\t Data(element).rootPropertyValueCache[hookRoot] = CSS.Normalizations.registered[hookRoot](\"extract\", null, adjustedSetData[1]);\n\t\t } else {\n\t\t Data(element).rootPropertyValueCache[hookRoot] = adjustedSetData[1];\n\t\t }\n\t\t }\n\t\t\n\t\t /***************\n\t\t Transforms\n\t\t ***************/\n\t\t\n\t\t /* Flag whether a transform property is being animated so that flushTransformCache() can be triggered once this tick pass is complete. */\n\t\t if (adjustedSetData[0] === \"transform\") {\n\t\t transformPropertyExists = true;\n\t\t }\n\t\t\n\t\t }\n\t\t }\n\t\t }\n\t\t\n\t\t /****************\n\t\t mobileHA\n\t\t ****************/\n\t\t\n\t\t /* If mobileHA is enabled, set the translate3d transform to null to force hardware acceleration.\n\t\t It's safe to override this property since Velocity doesn't actually support its animation (hooks are used in its place). */\n\t\t if (opts.mobileHA) {\n\t\t /* Don't set the null transform hack if we've already done so. */\n\t\t if (Data(element).transformCache.translate3d === undefined) {\n\t\t /* All entries on the transformCache object are later concatenated into a single transform string via flushTransformCache(). */\n\t\t Data(element).transformCache.translate3d = \"(0px, 0px, 0px)\";\n\t\t\n\t\t transformPropertyExists = true;\n\t\t }\n\t\t }\n\t\t\n\t\t if (transformPropertyExists) {\n\t\t CSS.flushTransformCache(element);\n\t\t }\n\t\t }\n\t\t\n\t\t /* The non-\"none\" display value is only applied to an element once -- when its associated call is first ticked through.\n\t\t Accordingly, it's set to false so that it isn't re-processed by this call in the next tick. */\n\t\t if (opts.display !== undefined && opts.display !== \"none\") {\n\t\t Velocity.State.calls[i][2].display = false;\n\t\t }\n\t\t if (opts.visibility !== undefined && opts.visibility !== \"hidden\") {\n\t\t Velocity.State.calls[i][2].visibility = false;\n\t\t }\n\t\t\n\t\t /* Pass the elements and the timing data (percentComplete, msRemaining, timeStart, tweenDummyValue) into the progress callback. */\n\t\t if (opts.progress) {\n\t\t opts.progress.call(callContainer[1],\n\t\t callContainer[1],\n\t\t percentComplete,\n\t\t Math.max(0, (timeStart + opts.duration) - timeCurrent),\n\t\t timeStart,\n\t\t tweenDummyValue);\n\t\t }\n\t\t\n\t\t /* If this call has finished tweening, pass its index to completeCall() to handle call cleanup. */\n\t\t if (percentComplete === 1) {\n\t\t completeCall(i);\n\t\t }\n\t\t }\n\t\t }\n\t\t\n\t\t /* Note: completeCall() sets the isTicking flag to false when the last call on Velocity.State.calls has completed. */\n\t\t if (Velocity.State.isTicking) {\n\t\t ticker(tick);\n\t\t }\n\t\t }", "function _fixBlockSizes() {\n\t\t\tvar timeBlockSize = $el.css('padding-top').replace('px', '') * 0.8;\n\t\t\t$el.find('.' + options.className + '-timeline').css('width', ''+ (children.length * timeBlockSize) +'px');\n\t\t\t$el.find('.' + options.className + '-timeliny-timeblock').css('width', '' + timeBlockSize + 'px');\n\t\t}", "updateNextMinuteData(minCount, minPosition) {\n // console.log(`minCount: ${minCount}, minPosition: ${minPosition}`);\n if (minPosition === 0) {\n // console.log(\"adding some visitors\");\n this.visitorsInMin = this.waitingVisitors.filter((visitor) => {\n let arrival = Number.parseInt(visitor.arrival);\n return arrival == minCount + 2;\n });\n // console.log(JSON.stringify(this.visitorsInMin));\n if (this.visitorsInMin.length > 0) {\n this.framesPerVisitor = Math.floor(this.framesPerMin / this.visitorsInMin.length);\n } else {\n this.framesPerVisitor = this.framesPerMin;\n }\n }\n }", "function onPlaybackTimeUpdated(e) {\n\n if (isVideoTrackPresent()) {\n var playbackQuality = videoModel.getPlaybackQuality();\n if (playbackQuality) {\n metricsModel.addDroppedFrames('video', playbackQuality);\n }\n }\n\n // Sometimes after seeking timeUpdateHandler is called before seekingHandler and a new stream starts\n // from beginning instead of from a chosen position. So we do nothing if the player is in the seeking state\n if (playbackController.isSeeking()) return;\n\n if (e.timeToEnd <= STREAM_END_THRESHOLD) {\n //only needed for multiple period content when the native event does not fire due to duration manipulation.\n onEnded();\n }\n }", "updateStopLoss() {\n this.period = new Date() - this.startTime;\n console.log(`Duration: ${Math.floor(this.period / 1000 / 60)} min`);\n if (this.type === PositionType.LONG && this.pair.currentPrice >= this.takeProfitPrice && !this.profitTrailing) {\n this.stopLossPrice = this.pair.currentPrice * 0.9999;\n this.takeProfitBasePrice = this.pair.currentPrice * (1 + (this.stopLossPerc / 100));\n this.profitTrailing = true;\n if (this.stopLossOrder.status === 'ACTIVE' && config.trading.enabled) this.stopLossOrder.update({ price: this.stopLossPrice });\n console.log(`SL = TP and updated to ${this.stopLossPrice} CP: ${this.pair.currentPrice} TPB: ${this.takeProfitBasePrice}`);\n } else if (this.type === PositionType.SHORT && this.pair.currentPrice <= this.takeProfitPrice && !this.profitTrailing) {\n this.stopLossPrice = this.pair.currentPrice * 1.0001;\n this.takeProfitBasePrice = this.pair.currentPrice * (1 - (this.stopLossPerc / 100));\n this.profitTrailing = true;\n if (this.stopLossOrder.status === 'ACTIVE' && config.trading.enabled) this.stopLossOrder.update({ price: this.stopLossPrice });\n console.log(`SL = TP and updated to ${this.stopLossPrice} CP: ${this.pair.currentPrice} TPB: ${this.takeProfitBasePrice}`);\n } else if (this.type === PositionType.LONG && this.pair.currentPrice <= this.takeProfitPrice && !this.profitTrailing) {\n this.debounce += 1;\n console.log(`Debounce: ${this.debounce}`);\n if (this.pair.indicators[Indicator.SAR] > this.stopLossPrice && this.debounce > 2) {\n this.stopLossPrice = this.pair.indicators[Indicator.SAR];\n if (this.stopLossOrder.status === 'ACTIVE' && config.trading.enabled) this.stopLossOrder.update({ price: this.stopLossPrice });\n console.log(`SL = SAR and updated to ${this.stopLossPrice}`);\n TelegramConnector.sendToChat(`SL = SAR = ${this.stopLossPrice.toFixed(3)} (CP: ${this.pair.currentPrice.toFixed(3)}) (${PositionType})`);\n }\n } else if (this.type === PositionType.SHORT && this.pair.currentPrice >= this.takeProfitPrice && !this.profitTrailing) {\n this.debounce += 1;\n console.log(`Debounce: ${this.debounce}`);\n if (this.pair.indicators[Indicator.SAR] < this.stopLossPrice && this.debounce > 2) {\n this.stopLossPrice = this.pair.indicators[Indicator.SAR];\n if (this.stopLossOrder.status === 'ACTIVE' && config.trading.enabled) this.stopLossOrder.update({ price: this.stopLossPrice });\n console.log(`SL = SAR and updated to ${this.stopLossPrice}`);\n TelegramConnector.sendToChat(`SL = SAR = ${this.stopLossPrice.toFixed(3)} (CP: ${this.pair.currentPrice.toFixed(3)}) (${PositionType})`);\n }\n }\n if (this.type === PositionType.LONG && this.pair.currentPrice >= this.takeProfitBasePrice && this.profitTrailing) {\n this.stopLossPrice = (this.pair.currentPrice * (1 - (this.stopLossPerc / 100)));\n this.takeProfitBasePrice = this.pair.currentPrice;\n if (this.stopLossOrder.status === 'ACTIVE' && config.trading.enabled) this.stopLossOrder.update({ price: this.stopLossPrice });\n console.log(`Stop Loss updated to: ${(this.stopLossPrice).toFixed(3)}`);\n } else if (this.type === PositionType.SHORT && this.pair.currentPrice <= this.takeProfitBasePrice && this.profitTrailing) {\n this.stopLossPrice = (this.pair.currentPrice * (1 + (this.stopLossPerc / 100)));\n this.takeProfitBasePrice = this.pair.currentPrice;\n if (this.stopLossOrder.status === 'ACTIVE' && config.trading.enabled) this.stopLossOrder.update({ price: this.stopLossPrice });\n console.log(`Stop Loss updated to: ${(this.stopLossPrice).toFixed(3)}`);\n }\n }", "updateClock() {\n let hrtime = process.hrtime(this.lastTick);\n this.lastTick = process.hrtime();\n let duration = hrtime[0] * 1000 + hrtime[1] / 1000000;\n\n const historyLength = 48; // TODO Move constant\n const ppq = 24; // TODO Move constant\n this.tickDurations.push(duration);\n this.tickDurations = this.tickDurations.splice(\n Math.max(0, this.tickDurations.length - historyLength),\n historyLength\n );\n let tickMillis =\n this.tickDurations.reduce((sum, value) => sum + value) /\n this.tickDurations.length;\n let beatMillis = tickMillis * ppq;\n const millisPerMin = 60000;\n let bpm = Math.round(millisPerMin / beatMillis);\n\n this.bpm = bpm;\n }", "function step(timestamp){\n // ++draws;\n // const time1 = window.performance.now();\n\n that.components.forEach(function(componentContextPair){\n const component = componentContextPair[0], context = componentContextPair[1];\n component.update({timestamp: timestamp});\n component.draw({context: context, timestamp: timestamp});\n });\n\n window.requestAnimationFrame(function(timestamp){\n step(timestamp);\n });\n // const time2 = window.performance.now();\n // timeDif += time2 - time1;\n // if(timeDif > maxTime){\n // maxTime = timeDif;\n // }\n // if(draws % 60 === 0){\n // console.log(\"Update/Draw took on avg: \" + ((timeDif) / 60) + \" ms, with max: \" + maxTime);\n // timeDif = 0;\n // maxTime = 0;\n // }\n }", "function checkTime() {\n var now = Date.now();\n if (now - last < threshold) {\n timer = setTimeout(checkTime, 10);\n } else {\n clearTimeout(timer);\n timer = last = 0;\n for (var i = 0, max = cache.length; i < max; i++) {\n cache[i]();\n }\n }\n }", "_rescheduleSequence(sequence, subdivision, startOffset) {\n sequence.forEach((value, index) => {\n const eventOffset = index * (subdivision) + startOffset;\n if (isArray(value)) {\n this._rescheduleSequence(value, subdivision / value.length, eventOffset);\n }\n else {\n const startTime = new TicksClass(this.context, eventOffset, \"i\").toSeconds();\n this._part.add(startTime, value);\n }\n });\n }", "function _tick () {\n this.time += this.interval;\n\n if ( this.countdown && (this.duration_ms - this.time < 0) ) {\n this.final_time = 0;\n this.go = false;\n this.callback(this);\n clearTimeout(this.timeout);\n this.complete(this);\n return;\n } else {\n this.callback(this);\n }\n\n var diff = (Date.now() - this.start_time) - this.time,\n next_interval_in = diff > 0 ? this.interval - diff : this.interval;\n\n if ( next_interval_in <= 0 ) {\n this.missed_ticks = Math.floor(Math.abs(next_interval_in) / this.interval);\n this.time += this.missed_ticks * this.interval;\n\n if ( this.go ) {\n _tick.call(this);\n }\n } else if ( this.go ) {\n this.timeout = setTimeout(_tick.bind(this), next_interval_in);\n }\n }", "_transform(chunk,encoding,cb) {\n\n const uint8_view = new Uint8Array(chunk, 0, chunk.length);\n var dataView = new DataView(uint8_view.buffer);\n\n let iFloat = Array(this.sz*2);\n let asComplex = Array(this.sz);\n\n\n // for(let i = 0; i < this.sz*2; i+=1) {\n // iFloat[i] = dataView.getFloat64(i*8, true);\n // }\n\n for(let i = 0; i < this.sz*2; i+=2) {\n let re = dataView.getFloat64(i*8, true);\n let im = dataView.getFloat64((i*8)+8, true);\n\n asComplex[i/2] = mt.complex(re,im);\n\n iFloat[i] = re;\n iFloat[i+1] = im;\n\n // if( i < 16 ) {\n // console.log(re);\n // }\n\n }\n\n let iShort = mutil.IFloatToIShortMulti(iFloat);\n\n if( this.onFrameIShort !== null ) {\n this.onFrameIShort(iShort);\n }\n\n // console.log(\"iFloat length \" + iFloat.length);\n // console.log(iFloat.slice(0,16));\n\n // console.log(\"iShort length \" + iShort.length);\n // console.log(iShort.slice(0,16));\n\n\n this.handleDefaultStream(iFloat,iShort,asComplex);\n this.handleFineSync(iFloat,iShort,asComplex);\n this.handleAllSubcarriers(iFloat,iShort,asComplex);\n this.handleDemodData(iFloat,iShort,asComplex);\n\n\n // for(x of iFloat) {\n // console.log(x);\n // }\n\n\n this.uint.frame_track_counter++;\n cb();\n }", "function updater(fun, rate) {\n\t var timeout;\n\t var last = 0;\n\t var runnit = function () {\n\t if (last + rate > rnow()) {\n\t clearTimeout(timeout);\n\t timeout = setTimeout(runnit, rate);\n\t } else {\n\t last = rnow();\n\t fun();\n\t }\n\t };\n\n\t return runnit;\n\t}", "function forEvery(ms, acc, func) {\r\n if (acc > 0) {\r\n func()\r\n setTimeout(() => forEvery(ms, acc-1, func), ms)\r\n }\r\n}", "proccessPlaybackTimeUpdate() {\n // check if track duration is NaN or zero and rectify\n if(isNaN(this.getCurrentTrackDuration(this.activePlayer.position)) || !isFinite(this.getCurrentTrackDuration(this.activePlayer.position))){\n this.changeCurrentTrackDuration({playerPosition: this.activePlayer.position, time: 260}) // give reasonable track duration\n } else {\n this.changeCurrentTrackDuration({playerPosition: this.activePlayer.position, time: (isNaN(this.getAudio(this.activePlayer.position).duration) || !isFinite(this.getAudio(this.activePlayer.position).duration)) ? 260 : this.getAudio(this.activePlayer.position).duration}) // get track duration\n }\n // debug loading\n if(this.getPlayerIsLoading){\n this.changePlayerIsLoading({playerPosition: this.activePlayer.position, status: false})\n }\n\n // update UI\n this.changeCurrentTrackTime({playerPosition: this.activePlayer.position, time: this.getAudio(this.activePlayer.position).currentTime}) // get current track time\n\n this.changePlayerIsPlaying({playerPosition: this.activePlayer.position, status: true})\n this.changePlayerIsPaused({playerPosition: this.activePlayer.position, status: false})\n this.changePlayerIsStopped({playerPosition: this.activePlayer.position, status: false})\n\n // update active player\n this.updateActivePlayer({playerPosition: this.activePlayer.position})\n }", "judgeHolds(delta, currentAudioTime, beat, tickCounts) {\n\n\n this.activeHolds.cumulatedHoldTime += delta ;\n\n\n this.activeHolds.timeCounterJudgmentHolds += delta ;\n\n const secondsPerBeat = 60 / this.composer.bpmManager.getCurrentBPM() ;\n\n const secondsPerKeyCount = secondsPerBeat/ tickCounts ;\n\n const numberOfHits = Math.floor(this.activeHolds.timeCounterJudgmentHolds / secondsPerKeyCount ) ;\n\n\n // console.log(numberOfPerfects) ;\n\n\n if ( numberOfHits > 0 ) {\n\n\n let aux = this.activeHolds.timeCounterJudgmentHolds ;\n const remainder = this.activeHolds.timeCounterJudgmentHolds % secondsPerKeyCount;\n this.activeHolds.timeCounterJudgmentHolds = 0 ;\n\n\n const difference = Math.abs((this.activeHolds.lastAddedHold.beginHoldTimeStamp) - currentAudioTime) ;\n // case 1: holds are pressed on time\n if (this.areHoldsBeingPressed()) {\n\n this.composer.judgmentScale.animateJudgement('p', numberOfHits);\n this.composer.animateTapEffect(this.activeHolds.asList());\n // case 2: holds are not pressed. we need to give some margin to do it\n } else if (this.activeHolds.beginningHoldChunk && difference < this.accuracyMargin ) {\n\n this.activeHolds.timeCounterJudgmentHolds += aux -remainder ;\n\n // case 3: holds are not pressed and we run out of the margin\n } else {\n // TODO: misses should not be in the same count.\n this.composer.judgmentScale.miss() ;\n this.activeHolds.beginningHoldChunk = false ;\n }\n\n\n this.activeHolds.timeCounterJudgmentHolds += remainder;\n\n }\n\n\n }", "function iterator ()\n {\n for (var i=0; i<obj.data.length; ++i) {\n \n // This produces a very slight easing effect\n obj.data[i] = data[i] * RG.Effects.getEasingMultiplier(frames, numFrame);\n }\n \n RGraph.clear(obj.canvas);\n RGraph.redrawCanvas(obj.canvas);\n \n if (++numFrame < frames) {\n RGraph.Effects.updateCanvas(iterator);\n } else {\n callback(obj);\n }\n }", "function step(timeStep){\r\n if(mode != 'non-collision' && mode != 'non-collision-gravity'){\r\n //keep a list of collisions so we can decide the order in which to compute them\r\n var collisions = [];\r\n //check for intersections between objects\r\n for(var p = 0; p < objects.length; p++){\r\n for(var q = p+1; q < objects.length; q++){\r\n var object1 = objects[p];\r\n var object2 = objects[q];\r\n collisions = collisions.concat(getCollisions(object1, object2));\r\n }\r\n var object = objects[p];\r\n computeForces(object, timeStep);\r\n }\r\n \r\n collisions.sort(function(a,b){\r\n return b.displacementAmount - a.displacementAmount;\r\n })\r\n for(var k = 0; k < collisions.length; k++){\r\n collision(collisions[k]);\r\n }\r\n }\r\n if(mode == 'non-collision-gravity'){\r\n for(var j = 0; j < objects.length; j++){\r\n computeForces(objects[j], timeStep);\r\n }\r\n }\r\n moveObjects(timeStep);\r\n drawObjects();\r\n}", "onFrameLoop(delta, inputs) {\n\n // Update the adventurer.\n this.adventurer.update(delta, inputs)\n\n // Update any effects.\n if(!!this.effects) {\n this.effects.forEach((effect) => {\n effect.update(delta)\n })\n }\n\n }", "updateStepQueueAndActiveHolds(currentAudioTime, delta, beat) {\n\n let validHold = this.findFirstValidHold(currentAudioTime);\n\n // update hold Run.\n if ( validHold !== null ) {\n if (!this.activeHolds.holdRun) {\n this.activeHolds.holdRun = true ;\n this.activeHolds.firstHoldInHoldRun = validHold ;\n }\n } else {\n this.activeHolds.holdRun = false ;\n }\n\n // Hold contribution to the combo\n if (validHold !== null) {\n\n const tickCounts = this.composer.getTickCountAtBeat(beat) ;\n\n this.judgeHolds(delta, currentAudioTime, beat, tickCounts) ;\n\n // Note that, to be exact, we have to add the remainder contribution of the hold that was not processed on the last\n // frame\n } else if (this.activeHolds.needFinishJudgment) {\n const tickCounts = this.composer.getTickCountAtBeat(beat) ;\n const difference = this.activeHolds.judgmentTimeStampEndReference - this.activeHolds.cumulatedHoldTime ;\n this.endJudgingHolds(difference, tickCounts) ;\n this.activeHolds.cumulatedHoldTime = 0;\n this.activeHolds.needFinishJudgment = false;\n }\n\n this.removeHoldsIfProceeds(currentAudioTime) ;\n\n if ( this.getLength() > 0 ) {\n\n let stepTime = this.getStepTimeStampFromTopMostStepInfo() ;\n\n\n\n const difference = (stepTime) - currentAudioTime ;\n // this condition is met when we run over a hold. We update here the current list of holds\n if ( difference < 0 && this.checkForNewHolds ) {\n // console.log(onlyHoldsInTopMostStepInfo) ;\n\n this.checkForNewHolds = false ;\n\n this.addHolds() ;\n\n\n // if we only have holds, and all of them are being pressed beforehand, then it's a perfect!\n if ( this.areThereOnlyHoldsInTopMostStepInfo() && this.areHoldsBeingPressed() ) {\n this.composer.judgmentScale.animateJudgement('p') ;\n this.composer.animateTapEffect(this.getTopMostStepsList()) ;\n this.removeFirstElement() ;\n this.checkForNewHolds = true ;\n }\n\n }\n\n // we count a miss, if we go beyond the time of the topmost step info, given that there are no holds there\n if (difference < -this.accuracyMargin ) {\n\n this.composer.judgmentScale.miss() ;\n\n this.removeFirstElement() ;\n this.checkForNewHolds = true ;\n\n }\n\n }\n\n\n\n\n\n }", "syncStep(stepDesc) {\n\n // apply incremental bending\n this.gameEngine.world.forEachObject((id, o) => {\n if (typeof o.applyIncrementalBending === 'function') {\n o.applyIncrementalBending(stepDesc);\n o.refreshToPhysics();\n }\n });\n\n // apply all pending required syncs\n while (this.requiredSyncs.length) {\n\n let requiredStep = this.requiredSyncs[0].stepCount; \n\n // if we haven't reached the corresponding step, it's too soon to apply syncs\n if (requiredStep > this.gameEngine.world.stepCount)\n return;\n\n this.gameEngine.trace.trace(() => `applying a required sync ${requiredStep}`);\n this.applySync(this.requiredSyncs.shift(), true);\n }\n\n // apply the sync and delete it on success\n if (this.lastSync) {\n let rc = this.applySync(this.lastSync, false);\n if (rc === this.SYNC_APPLIED)\n this.lastSync = null;\n }\n }", "step() {\n this.loop(SteppableArray.stepFunction);\n }", "step() {\n this.loop(SteppableArray.stepFunction);\n }", "step() {\n this.loop(SteppableArray.stepFunction);\n }", "function tick (timestamp) {\n\t /* An empty timestamp argument indicates that this is the first tick occurence since ticking was turned on.\n\t We leverage this metadata to fully ignore the first tick pass since RAF's initial pass is fired whenever\n\t the browser's next tick sync time occurs, which results in the first elements subjected to Velocity\n\t calls being animated out of sync with any elements animated immediately thereafter. In short, we ignore\n\t the first RAF tick pass so that elements being immediately consecutively animated -- instead of simultaneously animated\n\t by the same Velocity call -- are properly batched into the same initial RAF tick and consequently remain in sync thereafter. */\n\t if (timestamp) {\n\t /* We ignore RAF's high resolution timestamp since it can be significantly offset when the browser is\n\t under high stress; we opt for choppiness over allowing the browser to drop huge chunks of frames. */\n\t var timeCurrent = (new Date).getTime();\n\n\t /********************\n\t Call Iteration\n\t ********************/\n\n\t var callsLength = Velocity.State.calls.length;\n\n\t /* To speed up iterating over this array, it is compacted (falsey items -- calls that have completed -- are removed)\n\t when its length has ballooned to a point that can impact tick performance. This only becomes necessary when animation\n\t has been continuous with many elements over a long period of time; whenever all active calls are completed, completeCall() clears Velocity.State.calls. */\n\t if (callsLength > 10000) {\n\t Velocity.State.calls = compactSparseArray(Velocity.State.calls);\n\t }\n\n\t /* Iterate through each active call. */\n\t for (var i = 0; i < callsLength; i++) {\n\t /* When a Velocity call is completed, its Velocity.State.calls entry is set to false. Continue on to the next call. */\n\t if (!Velocity.State.calls[i]) {\n\t continue;\n\t }\n\n\t /************************\n\t Call-Wide Variables\n\t ************************/\n\n\t var callContainer = Velocity.State.calls[i],\n\t call = callContainer[0],\n\t opts = callContainer[2],\n\t timeStart = callContainer[3],\n\t firstTick = !!timeStart,\n\t tweenDummyValue = null;\n\n\t /* If timeStart is undefined, then this is the first time that this call has been processed by tick().\n\t We assign timeStart now so that its value is as close to the real animation start time as possible.\n\t (Conversely, had timeStart been defined when this call was added to Velocity.State.calls, the delay\n\t between that time and now would cause the first few frames of the tween to be skipped since\n\t percentComplete is calculated relative to timeStart.) */\n\t /* Further, subtract 16ms (the approximate resolution of RAF) from the current time value so that the\n\t first tick iteration isn't wasted by animating at 0% tween completion, which would produce the\n\t same style value as the element's current value. */\n\t if (!timeStart) {\n\t timeStart = Velocity.State.calls[i][3] = timeCurrent - 16;\n\t }\n\n\t /* The tween's completion percentage is relative to the tween's start time, not the tween's start value\n\t (which would result in unpredictable tween durations since JavaScript's timers are not particularly accurate).\n\t Accordingly, we ensure that percentComplete does not exceed 1. */\n\t var percentComplete = Math.min((timeCurrent - timeStart) / opts.duration, 1);\n\n\t /**********************\n\t Element Iteration\n\t **********************/\n\n\t /* For every call, iterate through each of the elements in its set. */\n\t for (var j = 0, callLength = call.length; j < callLength; j++) {\n\t var tweensContainer = call[j],\n\t element = tweensContainer.element;\n\n\t /* Check to see if this element has been deleted midway through the animation by checking for the\n\t continued existence of its data cache. If it's gone, skip animating this element. */\n\t if (!Data(element)) {\n\t continue;\n\t }\n\n\t var transformPropertyExists = false;\n\n\t /**********************************\n\t Display & Visibility Toggling\n\t **********************************/\n\n\t /* If the display option is set to non-\"none\", set it upfront so that the element can become visible before tweening begins.\n\t (Otherwise, display's \"none\" value is set in completeCall() once the animation has completed.) */\n\t if (opts.display !== undefined && opts.display !== null && opts.display !== \"none\") {\n\t if (opts.display === \"flex\") {\n\t var flexValues = [ \"-webkit-box\", \"-moz-box\", \"-ms-flexbox\", \"-webkit-flex\" ];\n\n\t $.each(flexValues, function(i, flexValue) {\n\t CSS.setPropertyValue(element, \"display\", flexValue);\n\t });\n\t }\n\n\t CSS.setPropertyValue(element, \"display\", opts.display);\n\t }\n\n\t /* Same goes with the visibility option, but its \"none\" equivalent is \"hidden\". */\n\t if (opts.visibility !== undefined && opts.visibility !== \"hidden\") {\n\t CSS.setPropertyValue(element, \"visibility\", opts.visibility);\n\t }\n\n\t /************************\n\t Property Iteration\n\t ************************/\n\n\t /* For every element, iterate through each property. */\n\t for (var property in tweensContainer) {\n\t /* Note: In addition to property tween data, tweensContainer contains a reference to its associated element. */\n\t if (property !== \"element\") {\n\t var tween = tweensContainer[property],\n\t currentValue,\n\t /* Easing can either be a pre-genereated function or a string that references a pre-registered easing\n\t on the Velocity.Easings object. In either case, return the appropriate easing *function*. */\n\t easing = Type.isString(tween.easing) ? Velocity.Easings[tween.easing] : tween.easing;\n\n\t /******************************\n\t Current Value Calculation\n\t ******************************/\n\n\t /* If this is the last tick pass (if we've reached 100% completion for this tween),\n\t ensure that currentValue is explicitly set to its target endValue so that it's not subjected to any rounding. */\n\t if (percentComplete === 1) {\n\t currentValue = tween.endValue;\n\t /* Otherwise, calculate currentValue based on the current delta from startValue. */\n\t } else {\n\t var tweenDelta = tween.endValue - tween.startValue;\n\t currentValue = tween.startValue + (tweenDelta * easing(percentComplete, opts, tweenDelta));\n\n\t /* If no value change is occurring, don't proceed with DOM updating. */\n\t if (!firstTick && (currentValue === tween.currentValue)) {\n\t continue;\n\t }\n\t }\n\n\t tween.currentValue = currentValue;\n\n\t /* If we're tweening a fake 'tween' property in order to log transition values, update the one-per-call variable so that\n\t it can be passed into the progress callback. */\n\t if (property === \"tween\") {\n\t tweenDummyValue = currentValue;\n\t } else {\n\t /******************\n\t Hooks: Part I\n\t ******************/\n\n\t /* For hooked properties, the newly-updated rootPropertyValueCache is cached onto the element so that it can be used\n\t for subsequent hooks in this call that are associated with the same root property. If we didn't cache the updated\n\t rootPropertyValue, each subsequent update to the root property in this tick pass would reset the previous hook's\n\t updates to rootPropertyValue prior to injection. A nice performance byproduct of rootPropertyValue caching is that\n\t subsequently chained animations using the same hookRoot but a different hook can use this cached rootPropertyValue. */\n\t if (CSS.Hooks.registered[property]) {\n\t var hookRoot = CSS.Hooks.getRoot(property),\n\t rootPropertyValueCache = Data(element).rootPropertyValueCache[hookRoot];\n\n\t if (rootPropertyValueCache) {\n\t tween.rootPropertyValue = rootPropertyValueCache;\n\t }\n\t }\n\n\t /*****************\n\t DOM Update\n\t *****************/\n\n\t /* setPropertyValue() returns an array of the property name and property value post any normalization that may have been performed. */\n\t /* Note: To solve an IE<=8 positioning bug, the unit type is dropped when setting a property value of 0. */\n\t var adjustedSetData = CSS.setPropertyValue(element, /* SET */\n\t property,\n\t tween.currentValue + (parseFloat(currentValue) === 0 ? \"\" : tween.unitType),\n\t tween.rootPropertyValue,\n\t tween.scrollData);\n\n\t /*******************\n\t Hooks: Part II\n\t *******************/\n\n\t /* Now that we have the hook's updated rootPropertyValue (the post-processed value provided by adjustedSetData), cache it onto the element. */\n\t if (CSS.Hooks.registered[property]) {\n\t /* Since adjustedSetData contains normalized data ready for DOM updating, the rootPropertyValue needs to be re-extracted from its normalized form. ?? */\n\t if (CSS.Normalizations.registered[hookRoot]) {\n\t Data(element).rootPropertyValueCache[hookRoot] = CSS.Normalizations.registered[hookRoot](\"extract\", null, adjustedSetData[1]);\n\t } else {\n\t Data(element).rootPropertyValueCache[hookRoot] = adjustedSetData[1];\n\t }\n\t }\n\n\t /***************\n\t Transforms\n\t ***************/\n\n\t /* Flag whether a transform property is being animated so that flushTransformCache() can be triggered once this tick pass is complete. */\n\t if (adjustedSetData[0] === \"transform\") {\n\t transformPropertyExists = true;\n\t }\n\n\t }\n\t }\n\t }\n\n\t /****************\n\t mobileHA\n\t ****************/\n\n\t /* If mobileHA is enabled, set the translate3d transform to null to force hardware acceleration.\n\t It's safe to override this property since Velocity doesn't actually support its animation (hooks are used in its place). */\n\t if (opts.mobileHA) {\n\t /* Don't set the null transform hack if we've already done so. */\n\t if (Data(element).transformCache.translate3d === undefined) {\n\t /* All entries on the transformCache object are later concatenated into a single transform string via flushTransformCache(). */\n\t Data(element).transformCache.translate3d = \"(0px, 0px, 0px)\";\n\n\t transformPropertyExists = true;\n\t }\n\t }\n\n\t if (transformPropertyExists) {\n\t CSS.flushTransformCache(element);\n\t }\n\t }\n\n\t /* The non-\"none\" display value is only applied to an element once -- when its associated call is first ticked through.\n\t Accordingly, it's set to false so that it isn't re-processed by this call in the next tick. */\n\t if (opts.display !== undefined && opts.display !== \"none\") {\n\t Velocity.State.calls[i][2].display = false;\n\t }\n\t if (opts.visibility !== undefined && opts.visibility !== \"hidden\") {\n\t Velocity.State.calls[i][2].visibility = false;\n\t }\n\n\t /* Pass the elements and the timing data (percentComplete, msRemaining, timeStart, tweenDummyValue) into the progress callback. */\n\t if (opts.progress) {\n\t opts.progress.call(callContainer[1],\n\t callContainer[1],\n\t percentComplete,\n\t Math.max(0, (timeStart + opts.duration) - timeCurrent),\n\t timeStart,\n\t tweenDummyValue);\n\t }\n\n\t /* If this call has finished tweening, pass its index to completeCall() to handle call cleanup. */\n\t if (percentComplete === 1) {\n\t completeCall(i);\n\t }\n\t }\n\t }\n\n\t /* Note: completeCall() sets the isTicking flag to false when the last call on Velocity.State.calls has completed. */\n\t if (Velocity.State.isTicking) {\n\t ticker(tick);\n\t }\n\t }", "function stepTime() {\n currentHourSetting += 1;\n if (currentHourSetting > 83)\n currentHourSetting -= 83;\n drawTimeSlide();\n let promises = updateTime();\n\t$.when.apply($, promises).then(function() {\n\t\tif (animationPlaying)\n\t\t\tanimationTimeout = setTimeout(stepTime, 200);\n\t});\n}", "step() {\n this.z80.step();\n // Handle non-maskable interrupts.\n if ((this.nmiLatch & this.nmiMask) !== 0 && !this.nmiSeen) {\n this.z80.nonMaskableInterrupt();\n this.nmiSeen = true;\n // Simulate the reset button being released.\n this.resetButtonInterrupt(false);\n }\n // Handle interrupts.\n if ((this.irqLatch & this.irqMask) !== 0) {\n this.z80.maskableInterrupt();\n }\n // Set off a timer interrupt.\n if (this.tStateCount > this.previousTimerClock + this.clockHz / this.timerHz) {\n this.handleTimer();\n this.previousTimerClock = this.tStateCount;\n }\n // Update cassette state.\n this.updateCassette();\n // Dispatch scheduled events.\n this.eventScheduler.dispatch(this.tStateCount);\n }", "function step(timestamp) {\n update(context, timestamp);\n render(context);\n window.requestAnimationFrame(step);\n}", "function step(timestamp) {\n update(context, timestamp);\n render(context);\n window.requestAnimationFrame(step);\n}", "mainloop() {\n this.repetitions++;\n let now = new Date().getTime();\n let relativeOriginal = now - this.realstartts;\n let relative = relativeOriginal * this.config.timeFactor;\n for (let node of this.nodes) {\n node.check(relative);\n };\n if (this.repetitions % 1000 === 0) {\n console.log(\"Repetition:\", this.repetitions, \"Relative time:\", relative);\n };\n }", "_calculateFrameStep() {\n // TODO: what do the magic numbers mean?\n this._frameStep = Math.round(extrapolate_range_clamp(1, this._simulationRate, 10, 30, 1));\n }", "applyIncrementalBending(stepDesc) {\n if (this.bendingIncrements === 0)\n return;\n\n let timeFactor = 1;\n if (stepDesc && stepDesc.dt)\n timeFactor = stepDesc.dt / (1000 / 60);\n\n const posDelta = this.bendingPositionDelta.clone().multiplyScalar(timeFactor);\n const velDelta = this.bendingVelocityDelta.clone().multiplyScalar(timeFactor);\n this.position.add(posDelta);\n this.velocity.add(velDelta);\n this.angularVelocity += (this.bendingAVDelta * timeFactor);\n this.angle += (this.bendingAngleDelta * timeFactor);\n\n this.bendingIncrements--;\n }", "function updateTime(ti) {\n\tvar curDuration = bg.getCurDuration();\n\tvar progress = ti / 400;\n\n\tbg.setTime(progress * curDuration);\n}", "function calculationLoop() {\n\n function updateTime() {\n updateTimeInToolbar();\n setTimeout(updateTime, 1000);\n }\n setTimeout(updateTime, 1000);\n \t\t\n\t\tfunction calc() {\n\t\t\tcalculate(false);\n\t\t\tsetTimeout(calc, AGSETTINGS.getRefreshTimerInterval());\n\t\t}\n\t\tsetTimeout(calc, AGSETTINGS.getRefreshTimerInterval());\n\t}", "tick() {\n for (let i = 0; i < this.clocksPerTick && this.started; i++) {\n this.step();\n }\n // We might have stopped in the step() routine (e.g., with scheduled event).\n if (this.started) {\n this.scheduleNextTick();\n }\n }", "function steppedForEach(arr, fn, step) {\n if (arr.length > step) {\n fn(...arr.slice(0, step));\n steppedForEach(arr.slice(step), fn, step);\n }\n else {\n fn(...arr);\n }\n}", "startCalcSpeed () {\n // calc rest time of backup\n this.lastTenData.length = 0\n this.startTime = new Date().getTime()\n let restTime = -1\n let lastRestTime = -1\n let beforeLastRestTime = -1\n clearInterval(this.timer)\n this.timer = setInterval(() => {\n const data = this.summary()\n this.lastTenData.unshift(data)\n\n // keep 10 data\n if (this.lastTenData.length > 10) this.lastTenData.length = 10\n\n const length = this.lastTenData.length\n // start calc restTime\n if (length > 1) {\n const deltaSize = this.lastTenData[0].transferSize - this.lastTenData[length - 1].transferSize\n const restTimeBySize = (data.size - data.completeSize) / deltaSize * (length - 1)\n\n const deltaCount = this.lastTenData[0].finishCount - this.lastTenData[length - 1].finishCount\n const restTimeByCount = (data.count - data.finishCount) / deltaCount * (length - 1)\n\n const usedTime = (new Date().getTime() - this.startTime) / 1000\n const restTimeByAllSize = (data.size - data.completeSize) * usedTime / data.transferSize\n const restTimeByAllCount = data.count * usedTime / data.finishCount - usedTime\n\n /* combine of restime by different method */\n restTime = Math.max(Math.min(restTimeBySize, restTimeByCount), Math.min(restTimeByAllSize, restTimeByAllCount))\n\n /* only use restTimeBySize */\n restTime = restTimeBySize\n // max restTime: 30 days\n restTime = Math.min(restTime, 2592000)\n /* average of the last 3 restTime */\n if (lastRestTime < 0 || beforeLastRestTime < 0) {\n lastRestTime = restTime\n beforeLastRestTime = restTime\n }\n restTime = (beforeLastRestTime + lastRestTime + restTime) / 3\n\n beforeLastRestTime = lastRestTime\n lastRestTime = restTime\n }\n\n const ltd = this.lastTenData\n const speed = ltd.length > 1 ? (ltd[0].transferSize - ltd[ltd.length - 1].transferSize) / ltd.length - 1 : 0\n\n const bProgress = data.count ? `${data.finishCount || 0}/${data.count}` : '--/--'\n\n const args = { speed, restTime: getLocaleRestTime(restTime), bProgress, ...data }\n webContents.getAllWebContents().forEach(contents => contents.send('BACKUP_MSG', args))\n }, 1000)\n }", "function loopStep() {\n emit('step', up);\n stepTimeoutRef.value = setTimeout(loopStep, STEP_INTERVAL);\n }", "function userTick(delta, time) {\n}" ]
[ "0.5634498", "0.50159085", "0.49622566", "0.49606362", "0.48251945", "0.48162657", "0.48135534", "0.48130465", "0.47721896", "0.47691166", "0.47629115", "0.47433683", "0.4713767", "0.47011852", "0.46780702", "0.4674049", "0.4664973", "0.46626997", "0.4643626", "0.463386", "0.46319994", "0.46250552", "0.46204817", "0.46020302", "0.4601572", "0.45783377", "0.45742905", "0.45732558", "0.4562005", "0.45539328", "0.45433182", "0.45413935", "0.45400488", "0.45235804", "0.45229658", "0.45229658", "0.4522569", "0.45208627", "0.45113167", "0.44967416", "0.44935107", "0.44885188", "0.44640172", "0.44622064", "0.4449581", "0.44479707", "0.44459355", "0.444453", "0.44368517", "0.44240603", "0.44223562", "0.44202095", "0.44125593", "0.4400251", "0.43971875", "0.43935135", "0.43759805", "0.43732026", "0.43690217", "0.43665257", "0.43498674", "0.4340191", "0.4339269", "0.43363872", "0.43340978", "0.4330407", "0.4329841", "0.43262738", "0.43234575", "0.4323219", "0.43229985", "0.431704", "0.43156746", "0.43144837", "0.43141252", "0.43128037", "0.43111235", "0.4297043", "0.4295229", "0.42906862", "0.42889726", "0.42889538", "0.42866647", "0.42866647", "0.42866647", "0.4284086", "0.4283768", "0.4281", "0.4279749", "0.4279749", "0.42708674", "0.42661208", "0.42659768", "0.42656663", "0.4265278", "0.4263318", "0.42632502", "0.42622113", "0.4258049", "0.42573947" ]
0.55785924
1
x,y determines a hex, d determines the vertex of the hex Two values for d: WEST or NORTHWEST
function dispAtVertex(text, context, x, y, d) { var xcoord = 0; var ycoord = 0; //FIXME: Retool this, it doesn't actually ensure correctness. //or remove /*if (x < 0 || y < 0 || x > 11 || y > 11) { // invalid coords! console.warn("Invalid drawing coords in dispAtVertex!"); return -1; }*/ var coords = getVertexCoords(x,y,d); xcoord = coords[0]; ycoord = coords[1]; //console.log("displaying vertex at " + xcoord +"," + ycoord); context.fillStyle = 'rgb(0,0,0)'; context.font = '12px sans-serif'; context.fillText(text, xcoord, ycoord); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hexagon(x,y, r) {\r\n push();\r\n translate(x,y);\r\n beginShape();\r\n vertex(r,0);\r\n vertex(r*0.5,r*0.8660254);\r\n vertex(-r*0.5,r*0.8660254);\r\n vertex(-r,0);\r\n vertex(-r*0.5,-r*0.8660254);\r\n vertex(r*0.5,-r*0.8660254);\r\n endShape(CLOSE);\r\n pop();\r\n}", "hexToPixel( h ) {\n // KEY pointy or flat\n\n let hexOrigin = this.state.hexOrigin\n\n // flat\n // let y = this.state.hexSize * Math.sqrt(3) * ( h.q + h.r / 2 ) + hexOrigin.y\n // let x = this.state.hexSize * 3/2 * h.r + hexOrigin.x\n \n // pointy\n let x = this.state.hexSize * Math.sqrt(3) * ( h.q + h.r / 2 ) + hexOrigin.x\n let y = this.state.hexSize * 3/2 * h.r + hexOrigin.y\n\n return this.Point( x, y )\n }", "function pixelToHex (x, y) {\r\n // offset\r\n x -= hexagon.offset.x\r\n y -= hexagon.offset.y\r\n\r\n // converts pixel coordinates to 2d axial hexagonal space\r\n var res = {}\r\n res.x = (x * Math.sqrt(3) / 3 - y / 3) / hexagon.radius\r\n res.y = y * 2 / 3 / hexagon.radius\r\n\r\n res = hexRound(res)\r\n\r\n return res\r\n}", "function hexagon_points(x, y, r) {\n var sq = Math.sqrt(3) * 0.5;\n var rh = 0.5 * r;\n\n return [x, y-r, x+r*sq, y-rh, x+r*sq, y+rh, x, y+r, x-r*sq, y+rh, x-r*sq, y-rh];\n}", "function hex(x,y)\r\n{\r\n\tvar ret = new Array;\r\n\tret[0] = x;\r\n\tret[1] = y;\r\n\tif (x >= 0 && x < gridSize && y >= 0 && y < gridSize)\r\n\t{ret[2] = cgrid[x][y];}else{ret[2] = new Array;ret[2][0] = 0;ret[2][1] = 0;}\r\n\tif (x >= 0 && x < gridSize && y >= 0 && y < gridSize)\r\n\t{ret[3] = grid[x][y];}else{ret[3] = 0;}\r\n\treturn ret;\r\n}", "function from_coords(x,y) {\n return x + y*16;\n }", "function hexPath(x,y,H,S,C,cornerSize,extra){\n\treturn \"M \"+x+\" \"+y + \n\t\t \" h \"+(H*(1-2 *cornerSize)/2) +\n\t\t \" q \"+(cornerSize*H)+\" 0 \" + (cornerSize * (S + H) ) + \" \" + (cornerSize * C) +\n\t\t \" l \"+(S * (1 - 2 * cornerSize)*(1+extra)) + \" \" + (C * (1 - 2 * cornerSize)*(1+extra)) + \n\t\t \" q \"+(cornerSize*S)+ \" \" + (cornerSize * C) + \" \" + \" 0 \" + (2 * cornerSize * C) +\n\t\t \" l \"+(-S * (1 - 2 * cornerSize) * (1+extra)) + \" \" + (C * (1 - 2 * cornerSize) * (1+extra)) +\n\t\t \" q \"+(-cornerSize * S) + \" \" + (cornerSize*C) + \" \" + (-(S+H) * cornerSize) + \" \" + (cornerSize*C) +\n\t\t \" h \"+(-H*(1-2*cornerSize)) +\n\t\t \" q \"+(-cornerSize * H) + \" 0 \" + (-cornerSize * (H + S)) + \" \" + (-cornerSize*C) +\n\t\t \" l \"+(-(1-2*cornerSize)*S * (1+extra)) + \" \" + (-(1-2*cornerSize)*C * (1+extra)) +\n\t\t \" q \"+(-cornerSize*S) + \" \" + (-cornerSize*C) + \" 0 \" + (-2 * cornerSize*C) +\n\t\t \" l \"+((1-2*cornerSize)*S * (1+extra)) + \" \" + (-(1-2*cornerSize)*C * (1+extra)) +\n\t\t \" q \"+(cornerSize*S) + \" \" + (-cornerSize*C) + \" \" + (cornerSize*(S+H)) + \" \" + (-cornerSize*C) +\n\t\t \" z\";\n}", "pixelToHex( p ) {\n let size = this.state.hexSize\n let origin = this.state.hexOrigin\n\n // KEY pointy or flat\n // flat\n // let q = ( p.x - origin.x ) * 2/3 / size\n // let r = ( -( p.x - origin.x ) / 3 + Math.sqrt(3)/3 * ( p.y - origin.y ) ) / size\n // return this.Hex( q, r, -q -r )\n\n // pointy\n let q = ( ( p.x - origin.x ) * Math.sqrt(3)/3 - ( p.y - origin.y ) / 3 ) / size\n let r = ( p.y - origin.y ) * 2/3 / size\n return this.Hex( q, r, -q -r )\n }", "function drawHexagon(ctx, x, y, w, h) {\n var facShort = 0.26;\n var facLong = 1 - facShort;\n x -= w / 2;\n y -= h / 2;\n ctx.moveTo(x + w * 0.5, y);\n ctx.lineTo(x, y + h * facShort);\n ctx.lineTo(x, y + h * facLong);\n ctx.lineTo(x + w * 0.5, y + h);\n ctx.lineTo(x + w, y + h * facLong);\n ctx.lineTo(x + w, y + h * facShort);\n ctx.lineTo(x + w * 0.5, y);\n } //function drawHexagon", "function drawHexagon(ctx, x, y, w, h) {\n var facShort = 0.26;\n var facLong = 1 - facShort;\n x -= w / 2;\n y -= h / 2;\n ctx.moveTo(x + w * 0.5, y);\n ctx.lineTo(x, y + h * facShort);\n ctx.lineTo(x, y + h * facLong);\n ctx.lineTo(x + w * 0.5, y + h);\n ctx.lineTo(x + w, y + h * facLong);\n ctx.lineTo(x + w, y + h * facShort);\n ctx.lineTo(x + w * 0.5, y);\n } //function drawHexagon", "function Vertex(hex,direction_number) {\n this.hex = hex;\n this.direction_number = direction_number;\n}", "hasSandwichNorth(x,y){\r\n if(y-3 < 0){//checks if all nodes exist\r\n return false;\r\n }\r\n return this.getColor(x, y - 3) === this.getColor(x, y) && this.getColor(x, y - 2) === this.getColor(x, y - 1) && this.oppositeColors(x, y, x, y - 1);\r\n //base case\r\n }", "function hex_distance(x1, z1, x2, z2) {\n\t// Convert to cube-coordinates first.\n\t// Derive the missing coordinate.\n y1 = -x1 - z1;\n y2 = -x2 - z2;\n return (Math.abs(x1 - x2) + Math.abs(y1 - y2) + Math.abs(z1 - z2)) / 2;\n}", "function x (x,y){\n let p = sz * 0.10;\n line((sz * x + sz) - p,\n (sz * y) + p,\n (sz * x) + p,\n (sz * y + sz) - p);\n line((sz * x) + p,\n (sz * y) + p,\n (sz * x + sz) - p,\n (sz * y + sz) - p);\n \n}", "grad(hash, x, y, z) {\n let h = hash & 15,\n u = h < 8 ? x : y,\n v = h < 4 ? y : h == 12 || h == 14 ? x : z;\n return ((h&1) == 0 ? u : -u) + ((h&2) == 0 ? v : -v);\n }", "function drawHex(x, y) {\n var start = Math.PI / 6;\n ctx.beginPath();\n ctx.moveTo(x + Math.cos(start) * HEX_SIZE, y + Math.sin(start) * HEX_SIZE);\n for(var i = 0; i < 6; ++i) {\n var angle = start + 2 * Math.PI * i / 6;\n ctx.lineTo(x + Math.cos(angle + 2 * Math.PI / 6) * HEX_SIZE, y + Math.sin(angle + 2 * Math.PI / 6) * HEX_SIZE);\n }\n ctx.closePath();\n ctx.fill();\n ctx.stroke();\n }", "drawHexes() {\n const { width, height } = this.state.canvasSize\n const { hexWidth, hexHeight, vertDist, horizDist } = this.state.hexParams\n const hexOrigin = this.state.hexOrigin\n\n let qLeftSide = Math.round( hexOrigin.x / horizDist )\n let qRightSide = Math.round( ( width - hexOrigin.x ) / horizDist )\n let rTopSide = Math.round( hexOrigin.y / ( vertDist ) )\n let rBottomSide = Math.round( ( height - hexOrigin.y ) / vertDist )\n\n // This is the bottom half\n var p = 0\n for( let r = 0; r <= rBottomSide; r++ ) {\n if( r % 2 === 0 && r !== 0 )\n p++\n for( let q = -qLeftSide; q <= qRightSide; q++ ) {\n const { x, y } = this.hexToPixel( this.Hex( q - p, r ) )\n\n if( ( x > hexWidth / 2 && x < width - hexWidth / 2) && ( y > hexHeight / 2 && y < height - hexHeight / 2 ) ) {\n this.drawHex( this.canvasHex, this.Point( x, y ) )\n this.drawHexCoordinates( this.canvasHex, this.Point( x, y ), this.Hex( q - p, r, -q -r ) )\n }\n }\n }\n\n // This is the top half\n var n = 0\n for( let r = -1; r >= -rTopSide; r-- ) {\n if( r % 2 !== 0 )\n n++\n for( let q = -qLeftSide; q <= qRightSide; q++ ) {\n const { x, y } = this.hexToPixel( this.Hex( q + n, r ) )\n\n if( ( x > hexWidth / 2 && x < width - hexWidth / 2) && ( y > hexHeight / 2 && y < height - hexHeight / 2 ) ) {\n this.drawHex( this.canvasHex, this.Point( x, y ) )\n this.drawHexCoordinates( this.canvasHex, this.Point( x, y ), this.Hex( q + n, r, -q -r ) )\n }\n }\n }\n }", "function Edge(hex,direction_number) {\n this.hex = hex;\n this.direction_number = direction_number;\n}", "function buildHex(hex){\n\t\n\tbuildPlane(hex,0,true);\n\tbuildPlane(hex,0,false);\n\n\tbuildPlane(hex,-0.10,true);\n\tbuildPlane(hex,-0.10,false);\n\n}", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | x << 8) & 0x00FF00FF;\n x = (x | x << 4) & 0x0F0F0F0F;\n x = (x | x << 2) & 0x33333333;\n x = (x | x << 1) & 0x55555555;\n\n y = (y | y << 8) & 0x00FF00FF;\n y = (y | y << 4) & 0x0F0F0F0F;\n y = (y | y << 2) & 0x33333333;\n y = (y | y << 1) & 0x55555555;\n\n return x | y << 1;\n}", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | x << 8) & 0x00FF00FF;\n x = (x | x << 4) & 0x0F0F0F0F;\n x = (x | x << 2) & 0x33333333;\n x = (x | x << 1) & 0x55555555;\n\n y = (y | y << 8) & 0x00FF00FF;\n y = (y | y << 4) & 0x0F0F0F0F;\n y = (y | y << 2) & 0x33333333;\n y = (y | y << 1) & 0x55555555;\n\n return x | y << 1;\n}", "function kd(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d}", "function zOrder(x, y, minX, minY, size) {\n\t // coords are transformed into non-negative 15-bit integer range\n\t x = 32767 * (x - minX) / size;\n\t y = 32767 * (y - minY) / size;\n\n\t x = (x | (x << 8)) & 0x00FF00FF;\n\t x = (x | (x << 4)) & 0x0F0F0F0F;\n\t x = (x | (x << 2)) & 0x33333333;\n\t x = (x | (x << 1)) & 0x55555555;\n\n\t y = (y | (y << 8)) & 0x00FF00FF;\n\t y = (y | (y << 4)) & 0x0F0F0F0F;\n\t y = (y | (y << 2)) & 0x33333333;\n\t y = (y | (y << 1)) & 0x55555555;\n\n\t return x | (y << 1);\n\t}", "function getDirection(x, y){\n if (x === 0 && y === 0)\n return null;\n if ( x + y >= 0 && x-y >= 0) {\n return \"r\";\n } else if (x+y < 0 && x-y >= 0) {\n return \"u\";\n } else if (x+y < 0 && x-y < 0) {\n return \"l\";\n } else {\n return \"d\";\n }\n }", "drawHexCoordinates( canvasID, center, h ) {\n const ctx = canvasID.getContext('2d')\n\n ctx.fillText( h.q, center.x+6, center.y )\n ctx.fillText( h.r, center.x-3, center.y+15 )\n ctx.fillText( h.s, center.x-12, center.y )\n }", "function zOrder(x, y, minX, minY, size) {\n\t // coords are transformed into non-negative 15-bit integer range\n\t x = 32767 * (x - minX) / size;\n\t y = 32767 * (y - minY) / size;\n\t\n\t x = (x | (x << 8)) & 0x00FF00FF;\n\t x = (x | (x << 4)) & 0x0F0F0F0F;\n\t x = (x | (x << 2)) & 0x33333333;\n\t x = (x | (x << 1)) & 0x55555555;\n\t\n\t y = (y | (y << 8)) & 0x00FF00FF;\n\t y = (y | (y << 4)) & 0x0F0F0F0F;\n\t y = (y | (y << 2)) & 0x33333333;\n\t y = (y | (y << 1)) & 0x55555555;\n\t\n\t return x | (y << 1);\n\t}", "function zOrder(x, y, minX, minY, size) {\n\t // coords are transformed into non-negative 15-bit integer range\n\t x = 32767 * (x - minX) / size;\n\t y = 32767 * (y - minY) / size;\n\t\n\t x = (x | (x << 8)) & 0x00FF00FF;\n\t x = (x | (x << 4)) & 0x0F0F0F0F;\n\t x = (x | (x << 2)) & 0x33333333;\n\t x = (x | (x << 1)) & 0x55555555;\n\t\n\t y = (y | (y << 8)) & 0x00FF00FF;\n\t y = (y | (y << 4)) & 0x0F0F0F0F;\n\t y = (y | (y << 2)) & 0x33333333;\n\t y = (y | (y << 1)) & 0x55555555;\n\t\n\t return x | (y << 1);\n\t}", "function zOrder(x, y, minX, minY, size) {\n\t // coords are transformed into non-negative 15-bit integer range\n\t x = 32767 * (x - minX) / size;\n\t y = 32767 * (y - minY) / size;\n\t\n\t x = (x | (x << 8)) & 0x00FF00FF;\n\t x = (x | (x << 4)) & 0x0F0F0F0F;\n\t x = (x | (x << 2)) & 0x33333333;\n\t x = (x | (x << 1)) & 0x55555555;\n\t\n\t y = (y | (y << 8)) & 0x00FF00FF;\n\t y = (y | (y << 4)) & 0x0F0F0F0F;\n\t y = (y | (y << 2)) & 0x33333333;\n\t y = (y | (y << 1)) & 0x55555555;\n\t\n\t return x | (y << 1);\n\t}", "static zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n return x | (y << 1);\n }", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) / size;\n y = 32767 * (y - minY) / size;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function xy2id(x, y){ return (1 + (parseInt(x) + 400) + (801 * Math.abs(parseInt(y) - 400))); }", "function xy2id(x, y){ return (1 + (parseInt(x) + 400) + (801 * Math.abs(parseInt(y) - 400))); }", "function hexPath(dir) {\n\tvar directions = dir.split(\",\");\n\n\t//Each variable refers to the number of steps taken in that direction\n\tvar n = directions.filter(a => a == 'n').length;\n\tvar ne = directions.filter(a => a == 'ne').length;\n\tvar se = directions.filter(a => a == 'se').length;\n\tvar s = directions.filter(a => a == 's').length;\n\tvar sw = directions.filter(a => a == 'sw').length;\n\tvar nw = directions.filter(a => a == 'nw').length;\n\t\n\tvar ns, nesw, nwse;\n\t//Eliminate directions that cancel each other out\n\tif (n >= s) {\n\t\tn = n - s;\n\t\ts = 0;\n\t\tns = 'n';\n\t}\n\telse {\n\t\ts = s - n;\n\t\tn = 0;\n\t\tns = 's';\n\t}\n\n\tif (ne >= sw) {\n\t\tne = ne - sw;\n\t\tsw = 0;\n\t\tnesw = 'ne';\n\t}\n\telse {\n\t\tsw = sw - ne;\n\t\tne = 0;\n\t\tnesw = 'sw';\n\t}\n\n\tif (nw >= se) {\n\t\tnw = nw - se;\n\t\tse = 0;\n\t\tnwse = 'nw';\n\t}\n\telse {\n\t\tse = se - nw;\n\t\tnw = 0;\n\t\tnwse = 'se';\n\t}\n\n\t//Eight possibilities for the three remaining directions\n\tvar switches = [ns,nesw,nwse];\n\tswitches = switches.join(\",\");\n\tswitch(switches) {\n\t\tcase 'n,ne,nw':\n\t\t\treturn n + Math.max(ne,nw);\n\t\tcase 'n,ne,se':\n\t\t\treturn ne + Math.max(n,se);\n\t\tcase 'n,sw,nw':\n\t\t\treturn nw + Math.max(n,sw);\n\t\tcase 's,ne,se':\n\t\t\treturn se + Math.max(s,ne);\n\t\tcase 's,sw,nw':\n\t\t\treturn sw + Math.max(s,nw);\n\t\tcase 's,sw,se':\n\t\t\treturn s + Math.max(sw,se);\n\t\tcase 'n,ne,nw':\n\t\t\treturn n + Math.max(ne,nw);\n\t\tcase 'n,sw,se':\n\t\t\treturn Math.max(n,sw,se) - Math.min(n,sw,se);\n\t\tcase 's,ne,nw':\n\t\t\treturn Math.max(s,ne,nw) - Math.min(s,ne,nw);\n\t\tdefault:\n\t\t\treturn 'error';\n\t}\n\n}", "function diagonalAscending(x, y, s) {\n line(x - s / 2, y + s / 2, x + s / 2, y - s / 2);\n}", "constructor(x, y) {\n\t\tthis.chadX = 1000;\n\t\tthis.chadY = 10;\n\t\tthis.chadW = 10;\n\t\tthis.chadDy = 5;\n this.color = \"Red\";\n }", "function HexLayout (orientation_string, size, origin) {\n \n this.orientation = getOrientation(orientation_string);\n this.size = size; //point object\n this.origin = origin; //point object\n\n this.fast_points = [new Point(0,0),new Point(0,0),new Point(0,0),new Point(0,0),new Point(0,0),new Point(0,0)];\n this.reusable_point = new Point(0,0);\n}", "function drawHexes() {\n const { canvasWidth, canvasHeight } = canvasSize\n const { hexWidth, hexHeight, vertDist, horizDist} = getHexParametres()\n let qLeftSide = Math.round(hexOrigin.x/horizDist);\n let qRightSide = Math.round((canvasWidth - hexOrigin.x)/horizDist);\n let rTopSide = Math.round(hexOrigin.y/vertDist);\n let rBottomSide = Math.round((canvasHeight - hexOrigin.y)/vertDist);\n let hexPathMap = []\n let p = 0\n for(let r = 0; r <= rBottomSide; r++) {\n if(r % 2 === 0 && r !== 0) {\n p++\n }\n for(let q = -qLeftSide; q <= qRightSide; q++) {\n const { x, y } = hexToPixel(hex(q-p, r))\n if((x > hexWidth/2 && x < canvasWidth - hexWidth/2) && (y > hexHeight/2 && y < canvasHeight - hexHeight/2)) {\n drawHex(canvasHex, point(x,y), 1, \"black\", \"grey\")\n //drawHexCoordinates(canvasHex, point(x,y), hex(q-p, r, - (q - p) - r))\n let bottomH = JSON.stringify(hex(q - p, r, - (q - p) - r))\n if(!obstacles.includes(bottomH)){\n hexPathMap.push(bottomH)\n }\n }\n }\n }\n let n = 0;\n for(let r = -1; r >= -rTopSide; r--) {\n if(r%2 !== 0) {\n n++\n }\n for(let q = -qLeftSide; q <= qRightSide; q++) {\n const { x, y } = hexToPixel(hex(q+n, r))\n if((x > hexWidth/2 && x < canvasWidth - hexWidth/2) && (y > hexHeight/2 && y < canvasHeight - hexHeight/2)) {\n drawHex(canvasHex, point(x,y), 1, \"black\", \"grey\")\n //drawHexCoordinates(canvasHex, point(x,y), hex(q+n, r, - (q + n) - r))\n let topH = JSON.stringify(hex(q + n, r, - (q + n) - r))\n if(!obstacles.includes(topH)){\n hexPathMap.push(topH)\n }\n }\n }\n }\n hexPathMap = [].concat(hexPathMap)\n setHexPath(hexPathMap)\n }", "function GetXandYCoordinate(id){\n id = \"\"+id;\n return {y : id[0],x : id[1]};\n}", "function move(d) {\n\t\tvar currentx = parseFloat(d3.select(this).attr(\"cx\")),\n\t\t \t//currenty = parseFloat(d3.select(this).attr(\"cy\")),\n\t\t\tradius = d.r;\n\n\t\t//Randomly define which quadrant to move next\n\t\tvar sideX = currentx > 0 ? -1 : 1,\n\t\t\tsideY = Math.random() > 0.5 ? 1 : -1,\n\t\t\trandSide = Math.random();\n\n\t\tvar newx,\n\t\t\tnewy;\n\n\t\t//Move new locations along the vertical sides in 33% of the cases\n\t\tif (randSide > 0.66) {\n\t\t\tnewx = sideX * 0.5 * SQRT3 * hexRadius - sideX*radius;\n\t\t\tnewy = sideY * Math.random() * 0.5 * hexRadius - sideY*radius;\n\t\t} else {\n\t\t\t//Choose a new x location randomly, \n\t\t\t//the y position will be calculated later to lie on the hexagon border\n\t\t\tnewx = sideX * Math.random() * 0.5 * SQRT3 * hexRadius;\n\t\t\t//Otherwise calculate the new Y position along the hexagon border \n\t\t\t//based on which quadrant the random x and y gave\n\t\t\tif (sideX > 0 && sideY > 0) {\n\t\t\t\tnewy = hexRadius - (1/SQRT3)*newx;\n\t\t\t} else if (sideX > 0 && sideY <= 0) {\n\t\t\t\tnewy = -hexRadius + (1/SQRT3)*newx;\n\t\t\t} else if (sideX <= 0 && sideY > 0) {\n\t\t\t\tnewy = hexRadius + (1/SQRT3)*newx;\n\t\t\t} else if (sideX <= 0 && sideY <= 0) {\n\t\t\t\tnewy = -hexRadius - (1/SQRT3)*newx;\n\t\t\t}//else\n\n\t\t\t//Take off a bit so it seems that the circles truly only touch the edge\n\t\t\tvar offSetX = radius * Math.cos( 60 * Math.PI/180),\n\t\t\t\toffSetY = radius * Math.sin( 60 * Math.PI/180);\n\t\t\tnewx = newx - sideX*offSetX;\n\t\t\tnewy = newy - sideY*offSetY;\n\t\t}//else\n\n\t\t//Transition the circle to its new location\n\t\td3.select(this)\n\t\t\t.transition(\"moveing\")\n\t\t\t.duration(3000 + 4000*Math.random())\n\t\t\t.ease(\"linear\")\n\t\t\t.attr(\"cy\", newy)\n\t\t\t.attr(\"cx\", newx)\n\t\t\t.each(\"end\", move);\n\n\t}", "getHexCornerCoord( center, i ) {\n // KEY pointy or flat\n\n // flat\n // let angleDeg = 60 * i\n\n // pointy\n let angleDeg = 60 * i + 30\n\n let angleRad = Math.PI / 180 * angleDeg\n let x = center.x + this.state.hexSize * Math.cos( angleRad )\n let y = center.y + this.state.hexSize * Math.sin( angleRad )\n\n return this.Point( x, y )\n }", "function getneighbors(x,y) {\n let neighbors = [];\n //e\n neighbors.push((x + 1) + \",\" + y);\n //se\n neighbors.push((y%2 === 0 ? x + 1 : x) + \",\" + (y+1));\n //sw\n neighbors.push((y%2 !== 0 ? x - 1 : x) + \",\" + (y+1));\n //w\n neighbors.push((x - 1) + \",\" + y);\n //nw\n neighbors.push((y%2 !== 0 ? x - 1 : x) + \",\" + (y-1));\n //ne\n neighbors.push((y%2 === 0 ? x + 1 : x) + \",\" + (y-1));\n return neighbors;\n}", "function mouseCoordToHex(x, y) {\n var ratio_x, ratio_y;\n x = x - allCanvas.pointer.offset().left;\n y = y - allCanvas.pointer.offset().top;\n\n if (framesize.decoded.height === 0) {\n ratio_x = x / getWidth();\n ratio_y = y / getHeight();\n } else {\n var calculated_height = framesize.decoded.height * framesize.displayed.width * framesize.displayed.scale / framesize.decoded.width;\n var calculated_width = framesize.displayed.width * framesize.displayed.scale; //framesize.decoded.width * framesize.displayed.height / framesize.decoded.height ;\n var offsetHeight = (calculated_height - framesize.displayed.height) / 2;\n var offsetWidth = (calculated_width - (framesize.displayed.width * framesize.displayed.scale)) / 2;\n ratio_x = ((x + offsetWidth)) / calculated_width;\n ratio_y = ((y + offsetHeight)) / calculated_height;\n }\n\n\n\n\n var hexX = that._percentToHex(ratio_x * 100);\n var hexY = that._percentToHex(ratio_y * 100);\n return hexX === 'FFFF' || hexY === 'FFFF' ? 'FFFFFFFF' : hexX + hexY;\n }", "function zOrder( x, y, minX, minY, invSize ) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\n\tx = 32767 * ( x - minX ) * invSize;\n\ty = 32767 * ( y - minY ) * invSize;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}", "function zOrder( x, y, minX, minY, invSize ) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\n\tx = 32767 * ( x - minX ) * invSize;\n\ty = 32767 * ( y - minY ) * invSize;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}", "function zOrder( x, y, minX, minY, invSize ) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\n\tx = 32767 * ( x - minX ) * invSize;\n\ty = 32767 * ( y - minY ) * invSize;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}", "function zOrder( x, y, minX, minY, invSize ) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\n\tx = 32767 * ( x - minX ) * invSize;\n\ty = 32767 * ( y - minY ) * invSize;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}", "function zOrder(x, y, minX, minY, invSize) {\n\t // coords are transformed into non-negative 15-bit integer range\n\t x = 32767 * (x - minX) * invSize;\n\t y = 32767 * (y - minY) * invSize;\n\n\t x = (x | (x << 8)) & 0x00FF00FF;\n\t x = (x | (x << 4)) & 0x0F0F0F0F;\n\t x = (x | (x << 2)) & 0x33333333;\n\t x = (x | (x << 1)) & 0x55555555;\n\n\t y = (y | (y << 8)) & 0x00FF00FF;\n\t y = (y | (y << 4)) & 0x0F0F0F0F;\n\t y = (y | (y << 2)) & 0x33333333;\n\t y = (y | (y << 1)) & 0x55555555;\n\n\t return x | (y << 1);\n\t}", "constructor(x, y) {\n this.x = x;\n this.y = y;\n this.w = 100;\n this.h = 40;\n this.fillColor = color(255, 76, 39);\n this.id = 1;\n }", "getHexParams() {\n // KEY pointy or flat\n\n // flat\n // let hexWidth = this.state.hexSize * 2\n // let hexHeight = Math.sqrt(3)/2 * hexWidth\n // let vertDist = hexHeight\n // let horizDist = hexWidth * 3/4\n\n // pointy\n let hexHeight = this.state.hexSize * 2\n let hexWidth = Math.sqrt(3)/2 * hexHeight\n let vertDist = hexHeight * 3/4\n let horizDist = hexWidth\n\n return { hexWidth, hexHeight, vertDist, horizDist }\n }", "function zOrder(x, y, minX, minY, size) {\n // coords are transformed into (0..1000) integer range\n x = 1000 * (x - minX) / size;\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = 1000 * (y - minY) / size;\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder( x, y, minX, minY, invSize ) {\n\n\t\t// coords are transformed into non-negative 15-bit integer range\n\n\t\tx = 32767 * ( x - minX ) * invSize;\n\t\ty = 32767 * ( y - minY ) * invSize;\n\n\t\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\t\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\t\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\t\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\t\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\t\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\t\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\t\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\t\treturn x | ( y << 1 );\n\n\t}", "function zOrder( x, y, minX, minY, invSize ) {\n\n\t\t// coords are transformed into non-negative 15-bit integer range\n\n\t\tx = 32767 * ( x - minX ) * invSize;\n\t\ty = 32767 * ( y - minY ) * invSize;\n\n\t\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\t\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\t\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\t\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\t\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\t\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\t\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\t\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\t\treturn x | ( y << 1 );\n\n\t}", "function zOrder( x, y, minX, minY, invSize ) {\n\n\t\t// coords are transformed into non-negative 15-bit integer range\n\n\t\tx = 32767 * ( x - minX ) * invSize;\n\t\ty = 32767 * ( y - minY ) * invSize;\n\n\t\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\t\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\t\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\t\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\t\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\t\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\t\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\t\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\t\treturn x | ( y << 1 );\n\n\t}", "function zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}", "function DencryptCoords() {}", "function zOrder( x, y, minX, minY, invSize ) {\n\n\t\t// coords are transformed into non-negative 15-bit integer range\n\t\tx = 32767 * ( x - minX ) * invSize;\n\t\ty = 32767 * ( y - minY ) * invSize;\n\n\t\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\t\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\t\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\t\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\t\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\t\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\t\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\t\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\t\treturn x | ( y << 1 );\n\n\t}", "function zOrder( x, y, minX, minY, invSize ) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\tx = ( x - minX ) * invSize | 0;\n\ty = ( y - minY ) * invSize | 0;\n\n\tx = ( x | ( x << 8 ) ) & 0x00FF00FF;\n\tx = ( x | ( x << 4 ) ) & 0x0F0F0F0F;\n\tx = ( x | ( x << 2 ) ) & 0x33333333;\n\tx = ( x | ( x << 1 ) ) & 0x55555555;\n\n\ty = ( y | ( y << 8 ) ) & 0x00FF00FF;\n\ty = ( y | ( y << 4 ) ) & 0x0F0F0F0F;\n\ty = ( y | ( y << 2 ) ) & 0x33333333;\n\ty = ( y | ( y << 1 ) ) & 0x55555555;\n\n\treturn x | ( y << 1 );\n\n}", "function zOrder(x, y, minX, minY, invSize) {\n\n\t// coords are transformed into non-negative 15-bit integer range\n\n\tx = 32767 * (x - minX) * invSize;\n\ty = 32767 * (y - minY) * invSize;\n\n\tx = (x | x << 8) & 0x00FF00FF;\n\tx = (x | x << 4) & 0x0F0F0F0F;\n\tx = (x | x << 2) & 0x33333333;\n\tx = (x | x << 1) & 0x55555555;\n\n\ty = (y | y << 8) & 0x00FF00FF;\n\ty = (y | y << 4) & 0x0F0F0F0F;\n\ty = (y | y << 2) & 0x33333333;\n\ty = (y | y << 1) & 0x55555555;\n\n\treturn x | y << 1;\n}", "function HexObj(centerX,centerY){\n\nthis.positions = [];\nthis.centerX = centerX;\nthis.centerY = centerY;\nthis.lineLength = 50;\n\nconst NUM_SIDES = 6;\n//make an array of positions\n//calculating six positions - dynamically.\nfor(let i=0; i<NUM_SIDES; i++)\n{\n //returns hex values in an array.\n this.positions.push(new PosVector(\n flat_hex_cornerX(this.centerX, this.lineLength, i),\n flat_hex_cornerY(this.centerY, this.lineLength, i)\n ));\n}\n\n}", "function hexagon(center, rx, ry) {\n var vertices = [];\n for (var i = 0; i < 6; i++) {\n var x = center[0] + rx * cosines[i];\n var y = center[1] + ry * sines[i];\n vertices.push([x, y]);\n }\n //first and last vertex must be the same\n vertices.push(vertices[0]);\n return polygon([vertices]);\n}", "function hexagon(center, rx, ry) {\n var vertices = [];\n for (var i = 0; i < 6; i++) {\n var x = center[0] + rx * cosines[i];\n var y = center[1] + ry * sines[i];\n vertices.push([x, y]);\n }\n //first and last vertex must be the same\n vertices.push(vertices[0]);\n return polygon([vertices]);\n}", "drawBothDiagonal(x, y, dim){\n const colorA = this.colors[0].toString()\n const colorB = this.colors[1].toString()\n fill(colorA)\n triangle(x, y, x+dim, y, x+(dim/2), y+(dim/2)) \n triangle(x, y+dim, x+dim/2, y+dim/2, x+dim, y+dim)\n fill(colorB)\n triangle(x, y, x+dim/2, y+dim/2, x, y+dim)\n triangle(x+dim, y, x+dim/2, y+dim/2, x+dim, y+dim)\n this.edges = [colorA, colorB, colorA, colorB]\n }", "function getColor(x, y) {\n var base = (Math.floor(y) * width + Math.floor(x)) * 4;\n var c = {\n r: pixels[base + 0],\n g: pixels[base + 1],\n b: pixels[base + 2],\n a: pixels[base + 3]\n };\n\n return \"rgb(\" + c.r + \",\" + c.g + \",\" + c.b + \")\";\n }", "function findPath(x, y, xd, yd) {\r\n var x_original = x;\r\n var y_original = y;\r\n\r\n var open = [];\r\n var count = 0;\r\n open.push([xd, yd, count]);\r\n\r\n for (var g = 0; g < open.length; g++) {\r\n x = open[g][0];\r\n y = open[g][1];\r\n count++;\r\n\r\n var arr = [];\r\n arr.push([x - tileSize, y, count]);\r\n arr.push([x + tileSize, y, count]);\r\n arr.push([x, y - tileSize, count]);\r\n arr.push([x, y + tileSize, count]);\r\n\r\n // Take out choices that are out of range\r\n // or otherwise cannot be traversed to.\r\n var o = arr.length - 1;\r\n while (o >= 0) {\r\n if (typeof arr[o] == 'undefined') {\r\n break;\r\n }\r\n\r\n var xx = arr[o][0];\r\n var yy = arr[o][1];\r\n\r\n var outOfRange = !isInRange(xx, yy);\r\n var tileOccupied = isOccupied(xx, yy);\r\n\r\n var existsInOpenList = false;\r\n\r\n for (var h = 0; h < open.length; h++) {\r\n if (xx == open[h][0] && yy == open[h][1]) {\r\n if (arr[o][2] >= open[h][2]) {\r\n existsInOpenList = true;\r\n }\r\n }\r\n }\r\n\r\n if (outOfRange || tileOccupied || existsInOpenList) {\r\n arr.splice(o, 1);\r\n }\r\n\r\n o--;\r\n }\r\n\r\n for (var i = 0; i < arr.length; i++) {\r\n open.push(arr[i]);\r\n }\r\n }\r\n\r\n x = x_original;\r\n y = y_original;\r\n var waypoints = [];\r\n var foundPath = false;\r\n\r\n while (true) {\r\n var lowestI = -1;\r\n var lowest = 999999;\r\n\r\n for (var f = 0; f < open.length; f++) {\r\n var isANearByCell = false;\r\n\r\n if (x + 30 == open[f][0] && y == open[f][1]) {\r\n isANearByCell = true;\r\n }\r\n if (x - 30 == open[f][0] && y == open[f][1]) {\r\n isANearByCell = true;\r\n }\r\n if (x == open[f][0] && y + 30 == open[f][1]) {\r\n isANearByCell = true;\r\n }\r\n if (x == open[f][0] && y - 30 == open[f][1]) {\r\n isANearByCell = true;\r\n }\r\n\r\n if (isANearByCell == true && lowest > open[f][2]) {\r\n lowest = open[f][2];\r\n lowestI = f;\r\n } else if (isANearByCell == true && lowest == open[f][2]) {\r\n var rand = Math.floor(Math.random() * 2);\r\n if (rand == 0) {\r\n lowest = open[f][2];\r\n lowestI = f;\r\n }\r\n }\r\n }\r\n\r\n if (lowestI == -1) {\r\n break;\r\n }\r\n\r\n var xx = open[lowestI][0] - x;\r\n var yy = open[lowestI][1] - y;\r\n\r\n waypoints.push([xx, yy]);\r\n\r\n x = open[lowestI][0];\r\n y = open[lowestI][1];\r\n\r\n if (open[lowestI][2] == 0) {\r\n foundPath = true;\r\n break;\r\n }\r\n }\r\n\r\n if (foundPath) {\r\n return waypoints;\r\n } else {\r\n return null;\r\n }\r\n}", "function hexagon(center, rx, ry) {\n var vertices = [];\n for (var i = 0; i < 6; i++) {\n var x = center[0] + rx * cosines[i];\n var y = center[1] + ry * sines[i];\n vertices.push([x, y]);\n }\n //first and last vertex must be the same\n vertices.push(vertices[0]);\n return polygon([vertices]);\n }", "function get_coords(x,y)\n{\n return {\n \"x\": 30 + 40*x +(y % 2 == 1 ? 20:0),\n \"y\": 35 + 35*y\n };\n}", "_drawHexDepth(context, col, row) {\n let half = this.size.tile / 2;\n let offset = row % 2 ? this.size.tile / 2 : 0;\n context.beginPath();\n context.moveTo(col*this.size.tile+offset, row*this.size.tile+2);\n context.lineTo(col*this.size.tile+offset+half, row*this.size.tile-2);\n context.lineTo((col+1)*this.size.tile+offset, row*this.size.tile+2);\n context.lineTo((col+1)*this.size.tile - (offset ? 0 : half), (row+1)*this.size.tile-2);\n context.lineTo(col*this.size.tile+offset+half, (row+1)*this.size.tile+2);\n context.lineTo(col*this.size.tile+offset, (row+1)*this.size.tile-2);\n context.lineTo(col*this.size.tile+offset, row*this.size.tile+2);\n context.fill();\n }", "function posToIndex(x, y) {\r\n\treturn x + (y * 32);\r\n}", "function getColorForCoord(x, y, data) {\n var red = y * (data.width * 4) + x * 4;\n return [data[red], data[red + 1], data[red + 2], data[red + 3]];\n}", "function hexagon(center, rx, ry) {\n\t var vertices = [];\n\t for (var i = 0; i < 6; i++) {\n\t var x = center[0] + rx * cosines[i];\n\t var y = center[1] + ry * sines[i];\n\t vertices.push([x, y]);\n\t }\n\t //first and last vertex must be the same\n\t vertices.push(vertices[0]);\n\t return polygon([vertices]);\n\t}", "function convertCoords(x,y) {\n var sidelen = 400 / board.size();\n\n x = x - 154 - sidelen / 2;\n y = y - 10 - sidelen / 2;\n return [x,y];\n}", "function drawHex(context, color, x, y, hex, line, fill) {\n context.strokeStyle = color;\n context.lineWidth = line || 1;\n \n var curx = x-hex.b;\n var cury = y-hex.a;\n\n context.beginPath();\n context.moveTo(curx, cury);\n context.lineTo(curx+=hex.b, cury-=hex.a);\n context.lineTo(curx+=hex.b, cury+=hex.a);\n context.lineTo(curx, cury+=hex.sidelen);\n context.lineTo(curx-=hex.b, cury+=hex.a);\n context.lineTo(curx-=hex.b, cury-hex.a);\n context.lineTo(curx, cury-=hex.sidelen);\n context.closePath();\n context.stroke();\n \n if (fill) {\n context.fillStyle = color;\n context.fill();\n }\n}", "function hexagon(center, rx, ry) {\n var vertices = [];\n for (var i = 0; i < 6; i++) {\n var x = center[0] + rx * cosines[i];\n var y = center[1] + ry * sines[i];\n vertices.push([x, y]);\n }\n //first and last vertex must be the same\n vertices.push(vertices[0].slice());\n return polygon([vertices]);\n}", "function gd(nodeOne, nodeTwo) {\n let ccrd = nodeOne.id.split(\"-\");\n let tcrd = nodeTwo.id.split(\"-\");\n let x1 = parseInt(ccrd[0]);\n let y1 = parseInt(ccrd[1]);\n let x2 = parseInt(tcrd[0]);\n let y2 = parseInt(tcrd[1]);\n if (x2 < x1) {\n if (nodeOne.direction === \"up\") {\n return [1, [\"f\"], \"up\"];\n } else if (nodeOne.direction === \"right\") {\n return [2, [\"l\", \"f\"], \"up\"];\n } else if (nodeOne.direction === \"left\") {\n return [2, [\"r\", \"f\"], \"up\"];\n } else if (nodeOne.direction === \"down\") {\n return [3, [\"r\", \"r\", \"f\"], \"up\"];\n }\n } else if (x2 > x1) {\n if (nodeOne.direction === \"up\") {\n return [3, [\"r\", \"r\", \"f\"], \"down\"];\n } else if (nodeOne.direction === \"right\") {\n return [2, [\"r\", \"f\"], \"down\"];\n } else if (nodeOne.direction === \"left\") {\n return [2, [\"l\", \"f\"], \"down\"];\n } else if (nodeOne.direction === \"down\") {\n return [1, [\"f\"], \"down\"];\n }\n }\n if (y2 < y1) {\n if (nodeOne.direction === \"up\") {\n return [2, [\"l\", \"f\"], \"left\"];\n } else if (nodeOne.direction === \"right\") {\n return [3, [\"l\", \"l\", \"f\"], \"left\"];\n } else if (nodeOne.direction === \"left\") {\n return [1, [\"f\"], \"left\"];\n } else if (nodeOne.direction === \"down\") {\n return [2, [\"r\", \"f\"], \"left\"];\n }\n } else if (y2 > y1) {\n if (nodeOne.direction === \"up\") {\n return [2, [\"r\", \"f\"], \"right\"];\n } else if (nodeOne.direction === \"right\") {\n return [1, [\"f\"], \"right\"];\n } else if (nodeOne.direction === \"left\") {\n return [3, [\"r\", \"r\", \"f\"], \"right\"];\n } else if (nodeOne.direction === \"down\") {\n return [2, [\"l\", \"f\"], \"right\"];\n }\n }\n}", "function gd(nodeOne, nodeTwo) {\n let ccrd = nodeOne.id.split(\"-\");\n let tcrd = nodeTwo.id.split(\"-\");\n let x1 = parseInt(ccrd[0]);\n let y1 = parseInt(ccrd[1]);\n let x2 = parseInt(tcrd[0]);\n let y2 = parseInt(tcrd[1]);\n if (x2 < x1) {\n if (nodeOne.direction === \"up\") {\n return [1, [\"f\"], \"up\"];\n } else if (nodeOne.direction === \"right\") {\n return [2, [\"l\", \"f\"], \"up\"];\n } else if (nodeOne.direction === \"left\") {\n return [2, [\"r\", \"f\"], \"up\"];\n } else if (nodeOne.direction === \"down\") {\n return [3, [\"r\", \"r\", \"f\"], \"up\"];\n }\n } else if (x2 > x1) {\n if (nodeOne.direction === \"up\") {\n return [3, [\"r\", \"r\", \"f\"], \"down\"];\n } else if (nodeOne.direction === \"right\") {\n return [2, [\"r\", \"f\"], \"down\"];\n } else if (nodeOne.direction === \"left\") {\n return [2, [\"l\", \"f\"], \"down\"];\n } else if (nodeOne.direction === \"down\") {\n return [1, [\"f\"], \"down\"];\n }\n }\n if (y2 < y1) {\n if (nodeOne.direction === \"up\") {\n return [2, [\"l\", \"f\"], \"left\"];\n } else if (nodeOne.direction === \"right\") {\n return [3, [\"l\", \"l\", \"f\"], \"left\"];\n } else if (nodeOne.direction === \"left\") {\n return [1, [\"f\"], \"left\"];\n } else if (nodeOne.direction === \"down\") {\n return [2, [\"r\", \"f\"], \"left\"];\n }\n } else if (y2 > y1) {\n if (nodeOne.direction === \"up\") {\n return [2, [\"r\", \"f\"], \"right\"];\n } else if (nodeOne.direction === \"right\") {\n return [1, [\"f\"], \"right\"];\n } else if (nodeOne.direction === \"left\") {\n return [3, [\"r\", \"r\", \"f\"], \"right\"];\n } else if (nodeOne.direction === \"down\") {\n return [2, [\"l\", \"f\"], \"right\"];\n }\n }\n}", "getKingZone([x, y], color) {\n if (color == 'w') {\n if (y >= 4) return -1; //\"out of zone\"\n if (y == 3 && [5, 6].includes(x)) return 0;\n if (x == 6) return 1;\n if (x == 5) return 2;\n if (x == 4) return 3;\n if (x == 3 || y == 0) return 4;\n if (y == 1) return 5;\n if (x == 0 || y == 2) return 6;\n return 7; //x == 1 && y == 3\n }\n // color == 'b':\n if (y <= 2) return -1; //\"out of zone\"\n if (y == 3 && [0, 1].includes(x)) return 0;\n if (x == 0) return 1;\n if (x == 1) return 2;\n if (x == 2) return 3;\n if (x == 3 || y == 6) return 4;\n if (y == 5) return 5;\n if (x == 6 || y == 4) return 6;\n return 7; //x == 5 && y == 3\n }", "function drawHex() {\n switch (eid(\"geometry\").value) {\n case \"Hex\":\n hex = new Hex(opt.h, opt.k, opt.H, opt.K);\n break;\n case \"TriHex\":\n hex = new TriHex(opt.h, opt.k, opt.H, opt.K);\n break;\n case \"SnubHex\":\n hex = new SnubHex(opt.h, opt.k, opt.H, opt.K);\n break;\n case \"RhombiTriHex\":\n hex = new RhombiTriHex(opt.h, opt.k, opt.H, opt.K);\n break;\n case \"DualHex\":\n hex = new DualHex(opt.h, opt.k, opt.H, opt.K);\n break;\n case \"DualTriHex\":\n hex = new DualTriHex(opt.h, opt.k, opt.H, opt.K);\n break;\n case \"DualSnubHex\":\n hex = new DualSnubHex(opt.h, opt.k, opt.H, opt.K);\n break;\n case \"DualRhombiTriHex\":\n hex = new DualRhombiTriHex(opt.h, opt.k, opt.H, opt.K);\n }\n}", "function toHex(d) {\n let r = djb2('red' + d)\n let g = djb2('green' + d)\n let b = djb2('blue' + d)\n\n let red = Math.abs((r + 85) % 240) + 30\n let green = Math.abs((g + 170) % 240) + 30\n let blue = Math.abs(b % 240) + 30\n\n red = red < 255 ? red : 255\n green = green < 255 ? green : 255\n blue = blue < 255 ? blue : 255\n\n return (\n ('0' + Number(red).toString(16)).slice(-2) +\n ('0' + Number(green).toString(16)).slice(-2) +\n ('0' + Number(blue).toString(16)).slice(-2)\n )\n}", "function analyzePoint(x, y) {\n\tconst options = [];\n\t// check \"left\"\n\tif (getPixelColor(x-1,y)==\"006600\") {\n\t\toptions.push([x-1,y]);\n\t}\n\t// check \"right\"\n\tif (getPixelColor(x+1,y)==\"006600\") {\n\t\toptions.push([x+1,y]);\n\t}\n\t// check \"up\"\n\tif (getPixelColor(x,y-1)==\"006600\") {\n\t\toptions.push([x,y-1]);\n\t}\n\t// check \"down\"\n\tif (getPixelColor(x,y+1)==\"006600\") {\n\t\toptions.push([x,y+1]);\n\t}\n\t//\n\treturn options;\n}", "mapCoordsToNode(x, y) {\n\n\t}", "function edge(a, b) {\n\t if (a.row > b.row) { var t = a; a = b; b = t; }\n\t return {\n\t x0: a.column,\n\t y0: a.row,\n\t x1: b.column,\n\t y1: b.row,\n\t dx: b.column - a.column,\n\t dy: b.row - a.row\n\t };\n\t}", "function edge(a, b) {\n\t if (a.row > b.row) { var t = a; a = b; b = t; }\n\t return {\n\t x0: a.column,\n\t y0: a.row,\n\t x1: b.column,\n\t y1: b.row,\n\t dx: b.column - a.column,\n\t dy: b.row - a.row\n\t };\n\t}", "_coord(arr) {\n var a = arr[0], d = arr[1], b = arr[2];\n var sum, pos = [0, 0];\n sum = a + d + b;\n if (sum !== 0) {\n a /= sum;\n d /= sum;\n b /= sum;\n pos[0] = corners[0][0] * a + corners[1][0] * d + corners[2][0] * b;\n pos[1] = corners[0][1] * a + corners[1][1] * d + corners[2][1] * b;\n }\n return pos;\n }", "constructor(x, y, direction, r, g, b) {\n this.x = x;\n this.y = y;\n this.r = r;\n this.g = g;\n this.b = b;\n this.direction = direction;\n }", "function yd(a){var b;q&&(b=a.bh());var c=u(\"xml\");a=xc(a,!0);for(var d=0,e;e=a[d];d++){var h=zd(e);e=e.fb();h.setAttribute(\"x\",q?b-e.x:e.x);h.setAttribute(\"y\",e.y);c.appendChild(h)}return c}" ]
[ "0.649759", "0.6325801", "0.62253255", "0.6198931", "0.61895376", "0.6178534", "0.61471224", "0.61114234", "0.60959464", "0.60959464", "0.5987963", "0.59076685", "0.5860176", "0.58549345", "0.5834054", "0.5831968", "0.5829414", "0.5815573", "0.5809667", "0.5804342", "0.5804342", "0.5803173", "0.57915205", "0.5789096", "0.57820433", "0.57792634", "0.57792634", "0.57792634", "0.5772729", "0.57585746", "0.57585746", "0.57585746", "0.57585746", "0.57585746", "0.57585746", "0.57585746", "0.57585746", "0.57585746", "0.57585746", "0.57585746", "0.57470804", "0.57470804", "0.57305145", "0.57014054", "0.56989974", "0.5696954", "0.5688666", "0.5682267", "0.56793034", "0.56693226", "0.56601506", "0.56564206", "0.56471425", "0.56471425", "0.56471425", "0.56471425", "0.5634123", "0.5620137", "0.56173146", "0.5612334", "0.56065184", "0.56065184", "0.56065184", "0.56052583", "0.56052583", "0.56052583", "0.56052583", "0.56052583", "0.56052583", "0.56052583", "0.560075", "0.5594969", "0.5588306", "0.5586847", "0.55841964", "0.5567915", "0.5567915", "0.5567715", "0.55586374", "0.55419165", "0.5538331", "0.5536311", "0.55297434", "0.5523174", "0.5514518", "0.5510871", "0.54953206", "0.5495248", "0.54862815", "0.5476277", "0.5476277", "0.54733807", "0.54434127", "0.5441781", "0.54269755", "0.54194933", "0.54163766", "0.54163766", "0.54160047", "0.5414346", "0.5396505" ]
0.0
-1
gives the pixel coordinates of the upper left hand corner of the square containing the hexagon to be drawn. Note that this pixel location is not actually inside the hexagon.
function getPixelCoords(x,y) { var xcoord = 0; var ycoord = 0; ycoord = 0.5 * (3 - x) * SCALE_HEIGHT + y * SCALE_HEIGHT; xcoord = (SCALE_WIDTH - SCALE_OFFSET) * x; ycoord += .5 * SCALE_HEIGHT; xcoord += SCALE_WIDTH - SCALE_OFFSET; return [xcoord, ycoord]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getHexCornerCoord( center, i ) {\n // KEY pointy or flat\n\n // flat\n // let angleDeg = 60 * i\n\n // pointy\n let angleDeg = 60 * i + 30\n\n let angleRad = Math.PI / 180 * angleDeg\n let x = center.x + this.state.hexSize * Math.cos( angleRad )\n let y = center.y + this.state.hexSize * Math.sin( angleRad )\n\n return this.Point( x, y )\n }", "function hexagon_points(x, y, r) {\n var sq = Math.sqrt(3) * 0.5;\n var rh = 0.5 * r;\n\n return [x, y-r, x+r*sq, y-rh, x+r*sq, y+rh, x, y+r, x-r*sq, y+rh, x-r*sq, y-rh];\n}", "function hex_corner(centerX, centerY, i){\n\t var angle_deg = 60 * i + 30;\n\t var angle_rad = Math.PI / 180 * angle_deg;\n\t var x = centerX + size * Math.cos(angle_rad);\n\t var y = centerY + size * Math.sin(angle_rad);\n\t var point = {xPos: toInt(x), yPos: toInt(y)};\n\t return point;\n\t}", "function flat_hex_cornerX(cx, size, i){\n let angle_deg = 60 * i;\n // convert to radians\n let angle_rad = Math.PI / 180 * angle_deg;\n return (cx + size * Math.cos(angle_rad))\n\n }", "tile_normalized_coord() {\n\t\tvar rect = this.canvas.getBoundingClientRect();\n\t\tvar x = this.cursor_x - rect.left + this.current_x;\n\t\tvar y = this.cursor_y - rect.top + this.current_y;\n\t\tvar row = y / this.tile_size;\n\t\tvar col = x / this.tile_size;\n\t\treturn [col, row]\n\t}", "getPixelPosition(tileMap, x, y){\r\n\t\t\r\n\t\tlet [xPos, yPos] = tileMap.getTileCoords(x, y);\r\n\t\tlet charaOffSetX = -8; //An image's origin is the point on the image where it will be placed on the canvas (i.e the the top left corner).\r\n\t\tlet charaOffSetY = 17; //we must adjust this point for the character to be placed on a canvas in a way that it will align with the center of the floor.\r\n\r\n\t\treturn [ xPos + charaOffSetX, yPos + charaOffSetY ]\r\n\t}", "function hex(x,y)\r\n{\r\n\tvar ret = new Array;\r\n\tret[0] = x;\r\n\tret[1] = y;\r\n\tif (x >= 0 && x < gridSize && y >= 0 && y < gridSize)\r\n\t{ret[2] = cgrid[x][y];}else{ret[2] = new Array;ret[2][0] = 0;ret[2][1] = 0;}\r\n\tif (x >= 0 && x < gridSize && y >= 0 && y < gridSize)\r\n\t{ret[3] = grid[x][y];}else{ret[3] = 0;}\r\n\treturn ret;\r\n}", "getBlockIndex(screenX, screenY) {\n let col = Math.floor(screenX * this.col / window.innerWidth);\n let row = Math.floor(screenY * this.row / window.innerHeight);\n return [row, col];\n }", "function convertCoords(x,y) {\n var sidelen = 400 / board.size();\n\n x = x - 154 - sidelen / 2;\n y = y - 10 - sidelen / 2;\n return [x,y];\n}", "getLocation(x, y) {\n return [Math.floor(x / CELL.WIDTH), Math.floor(y / CELL.HEIGHT)];\n }", "function getCoords(e) {\t\t\n\t\treturn { x: e.pageX - theCanvas.offsetLeft, y: e.pageY - theCanvas.offsetTop };\n\t }", "function mouseCoordToHex(x, y) {\n var ratio_x, ratio_y;\n x = x - allCanvas.pointer.offset().left;\n y = y - allCanvas.pointer.offset().top;\n\n if (framesize.decoded.height === 0) {\n ratio_x = x / getWidth();\n ratio_y = y / getHeight();\n } else {\n var calculated_height = framesize.decoded.height * framesize.displayed.width * framesize.displayed.scale / framesize.decoded.width;\n var calculated_width = framesize.displayed.width * framesize.displayed.scale; //framesize.decoded.width * framesize.displayed.height / framesize.decoded.height ;\n var offsetHeight = (calculated_height - framesize.displayed.height) / 2;\n var offsetWidth = (calculated_width - (framesize.displayed.width * framesize.displayed.scale)) / 2;\n ratio_x = ((x + offsetWidth)) / calculated_width;\n ratio_y = ((y + offsetHeight)) / calculated_height;\n }\n\n\n\n\n var hexX = that._percentToHex(ratio_x * 100);\n var hexY = that._percentToHex(ratio_y * 100);\n return hexX === 'FFFF' || hexY === 'FFFF' ? 'FFFFFFFF' : hexX + hexY;\n }", "function getPixelPos(squares) { \n var squareWidth = (canvas.width - ((NUM_ROWS+1)*GAP))/NUM_ROWS;\n return squares*squareWidth+(GAP*squares)+GAP;\n}", "getScreenCoordinatesTLCorner(){\n var cornersInScreenCoordinates = []\n var cornersInPSCoordinates = this.getCorners();\n for (var i = 0; i < 4; i++){\n cornersInScreenCoordinates[i] = this.parent.getScreenCoordinatesFromPSCoordinates(cornersInPSCoordinates[i]);\n }\n\n var cornersSortedByLeftness = DrawingArea.sortCornersByLeftness(cornersInScreenCoordinates)\n\n var leftCorners = cornersSortedByLeftness.slice(0,2)\n var cornersSortedByTopness = DrawingArea.sortCornersByTopness(leftCorners)\n var upperLeftCorner = cornersSortedByTopness[0];\n return upperLeftCorner\n }", "_coord(arr) {\n var a = arr[0], d = arr[1], b = arr[2];\n var sum, pos = [0, 0];\n sum = a + d + b;\n if (sum !== 0) {\n a /= sum;\n d /= sum;\n b /= sum;\n pos[0] = corners[0][0] * a + corners[1][0] * d + corners[2][0] * b;\n pos[1] = corners[0][1] * a + corners[1][1] * d + corners[2][1] * b;\n }\n return pos;\n }", "function getMouseCoords(e) {\n var cPos = optimalApp.board.getCoordsTopLeftCorner(e),\n absPos = JXG.getPosition(e),\n dx = absPos[0]-cPos[0],\n dy = absPos[1]-cPos[1];\n \n return new JXG.Coords(JXG.COORDS_BY_SCREEN, [dx, dy], optimalApp.board);\n}", "function getNeighborCoordsLeftCol(i) {\n return [\n [i - 1, 0], // The cells above and above-right.\n [i - 1, 1],\n [i, 1], // The cell to the right.\n [i + 1, 0], // The cells below and below-right.\n [i + 1, 1]\n ];\n}", "function pixelToHex (x, y) {\r\n // offset\r\n x -= hexagon.offset.x\r\n y -= hexagon.offset.y\r\n\r\n // converts pixel coordinates to 2d axial hexagonal space\r\n var res = {}\r\n res.x = (x * Math.sqrt(3) / 3 - y / 3) / hexagon.radius\r\n res.y = y * 2 / 3 / hexagon.radius\r\n\r\n res = hexRound(res)\r\n\r\n return res\r\n}", "calcCoordsForCenter(tileRow, tileCol, width, height, tileSize) {\n const tileXCenter = tileSize * (tileCol + 0.5);\n const tileYCenter = tileSize * (tileRow + 0.5);\n const dstX = tileXCenter - width * 0.5;\n const dstY = tileYCenter - height * 0.5;\n return [dstX, dstY];\n }", "hexToPixel( h ) {\n // KEY pointy or flat\n\n let hexOrigin = this.state.hexOrigin\n\n // flat\n // let y = this.state.hexSize * Math.sqrt(3) * ( h.q + h.r / 2 ) + hexOrigin.y\n // let x = this.state.hexSize * 3/2 * h.r + hexOrigin.x\n \n // pointy\n let x = this.state.hexSize * Math.sqrt(3) * ( h.q + h.r / 2 ) + hexOrigin.x\n let y = this.state.hexSize * 3/2 * h.r + hexOrigin.y\n\n return this.Point( x, y )\n }", "function _getCoordinates(x, y) {\n var res = _getFirstPlotLayerInfo();\n var topLeft = res[0], scale = res[1], width = res[2], height = res[3];\n \n var percentageCoordinates = position.topLeftToPercentage({x: x, y: y}, topLeft, scale, width, height);\n var pixelCoordinates = {x: percentageCoordinates.x * width, y: percentageCoordinates.y * height};\n \n return [pixelCoordinates, width, height];\n }", "function calcCoords()\n\t{\n\t\tvar w = that.w + (2*that.borderWidth);\n\t\tvar h = that.h + (2*that.borderWidth)\n\t\tvar scaledW = w * that.scale;\n\t\tvar scaledH = h * that.scale;\n\n\t\timgOfsX = (w - scaledW) / 2 - that.borderWidth;\n\t\timgOfsY = (h - scaledH) / 2 - that.borderWidth;\n\n\t\tcloseOfsX = scaledW / 2 - that.borderWidth;\n\t\tcloseOfsY = -scaledH / 2 + that.borderWidth;\n\t}", "get tileOrigin() {\n return { x: Math.round(this.x / 8), y: Math.round(this.y / 8) }\n }", "function getCoords(square) {\n\tif(String(square).slice(0, 2) == \"sq\") {\n\t\tsquare = square.substr(2);\n\t}\n\treturn [square % squareX, Math.floor(square / squareX)];\n}", "function hexRound (hexPos) {\r\n // rounds and converts to three-dimensional hexagonal coordinates\r\n var res = {}\r\n hexPos.z = -hexPos.x - hexPos.y\r\n res.x = Math.round(hexPos.x)\r\n res.y = Math.round(hexPos.y)\r\n res.z = Math.round(hexPos.z)\r\n\r\n // makes coordinate which is furthest away from any hexagon Center Coordinate\r\n // dependant upon the others\r\n var xDiff = Math.abs(res.x - hexPos.x)\r\n var yDiff = Math.abs(res.y - hexPos.y)\r\n var zDiff = Math.abs(res.z - hexPos.z)\r\n\r\n if (xDiff > yDiff && xDiff > zDiff) {\r\n res.x = -res.y - res.z\r\n } else if (yDiff > zDiff) {\r\n res.y = -res.x - res.z\r\n } else {\r\n res.z = -res.x - res.y\r\n }\r\n\r\n return res\r\n}", "function mouseSquare()\n{\n var mouse={x:-1, y:-1} ;\n if ((mouseX/pixelSize) >= 100 && (mouseX/pixelSize) < 900 && \n (mouseY/pixelSize) >= 100 && (mouseY/pixelSize) < 900) {\n mouse.x=Math.floor((mouseX/pixelSize)/100)-1;\n mouse.y=Math.floor((mouseY/pixelSize)/100)-1;\n if (reverse) {\n mouse.x=7-mouse.x;\n mouse.y=7-mouse.y;\n }\n }\n return mouse;\n}", "function getCornerPoints($element) {\n var offset = $element[0].getBoundingClientRect();\n var top = offset.top;\n var left = offset.left;\n var width = $element[0].offsetWidth;\n var height = $element[0].offsetHeight;\n return [\n [left, top], // top left [x, y]\n [left + width, top], // top right [x, y]\n [left, top + height], // bottom left [x, y]\n [left + width, top + height] // bottom right [x, y]\n ];\n}", "function calcXAndY(row, column){\n if(row < 0 || row > 4 || column < 0 || column > 4){\n return undefined\n }\n return {\n x: row * QUADRANT_DIMENSION + ANCHOR_OFFSET,\n y: column * QUADRANT_DIMENSION + ANCHOR_OFFSET,\n };\n}", "function getCenterXY() {\r\n\t\tvar sets = $['mapsettings'];\r\n\t\tvar $this = sets.element;\r\n\t\tvar centerx = ($this.innerWidth()/2)-parseInt($('#inner').css('left'));\r\n\t\tvar centery = ($this.innerHeight()/2)-parseInt($('#inner').css('top'));\r\n\t\treturn new Point(centerx,centery);\r\n\t}", "function getCandyRowColFromCoordinates(x, y){\n\tvar rect = dom.gameBoard.getBoundingClientRect();\n\tvar splits = size + 1;\n\tvar range = rect.width;\n\tvar eachCell = range/splits;\n\tx = x - rect.left;\n\ty = y - rect.top;\n\tvar column = Math.floor(x / eachCell) - 1;\n\tvar row = Math.floor(y / eachCell) - 1;\n\treturn [row, column];\n}", "function coordinatesToIndex(x, y) {\n // Takes the canvas offset X and Y and convers them into \n // row and column numbers of the canvas\n let column = Math.floor(x / BOX_SIDE_LENGTH);\n let row = Math.floor(y / BOX_SIDE_LENGTH);\n return row * NUM_ROWS + column;\n}", "function getCoordinates(el) {\n\txCor = (el.getBoundingClientRect()).x;\n\tyCor = (el.getBoundingClientRect()).y;\n\tCoor = [(xCor + window.scrollX), (yCor + window.scrollY)];\n\tconsole.log(Coor);\n\tconsole.log(el.getBoundingClientRect());\n\treturn Coor;\n}", "function getCoords(e) {\n if (e.offsetX) {\n // Works in Chrome / Safari (except on iPad/iPhone)\n return { x: e.offsetX, y: e.offsetY };\n }\n else if (e.layerX) {\n // Works in Firefox\n return { x: e.layerX, y: e.layerY };\n }\n else {\n // Works in Safari on iPad/iPhone\n return { x: e.pageX - findPos(_c.canvasElement).left, y: e.pageY - findPos(_c.canvasElement).top };\n }\n }", "function getCoords(e) {\n\t\tif (e.offsetX) {\n\t\t\t// Works in Chrome / Safari (except on iPad/iPhone)\n\t\t\treturn { x: e.offsetX, y: e.offsetY };\n\t\t}\n\t\telse if (e.layerX) {\n\t\t\t// Works in Firefox\n\t\t\treturn { x: e.layerX, y: e.layerY };\n\t\t}\n\t\telse {\n\t\t\t// Works in Safari on iPad/iPhone\n\t\t\treturn { x: e.pageX - canvas.offsetLeft, y: e.pageY - canvas.offsetTop };\n\t\t}\n\t}", "function getCoords(event){\n // size is where the canvas is in the page\n var size = canvas.getBoundingClientRect();\n /* clientX/Y are the pixel positions of mouse in page\n For horizontal/x, minus the left offset to get back to 0\n e.g. mouse pos in page is 10,0 while in top left corner of canvas\n We want it at 0,0 (pos in canvas, not page),\n so we minus the gap between page left and canvas start\n which here would be 10 */\n x = (event.clientX - size.left);\n y = (event.clientY - size.top);\n}", "function get_xy(el) {\n\tvar box = el.getBoundingClientRect();\n\treturn {\n\t\tx: box.left,\n\t\ty: box.top\n\t};\n}", "function xGridRefToGameBoardCoordinate (xGridRef) {\n xCoordinate = 150 + (xGridRef * 25);\n return xCoordinate;\n}", "function detectNextBlock_CornerDownLeft (x,y,h,w)\n {\n var mapCoordY = (y + h)/ h;\n var mapCoordX = (x -1) / w;\n \n mapCoordX = Math.floor(mapCoordX);\n mapCoordY = Math.floor(mapCoordY);\n \n return map[mapCoordY-1][mapCoordX-1];\n }", "function getCoordsUX(e) {\n const { x, y } = e.target.getBoundingClientRect();\n const mouseX = e.clientX - x;\n const mouseY = e.clientY - y;\n\n return [Math.floor(mouseX / tileSize), Math.floor(mouseY / tileSize)];\n}", "hovered_tile() {\n\t\tvar rect = this.canvas.getBoundingClientRect();\n \tvar x = this.cursor_x - rect.left + this.current_x;\n \tvar y = this.cursor_y - rect.top + this.current_y;\n\t\tvar row = Math.floor(y / this.tile_size);\n\t\tvar col = Math.floor(x / this.tile_size);\n\t\treturn row * this.board.width + col\n\t}", "drawHexes() {\n const { width, height } = this.state.canvasSize\n const { hexWidth, hexHeight, vertDist, horizDist } = this.state.hexParams\n const hexOrigin = this.state.hexOrigin\n\n let qLeftSide = Math.round( hexOrigin.x / horizDist )\n let qRightSide = Math.round( ( width - hexOrigin.x ) / horizDist )\n let rTopSide = Math.round( hexOrigin.y / ( vertDist ) )\n let rBottomSide = Math.round( ( height - hexOrigin.y ) / vertDist )\n\n // This is the bottom half\n var p = 0\n for( let r = 0; r <= rBottomSide; r++ ) {\n if( r % 2 === 0 && r !== 0 )\n p++\n for( let q = -qLeftSide; q <= qRightSide; q++ ) {\n const { x, y } = this.hexToPixel( this.Hex( q - p, r ) )\n\n if( ( x > hexWidth / 2 && x < width - hexWidth / 2) && ( y > hexHeight / 2 && y < height - hexHeight / 2 ) ) {\n this.drawHex( this.canvasHex, this.Point( x, y ) )\n this.drawHexCoordinates( this.canvasHex, this.Point( x, y ), this.Hex( q - p, r, -q -r ) )\n }\n }\n }\n\n // This is the top half\n var n = 0\n for( let r = -1; r >= -rTopSide; r-- ) {\n if( r % 2 !== 0 )\n n++\n for( let q = -qLeftSide; q <= qRightSide; q++ ) {\n const { x, y } = this.hexToPixel( this.Hex( q + n, r ) )\n\n if( ( x > hexWidth / 2 && x < width - hexWidth / 2) && ( y > hexHeight / 2 && y < height - hexHeight / 2 ) ) {\n this.drawHex( this.canvasHex, this.Point( x, y ) )\n this.drawHexCoordinates( this.canvasHex, this.Point( x, y ), this.Hex( q + n, r, -q -r ) )\n }\n }\n }\n }", "function element_xy(e) {\n\tvar x = 0;\n\tvar y = 0;\n\tif(e.offsetParent) {\n\t\tdo {\n\t\t\tx += e.offsetLeft;\n\t\t\ty += e.offsetTop;\n\t\t} while(e = e.offsetParent);\n\t}\n\treturn [x, y];\n}", "function getX (hex, layout, hexWidth, hexRadius) {\n\t\tvar x = 0,\n\t\t\txOffset = 0;\n\n\t\tswitch (layout) {\n\t\t\tcase \"odd-r\":\n\t\t\t\txOffset = (hex.rc % 2 === 1) ? hexWidth : (hexWidth / 2);\n\t\t\t\tx = (hex.qc * hexWidth) + xOffset;\n\t\t\t\tbreak;\n\n\t\t\tcase \"even-r\":\n\t\t\t\txOffset = (hex.rc % 2 === 0) ? hexWidth : (hexWidth / 2);\n\t\t\t\tx = (hex.qc * hexWidth) + xOffset;\n\t\t\t\tbreak;\n\n\t\t\tcase \"odd-q\":\n\t\t\tcase \"even-q\":\n\t\t\t\tx = (hex.qc * hexRadius * 1.5) + hexRadius;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn x;\n\t}", "function getCoords(el) {\n\t \tvar box = el.getBoundingClientRect(),\n\t \tdoc = el.ownerDocument,\n\t \tbody = doc.body,\n\t \thtml = doc.documentElement,\n\t \tclientTop = html.clientTop || body.clientTop || 0,\n\t \tclientLeft = html.clientLeft || body.clientLeft || 0,\n\t \ttop = box.top + (self.pageYOffset || html.scrollTop || body.scrollTop) - clientTop,\n\t \tleft = box.left + (self.pageXOffset || html.scrollLeft || body.scrollLeft) - clientLeft\n\t \t\treturn {\n\t \t\t'top' : top,\n\t \t\t'left' : left\n\t \t};\n\t }", "mapXPos(num) {\n return this.startingWidth + (num * this.squareSize);\n }", "function hexagon(x,y, r) {\r\n push();\r\n translate(x,y);\r\n beginShape();\r\n vertex(r,0);\r\n vertex(r*0.5,r*0.8660254);\r\n vertex(-r*0.5,r*0.8660254);\r\n vertex(-r,0);\r\n vertex(-r*0.5,-r*0.8660254);\r\n vertex(r*0.5,-r*0.8660254);\r\n endShape(CLOSE);\r\n pop();\r\n}", "function hexagon(length, x_start, y_start) {\n\t\"use strict\";\n\tvar hex = [\n\t\t[length + x_start, y_start],\n\t\t[((length / 2) + x_start), (length * Math.sqrt(length / 2)) + y_start],\n\t\t[((-length / 2) + x_start), (length * Math.sqrt(length / 2)) + y_start],\n\t\t[(-length + x_start), y_start],\n\t\t[((-length / 2) + x_start), (-length * Math.sqrt(length / 2)) + y_start],\n\t\t[(length / 2) + x_start, (-length * Math.sqrt(length / 2)) + y_start],\n\t\t[length + x_start, y_start]];\n\treturn hex;\n\n}", "function mapFromXY(x,y) {\n \tlet invY = 5 - y;\n\t let mappedPixel = invY + (x*6);\n\n\t return mappedPixel;\t \n }", "function mouseCoordinates(e){\n\n var horizontalPosition = windowWidth - e.clientX - 26;\n var verticalPosition = windowHeight - e.clientY - 26;\n\n CIRCLE.style.left = horizontalPosition + 'px';\n CIRCLE.style.top = verticalPosition + 'px';\n\n}", "function getCoords(e) {\n const { x, y } = e.target.getBoundingClientRect();\n\n let mouseX = e.clientX - x;\n let mouseY = e.clientY - y;\n\n var oX = Math.floor((originx / tileSize) )\n var oY = Math.floor((originy / tileSize) )\n\n finalX = Math.floor((mouseX / tileSize) / scale)\n finalY = Math.floor((mouseY / tileSize) / scale)\n\n return [\n finalX + oX,\n finalY + oY\n ];\n}", "function coord_CurrentLeftDown (x,y,h,w)\n {\n var mapCoord = {};\n \n mapCoord[1] = (y + h -1)/ h;\n mapCoord[0] = (x) / w;\n \n mapCoord[0] = Math.floor(mapCoord[0]-1);\n mapCoord[1] = Math.floor(mapCoord[1]-1);\n \n return mapCoord;\n }", "function retrieveXandYposition(i) {\n const x = i % 8;\n const y = Math.abs(Math.floor(i / 8) - 7);\n return { x, y };\n }", "function get_xy(element) {\n// We use the CSS because its the property we can change\n\tx = element.style.left;\n\ty = element.style.top;\n\t\n\tp = new Array(2);\n\tp[0]= x;\n\tp[1]= y;\n\t\n\treturn p;\n}", "function coords(box, { w, h }) {\n const [b1, b2, b3, b4] = box\n const round6 = (n) => (Math.round(n * 1000000) / 1000000).toFixed(6)\n const x = round6((b1 + b3) / 2 / w)\n const y = round6((b2 + b4) / 2 / h)\n const width = round6(Math.abs(b1 - b3) / w)\n const height = round6(Math.abs(b2 - b4) / h)\n\n return `${x} ${y} ${width} ${height}`\n}", "function id_to_xy(id) {\n return { x: Math.floor((id - 1) / COL), y: (id - 1) % COL };\n}", "function hexagon(center, rx, ry) {\n var vertices = [];\n for (var i = 0; i < 6; i++) {\n var x = center[0] + rx * cosines[i];\n var y = center[1] + ry * sines[i];\n vertices.push([x, y]);\n }\n //first and last vertex must be the same\n vertices.push(vertices[0]);\n return polygon([vertices]);\n }", "findCenter() {\n return {\n x: (this.right - this.left)/2 + this.left,\n y: (this.bottom - this.top)/2 + this.top\n };\n }", "function getCoords () {\n return {\n x: 10,\n y: 22\n }\n }", "function GetCoordinates(e)\n{\n var PosX = 0;\n var PosY = 0;\n var ImgPos;\n var myImg = document.getElementById(\"frame_image\");\n ImgPos = FindPosition(myImg);\n if (!e) var e = window.event;\n if (e.pageX || e.pageY)\n {\n PosX = e.pageX;\n PosY = e.pageY;\n }\n else if (e.clientX || e.clientY)\n {\n PosX = e.clientX + document.body.scrollLeft\n + document.documentElement.scrollLeft;\n PosY = e.clientY + document.body.scrollTop\n + document.documentElement.scrollTop;\n }\n PosX = PosX - ImgPos[0];\n PosY = PosY - ImgPos[1];\n\n document.getElementById(\"x_hori\").innerHTML = \" \" + ((PosX / myImg.width) * 100).toFixed(2);\n document.getElementById(\"y_hori\").innerHTML = \" \" + ((PosY / myImg.height) * 100).toFixed(2);\n \n}", "function convertCoordinates(canvas, x, y){\n var container = canvas.getBoundingClientRect();\n return {x: x - container.left * (canvas.width / container.width),\n y: y - container.top * (canvas.height / container.height)};\n }", "findCell(x, y) {\n // `Number >> 4` effectively does an integer division by 16\n // and `Number << 4` multiplies by 16 this notation is used to avoid floats\n x = (x >> 4) << 4; // x = Math.floor((x / this.root.min) * this.root.min)\n y = (y >> 4) << 4; // y = Math.floor((y / this.root.min) * this.root.min)\n\n return this._findCell(x, y, this.root);\n }", "getCorners(){\n\t\treturn [\n\t\t\t{x:-(this.width/2), y:-(this.height/2)},\n\t\t\t{x:-(this.width/2)+this.width, y:-(this.height/2)},\n\t\t\t{x:-(this.width/2)+this.width, y:-(this.height/2)+this.height},\n\t\t\t{x:-(this.width/2), y:-(this.height/2)+this.height}\n\t\t];\n\t}", "function hexagon(center, rx, ry) {\n\t var vertices = [];\n\t for (var i = 0; i < 6; i++) {\n\t var x = center[0] + rx * cosines[i];\n\t var y = center[1] + ry * sines[i];\n\t vertices.push([x, y]);\n\t }\n\t //first and last vertex must be the same\n\t vertices.push(vertices[0]);\n\t return polygon([vertices]);\n\t}", "function generateTopLeft(x,y){\r\n var x = floor(random(ppg.width/2));\r\n var y = floor(random(ppg.height/2));\r\n var maxX=width/2;\r\n var maxY=height/2;\r\n for (i=0; i<=21;i++){\r\n x+=1;\r\n y+=1;\r\n maxX=maxX-x;\r\n maxY=maxY-y;\r\n let pixelN = ppg.get((width/2)-x , (height/2)-y);\r\n fill(pixelN);\r\n noStroke();\r\n rect(maxX, maxY,12,3);\r\n }\r\n}", "function getPixelCenter(x, y) {\n\tvar pixelX = x*(canvas.width/grid.x)+((canvas.width/grid.x)/2);\n\tvar pixelY = y*(canvas.height/grid.y)+((canvas.height/grid.y)/2);\n\treturn {\"x\": pixelX, \"y\": pixelY};\n}", "function hexagon(center, rx, ry) {\n var vertices = [];\n for (var i = 0; i < 6; i++) {\n var x = center[0] + rx * cosines[i];\n var y = center[1] + ry * sines[i];\n vertices.push([x, y]);\n }\n //first and last vertex must be the same\n vertices.push(vertices[0]);\n return polygon([vertices]);\n}", "function hexagon(center, rx, ry) {\n var vertices = [];\n for (var i = 0; i < 6; i++) {\n var x = center[0] + rx * cosines[i];\n var y = center[1] + ry * sines[i];\n vertices.push([x, y]);\n }\n //first and last vertex must be the same\n vertices.push(vertices[0]);\n return polygon([vertices]);\n}", "function getCoordinates(cell) {\n return {\n x: (cell) % 10,\n y: Math.floor((cell) / 10)\n }\n}", "function xCoord() {\r\n var min = Math.ceil(120);\r\n var max = Math.floor(cWidth - 120);\r\n return Math.floor(Math.random() * (max - min) + min);\r\n }", "function getX(hex, layout, hexWidth, hexRadius) {\n\t\tvar x = 0,\n\t\t xOffset = 0;\n\n\t\tswitch (layout) {\n\t\t\tcase \"odd-r\":\n\t\t\t\txOffset = hex.rc % 2 === 1 ? hexWidth : hexWidth / 2;\n\t\t\t\tx = hex.qc * hexWidth + xOffset;\n\t\t\t\tbreak;\n\n\t\t\tcase \"even-r\":\n\t\t\t\txOffset = hex.rc % 2 === 0 ? hexWidth : hexWidth / 2;\n\t\t\t\tx = hex.qc * hexWidth + xOffset;\n\t\t\t\tbreak;\n\n\t\t\tcase \"odd-q\":\n\t\t\tcase \"even-q\":\n\t\t\t\tx = hex.qc * hexRadius * 1.5 + hexRadius;\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn x;\n\t}", "setupCoordinates(){\n // Starts the circle and square off screen to the bottom left\n // We divide their size by two because we're drawing from the center\n this.xPos = width + squareSize / 2;\n this.yPos = height + squareSize / 2;\n }", "function drawHexes() {\n const { canvasWidth, canvasHeight } = canvasSize\n const { hexWidth, hexHeight, vertDist, horizDist} = getHexParametres()\n let qLeftSide = Math.round(hexOrigin.x/horizDist);\n let qRightSide = Math.round((canvasWidth - hexOrigin.x)/horizDist);\n let rTopSide = Math.round(hexOrigin.y/vertDist);\n let rBottomSide = Math.round((canvasHeight - hexOrigin.y)/vertDist);\n let hexPathMap = []\n let p = 0\n for(let r = 0; r <= rBottomSide; r++) {\n if(r % 2 === 0 && r !== 0) {\n p++\n }\n for(let q = -qLeftSide; q <= qRightSide; q++) {\n const { x, y } = hexToPixel(hex(q-p, r))\n if((x > hexWidth/2 && x < canvasWidth - hexWidth/2) && (y > hexHeight/2 && y < canvasHeight - hexHeight/2)) {\n drawHex(canvasHex, point(x,y), 1, \"black\", \"grey\")\n //drawHexCoordinates(canvasHex, point(x,y), hex(q-p, r, - (q - p) - r))\n let bottomH = JSON.stringify(hex(q - p, r, - (q - p) - r))\n if(!obstacles.includes(bottomH)){\n hexPathMap.push(bottomH)\n }\n }\n }\n }\n let n = 0;\n for(let r = -1; r >= -rTopSide; r--) {\n if(r%2 !== 0) {\n n++\n }\n for(let q = -qLeftSide; q <= qRightSide; q++) {\n const { x, y } = hexToPixel(hex(q+n, r))\n if((x > hexWidth/2 && x < canvasWidth - hexWidth/2) && (y > hexHeight/2 && y < canvasHeight - hexHeight/2)) {\n drawHex(canvasHex, point(x,y), 1, \"black\", \"grey\")\n //drawHexCoordinates(canvasHex, point(x,y), hex(q+n, r, - (q + n) - r))\n let topH = JSON.stringify(hex(q + n, r, - (q + n) - r))\n if(!obstacles.includes(topH)){\n hexPathMap.push(topH)\n }\n }\n }\n }\n hexPathMap = [].concat(hexPathMap)\n setHexPath(hexPathMap)\n }", "function getNeighborCoords(i, j) {\n return [\n [i - 1, j - 1], // The three cells in the row above.\n [i - 1, j],\n [i - 1, j + 1],\n [i, j - 1], // The two cells in the same row, to the left and right.\n [i, j + 1],\n [i + 1, j - 1], // The three cells in the row below.\n [i + 1, j],\n [i + 1, j + 1]\n ];\n}", "function X(){var t=c.getBoundingClientRect(),e=\"offset\"+[\"Width\",\"Height\"][i.ort];return 0===i.ort?t.width||c[e]:t.height||c[e]}", "get mid_x() { //center of x position\n return this.x + this.w / 2;\n }", "static getBLCorner(corners){\n var cornersInPSCoordinates = []\n\n var cornersSortedByLeftness = DrawingArea.sortCornersByLeftnessPS(corners)\n\n var leftCorners = cornersSortedByLeftness.slice(0,2)\n var cornersSortedByTopness = DrawingArea.sortCornersByTopnessPS(leftCorners)\n var lowerLeftCorner = cornersSortedByTopness[1];\n return lowerLeftCorner\n }", "function from_coords(x,y) {\n return x + y*16;\n }", "function xyTileNum(x, y) {\n var col = x / 101;\n var row = (y + 40) / 83;\n var tile = row * 5 + col;\n return tile;\n}", "getRight(pos){\n const x = pos[0]+1;\n const y = pos[1];\n // pretty sure all grids are square, but..\n // do check of specific row anyway, w/e\n return [x,y];\n }", "function hexagon(center, rx, ry) {\n var vertices = [];\n for (var i = 0; i < 6; i++) {\n var x = center[0] + rx * cosines[i];\n var y = center[1] + ry * sines[i];\n vertices.push([x, y]);\n }\n //first and last vertex must be the same\n vertices.push(vertices[0].slice());\n return polygon([vertices]);\n}", "function pixelCoordinate(body){\n var result = {};\n result.x = body.state.pos.x + Globals.translation.x;\n result.y = body.state.pos.y - Globals.translation.y;\n return result;\n}", "xy_lin(lin) {\n return [(lin / this.mapWidth | 0) * this.tileSizeDrawn,\n (lin % this.mapWidth | 0) * this.tileSizeDrawn];\n }", "function hexPath(x,y,H,S,C,cornerSize,extra){\n\treturn \"M \"+x+\" \"+y + \n\t\t \" h \"+(H*(1-2 *cornerSize)/2) +\n\t\t \" q \"+(cornerSize*H)+\" 0 \" + (cornerSize * (S + H) ) + \" \" + (cornerSize * C) +\n\t\t \" l \"+(S * (1 - 2 * cornerSize)*(1+extra)) + \" \" + (C * (1 - 2 * cornerSize)*(1+extra)) + \n\t\t \" q \"+(cornerSize*S)+ \" \" + (cornerSize * C) + \" \" + \" 0 \" + (2 * cornerSize * C) +\n\t\t \" l \"+(-S * (1 - 2 * cornerSize) * (1+extra)) + \" \" + (C * (1 - 2 * cornerSize) * (1+extra)) +\n\t\t \" q \"+(-cornerSize * S) + \" \" + (cornerSize*C) + \" \" + (-(S+H) * cornerSize) + \" \" + (cornerSize*C) +\n\t\t \" h \"+(-H*(1-2*cornerSize)) +\n\t\t \" q \"+(-cornerSize * H) + \" 0 \" + (-cornerSize * (H + S)) + \" \" + (-cornerSize*C) +\n\t\t \" l \"+(-(1-2*cornerSize)*S * (1+extra)) + \" \" + (-(1-2*cornerSize)*C * (1+extra)) +\n\t\t \" q \"+(-cornerSize*S) + \" \" + (-cornerSize*C) + \" 0 \" + (-2 * cornerSize*C) +\n\t\t \" l \"+((1-2*cornerSize)*S * (1+extra)) + \" \" + (-(1-2*cornerSize)*C * (1+extra)) +\n\t\t \" q \"+(cornerSize*S) + \" \" + (-cornerSize*C) + \" \" + (cornerSize*(S+H)) + \" \" + (-cornerSize*C) +\n\t\t \" z\";\n}", "function getSobelPixel(imgdata, x, y) {\n if (x < 0) {\n x = 0;\n } else if (x >= imgdata.width) {\n x = imgdata.width - 1;\n }\n\n if (y < 0) {\n y = 0;\n } else if (y >= imgdata.height) {\n y = imgdata.height - 1;\n }\n var px = getPixel(imgdata, x, y);\n return (px.r + px.g + px.b) / 3;\n }", "function gridLocationFromCoord(x, y) {\n var row = Math.floor((y / canvas.height) * numberOfRows);\n var col = Math.floor((x / canvas.width) * numberOfCols);\n \n return loc(row, col);\n }", "function getMouseXY(gridReference, squareWidth, squareHeight, evt) {\n let rect = gridReference.getBoundingClientRect();\n let width = parseInt(window.getComputedStyle(gridReference).width, 10);\n let height = parseInt(window.getComputedStyle(gridReference).height, 10);\n return {\n x: Math.floor(((evt.clientX - rect.left) / (rect.right - rect.left) * width) / squareWidth),\n y: Math.floor(((evt.clientY - rect.top) / (rect.bottom - rect.top) * height) / squareHeight)\n };\n}", "getTileIndexFromPixelCoords(x, y) {\n if (x < 0 || y <0 || x > this.width.px || y > this.width.px) return; // coords are out of bounds: don't return any index\n var qx = Math.floor(x / this.tileSize);\n var qy = Math.floor(y / this.tileSize);\n return qx + qy * this.width.tiles;\n }", "getCenterX() {\n return this.x + this.width/2\n }", "function realCoordinates(nodeIndex) {\n return { x: x[nodeIndex] + 20 - rect.left, y: y[nodeIndex] + 20 - rect.top };\n}", "function getTriangleCenter(x,y,size) {\n return {\n x: Math.floor((x + x+size + x) / 3),\n y: Math.floor((y + y+size + y+size) / 3)\n }\n}", "function getCoords(e, canvas) {\n if (e.offsetX) {\n return { x: e.offsetX, y: e.offsetY };\n }\n else if (e.layerX) {\n return { x: e.layerX, y: e.layerY };\n }\n else {\n return { x: e.pageX, y: e.pageY };\n }\n }", "function coordonnees() {\n // code fictif\n return { x:25, y:12.5 };\n}", "function toPixelCoords(tilePosition) {\n return {\n x: (tilePosition.i + 0.5) * tileSize(),\n y: (tilePosition.j + 0.5) * tileSize()\n }\n }", "coordinateToIndex(x, y) {\n return y * this.width + x;\n }", "function mouse_coords(evt) {\r\n\tlet t = evt.currentTarget;\r\n\tlet x = evt.clientX - t.clientLeft - t.getBoundingClientRect().left + t.scrollLeft;\r\n\tlet y = evt.clientY - t.clientTop - t.getBoundingClientRect().top + t.scrollTop;\r\n\tx = 2*(x/t.width) - 1;\r\n\ty = 1 - 2*(y/t.height);\r\n\treturn vec2(x, y);\r\n}", "function mouseXY(e){\r\n var rect = canvas.getBoundingClientRect();\r\n mouseX = e.x - rect.left;\r\n mouseY = e.y - rect.top;\r\n\r\n}", "_getCenterCoordinates() {\n const that = this,\n offset = that.$.picker.getBoundingClientRect(),\n radius = that._measurements.radius,\n scrollLeft = document.body.scrollLeft || document.documentElement.scrollLeft,\n scrollTop = document.body.scrollTop || document.documentElement.scrollTop;\n\n return { x: offset.left + scrollLeft + radius, y: offset.top + scrollTop + radius };\n }", "function drawHexagon(ctx, x, y, w, h) {\n var facShort = 0.26;\n var facLong = 1 - facShort;\n x -= w / 2;\n y -= h / 2;\n ctx.moveTo(x + w * 0.5, y);\n ctx.lineTo(x, y + h * facShort);\n ctx.lineTo(x, y + h * facLong);\n ctx.lineTo(x + w * 0.5, y + h);\n ctx.lineTo(x + w, y + h * facLong);\n ctx.lineTo(x + w, y + h * facShort);\n ctx.lineTo(x + w * 0.5, y);\n } //function drawHexagon", "function drawHexagon(ctx, x, y, w, h) {\n var facShort = 0.26;\n var facLong = 1 - facShort;\n x -= w / 2;\n y -= h / 2;\n ctx.moveTo(x + w * 0.5, y);\n ctx.lineTo(x, y + h * facShort);\n ctx.lineTo(x, y + h * facLong);\n ctx.lineTo(x + w * 0.5, y + h);\n ctx.lineTo(x + w, y + h * facLong);\n ctx.lineTo(x + w, y + h * facShort);\n ctx.lineTo(x + w * 0.5, y);\n } //function drawHexagon", "function obtenirCoordenades(evt) {\n var rect = c.getBoundingClientRect();\n mouse.x = evt.clientX - rect.left;\n mouse.y = evt.clientY - rect.top;\n }", "drawHexCoordinates( canvasID, center, h ) {\n const ctx = canvasID.getContext('2d')\n\n ctx.fillText( h.q, center.x+6, center.y )\n ctx.fillText( h.r, center.x-3, center.y+15 )\n ctx.fillText( h.s, center.x-12, center.y )\n }" ]
[ "0.65818816", "0.65176773", "0.6458529", "0.632223", "0.62293106", "0.6013692", "0.59704685", "0.59650815", "0.5955957", "0.5939201", "0.5933498", "0.5930881", "0.5928821", "0.59219396", "0.5915608", "0.58978283", "0.58835167", "0.5845123", "0.58370817", "0.58347845", "0.5828888", "0.58033305", "0.5753022", "0.57467544", "0.5745426", "0.57174504", "0.57155", "0.56859475", "0.56824577", "0.56779385", "0.56760484", "0.5656123", "0.56544626", "0.5646916", "0.56448495", "0.5644361", "0.5644094", "0.5627977", "0.5627578", "0.5627151", "0.56227946", "0.5622719", "0.5617127", "0.56151724", "0.5600714", "0.559829", "0.5596125", "0.55957115", "0.55910814", "0.55892295", "0.55653965", "0.5562412", "0.5551757", "0.55503005", "0.5549312", "0.55354756", "0.5532937", "0.5530652", "0.5526336", "0.55235636", "0.5521724", "0.55183077", "0.5516953", "0.55139613", "0.55115277", "0.5510827", "0.5510827", "0.5503656", "0.54987746", "0.5485773", "0.5485735", "0.548501", "0.5484277", "0.54823005", "0.54806566", "0.5473274", "0.54653263", "0.54649043", "0.54593635", "0.5455388", "0.5450297", "0.54499793", "0.5447263", "0.5445317", "0.5438337", "0.5434404", "0.54329556", "0.5432896", "0.542897", "0.5428891", "0.5422363", "0.5420907", "0.54146796", "0.5401844", "0.5400592", "0.5398379", "0.53971165", "0.53964806", "0.53964806", "0.5396004", "0.53942376" ]
0.0
-1
(0,0) is measured as the northwest most piece on the board. TODO: Make this not draw things in the lower right hand corner
function drawHexAt(img, context, hexNum, x, y) { var xcoord = 0; var ycoord = 0; var coords = getPixelCoords(x,y); xcoord = coords[0]; ycoord = coords[1]; context.drawImage(img, TILE_WIDTH * hexNum, 0, TILE_WIDTH, TILE_HEIGHT, xcoord, ycoord, SCALE_WIDTH, SCALE_HEIGHT); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rePosition(){\r\n piece.pos.y = 0; // this and next line puts the next piece at the top centered\r\n piece.pos.x = ( (arena[0].length / 2) | 0) - ( (piece.matrix[0].length / 2) | 0);\r\n }", "function detectNextBlock_CornerDownLeft (x,y,h,w)\n {\n var mapCoordY = (y + h)/ h;\n var mapCoordX = (x -1) / w;\n \n mapCoordX = Math.floor(mapCoordX);\n mapCoordY = Math.floor(mapCoordY);\n \n return map[mapCoordY-1][mapCoordX-1];\n }", "function drawPieceBoard(pieceBoard) {\n for(var i = 0; i < 3; i++)\n for(var j = 0;j < 7; j++)\n drawPixelNext( j, i, pieceBoard[i][j]);\n}", "function undrawPiece() {\nfor (var i =0; i<active.location.length;i++){\n row = active.location[i][0];\n col = active.location[i][1];\n if( grid[row][col] !== BORDER){\n\n\n ctx.fillStyle = \"black\";\n ctx.fillRect(col * SQUARE_SIZE, row * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE);\n ctx.strokeStyle = \"white\";\n ctx.strokeRect(col * SQUARE_SIZE, row * SQUARE_SIZE, SQUARE_SIZE, SQUARE_SIZE);\n grid[row][col] = -1;}\n}\n}", "function borders(){\n var N;\n N = getShape(\"halcon\");\n console.log(N);\n if (N.x >1000){\n N.x = 0;\n }\n if (N.x < 0){\n N.x = 1000;\n }\n if(N.y<-50){\n N.y = 500;\n }\n if(N.y >500){\n N.y = -50;\n }\n}", "constructor () {\n this.grid[this.topLeftCorner] = 'W';\n }", "function drawStaticPieces() {\r\n board.forEach(\r\n (row, y) => board[y].forEach(\r\n (item, x) => {\r\n if (board[y][x] !== 0) {\r\n context.fillStyle = colours[board[y][x] - 1];\r\n context.fillRect(x, y, 1, 1);\r\n }\r\n }\r\n )\r\n );\r\n}", "function drawBoard(){\n\tfor (var i = 0; i < n - 1; i++) {\n\t\tvar pos = pieceSize * (i + 1);\n\t\tctx.beginPath();\n\t\tctx.moveTo(pos, 0);\n\t\tctx.lineTo(pos, length);\n\t\tctx.moveTo(0, pos);\n\t\tctx.lineTo(length, pos);\n\t\tctx.stroke();\n\t\tctx.closePath();\n\t}\n}", "hovered_tile() {\n\t\tvar rect = this.canvas.getBoundingClientRect();\n \tvar x = this.cursor_x - rect.left + this.current_x;\n \tvar y = this.cursor_y - rect.top + this.current_y;\n\t\tvar row = Math.floor(y / this.tile_size);\n\t\tvar col = Math.floor(x / this.tile_size);\n\t\treturn row * this.board.width + col\n\t}", "function drawBoard(state){\n\n var canvas = $(\"#canvas\");\n //height and width of the board\n var W = 600, H = 600;\n canvas.css(\"height\", H);\n canvas.css(\"width\", W);\n\n var svg = $(makeSVG(W, H));\n svg.append(makeRectangle(0, 0, H, W, colorBoard));\n\n\n var numOfPix = ((W-100)/(state.size-1));//so that the board has 50 pix of room on each side\n\n //token size\n var tsize;\n if(state.size == 9)\n tsize = 20;\n else if(state.size == 13)\n tsize = 15;\n else//size is 13\n\ttsize = 13;\n\n\n var x1 = 0;\n var y1 = 0;\n\n //makes the majority of the board\n for(x = 50; x<(W-50); x += numOfPix){//50 to 550 with a 50 pix boarder\n\n for(y = 50; y<(W-50);y += numOfPix){\n\n svg.append(makeLine(x, y, x+numOfPix, y));\n svg.append(makeLine(x, y, x, y+numOfPix));\n\n svg.append(makeCircle(x, y, tsize, state.board[y1][x1]));//makes a board\n y1++;\n }\n y1 = 0;\n x1++;\n }\n\n\n\t//makes the last x line (bottom line)\n\tvar x1 = 0;\n\tfor(x = 50; x<(W-50); x += numOfPix){//50 to 550 with a 50 pix boarder\n \tsvg.append(makeLine(x, W-50, x+numOfPix, W-50));\n\n svg.append(makeCircle(x, W-50, tsize, state.board[state.size-1][x1]));//bottom of the y array\n x1++;\n }\n\n //makes the last y line (right line)\n\tvar y1 = 0;\n\tfor(y = 50; y<(W-50); y += numOfPix){//50 to 550 with a 50 pix boarder\n \tsvg.append(makeLine(W-50, y,W-50, y+numOfPix));\n\n svg.append(makeCircle(W-50,y, tsize, state.board[y1][state.size-1]));//right of the x array\n y1++;\n }\n\n //makes the last circle at the bottom right\n svg.append(makeCircle(W-50,W-50, tsize, state.board[state.size-1][state.size-1]));\n\n\n canvas.empty().append(svg);\n}", "function northwest(n) {\n var level = bottoms[n];\n var count = 0;\n\n for (var i = 1; ((n - i) >= 0) && ((level - i) >= 0); i++) {\n var square = document.getElementsByClassName(\"row\").item(level - i)\n .getElementsByClassName(\"bigSquare\").item(n - i);\n if (square.style.backgroundColor == color(currentTurn)) {\n count++;\n }\n else return count;\n }\n return count;\n }", "function drawBoard(){\n for (j = 0; j < numRows; j++) {\n \t\t// y coordinate\n \t\tvar yCorner = yOrigin + j * segmentSize;\n\t\t\n\t\t\t\tfor (i = 0; i < barSegments; i++) {\n\t\t\t\t\t\t// x coordinate\n\t\t\t\t\t\tvar xCorner = xOrigin + i * segmentSize; {\n \n if ( isOdd(i) == isOdd(j)){\n\t\t\t\t\t\t fill(\"lightblue\");\n\t\t\t\t\t\t } else {\n\t\t\t\t\t\t fill(\"white\");\n }\t\n }\n\t\t\t\t\t \n\t\t\t\t\tdrawSquare(xCorner, yCorner, segmentSize, segmentSize);\n\t\t\t\t }\n }\t\n }", "function drawBoard() {\n var height = cellside * sidelength;\n var width = cellside * sidelength;\n from_to(0, height, cellside, function (i) {\n ctx.moveTo(i, 0);\n ctx.lineTo(i, width);\n ctx.moveTo(0, i);\n ctx.lineTo(height, i);\n });\n ctx.strokeStyle = \"black\";\n ctx.stroke();\n}", "function initializeBoard() {\n return [new Cell(new Posn(0, 0), [\"up\", \"left\"]),\n new Cell(new Posn(1, 0), [\"up\", \"down\"]),\n new Cell(new Posn(2, 0), [\"up\", \"down\"]),\n new Cell(new Posn(3, 0), [\"up\", \"down\"]),\n new Cell(new Posn(4, 0), [\"up\", \"down\"]),\n new Cell(new Posn(5, 0), [\"up\"]),\n new Cell(new Posn(6, 0), [\"up\", \"down\"]),\n new Cell(new Posn(7, 0), [\"up\", \"down\"]),\n new Cell(new Posn(8, 0), [\"up\", \"down\"]),\n new Cell(new Posn(9, 0), [\"up\", \"down\"]),\n new Cell(new Posn(10, 0), [\"up\", \"down\"]),\n new Cell(new Posn(11, 0), [\"up\", \"right\"]),\n new Cell(new Posn(12, 0), [\"up\", \"left\"]),\n new Cell(new Posn(13, 0), [\"up\", \"right\"]),\n new Cell(new Posn(14, 0), [\"up\", \"left\"]),\n new Cell(new Posn(15, 0), [\"up\", \"down\"]),\n new Cell(new Posn(16, 0), [\"up\", \"down\"]),\n new Cell(new Posn(17, 0), [\"up\", \"down\"]),\n new Cell(new Posn(18, 0), [\"up\", \"down\"]),\n new Cell(new Posn(19, 0), [\"up\", \"down\"]),\n new Cell(new Posn(20, 0), [\"up\"]),\n new Cell(new Posn(21, 0), [\"up\", \"down\"]),\n new Cell(new Posn(22, 0), [\"up\", \"down\"]),\n new Cell(new Posn(23, 0), [\"up\", \"down\"]),\n new Cell(new Posn(24, 0), [\"up\", \"down\"]),\n new Cell(new Posn(25, 0), [\"up\", \"right\"]),\n new Cell(new Posn(0, 1), [\"left\", \"right\"]),\n new Cell(new Posn(1, 1), [\"up\", \"left\"]),\n new Cell(new Posn(2, 1), [\"up\"]),\n new Cell(new Posn(3, 1), [\"up\"]),\n new Cell(new Posn(4, 1), [\"up\", \"right\"]),\n new Cell(new Posn(5, 1), [\"left\", \"right\"]),\n new Cell(new Posn(6, 1), [\"up\", \"left\"]),\n new Cell(new Posn(7, 1), [\"up\"]),\n new Cell(new Posn(8, 1), [\"up\"]),\n new Cell(new Posn(9, 1), [\"up\"]),\n new Cell(new Posn(10, 1), [\"up\", \"right\"]),\n new Cell(new Posn(11, 1), [\"left\", \"right\"]),\n new Cell(new Posn(12, 1), [\"left\"]),\n new Cell(new Posn(13, 1), [\"right\"]),\n new Cell(new Posn(14, 1), [\"left\", \"right\"]),\n new Cell(new Posn(15, 1), [\"up\", \"left\"]),\n new Cell(new Posn(16, 1), [\"up\"]),\n new Cell(new Posn(17, 1), [\"up\"]),\n new Cell(new Posn(18, 1), [\"up\"]),\n new Cell(new Posn(19, 1), [\"up\", \"right\"]),\n new Cell(new Posn(20, 1), [\"left\", \"right\"]),\n new Cell(new Posn(21, 1), [\"up\", \"left\"]),\n new Cell(new Posn(22, 1), [\"up\"]),\n new Cell(new Posn(23, 1), [\"up\"]),\n new Cell(new Posn(24, 1), [\"up\", \"right\"]),\n new Cell(new Posn(25, 1), [\"left\", \"right\"]),\n new Cell(new Posn(0, 2), [\"left\", \"right\"]),\n new Cell(new Posn(1, 2), [\"left\"]),\n new Cell(new Posn(2, 2), []),\n new Cell(new Posn(3, 2), []),\n new Cell(new Posn(4, 2), [\"right\"]),\n new Cell(new Posn(5, 2), [\"left\", \"right\"]),\n new Cell(new Posn(6, 2), [\"left\"]),\n new Cell(new Posn(7, 2), []),\n new Cell(new Posn(8, 2), []),\n new Cell(new Posn(9, 2), []),\n new Cell(new Posn(10, 2), [\"right\"]),\n new Cell(new Posn(11, 2), [\"left\", \"right\"]),\n new Cell(new Posn(12, 2), [\"left\"]),\n new Cell(new Posn(13, 2), [\"right\"]),\n new Cell(new Posn(14, 2), [\"left\", \"right\"]),\n new Cell(new Posn(15, 2), [\"left\"]),\n new Cell(new Posn(16, 2), []),\n new Cell(new Posn(17, 2), []),\n new Cell(new Posn(18, 2), []),\n new Cell(new Posn(19, 2), [\"right\"]),\n new Cell(new Posn(20, 2), [\"left\", \"right\"]),\n new Cell(new Posn(21, 2), [\"left\"]),\n new Cell(new Posn(22, 2), []),\n new Cell(new Posn(23, 2), []),\n new Cell(new Posn(24, 2), [\"right\"]),\n new Cell(new Posn(25, 2), [\"left\", \"right\"]),\n new Cell(new Posn(0, 3), [\"left\", \"right\"]),\n new Cell(new Posn(1, 3), [\"left\", \"down\"]),\n new Cell(new Posn(2, 3), [\"down\"]),\n new Cell(new Posn(3, 3), [\"down\"]),\n new Cell(new Posn(4, 3), [\"right\", \"down\"]),\n new Cell(new Posn(5, 3), [\"left\", \"right\"]),\n new Cell(new Posn(6, 3), [\"left\", \"down\"]),\n new Cell(new Posn(7, 3), [\"down\"]),\n new Cell(new Posn(8, 3), [\"down\"]),\n new Cell(new Posn(9, 3), [\"down\"]),\n new Cell(new Posn(10, 3), [\"right\", \"down\"]),\n new Cell(new Posn(11, 3), [\"left\", \"right\"]),\n new Cell(new Posn(12, 3), [\"left\", \"down\"]),\n new Cell(new Posn(13, 3), [\"right\", \"down\"]),\n new Cell(new Posn(14, 3), [\"left\", \"right\"]),\n new Cell(new Posn(15, 3), [\"left\", \"down\"]),\n new Cell(new Posn(16, 3), [\"down\"]),\n new Cell(new Posn(17, 3), [\"down\"]),\n new Cell(new Posn(18, 3), [\"down\"]),\n new Cell(new Posn(19, 3), [\"right\", \"down\"]),\n new Cell(new Posn(20, 3), [\"left\", \"right\"]),\n new Cell(new Posn(21, 3), [\"left\", \"down\"]),\n new Cell(new Posn(22, 3), [\"down\"]),\n new Cell(new Posn(23, 3), [\"down\"]),\n new Cell(new Posn(24, 3), [\"right\", \"down\"]),\n new Cell(new Posn(25, 3), [\"left\", \"right\"]),\n new Cell(new Posn(0, 4), [\"left\"]),\n new Cell(new Posn(1, 4), [\"up\", \"down\"]),\n new Cell(new Posn(2, 4), [\"up\", \"down\"]),\n new Cell(new Posn(3, 4), [\"up\", \"down\"]),\n new Cell(new Posn(4, 4), [\"up\", \"down\"]),\n new Cell(new Posn(5, 4), []),\n new Cell(new Posn(6, 4), [\"up\", \"down\"]),\n new Cell(new Posn(7, 4), [\"up\", \"down\"]),\n new Cell(new Posn(8, 4), [\"up\"]),\n new Cell(new Posn(9, 4), [\"up\", \"down\"]),\n new Cell(new Posn(10, 4), [\"up\", \"down\"]),\n new Cell(new Posn(11, 4), [\"down\"]),\n new Cell(new Posn(12, 4), [\"up\", \"down\"]),\n new Cell(new Posn(13, 4), [\"up\", \"down\"]),\n new Cell(new Posn(14, 4), [\"down\"]),\n new Cell(new Posn(15, 4), [\"up\", \"down\"]),\n new Cell(new Posn(16, 4), [\"up\", \"down\"]),\n new Cell(new Posn(17, 4), [\"up\"]),\n new Cell(new Posn(18, 4), [\"up\", \"down\"]),\n new Cell(new Posn(19, 4), [\"up\", \"down\"]),\n new Cell(new Posn(20, 4), []),\n new Cell(new Posn(21, 4), [\"up\", \"down\"]),\n new Cell(new Posn(22, 4), [\"up\", \"down\"]),\n new Cell(new Posn(23, 4), [\"up\", \"down\"]),\n new Cell(new Posn(24, 4), [\"up\", \"down\"]),\n new Cell(new Posn(25, 4), [\"right\"]),\n new Cell(new Posn(0, 5), [\"left\", \"right\"]),\n new Cell(new Posn(1, 5), [\"up\", \"left\"]),\n new Cell(new Posn(2, 5), [\"up\"]),\n new Cell(new Posn(3, 5), [\"up\"]),\n new Cell(new Posn(4, 5), [\"up\", \"right\"]),\n new Cell(new Posn(5, 5), [\"left\", \"right\"]),\n new Cell(new Posn(6, 5), [\"up\", \"left\"]),\n new Cell(new Posn(7, 5), [\"up\", \"right\"]),\n new Cell(new Posn(8, 5), [\"left\", \"right\"]),\n new Cell(new Posn(9, 5), [\"up\", \"left\"]),\n new Cell(new Posn(10, 5), [\"up\"]),\n new Cell(new Posn(11, 5), [\"up\"]),\n new Cell(new Posn(12, 5), [\"up\"]),\n new Cell(new Posn(13, 5), [\"up\"]),\n new Cell(new Posn(14, 5), [\"up\"]),\n new Cell(new Posn(15, 5), [\"up\"]),\n new Cell(new Posn(16, 5), [\"up\", \"right\"]),\n new Cell(new Posn(17, 5), [\"left\", \"right\"]),\n new Cell(new Posn(18, 5), [\"up\", \"left\"]),\n new Cell(new Posn(19, 5), [\"up\", \"right\"]),\n new Cell(new Posn(20, 5), [\"left\", \"right\"]),\n new Cell(new Posn(21, 5), [\"up\", \"left\"]),\n new Cell(new Posn(22, 5), [\"up\"]),\n new Cell(new Posn(23, 5), [\"up\"]),\n new Cell(new Posn(24, 5), [\"up\", \"right\"]),\n new Cell(new Posn(25, 5), [\"left\", \"right\"]),\n new Cell(new Posn(0, 6), [\"left\", \"right\"]),\n new Cell(new Posn(1, 6), [\"left\", \"down\"]),\n new Cell(new Posn(2, 6), [\"down\"]),\n new Cell(new Posn(3, 6), [\"down\"]),\n new Cell(new Posn(4, 6), [\"right\", \"down\"]),\n new Cell(new Posn(5, 6), [\"left\", \"right\"]),\n new Cell(new Posn(6, 6), [\"left\"]),\n new Cell(new Posn(7, 6), [\"right\"]),\n new Cell(new Posn(8, 6), [\"left\", \"right\"]),\n new Cell(new Posn(9, 6), [\"left\", \"down\"]),\n new Cell(new Posn(10, 6), [\"down\"]),\n new Cell(new Posn(11, 6), [\"down\"]),\n new Cell(new Posn(12, 6), []),\n new Cell(new Posn(13, 6), []),\n new Cell(new Posn(14, 6), [\"down\"]),\n new Cell(new Posn(15, 6), [\"down\"]),\n new Cell(new Posn(16, 6), [\"right\", \"down\"]),\n new Cell(new Posn(17, 6), [\"left\", \"right\"]),\n new Cell(new Posn(18, 6), [\"left\"]),\n new Cell(new Posn(19, 6), [\"right\"]),\n new Cell(new Posn(20, 6), [\"left\", \"right\"]),\n new Cell(new Posn(21, 6), [\"left\", \"down\"]),\n new Cell(new Posn(22, 6), [\"down\"]),\n new Cell(new Posn(23, 6), [\"down\"]),\n new Cell(new Posn(24, 6), [\"right\", \"down\"]),\n new Cell(new Posn(25, 6), [\"left\", \"right\"]),\n new Cell(new Posn(0, 7), [\"left\", \"down\"]),\n new Cell(new Posn(1, 7), [\"up\", \"down\"]),\n new Cell(new Posn(2, 7), [\"up\", \"down\"]),\n new Cell(new Posn(3, 7), [\"up\", \"down\"]),\n new Cell(new Posn(4, 7), [\"up\", \"down\"]),\n new Cell(new Posn(5, 7), [\"right\"]),\n new Cell(new Posn(6, 7), [\"left\"]),\n new Cell(new Posn(7, 7), [\"right\"]),\n new Cell(new Posn(8, 7), [\"left\", \"down\"]),\n new Cell(new Posn(9, 7), [\"up\", \"down\"]),\n new Cell(new Posn(10, 7), [\"up\", \"down\"]),\n new Cell(new Posn(11, 7), [\"up\", \"right\"]),\n new Cell(new Posn(12, 7), [\"left\"]),\n new Cell(new Posn(13, 7), [\"right\"]),\n new Cell(new Posn(14, 7), [\"up\", \"left\"]),\n new Cell(new Posn(15, 7), [\"up\", \"down\"]),\n new Cell(new Posn(16, 7), [\"up\", \"down\"]),\n new Cell(new Posn(17, 7), [\"right\", \"down\"]),\n new Cell(new Posn(18, 7), [\"left\"]),\n new Cell(new Posn(19, 7), [\"right\"]),\n new Cell(new Posn(20, 7), [\"left\"]),\n new Cell(new Posn(21, 7), [\"up\", \"down\"]),\n new Cell(new Posn(22, 7), [\"up\", \"down\"]),\n new Cell(new Posn(23, 7), [\"up\", \"down\"]),\n new Cell(new Posn(24, 7), [\"up\", \"down\"]),\n new Cell(new Posn(25, 7), [\"right\", \"down\"]),\n new Cell(new Posn(0, 8), [\"up\", \"left\"]),\n new Cell(new Posn(1, 8), [\"up\"]),\n new Cell(new Posn(2, 8), [\"up\"]),\n new Cell(new Posn(3, 8), [\"up\"]),\n new Cell(new Posn(4, 8), [\"up\", \"right\"]),\n new Cell(new Posn(5, 8), [\"left\", \"right\"]),\n new Cell(new Posn(6, 8), [\"left\"]),\n new Cell(new Posn(7, 8), []),\n new Cell(new Posn(8, 8), [\"up\"]),\n new Cell(new Posn(9, 8), [\"up\"]),\n new Cell(new Posn(10, 8), [\"up\", \"right\"]),\n new Cell(new Posn(11, 8), [\"left\", \"right\"]),\n new Cell(new Posn(12, 8), [\"left\"]),\n new Cell(new Posn(13, 8), [\"right\"]),\n new Cell(new Posn(14, 8), [\"left\", \"right\"]),\n new Cell(new Posn(15, 8), [\"up\", \"left\"]),\n new Cell(new Posn(16, 8), [\"up\"]),\n new Cell(new Posn(17, 8), [\"up\"]),\n new Cell(new Posn(18, 8), []),\n new Cell(new Posn(19, 8), [\"right\"]),\n new Cell(new Posn(20, 8), [\"left\", \"right\"]),\n new Cell(new Posn(21, 8), [\"up\", \"left\"]),\n new Cell(new Posn(22, 8), [\"up\"]),\n new Cell(new Posn(23, 8), [\"up\"]),\n new Cell(new Posn(24, 8), [\"up\"]),\n new Cell(new Posn(25, 8), [\"up\", \"right\"]),\n new Cell(new Posn(0, 9), [\"left\"]),\n new Cell(new Posn(1, 9), []),\n new Cell(new Posn(2, 9), []),\n new Cell(new Posn(3, 9), []),\n new Cell(new Posn(4, 9), [\"right\"]),\n new Cell(new Posn(5, 9), [\"left\", \"right\"]),\n new Cell(new Posn(6, 9), [\"left\"]),\n new Cell(new Posn(7, 9), []),\n new Cell(new Posn(8, 9), [\"down\"]),\n new Cell(new Posn(9, 9), [\"down\"]),\n new Cell(new Posn(10, 9), [\"right\", \"down\"]),\n new Cell(new Posn(11, 9), [\"left\", \"right\"]),\n new Cell(new Posn(12, 9), [\"left\", \"down\"]),\n new Cell(new Posn(13, 9), [\"right\", \"down\"]),\n new Cell(new Posn(14, 9), [\"left\", \"right\"]),\n new Cell(new Posn(15, 9), [\"left\", \"down\"]),\n new Cell(new Posn(16, 9), [\"down\"]),\n new Cell(new Posn(17, 9), [\"down\"]),\n new Cell(new Posn(18, 9), []),\n new Cell(new Posn(19, 9), [\"right\"]),\n new Cell(new Posn(20, 9), [\"left\", \"right\"]),\n new Cell(new Posn(21, 9), [\"left\"]),\n new Cell(new Posn(22, 9), []),\n new Cell(new Posn(23, 9), []),\n new Cell(new Posn(24, 9), []),\n new Cell(new Posn(25, 9), [\"right\"]),\n new Cell(new Posn(0, 10), [\"left\"]),\n new Cell(new Posn(1, 10), []),\n new Cell(new Posn(2, 10), []),\n new Cell(new Posn(3, 10), []),\n new Cell(new Posn(4, 10), [\"right\"]),\n new Cell(new Posn(5, 10), [\"left\", \"right\"]),\n new Cell(new Posn(6, 10), [\"left\"]),\n new Cell(new Posn(7, 10), [\"right\"]),\n new Cell(new Posn(8, 10), [\"up\", \"left\"]),\n new Cell(new Posn(9, 10), [\"up\"]),\n new Cell(new Posn(10, 10), [\"up\"]),\n new Cell(new Posn(11, 10), []),\n new Cell(new Posn(12, 10), [\"up\"]),\n new Cell(new Posn(13, 10), [\"up\"]),\n new Cell(new Posn(14, 10), []),\n new Cell(new Posn(15, 10), [\"up\"]),\n new Cell(new Posn(16, 10), [\"up\"]),\n new Cell(new Posn(17, 10), [\"up\", \"right\"]),\n new Cell(new Posn(18, 10), [\"left\"]),\n new Cell(new Posn(19, 10), [\"right\"]),\n new Cell(new Posn(20, 10), [\"left\", \"right\"]),\n new Cell(new Posn(21, 10), [\"left\"]),\n new Cell(new Posn(22, 10), []),\n new Cell(new Posn(23, 10), []),\n new Cell(new Posn(24, 10), []),\n new Cell(new Posn(25, 10), [\"right\"]),\n new Cell(new Posn(0, 11), [\"left\"]),\n new Cell(new Posn(1, 11), []),\n new Cell(new Posn(2, 11), []),\n new Cell(new Posn(3, 11), []),\n new Cell(new Posn(4, 11), [\"right\"]),\n new Cell(new Posn(5, 11), [\"left\", \"right\"]),\n new Cell(new Posn(6, 11), [\"left\"]),\n new Cell(new Posn(7, 11), [\"right\"]),\n new Cell(new Posn(8, 11), [\"left\"]),\n new Cell(new Posn(9, 11), [\"down\"]),\n new Cell(new Posn(10, 11), [\"down\"]),\n new Cell(new Posn(11, 11), [\"down\"]),\n new Cell(new Posn(12, 11), [\"down\"]),\n new Cell(new Posn(13, 11), [\"down\"]),\n new Cell(new Posn(14, 11), [\"down\"]),\n new Cell(new Posn(15, 11), [\"down\"]),\n new Cell(new Posn(16, 11), [\"down\"]),\n new Cell(new Posn(17, 11), [\"right\"]),\n new Cell(new Posn(18, 11), [\"left\"]),\n new Cell(new Posn(19, 11), [\"right\"]),\n new Cell(new Posn(20, 11), [\"left\", \"right\"]),\n new Cell(new Posn(21, 11), [\"left\"]),\n new Cell(new Posn(22, 11), []),\n new Cell(new Posn(23, 11), []),\n new Cell(new Posn(24, 11), []),\n new Cell(new Posn(25, 11), [\"right\"]),\n new Cell(new Posn(0, 12), [\"left\", \"down\"]),\n new Cell(new Posn(1, 12), [\"down\"]),\n new Cell(new Posn(2, 12), [\"down\"]),\n new Cell(new Posn(3, 12), [\"down\"]),\n new Cell(new Posn(4, 12), [\"right\", \"down\"]),\n new Cell(new Posn(5, 12), [\"left\", \"right\"]),\n new Cell(new Posn(6, 12), [\"left\", \"down\"]),\n new Cell(new Posn(7, 12), [\"right\", \"down\"]),\n new Cell(new Posn(8, 12), [\"left\", \"right\"]),\n new Cell(new Posn(9, 12), [\"up\", \"left\"]),\n new Cell(new Posn(10, 12), [\"up\"]),\n new Cell(new Posn(11, 12), [\"up\"]),\n new Cell(new Posn(12, 12), [\"special\"]),\n new Cell(new Posn(13, 12), [\"special\"]),\n new Cell(new Posn(14, 12), [\"up\"]),\n new Cell(new Posn(15, 12), [\"up\"]),\n new Cell(new Posn(16, 12), [\"up\", \"right\"]),\n new Cell(new Posn(17, 12), [\"left\", \"right\"]),\n new Cell(new Posn(18, 12), [\"left\", \"down\"]),\n new Cell(new Posn(19, 12), [\"right\", \"down\"]),\n new Cell(new Posn(20, 12), [\"left\", \"right\"]),\n new Cell(new Posn(21, 12), [\"left\", \"down\"]),\n new Cell(new Posn(22, 12), [\"down\"]),\n new Cell(new Posn(23, 12), [\"down\"]),\n new Cell(new Posn(24, 12), [\"down\"]),\n new Cell(new Posn(25, 12), [\"right\", \"down\"]),\n new Cell(new Posn(0, 13), [\"up\", \"down\"]),\n new Cell(new Posn(1, 13), [\"up\", \"down\"]),\n new Cell(new Posn(2, 13), [\"up\", \"down\"]),\n new Cell(new Posn(3, 13), [\"up\", \"down\"]),\n new Cell(new Posn(4, 13), [\"up\", \"down\"]),\n new Cell(new Posn(5, 13), []),\n new Cell(new Posn(6, 13), [\"up\", \"down\"]),\n new Cell(new Posn(7, 13), [\"up\", \"down\"]),\n new Cell(new Posn(8, 13), [\"right\"]),\n new Cell(new Posn(9, 13), [\"left\"]),\n new Cell(new Posn(10, 13), []),\n new Cell(new Posn(11, 13), []),\n new Cell(new Posn(12, 13), []),\n new Cell(new Posn(13, 13), []),\n new Cell(new Posn(14, 13), []),\n new Cell(new Posn(15, 13), []),\n new Cell(new Posn(16, 13), [\"right\"]),\n new Cell(new Posn(17, 13), [\"left\"]),\n new Cell(new Posn(18, 13), [\"up\", \"down\"]),\n new Cell(new Posn(19, 13), [\"up\", \"down\"]),\n new Cell(new Posn(20, 13), []),\n new Cell(new Posn(21, 13), [\"up\", \"down\"]),\n new Cell(new Posn(22, 13), [\"up\", \"down\"]),\n new Cell(new Posn(23, 13), [\"up\", \"down\"]),\n new Cell(new Posn(24, 13), [\"up\", \"down\"]),\n new Cell(new Posn(25, 13), [\"up\", \"down\"]),\n new Cell(new Posn(0, 14), [\"up\", \"left\"]),\n new Cell(new Posn(1, 14), [\"up\"]),\n new Cell(new Posn(2, 14), [\"up\"]),\n new Cell(new Posn(3, 14), [\"up\"]),\n new Cell(new Posn(4, 14), [\"up\", \"right\"]),\n new Cell(new Posn(5, 14), [\"left\", \"right\"]),\n new Cell(new Posn(6, 14), [\"up\", \"left\"]),\n new Cell(new Posn(7, 14), [\"up\", \"right\"]),\n new Cell(new Posn(8, 14), [\"left\", \"right\"]),\n new Cell(new Posn(9, 14), [\"left\"]),\n new Cell(new Posn(10, 14), []),\n new Cell(new Posn(11, 14), []),\n new Cell(new Posn(12, 14), []),\n new Cell(new Posn(13, 14), []),\n new Cell(new Posn(14, 14), []),\n new Cell(new Posn(15, 14), []),\n new Cell(new Posn(16, 14), [\"right\"]),\n new Cell(new Posn(17, 14), [\"left\", \"right\"]),\n new Cell(new Posn(18, 14), [\"up\", \"left\"]),\n new Cell(new Posn(19, 14), [\"up\", \"right\"]),\n new Cell(new Posn(20, 14), [\"left\", \"right\"]),\n new Cell(new Posn(21, 14), [\"up\", \"left\"]),\n new Cell(new Posn(22, 14), [\"up\"]),\n new Cell(new Posn(23, 14), [\"up\"]),\n new Cell(new Posn(24, 14), [\"up\"]),\n new Cell(new Posn(25, 14), [\"up\", \"right\"]),\n new Cell(new Posn(0, 15), [\"left\"]),\n new Cell(new Posn(1, 15), []),\n new Cell(new Posn(2, 15), []),\n new Cell(new Posn(3, 15), []),\n new Cell(new Posn(4, 15), [\"right\"]),\n new Cell(new Posn(5, 15), [\"left\", \"right\"]),\n new Cell(new Posn(6, 15), [\"left\"]),\n new Cell(new Posn(7, 15), [\"right\"]),\n new Cell(new Posn(8, 15), [\"left\", \"right\"]),\n new Cell(new Posn(9, 15), [\"left\", \"down\"]),\n new Cell(new Posn(10, 15), [\"down\"]),\n new Cell(new Posn(11, 15), [\"down\"]),\n new Cell(new Posn(12, 15), [\"down\"]),\n new Cell(new Posn(13, 15), [\"down\"]),\n new Cell(new Posn(14, 15), [\"down\"]),\n new Cell(new Posn(15, 15), [\"down\"]),\n new Cell(new Posn(16, 15), [\"right\", \"down\"]),\n new Cell(new Posn(17, 15), [\"left\", \"right\"]),\n new Cell(new Posn(18, 15), [\"left\"]),\n new Cell(new Posn(19, 15), [\"right\"]),\n new Cell(new Posn(20, 15), [\"left\", \"right\"]),\n new Cell(new Posn(21, 15), [\"left\"]),\n new Cell(new Posn(22, 15), []),\n new Cell(new Posn(23, 15), []),\n new Cell(new Posn(24, 15), []),\n new Cell(new Posn(25, 15), [\"right\"]),\n new Cell(new Posn(0, 16), [\"left\"]),\n new Cell(new Posn(1, 16), []),\n new Cell(new Posn(2, 16), []),\n new Cell(new Posn(3, 16), []),\n new Cell(new Posn(4, 16), [\"right\"]),\n new Cell(new Posn(5, 16), [\"left\", \"right\"]),\n new Cell(new Posn(6, 16), [\"left\"]),\n new Cell(new Posn(7, 16), [\"right\"]),\n new Cell(new Posn(8, 16), [\"left\"]),\n new Cell(new Posn(9, 16), [\"up\", \"down\"]),\n new Cell(new Posn(10, 16), [\"up\", \"down\"]),\n new Cell(new Posn(11, 16), [\"up\", \"down\"]),\n new Cell(new Posn(12, 16), [\"up\", \"down\"]),\n new Cell(new Posn(13, 16), [\"up\", \"down\"]),\n new Cell(new Posn(14, 16), [\"up\", \"down\"]),\n new Cell(new Posn(15, 16), [\"up\", \"down\"]),\n new Cell(new Posn(16, 16), [\"up\", \"down\"]),\n new Cell(new Posn(17, 16), [\"right\"]),\n new Cell(new Posn(18, 16), [\"left\"]),\n new Cell(new Posn(19, 16), [\"right\"]),\n new Cell(new Posn(20, 16), [\"left\", \"right\"]),\n new Cell(new Posn(21, 16), [\"left\"]),\n new Cell(new Posn(22, 16), []),\n new Cell(new Posn(23, 16), []),\n new Cell(new Posn(24, 16), []),\n new Cell(new Posn(25, 16), [\"right\"]),\n new Cell(new Posn(0, 17), [\"left\"]),\n new Cell(new Posn(1, 17), []),\n new Cell(new Posn(2, 17), []),\n new Cell(new Posn(3, 17), []),\n new Cell(new Posn(4, 17), [\"right\"]),\n new Cell(new Posn(5, 17), [\"left\", \"right\"]),\n new Cell(new Posn(6, 17), [\"left\"]),\n new Cell(new Posn(7, 17), [\"right\"]),\n new Cell(new Posn(8, 17), [\"left\", \"right\"]),\n new Cell(new Posn(9, 17), [\"up\", \"left\"]),\n new Cell(new Posn(10, 17), [\"up\"]),\n new Cell(new Posn(11, 17), [\"up\"]),\n new Cell(new Posn(12, 17), [\"up\"]),\n new Cell(new Posn(13, 17), [\"up\"]),\n new Cell(new Posn(14, 17), [\"up\"]),\n new Cell(new Posn(15, 17), [\"up\"]),\n new Cell(new Posn(16, 17), [\"up\", \"right\"]),\n new Cell(new Posn(17, 17), [\"left\", \"right\"]),\n new Cell(new Posn(18, 17), [\"left\"]),\n new Cell(new Posn(19, 17), [\"right\"]),\n new Cell(new Posn(20, 17), [\"left\", \"right\"]),\n new Cell(new Posn(21, 17), [\"left\"]),\n new Cell(new Posn(22, 17), []),\n new Cell(new Posn(23, 17), []),\n new Cell(new Posn(24, 17), []),\n new Cell(new Posn(25, 17), [\"right\"]),\n new Cell(new Posn(0, 18), [\"left\", \"down\"]),\n new Cell(new Posn(1, 18), [\"down\"]),\n new Cell(new Posn(2, 18), [\"down\"]),\n new Cell(new Posn(3, 18), [\"down\"]),\n new Cell(new Posn(4, 18), [\"right\", \"down\"]),\n new Cell(new Posn(5, 18), [\"left\", \"right\"]),\n new Cell(new Posn(6, 18), [\"left\", \"down\"]),\n new Cell(new Posn(7, 18), [\"right\", \"down\"]),\n new Cell(new Posn(8, 18), [\"left\", \"right\"]),\n new Cell(new Posn(9, 18), [\"left\", \"down\"]),\n new Cell(new Posn(10, 18), [\"down\"]),\n new Cell(new Posn(11, 18), [\"down\"]),\n new Cell(new Posn(12, 18), []),\n new Cell(new Posn(13, 18), []),\n new Cell(new Posn(14, 18), [\"down\"]),\n new Cell(new Posn(15, 18), [\"down\"]),\n new Cell(new Posn(16, 18), [\"right\", \"down\"]),\n new Cell(new Posn(17, 18), [\"left\", \"right\"]),\n new Cell(new Posn(18, 18), [\"left\", \"down\"]),\n new Cell(new Posn(19, 18), [\"right\", \"down\"]),\n new Cell(new Posn(20, 18), [\"left\", \"right\"]),\n new Cell(new Posn(21, 18), [\"left\", \"down\"]),\n new Cell(new Posn(22, 18), [\"down\"]),\n new Cell(new Posn(23, 18), [\"down\"]),\n new Cell(new Posn(24, 18), [\"down\"]),\n new Cell(new Posn(25, 18), [\"right\", \"down\"]),\n new Cell(new Posn(0, 19), [\"up\", \"left\"]),\n new Cell(new Posn(1, 19), [\"up\", \"down\"]),\n new Cell(new Posn(2, 19), [\"up\", \"down\"]),\n new Cell(new Posn(3, 19), [\"up\", \"down\"]),\n new Cell(new Posn(4, 19), [\"up\", \"down\"]),\n new Cell(new Posn(5, 19), []),\n new Cell(new Posn(6, 19), [\"up\", \"down\"]),\n new Cell(new Posn(7, 19), [\"up\", \"down\"]),\n new Cell(new Posn(8, 19), [\"down\"]),\n new Cell(new Posn(9, 19), [\"up\", \"down\"]),\n new Cell(new Posn(10, 19), [\"up\", \"down\"]),\n new Cell(new Posn(11, 19), [\"up\", \"right\"]),\n new Cell(new Posn(12, 19), [\"left\"]),\n new Cell(new Posn(13, 19), [\"right\"]),\n new Cell(new Posn(14, 19), [\"up\", \"left\"]),\n new Cell(new Posn(15, 19), [\"up\", \"down\"]),\n new Cell(new Posn(16, 19), [\"up\", \"down\"]),\n new Cell(new Posn(17, 19), [\"down\"]),\n new Cell(new Posn(18, 19), [\"up\", \"down\"]),\n new Cell(new Posn(19, 19), [\"up\", \"down\"]),\n new Cell(new Posn(20, 19), []),\n new Cell(new Posn(21, 19), [\"up\", \"down\"]),\n new Cell(new Posn(22, 19), [\"up\", \"down\"]),\n new Cell(new Posn(23, 19), [\"up\", \"down\"]),\n new Cell(new Posn(24, 19), [\"up\", \"down\"]),\n new Cell(new Posn(25, 19), [\"up\", \"right\"]),\n new Cell(new Posn(0, 20), [\"left\", \"right\"]),\n new Cell(new Posn(1, 20), [\"up\", \"left\"]),\n new Cell(new Posn(2, 20), [\"up\"]),\n new Cell(new Posn(3, 20), [\"up\"]),\n new Cell(new Posn(4, 20), [\"up\", \"right\"]),\n new Cell(new Posn(5, 20), [\"left\", \"right\"]),\n new Cell(new Posn(6, 20), [\"up\", \"left\"]),\n new Cell(new Posn(7, 20), [\"up\"]),\n new Cell(new Posn(8, 20), [\"up\"]),\n new Cell(new Posn(9, 20), [\"up\"]),\n new Cell(new Posn(10, 20), [\"up\", \"right\"]),\n new Cell(new Posn(11, 20), [\"left\", \"right\"]),\n new Cell(new Posn(12, 20), [\"left\"]),\n new Cell(new Posn(13, 20), [\"right\"]),\n new Cell(new Posn(14, 20), [\"left\", \"right\"]),\n new Cell(new Posn(15, 20), [\"up\", \"left\"]),\n new Cell(new Posn(16, 20), [\"up\"]),\n new Cell(new Posn(17, 20), [\"up\"]),\n new Cell(new Posn(18, 20), [\"up\"]),\n new Cell(new Posn(19, 20), [\"up\", \"right\"]),\n new Cell(new Posn(20, 20), [\"left\", \"right\"]),\n new Cell(new Posn(21, 20), [\"up\", \"left\"]),\n new Cell(new Posn(22, 20), [\"up\"]),\n new Cell(new Posn(23, 20), [\"up\"]),\n new Cell(new Posn(24, 20), [\"up\", \"right\"]),\n new Cell(new Posn(25, 20), [\"left\", \"right\"]),\n new Cell(new Posn(0, 21), [\"left\", \"right\"]),\n new Cell(new Posn(1, 21), [\"left\", \"down\"]),\n new Cell(new Posn(2, 21), [\"down\"]),\n new Cell(new Posn(3, 21), []),\n new Cell(new Posn(4, 21), [\"right\"]),\n new Cell(new Posn(5, 21), [\"left\", \"right\"]),\n new Cell(new Posn(6, 21), [\"left\", \"down\"]),\n new Cell(new Posn(7, 21), [\"down\"]),\n new Cell(new Posn(8, 21), [\"down\"]),\n new Cell(new Posn(9, 21), [\"down\"]),\n new Cell(new Posn(10, 21), [\"right\", \"down\"]),\n new Cell(new Posn(11, 21), [\"left\", \"right\"]),\n new Cell(new Posn(12, 21), [\"left\", \"down\"]),\n new Cell(new Posn(13, 21), [\"right\", \"down\"]),\n new Cell(new Posn(14, 21), [\"left\", \"right\"]),\n new Cell(new Posn(15, 21), [\"left\", \"down\"]),\n new Cell(new Posn(16, 21), [\"down\"]),\n new Cell(new Posn(17, 21), [\"down\"]),\n new Cell(new Posn(18, 21), [\"down\"]),\n new Cell(new Posn(19, 21), [\"right\", \"down\"]),\n new Cell(new Posn(20, 21), [\"left\", \"right\"]),\n new Cell(new Posn(21, 21), [\"left\"]),\n new Cell(new Posn(22, 21), []),\n new Cell(new Posn(23, 21), [\"down\"]),\n new Cell(new Posn(24, 21), [\"right\", \"down\"]),\n new Cell(new Posn(25, 21), [\"left\", \"right\"]),\n new Cell(new Posn(0, 22), [\"left\", \"down\"]),\n new Cell(new Posn(1, 22), [\"up\", \"down\"]),\n new Cell(new Posn(2, 22), [\"up\", \"right\"]),\n new Cell(new Posn(3, 22), [\"left\"]),\n new Cell(new Posn(4, 22), [\"right\"]),\n new Cell(new Posn(5, 22), [\"left\"]),\n new Cell(new Posn(6, 22), [\"up\", \"down\"]),\n new Cell(new Posn(7, 22), [\"up\", \"down\"]),\n new Cell(new Posn(8, 22), [\"up\"]),\n new Cell(new Posn(9, 22), [\"up\", \"down\"]),\n new Cell(new Posn(10, 22), [\"up\", \"down\"]),\n new Cell(new Posn(11, 22), [\"down\"]),\n new Cell(new Posn(12, 22), [\"up\", \"down\"]),\n new Cell(new Posn(13, 22), [\"up\", \"down\"]),\n new Cell(new Posn(14, 22), [\"down\"]),\n new Cell(new Posn(15, 22), [\"up\", \"down\"]),\n new Cell(new Posn(16, 22), [\"up\", \"down\"]),\n new Cell(new Posn(17, 22), [\"up\"]),\n new Cell(new Posn(18, 22), [\"up\", \"down\"]),\n new Cell(new Posn(19, 22), [\"up\", \"down\"]),\n new Cell(new Posn(20, 22), [\"right\"]),\n new Cell(new Posn(21, 22), [\"left\"]),\n new Cell(new Posn(22, 22), [\"right\"]),\n new Cell(new Posn(23, 22), [\"up\", \"left\"]),\n new Cell(new Posn(24, 22), [\"up\", \"down\"]),\n new Cell(new Posn(25, 22), [\"right\", \"down\"]),\n new Cell(new Posn(0, 23), [\"up\", \"left\"]),\n new Cell(new Posn(1, 23), [\"up\", \"right\"]),\n new Cell(new Posn(2, 23), [\"left\", \"right\"]),\n new Cell(new Posn(3, 23), [\"left\"]),\n new Cell(new Posn(4, 23), [\"right\"]),\n new Cell(new Posn(5, 23), [\"left\", \"right\"]),\n new Cell(new Posn(6, 23), [\"up\", \"left\"]),\n new Cell(new Posn(7, 23), [\"up\", \"right\"]),\n new Cell(new Posn(8, 23), [\"left\", \"right\"]),\n new Cell(new Posn(9, 23), [\"up\", \"left\"]),\n new Cell(new Posn(10, 23), [\"up\"]),\n new Cell(new Posn(11, 23), [\"up\"]),\n new Cell(new Posn(12, 23), [\"up\"]),\n new Cell(new Posn(13, 23), [\"up\"]),\n new Cell(new Posn(14, 23), [\"up\"]),\n new Cell(new Posn(15, 23), [\"up\"]),\n new Cell(new Posn(16, 23), [\"up\", \"right\"]),\n new Cell(new Posn(17, 23), [\"left\", \"right\"]),\n new Cell(new Posn(18, 23), [\"up\", \"left\"]),\n new Cell(new Posn(19, 23), [\"up\", \"right\"]),\n new Cell(new Posn(20, 23), [\"left\", \"right\"]),\n new Cell(new Posn(21, 23), [\"left\"]),\n new Cell(new Posn(22, 23), [\"right\"]),\n new Cell(new Posn(23, 23), [\"left\", \"right\"]),\n new Cell(new Posn(24, 23), [\"up\", \"left\"]),\n new Cell(new Posn(25, 23), [\"up\", \"right\"]),\n new Cell(new Posn(0, 24), [\"left\", \"down\"]),\n new Cell(new Posn(1, 24), [\"right\", \"down\"]),\n new Cell(new Posn(2, 24), [\"left\", \"right\"]),\n new Cell(new Posn(3, 24), [\"left\", \"down\"]),\n new Cell(new Posn(4, 24), [\"right\", \"down\"]),\n new Cell(new Posn(5, 24), [\"left\", \"right\"]),\n new Cell(new Posn(6, 24), [\"left\"]),\n new Cell(new Posn(7, 24), [\"right\"]),\n new Cell(new Posn(8, 24), [\"left\", \"right\"]),\n new Cell(new Posn(9, 24), [\"left\", \"down\"]),\n new Cell(new Posn(10, 24), [\"down\"]),\n new Cell(new Posn(11, 24), [\"down\"]),\n new Cell(new Posn(12, 24), []),\n new Cell(new Posn(13, 24), []),\n new Cell(new Posn(14, 24), [\"down\"]),\n new Cell(new Posn(15, 24), [\"down\"]),\n new Cell(new Posn(16, 24), [\"right\", \"down\"]),\n new Cell(new Posn(17, 24), [\"left\", \"right\"]),\n new Cell(new Posn(18, 24), [\"left\"]),\n new Cell(new Posn(19, 24), [\"right\"]),\n new Cell(new Posn(20, 24), [\"left\", \"right\"]),\n new Cell(new Posn(21, 24), [\"left\", \"down\"]),\n new Cell(new Posn(22, 24), [\"right\", \"down\"]),\n new Cell(new Posn(23, 24), [\"left\", \"right\"]),\n new Cell(new Posn(24, 24), [\"left\", \"down\"]),\n new Cell(new Posn(25, 24), [\"right\", \"down\"]),\n new Cell(new Posn(0, 25), [\"up\", \"left\"]),\n new Cell(new Posn(1, 25), [\"up\", \"down\"]),\n new Cell(new Posn(2, 25), [\"down\"]),\n new Cell(new Posn(3, 25), [\"up\", \"down\"]),\n new Cell(new Posn(4, 25), [\"up\", \"down\"]),\n new Cell(new Posn(5, 25), [\"right\", \"down\"]),\n new Cell(new Posn(6, 25), [\"left\"]),\n new Cell(new Posn(7, 25), [\"right\"]),\n new Cell(new Posn(8, 25), [\"left\", \"down\"]),\n new Cell(new Posn(9, 25), [\"up\", \"down\"]),\n new Cell(new Posn(10, 25), [\"up\", \"down\"]),\n new Cell(new Posn(11, 25), [\"up\", \"right\"]),\n new Cell(new Posn(12, 25), [\"left\"]),\n new Cell(new Posn(13, 25), [\"right\"]),\n new Cell(new Posn(14, 25), [\"up\", \"left\"]),\n new Cell(new Posn(15, 25), [\"up\", \"down\"]),\n new Cell(new Posn(16, 25), [\"up\", \"down\"]),\n new Cell(new Posn(17, 25), [\"right\", \"down\"]),\n new Cell(new Posn(18, 25), [\"left\"]),\n new Cell(new Posn(19, 25), [\"right\"]),\n new Cell(new Posn(20, 25), [\"left\", \"down\"]),\n new Cell(new Posn(21, 25), [\"up\", \"down\"]),\n new Cell(new Posn(22, 25), [\"up\", \"down\"]),\n new Cell(new Posn(23, 25), [\"down\"]),\n new Cell(new Posn(24, 25), [\"up\", \"down\"]),\n new Cell(new Posn(25, 25), [\"up\", \"right\"]),\n new Cell(new Posn(0, 26), [\"left\", \"right\"]),\n new Cell(new Posn(1, 26), [\"up\", \"left\"]),\n new Cell(new Posn(2, 26), [\"up\"]),\n new Cell(new Posn(3, 26), [\"up\"]),\n new Cell(new Posn(4, 26), [\"up\"]),\n new Cell(new Posn(5, 26), [\"up\"]),\n new Cell(new Posn(6, 26), []),\n new Cell(new Posn(7, 26), []),\n new Cell(new Posn(8, 26), [\"up\"]),\n new Cell(new Posn(9, 26), [\"up\"]),\n new Cell(new Posn(10, 26), [\"up\", \"right\"]),\n new Cell(new Posn(11, 26), [\"left\", \"right\"]),\n new Cell(new Posn(12, 26), [\"left\"]),\n new Cell(new Posn(13, 26), [\"right\"]),\n new Cell(new Posn(14, 26), [\"left\", \"right\"]),\n new Cell(new Posn(15, 26), [\"up\", \"left\"]),\n new Cell(new Posn(16, 26), [\"up\"]),\n new Cell(new Posn(17, 26), [\"up\"]),\n new Cell(new Posn(18, 26), []),\n new Cell(new Posn(19, 26), []),\n new Cell(new Posn(20, 26), [\"up\"]),\n new Cell(new Posn(21, 26), [\"up\"]),\n new Cell(new Posn(22, 26), [\"up\"]),\n new Cell(new Posn(23, 26), [\"up\"]),\n new Cell(new Posn(24, 26), [\"up\", \"right\"]),\n new Cell(new Posn(25, 26), [\"left\", \"right\"]),\n new Cell(new Posn(0, 27), [\"left\", \"right\"]),\n new Cell(new Posn(1, 27), [\"left\", \"down\"]),\n new Cell(new Posn(2, 27), [\"down\"]),\n new Cell(new Posn(3, 27), [\"down\"]),\n new Cell(new Posn(4, 27), [\"down\"]),\n new Cell(new Posn(5, 27), [\"down\"]),\n new Cell(new Posn(6, 27), [\"down\"]),\n new Cell(new Posn(7, 27), [\"down\"]),\n new Cell(new Posn(8, 27), [\"down\"]),\n new Cell(new Posn(9, 27), [\"down\"]),\n new Cell(new Posn(10, 27), [\"right\", \"down\"]),\n new Cell(new Posn(11, 27), [\"left\", \"right\"]),\n new Cell(new Posn(12, 27), [\"left\", \"down\"]),\n new Cell(new Posn(13, 27), [\"right\", \"down\"]),\n new Cell(new Posn(14, 27), [\"left\", \"right\"]),\n new Cell(new Posn(15, 27), [\"left\", \"down\"]),\n new Cell(new Posn(16, 27), [\"down\"]),\n new Cell(new Posn(17, 27), [\"down\"]),\n new Cell(new Posn(18, 27), [\"down\"]),\n new Cell(new Posn(19, 27), [\"down\"]),\n new Cell(new Posn(20, 27), [\"down\"]),\n new Cell(new Posn(21, 27), [\"down\"]),\n new Cell(new Posn(22, 27), [\"down\"]),\n new Cell(new Posn(23, 27), [\"down\"]),\n new Cell(new Posn(24, 27), [\"right\", \"down\"]),\n new Cell(new Posn(25, 27), [\"left\", \"right\"]),\n new Cell(new Posn(0, 28), [\"left\", \"down\"]),\n new Cell(new Posn(1, 28), [\"up\", \"down\"]),\n new Cell(new Posn(2, 28), [\"up\", \"down\"]),\n new Cell(new Posn(3, 28), [\"up\", \"down\"]),\n new Cell(new Posn(4, 28), [\"up\", \"down\"]),\n new Cell(new Posn(5, 28), [\"up\", \"down\"]),\n new Cell(new Posn(6, 28), [\"up\", \"down\"]),\n new Cell(new Posn(7, 28), [\"up\", \"down\"]),\n new Cell(new Posn(8, 28), [\"up\", \"down\"]),\n new Cell(new Posn(9, 28), [\"up\", \"down\"]),\n new Cell(new Posn(10, 28), [\"up\", \"down\"]),\n new Cell(new Posn(11, 28), [\"down\"]),\n new Cell(new Posn(12, 28), [\"up\", \"down\"]),\n new Cell(new Posn(13, 28), [\"up\", \"down\"]),\n new Cell(new Posn(14, 28), [\"down\"]),\n new Cell(new Posn(15, 28), [\"up\", \"down\"]),\n new Cell(new Posn(16, 28), [\"up\", \"down\"]),\n new Cell(new Posn(17, 28), [\"up\", \"down\"]),\n new Cell(new Posn(18, 28), [\"up\", \"down\"]),\n new Cell(new Posn(19, 28), [\"up\", \"down\"]),\n new Cell(new Posn(20, 28), [\"up\", \"down\"]),\n new Cell(new Posn(21, 28), [\"up\", \"down\"]),\n new Cell(new Posn(22, 28), [\"up\", \"down\"]),\n new Cell(new Posn(23, 28), [\"up\", \"down\"]),\n new Cell(new Posn(24, 28), [\"up\", \"down\"]),\n new Cell(new Posn(25, 28), [\"right\", \"down\"])\n ];\n}", "function squareCornerWin(){\n}", "initBoard () {\n\t\tthis.clearBoard();\n\t\t/* Init piece-list */\n\t\t/* White */\n\t\tthis.pieces = [\n\t\t\tnew Lance(COLOR.WHITE, position.toIdx(1, 'a')),\n\t\t\tnew Knight(COLOR.WHITE, position.toIdx(2, 'a')),\n\t\t\tnew Silver(COLOR.WHITE, position.toIdx(3, 'a')),\n\t\t\tnew Gold(COLOR.WHITE, position.toIdx(4, 'a')),\n\t\t\tnew King(COLOR.WHITE, position.toIdx(5, 'a')),\n\t\t\tnew Gold(COLOR.WHITE, position.toIdx(6, 'a')),\n\t\t\tnew Silver(COLOR.WHITE, position.toIdx(7, 'a')),\n\t\t\tnew Knight(COLOR.WHITE, position.toIdx(8, 'a')),\n\t\t\tnew Lance(COLOR.WHITE, position.toIdx(9, 'a')),\n\t\t\tnew Rook(COLOR.WHITE, position.toIdx(2, 'b')),\n\t\t\tnew Bishop(COLOR.WHITE, position.toIdx(8, 'b')),\n\t\t];\n\t\tfor (let i = 1; i <= NUM_COLS; i++) {\n\t\t\tthis.pieces.push(new Pawn(COLOR.WHITE, position.toIdx(i, 'c')));\n\t\t}\n\t\t/* Black */\n\t\tthis.pieces = this.pieces.concat([\n\t\t\tnew Lance(COLOR.BLACK, position.toIdx(1, 'i')),\n\t\t\tnew Knight(COLOR.BLACK, position.toIdx(2, 'i')),\n\t\t\tnew Silver(COLOR.BLACK, position.toIdx(3, 'i')),\n\t\t\tnew Gold(COLOR.BLACK, position.toIdx(4, 'i')),\n\t\t\tnew King(COLOR.BLACK, position.toIdx(5, 'i')),\n\t\t\tnew Gold(COLOR.BLACK, position.toIdx(6, 'i')),\n\t\t\tnew Silver(COLOR.BLACK, position.toIdx(7, 'i')),\n\t\t\tnew Knight(COLOR.BLACK, position.toIdx(8, 'i')),\n\t\t\tnew Lance(COLOR.BLACK, position.toIdx(9, 'i')),\n\t\t\tnew Rook(COLOR.BLACK, position.toIdx(2, 'h')),\n\t\t\tnew Bishop(COLOR.BLACK, position.toIdx(8, 'h')),\n\t\t]);\n\t\tfor (let i = 1; i <= NUM_COLS; i++) {\n\t\t\tthis.pieces.push(new Pawn(COLOR.BLACK, position.toIdx(i, 'g')));\n\t\t}\n\n\t\t/* Put pieces on board */\n\t\tthis.pieces.forEach((piece) => {\n\t\t\tthis.putPiece(piece, piece.pos);\n\t\t});\n\t}", "function drawCanyon(t_canyon)\n{\n fill(0, 0, 255);\n rect(t_canyon.x_pos, floorPos_y, t_canyon.width, height - floorPos_y); \n}", "show() {\n let colorIdx = (this.x + this.y) % 2 // checkerboard pattern for board tiles\n fill(this.color[colorIdx]);\n noStroke();\n rectMode(CORNER);\n rect(this.x * TILE_SIZE, this.y * TILE_SIZE, TILE_SIZE, TILE_SIZE);\n }", "topLeftCell() {\n return \n }", "function drawBoard() {\n\t// Background grid.\n\tctx.drawImage(backgroundImg, 0, 0, 320, 640, 0, 0, 320, 640);\n\t\n\t// Drawing the \"stationary\" already stopped blocks from game data.\n\tfor(var r = 0; r < rows; r++) {\n\t\tfor(var c = 0; c < columns; c++) {\n\t\t\tif(gameData[r][c] != 0) {\n\t\t\t\tctx.drawImage(blockImg, (gameData[r][c] - 1) * size, 0, size, size, c * size, r * size, size, size);\n\t\t\t}\n\t\t}\n\t}\n}", "function v(){var t=W.getBoundingClientRect(),e=\"offset\"+[\"Width\",\"Height\"][i.ort];return 0===i.ort?t.width||W[e]:t.height||W[e]}", "function drawMiniBoardAtPosition(x, y){\n \tvar c = document.getElementById(\"canvas_1\");\n \tvar ctx = c.getContext(\"2d\");\n\n \tvar starting_corner = 25;\n \tvar ending_corner = 475;\n \tvar bigboard_width = 150;\n \tvar smallboard_width = 50;\n \tvar smallboard_offset = 10;\n \tctx.strokeStyle=\"#000000\"; //all black\n ctx.lineWidth = 1;\n //Draw the first smaller board in the upper, left corner\n ctx.moveTo(starting_corner + smallboard_width + (x * bigboard_width), \n starting_corner + smallboard_offset + (y * bigboard_width));\n ctx.lineTo(starting_corner + smallboard_width + (x * bigboard_width), \n starting_corner + 3 * smallboard_width - smallboard_offset + (y * bigboard_width));\n ctx.stroke();\n ctx.moveTo(starting_corner + 2 * smallboard_width + (x * bigboard_width), \n starting_corner + smallboard_offset + (y * bigboard_width));\n ctx.lineTo(starting_corner + 2 * smallboard_width + (x * bigboard_width), \n starting_corner + 3 * smallboard_width - smallboard_offset + (y * bigboard_width));\n ctx.stroke();\n ctx.moveTo(starting_corner + smallboard_offset + (x * bigboard_width), \n starting_corner + smallboard_width + (y * bigboard_width));\n ctx.lineTo(starting_corner + 3 * smallboard_width - smallboard_offset + (x * bigboard_width), \n starting_corner + smallboard_width + (y * bigboard_width));\n ctx.stroke();\n ctx.moveTo(starting_corner + smallboard_offset + (x * bigboard_width), \n starting_corner + 2 * smallboard_width + (y * bigboard_width));\n ctx.lineTo(starting_corner + 3 * smallboard_width - smallboard_offset + (x * bigboard_width), \n starting_corner + 2 * smallboard_width + (y * bigboard_width));\n ctx.stroke();\n\t }", "function drawTile0() {\n ctx.clearRect(25, 125, 65, 70);\n ctx.fillStyle = palette[2][0];\n ctx.fillRect(25, 125, 65, 70)\n }", "function detectNextBlock_CornerDownRight (x,y,h,w)\n {\n var mapCoordY = (y + h)/ h;\n var mapCoordX = (x + w) / w;\n \n \n \n mapCoordX = Math.floor(mapCoordX);\n mapCoordY = Math.floor(mapCoordY);\n \n return map[mapCoordY-1][mapCoordX-1];\n }", "function drawHoldPieceBoard(holdBoard) {\n for(var i = 0; i < 3; i++)\n for(var j = 0;j < 7; j++)\n drawPixelHold( j, i, holdBoard[i][j]);\n}", "drawBoard() {\n for (let y = 0; y < this.tetris.board.height; y++) {\n for (let x = 0; x < this.tetris.board.width; x++) {\n let id = this.tetris.board.getCell(x, y);\n if (id !== this.tetris.board.EMPTY) {\n this.drawBlock(this.ctxGame, id, x * this.size, y * this.size);\n }\n }\n }\n }", "geoLayout() {\n this.pieces.forEach((row, i) => row.forEach((piece, j) => {\n let x, y;\n if (i <= Math.floor(this.pieces.length / 2)) {\n x = i * -1 / 2 + j * 1;\n\n } else {\n x = -Math.floor(this.pieces.length / 2) / 2 + (i - Math.floor(this.pieces.length / 2)) / 2 + j * 1;\n\n }\n y = i * Math.sqrt(3) / 2;\n\n piece.geoPoint = new Point(x, y);\n }));\n }", "function c_screen(logical)\n{\n // '1 -' because computer display coords are upside down ^_^\n return ((1 - logical) * CHART_HEIGHT)>>0;\n}", "getMiddleCell() {\n return Math.round(this.boardSize / 2);\n }", "function color_starting_square(ctx, num_canvas_cells, x_offset, y_offset)\r\n{\r\n ctx.save( );\r\n ctx.fillStyle = 'black';\r\n\r\n // rect(the x cord in the upper left corner, the y cord of the upper left rect, width, height)\r\n ctx.rect(x_offset + ((Math.floor(num_canvas_cells / 2) - 1) * 5), y_offset, 5, 5);\r\n ctx.fill();\r\n ctx.restore( );\r\n}", "function drawLanes() {\r\n\tfill(80);\r\n\trect(0, 0, 5, height);\r\n\trect(55, 0, 5, height);\r\n\trect(110, 0, 5, height);\r\n\trect(165, 0, 5, height);\r\n\trect(220, 0, 5, height);\r\n}", "function drawBoard(board) {\n\tvar windowHeight = Math.ceil($('#world').height());\n\tvar windowWidth = Math.ceil($('#world').width());\n\tvar cellHeight = Math.ceil(windowHeight / getHeight(board));\n\tvar cellWidth = Math.ceil(windowWidth / getWidth(board));\n\tvar canvasContext = document.getElementById('world').getContext('2d');\n\tcanvasContext.canvas.width = windowWidth;\n\tcanvasContext.canvas.height = windowHeight;\n\tfor (var i = 0; i < getHeight(board); i++) {\n\t\tfor (var j = 0; j < getWidth(board); j++) {\n\t\t\tif (board[j][i] === 0) {\n\t\t\t\tcanvasContext.fillStyle = 'rgb(255,255,255)';\n\t\t\t\tcanvasContext.fillRect(\n\t\t\t\t\tj * cellWidth, i * cellHeight, cellWidth, cellHeight);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcanvasContext.fillStyle = 'rgb(0,0,0)';\n\t\t\t\tcanvasContext.fillRect(\n\t\t\t\t\tj * cellWidth, i * cellHeight, cellWidth, cellHeight);\n\t\t\t}\n\t\t}\n\t}\n}", "function initiateBoard(){\n\tblankx=wid-1;\n\tblanky=height-1;\n\tfor(i=0;i<=numTiles;i++) position[i]=i;\n}", "wallDetect(){\r\n if(this.x + this.width > WIDTH){\r\n this.x = WIDTH - this.width; // direita\r\n }\r\n if(this.x < 0){\r\n this.x = 0; // esquerda\r\n }\r\n }", "function createTopLeftTurn(xpos, ypos) { //creates a top left angled corner for a turn\r\n color(\"light_green\")\r\n char(\"e\", xpos, ypos + 12);\r\n char(\"e\", xpos + 6, ypos + 6);\r\n char(\"e\", xpos + 12, ypos);\r\n char(\"d\", xpos + 6, ypos + 12);\r\n char(\"d\", xpos + 12, ypos + 6);\r\n char(\"d\", xpos + 12, ypos + 12);\r\n turnHelper(xpos, ypos);\r\n}", "function drawCanyon(t_canyon)\n{\n fill(100, 155, 255); \n rect(t_canyon.x_pos, floorPos_y, t_canyon.width,(height-floorPos_y));\n}", "function generateLowerLeft(x,y){\r\n var x = floor(random(ppg.width/2));\r\n var y = floor(random(ppg.height/2));\r\n var maxX=width/2;\r\n var maxY=height/2;\r\n for (i=0; i<=21;i++){\r\n x+=1;\r\n y+=1;\r\n maxX=maxX-x;\r\n maxY=maxY+y;\r\n let pixelN = ppg.get((width/2)-x , (height/2)+y);\r\n fill(pixelN);\r\n noStroke();\r\n rect(maxX, maxY,12, 7);\r\n }\r\n}", "function detectNextBlock_CurrentLeftUp(x,y,h,w)\n {\n var mapCoordY = (y)/ h;\n var mapCoordX = (x) / w;\n \n mapCoordX = Math.floor(mapCoordX);\n mapCoordY = Math.floor(mapCoordY);\n \n return map[mapCoordY-1][mapCoordX-1]; \n }", "function displayBoard(board) {\n for (let i = 0; i < 4; i++) {\n const xVal = (i + 1) * 50;\n for (let j = 0; j < 4; j++) {\n const yVal = j * 50 + 50;\n if (board[4 * j + i] === \"blank\") {\n gameState.tiles.create(xVal, yVal, board[4 * j + i]).setScale(0.6);\n } else {\n gameState.tiles.create(xVal, yVal, board[4 * j + i]);\n }\n }\n }\n}", "function drawPiece(context, piece, pos, maxHeight){\n var drawX, drawY;\n context.fillStyle = piece.color;\n for(var y = 0;y < piece.shape.length;y++){\n for(var x = 0;x < piece.shape[y].length;x++){\n if(piece.shape[y][x] != 0){\n // console.log(\"p1.shape[\" + i + \"][\" + j + \"]=\" + piece.shape[i][j]);\n drawX = (x + pos.x)*UNIT_SIZE;\n drawY = (maxHeight - 1 - (y + pos.y))*UNIT_SIZE;\n context.fillRect(drawX, drawY, UNIT_SIZE, UNIT_SIZE);\n context.strokeRect(drawX, drawY, UNIT_SIZE, UNIT_SIZE);\n }\n }\n }\n}", "function west(n) {\n var level = bottoms[n];\n var count = 0;\n\n for (var i = 1; (n - i) >= 0; i++) {\n var square = document.getElementsByClassName(\"row\").item(level)\n .getElementsByClassName(\"bigSquare\").item(n - i);\n if (square.style.backgroundColor == color(currentTurn)) {\n count++;\n }\n else return count;\n }\n return count;\n }", "function S(){var e=le.getBoundingClientRect(),t=\"offset\"+[\"Width\",\"Height\"][n.ort];return 0===n.ort?e.width||le[t]:e.height||le[t]}", "function W(){var t=l.getBoundingClientRect(),e=\"offset\"+[\"Width\",\"Height\"][i.ort];return 0===i.ort?t.width||l[e]:t.height||l[e]}", "constructor(board,width,height){ \n this.width=40;\n this.height=50;\n this.x=width/6;\n this.y=3*height/5-this.height;\n this.xspeed=0;\n this.yspeed=0;\n this.gravity=0.0;\n this.image=new Image();\n \n \n }", "function northeast(n) {\n var level = bottoms[n];\n var count = 0;\n\n for (var i = 1; ((n + i) <= 6) && ((level - i) >= 0); i++) {\n var square = document.getElementsByClassName(\"row\").item(level - i)\n .getElementsByClassName(\"bigSquare\").item(n + i);\n if (square.style.backgroundColor == color(currentTurn)) {\n count++;\n }\n else return count;\n }\n return count;\n }", "function detectNextBlock_CurrentLeftDown(x,y,h,w)\n {\n var mapCoordY = (y + h -1)/ h;\n var mapCoordX = (x) / w;\n \n mapCoordX = Math.floor(mapCoordX);\n mapCoordY = Math.floor(mapCoordY);\n \n return map[mapCoordY-1][mapCoordX-1]; \n }", "function boardposition(){ \n\t\t\t\tp = slider.position();\n\t\t\t\tboardLeft = p.left;\n\t\t\t\tboardTop = p.top;\n\t\t}", "check_piece_top(x, y) {\n return (y !== 0);\n }", "function myMove(e) {\n x = e.pageX - canvas.offsetLeft;\n y = e.pageY - canvas.offsetTop;\n\n for (c = 0; c < tileColumnCount; c++) {\n for (r = 0; r < tileRowCount; r++) {\n if (c * (tileW + 3) < x && x < c * (tileW + 3) + tileW && r * (tileH + 3) < y && y < r * (tileH + 3) + tileH) {\n if (tiles[c][r].state == \"e\" && (c != boundX || r != boundY)) {\n tiles[c][r].state = \"w\";\n\n boundX = c;\n boundY = r;\n\n }\n else if (tiles[c][r].state == \"w\" && (c != boundX || r != boundY)) {\n tiles[c][r].state = \"e\";\n\n boundX = c;\n boundY = r;\n\n }\n }\n }\n }\n}", "function generateBrickTop() {\n let row = 12;\n for(let i = 1; i <= canvas.width; i++) {\n ctx.fillStyle = '#000';\n ctx.save();\n ctx.fillRect((6 + row)*i, 0, 2, 6);\n ctx.fillRect((0 + row)*i, 6, 2, 6);\n ctx.fillRect((6 + row)*i, 12, 2, 6);\n }\n }", "function drawBoard()\n{\n\tfor(let i = 0; i < 7; i++)\n\t{\n\t\tfor(let j = 0; j < 6; j++)\n\t\t{\n\t\t\tif(allChips[i][j] == 0)\n\t\t\t{\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.fillStyle = 'white';\n\t\t\t\tctx.arc((40+50*i), (40+50*j), 20, 0, 2 * Math.PI);\n\t\t\t\tctx.fill();\n\t\t\t\tctx.stroke();\n\t\t\t}\n\t\t\telse if(allChips[i][j] == 1)\n\t\t\t{\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.fillStyle = 'red';\n\t\t\t\tctx.arc((40+50*i), (40+50*j), 20, 0, 2 * Math.PI);\n\t\t\t\tctx.fill();\t\t\t}\n\t\t\telse //allChips[i][j] == 2\n\t\t\t{\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.fillStyle = 'yellow';\n\t\t\t\tctx.arc((40+50*i), (40+50*j), 20, 0, 2 * Math.PI);\n\t\t\t\tctx.fill();\n\t\t\t}\n\t\t}\n\t}\n}", "function drawCanyon(t_canyon)\n{\n fill(11, 27, 13);\n rect(t_canyon.x_Pos,t_canyon.y_Pos,t_canyon.width,floorPos_y);\n}", "function addZero(){\n ctx.beginPath();\n ctx.moveTo((width/2), height-((rows-1)*step));\n ctx.lineTo(width, height-(step*rows));\n ctx.stroke();\n }", "function identifyBoardRegion(index){\n\t\t\ttraversalIndex = index % COLS;\n\n\t\t\tif(index === 0){\n\t\t\t\treturn(\"TOP-LEFT CORNER\");\n\t\t\t}\n\n\t\t\telse if(index === (COLS-1) ){\n\t\t\t\treturn(\"BOTTOM-LEFT CORNER\");\n\t\t\t}\n\n\t\t\telse if(index === ((ROWS-1)*COLS) ){\n\t\t\t\treturn(\"TOP-RIGHT CORNER\");\n\t\t\t}\n\n\t\t\telse if(index === ((ROWS*COLS)-1)){\n\t\t\t\treturn(\"BOTTOM-RIGHT CORNER\")\n\t\t\t}\n\n\t \t\telse if(traversalIndex === 0){\n\t \t\t\treturn(\"TOP ROW\");\n\t \t\t}\n\t \t\telse if(traversalIndex === (COLS-1)){\n\t \t\t\treturn(\"BOTTOM ROW\");\n\t \t\t}\n\n\t \t\telse if(index < COLS){\n\t \t\t\treturn(\"LEFT COLUMN\");\n\t \t\t}\n\n\t \t\telse if(index > ((ROWS-1)*COLS )){\n\t \t\t\treturn(\"RIGHT COLUMN\");\n\t \t\t}\n\t \t\telse{\n\t \t\t\treturn(\"INNER-SQUARE\");\n\t \t\t}\n\n\t\t}", "function detectNextBlock_UpLeft (x,y,h,w)\n {\n var mapCoordY = (y - 1)/ h;\n var mapCoordX = (x ) / w;\n \n mapCoordX = Math.floor(mapCoordX);\n mapCoordY = Math.floor(mapCoordY);\n \n return map[mapCoordY-1][mapCoordX-1];\n \n }", "getKingZone([x, y], color) {\n if (color == 'w') {\n if (y >= 4) return -1; //\"out of zone\"\n if (y == 3 && [5, 6].includes(x)) return 0;\n if (x == 6) return 1;\n if (x == 5) return 2;\n if (x == 4) return 3;\n if (x == 3 || y == 0) return 4;\n if (y == 1) return 5;\n if (x == 0 || y == 2) return 6;\n return 7; //x == 1 && y == 3\n }\n // color == 'b':\n if (y <= 2) return -1; //\"out of zone\"\n if (y == 3 && [0, 1].includes(x)) return 0;\n if (x == 0) return 1;\n if (x == 1) return 2;\n if (x == 2) return 3;\n if (x == 3 || y == 6) return 4;\n if (y == 5) return 5;\n if (x == 6 || y == 4) return 6;\n return 7; //x == 5 && y == 3\n }", "function move(piece) {\r\n\t// store initial position of the piece in integers\r\n\tvar row = parseInt(piece.style.top);\r\n\tvar col = parseInt(piece.style.left);\r\n\t// set final position of the piece as the position of the empty square\r\n\tpiece.style.left = EMPTYCOL*TILESIZE+\"px\";\r\n\tpiece.style.top = EMPTYROW*TILESIZE+\"px\";\r\n\t// set position of the empty square to the moved piece's initial position\r\n\tEMPTYROW = row/TILESIZE;\r\n\tEMPTYCOL = col/TILESIZE;\r\n\t// extra feature: see if the move solves the puzzle\r\n\tsolve();\r\n}", "function detectNextBlock_CurrentRightUp(x,y,h,w)\n {\n var mapCoordY = (y)/ h;\n var mapCoordX = (x + w -1) / w;\n \n mapCoordX = Math.floor(mapCoordX);\n mapCoordY = Math.floor(mapCoordY);\n \n return map[mapCoordY-1][mapCoordX-1]; \n }", "function showZeros() {\n\t\tctx.beginPath();\n\t\tctx.fillStyle = \"cornflowerblue\";\n\t\tctx.arc(0, 0, 5, 0, Math.PI * 2); // drawing circle around x/y - upper left corner\n\t\tctx.fill();\n\t\tctx.stroke();\n\t\tctx.closePath();\n\t}", "_drawPiece(piece, origin, squareWidth) {\n\t\tlet center = {\n\t\t\tx: origin.x + Math.floor(squareWidth / 2),\n\t\t\ty: origin.y + Math.floor(squareWidth / 2)\n\t\t}\n\t\tthis._ctx.fillStyle = 'black';\n\t\tif (piece.type === 'p') { // pawns\n\t\t\tlet rad = Math.floor(squareWidth / 4);\n\t\t\tthis._ctx.beginPath();\n\t\t\tthis._ctx.arc(center.x, center.y, rad, 0, Math.PI * 2);\n\t\t\tif (piece.color === 'b') {\n\t\t\t\tthis._ctx.fill();\n\t\t\t} else {\n\t\t\t\tthis._ctx.lineWidth = this._lineWidth;\n\t\t\t\tthis._ctx.stroke();\n\t\t\t}\n\t\t} else if (piece.type === 'n') { // knights\n\t\t\tthis._ctx.beginPath();\n\t\t\t// left ear\n\t\t\tthis._ctx.moveTo(\n\t\t\t\tcenter.x - (squareWidth / 4),\n\t\t\t\tcenter.y - (squareWidth / 3)\n\t\t\t);\n\t\t\t// central crevice\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x, center.y - (squareWidth / 6)\n\t\t\t)\n\t\t\t// right ear\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x + (squareWidth / 4),\n\t\t\t\tcenter.y - (squareWidth / 3)\n\t\t\t);\n\t\t\t// right eye\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x + (squareWidth / 4),\n\t\t\t\tcenter.y,\n\t\t\t);\n\t\t\t// right mouth\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x + (squareWidth / 8),\n\t\t\t\tcenter.y + (squareWidth / 3)\n\t\t\t);\n\t\t\t// left mouth\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x - (squareWidth / 8),\n\t\t\t\tcenter.y + (squareWidth / 3)\n\t\t\t);\n\t\t\t// left eye\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x - (squareWidth / 4),\n\t\t\t\tcenter.y,\n\t\t\t);\n\t\t\tif (piece.color === 'b') {\n\t\t\t\tthis._ctx.fill();\n\t\t\t} else {\n\t\t\t\tthis._ctx.lineWidth = this._lineWidth;\n\t\t\t\tthis._ctx.closePath();\n\t\t\t\tthis._ctx.stroke();\n\t\t\t}\n\t\t} else if (piece.type === 'r') { // rooks\n\t\t\tlet length = squareWidth / 3;\n\t\t\tlet height = length * 2;\n\t\t\tif (piece.color === 'b') {\n\t\t\t\tthis._ctx.fillRect(\n\t\t\t\t\tcenter.x - (length / 2),\n\t\t\t\t\tcenter.y - (height / 2),\n\t\t\t\t\tlength,\n\t\t\t\t\theight\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tthis._ctx.lineWidth = this._lineWidth;\n\t\t\t\tthis._ctx.strokeRect(\n\t\t\t\t\tcenter.x - (length / 2),\n\t\t\t\t\tcenter.y - (height / 2),\n\t\t\t\t\tlength,\n\t\t\t\t\theight\n\t\t\t\t);\n\t\t\t}\n\t\t} else if (piece.type === 'b') { // bishops\n\t\t\tthis._ctx.beginPath();\n\t\t\tthis._ctx.moveTo(\n\t\t\t\tcenter.x,\n\t\t\t\tcenter.y - (squareWidth / 3)\n\t\t\t);\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x + (squareWidth / 4),\n\t\t\t\tcenter.y + (squareWidth / 3)\n\t\t\t);\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x - (squareWidth / 4),\n\t\t\t\tcenter.y + (squareWidth / 3)\n\t\t\t);\n\t\t\tif (piece.color === 'b') {\n\t\t\t\tthis._ctx.fill();\n\t\t\t} else {\n\t\t\t\tthis._ctx.lineWidth = this._lineWidth;\n\t\t\t\tthis._ctx.closePath();\n\t\t\t\tthis._ctx.stroke();\n\t\t\t}\n\t\t} else if (piece.type === 'k') { // kings\n\t\t\tthis._ctx.beginPath();\n\t\t\t// left spike\n\t\t\tthis._ctx.moveTo(\n\t\t\t\tcenter.x - (squareWidth / 3),\n\t\t\t\tcenter.y - (squareWidth / 3),\n\t\t\t);\n\t\t\t// central crevice\n\t\t\tthis._ctx.lineTo(center.x, center.y);\n\t\t\t// right spike\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x + (squareWidth / 3),\n\t\t\t\tcenter.y - (squareWidth / 3),\n\t\t\t);\n\t\t\t// right base\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x + (squareWidth / 3),\n\t\t\t\tcenter.y + (squareWidth / 3)\n\t\t\t);\n\t\t\t// left base\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x - (squareWidth / 3),\n\t\t\t\tcenter.y + (squareWidth / 3)\n\t\t\t);\n\t\t\tif (this._model.turn == piece.color) {\n\t\t\t\tthis._ctx.strokeStyle = 'red';\n\t\t\t\tthis._ctx.fillStyle = 'red';\n\t\t\t}\n\t\t\tif (piece.color === 'b') {\n\t\t\t\tthis._ctx.fill();\n\t\t\t} else {\n\t\t\t\tthis._ctx.lineWidth = this._lineWidth;\n\t\t\t\tthis._ctx.closePath();\n\t\t\t\tthis._ctx.stroke();\n\t\t\t}\n\t\t\t// jewel\n\t\t\tthis._ctx.beginPath();\n\t\t\tthis._ctx.arc(\n\t\t\t\tcenter.x,\n\t\t\t\tcenter.y - (squareWidth / 4),\n\t\t\t\tMath.floor(squareWidth / 8),\n\t\t\t\t0,\n\t\t\t\tMath.PI * 2\n\t\t\t);\n\t\t\tif (piece.color === 'b') {\n\t\t\t\tthis._ctx.fill();\n\t\t\t} else {\n\t\t\t\tthis._ctx.lineWidth = this._lineWidth;\n\t\t\t\tthis._ctx.stroke();\n\t\t\t}\n\t\t\tthis._ctx.strokeStyle = 'black';\n\t\t\tthis._ctx.fillStyle = 'black';\n\t\t} else if (piece.type === 'q') { // queens\n\t\t\tthis._ctx.beginPath();\n\t\t\t// left spike\n\t\t\tthis._ctx.moveTo(\n\t\t\t\tcenter.x - (squareWidth / 3),\n\t\t\t\tcenter.y - (squareWidth / 8),\n\t\t\t);\n\t\t\t// left crevice\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x - (squareWidth / 6),\n\t\t\t\tcenter.y\n\t\t\t);\n\t\t\t// central spike\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x,\n\t\t\t\tcenter.y - (squareWidth / 3),\n\t\t\t);\n\t\t\t// right crevice\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x + (squareWidth / 6),\n\t\t\t\tcenter.y\n\t\t\t);\n\t\t\t// right spike\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x + (squareWidth / 3),\n\t\t\t\tcenter.y - (squareWidth / 8)\n\t\t\t);\n\t\t\t// right base\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x + (squareWidth / 4),\n\t\t\t\tcenter.y + (squareWidth / 3)\n\t\t\t);\n\t\t\t// left base\n\t\t\tthis._ctx.lineTo(\n\t\t\t\tcenter.x - (squareWidth / 4),\n\t\t\t\tcenter.y + (squareWidth / 3)\n\t\t\t)\n\t\t\tif (piece.color === 'b') {\n\t\t\t\tthis._ctx.fill();\n\t\t\t} else {\n\t\t\t\tthis._ctx.lineWidth = this._lineWidth;\n\t\t\t\tthis._ctx.closePath();\n\t\t\t\tthis._ctx.stroke();\n\t\t\t}\n\t\t} else {\n\t\t\tthrow Error(`No drawing handler for piece of type: ${piece.type}`)\n\t\t}\n\n\t}", "checkSurroundingArea(theRow, theCol, theBoard) {\n\n let temp = [];\n let { rows, cols } = this.props;\n\n /* up */\n if (theRow > 0) {\n temp.push(theBoard[theRow - 1][theCol]);\n }\n\n /* down */\n if (theRow < rows - 1) {\n temp.push(theBoard[theRow + 1][theCol]);\n }\n\n /* left */\n if (theCol > 0) {\n temp.push(theBoard[theRow][theCol - 1]);\n }\n\n /* right */\n if (theCol < cols - 1) {\n temp.push(theBoard[theRow][theCol + 1]);\n }\n\n /* up left */\n if (theRow > 0 && theCol > 0) {\n temp.push(theBoard[theRow - 1][theCol - 1]);\n }\n\n /* up right */\n if (theRow > 0 && theCol < cols - 1) {\n temp.push(theBoard[theRow - 1][theCol + 1]);\n }\n\n /* down left */\n if (theRow < rows - 1 && theCol > 0) {\n temp.push(theBoard[theRow + 1][theCol - 1]);\n }\n\n /* down right */\n if (theRow < rows - 1 && theCol < cols - 1) {\n temp.push(theBoard[theRow + 1][theCol + 1]);\n }\n\n return temp;\n }", "function onSnapEnd() {\r\n board.position(game.fen());\r\n}", "function drawPiece() {\n var block = piece.pieceName;\n for(var i = 0; i < block.length; i++)\n for(var j = 0; j < block.length; j++)\n if( block[i][j] == 1)\n drawPixel( piece.xPos +j, piece.yPos+i, piece.colour);\n}", "function detectNextBlock_DownLeft (x,y,h,w)\n {\n var mapCoordY = (y + h)/ h;\n var mapCoordX = (x) / w;\n \n mapCoordX = Math.floor(mapCoordX);\n mapCoordY = Math.floor(mapCoordY);\n \n //Frage\n //var stoneBool = (Crafty.e('Stone') == map_comp[mapCoordY-1][mapCoordX-1]);\n //console.log(\"Is Stone: \" + stoneBool);\n return map[mapCoordY-1][mapCoordX-1];\n }", "dibujar_p() {\n push();\n stroke('black');\n strokeWeight(3);\n translate(this.posx-((this._shape[0].length*this.longitud)/2),this.posy-((this._shape.length*this.longitud)/2));\n for (var i = 0; i < this._shape.length; i++) {\n for (var j = 0; j < this._shape[i].length; j++) {\n if (this._shape[i][j] != 0) {\n fill(this._shape[i][j]);\n rect(j * this.longitud, i * this.longitud, this.longitud, this.longitud);\n }\n } \n }\n pop();\n}", "function DisplayBoard() {\n\tconsole.log(\"Turn \"+(TotalEmptyPegs-1))\n\tlet spacer = \" \"\n\tfor (var i = 0; i < board.length; i++) {\n\t\tlet text = \"\"\n\t\tfor (var y = 0; y < board[i].length; y++) {\n\t\t\tif(board[i][y].isFilled) { text+=\" X\" }\n\t\t\telse text+=\" O\"\n\t\t\t\n\t\t\tspacer = spacer.substring(0, spacer.length - 1);\n\t\t}\n\t\tconsole.log(spacer+text)\n\t}\n\t\n}", "function onSnapEnd () {\n board.position(game.fen())\n}", "function onSnapEnd () {\n board.position(game.fen())\n}", "function onSnapEnd () {\n board.position(game.fen())\n}", "function onSnapEnd () {\n board.position(game.fen())\n}", "function drawPieces(state) {\r\n // state.printBoardText();\r\n for(let col = 0; col < state.board_size; col++) {\r\n for(let row = 0; row < state.board_size; row++) {\r\n let player = state.board[state.getIndex(row, col)];\r\n if(player != 0) {\r\n drawCircle(row, col, player);\r\n }\r\n }\r\n }\r\n hover_coord = null;\r\n //updateScores();\r\n }", "function drawHouse() {\n\tfill('orange');\n\ttranslate(10, 10);\n\ttriangle(15, 0, 0, 15, 30, 15);\n\trect(0, 15, 30, 25);\n\trect(12, 30, 10, 10);\n}", "function near_wall() {\n\treturn 'up';\n}", "constructor () {\n this.left = -Infinity;\n this.right = Infinity;\n this.bottom = -Infinity;\n this.top = Infinity;\n }", "constructor(height, width, state) {\n this.height = height;\n this.width = width;\n this.board = [];\n for (let i = 0; i < this.height; ++i) {\n let tmp = [];\n for (let j = 0; j < this.width; ++j) {\n tmp.push(-1);\n }\n this.board.push(tmp);\n }\n\n\n if(state === 0) {\n var half = this.height / 2;\n var oneLess = (this.height / 2) - 1;\n\n this.board[oneLess][oneLess] = 'B';\n this.board[oneLess][half] = 'W';\n this.board[half][oneLess] = 'W';\n this.board[half][half] = 'B';\n } else {\n\n for (var r = 0; r < state.length; ++r) {\n for(var e = 0; e < state.length; ++e) {\n this.board[r][e] = state[r][e];\n }\n }\n\n }\n\n }", "function tilingWhite() {\n let x = 60;\n let y = 0; // before y = 60\n\n for (let i = 0; i < tileWhite.segmentsY; i++) {\n if (i % 2 === 0) {\n x = 60; // before x = 90;\n }\n else {\n x = 0; //before x = 150;\n }\n // Draws horizontal tiles\n for (let j = 0; j < tileWhite.segmentsX; j++) {\n push();\n noStroke();\n fill(tileWhite.fill.r, tileWhite.fill.g, tileWhite.fill.b);\n rect(x,y, tileWhite.size);\n x = x + tileWhite.spacingX;\n pop();\n }\n y = y + tileWhite.spacingY;\n }\n}", "function detectNextBlock_CurrentRightDown(x,y,h,w)\n {\n var mapCoordY = (y + h -1)/ h;\n var mapCoordX = (x + w -1) / w;\n \n mapCoordX = Math.floor(mapCoordX);\n mapCoordY = Math.floor(mapCoordY);\n \n return map[mapCoordY-1][mapCoordX-1]; \n }", "function magnetNorth () { \n drawPolygon(pgNorth,colorNorth); // Ausgefülltes Polygon\n var u1 = screenU(-XM1,YM2); // 1. innerer Punkt links, waagrechte Bildschirmkoordinate\n var v1 = screenV(-XM1,YM2,ZM1); // 1. innerer Punkt links, senkrechte Bildschirmkoordinate\n lineP(u1,v1,pgNorth,1); // Linie vom 1. inneren Punkt nach unten\n lineP(u1,v1,pgNorth,3); // Linie vom 1. inneren Punkt nach rechts unten\n var u2 = screenU(-XM1,YM1); // 2. innerer Punkt rechts, waagrechte Bildschirmkoordinate\n var v2 = screenV(-XM1,YM1,ZM2); // 2. innerer Punkt rechts, senkrechte Bildschirmkoordinate\n lineP(u2,v2,pgNorth,4); // Linie vom 2. inneren Punkt nach unten\n lineP(u2,v2,pgNorth,6); // Linie vom 2. inneren Punkt nach rechts oben\n lineP(u2,v2,pgNorth,8); // Linie vom 2. inneren Punkt nach links oben\n }", "function drawBoard(){ //create drawboard function\n for( r = 0; r <ROW; r++){\n for(c = 0; c < COL; c++){\n drawSquare(c,r,board[r][c]); //r is the y position, c is the x position\n }\n }\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 }", "function coord_CurrentLeftDown (x,y,h,w)\n {\n var mapCoord = {};\n \n mapCoord[1] = (y + h -1)/ h;\n mapCoord[0] = (x) / w;\n \n mapCoord[0] = Math.floor(mapCoord[0]-1);\n mapCoord[1] = Math.floor(mapCoord[1]-1);\n \n return mapCoord;\n }", "display() {\n for (let i = 0; i < this.pieces.length; i++) {\n let x_cord = this.pieces[i][0];\n let y_cord = this.pieces[i][1];\n let curr_piece = this.gameboard[x_cord][y_cord];\n imageMode(CORNER);\n if (!(curr_piece === null)) {\n image(curr_piece.srcImg, curr_piece.x, curr_piece.y)\n }\n }\n }", "function onSnapEnd() {\n board.position(game.fen())\n}", "static WorldPointToSizedRect() {}", "getNextWorkerPlaceDiagonal(workerList) {\n for (let i = 0; i < constants.BOARD_HEIGHT; i++) {\n let p = {x:i, y:i};\n if (!this.tileIsOccupied(workerList, p)) {\n return [\"place\", p.x, p.y];\n }\n }\n }", "function drawBoard(ctx){\n ctx.beginPath();\n\n ctx.moveTo(0.333, 0.05);\n ctx.lineTo(0.333, 0.95);\n\n ctx.moveTo(0.666, 0.05);\n ctx.lineTo(0.666, 0.95);\n\n ctx.moveTo(0.95, 0.333); \n ctx.lineTo(0.95, 0.666);\n\n ctx.stroke(); \n }", "function onSnapEnd() {\n board.position(game.fen());\n}", "function Z(){var e=l.getBoundingClientRect(),t=\"offset\"+[\"Width\",\"Height\"][r.ort];return 0===r.ort?e.width||l[t]:e.height||l[t]}", "function Z(){var e=l.getBoundingClientRect(),t=\"offset\"+[\"Width\",\"Height\"][r.ort];return 0===r.ort?e.width||l[t]:e.height||l[t]}", "function drawOuterBorder(){\n\tcontext.globalCompositeOperation = 'destination-over';\n\tcontext.fillStyle = outerBorderColor;\n\tcontext.fillRect(0, 0, squareSize * columns + outerBorder * 2, squareSize * rows + outerBorder * 2);\n\tcontext.globalCompositeOperation = 'source-over';\n}", "function offset_from_location(row, col){\n\t\tvar offset = $('.tile-board').offset();\n\t\toffset.left += (col-1)*tileWidth;\n\t\toffset.top += (row-1)*tileHeight;\n\t\treturn offset;\n\t}", "function dessinerMonstre (x,y) {\n\n // LE CORPS\n fill(0);\n ellipse(x,y,30,30);\n // LES YEUX\n fill(255);\n ellipse(x-8,y-5,10,10);\n ellipse(x+8,y-5,10,10);\n\n}", "function alighnCharacter() {\n if (\"arriveFrom\" in charData) {\n if (charData[\"arriveFrom\"] == \"North\") {\n char_x = width / 2\n char_y = height - 55\n }\n if (charData[\"arriveFrom\"] == \"South\") {\n char_x = width / 2\n char_y = 55\n }\n if (charData[\"arriveFrom\"] == \"East\") {\n char_x = 55\n char_y = height / 2\n }\n if (charData[\"arriveFrom\"] == \"West\") {\n char_x = width - 55\n char_y = height / 2\n }\n }\n}", "function generateLowerRight(x,y){\r\n var x = floor(random(ppg.width/2));\r\n var y = floor(random(ppg.height/2));\r\n var maxX=width/2;\r\n var maxY=height/2;\r\n for (i=0; i<=21;i++){\r\n x+=1;\r\n y+=1;\r\n maxX=maxX+x;\r\n maxY=maxY+y;\r\n let pixelN = ppg.get((width/2)+x , (height/2)+y);\r\n fill(pixelN);\r\n noStroke();\r\n rect(maxX, maxY,12,3);\r\n }\r\n}", "getPieceCorners({piece, x, y}) {\n\t\tconst topLeft = {x, y};\n\t\tconst topRight = {x: x + piece.width - 1, y};\n\t\tconst bottomLeft = {x, y: y + piece.height - 1};\n\t\tconst bottomRight = {x: x + piece.width - 1, y: y + piece.height - 1};\n\n\t\treturn {topLeft, topRight, bottomLeft, bottomRight};\n\t}", "function myMove(e){\n x=e.pageX-canvas.offsetLeft;\n y=e.pageY-canvas.offsetTop;\n for(c=1;c<tileColCount;c++){\n for(r=1;r<tileRowCount;r++){\n if(c*(tileW+3)<x && x<c*(tileW+3)+tileW && r*(tileH+3)<y && y<r*(tileH+3)+tileH){\n if(tiles[c][r].state=='e'&&(c!=boundX||r!=boundY)){\n tiles[c][r].state='w';\n boundX=c;\n boundY=r;\n }\n else if(tiles[c][r].state=='w'&&(c!=boundX||r!=boundY)){\n tiles[c][r].state='e';\n boundX=c;\n boundY=r;\n }\n }\n }\n }\n}", "function groundSweep(){\n let rowCount = 1;\n outer: for (let y = ground.length -1; y>0; --y){\n for (let x= 0; x< ground[y].length; ++x){\n if (ground[y][x] ===0){\n continue outer;\n }\n }\n\n // shifting the blocx\n\n const raw = ground.splice(y,1)[0].fill(0);\n\n ground.unshift(row);\n ++y; // incrementation of y \n// makin the ground better for the blocx with dimensional changes\n player.score += rowCount * 10;\n rowCount *= 2 ;\n\n }\n}", "tryWall(x, y) {\n if (x >= 0 && x < this.tiles[0].length && y >= 0 && y < this.tiles.length &&\n this.tiles[y][x] === 'E') {\n this.tiles[y][x] = 'W';\n }\n }", "function insideBoard(x,y) {\n if (x >= 154 && x <= 554) {\n board.size;\n return x / board.size;\n }\n else {\n return -1;\n }\n}", "function penLoc(n) {\n\treturn Math.round(n * (penSize / 2 - 0.5) + -1 * (-n - 1));\n}", "function drawCanyon(t_canyon)\n{\n\n fill(153,27,0)\n rect(t_canyon.x_pos + 80, 430, t_canyon.width - 75,200)\n \n fill (102,178,255)\n rect(t_canyon.x_pos + 105,430, t_canyon.width - 35,200) \n \n fill(153,27,0)\n rect(t_canyon.x_pos + 150,430, t_canyon.width - 75,200) \n \n}" ]
[ "0.63492", "0.63269633", "0.63209003", "0.62994176", "0.6282236", "0.62648076", "0.62557524", "0.62143517", "0.6188328", "0.61363137", "0.6107528", "0.607399", "0.60506564", "0.6042557", "0.60212743", "0.6017665", "0.60079527", "0.60072756", "0.5983221", "0.5980872", "0.59754753", "0.59632766", "0.5956323", "0.59493595", "0.593445", "0.59209555", "0.5896694", "0.5886683", "0.5880551", "0.58713603", "0.5863098", "0.58626926", "0.58625275", "0.58608943", "0.5848796", "0.5847257", "0.5845456", "0.58409756", "0.5822643", "0.58220303", "0.5819272", "0.5817769", "0.58153343", "0.58040476", "0.5802459", "0.5797894", "0.5789824", "0.57862246", "0.5785306", "0.5784116", "0.57826203", "0.57730657", "0.5767379", "0.5763813", "0.57633734", "0.576263", "0.5759561", "0.57575995", "0.5756483", "0.5752491", "0.57507044", "0.57447964", "0.5734672", "0.5733017", "0.5732974", "0.57317096", "0.5730782", "0.5730782", "0.5730782", "0.5730782", "0.5722208", "0.57220715", "0.57197493", "0.57164174", "0.5715091", "0.5712507", "0.57105136", "0.57091874", "0.5705706", "0.56986237", "0.5698405", "0.5695427", "0.5689833", "0.5687679", "0.56848955", "0.56768143", "0.5675846", "0.56754863", "0.56754863", "0.56754065", "0.56709296", "0.56705546", "0.56700915", "0.5666171", "0.5663759", "0.56616396", "0.5658516", "0.5655998", "0.565315", "0.56527334", "0.5652347" ]
0.0
-1
Once again, we need to create a data structure that can handle large numbers This time, let's create a class for it
function nDigitFibb(n) { class bigNum { constructor(value = 0) { this.num = value.toString().split("").map((digit) => +digit); } getLength() { return this.num.length; } add(num2) { // pad the smaller number with 0's so the digits line up if (this.getLength() < num2.getLength()) { this.num = Array(num2.getLength() - this.getLength()).fill(0).concat(this.num); } else if (this.getLength() > num2.getLength()) { num2.num = Array(this.getLength() - num2.getLength()).fill(0).concat(num2.num); } var carry = 0; var newNum = []; for (let i = this.num.length - 1; i >= 0; i--) { var newDigit = this.num[i] + num2.num[i] + carry; newNum.unshift(newDigit % 10); carry = Math.floor(newDigit / 10); } while (carry > 0) { newNum.unshift(carry % 10); carry = Math.floor(carry / 10); } var sum = new bigNum(); sum.num = newNum; return sum; } } var a = new bigNum(1); var b = new bigNum(1); var c = a.add(b); var count = 3; // var test1 = new bigNum(8); // var test2 = new bigNum(13); // var test3 = test1.add(test2); // console.log(test3); while (c.getLength() < n) { a = b; b = c; c = a.add(b); count++; } return count; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(n, p, r) {\n var o = this, i;\n\n if (JQX.Utilities.BigNumber.bigIntSupport) {\n if (n instanceof JQX.Utilities.BigNumber) {\n if (Array.isArray(n._d)) {\n n = (n._s ? '-' : '') + (n._d.slice(0, n._f).join('') || '0') + (n._f != n._d.length ? '.' + n._d.slice(n._f).join('') : '');\n }\n else {\n return new JQX.Utilities.BigNumber(n._d);\n }\n }\n\n try {\n if (n === null) {\n o._d = BigInt(0);\n }\n else if (typeof n === 'string' && n.toLowerCase().indexOf('e') !== -1) {\n o._d = BigInt(parseFloat(n));\n }\n else {\n o._d = BigInt(n);\n }\n }\n catch (error) {\n try {\n const numberParts = n.toString().split('.');\n let result = BigInt(numberParts[0]),\n firstDecimalDigit = parseInt(numberParts[1].charAt(0));\n\n if (result > 0 && firstDecimalDigit >= 5) {\n result = result + BigInt(1);\n }\n else if (result < 0) {\n if (firstDecimalDigit > 5) {\n result = result - BigInt(1);\n }\n else if (firstDecimalDigit === 5) {\n let iterator = 1,\n nextChar = numberParts[1].charAt(iterator),\n roundDown = false;\n\n while (nextChar !== '') {\n iterator++;\n nextChar = numberParts[1].charAt(iterator);\n\n if (nextChar !== '0') {\n roundDown = true;\n break;\n }\n }\n\n if (roundDown) {\n result = result - BigInt(1);\n }\n }\n }\n\n o._d = result;\n }\n catch (error) {\n o._d = BigInt(0);\n }\n }\n\n o._f = o._d.toString().replace('-', '').length;\n o._s = o._d < 0;\n return;\n }\n\n if (n instanceof JQX.Utilities.BigNumber) {\n if (typeof n._d === 'bigint') {\n return new JQX.Utilities.BigNumber(n._d.toString());\n }\n\n for (i in { precision: 0, roundType: 0, _s: 0, _f: 0 }) o[i] = n[i];\n o._d = n._d.slice();\n\n if (n._s && n._d.length === 1 && n._d[0] === 0) {\n // n is -0\n o._s = false;\n }\n\n return;\n }\n\n if (n !== undefined) {\n if (n === '-0') {\n n = '0';\n }\n\n // exponential notation support\n if (new RegExp(/e/i).test(n)) {\n var stringExponential = n.toString().toLowerCase(),\n indexOfE = stringExponential.indexOf('e'),\n mantissa = new JQX.Utilities.BigNumber(stringExponential.slice(0, indexOfE)),\n exponent = stringExponential.slice(indexOfE + 2),\n sign = stringExponential.slice(indexOfE + 1, indexOfE + 2),\n bigTen = new JQX.Utilities.BigNumber(10),\n multyplyBy = bigTen.pow(sign + exponent),\n result = mantissa.multiply(multyplyBy);\n\n n = result.toString();\n }\n }\n\n o.precision = isNaN(p = Math.abs(p)) ? JQX.Utilities.BigNumber.defaultPrecision : p;\n o.roundType = isNaN(r = Math.abs(r)) ? JQX.Utilities.BigNumber.defaultRoundType : r;\n o._s = (n += '').charAt(0) == '-';\n o._f = ((n = n.replace(/[^\\d.]/g, '').split('.', 2))[0] = n[0].replace(/^0+/, '') || '0').length;\n for (i = (n = o._d = (n.join('') || '0').split('')).length; i; n[--i] = +n[i]);\n o.round();\n }", "constructor(length){ \n this.n=BigInt(length)\n this.A={}\n }", "constructor(length){ \n this.n=BigInt(length)\n this.A={}\n }", "function bigInt(str){\n\n if(typeof str==='string')\n this.num = this.convertToNumberArray(str);\n else if( Object.prototype.toString.call( str ) === '[object Array]' ) {\n this.num = str;\n }\n \n return this;\n}", "function LargeObject(i) {\r\n this.a = i;\r\n this.b = i;\r\n this.c = i;\r\n this.d = i;\r\n this.e = i;\r\n this.f = i;\r\n this.g = i;\r\n this.h = i;\r\n this.i = i;\r\n this.j = i;\r\n this.k = i;\r\n this.l = i;\r\n this.m = i;\r\n this.n = i;\r\n this.o = i;\r\n this.p = i;\r\n this.q = i;\r\n this.r = i;\r\n this.s = i;\r\n this.t = i;\r\n this.u = i;\r\n this.v = i;\r\n this.w = i;\r\n this.x = i;\r\n this.y = i;\r\n this.z = i;\r\n this.a1 = i;\r\n this.b1 = i;\r\n this.c1 = i;\r\n this.d1 = i;\r\n this.e1 = i;\r\n this.f1 = i;\r\n this.g1 = i;\r\n this.h1 = i;\r\n this.i1 = i;\r\n this.j1 = i;\r\n this.k1 = i;\r\n this.l1 = i;\r\n this.m1 = i;\r\n this.n1 = i;\r\n this.o1 = i;\r\n this.p1 = i;\r\n this.q1 = i;\r\n this.r1 = i;\r\n this.s1 = i;\r\n this.t1 = i;\r\n this.u1 = i;\r\n this.v1 = i;\r\n this.w1 = i;\r\n this.x1 = i;\r\n this.y1 = i;\r\n this.z1 = i;\r\n this.a2 = i;\r\n this.b2 = i;\r\n this.c2 = i;\r\n this.d2 = i;\r\n this.e2 = i;\r\n this.f2 = i;\r\n this.g2 = i;\r\n this.h2 = i;\r\n this.i2 = i;\r\n this.j2 = i;\r\n this.k2 = i;\r\n this.l2 = i;\r\n this.m2 = i;\r\n this.n2 = i;\r\n this.o2 = i;\r\n this.p2 = i;\r\n this.q2 = i;\r\n this.r2 = i;\r\n this.s2 = i;\r\n this.t2 = i;\r\n this.u2 = i;\r\n this.v2 = i;\r\n this.w2 = i;\r\n this.x2 = i;\r\n this.y2 = i;\r\n this.z2 = i;\r\n this.a3 = i;\r\n this.b3 = i;\r\n this.c3 = i;\r\n this.d3 = i;\r\n this.e3 = i;\r\n this.f3 = i;\r\n this.g3 = i;\r\n this.h3 = i;\r\n this.i3 = i;\r\n this.j3 = i;\r\n this.k3 = i;\r\n this.l3 = i;\r\n this.m3 = i;\r\n this.n3 = i;\r\n this.o3 = i;\r\n this.p3 = i;\r\n this.q3 = i;\r\n this.r3 = i;\r\n this.s3 = i;\r\n this.t3 = i;\r\n this.u3 = i;\r\n this.v3 = i;\r\n this.w3 = i;\r\n this.x3 = i;\r\n this.y3 = i;\r\n this.z3 = i;\r\n this.a4 = i;\r\n this.b4 = i;\r\n this.c4 = i;\r\n this.d4 = i;\r\n this.e4 = i;\r\n this.f4 = i;\r\n this.g4 = i;\r\n this.h4 = i;\r\n this.i4 = i;\r\n this.j4 = i;\r\n this.k4 = i;\r\n this.l4 = i;\r\n this.m4 = i;\r\n this.n4 = i;\r\n this.o4 = i;\r\n this.p4 = i;\r\n this.q4 = i;\r\n this.r4 = i;\r\n this.s4 = i;\r\n this.t4 = i;\r\n this.u4 = i;\r\n this.v4 = i;\r\n this.w4 = i;\r\n this.x4 = i;\r\n this.y4 = i;\r\n this.z4 = i;\r\n this.a5 = i;\r\n this.b5 = i;\r\n this.c5 = i;\r\n this.d5 = i;\r\n this.e5 = i;\r\n this.f5 = i;\r\n this.g5 = i;\r\n this.h5 = i;\r\n this.i5 = i;\r\n this.j5 = i;\r\n this.k5 = i;\r\n this.l5 = i;\r\n this.m5 = i;\r\n this.n5 = i;\r\n this.o5 = i;\r\n this.p5 = i;\r\n this.q5 = i;\r\n this.r5 = i;\r\n this.s5 = i;\r\n this.t5 = i;\r\n this.u5 = i;\r\n this.v5 = i;\r\n this.w5 = i;\r\n this.x5 = i;\r\n this.y5 = i;\r\n this.z5 = i;\r\n this.a6 = i;\r\n this.b6 = i;\r\n this.c6 = i;\r\n this.d6 = i;\r\n this.e6 = i;\r\n this.f6 = i;\r\n this.g6 = i;\r\n this.h6 = i;\r\n this.i6 = i;\r\n this.j6 = i;\r\n this.k6 = i;\r\n this.l6 = i;\r\n this.m6 = i;\r\n this.n6 = i;\r\n this.o6 = i;\r\n this.p6 = i;\r\n this.q6 = i;\r\n this.r6 = i;\r\n this.s6 = i;\r\n this.t6 = i;\r\n this.u6 = i;\r\n this.v6 = i;\r\n this.w6 = i;\r\n this.x6 = i;\r\n this.y6 = i;\r\n this.z6 = i;\r\n this.a7 = i;\r\n this.b7 = i;\r\n this.c7 = i;\r\n this.d7 = i;\r\n this.e7 = i;\r\n this.f7 = i;\r\n this.g7 = i;\r\n this.h7 = i;\r\n this.i7 = i;\r\n this.j7 = i;\r\n this.k7 = i;\r\n this.l7 = i;\r\n this.m7 = i;\r\n this.n7 = i;\r\n this.o7 = i;\r\n this.p7 = i;\r\n this.q7 = i;\r\n this.r7 = i;\r\n this.s7 = i;\r\n this.t7 = i;\r\n this.u7 = i;\r\n this.v7 = i;\r\n this.w7 = i;\r\n this.x7 = i;\r\n this.y7 = i;\r\n this.z7 = i;\r\n this.a8 = i;\r\n this.b8 = i;\r\n this.c8 = i;\r\n this.d8 = i;\r\n this.e8 = i;\r\n this.f8 = i;\r\n this.g8 = i;\r\n this.h8 = i;\r\n this.i8 = i;\r\n this.j8 = i;\r\n this.k8 = i;\r\n this.l8 = i;\r\n this.m8 = i;\r\n this.n8 = i;\r\n this.o8 = i;\r\n this.p8 = i;\r\n this.q8 = i;\r\n this.r8 = i;\r\n this.s8 = i;\r\n this.t8 = i;\r\n this.u8 = i;\r\n this.v8 = i;\r\n this.w8 = i;\r\n this.x8 = i;\r\n this.y8 = i;\r\n this.z8 = i;\r\n this.a9 = i;\r\n this.b9 = i;\r\n this.c9 = i;\r\n this.d9 = i;\r\n this.e9 = i;\r\n this.f9 = i;\r\n this.g9 = i;\r\n this.h9 = i;\r\n this.i9 = i;\r\n this.j9 = i;\r\n this.k9 = i;\r\n this.l9 = i;\r\n this.m9 = i;\r\n this.n9 = i;\r\n this.o9 = i;\r\n this.p9 = i;\r\n this.q9 = i;\r\n // With this number of properties the object perfectly wraps around if the\r\n // instance size is not checked when allocating the initial map for MultiProp.\r\n // Meaning that the instance will be smaller than a minimal JSObject and we\r\n // will suffer a bus error in the release build or an assertion in the debug\r\n // build.\r\n}", "_pushBigNumber(gen, obj) {\n\t if (obj.isNaN()) {\n\t return gen._pushNaN()\n\t }\n\t if (!obj.isFinite()) {\n\t return gen._pushInfinity(obj.isNegative() ? -Infinity : Infinity)\n\t }\n\t if (obj.isInteger()) {\n\t return gen._pushBigint(obj)\n\t }\n\t if (!(gen._pushTag(TAG.DECIMAL_FRAC) &&\n\t gen._pushInt(2, MT$1.ARRAY))) {\n\t return false\n\t }\n\n\t const dec = obj.decimalPlaces();\n\t const slide = obj.shiftedBy(dec);\n\t if (!gen._pushIntNum(-dec)) {\n\t return false\n\t }\n\t if (slide.abs().isLessThan(constants$4.BN.MAXINT)) {\n\t return gen._pushIntNum(slide.toNumber())\n\t }\n\t return gen._pushBigint(slide)\n\t }", "bigNumber(value) {\n return bignumber[\"a\" /* BigNumber */].from(value);\n }", "_pushBigNumber(gen, obj) {\n if(obj.isNaN()) {\n return gen._pushNaN();\n }\n if(!obj.isFinite()) {\n return gen._pushInfinity(obj.isNegative() ? -Infinity : Infinity);\n }\n if(obj.isInteger()) {\n return gen._pushBigint(obj);\n }\n if(!(gen._pushTag(TAG.DECIMAL_FRAC) && gen._pushInt(2, MT.ARRAY))) {\n return false;\n }\n\n const dec = obj.decimalPlaces();\n const slide = obj.shiftedBy(dec);\n if(!gen._pushIntNum(-dec)) {\n return false;\n }\n if(slide.abs().isLessThan(BN.MAXINT)) {\n return gen._pushIntNum(slide.toNumber());\n }\n return gen._pushBigint(slide);\n }", "function _Big_() {\r\n\r\n /*\r\n * The Big constructor and exported function.\r\n * Create and return a new instance of a Big number object.\r\n *\r\n * n {number|string|Big} A numeric value.\r\n */\r\n function Big(n) {\r\n var x = this;\r\n\r\n // Enable constructor usage without new.\r\n if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);\r\n\r\n // Duplicate.\r\n if (n instanceof Big) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = n.c.slice();\r\n } else {\r\n parse(x, n);\r\n }\r\n\r\n /*\r\n * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which\r\n * points to Object.\r\n */\r\n x.constructor = Big;\r\n }\r\n\r\n Big.prototype = P;\r\n Big.DP = DP;\r\n Big.RM = RM;\r\n Big.NE = NE;\r\n Big.PE = PE;\r\n Big.version = '5.0.2';\r\n\r\n return Big;\r\n }", "function _Big_() {\r\n\r\n /*\r\n * The Big constructor and exported function.\r\n * Create and return a new instance of a Big number object.\r\n *\r\n * n {number|string|Big} A numeric value.\r\n */\r\n function Big(n) {\r\n var x = this;\r\n\r\n // Enable constructor usage without new.\r\n if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);\r\n\r\n // Duplicate.\r\n if (n instanceof Big) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = n.c.slice();\r\n } else {\r\n parse(x, n);\r\n }\r\n\r\n /*\r\n * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which\r\n * points to Object.\r\n */\r\n x.constructor = Big;\r\n }\r\n\r\n Big.prototype = P;\r\n Big.DP = DP;\r\n Big.RM = RM;\r\n Big.NE = NE;\r\n Big.PE = PE;\r\n Big.version = '5.0.2';\r\n\r\n return Big;\r\n }", "function _Big_() {\r\n\r\n /*\r\n * The Big constructor and exported function.\r\n * Create and return a new instance of a Big number object.\r\n *\r\n * n {number|string|Big} A numeric value.\r\n */\r\n function Big(n) {\r\n var x = this;\r\n\r\n // Enable constructor usage without new.\r\n if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);\r\n\r\n // Duplicate.\r\n if (n instanceof Big) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = n.c.slice();\r\n } else {\r\n parse(x, n);\r\n }\r\n\r\n /*\r\n * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which\r\n * points to Object.\r\n */\r\n x.constructor = Big;\r\n }\r\n\r\n Big.prototype = P;\r\n Big.DP = DP;\r\n Big.RM = RM;\r\n Big.NE = NE;\r\n Big.PE = PE;\r\n Big.version = '5.2.2';\r\n\r\n return Big;\r\n }", "function _Big_() {\n\n /*\n * The Big constructor and exported function.\n * Create and return a new instance of a Big number object.\n *\n * n {number|string|Big} A numeric value.\n */\n function Big(n) {\n var x = this;\n\n // Enable constructor usage without new.\n if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);\n\n // Duplicate.\n if (n instanceof Big) {\n x.s = n.s;\n x.e = n.e;\n x.c = n.c.slice();\n } else {\n parse(x, n);\n }\n\n /*\n * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which\n * points to Object.\n */\n x.constructor = Big;\n }\n\n Big.prototype = P;\n Big.DP = DP;\n Big.RM = RM;\n Big.NE = NE;\n Big.PE = PE;\n Big.version = '5.2.2';\n\n return Big;\n }", "function _Big_() {\n\n /*\n * The Big constructor and exported function.\n * Create and return a new instance of a Big number object.\n *\n * n {number|string|Big} A numeric value.\n */\n function Big(n) {\n var x = this;\n\n // Enable constructor usage without new.\n if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);\n\n // Duplicate.\n if (n instanceof Big) {\n x.s = n.s;\n x.e = n.e;\n x.c = n.c.slice();\n } else {\n parse(x, n);\n }\n\n /*\n * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which\n * points to Object.\n */\n x.constructor = Big;\n }\n\n Big.prototype = P;\n Big.DP = DP;\n Big.RM = RM;\n Big.NE = NE;\n Big.PE = PE;\n Big.version = '5.2.2';\n\n return Big;\n }", "function bigInteger(initValue) {\n var MAX = 1000000;\n var result = [initValue];\n var needMerge = false;\n var isFlat = false;\n var merge = function (arr) {\n var i, digit;\n for (i = 0; i < arr.length; i++) {\n digit = arr[i];\n if (digit >= 10) {\n //carry to higher digit\n arr[i] = digit % 10;\n if (i + 1 >= arr.length) {\n //lazy init new most significant digit\n arr[i + 1] = 0;\n }\n arr[i + 1] += Math.floor(digit / 10);\n }\n }\n needMerge = false;\n isFlat = true;\n };\n var sum = function () {\n finish();\n \n return _.reduce(result, function (memo, num) {\n return memo + num;\n }, 0);\n };\n /*\n * multiply with another integer\n */\n var multiply = function (n) {\n isFlat = false;\n\n _.each(result, function (digit, index, arr) {\n arr[index] = digit * n;\n if (arr[index] > MAX) {\n needMerge = true;\n }\n });\n if (needMerge) {\n merge(result);\n }\n return this;\n };\n var finish = function () {\n if (!isFlat) {\n merge(result);\n }\n return this;\n };\n /*\n * add another big integer\n */\n var add = function(other) {\n isFlat = false;\n var arrOther = other.result(); \n _.each(arrOther, function(digit, index) {\n if(index >= result.length) {\n result[index] = 0;\n }\n result[index] += digit;\n if(result[index] > MAX) {\n needMerge = true;\n } \n });\n if(needMerge) {\n merge(result);\n }\n return this;\n };\n var print = function() {\n finish();\n var i;\n var s = '';\n for(i = result.lengt - 1; i >=0; i--) {\n s += result[i];\n }\n console.log(s);\n };\n var length = function() {\n finish();\n return result.length;\n };\n var getResult = function() {\n finish();\n return result;\n };\n return {\n multiply: multiply,\n sum: sum,\n finish: finish,\n add: add,\n print: print,\n length: length,\n result: getResult\n };\n}", "function int64(h, l) {\r\n this.h = h;\r\n this.l = l;\r\n //this.toString = int64toString;\r\n}", "bigNumber(value) {\n return __WEBPACK_IMPORTED_MODULE_1__ethersproject_bignumber__[\"a\" /* BigNumber */].from(value);\n }", "function parseBigInt(b,a){return new BigInteger(b,a)}", "function parseBigInt(b,a){return new BigInteger(b,a)}", "function parseBigInt(b,a){return new BigInteger(b,a)}", "function parseBigInt(b,a){return new BigInteger(b,a)}", "function parseBigInt(b,a){return new BigInteger(b,a)}", "function _Big_() {\n\n\t /*\n\t * The Big constructor and exported function.\n\t * Create and return a new instance of a Big number object.\n\t *\n\t * n {number|string|Big} A numeric value.\n\t */\n\t function Big(n) {\n\t var x = this;\n\n\t // Enable constructor usage without new.\n\t if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n);\n\n\t // Duplicate.\n\t if (n instanceof Big) {\n\t x.s = n.s;\n\t x.e = n.e;\n\t x.c = n.c.slice();\n\t } else {\n\t parse$5(x, n);\n\t }\n\n\t /*\n\t * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which\n\t * points to Object.\n\t */\n\t x.constructor = Big;\n\t }\n\n\t Big.prototype = P;\n\t Big.DP = DP;\n\t Big.RM = RM;\n\t Big.NE = NE;\n\t Big.PE = PE;\n\t Big.version = '5.2.2';\n\n\t return Big;\n\t}", "function parseBigInt(b,a){return new BigInteger$5(b,a)}", "function bigFactory() {\r\n\r\n\t /*\r\n\t * The Big constructor and exported function.\r\n\t * Create and return a new instance of a Big number object.\r\n\t *\r\n\t * n {number|string|Big} A numeric value.\r\n\t */\r\n\t function Big(n) {\r\n\t var x = this;\r\n\r\n\t // Enable constructor usage without new.\r\n\t if (!(x instanceof Big)) {\r\n\t return n === void 0 ? bigFactory() : new Big(n);\r\n\t }\r\n\r\n\t // Duplicate.\r\n\t if (n instanceof Big) {\r\n\t x.s = n.s;\r\n\t x.e = n.e;\r\n\t x.c = n.c.slice();\r\n\t } else {\r\n\t parse(x, n);\r\n\t }\r\n\r\n\t /*\r\n\t * Retain a reference to this Big constructor, and shadow\r\n\t * Big.prototype.constructor which points to Object.\r\n\t */\r\n\t x.constructor = Big;\r\n\t }\r\n\r\n\t Big.prototype = P;\r\n\t Big.DP = DP;\r\n\t Big.RM = RM;\r\n\t Big.E_NEG = E_NEG;\r\n\t Big.E_POS = E_POS;\r\n\r\n\t return Big;\r\n\t }", "function bigFactory() {\r\n\r\n\t /*\r\n\t * The Big constructor and exported function.\r\n\t * Create and return a new instance of a Big number object.\r\n\t *\r\n\t * n {number|string|Big} A numeric value.\r\n\t */\r\n\t function Big(n) {\r\n\t var x = this;\r\n\r\n\t // Enable constructor usage without new.\r\n\t if (!(x instanceof Big)) {\r\n\t return n === void 0 ? bigFactory() : new Big(n);\r\n\t }\r\n\r\n\t // Duplicate.\r\n\t if (n instanceof Big) {\r\n\t x.s = n.s;\r\n\t x.e = n.e;\r\n\t x.c = n.c.slice();\r\n\t } else {\r\n\t parse(x, n);\r\n\t }\r\n\r\n\t /*\r\n\t * Retain a reference to this Big constructor, and shadow\r\n\t * Big.prototype.constructor which points to Object.\r\n\t */\r\n\t x.constructor = Big;\r\n\t }\r\n\r\n\t Big.prototype = P;\r\n\t Big.DP = DP;\r\n\t Big.RM = RM;\r\n\t Big.E_NEG = E_NEG;\r\n\t Big.E_POS = E_POS;\r\n\r\n\t return Big;\r\n\t }", "function int64(h, l) {\n\t this.h = h;\n\t this.l = l;\n\t //this.toString = int64toString;\n\t }", "function testGMP()\n{\n var numbSet = []\n var objSet = []\n for (var cD=0;cD<6;cD++)\n {\n numbSet.push(cD)\n objSet.push([String.fromCharCode(cD+65)])\n }\n\n// var ans = generateMultiplePlacements(numbSet.length,[1,3,2,1,4],numbSet,objSet)\n var ans = generateMultiplePlacements(numbSet.length,[1,3,2],numbSet,objSet)\n// var map =[]\n// dimensionRecurse(ans,map);\n\n var int = 5;\n}", "function BigInteger(n, s, token) {\n\tif (token !== CONSTRUCT) {\n\t\tif (n instanceof BigInteger) {\n\t\t\treturn n;\n\t\t}\n\t\telse if (typeof n === \"undefined\") {\n\t\t\treturn ZERO;\n\t\t}\n\t\treturn BigInteger.parse(n);\n\t}\n\n\tn = n || []; // Provide the nullary constructor for subclasses.\n\twhile (n.length && !n[n.length - 1]) {\n\t\t--n.length;\n\t}\n\tthis._d = n;\n\tthis._s = n.length ? (s || 1) : 0;\n}", "function BigInteger(n, s, token) {\n\tif (token !== CONSTRUCT) {\n\t\tif (n instanceof BigInteger) {\n\t\t\treturn n;\n\t\t}\n\t\telse if (typeof n === \"undefined\") {\n\t\t\treturn ZERO;\n\t\t}\n\t\treturn BigInteger.parse(n);\n\t}\n\n\tn = n || []; // Provide the nullary constructor for subclasses.\n\twhile (n.length && !n[n.length - 1]) {\n\t\t--n.length;\n\t}\n\tthis._d = n;\n\tthis._s = n.length ? (s || 1) : 0;\n}", "function bigFactory() {\n\n /*\r\n * The Big constructor and exported function.\r\n * Create and return a new instance of a Big number object.\r\n *\r\n * n {number|string|Big} A numeric value.\r\n */\n function Big(n) {\n var x = this;\n\n // Enable constructor usage without new.\n if (!(x instanceof Big)) {\n return n === void 0 ? bigFactory() : new Big(n);\n }\n\n // Duplicate.\n if (n instanceof Big) {\n x.s = n.s;\n x.e = n.e;\n x.c = n.c.slice();\n } else {\n parse(x, n);\n }\n\n /*\r\n * Retain a reference to this Big constructor, and shadow\r\n * Big.prototype.constructor which points to Object.\r\n */\n x.constructor = Big;\n }\n\n Big.prototype = P;\n Big.DP = DP;\n Big.RM = RM;\n Big.E_NEG = E_NEG;\n Big.E_POS = E_POS;\n\n return Big;\n }", "function BigInteger(n, s, token) {\n\t\tif (token !== CONSTRUCT) {\n\t\t\tif (n instanceof BigInteger) {\n\t\t\t\treturn n;\n\t\t\t} else if (typeof n === \"undefined\") {\n\t\t\t\treturn ZERO;\n\t\t\t}\n\t\t\treturn BigInteger.parse(n);\n\t\t}\n\n\t\tn = n || []; // Provide the nullary constructor for subclasses.\n\t\twhile (n.length && !n[n.length - 1]) {\n\t\t\t--n.length;\n\t\t}\n\t\tthis._d = n;\n\t\tthis._s = n.length ? s || 1 : 0;\n\t}", "function BigInteger(digits) {\n Object(C_Users_Abid_Loqmen_Desktop_NGforce_thesis_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_12__[\"default\"])(this, BigInteger);\n\n this.digits = digits;\n }", "supportsLongValues() {\n return true;\n }", "function bigFactory() {\r\n\r\n /*\r\n * The Big constructor and exported function.\r\n * Create and return a new instance of a Big number object.\r\n *\r\n * n {number|string|Big} A numeric value.\r\n */\r\n function Big(n) {\r\n var x = this;\r\n\r\n // Enable constructor usage without new.\r\n if (!(x instanceof Big)) {\r\n return n === void 0 ? bigFactory() : new Big(n);\r\n }\r\n\r\n // Duplicate.\r\n if (n instanceof Big) {\r\n x.s = n.s;\r\n x.e = n.e;\r\n x.c = n.c.slice();\r\n } else {\r\n parse(x, n);\r\n }\r\n\r\n /*\r\n * Retain a reference to this Big constructor, and shadow\r\n * Big.prototype.constructor which points to Object.\r\n */\r\n x.constructor = Big;\r\n }\r\n\r\n Big.prototype = P;\r\n Big.DP = DP;\r\n Big.RM = RM;\r\n Big.E_NEG = E_NEG;\r\n Big.E_POS = E_POS;\r\n\r\n return Big;\r\n }", "function bigFactory() {\n\n /*\n * The Big constructor and exported function.\n * Create and return a new instance of a Big number object.\n *\n * n {number|string|Big} A numeric value.\n */\n function Big(n) {\n var x = this;\n\n // Enable constructor usage without new.\n if (!(x instanceof Big)) {\n return n === void 0 ? bigFactory() : new Big(n);\n }\n\n // Duplicate.\n if (n instanceof Big) {\n x.s = n.s;\n x.e = n.e;\n x.c = n.c.slice();\n } else {\n parse(x, n);\n }\n\n /*\n * Retain a reference to this Big constructor, and shadow\n * Big.prototype.constructor which points to Object.\n */\n x.constructor = Big;\n }\n\n Big.prototype = P;\n Big.DP = DP;\n Big.RM = RM;\n Big.E_NEG = E_NEG;\n Big.E_POS = E_POS;\n\n return Big;\n }", "static get SIZE() { return 2000000; }", "function h(){return r.TYPED_ARRAY_SUPPORT?2147483647:1073741823}", "function IntegerBufferSet() {\n this.$IntegerBufferSet_valueToPositionMap = {};\n this.$IntegerBufferSet_size = 0;\n this.$IntegerBufferSet_smallValues = new Heap(\n [], // Initial data in the heap\n this.$IntegerBufferSet_smallerComparator\n );\n this.$IntegerBufferSet_largeValues = new Heap(\n [], // Initial data in the heap\n this.$IntegerBufferSet_greaterComparator\n );\n\n this.getNewPositionForValue = this.getNewPositionForValue.bind(this);\n this.getValuePosition = this.getValuePosition.bind(this);\n this.getSize = this.getSize.bind(this);\n this.replaceFurthestValuePosition =\n this.replaceFurthestValuePosition.bind(this);\n }", "function FastIntegerCompression() {\n}", "function BigInteger(n, token) {\n\tif (token !== CONSTRUCT) {\n\t\tif (n instanceof BigInteger) {\n\t\t\treturn n;\n\t\t}\n\t\telse if (typeof n === \"undefined\") {\n\t\t\treturn ZERO;\n\t\t}\n\t\treturn BigInteger.parse(n);\n\t}\n\n\tthis.value = BigInt(n);\n}", "function u(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}", "function bigNum(num) {\n return ethers_1.utils.bigNumberify(num);\n}", "function nbi() {return new BigInteger(null);}", "function nbi() {return new BigInteger(null);}", "multiply(n) {\n let newDigits = [];\n let carry = 0;\n for (const digit of this.digits) {\n const sum = digit * n + carry;\n newDigits.push(sum % 10);\n carry = Math.floor(sum / 10);\n }\n if (carry > 0)\n newDigits.push(carry);\n return new Uint(newDigits);\n }", "function Column_BIGINT() {}", "static readSortedLong(buf, off, toBigInt = false) {\n\n let byteLen;\n let negative;\n\n /* The first byte of the buf stores the length of the value part. */\n let b1 = buf.readUInt8(off++);\n /* Adjust the byteLen to the real length of the value part. */\n if (b1 < 0x08) {\n byteLen = 0x08 - b1;\n negative = true;\n } else if (b1 > 0xf7) {\n byteLen = b1 - 0xf7;\n negative = false;\n } else {\n return {\n value: toBigInt ? BigIntCons(b1 - 127) : b1 - 127,\n off\n };\n }\n\n /*\n * The following bytes on the buf store the value as a big endian\n * integer. We extract the significant bytes from the buf and put them\n * into the value in big endian order.\n *\n * Note that unlike in Java, we don't need to do (buf[off++] & 0xff)\n * if we read the byte as unsigned 8-bit integer.\n */\n let valueL, valueR;\n if (negative) {\n valueL = -1;\n valueR = -1;\n } else {\n valueL = 0;\n valueR = 0;\n }\n\n //64 bit int overflow will be detected in Int64.combine()\n if (byteLen > 7) {\n valueL = (valueL << 8) | buf.readUInt8(off++);\n }\n if (byteLen > 6) {\n valueL = (valueL << 8) | buf.readUInt8(off++);\n }\n if (byteLen > 5) {\n valueL = (valueL << 8) | buf.readUInt8(off++);\n }\n if (byteLen > 4) {\n valueL = (valueL << 8) | buf.readUInt8(off++);\n }\n if (byteLen > 3) {\n valueR = (valueR << 8) | buf.readUInt8(off++);\n }\n if (byteLen > 2) {\n valueR = (valueR << 8) | buf.readUInt8(off++);\n }\n if (byteLen > 1) {\n valueR = (valueR << 8) | buf.readUInt8(off++);\n }\n valueR = (valueR << 8) | buf.readUInt8(off++);\n\n let value = Int64.combine(valueL, valueR, toBigInt);\n\n /*\n * After obtaining the adjusted value, we have to adjust it back to the\n * original value.\n */\n if (negative) {\n value -= toBigInt ? BIGINT_119 : 119;\n } else {\n value += toBigInt ? BIGINT_121 : 121;\n }\n return { value, off };\n }", "function de_exponentize(number) {\n\treturn number * 10000000;\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 nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }", "function nbi() { return new BigInteger(null); }" ]
[ "0.65659046", "0.65258074", "0.65258074", "0.626205", "0.6250921", "0.6239402", "0.6217185", "0.6197913", "0.617068", "0.617068", "0.61600167", "0.6112274", "0.6112274", "0.60709", "0.60119915", "0.5917327", "0.5898823", "0.5898823", "0.5898823", "0.5898823", "0.5898823", "0.5888015", "0.5819409", "0.5790518", "0.5790518", "0.5787291", "0.5769977", "0.5746313", "0.5746313", "0.5715159", "0.5709274", "0.5694137", "0.56915087", "0.56911105", "0.56582534", "0.5642559", "0.5627045", "0.56266433", "0.56243145", "0.5604296", "0.55879295", "0.55870444", "0.55188674", "0.55188674", "0.55165434", "0.5506717", "0.54831207", "0.54729134", "0.5468366", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654", "0.5457654" ]
0.58026785
23
Minor Programmeren Finalproject Musicvisualization // // Name: Noam Rubin // Studentnumber: 10800565 // // 27 06 2018 // // This script lets the user load a mp3 file and // updates the visualization // //
function uploadFile() { /* lets user upload a file and updates charts*/ // substract variables from html const realFileButton = document.getElementById("real-file"); const customButton = document.getElementById("custom-button"); const customText = document.getElementById("custom-text"); // activate realfilebutton when custombutton is clicked customButton.addEventListener("click", function() { realFileButton.click(); }); // if value realfilebutton changes realFileButton.addEventListener("change", function() { // if a file is chosen if (realFileButton.value) { // show filename customText.innerHTML = document.getElementById("real-file").files[0].name // update chart with new data var properties = playAudio(customText.innerHTML); // substract properties audio file context = properties[0] source = properties[1] analyserNode = properties[2]; // create frequencyArray and fill it frequencyArray = new Uint8Array(analyserNode.frequencyBinCount); analyserNode.getByteFrequencyData(frequencyArray); // create frequency barchart createBarChart(analyserNode); // create circle chart createCircleChart(analyserNode); // create linegraph startLineContext(analyserNode); // run synthesizer synthesizer(context, source); } // if file is not chosen yet else { // show customText.innerHTML = "File not chosen"; }; }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function musicMainScreen() {\n //Get the file and play it\n}", "function loadMusic( music ) {\n title[0].textContent = music.Name_song\n audio.src = music.path\n coverAlbum.style.backgroundImage = music.cover_song \n imageVolume()\n}", "function readMusic(input) {\r\n if(input.files && input.files[0])\r\n audio.src = URL.createObjectURL(input.files[0]);\r\n pausePlay.innerHTML = \"Pause\";\r\n}", "function preload() {\n //change song file name here\n song = loadSound('song.mpeg');\n}", "function preload() {\n //change song file name here\n song = loadSound('song.mpeg');\n}", "function play() {\n\n verovioToolkit.loadData(mei); // this is rendundant with\n verovioToolkit.renderToMidi(); // line 137 & 141\n\n let maxDuration = viewManager.getDuration();\n\n startTime = (new Date().valueOf()) - pauseTimePassed;\n\n function updateTicker() {\n\n let timePassed = (new Date().valueOf()) - startTime;\n\n // If time has passed the duration of the longest audio\n // clip, then rewind and stop\n\n if (timePassed < maxDuration) {\n viewManager.update(timePassed);\n } else {\n reset();\n }\n }\n\n timerId = setInterval(updateTicker, VIZ_REFRESH_INTERVAL);\n }", "function preload() {\r\n // Preload function - only used to insert bellRing.mp3\r\n\r\n}", "function loadMusica(musica) {\n titulo.innerText = musica;\n Artista.innerText = musica;\n audio.src = \"./musicas/\".concat(musica, \".mp3\");\n album.src = \"./imagens/\".concat(musica, \".jpg\");\n} // Toca musicas", "function loadSong(song){\n title.innerText = song;\n audio.src =`musique/${song}.mp3`;\n cover.src =`vignette/${song}.jpg`\n }", "function loadMusic(indexNumb) {\n musicName.innerText = allMusic[indexNumb - 1].name;\n musicArtist.innerText = allMusic[indexNumb - 1].artist;\n musicImg.src = `images/${allMusic[indexNumb - 1].img}.jpg`;\n mainAudio.src = `songs/${allMusic[indexNumb - 1].src}.mp3`;\n}", "function loadSong(){\r\n\r\n song.src = songs[currentSong];\r\n songtitle.textContent = (currentSong + 1) + \". \" + songs[currentSong];\r\n nextSongTitle.innerHTML = (\"<b>Next Song: </b>\") + songs[currentSong + 1];\r\n song.volume = volumeSlider.value;\r\n song.play();\r\n \r\n }", "function preload() {\n font = loadFont('data/MaisonNeueMono-Regular.otf');\n song = loadSound('data/gpsjammeroutput.mp3');\n}", "function loadSong(index) {\r\n cover.src = music[musicIndex].img;\r\n audio.src = `./music/${music[musicIndex].title}.mp3`;\r\n artistName.innerText = music[musicIndex].artist;\r\n songName.innerText = music[musicIndex].title;\r\n}", "function loadSong(song) {\n title.innerText = song;\n audio.src = `music/${song}.aac`;\n}", "function loadMusic(){\n srcPlayer.src = pathMusic + musics[countMusic] + extMusic;\n player.load();\n\n if(musics[countMusic] == 'mana_feat_jorge_e_matheus-voce_e_minha_religiao'){\n player.currentTime = 14;\n }\n }", "function playSong(){\n song.src = songs[currentSong]; //set the source of 0th song \n songTitle.textContent = songs[currentSong].replace('./assets/audio/',''); // set the title of song\n songTitle.textContent = songTitle.textContent.replace('.mp3',''); // set the title of song\n song.play(); // play the song\n}", "function preload() {\n song = loadSound('R.mp3')\n}", "function loadSong(song) {\n tittle.innerText = song\n audio.src = `music/${song}.mp3`\n audio.src = `images/${song}.jpg`\n}", "function preload(){\n song = loadSound ('run_boy.mp3');// loads song\n}", "function preload() {\n song = loadSound('MUJI.mp3');\n}", "function processSong(data) {\n\t\taudioFile.src = \"data:\" + data.mime + \";base64,\" + data.base64;\n\t\taudioFile.volume = volume / 100;\n\t\taudioFile.load();\n\t\taudioFile.play();\n\t\tdivListview.classList.add(\"active\");\n\t\tdivAudioBanner.classList.remove(\"hidden\");\n\t\tdivAudioPlayer.classList.remove(\"hidden\");\n\t\tshowPause();\n\t}", "function preload() {\r\n theme = loadSound('music/Forget.mp3')\r\n font = loadFont('music/vanilla-extract.regular.ttf')\r\n crasyPer = loadImage('music/crazy-faceejfnaiugjkarngow2.png')\r\n crasyPer2 = loadImage('music/crazy-facefejrgniuagoiw3.png')\r\n crasyPer3 = loadImage('music/crazy-facegjnsurgaegsuiehg4.png')\r\n crasyPer4 = loadImage('music/crazy-facejnsfjhw1.png')\r\n perPer1 = loadImage('music/crybabe.png')\r\n perPer4 = loadImage('music/iogueig.png')\r\n perPer2 = loadImage('music/sifjoefu.png')\r\n perPer3 = loadImage('music/softbayru.png')\r\n perPer5 = loadImage('music/krjgoeg.png')\r\n perPer6 = loadImage('music/oerguhg.png')\r\n perPer7 = loadImage('music/oiewjgiugb.png')\r\n dreamPer3 = loadImage('music/iurjgu.png')\r\n dreamPer1 = loadImage('music/pojihg.png')\r\n dreamPer2 = loadImage('music/rugjo.png')\r\n}", "function load(title) {\n var oAudio = document.getElementById('audio_core');\n var extension = title.lastIndexOf('.');\n var cleanTitle = title.substring(0, extension);\n if (oAudio) {\n oAudio.src = \"/static/media/Music/\" + title;\n oAudio.load();\n oAudio.play();\n document.getElementById('title').innerHTML = \"Title: \" + cleanTitle.toString();\n }}", "function loaded() {\n\tsong.play();\n}", "function preload(){\n font = loadFont('data/NewRocker-Regular.ttf');\n song = loadSound ('data/creepySound.mp3');\n}", "function preload() {\n song = loadSound('../assets/music/song5.mp3');\n }", "function preload() {\r\n\tmySound = loadSound ('MarioMusic.mp3');\r\n\t//this sound was found from this websitehttps://downloads.khinsider.com/mario\r\n\t\r\n}", "function playTrack(src, num) {\n\tvar audio = document.getElementById(\"myAudio\");\n\tvar source = document.getElementById(\"mp3Source\");\n\tvar imgtag = art[num];\n\tif (artStatus == 0) {\n\t\tif (imgtag) {\n\t\t\tvar base64String = \"\";\n\t\t\tfor (var i = 0; i < imgtag.data.length; i++) {\n\t\t\t\tbase64String += String.fromCharCode(imgtag.data[i]);\n\t\t\t}\n\t\t\tvar base64 = \"data:\" + imgtag.format + \";base64,\" +\n\t\t\twindow.btoa(base64String);\n\t\t\tdocument.getElementById('albumArt').setAttribute('src',base64);\n\t\t} else {\n\t\t\tdocument.getElementById('albumArt').style.display = \"none\";\n\t\t}\n\t} else if (artStatus == 1) {\n\t\talbumArt.src = savedStatus;\n\t\talbumArt.className = \"\";\n\t\tartStatus = 0;\n\t\tif (imgtag) {\n\t\t\tvar base64String = \"\";\n\t\t\tfor (var i = 0; i < imgtag.data.length; i++) {\n\t\t\t\tbase64String += String.fromCharCode(imgtag.data[i]);\n\t\t\t}\n\t\t\tvar base64 = \"data:\" + imgtag.format + \";base64,\" +\n\t\t\twindow.btoa(base64String);\n\t\t\tdocument.getElementById('albumArt').setAttribute('src',base64);\n\t\t} else {\n\t\t\tdocument.getElementById('albumArt').style.display = \"none\";\n\t\t}\n\t}\n\t\t\n\tsource.src = src;\n\taudio.load();\n\taudio.play();\n}", "loadSong(music) {\n audio.src = `music/${music.song}.mp3`;\n\n this.getDuration(audio).then((time) => {\n thumbnailSong.src = `image/${music.song}.jpg`;\n nameSong.textContent = music.song;\n author.textContent = music.author;\n timeSong.textContent = time;\n thumbnailSong.classList.add(\"rotate-ani\");\n });\n }", "function getExampleAudio() {\n loadExampleSong('FuriousFreak.mp3', 0);\n omniButtonIcon.classList = \"fa fa-cog fa-spin omniButtonIconNoVisualization\";\n omniButtonPrompt.innerHTML = 'Loading and Analyzing \"Furious Freak\" by Kevin MacLeod'\n document.getElementById(\"vanishingAct\").classList = \"hidden\";\n fileUpload.classList = \"hidden\";\n}", "function loadSong(song){\n if(source!=null){\n if(!audio.paused) btnClick(d3.select('#playBtn'))\n audio.currentTime = audio.duration//end song\n //audio.pause()\n source.disconnect(analyser)\n //songChanged = true;\n }\n \n \n audio = new Audio(song)\n if(source == null) requestAnimationFrame(tick);\n source = audioCtx.createMediaElementSource(audio)\n source.connect(analyser)\n \n //audio.play()\n //songChanged = false;\n //requestAnimationFrame(tick) \n}", "function PickSong(song){\n title.innerText=song;\n //document.getElementById(\"title\").innerHTML = title;\n audio.src=`songs/${song}.mp3`\n \n}", "function preload(){\n music = loadSound(\"assets/bkgrndmusic.mp3\");\n}", "function preload(){\n song = loadSound(\"jinglebell.mp3\");\n}", "function preload(){\n happy = loadFont(' KGHAPPY.ttf');\n song1 = loadSound('POP.WAV');\n song2 = loadSound('morning.mp3');\n}", "function music(mp3path){\n $('#playDiv').empty()\n // $('#playDiv').append(\n // \"<iframe id='dzplayer' dztype='dzplayer' src='https://www.deezer.com/plugins/player?type=tracks&id=\" + playlistId[1] + \" &format=classic&color=007FEB&autoplay=true&playlist=true&width=700&height=90' scrolling='no' frameborder='0' style='border:none; overflow:hidden;' width='700' height='90' allowTransparency='true'></iframe>\"\n // )\n $('#playDiv').append(\n \"<audio id='myAudio' controls autoplay><source src='\"+mp3path+\"' type='audio/mpeg'>Your browser does not support the audio element.</audio>\"\n )\n\n \n}", "function preload() {\n soundFile = loadSound('../../music/tiesto_zero_76.mp3');\n}", "function preload() {\n soundFile = loadSound('../../music/tiesto_zero_76.mp3');\n}", "preload() {\n this.load.image('author-logo', 'author/PlatypusDev.png');\n this.load.audio('author-song', 'author/Perry.mp3');\n }", "function playFile(path){\n if(audio){\n audio.pause()\n audio.currentTime = 0\n }\n audio = new Audio('file:///'+path)\n\n // Getting metadata for the audio file\n id3({ file: path.toString(), type: id3.OPEN_LOCAL }, function(err, tags) {\n if(tags){\n songTitle.innerHTML = tags.title\n songAlbum.innerHTML = tags.album\n songArtist.innerHTML = tags.artist\n }\n })\n\n // Getting Album Cover of the audio file\n musicmetadata(fs.createReadStream(path.toString()), function (err, metadata) {\n if(!err && metadata){\n var base64Data = base64ArrayBuffer( metadata.picture[0].data )\n albumCover.src = 'data:image/png;base64, ' + base64Data\n var img = \"url('data:image/png;base64, \"+base64Data + \"')\"\n document.getElementById('player-background').style.backgroundImage = img\n }\n })\n songDuration = 0\n audio.addEventListener('loadedmetadata', function() {\n songDuration = audio.duration\n play_button.src = \"../assets/images/controls/player/pause.png\"\n audio.volume = volumeSeek.value\n if(notInFocus){\n notifier.notify('Player', {\n message: 'Now Playing - ' + songTitle.innerHTML\n })\n }\n setTimeout(function(){\n audio.play()\n startSeek()\n }, 1000)\n });\n // audio.muted = true\n}", "function displaySong(name, inter, data) {\r\n\tvar obj = JSON.parse(data);\r\n\tvar cssSelector = {\r\n\t\tjPlayer: name,\r\n\t\tcssSelectorAncestor: inter\r\n\t};\r\n\t/*An Empty Playlist*/\r\n\tvar playlist = [];\r\n\tvar options = {\r\n\t\tswfPath: \"js\",\r\n\t\tuseStateClassSkin: true,\r\n\t\tsupplied: \"mp3\"\r\n\t};\r\n\tvar myPlaylist = new jPlayerPlaylist(cssSelector, playlist, options);\r\n\t/*Loop through the JSon array and add it to the playlist*/\r\n\tvar l=obj.length;\r\n\tfor (var i=0;i<l; i++) {\r\n \tmyPlaylist.add({\r\n\t\t\ttitle: obj[i].title,\r\n\t\t\tmp3: obj[i].mp3\r\n\t\t});\r\n\t}\r\n}", "function preload() {\n soundFile = loadSound('assets/ChildishGambinoCalifornia_01.mp3');\n //soundFile = loadSound('assets/DREAMDIVISION.mp3');\n\n lrcStrings = loadStrings('assets/ChildishGambinoCalifornia_01.lrc');\n\t\n\tbassBlob = loadImage('assets/bassBlob.svg');\n\t\n\n\tmorakas = loadImage('assets/morakas.svg');\n\n\nfuturaBold = loadFont(\"assets/Futura_Bold.ttf\");\n\t\n}", "function preload() {\n soundFormats('mp3', 'ogg');\n click = loadSound('https://travisfeldman.github.io/FILES/drum');\n beatbox = loadSound('https://travisfeldman.github.io/FILES/beatbox');\n\n}", "function loadSong(song) {\n cover.src = song.coverPath;\n disc.src = song.discPath;\n title.textContent = song.title;\n artist.textContent = song.artist;\n duration.textContent = song.duration;\n}", "function loadMusic(ruta){\r\n\tvar source = document.getElementById('source')\r\n\tvar folder =\"audio\";//Carpeta donde tenemos almancenada la musica\r\n\tsource.src= folder+\"/\"+ruta\r\n\tvar index= indiceActual[0]= canciones.indexOf(ruta)\r\n\tremoveActive()\r\n\tvar item=document.getElementById(index)\r\n\titem.classList.add(\"active\");\r\n\treproduccionActual(\"Reproduciendo: \"+ ruta)\r\n\tmiguel.load()\r\n}", "function tocaAnterior(){// função responsável por tocar musica anterior a musica atual.\n tempo=0\n numMusica--;// como as musicas são numeradas de 0 a 3, a variável diminui para que regrida a playlist.\n if(numMusica < 0){\n numMusica = 3;//retorna a ultima musica.\n }\n else{\n document.getElementById(\"music\").src = \"musica/music\"+numMusica+\".mp3\";\n document.getElementById(\"music\").play();//toca a musica anterior subtituindo a variavel que numera o nomre da musica linkando no html.\n }\n}", "function preload() {\n mySong = loadSound(\"./assets/equilibrium.mp3\");\n myImage = loadImage(\"./assets/relax.png\");\n}", "function preload() {\n boom = loadSound('assets/boom.mp3');\n tss = loadSound('assets/tss.mp3');\n myFont = loadFont('assets/Gulim.ttf');\n gradientLoop = loadSound('assets/gradientloop.mp3'); \n drumLoad(128);\n}", "function preload() {\n h1 = loadSound('hea1.mp3')\n}", "function addAudio(obj)\n{\n \n var desc = '';\n var artist_full;\n var album_full;\n var artist = '';\n\n // first gather data\n var title = obj.meta[M_TITLE];\n if (!title) title = obj.title;\n \n artist = orig.aux['TPE2'];\n if (!artist)\n artist = obj.meta[M_ARTIST];\n if (!artist) \n {\n artist = '-unknown-';\n artist_full = null;\n }\n else\n {\n artist_full = artist;\n desc = artist;\n }\n \n var album = obj.meta[M_ALBUM];\n if (!album) \n {\n album = '-unknown-';\n album_full = null;\n }\n else\n {\n desc = desc + ', ' + album;\n album_full = album;\n }\n\n var discno = obj.aux['TPOS'];\n \n if (desc)\n desc = desc + ', ';\n \n desc = desc + title;\n \n var date = obj.meta[M_DATE];\n\tvar decade; // used for extra division into decades\n\n if (!date)\n {\n date = '-unknown-';\n\t\tdecade = null;\n }\n else\n {\n date = getYear(date);\n\t\tdecade = date.substring(0,3) + '0 - ' + String(10 * (parseInt(date.substring(0,3))) + 9) ;\n desc = desc + ', ' + date;\n }\n \n var genre = obj.meta[M_GENRE];\n if (!genre)\n {\n genre = '-unknown-';\n }\n else\n {\n desc = desc + ', ' + genre;\n }\n \n var description = obj.meta[M_DESCRIPTION];\n if (!description) \n {\n obj.meta[M_DESCRIPTION] = desc;\n }\n \n print (\"Import Audio: \" + desc);\n\n// for debugging only\n// print (\" M_TITLE = \" + orig.meta[M_TITLE]);\n// print (\" M_ARTIST= \" + orig.meta[M_ARTIST]);\n// print (\" M_ALBUM= \" + orig.meta[M_ALBUM]);\n// print (\" M_DATE= \" + orig.meta[M_DATE]);\n// print (\" M_GENRE= \" + orig.meta[M_GENRE]);\n// print (\" M_DESCRIPTION= \" + orig.meta[M_DESCRIPTION]);\n// print (\" M_REGION= \" + orig.meta[M_REGION]);\n// print (\" M_TRACKNUMBER= \" + orig.meta[M_TRACKNUMBER]);\n// print (\" M_AUTHOR= \" + orig.meta[M_AUTHOR]);\n// print (\" M_DIRECTOR= \" + orig.meta[M_DIRECTOR]);\n// print (\" AUX_TPE2= \" + orig.aux['TPE2']);\n// print (\" M_PUBLISHER= \" + orig.meta[M_PUBLISHER]);\n// print (\" M_RATING= \" + orig.meta[M_RATING]);\n// print (\" M_ACTOR= \" + orig.meta[M_ACTOR]);\n// print (\" M_PRODUCER= \" + orig.meta[M_PRODUCER]);\n\n// uncomment this if you want to have track numbers in front of the title\n// in album view\n\n var track = obj.meta[M_TRACKNUMBER];\n if (!track)\n track = '';\n else\n {\n if (track.length == 1)\n {\n track = '0' + track;\n }\n if (discno)\n {\n track = discno + track;\n obj.meta[M_TRACKNUMBER] = track;\n }\n track = track + ' - ';\n }\n// comment the following line out if you uncomment the stuff above :)\n// var track = '';\n\n// Start of parsing audio ///////////////////////////////////////////////\n\n\tvar disctitle = '';\n\tvar album_artist = '';\n\tvar tracktitle = '';\n\t\n// ALBUM //\n// Extra code for correct display of albums with various artists (usually Collections)\n if (!description)\n\t{\n\t\talbum_artist = album + ' - ' + artist;\n\t\ttracktitle = track + title;\n\t}\n\telse\n\t{\n\t if (description.toUpperCase() == 'VARIOUS')\n\t\t{\n\t\t\talbum_artist = album + ' - Various';\n\t\t\ttracktitle = track + title + ' - ' + artist;\n\t\t}\n\t else\n\t\t{\n\t\t\talbum_artist = album + ' - ' + artist;\n\t\t\ttracktitle = track + title;\n\t\t}\n\t}\n\n// ALBUM //\n\t// current\n\t// we do not need this sorting currently ...\n\t//chain = new Array('-Audio-', '-Album-', abcbox(album, 6, '-'), \n\t//\t\t\t\talbum.charAt(0).toUpperCase(), album_artist);\n\t//obj.title = tracktitle;\n\t//addCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_ALBUM);\n\t// DEBUG ONLY print (\"Added Audio -Album-ABCD-\" + album.charAt(0).toUpperCase() + \"-\" + album_artist + \"-: \" + tracktitle);\n\n// ARTIST //\n\tchain = new Array('-Audio-', '-Artist-', abcbox(artist, 6, '-'),\n\t\t\t\t\tartist.charAt(0).toUpperCase(), artist, '-all-');\n obj.title = title + ' (' + album + ', ' + date + ')'; \n\t// DEBUG ONLY print (\"Added Audio -Artist-ABCD-\" + artist.charAt(0).toUpperCase() + \"-\" + artist + \"-all-: \" + obj.title);\n\taddCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_ARTIST);\n\n\tobj.title = tracktitle;\n\tchain = new Array('-Audio-', '-Artist-', abcbox(artist, 6, '-'), \n\t\t\t\t\tartist.charAt(0).toUpperCase(), artist, date + \" - \" + album);\n\t//\tobj.title = tracktitle;\n\t// DEBUG ONLY print (\"Added Audio -Artist-ABCD-\" + artist.charAt(0).toUpperCase() + \"-\" + artist + \"-\" + date + \" - \" + album + \"-:\" + obj.title);\n\taddCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_ARTIST);\n\t\n// ARTIST flattened //\n\tchain = new Array('-Audio-', '-Artist-', '_all-', artist, '-all-');\n obj.title = title + ' (' + album + ', ' + date + ')'; \n\t// DEBUG ONLY print (\"Added Audio -Artist-ABCD-\" + artist.charAt(0).toUpperCase() + \"-\" + artist + \"-all-: \" + obj.title);\n\taddCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_ARTIST);\n\n\tobj.title = tracktitle;\n\tchain = new Array('-Audio-', '-Artist-', '_all-', artist, date + \" - \" + album);\n\t//\tobj.title = tracktitle;\n\t// DEBUG ONLY print (\"Added Audio -Artist-ABCD-\" + artist.charAt(0).toUpperCase() + \"-\" + artist + \"-\" + date + \" - \" + album + \"-:\" + obj.title);\n\taddCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_ARTIST);\n\t\n// GENRE //\n // no sense for GENRE - unsorted typically\n \n // chain = new Array('-Audio-', '-Genre-', genre, '-all-');\n // obj.title = title + ' - ' + artist_full;\n // addCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC);\n \n // chain = new Array('-Audio-', '-Genre-', genre, abcbox(artist, 6, '-'), artist.charAt(0).toUpperCase(), artist, album);\n\t// if (!discno) { obj.title = tracktitle; }\n\t// else { obj.title = disctitle; }\n\t// addCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_ARTIST);\n\n// TRACKS //\n // no \"all\" tracks - does not make any sense\n // var chain = new Array('-Audio-', '-Track-', '-all-');\n // obj.title = title + ' - ' + artist_full;\n // addCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC);\n\n\tchain = new Array('-Audio-', '-Track-', abcbox(title, 6, '-'), title.charAt(0).toUpperCase());\n obj.title = title + ' - ' + artist + ' (' + album + ', ' + date + ')';\n\t// DEBUG ONLY print (\"Added Audio -Track-ABCD-\" + title.charAt(0).toUpperCase() + \"-: \" + obj.title);\n addCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_ARTIST);\n\n// ALL //\n// chain = new Array('-Audio-', '-all-');\n// obj.title = title + ' - ' + artist;\n// addCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC);\n\n// YEAR //\n// Ordered into decades \n\tif (!decade)\n\t{\n\t\tchain = new Array('-Audio-', '-Year-', date, abcbox(artist, 6, '-'), artist.charAt(0).toUpperCase(), artist, album);\n\t\taddCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_ALBUM);\n\t // DEBUG ONLY print (\"Added Audio -Year-\" + date + \"-ABCD-\" + artist.charAt(0).toUpperCase() + \"-\" + artist + \"-\" + album + \"-:\" + obj.title);\n }\n\telse\n\t{\n\t\tchain = new Array('-Audio-', '-Year-', decade, date, '-all-');\n\t\taddCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_ARTIST);\n\t // DEBUG ONLY print (\"Added Audio -Year-\" + decade + \"-\" + date + \"-all-\" + \"-:\" + obj.title);\n\n\t\tobj.title = tracktitle;\n\n\t\tchain = new Array('-Audio-', '-Year-', decade, '-all-', artist, album);\n\t\taddCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_ALBUM);\n\t // DEBUG ONLY print (\"Added Audio -Year-\" + decade + \"-all-\" + artist + \"-\" + album + \"-:\" + obj.title);\n\n\t\tchain = new Array('-Audio-', '-Year-', decade, date, artist + \" - \" + album);\n\t\taddCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_ARTIST);\n\t // DEBUG ONLY print (\"Added Audio -Year-\" + decade + \"-\" + date + \"-\" + artist + \" - \" + album + \"-:\" + obj.title);\n\t}\n}", "function preload() {\n song = loadSound('Sound-of-water-running.mp3');\n}", "_loadAudio(index) {\n const chunk = this.chunks[index];\n console.log(`loading chunk ${chunk.text}`);\n if (!chunk.audio.src) {\n chunk.audio.src = `${Speech.API_URL}/api/article_podcast/listen?podcastId=${this.id}&chunk=${index}&gender=${this.speaker}&token=${this.auth_token}&_t=${Math.random()}.mp3`;\n }\n }", "function preload() {\n song1 = loadSound('assets/DaydreamBlissSYBS.mp3');\n song1.loop();\n song1.stop();\n}", "function preload() {\n //imgcover = loadImage(\"best-of-british-cover.jpg\")\n //imgqueen = loadImage(\"Queen-Bohemian-Rhapsody.jpg\");\n //imgbetty = loadImage(\"bouncing-betty.svg\");\n song1 = loadSound(\"voice1.mp3\");\n}", "function audioFromFile() {\n document.getElementById('queue').style = 'block';\n document.getElementById('queue').innerHTML = 'Queue: <br>';\n \n files = document.getElementById('files').files;\n index = 0;\n\n for (let i = 0, file; file = files[i]; i++) {\n document.getElementById('queue').innerHTML +=\n \"<span id='song\" + i + \"' style='color:black'>\" + (i + 1) + '. ' + file.name.match(/(.+)\\./)[1] + '</span><br>';\n }\n \n playFromFile();\n}", "function preload(){ //My media\n thud = loadSound(\"thud.mp3\"); //noise when you hit the \"a\" key\n song = loadSound(\"halloween.mp3\"); //background music\n img = loadImage(\"ghost.png\"); //ghost icon\n}", "function loadSongsToDOM() {\n\n}", "function loadExample() {\n\tdocument.getElementById('fileInput').value = '';\n\tlet request = new XMLHttpRequest();\n\trequest.open('GET', './example.mid', true);\n\trequest.responseType = 'arraybuffer';\n\trequest.onerror = (e) => console.error('Unable to load example MIDI.');\n\trequest.onload = () => {\n\t\tlet arraybuffer = request.response;\n\t\tif (arraybuffer) {\n\t\t\tloadData(new Uint8Array(arraybuffer));\n\t\t}\n\t};\n\trequest.send();\n}", "function preload(){\t\n\ttextLines = loadStrings('Text/HPch1.txt');\n\thpFont = loadFont('Font/harry_p/HARRYP__.ttf');\n\thpJingle = loadSound('HarryPotter_HedwigsTheme_Short.wav');\n}", "function audioVisualizer(volhistory, k) {\n\tbeginShape();\n\tfor (var i=0; i<width/2; i++) {\n\t\tif (volhistory[i] < 0.1) {\n\t\t\tvar y = 0;\n\t\t} else {\n\t\t\tvar y = map(volhistory[i], 0, 1, -10, 10, true);\n\t\t}\n\t\tvar z = y - 0.6*y*sin(i);\n\t\tcurveVertex(2*i, k+z);\n\t}\n\tendShape();\n}", "function playAudioDraw() {\n new Audio(\"assets/audio/draw.mp3\").play();\n\n}", "function preload() {\n\taudio = loadSound(\"audio/DancinWithTheDevil-LindsayPerry.mp3\");\n}", "function loadMusic(ruta){\n\tvar source = document.getElementById('source')\n\tvar folder =\"audio\";//Carpeta donde tenemos almancenada la musica\n\tsource.src= folder+\"/\"+ruta\n\tvar index= indiceActual[0]= canciones.indexOf(ruta)\n\tremoveActive()\n\tvar item=document.getElementById(index)\n\titem.classList.add(\"active\");\n\treproduccionActual(\"Playing: \"+ ruta)\n\tplayer.load()\n}", "function prevMusic() {\n if( audio.currentTime > 3 ) audio.currentTime = 0\n else startMusic-- \n\n if( startMusic < 0 ) startMusic = musicList.length - 1\n loadMusic( musicList[startMusic] )\n playMusic()\n}", "function loadVid1(){\n player1.cuePlaylist({listType:\"search\",\n list: \"documentary \" + QueryString.NAinterest,\n videoCategoryID: 'Education',\n startSeconds:0,\n suggestedQuality:\"large\"});}", "function startMusic(){\n var music = new Audio('C:/Users/João Gaspar/Desktop/Game Project/audios/02 - Start.mp3');\n music.play();\n}", "function loadTrack(index_no) {\r\n clearInterval(timer);\r\n resetSlider();\r\n track.src = All_songs[index_no].path;\r\n title.innerHTML = All_songs[index_no].name;\r\n trackImage.src = All_songs[index_no].img;\r\n artist.innerHTML = All_songs[index_no].singer;\r\n track.load();\r\n\r\n total.innerHTML = All_songs.length;\r\n present.innerHTML = index_no + 1;\r\n timer = setInterval(range_slider, 1000);\r\n}", "function playSong(){\n song.src = songs[currentSong]; //set the source of 0th song \n songTitle.textContent = songs[currentSong].slice(6, -4); // set the title of song\n song.play(); // play the song\n}", "function preload(){\n soundFile = loadSound(\"assets/CowMoo.mp3\");\n}", "function preload() {\n wave = loadSound('wave.mp3');\n gulls = loadSound('seagulls.mp3');\n\n\n}", "function prerun() \n{\n var fileUrl = \"/public/js/\";\n var fileName;\n var folderName = \"/\";\n var canRead = true;\n var canWrite = false;\n\n fileName = [\n \"vacuum.wav\",\n \"crowd.wav\",\n ];\n\n for (var count = 0; count < fileName.length; count++)\n {\n FMOD.FS_createPreloadedFile(folderName, fileName[count], fileUrl + fileName[count], canRead, canWrite);\n } \n}", "function vidLoad() {\n movie.loop();\n movie.volume(0);\n}", "function vidLoad() {\n movie.loop();\n movie.volume(0);\n}", "function playFromFile() {\n var reader = new FileReader();\n\n if (audioCtx == null) {\n audioCtx = new (window.AudioContext || window.webkitAudioContext)();\n }\n\n analyzer = audioCtx.createAnalyser();\n analyzer.fftsize = 512;\n document.getElementById('loading').style.display = 'block';\n // creates audio source and analyzer from inputed file\n reader.onload = function (e) {\n audioCtx.decodeAudioData(e.target.result, function (buf) {\n document.getElementById('loading').style.display = 'none';\n document.getElementById('song' + index).style.color = 'green';\n source = audioCtx.createBufferSource();\n source.connect(analyzer);\n //source.connect(audioCtx.destination); // causes distortion\n analyzer.connect(audioCtx.destination);\n source.buffer = buf;\n source.start(0);\n source.onended = function() {// plays next song if any in queue\n document.getElementById('song' + index).style.color = 'black';\n\n if (index !== files.length - 1) {\n index++;\n playFromFile();\n }\n };\n\n })\n };\n reader.readAsArrayBuffer(files[index]);\n \n dataArray = new Uint8Array(analyzer.frequencyBinCount);\n analyzer.getByteFrequencyData(dataArray); // sets audio data\n}", "function preload(){\n pathImg = loadImage(\"depositphotos_211414398-stock-video-halloween-shortcut-road-forest-scary.jpg\");\n playerImg = loadAnimation(\"boy running 1.png\",\"boy running 2.png\",\"boy running 3.png\",\"boy running 4.png\");\n forestSound = loadSound(\"dark-forest.mp3\");\n wolfHowl = loadSound(\"mixkit-lone-wolf-howling-1729.wav\");\n fireImg = loadImage(\"fire.png\");\n coinImg = loadImage(\"—Pngtree—coin golden 3d digital_5879622.png\")\n //coinSound = loadSound(\"mixkit-space-coin-win-notification-271.wav\")\n cactusImg = loadImage(\"kisspng-cactus-clip-art-portable-network-graphics-image-fr-cactus-png-transparent-images-pictures-photos-pn-5c9d2a4d7ac150.5892471815538038535028.png\")\n \n \n}", "function addAudio(obj)\n{\n var desc = '';\n var artist_full;\n var album_full;\n\tvar extension;\n\tvar albumartist;\n \n // first gather data\n var title = obj.meta[M_TITLE];\n if (!title) title = obj.title;\n \n \t// Grab artist, if emtpy, mark as unknown\n var artist = obj.meta[M_ARTIST];\n if (!artist) \n {\n artist = 'Unknown';\n artist_full = null;\n }\n else\n {\n artist_full = artist;\n desc = artist;\n }\n\n \t// Add retrieval of album artist object based on file type\n\t// Code be extended but I only need mp3 and flac\n\textension = obj.title.split('.').pop().toUpperCase();\n\tif ( extension.indexOf(\"MP3\") !== -1 ){\n\t\talbumartist = obj.aux['TPE2'];\n }\n\telse if ( extension.indexOf(\"FLAC\") !== -1 ){\n\t\talbumartist = obj.aux['ALBUM ARTIST'];\n }\n var album = obj.meta[M_ALBUM];\n if (!album) \n {\n album = 'Unknown';\n album_full = null;\n }\n else\n {\n desc = desc + ', ' + album;\n album_full = album;\n }\n \n if (desc)\n desc = desc + ', ';\n \n desc = desc + title;\n \n var date = obj.meta[M_DATE];\n if (!date)\n {\n date = 'Unknown';\n }\n else\n {\n date = getYear(date);\n desc = desc + ', ' + date;\n }\n \n var genre = obj.meta[M_GENRE];\n if (!genre)\n {\n genre = 'Unknown';\n }\n else\n {\n desc = desc + ', ' + genre;\n }\n \n var description = obj.meta[M_DESCRIPTION];\n if (!description) \n {\n obj.meta[M_DESCRIPTION] = desc;\n }\n \n\n\t// Provides track number metadata\n var track = obj.meta[M_TRACKNUMBER];\n\t// Delimiter for tracks\n\tvar trackDelimiter = '-';\n if (!track)\n track = '';\n else\n\t{\n if (track.length == 1)\n {\n track = '0' + track;\n }\n track = track + ' ' + trackDelimiter + ' ';\n }\n\n // Display track title as title alone, track may be useful later\n\tobj.title = title;\n\tvar currTitle = obj.title;\n \n\t// for all music we want to display album then track details\n\tvar chain = new Array('Music', 'All Music');\n obj.title = album + ' - ' + track + currTitle;\n addCdsObject(obj, createContainerChain(chain));\n\t// reset title\n\tobj.title = currTitle;\n \n\t// Artists with album subset\n\tif ( albumartist === '' || albumartist === null || albumartist == undefined ){\n \tchain = new Array('Music', 'Artist/Album', abcbox(artist, '',''), artist, album + ' [' + extension + ']');\n\t}else{\n \tchain = new Array('Music', 'Artist/Album', abcbox(albumartist, '',''), albumartist, album + ' [' + extension + ']');\n\t}\n addCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_ALBUM);\n \n\t// Artists with all tracks by them\n\tif ( albumartist === '' || albumartist === null || albumartist == undefined ){\n \tchain = new Array('Music', 'Artist/All Tracks', abcbox(artist, '',''), artist);\n\t}else{\n \tchain = new Array('Music', 'Artist/All Tracks', abcbox(albumartist, '',''), albumartist);\n\t}\n\t// Before we add, we'll add the album to the title\n\tobj.title = album + ' - ' + track + currTitle;\n addCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER);\n\tobj.title = currTitle;\n\n\t// Albums by letter\n chain = new Array('Music', 'Albums', abcbox(album, '',''), album + ' [' + extension.toUpperCase() + ']' );\n addCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_ALBUM);\n \n\t// Genres\n chain = new Array('Music', 'Genres', genre);\n addCdsObject(obj, createContainerChain(chain), UPNP_CLASS_CONTAINER_MUSIC_GENRE);\n \n\t// Music by year, album letter, album\n chain = new Array('Music', 'Year', date, abcbox(album, '',''), album + ' [' + extension.toUpperCase() + ']' );\n addCdsObject(obj, createContainerChain(chain));\n}", "function main() {\n setupWebGL(); // set up the webGL environment\n setupTextures(); // load textures\n loadModels(); // load in the models from tri file\n var snd2 = new Audio(TEXTURES_URL + \"Game_Music.mp3\");\n snd2.addEventListener('ended', function() {\n this.currentTime = 0;\n this.play();\n }, false);\n snd2.play();\n setupShaders(); // setup the webGL shaders\n \n \n} // end main", "function loadTrack(track_index) \r\n{\r\n // clear the previous seek timer \r\n clearInterval(updateTimer);\r\n resetValues();\r\n\r\n // load a new track\r\n curr_track.src = track_list[track_index].path;\r\n curr_track.load();\r\n\r\n // update details of the track\r\n track_art.style.backgroundImage = \"url(\" + track_list[track_index].image + \")\";\r\n track_name.textContent = track_list[track_index].name;\r\n track_artist.textContent = track_list[track_index].artist;\r\n now_playing.textContent = \"PLAYING \" + (track_index + 1) + \" OF \" + track_list.length;\r\n\r\n // set an interval of 1000 milliseconds\r\n // for updating the seel slider \r\n\r\n updateTimer = setInterval(seekUpdate, 1000);\r\n\r\n /*\r\n move to the next track if the current finishes playing\r\n using the 'ended' event\r\n */\r\n curr_track.addEventListener(\"ended\", nextTrack);\r\n // applies random bg color \r\n random_bg_color();\r\n}", "function preload() {\n soundFormats('mp3', 'ogg');\n sound = loadSound('./audio/sound4.mp3');\n}", "function preload() {\n //bling = loadSound('images/sound.mp3');\n}", "function preload() {\n\n\n slice = loadSound(\"sound/slice.mp3\");\n death = loadSound(\"sound/death.mp3\");\n\n\n}", "function preload() {\n backgroundMusic = loadSound(\"assets/mlg.mp3\");\n spellSound = loadSound(\"assets/hitmaker.mp3\");\n cat = loadImage(\"assets/cat.png\");\n}", "function loadMusic(url) {\n waveArr = [];\n highestVocal = 0;\n duration = 0;\n currTime = 0;\n timeIdx = 0;\n\n var req = new XMLHttpRequest();\n req.open( \"GET\", url, true );\n req.responseType = \"arraybuffer\";\n req.onreadystatechange = function (e) {\n if (req.readyState == 4) {\n if(req.status == 200)\n audioContext.decodeAudioData(req.response,\n function(buffer) {\n currentBuffer = buffer;\n displayBuffer(buffer);\n }, onDecodeError);\n else\n alert('error during the load.Wrong url or cross origin issue');\n }\n } ;\n req.send();\n}", "function preload()\n{\n // load media:\n tednose = loadImage('./data/tednose.png');\n for(var i = 0 ;i<substance.length;i++) {\n substance[i] = loadSound('./data/substance.mp3');\n }\n}", "function preload() {\n song = loadSound(`assets/sounds/song.mp3`);\n}", "function preload() {\r\n song1 = loadSound('assets/mind.m4a');\r\n song2 = loadSound('assets/alone.m4a');\r\n}", "function music_start() {\n\t// get samples \n\tdata_array = new Float32Array(analyser.frequencyBinCount);\n\tanalyser.getFloatFrequencyData(data_array);\n\n\t// camera gray scale\n\tvar gScale = data_array[4] + 26.5\n\n\t// color and filter with Kick\n\tif ( (data_array[4] > slider_value) && (pre + 5<data_array[4]) ){\n\t\ta = a + 100;\n\t\ta = a % 360;\n\t\tgScale_env = gScale;\n\t\t//first beat pass\n\t\tif (f==1){\n\t\t\trandom_select();\n\t\t\trandom_interval = setInterval(random_select,count_value*1000*beat_interval)\n\t\t}\n\t\tf=0;\n\t}\n\telse{\n\t\tgScale_env = gScale_env - 0.5;\n\t\t//saturate = saturate-0.3;\n\t\tif (gScale_env<0){\n\t\t\tgScale_env = 0;\n\t\t}\n\t\telse if (gScale_env>10){\n\t\t\tconsole.log(gScale_env)\n\t\t\tgScale_env=10;\n\t\t}\n\t}\n\tpre = data_array[4];\n\tdocument.getElementById(\"videoCanvas\").style.filter=\"blur(\" + gScale_env +\"px) saturate(\" + saturate +\") invert(\" + invert +\"%) sepia(\" + sepia + \"%) contrast(\" + contrast +\"%)\";\n\tdraw_visualizer()\n}", "function VkoptAudio()\r\n/* knopka dlya skachivaniya audio\r\n thanks to [Sergey GrayFace Rojenko]\r\n (iznachal'naya ideya vzyata u nego, no pererabotana dlya\r\n sovmestimosti s FireFox */\r\n{\r\n\tvar bar = document.getElementById(\"audioBar\");\r\n\r\n\tif (bar)\r\n\t{\r\n\t\tbar = bar.firstChild;\r\n\t\tif (bar) bar = bar.nextSibling; // <div class=\"column mainPanel\">\r\n\t\tif (bar) bar = bar.firstChild;\r\n\t\tif (bar) bar = bar.nextSibling; // <div id=\"audios\"\r\n\t}\r\n\telse\r\n\t{\r\n\t\tbar = document.getElementById(\"audios\");\r\n\t\tif (bar)\r\n\t\t{\r\n\t\t\tbar = bar.firstChild;\r\n\t\t\tif (bar) bar = bar.nextSibling; // <div class=\"bOpen\">\r\n\t\t\tif (bar) bar = bar.nextSibling;\r\n\t\t\tif (bar) bar = bar.nextSibling; // <div class=\"c\">\r\n\t\t\tif (bar) bar = bar.firstChild;\r\n\t\t\tif (bar) bar = bar.nextSibling; // <div class=\"whenOpen\">\r\n\t\t\tif (bar) bar = bar.firstChild;\r\n\t\t\tif (bar) bar = bar.nextSibling; // <div class=\"fSub clearFix\">\r\n\t\t\tif (bar) bar = bar.nextSibling;\r\n\t\t\tif (bar) bar = bar.nextSibling; // <div class=\"flexBox clearFix\"\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tbar = document.getElementById(\"bigResult\");\r\n\t\t\tif (bar) bar = bar.firstChild;\r\n\t\t\tif (bar) bar = bar.nextSibling; // <div>\r\n\t\t\tif (bar) bar = bar.firstChild;\r\n\t\t\tif (bar) bar = bar.nextSibling; // <div style=\"padding:20px\" >\r\n\t\t}\r\n\t}\r\n\t\r\n\tif (bar)\r\n\t{\r\n\t\tvar row = bar.firstChild;\r\n\t\tif (row) row = row.nextSibling;\r\n\r\n\t\twhile (row && (row.className== 'audioRow'))\r\n\t\t{\r\n\t\t\tvar td = row.getElementsByTagName('td')[0];\r\n\r\n\t\t\t// Generate URL\r\n\t\t\tvar script = td.innerHTML.split('onclick=\"')[1].split('\"')[0];\r\n\t\t\tscript = script.substring(script.indexOf('(') + 1, script.indexOf(')'));\r\n\t\t\tvar params = script.split(',');\r\n\t\t\tvar server = params[1];\r\n\t\t\tvar user = params[2];\r\n\t\t\twhile (user.length < 5) user = '0' + user;\r\n\t\t\tvar fname = params[3];\r\n\t\t\tfname = fname.substring(1, fname.length - 1); // remove '\r\n\t\t\t\r\n\t\t\tfname = 'http://cs' + server + '.vkontakte.ru/u' + user + '/audio/' + fname + '.mp3';\r\n\r\n\t\t\t// Add link\r\n\t\t\ttd.style.width = '48px';\r\n\t\t\ttd.innerHTML+=\r\n\t\t\t\t'<a href= \"'+ fname+ '\"><img src= \"http://vkopt.nm.ru/save2.gif\"></a>';\r\n\t\t\t\t\t\t\r\n\t\t\trow = row.nextSibling;\r\n\t\t\tif (row) row = row.nextSibling;\r\n\t\t}\r\n\t}\r\n}", "function soundSetup(){\n updateState(false, false);\n varSong = [];\n varSongID = [];\n currentVarSongIndex = 0;\n varSongLength = 4;\n mainSong = new Howl({\n src: ['Songs/1_main.mp3'],\n loop:true\n });\n for(var x = 1; x<=varSongLength; x++){\n varSong[x-1] = new Howl({\n src: ['Songs/1_var'+x+'.mp3']\n });\n}\nresetIDs();\n\n}", "function preload() {\n soundFormats('mp3', 'ogg');\n mySound = loadSound('Goodbye Mix by Spheriá.mp3');\n}", "function proccessSong() {\n player.bind('loadedmetadata', function () {\n // Increase view song\n\n s_duration = player.prop('duration');\n // Show duration\n // Call toMinutes function for converting second to minutes\n var duration = toMinutes(s_duration);\n $(\".duration\").html(duration);\n // Update current time\n var old_lyr = 0;\n var cur_lyr;\n var active = 1;\n var deactive = 2;\n // player.bind('timeupdate', function () {\n myInterval = setInterval(function () {\n if (player.prop('paused') === false) {\n var s_currentTime = player.prop('currentTime');\n // Call toMinutes function for converting second to minutes\n currentTime = toMinutes(s_currentTime);\n // Show current time\n $(\".current-time\").html(currentTime);\n // Set seek-point\n // $('#seek').val(player.prop('currentTime') * 100 / player.prop('duration'));\n var percent_done = player.prop('currentTime') * 100 / player.prop('duration');\n $('#seek #seek-cursor').css('left', percent_done - 1 + '%');\n // Finish playing -> next song\n if (s_currentTime >= s_duration*0.995) {\n current_index = nextIndex();\n setSong(json_data[current_index]);\n if (mode == 2) showList();\n }\n // Start update lyric to player\n if (has_time_lyric == true) {\n // Call getLyric\n cur_lyr = getLyric(s_currentTime, lyric);\n if (cur_lyr != undefined) {\n var width = (s_currentTime - cur_lyr.start) * 100 / cur_lyr.dur;\n // Modify width a bit\n // width = width > 93 ? width += 15 : width;\n // Compare old lyc and new lrc. If have update -> replace html\n $('.lyric-' + deactive + ' > .kara').css('width', width + '%');\n if (JSON.stringify(old_lyr) != JSON.stringify(cur_lyr)) {\n deactive = active == 1 ? 2 : 1;\n // Show lyric when it is not empty\n if (cur_lyr.lyr != '') {\n $('.lyric-' + active).html(cur_lyr.lyr + '<span class=\"kara\" style=\"width: ' + width + '%\">' + cur_lyr.lyr + '</span>');\n // $('.lyric-' + active).append();\n }\n // Check nextlyric if it is not empty\n if (cur_lyr.next_lyr != '') {\n // setTimeout(function(){\n $('.lyric-' + deactive).html(cur_lyr.next_lyr);\n // },1000);\n\n }\n // Swap active and deactive\n var temp = active;\n active = deactive;\n deactive = temp;\n old_lyr = cur_lyr;\n } else {\n // Else change kara width\n // $('.lyric-' + deactive + ' > .kara').css('width', width + '%');\n }\n }\n }\n }\n },50);\n // });\n });\n }", "function modifyAudio(file){\n document.getElementById('audio').src = file;\n\n}", "function mediaPlayerOpeningHandler() {\r\n\tinsertText(\"playingSongTitle\", currentPlayFileName);\r\n}", "function preload() {\n hornS = loadSound('music/horn.mp3');\n growlS = loadSound('music/growl.mp3');\n waveS = loadSound('music/wave.mp3');\n woof = loadSound('music/woof.mp3');\n creak = loadSound('music/creak.wav');\n rainS = loadSound('music/rain.mp3');\n seaS = loadSound('music/sea.mp3');\n pianoS = loadSound('music/piano.mp3');\n catGif = loadImage(\"images/cat.gif\");\n mapPng = loadImage(\"images/map.png\");\n cloudPng = loadImage(\"images/cloud.png\");\n moonPng = loadImage(\"images/moon.png\");\n lightBeam = loadImage(\"images/lightbeam.png\");\n shipPng = loadImage(\"images/ship.png\");\n dogPng = loadImage(\"images/dog.gif\");\n fishCatPng = loadImage(\"images/fishingCat.gif\");\n danceCatPng = loadImage(\"images/danceCat.gif\");\n tentacles = loadImage(\"images/tentacles.gif\");\n catKren = loadImage(\"images/catken.gif\");\n miracleFont = loadFont(\"fonts/miracle.ttf\");\n}", "preload() {\n // we gaan nu muziek afspelen\n this.load.audio('test', ['assets/avemaria.mp3']);\n }", "function preload(){\n table = loadTable(\"data/team_data.csv\", \"csv\", \"header\");\n \n cheer = loadSound(\"images/cheer.mp3\");\n table = loadTable(\"data/gsw.csv\", \"csv\", \"header\");\n table2 = loadTable(\"data/okc.csv\", \"csv\", \"header\");\n table3 = loadTable(\"data/nyk.csv\", \"csv\", \"header\");\n table4 = loadTable(\"data/cc.csv\", \"csv\", \"header\");\n table5 = loadTable(\"data/team_data.csv\", \"csv\", \"header\");\n}", "function visual() {\n\n //first new beat, draw hexagons\n if (song.currentTime() > 14) {\n for (i = 100; i < windowWidth; i += 100) {\n for (j = -100; j < windowHeight; j += 100) {\n stroke(255);\n strokeWeight(0.4);\n fill(0);\n polygon(i, j, volume * 0.5, 6);\n }\n }\n }\n\n //second new beat, draw gray ellipses\n if (song.currentTime() > 28) {\n for (t = 50; t < windowWidth; t += 100) {\n for (z = -100; z < windowHeight; z += 100) {\n stroke(0);\n strokeWeight(0.4);\n fill(120);\n ellipse(t, z, volume * 0.2);\n }\n }\n }\n\n //third new beat, draw squares\n if (song.currentTime() > 36) {\n for (h = -100; h < windowWidth + 100; h += 100) {\n for (l = 150; l < windowHeight + 200; l += 200) {\n stroke(\"#b0f11d\");\n strokeWeight(0.5);\n fill(0);\n polygon(h, l, volume * 0.1, 4);\n }\n }\n }\n\n //fourth new beat, draw ellipses\n if (song.currentTime() > 68) {\n for (g = 50; g < windowWidth; g += 100) {\n for (r = 50; r < windowHeight; r += 200) {\n stroke(\"#b0f11d\");\n strokeWeight(0.4);\n fill(0);\n ellipse(g, r, volume * 0.2);\n }\n }\n }\n\n//once the song reaches a certain point, it stops and the whole animation gets refreshed\n if (song.currentTime() > 75) {\n song.stop();\n reset();\n }\n}", "function preload() {\n main_bgm = loadSound('./libraries/snowy.mp3');\n}", "function loadResults(songMetaData) {\n playlist.unshift(songMetaData);\n // console.log(playlist);\n saveFile();\n}", "function Play(songs) {\r\n title.textContent = songs.title1;\r\n singer.textContent = songs.artist;\r\n song.src = songs.name;\r\n songImage.src = songs.cover;\r\n playMusic();\r\n}", "function loadSong( track ){\n currentTrack = track;\n $( '#target' ).empty();\n// Animation Check for Tracks\n if ( !animationRunning ) {\n anim();\n animationRunning = true;\n }\n// getJSON for Tracks - Takes songURLs from array(above)\n var $xhr = $.getJSON(`https://cors-anywhere.herokuapp.com/http://api.soundcloud.com/resolve?url=${songURLs[track]}&client_id=cf8a5ad4e3dc1198d5853833155de0bc`);\n $xhr.done(function( track ) {\n var count = 0;\n if ( $xhr.status !== 200 ) {\n return;\n }\n// Track Embed Autoplay\n var trackURL = track.permalink_url;\n SC.oEmbed(trackURL, {\n auto_play: true,\n element: document.getElementById( 'target' )\n })\n .then(function( embed ) {\n\n// SC.oEmbed player style and position\n $( '#target' ).css({\n height: '100px',\n width: '500px',\n float: 'right',\n position: 'absolute',\n bottom: '75px',\n right: '30px',\n zindex: '99'\n });\n\n\n// SC Widget for autoplaying tracks\n var iframeElement = document.querySelector( 'iframe' );\n var widget = SC.Widget( iframeElement );\n widget.bind( finish, function(){\n currentTrack++;\n if ( currentTrack < 10 ) {\n loadSong( currentTrack );\n }\n });\n });\n });\n }" ]
[ "0.68576103", "0.6848677", "0.6532257", "0.64853764", "0.64853764", "0.6469244", "0.6353492", "0.6349311", "0.63193065", "0.63169926", "0.6299768", "0.6248122", "0.6239355", "0.6223669", "0.6190795", "0.61619973", "0.6152982", "0.6137016", "0.61286", "0.6123768", "0.6117744", "0.6103447", "0.60963696", "0.6096", "0.6086847", "0.60553366", "0.6041149", "0.6034003", "0.60278696", "0.6013063", "0.597949", "0.5951451", "0.5939713", "0.5928491", "0.59217656", "0.5920719", "0.5919011", "0.5919011", "0.59125406", "0.5897206", "0.58826935", "0.5881413", "0.58793515", "0.58777314", "0.58651155", "0.5846417", "0.58401597", "0.5837418", "0.58257854", "0.58253944", "0.5821767", "0.58160603", "0.5810314", "0.58069646", "0.5806354", "0.5805816", "0.58000386", "0.57984495", "0.5797225", "0.57965344", "0.57943726", "0.5779265", "0.57786715", "0.57625085", "0.57591677", "0.5746202", "0.57453096", "0.5738267", "0.5736353", "0.5733017", "0.5731986", "0.5730968", "0.5730968", "0.5717448", "0.5707779", "0.57060254", "0.56962085", "0.5687266", "0.5684338", "0.56797045", "0.56787395", "0.56726146", "0.5658439", "0.5653401", "0.5653346", "0.5647082", "0.56458735", "0.5640246", "0.5636236", "0.5629757", "0.56288713", "0.5627459", "0.56209147", "0.5619634", "0.5615573", "0.561249", "0.5610493", "0.56075215", "0.5607057", "0.5601276", "0.55886185" ]
0.0
-1
alias for sending JSON encoded messages
function send(message) { if(stompClient && stompClient.connected){ stompClient.send("/socket-subscriber/call", {}, JSON.stringify(message)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function JSONString(result, message){\r\n\tresult.write(JSON.stringify({quote: message}));\r\n\tresult.end();\t\r\n}", "sendMessage(type, data) {\n const message = { type: type, data: data };\n this.connection.send(JSON.stringify(message)); //La méthode JSON.stringify() convertit une valeur JavaScript en chaîne JSON\n }", "function send(msg) { ltSck.write(JSON.stringify(msg) + \"\\n\"); }", "function SendMessage(message)\n{\n client.sendEvent(new Message(JSON.stringify(message))); //, printResultFor(\"send\"));\n}", "function send_json_message(response, message) {\n\n\t// Log the message\n\tconsole.log(message);\n\n\tresponse.writeHead(200, {\"Content-Type\": \"application/json\"});\n\tresponse.write(JSON.stringify(message));\n\tresponse.end(); \n\t\n\tutility.update_status(message.status_message);\n}", "function sendJSON(json){\n\t\tvar message = JSON.stringify(json);\n\t\tconsole.log('Client socket: Sending json message: ' + message);\n\t\tmWebSocket.send(message);\n\t}", "_serialize() {\n let clazz = this.__clazz__ || 'org.arl.fjage.Message';\n let data = JSON.stringify(this, (k,v) => {\n if (k.startsWith('__')) return;\n return v;\n });\n return '{ \"clazz\": \"'+clazz+'\", \"data\": '+data+' }';\n }", "get json() {\n throw new Error('No implementation found for BaseMessage.json()')\n }", "function JSON() {}", "function sendJson(json) \n{\n var data = JSON.stringify(json);\n return sendData(data);\n}", "toJSON() {\n return {\n name: this.name,\n code: this.code,\n message: this.message,\n };\n }", "function packMessage(msgObj){\n\treturn JSON.stringify(msgObj);\n}", "addMsg(msg){\n this.socket.send(JSON.stringify(msg));\n }", "json(data) {\n\t\tthis.setHeader('content-type', 'application/json')\n\t\treturn this.send(JSON.stringify(data))\n\t}", "function JRMessage(){\n this.id = null;\n this.rpc_method = null;\n this.args = null;\n\n this.data = null;\n this.json = null;\n\n this.error = null;\n this.result = null;\n\n this.onresponse = null;\n this.success = null;\n\n this.to_json = function(){\n this.json = $.toJSON(this.data);\n return this.json;\n }\n\n this.handle_response = function(res){\n res.success = (res.error == undefined);\n if(this.onresponse)\n this.onresponse(res);\n }\n}", "function send(message) {\n conn.send(JSON.stringify(message));\n}", "function sendMsg(json){\n\t\tif(ws){\n\t\t\ttry{\n\t\t\t\tws.send(JSON.stringify(json));\n\t\t\t}\n\t\t\tcatch(e){\n\t\t\t\tconsole.log(\"error ws\", e);\n\t\t\t}\n\t\t}\n\t}", "function sendMsg(json){\n\t\tif(ws){\n\t\t\ttry{\n\t\t\t\tws.send(JSON.stringify(json));\n\t\t\t}\n\t\t\tcatch(e){\n\t\t\t\tconsole.log(\"error ws\", e);\n\t\t\t}\n\t\t}\n\t}", "function packMessages(msgObj){\n\treturn JSON.stringify(msgObj);\n}", "function msgToString(msg){\n\tif (msg.asString == undefined)\n\t{\n\t\tmsg.asString = JSON.stringify(msg);\n\t}\n\treturn msg.asString;\n}", "function JSON() {\r\n}", "function sendMsg(json){\n\t\tif(ws){\n\t\t\ttry{\n\t\t\t\tws.send(JSON.stringify(json));\n\t\t\t}\n\t\t\tcatch(e){\n\t\t\t\tconsole.log('[ws error] could not send msg', e);\n\t\t\t}\n\t\t}\n\t}", "function sendMsg(json){\n\t\tif(ws){\n\t\t\ttry{\n\t\t\t\tws.send(JSON.stringify(json));\n\t\t\t}\n\t\t\tcatch(e){\n\t\t\t\tconsole.log('error ws', e);\n\t\t\t}\n\t\t}\n\t}", "function sendMsg(json){\n\t\tif(ws){\n\t\t\ttry{\n\t\t\t\tws.send(JSON.stringify(json));\n\t\t\t}\n\t\t\tcatch(e){\n\t\t\t\tconsole.log('error ws', e);\n\t\t\t}\n\t\t}\n\t}", "function format_client_msg(msg_type, data) {\n data.type = msg_type;\n return JSON.stringify(data);\n}", "toJSON(){return Object.assign({name:this.name,message:this.message},this)}", "sendMessage(name, value) { \n this.websocket.send(\n JSON.stringify({\n variable: name,\n value: value\n }\n ));\n }", "json(obj) {\n return this.string(JSON.stringify(obj));\n }", "addMessage (content, username, userColor) {\n this.socket.send(JSON.stringify({\n type: 'incomingMessage', \n username, \n content,\n userColor\n }));\n }", "send (message) {\n $.ajax({\n url: this.server,\n type: 'POST',\n contentType: 'application/json',\n data: JSON.stringify(message),\n success: (data) => {\n console.log('chatterbox: Message sent', data);\n },\n error: (data) => {\n console.error('chatterbox: Failed to send message', data);\n }\n }); \n }", "sendMessages(payload) {\n return axios.post('/api/message/text_message_sending', payload)\n }", "sendIt(obj) {\n this.ws.send(JSON.stringify(obj));\n }", "function sendJSON(formInfoObj){\n\t//send it to redis\n\tredisClient.publish(\"bigbluebutton:bridge\", JSON.stringify(formInfoObj));\n}", "toJson() {\n return {\n 'success': this.success,\n 'message': this.message,\n 'data': this.data,\n 'error': this.error,\n };\n }", "_jsonEncode( data ) {\n if ( typeof data === 'object' ) {\n try { let json = JSON.stringify( data ); return json; }\n catch ( e ) { return JSON.stringify( e ); }\n }\n return '{}';\n }", "sendDetails(){\n console.log('sendDetails');\n var room = this;\n var cpy = [];\n\n // Liste sämtlicher Usernamen\n room.users.forEach(u => {\n cpy.push({Username: u.Username});\n });\n // ... zusammen mit Raum-Name und ob es ein Spiel-Raum ist (oder nicht)\n var msg = JSON.stringify({\n roomName: room.Roomname,\n userList: cpy,\n isPlayRoom: room.isPlayRoom\n });\n\n // .. als Server-Nachricht\n var data = {\n dataType: CHAT_ROOM,\n sender: \"Server\",\n message: msg\n };\n // .. an alle User im Raum senden\n room.sendAll(JSON.stringify(data));\n}", "function sendMsg(json) {\n if (ws) {\n try {\n ws.send(JSON.stringify(json));\n } catch (e) {\n console.log('error ws', e);\n }\n }\n }", "function sendMsg(json) {\n\t\t\tif (ws) {\n\t\t\t\ttry {\n\t\t\t\t\tws.send(JSON.stringify(json));\n\t\t\t\t}\n\t\t\t\tcatch (e) {\n\t\t\t\t\tlogger.debug('[ws error] could not send msg', e);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function sendMsg(json) {\n\t\t\tif (ws) {\n\t\t\t\ttry {\n\t\t\t\t\tws.send(JSON.stringify(json));\n\t\t\t\t}\n\t\t\t\tcatch (e) {\n\t\t\t\t\tlogger.debug('[ws error] could not send msg', e);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function sendMsg(json) {\n\t\t\tif (ws) {\n\t\t\t\ttry {\n\t\t\t\t\tws.send(JSON.stringify(json));\n\t\t\t\t}\n\t\t\t\tcatch (e) {\n\t\t\t\t\tlogger.debug('[ws error] could not send msg', e);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function defaultSuccess(json)\n{\n msg(\"success! \" + (typeof json == \"string\" ? json : JSON.stringify(json)));\n}", "function __encodeMsg (input, version = MSG_VERSION) {\n switch(version) {\n case 1:\n return JSON.stringify({\n version: 1,\n data: input,\n })\n break;\n default:\n throw new Error('Encoding for unknown version of message payload');\n }\n}", "send(type, data=null){\n // attempt to create json string and send\n try{\n // json string\n let json = JSON.stringify({type, data});\n\n // send\n ipcRenderer.send(\"req\", json);\n }\n catch(err){ \n // stringify or send error - handle?\n }\n }", "function sendMessage(message) {\n var mymsg = JSON.stringify(message);\n logg(\"SEND: \" + mymsg);\n console.log(\"****************************************\" + mymsg);\n socket.send(mymsg);\n}", "toString() { \n return `[Message; Text: ${this.text}; GUID: ${this.guid}]`;\n }", "function reply(message, code) {\n utils.writeJson(res, message, code);\n }", "messageHandler(obj) {\n const sender = obj.sender.id;\n const message = obj.message;\n let result = {};\n\n if (message.text) {\n result = {\n sender,\n type: 'text',\n content: message.text\n }\n return result;\n }\n }", "addNewMessage(messageContent) {\n let messageObj = {username: this.state.currentUser, content: messageContent, type: 'postMessage', colour: this.state.colour};\n this.socket.send(JSON.stringify(messageObj));\n }", "function sendMessage(payload) {\n socket.send(JSON.stringify(payload));\n}", "sendMessage(content_message)\n {\n\n let recipient = this.props.participants.get(this.props.currentUser);\n let sender = this.props.participants.get(recipient)\n\n let message = {\n content : content_message,\n recipient : recipient,\n sender: sender,\n fkConversation : this.props.conversation,\n date:Date.now()\n }\n this.client.send('/EZChat/'+message.fkConversation.id+'/private',{},JSON.stringify(message))\n }", "send (message) {\n if (_.isObject(message))\n message = MessageMaster.stringify(message)\n\n this.socket.send(message)\n }", "function sendTextMessage\n(\n phone,\n msg\n)\n{\n var res;\n var dataToSend = {\n \"action\" : SEND_TEXT_MESSAGE,\n \"phone\" : JSON.stringify(phone), \n \"msg\" : JSON.stringify(msg) \n }\n $.ajax({\n type : \"POST\",\n url : API_URL,\n data : dataToSend,\n async :false,\n dataType : \"json\",\n headers : HEADER,\n error : function (e) \n {\n res = -1;\n },\n success :function(jsonResult)\n {\n res = jsonResult;\n }\n });\n\n return res;\n}", "function send_message(message_type, msg) {\r\n var msg_contents = JSON.parse(msg);\r\n var json_msg;\r\n\r\n switch (message_type) { \r\n case \"usersyscheck\":\r\n // Prepare JSON message\r\n json_msg = {\r\n message_type: message_type\r\n };\r\n break;\r\n\r\n case \"userreg\":\r\n // Prepare JSON message\r\n json_msg = {\r\n message_type: message_type, \r\n player_name: msg_contents.player_name,\r\n player_ip: msg_contents.player_ip\r\n };\r\n break;\r\n\r\n case \"usermove\":\r\n // Prepare JSON message\r\n json_msg = {\r\n message_type: message_type,\r\n player_id: msg_contents.player_id, \r\n player_name: msg_contents.player_name, \r\n move_id: msg_contents.move_id, \r\n move: msg_contents.move\r\n };\r\n break;\r\n\r\n case \"userscores\":\r\n // Prepare JSON message\r\n json_msg = {\r\n message_type: message_type, \r\n scores: msg_contents.scores\r\n };\r\n break;\r\n \r\n case \"userquit\":\r\n // Prepare JSON message\r\n json_msg = {\r\n message_type: message_type,\r\n player_id: msg_contents.player_id, \r\n player_name: msg_contents.player_name\r\n };\r\n break;\r\n\r\n case \"userplay\":\r\n json_msg = {\r\n message_type: message_type\r\n };\r\n break;\r\n }\r\n \r\n // Convert and send data to socket\r\n socket.send(JSON.stringify(json_msg));\r\n}", "function sendMessage() {\r\n var currentdate = new Date();\r\n var myObj = {};\r\n myObj[\"ChatId\"] = vm.returnChat;\r\n myObj[\"MessageId\"] = \"x\";\r\n myObj[\"SenderId\"] = vm.currentUser.accountID; //currentdate.getDate()\r\n myObj[\"Message\"] = vm.textMessage;\r\n myObj[\"MessageTime\"] = currentdate.getFullYear() + \"-\" + (currentdate.getMonth() + 1) + \"-\" + currentdate.getDate() + \" \" + currentdate.getHours() + \":\" + currentdate.getMinutes() + \":\" + currentdate.getSeconds();\r\n myObj[\"AccountIcon\"] = vm.currentUser.avatar;\r\n vm.chatList.push(myObj);\r\n // var json = JSON.stringify(myObj);\r\n if (vm.textMessage != null) {\r\n StudyService.sendMessage(vm.returnChat, vm.currentUser.accountID, vm.textMessage, myObj[\"MessageTime\"]);\r\n }\r\n vm.textMessage = null;\r\n }", "function respondToMessages(message) {\n console.log(\"New message: \" + JSON.stringify(message));\n\n}", "function textJSONconstructor (sender_psid, recipient_id, data) {\n let payload;\n let text;\n\n // text can be stored in xml or by itself (standard reply)\n if (typeof data == 'object') {\n text = data.response.text;\n } else {\n text = data;\n }\n\n // construct\n payload = returnTextJSON(text);\n\n // route to sendAPI\n sendAPI(sender_psid, recipient_id, payload);\n}", "function serialize(msg) {\n var value;\n if (msg.buffers && msg.buffers.length) {\n value = serializeBinary(msg);\n }\n else {\n value = JSON.stringify(msg);\n }\n return value;\n}", "function sendMessage() {\n json.activeSince = moment();\n \n var message = JSON.stringify(json);\n \n console.log('Music ' + SOUNDS[json.instrument] + ' message : ' + message);\n\n socket.send(message, 0, message.length, protocol.PORT, protocol.MULTICAST_ADDRESS, function (err, bytes) {\n if (err) throw err;\n });\n}", "gotMessageFromServer(message) {\n var signal = JSON.parse(message.data);\n return signal;\n }", "sendMessage(message) {\n const serialized = JSON.stringify(message);\n this.dealerSocket.send([this.areaId, '', serialized]);\n }", "onClientMessage(message) {\n try {\n // Decode the string to an object\n const { event, payload } = JSON.parse(message);\n\n this.emit(\"message\", event, payload);\n } catch {}\n }", "function encodeSend(to) {\n return {\n to,\n method:0,\n params: \"\",\n }\n}", "function sendMessage(){}", "function send(data) {\n //console.log(data);\n client.send(JSON.stringify(data))\n }", "sendMessage(text) {\n const msg = {\n type: \"newMessage\",\n chatId: this.chatId(),\n user: this.state.user,\n text: text\n };\n this.ws.send(JSON.stringify(msg));\n }", "function sendWelcomeMessage(data){\n data.message = \"Hello, I can help you with searching hotels near your city of interest\";\n }", "encodeAsString(obj) {\n // first is type\n let str = \"\" + obj.type; // attachments if we have them\n\n if (obj.type === PacketType.BINARY_EVENT || obj.type === PacketType.BINARY_ACK) {\n str += obj.attachments + \"-\";\n } // if we have a namespace other than `/`\n // we append it followed by a comma `,`\n\n\n if (obj.nsp && \"/\" !== obj.nsp) {\n str += obj.nsp + \",\";\n } // immediately followed by the id\n\n\n if (null != obj.id) {\n str += obj.id;\n } // json data\n\n\n if (null != obj.data) {\n str += JSON.stringify(obj.data);\n }\n\n debug(\"encoded %j as %s\", obj, str);\n return str;\n }", "function send(client, obj) {\n console.log(\"Sending message to client\");\n client.send(JSON.stringify(obj));\n}", "function add_success_message(js) {\n\teEngine.model('message').msg(JSON.parse(js));\n}", "function sendMessage(){\n\tlet content_temp = $('#content_input').val();\n content_temp = content_temp.replace(/&/g, \"&amp;\").replace(/>/g, \"&gt;\").replace(/</g, \"&lt;\").replace(/\"/g, \"&quot;\");\n\n\tcontent_temp = convertContent(content_temp);\n\n let dataArray = {\n content: content_temp,\n room_name: LOCAL_SETTINGS.roomData.url,\n room_token: LOCAL_SETTINGS.roomData.room_token,\n user_id: LOCAL_SETTINGS.userData.id,\n user_token: LOCAL_SETTINGS.userData.user_token,\n nickname: LOCAL_SETTINGS.userData.nickname\n };\n\n // clear textarea and focus it\n $('#content_input').val('');\n $('#content_input').focus();\n\n // send new message\n $.post(ROOM_ID + \"/send-message\", dataArray, function (data) {\n let response = JSON.parse(data);\n console.log(response);\n });\n}", "function _sendMessage(command, args) {\n try {\n var _msg = args || {};\n _msg.cmd = command;\n\n var serialized = JSON.stringify(_msg);\n\n DBG('Sending Message : ' + serialized);\n var reply = extension.internal.sendSyncMessage(serialized);\n DBG('Got Reply : ' + reply);\n\n return JSON.parse(reply);\n } catch (e) {\n ERR('Exception: ' + e);\n }\n }", "newMessage(userName, messageText) {\n const newMessageObj = {\n type: 'user',\n username: userName,\n content: messageText\n };\n console.log('about to send:', newMessageObj);\n this.socket.send(JSON.stringify(newMessageObj));\n }", "function sendMessage(payload) {\n\tsocket.send(JSON.stringify(payload));\n}", "encodeAsString(obj) {\n // first is type\n let str = \"\" + obj.type;\n // attachments if we have them\n if (obj.type === PacketType.BINARY_EVENT ||\n obj.type === PacketType.BINARY_ACK) {\n str += obj.attachments + \"-\";\n }\n // if we have a namespace other than `/`\n // we append it followed by a comma `,`\n if (obj.nsp && \"/\" !== obj.nsp) {\n str += obj.nsp + \",\";\n }\n // immediately followed by the id\n if (null != obj.id) {\n str += obj.id;\n }\n // json data\n if (null != obj.data) {\n str += JSON.stringify(obj.data);\n }\n debug(\"encoded %j as %s\", obj, str);\n return str;\n }", "function QrpcMessage( options ) {\n options = options || {}\n if (options.json_encode) this.json_encode = options.json_encode\n if (options.json_decode) this.json_decode = options.json_decode\n\n //this.v = options.v || 1\n this.v = 1\n this.encode = this.encodeV1\n this.decode = this.decodeV1\n}", "send(json) {\n\n json = json || {};\n\n json.status = this.status;\n\n if (typeof json.id !== \"string\") json.id = this.json.id;\n\n if (this.part > 0) json.part = ++this.part;\n else this.part++;\n\n this.client.send(json);\n\n }", "sendMessage() {\n const currentTime = new Date();\n this.state.socket.send(JSON.stringify({\n who_send: Cookie.get('userId'),\n message: this.messageRef.current.value,\n time: currentTime.toISOString().replace(/T/, ' ').replace(/\\..+/, ''),\n person: this.state.selected_contact\n }));\n }", "function send_message(funcname, args) {\n var message = {funcname:funcname, args:args};\n wsHub.socket.send(JSON.stringify(message));\n}", "respondToMessages() { }", "function send(msg) {\n socket.send(JSON.stringify(msg));\n }", "addMessage(type, username, content, color) {\n const message = {\n type: type,\n username: username,\n content: content,\n color: color\n };\n this.ws.send(JSON.stringify(message));\n }", "directMessage(socket, msg) {\n var message = {\n command: 'game',\n data: msg\n }\n socket.write(JSON.stringify(message));\n }", "sendIn(text) {\n this.emit('message', { data: text });\n }", "sendCommand( command, args ) {\n if ( args ) {\n this.send('{\"command\":{\"'+command+'\":'+JSON.stringify(args)+'}}'); \n } else {\n this.send('{\"command\":{\"'+command+'\":{}}}');\n }\n }", "function sendTo(connection, message) { \n connection.send(JSON.stringify(message)); \n}", "encodeAsString(obj) {\n // first is type\n let str = \"\" + obj.type;\n // attachments if we have them\n if (obj.type === PacketType.BINARY_EVENT ||\n obj.type === PacketType.BINARY_ACK) {\n str += obj.attachments + \"-\";\n }\n // if we have a namespace other than `/`\n // we append it followed by a comma `,`\n if (obj.nsp && \"/\" !== obj.nsp) {\n str += obj.nsp + \",\";\n }\n // immediately followed by the id\n if (null != obj.id) {\n str += obj.id;\n }\n // json data\n if (null != obj.data) {\n str += JSON.stringify(obj.data, this.replacer);\n }\n return str;\n }", "function encode(sender) {\n // messages are fetched using arguments\n var message = '[' + sender + ']';\n\n var actions = [];\n for (var actionIndex = 1; actionIndex < arguments.length; ++actionIndex) {\n actions.push(encodeAction(arguments[actionIndex]));\n }\n\n message += actions.join('|');\n message += ';';\n\n return message;\n}", "function sendResponse(senderID , jsonData, lastStopRequested) {\n var messageData = {\n recipient: {\n id: senderID\n },\n message: {\n text: jsonData\n }\n }\n callSendAPI(messageData, lastStopRequested);\n}", "getPacket() {\n return JSON.stringify(this.jsonString)\n }", "function send ( obj ){\n ws.send( JSON.stringify( obj ) );\n }", "function sendMessage(msg) {\n // convert to json and prepare buffer\n var json = JSON.stringify(msg);\n var byteLen = Buffer.byteLength(json);\n var msgBuffer = new Buffer(4 + byteLen);\n\n // Write 4-byte length, followed by json, to buffer\n msgBuffer.writeUInt32BE(byteLen, 0);\n msgBuffer.write(json, 4, json.length, 'utf8');\n\n // send buffer to standard input on the java application\n _javaSpawn.stdin.write(msgBuffer);\n\n _self.emit('sent', msg);\n }", "txt(id, text, messaging_type = 'RESPONSE') {\n const obj = {\n messaging_type,\n recipient: { id },\n message: { text }\n }\n return this.sendMessage(obj);\n }", "function sendMessge(to, from, contents)\n{\n const url = \"https://kam.azurewebsites.net/api/messages\";\n var message = \n {\n toMessage: to,\n fromMessage: from,\n contents: contents\n };\n $.post(url, message, function(message, status){\n console.log(`${message} and status is ${status}`);\n });\n}", "function json_encode(mixed_val) {\n var retVal, json = this.window.JSON;\n try {\n if (typeof json === 'object' && typeof json.stringify === 'function') {\n retVal = json.stringify(mixed_val); // Errors will not be caught here if our own equivalent to resource\n // (an instance of PHPJS_Resource) is used\n if (retVal === undefined) {\n throw new SyntaxError('json_encode');\n }\n return retVal;\n }\n\n var value = mixed_val;\n\n var quote = function(string) {\n var escapable =\n /[\\\\\\\"\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g;\n var meta = { // table of character substitutions\n '\\b': '\\\\b',\n '\\t': '\\\\t',\n '\\n': '\\\\n',\n '\\f': '\\\\f',\n '\\r': '\\\\r',\n '\"': '\\\\\"',\n '\\\\': '\\\\\\\\'\n };\n\n escapable.lastIndex = 0;\n return escapable.test(string) ? '\"' + string.replace(escapable, function(a) {\n var c = meta[a];\n return typeof c === 'string' ? c : '\\\\u' + ('0000' + a.charCodeAt(0)\n .toString(16))\n .slice(-4);\n }) + '\"' : '\"' + string + '\"';\n };\n\n var str = function(key, holder) {\n var gap = '';\n var indent = ' ';\n var i = 0; // The loop counter.\n var k = ''; // The member key.\n var v = ''; // The member value.\n var length = 0;\n var mind = gap;\n var partial = [];\n var value = holder[key];\n\n // If the value has a toJSON method, call it to obtain a replacement value.\n if (value && typeof value === 'object' && typeof value.toJSON === 'function') {\n value = value.toJSON(key);\n }\n\n // What happens next depends on the value's type.\n switch (typeof value) {\n case 'string':\n return quote(value);\n\n case 'number':\n // JSON numbers must be finite. Encode non-finite numbers as null.\n return isFinite(value) ? String(value) : 'null';\n\n case 'boolean':\n case 'null':\n // If the value is a boolean or null, convert it to a string. Note:\n // typeof null does not produce 'null'. The case is included here in\n // the remote chance that this gets fixed someday.\n return String(value);\n\n case 'object':\n // If the type is 'object', we might be dealing with an object or an array or\n // null.\n // Due to a specification blunder in ECMAScript, typeof null is 'object',\n // so watch out for that case.\n if (!value) {\n return 'null';\n }\n if ((this.PHPJS_Resource && value instanceof this.PHPJS_Resource) || (window.PHPJS_Resource &&\n value instanceof window.PHPJS_Resource)) {\n throw new SyntaxError('json_encode');\n }\n\n // Make an array to hold the partial results of stringifying this object value.\n gap += indent;\n partial = [];\n\n // Is the value an array?\n if (Object.prototype.toString.apply(value) === '[object Array]') {\n // The value is an array. Stringify every element. Use null as a placeholder\n // for non-JSON values.\n length = value.length;\n for (i = 0; i < length; i += 1) {\n partial[i] = str(i, value) || 'null';\n }\n\n // Join all of the elements together, separated with commas, and wrap them in\n // brackets.\n v = partial.length === 0 ? '[]' : gap ? '[\\n' + gap + partial.join(',\\n' + gap) + '\\n' + mind +\n ']' : '[' + partial.join(',') + ']';\n gap = mind;\n return v;\n }\n\n // Iterate through all of the keys in the object.\n for (k in value) {\n if (Object.hasOwnProperty.call(value, k)) {\n v = str(k, value);\n if (v) {\n partial.push(quote(k) + (gap ? ': ' : ':') + v);\n }\n }\n }\n\n // Join all of the member texts together, separated with commas,\n // and wrap them in braces.\n v = partial.length === 0 ? '{}' : gap ? '{\\n' + gap + partial.join(',\\n' + gap) + '\\n' + mind + '}' :\n '{' + partial.join(',') + '}';\n gap = mind;\n return v;\n case 'undefined':\n // Fall-through\n case 'function':\n // Fall-through\n default:\n throw new SyntaxError('json_encode');\n }\n };\n\n // Make a fake root object containing our value under the key of ''.\n // Return the result of stringifying the value.\n return str('', {\n '': value\n });\n\n } catch (err) { // Todo: ensure error handling above throws a SyntaxError in all cases where it could\n // (i.e., when the JSON global is not available and there is an error)\n if (!(err instanceof SyntaxError)) {\n throw new Error('Unexpected error type in json_encode()');\n }\n this.php_js = this.php_js || {};\n this.php_js.last_error_json = 4; // usable by json_last_error()\n return null;\n }\n}", "__handleResponse() {\n this.push('messages', {\n author: 'server',\n text: this.response\n });\n }", "function sendMessage(command, messageObj) {\n var jsonified = JSON.stringify(messageObj);\n packet = command + DELIM + jsonified;\n conn.send(packet);\n }", "send(variable, message) {\n const socket = this.getSocket(variable);\n let response;\n message = message || _.get(variable, 'dataBinding.RequestBody');\n response = this._onBeforeSend(variable, message);\n if (response === false) {\n return;\n }\n message = isDefined(response) ? response : message;\n message = isObject(message) ? JSON.stringify(message) : message;\n socket.send(message, 0);\n }", "['toString']() {\n return this.message;\n }", "function sendMsg() {\n let message = {\n command: 'send',\n message: $('#compose').val().trim()\n };\n chat_socket.send(JSON.stringify(message));\n\n}", "encodeAsString(obj) {\n // first is type\n let str = \"\" + obj.type;\n // attachments if we have them\n if (obj.type === PacketType.BINARY_EVENT ||\n obj.type === PacketType.BINARY_ACK) {\n str += obj.attachments + \"-\";\n }\n // if we have a namespace other than `/`\n // we append it followed by a comma `,`\n if (obj.nsp && \"/\" !== obj.nsp) {\n str += obj.nsp + \",\";\n }\n // immediately followed by the id\n if (null != obj.id) {\n str += obj.id;\n }\n // json data\n if (null != obj.data) {\n str += JSON.stringify(obj.data);\n }\n debug(\"encoded %j as %s\", obj, str);\n return str;\n }", "encodeAsString(obj) {\n // first is type\n let str = \"\" + obj.type;\n // attachments if we have them\n if (obj.type === PacketType.BINARY_EVENT ||\n obj.type === PacketType.BINARY_ACK) {\n str += obj.attachments + \"-\";\n }\n // if we have a namespace other than `/`\n // we append it followed by a comma `,`\n if (obj.nsp && \"/\" !== obj.nsp) {\n str += obj.nsp + \",\";\n }\n // immediately followed by the id\n if (null != obj.id) {\n str += obj.id;\n }\n // json data\n if (null != obj.data) {\n str += JSON.stringify(obj.data);\n }\n debug(\"encoded %j as %s\", obj, str);\n return str;\n }" ]
[ "0.73147666", "0.6862307", "0.65187293", "0.6517685", "0.6491351", "0.64819676", "0.6453755", "0.6423328", "0.6287493", "0.6286235", "0.62554836", "0.6243486", "0.6197506", "0.617119", "0.6155696", "0.6146992", "0.6080151", "0.6080151", "0.60710937", "0.6066764", "0.60534626", "0.60490495", "0.6044596", "0.6044596", "0.60288715", "0.60081", "0.5999523", "0.5990958", "0.5988712", "0.59839714", "0.5967369", "0.5958487", "0.591467", "0.59123015", "0.5912078", "0.5898139", "0.5897588", "0.5893806", "0.5893806", "0.5893806", "0.587819", "0.58637136", "0.5855075", "0.58463293", "0.58335733", "0.58260906", "0.5823732", "0.5812576", "0.5811067", "0.58102596", "0.5789176", "0.5789087", "0.57873744", "0.57788306", "0.57767326", "0.57716954", "0.5767202", "0.5758547", "0.5753421", "0.5735012", "0.57256263", "0.5725273", "0.57191384", "0.5718062", "0.570774", "0.5706495", "0.5703681", "0.56950235", "0.5693866", "0.5688305", "0.5687454", "0.5686158", "0.56807566", "0.56702906", "0.56555814", "0.56512547", "0.56426984", "0.56245655", "0.5618886", "0.56038094", "0.5594956", "0.5592089", "0.5591586", "0.55861014", "0.55859655", "0.5580591", "0.5578825", "0.5562428", "0.5551718", "0.5545686", "0.5545074", "0.5540232", "0.5536159", "0.55358845", "0.553326", "0.55284595", "0.5513242", "0.5505338", "0.5504924", "0.5502911", "0.5502911" ]
0.0
-1
const isWindows = process.platform === 'win32'
function createWindow() { mainWindow = new BrowserWindow({ width: 900, height: 680, icon: `${__dirname}/images/logo.png`, titleBarStyle: 'hidden', backgroundColor: '#282c34', darkTheme: true, webPreferences: { nodeIntegration: true, enableRemoteModule: true, }, }) // mainWindow.maximize() mainWindow.menuBarVisible = false // Loading the web application mainWindow.loadURL( isDev ? 'http://localhost:3000' : `file://${path.join(__dirname, '../build/index.html')}`, ) if (isDev) { mainWindow.webContents.openDevTools() } mainWindow.once('ready-to-show', () => { if (!mainWindow) { throw new Error('"mainWindow" is not defined') } if (process.env.START_MINIMIZED) { mainWindow.minimize() } else { mainWindow.show() mainWindow.focus() } }) // Open urls in the user's browser mainWindow.webContents.on('new-window', (event, url) => { event.preventDefault() shell.openExternal(url) }) mainWindow.on('closed', () => { mainWindow = null }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isWindows() {\n return process.platform.startsWith(\"win\");\n}", "isWindows() {\n return !!process.platform.match(/^win/);\n }", "isWindowsPlatform() {\n return process.platform.startsWith('win');\n }", "function isWindows() {\n if (!isNode() || !(process && process.platform))\n /* istanbul ignore next */\n return false;\n return process.platform.indexOf('win') === 0;\n}", "function h$filepath_isWindows() {\n if(h$isNode && process.platform === 'win32') return true;\n return false;\n}", "function launchedFromCmd() {\n return process.platform === 'win32' && process.env._ === undefined;\n}", "function launchedFromCmd() {\n return process.platform === 'win32' && process.env._ === undefined;\n}", "function launchedFromCmd() {\n return process.platform === 'win32' && process.env._ === undefined;\n}", "function launchedFromCmd() {\n return process.platform === 'win32' && process.env._ === undefined;\n}", "function getIsWindows( ua ) {\n if( ua.indexOf( \"windows\" ) > -1 ) {\n return true;\n }\n return false;\n }", "function getPlatform() {\n var userAgent = window.navigator.userAgent;\n return {\n isWin: userAgent.indexOf('Windows') >= 0,\n isMac: userAgent.indexOf('Macintosh') >= 0,\n isLinux: userAgent.indexOf('Linux') >= 0\n };\n}", "function launchedFromCmd() {\n return process.platform === 'win32' &&\n process.env._ === undefined\n}", "function launchedFromCmd() {\n return process.platform === 'win32'\n && process.env._ === undefined;\n}", "function IsPlatformWin32(oConfig)\n{\n\treturn oConfig.Platform.Name == \"Win32\";\n}", "function launchedFromCmd() {\n return process.platform === 'win32'\n && process.env._ === undefined;\n}", "function get_platform(){\n if (['darwin', 'win32', 'win64'].indexOf(process.platform) === -1) return 'linux';\n if (['darwin'].indexOf(process.platform) === -1) return 'win';\n return 'mac';\n }", "function platform() {\r\n return os.platform();\r\n}", "function compatibleWinEnv(cmd) {\n const isWin = /^win/.test(process.platform);\n\n if (!isWin || cmd !== 'npm') return cmd;\n\n return `${cmd}.cmd`;\n}", "function isMac() {\n return navigator.platform.indexOf('Mac') > -1\n}", "function trk_get_platform() {\n if (navigator.platform) {\n\treturn navigator.platform;\n } else {\n\treturn \"-\";\n }\n}", "function detectOS() {\n let OSName=\"unknown\";\n if (navigator.appVersion.indexOf(\"Win\")!=-1) OSName=\"windows\";\n if (navigator.appVersion.indexOf(\"Mac\")!=-1) OSName=\"mac\";\n if (navigator.appVersion.indexOf(\"X11\")!=-1) OSName=\"unix\";\n if (navigator.appVersion.indexOf(\"Linux\")!=-1) OSName=\"linux\";\n return OSName;\n}", "function isMac() {\n return navigator.platform.toUpperCase().indexOf('MAC') >= 0;\n}", "function isMacintosh() {\n return navigator.platform.indexOf('Mac') > -1\n}", "function checkPlatform(platform) {\n if (platform == \"PSN\" || platform == \"PS5\" || platform == \"PS\" || platform == \"PS4\")\n return \"PS4\";\n\n if (platform == \"XBOX\" || platform == \"X1\") return \"X1\";\n\n if (platform == \"PC\" || platform == \"STEAM\" || platform == \"ORIGIN\") return \"PC\";\n\n if (\n platform == \"SWITCH\" ||\n platform == \"NINTENDO\" ||\n platform == \"NINTENDO SWITCH\" ||\n platform == \"NS\"\n )\n return 1;\n\n return 0;\n }", "static mojangFriendlyOS(){\n const opSys = process.platform\n if (opSys === 'darwin') {\n return 'osx'\n } else if (opSys === 'win32'){\n return 'windows'\n } else if (opSys === 'linux'){\n return 'linux'\n } else {\n return 'unknown_os'\n }\n }", "function isWin7() {\n\n var OS = navigator.userAgent;\n\n if (OS.match('Windows NT 6.1') || OS.match('Windows NT 7.0'))\n return true;\n else\n return false;\n}", "function isMac() {\n return /^darwin/i.test(process.platform);\n}", "getPlatformInfo () {\n switch (this.props.platform) {\n case 'darwin':\n return 'Mac';\n case 'win32':\n return 'Windows';\n case 'linux':\n return 'Linux';\n default:\n return '';\n }\n }", "supportsPlatform() {\n return true;\n }", "function getOs()\n{\n if (navigator.appVersion.indexOf(\"Win\") != -1)\n {\n return OS_WIN;\n }\n \n if (navigator.appVersion.indexOf(\"Mac\") != -1)\n {\n return OS_MAC;\n }\n\n if (navigator.appVersion.indexOf(\"X11\") != -1)\n {\n return OS_UNIX;\n }\n\n if (navigator.appVersion.indexOf(\"Linux\") != -1)\n {\n return OS_LINUX;\n }\n\n return OS_UNKNOWN;\n}", "isMac(){\n let bool = false;\n if (navigator.platform.toUpperCase().indexOf('MAC') >= 0\n || navigator.platform.toUpperCase().indexOf('IPAD') >= 0) {\n bool = true;\n }\n return bool;\n }", "function isBrowser() {\n return typeof window !== \"undefined\" && (typeof process === 'undefined' ? 'undefined' : _typeof2(process)) === \"object\" && process.title === \"browser\";\n}", "function OSType() {\n var OSName=\"Unknown OS\";\n if (navigator.appVersion.indexOf(\"Win\")!=-1) OSName=\"Windows\";\n if (navigator.appVersion.indexOf(\"Mac\")!=-1) OSName=\"MacOS\";\n if (navigator.appVersion.indexOf(\"X11\")!=-1) OSName=\"UNIX\";\n if (navigator.appVersion.indexOf(\"Linux\")!=-1) OSName=\"Linux\";\n return OSName;\n}", "function OSName() {\n if (navigator.appVersion.indexOf(\"Win\") != -1) return \"Windows\";\n if (navigator.appVersion.indexOf(\"Mac\") != -1) return \"MacOS\";\n if (navigator.appVersion.indexOf(\"X11\") != -1) return \"UNIX\";\n if (navigator.appVersion.indexOf(\"Linux\")!= -1) return \"Linux\";\n return \"Unknown OS\";\n}", "function test_vmrc_console_windows(browser, operating_system, provider) {}", "function DetectWindowsMobile()\n{\n //Most devices use 'Windows CE', but some report 'iemobile' \n // and some older ones report as 'PIE' for Pocket IE. \n if (uagent.search(deviceWinMob) > -1 ||\n uagent.search(deviceIeMob) > -1 ||\n uagent.search(enginePie) > -1)\n return true;\n else\n return false;\n}", "function isBrowser() {\n return typeof window !== 'undefined';\n}", "function isBrowser() {\n return typeof window !== 'undefined';\n}", "function DetectWindowsMobile()\n{\n //Most devices use 'Windows CE', but some report 'iemobile'\n // and some older ones report as 'PIE' for Pocket IE.\n if (uagent.search(deviceWinMob) > -1 ||\n uagent.search(deviceIeMob) > -1 ||\n uagent.search(enginePie) > -1)\n return true;\n //Test for Windows Mobile PPC but not old Macintosh PowerPC.\n if ((uagent.search(devicePpc) > -1) &&\n !(uagent.search(deviceMacPpc) > -1))\n return true;\n //Test for Windwos Mobile-based HTC devices.\n if (uagent.search(manuHtc) > -1 &&\n uagent.search(deviceWindows) > -1)\n return true;\n else\n return false;\n}", "function isNativeApp() {\n var hasWindow = typeof window !== \"undefined\";\n var isUwp = typeof Windows !== \"undefined\";\n var isPxtElectron = hasWindow && !!window.pxtElectron;\n var isCC = hasWindow && !!window.ipcRenderer || /ipc=1/.test(location.hash) || /ipc=1/.test(location.search); // In WKWebview, ipcRenderer is injected later, so use the URL query\n return isUwp || isPxtElectron || isCC;\n }", "static isBrowser() {\n return typeof window !== 'undefined';\n }", "function checkLinux(platform) {\n\tvar lxReg=/linux/i;\n\tif(lxReg.test(platform)) return true;\n\telse return false;\n}", "function isMsWindow(window) {\n if (quacksLikeAnMsWindow(window) && window.msCrypto.subtle !== undefined) {\n var _a = window.msCrypto, getRandomValues = _a.getRandomValues, subtle_1 = _a.subtle;\n return msSubtleCryptoMethods\n .map(function (methodName) { return subtle_1[methodName]; })\n .concat(getRandomValues)\n .every(function (method) { return typeof method === \"function\"; });\n }\n return false;\n}", "function isMsWindow(window) {\n if (quacksLikeAnMsWindow(window) && window.msCrypto.subtle !== undefined) {\n var _a = window.msCrypto, getRandomValues = _a.getRandomValues, subtle_1 = _a.subtle;\n return msSubtleCryptoMethods\n .map(function (methodName) { return subtle_1[methodName]; })\n .concat(getRandomValues)\n .every(function (method) { return typeof method === \"function\"; });\n }\n return false;\n}", "function isMsWindow(window) {\n if (quacksLikeAnMsWindow(window) && window.msCrypto.subtle !== undefined) {\n var _a = window.msCrypto, getRandomValues = _a.getRandomValues, subtle_1 = _a.subtle;\n return msSubtleCryptoMethods\n .map(function (methodName) { return subtle_1[methodName]; })\n .concat(getRandomValues)\n .every(function (method) { return typeof method === \"function\"; });\n }\n return false;\n}", "function inBrowser() {\n return typeof window !== 'undefined';\n}", "function checkOS () {\n var os;\n var clientStrings = [{\n s:'Windows',\n r:/(Windows)/\n }, {\n s:'Android',\n r:/Android/\n }, {\n s:'Open BSD',\n r:/OpenBSD/\n }, {\n s:'Linux',\n r:/(Linux|X11)/\n }, {\n s:'iOS',\n r:/(iPhone|iPad|iPod)/\n }, {\n s:'Mac',\n r:/Mac/\n }, {\n s:'UNIX',\n r:/UNIX/\n }, {\n s:'Robot',\n r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\\/Teoma|ia_archiver)/\n }];\n\n for (var i = 0; i < clientStrings.length; i++) {\n var cs = clientStrings[i];\n if (cs.r.test(navigator.userAgent)) {\n return cs.s;\n }\n }\n}", "function isUWP() {\r\n return getUA().indexOf('MSAppHost/') >= 0;\r\n}", "function isUWP() {\r\n return getUA().indexOf('MSAppHost/') >= 0;\r\n}", "function isUWP() {\r\n return getUA().indexOf('MSAppHost/') >= 0;\r\n}", "function isUWP() {\r\n return getUA().indexOf('MSAppHost/') >= 0;\r\n}", "function isUWP() {\n return getUA().indexOf('MSAppHost/') >= 0;\n}", "function isUWP() {\n return getUA().indexOf('MSAppHost/') >= 0;\n}", "function isUWP() {\n return getUA().indexOf('MSAppHost/') >= 0;\n}", "function isUWP() {\n return getUA().indexOf('MSAppHost/') >= 0;\n}", "function isUWP() {\n return getUA().indexOf('MSAppHost/') >= 0;\n}", "function isUWP() {\n return getUA().indexOf('MSAppHost/') >= 0;\n}", "function isUWP() {\n return getUA().indexOf('MSAppHost/') >= 0;\n}", "function isUWP() {\n return getUA().indexOf('MSAppHost/') >= 0;\n}", "function realDeal() {\n var real = true;\n if (navigator.platform.substring(0, 3) == 'Mac') real = false;\n if (navigator.platform.substring(0, 3) == 'Win') real = false;\n //log('real deal?', real);\n return real;\n}", "function isMac(){\n if(process.platform == 'darwin'){\n return 1;\n }\n return -1;\n}", "function isBrowser() {\n return (typeof(window) !== 'undefined');\n}", "function isBrowser() {\n return (typeof(window) !== 'undefined');\n}", "function isNodeProcess() {\r\n // Check browser environment.\r\n if (typeof global !== 'object') {\r\n return false;\r\n }\r\n // Check nodejs or React Native environment.\r\n if (Object.prototype.toString.call(global.process) === '[object process]' ||\r\n navigator.product === 'ReactNative') {\r\n return true;\r\n }\r\n}", "function testOS() {\n var userAgent = navigator.userAgent.toLowerCase();\n if (userAgent.match(/ipad/i) == \"ipad\") {\n return \"ipad\";\n } else if (userAgent.match(/iphone/i) == \"iphone\") {\n return \"iphone\";\n } else if (userAgent.match(/android/i) == \"android\") {\n return \"android\";\n } else {\n return \"win\";\n }\n}", "function type() {\n if (exports.isWindows) {\n return Type.Windows;\n }\n if (exports.isOSX) {\n return Type.OSX;\n }\n return Type.Linux;\n }", "function toWindows(name) {\n return name.replace(/\\//g, '\\\\');\n}", "function lc3_clean_is_linux_chrome()\n{\n return (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n && (navigator.userAgent.toLowerCase().indexOf('linux') > -1);\n}", "function isUWP() {\n return getUA().indexOf('MSAppHost/') >= 0;\n }", "function isStandardBrowserEnv(){\nif(typeof navigator!=='undefined'&&navigator.product==='ReactNative'){\nreturn false;\n}\nreturn(\ntypeof window!=='undefined'&&\ntypeof document!=='undefined');\n\n}", "function isNodeEnv() {\r\n // tslint:disable:strict-type-predicates\r\n return Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]';\r\n}", "function cd_IsMacWithIE() {\n\treturn cd_testBrowserType(\"Microsoft Internet Explorer\") && (navigator.platform.indexOf(\"Mac\") != -1 || navigator.platform.indexOf(\"MAC\") != -1);\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined');\n\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined');\n\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}", "function isPlatformBrowser(platformId){return platformId===PLATFORM_BROWSER_ID;}", "isUNC() {\n const pl = this.#patternList;\n return this.#isUNC !== undefined\n ? this.#isUNC\n : (this.#isUNC =\n this.#platform === 'win32' &&\n this.#index === 0 &&\n pl[0] === '' &&\n pl[1] === '' &&\n typeof pl[2] === 'string' &&\n !!pl[2] &&\n typeof pl[3] === 'string' &&\n !!pl[3]);\n }", "checkChrome() {\n return window['chrome'] ? 'is-chrome' : '';\n }", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' || navigator.product === 'NativeScript' || navigator.product === 'NS')) return false;\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}", "function selectByPlatform(map) {\n let {\n platform,\n arch\n } = process;\n return map[platform === 'win32' && arch === 'x64' ? 'win64' : platform];\n} // Installs a revision of Chromium to a local directory", "function getPlatform() {\n return lang_1.isPresent(_platform) && !_platform.disposed ? _platform : null;\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\n navigator.product === 'NativeScript' ||\n navigator.product === 'NS')) {\n return false;\n }\n return (typeof window !== 'undefined' &&\n typeof document !== 'undefined');\n}", "function isBrowser () {\n // If we can say that it is the main process, then we are definitely running the native app\n if (isMain()) {\n return false;\n }\n\n // If it is not the main process, then we can either be in the renderer process OR running on\n // the browser. In both these cases, the window object would be present and so we can check the\n // SDK_PLATFORM flag.\n return window && (window.SDK_PLATFORM === 'browser');\n}", "function isStandardBrowserEnv() {\r\n if (typeof navigator !== 'undefined' && (navigator.product === 'ReactNative' ||\r\n navigator.product === 'NativeScript' ||\r\n navigator.product === 'NS')) {\r\n return false;\r\n }\r\n return (\r\n typeof window !== 'undefined' &&\r\n typeof document !== 'undefined'\r\n );\r\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return typeof window !== 'undefined' && typeof document !== 'undefined';\n}", "function isBrowser() {\n // eslint-disable-next-line no-restricted-globals\n return typeof window !== 'undefined' && (!isNodeEnv() || isElectronNodeRenderer());\n }", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}", "function isStandardBrowserEnv() {\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n return false;\n }\n return (\n typeof window !== 'undefined' &&\n typeof document !== 'undefined'\n );\n}" ]
[ "0.94603986", "0.9295414", "0.9134149", "0.87568235", "0.81727165", "0.74788165", "0.74788165", "0.74510986", "0.74510986", "0.743265", "0.7424441", "0.73983884", "0.73940325", "0.7366195", "0.7364052", "0.7219087", "0.71349275", "0.6892083", "0.66629034", "0.6647219", "0.6566033", "0.65541923", "0.653851", "0.6379939", "0.6377994", "0.634561", "0.62849844", "0.6270044", "0.6267403", "0.624651", "0.6243108", "0.62281865", "0.62164176", "0.6216055", "0.62051433", "0.6188797", "0.6172568", "0.6172568", "0.6125479", "0.61214745", "0.6115039", "0.6083093", "0.6076742", "0.6076742", "0.6076742", "0.60666615", "0.6061606", "0.60415363", "0.60415363", "0.60415363", "0.60415363", "0.60415244", "0.60415244", "0.60415244", "0.60415244", "0.60415244", "0.60415244", "0.60415244", "0.60415244", "0.60317385", "0.60261214", "0.60206753", "0.60206753", "0.59866154", "0.59221715", "0.5919237", "0.5902975", "0.5879154", "0.5849435", "0.58441615", "0.58404005", "0.5837843", "0.5837272", "0.5837272", "0.5835909", "0.5822474", "0.58188486", "0.5810455", "0.5797748", "0.5795031", "0.5789125", "0.578434", "0.5784054", "0.5774523", "0.5773663", "0.5773663", "0.5773663", "0.5773663", "0.5773663", "0.5773663", "0.5773663", "0.5773663", "0.5772915", "0.5767342", "0.5767342", "0.5767342", "0.5767342", "0.5767342", "0.5767342", "0.5767342", "0.5767342" ]
0.0
-1
Zero pad an integer to the specified length.
function padInteger(num, length) { "use strict"; var r = '' + num; while (r.length < length) { r = '0' + r; } return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function zero_padding(num,length){\n return ('0000000000' + num).slice(-length);\n}", "function pad0(num, len){\r\n\t\t\t\treturn ('0000'+num).split('').reverse().splice(0,len).reverse().join('');\r\n\t\t\t}", "function zeroPad(val, len) {\n return ('00000000' + val).substr(-len);\n }", "function padInt(int, len){\n var str = int + '';\n while (str.length < len) {\n str = '0' + str;\n }\n return str;\n}", "function intPad(n, length) {\n var len = length - (''+n).length;\n return (len > 0 ? new Array(++len).join('0') : '') + n\n}", "function padZeros(num, len) {\n var s = parseInt(num)+'';\n while (s.length < len) s = '0' + s;\n return s;\n}", "function padZeros(num, len) {\n var s = parseInt(num)+'';\n while (s.length < len) s = '0' + s;\n return s;\n}", "function lpadZero (n, length){\n var str = (n > 0 ? n : -n) + \"\";\n var zeros = \"\";\n for (var i = length - str.length; i > 0; i--)\n zeros += \"0\";\n zeros += str;\n return n >= 0 ? zeros : \"-\" + zeros;\n }", "function zero_padding(string, length){\n\tif(string.length >= length){\n\t\treturn string;\n\t}\n\t\n\treturn zero_padding(\"0\" + string, length); \n}", "function pad(number, length) {\n var str = '' + number;\n while (str.length < length) {\n str = '0' + str;\n }\n return str;\n}", "function pad(number, length) {\n var str = '' + number;\n while (str.length < length) {\n str = '0' + str;\n }\n return str;\n}", "function pad(number, length) {\n var str = '' + number;\n while (str.length < length) {\n str = '0' + str;\n }\n return str;\n}", "function pad(number, length) {\n\n var str = '' + number;\n while (str.length < length) {\n str = '0' + str;\n }\n\n return str;\n\n}", "function pad(n, length) {\n n = n + ''; // to string\n return n.length >= length\n ? n.substring(n.length - length) // deletes digits\n : new Array(length - n.length + 1).join('0') + n; // adds zeros\n}", "function padZero(num, size) {\n var tmp = num + \"\";\n while (tmp.length < size) tmp = \"0\" + tmp;\n return tmp;\n}", "function padWithZero(number) {\n\tif (eval(number) < 10) {\n\t\treturn '0' + number;\n\t}\n\treturn number;\n}", "function pad(number, length, ending) {\n return (`0000${number}`).slice(-length) + ending;\n }", "function padWithZero(i) {\n if (i < 10) {\n i = \"0\" + i;\n }\n return i;\n}", "function padZero(str, len) {\n len = len || 2;\n var zeros = new Array(len).join('0');\n return (zeros + str).slice(-len);\n }", "function padzero(n) {\n return n < 10 ? '0' + n : n;\n }", "function pad(n) { return (\"0\" + n).slice(-2); }", "function PadZeroes(myNumber, iLength)\n{\nsNumber = \"0\" + myNumber; // convert to string\nfor (i = sNumber.length; i < iLength; i++)\n {\n sNumber = \"0\" + sNumber;\n }\nreturn sNumber;\n} // padzeroes", "function padZero(str, len, isRight) {\n\t\t\tif (str == null) { str = \"\"; }\n\t\t\tstr = \"\" + str;\n\t\t\t\n\t\t\treturn (isRight ? str : \"\") + repeatZero(len - str.length) + (isRight ? \"\" : str);\n\t\t}", "function padZero(str, len, isRight) {\n\t\tif (str == null) { str = \"\"; }\n\t\tstr = \"\" + str;\n\t\t\n\t\treturn (isRight ? str : \"\") + repeatZero(len - str.length) + (isRight ? \"\" : str);\n\t}", "function pad0(i,w) { return (\"000\" + String(i)).slice(-w); }", "function tp_zero_pad(n, l)\n{\n\tn = n.toString();\n\tl = Number(l);\n\tvar pad = '0';\n\twhile (n.length < l) {n = pad + n;}\n\treturn n;\n}", "function pad(num, size){ return ('000000000' + num).substr(-size); }", "function pad(n) {return n<10 ? '0'+n : n} // in case", "function pad(str,length)\n{\n\tvar hold = str;\n\twhile((hold.length) < length)\n\t{\n\t\thold = \"0\" + hold;\n\t}\n\treturn hold;\n}", "function padNumber(num, length, pad){\n num = String(num);\n while (num.length < length){\n num = String(pad) + num;\n }\n return num;\n }", "zeroPad(number, size){\n var stringNumber = String(number);\n while (stringNumber.length < (size || 2)){\n stringNumber = \"0\" + stringNumber;\n }\n return stringNumber;\n }", "function pad(num, width, zeroValue) {\r zeroValue = zeroValue || '0';\r num = num + '';\r return num.length >= width ? num : new Array(width - num.length + 1).join(zeroValue) + num;\r}", "zeroPad(number, size){\r\n var stringNumber = String(number);\r\n while(stringNumber.length < (size || 2)){\r\n stringNumber = \"0\" + stringNumber;\r\n }\r\n return stringNumber;\r\n }", "function zeroPad(num, width) {\n var n = Math.abs(num);\n var zeros = Math.max(0, width - Math.floor(n).toString().length );\n var zeroString = Math.pow(10,zeros).toString().substr(1);\n if( num < 0 ) {\n zeroString = '-' + zeroString;\n }\n\n return zeroString+n;\n}", "function pad0(i, w) {\n\t\t\treturn (\"000\" + String(i)).slice(-w);\n\t\t}", "function zeroPad(number, pad) {\n\t\t\tvar N = Math.pow(10, pad);\n\t\t\treturn number < N ? (String(\"\") + (N + number)).slice(1) : String(\"\") + number;\n\t\t}", "function zeroPad(number) {\n const numeric = number >> 0;\n return `${numeric < 10 ? '0' : ''}${numeric}`;\n }", "function padZeros(number) {\r\n\tvar result;\r\n\tif (number < 10) result = '000' + number; \r\n\telse if (number < 100) result = '00' + number;\r\n\telse if (number < 1000) result = '0' + number;\r\n\treturn result;\r\n}", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function leftZeroFill(number, targetLength) {\n var output = number + '';\n while (output.length < targetLength) {\n output = '0' + output;\n }\n return output;\n }", "function zeroPad(n, width) {\n var s = n.toString();\n var i = Math.max(width - s.length, 0);\n return new Array(i + 1).join(\"0\") + s;\n }", "zeroPad(number, size) {\n var stringNumber = String(number);\n while (stringNumber.length < (size || 2)) {\n stringNumber = \"0\" + stringNumber;\n }\n return stringNumber;\n }", "function zeroPad(num, width) {\n num = num.toString();\n while (num.length < width) {\n num = \"0\" + num;\n }\n return num;\n}", "function pad0(i,w) {\n\t\treturn (\"000\" + String(i)).slice(-w);\n\t}", "function pad(n){\n if (('' + n).length == 1) return '0' + n;\n else return n;\n }", "function zeroPad(number, width) {\n let string = String(number);\n while (string.length < width) {\n string = \"0\" + string;\n }\n return string;\n}", "function zeroPad(number, width) {\n let string = String(number);\n while (string.length < width) {\n string = \"0\" + string;\n }\n return string;\n}", "function zeroPad(n, width) {\n var s = n.toString();\n var i = Math.max(width - s.length, 0);\n return new Array(i + 1).join(\"0\") + s;\n }", "function leftPad(str, length) {\n for (var i = str.length; i < length; i++) str = '0' + String(str);\n return str;\n }", "function PadZeros(value, desiredStringLength){\n var num = value + \"\";\n while (num.length < desiredStringLength){\n num = \"0\" + num;\n }\n return num;\n}", "function zeroPad(num, size) {\n var s = num + \"\";\n while (s.length < size)\n s = \"0\" + s;\n return s;\n}", "function zero_pad(input_string, desired_length) {\n let output_string = input_string;\n while (output_string.length < desired_length) {\n output_string = '0' + output_string;\n }\n return output_string;\n}", "function _zeroPad(str, count, left) {\n var l;\n for (l = str.length; l < count; l += 1) {\n // eslint-disable-next-line no-param-reassign\n str = (left ? ('0' + str) : (str + '0'));\n }\n return str;\n }", "function pad(n) \n{\n return (n < 10) ? (\"0\" + n) : n;\n}", "function pad(number) {\n if (number < 10) {\n return '0' + number;\n }\n return number;\n}", "function pad(val) {\n\t\tval = parseInt(val, 10);\n\t\treturn val >= 10 ? val : \"0\" + val;\n\t}", "function pad(n) {\n return n < 10 ? '0' + n : n;\n}", "function zeroPad (value) {\n let pad = value < 10 ? '0' : ''\n return `${pad}${value}`\n}", "function pad(num, size) {\n num = num.toString();\n while (num.length < size) num = \"0\" + num;\n return num;\n }", "function pad(number) {\n if (number < 10) {\n return '0' + number;\n }\n\n return number;\n }", "function pad(number) {\n if (number < 10) {\n return '0' + number;\n }\n\n return number;\n }", "function pad(number) {\n if (number < 10) {\n return '0' + number;\n }\n return number;\n}", "function zeroPad (number, size) {\n var s = \"000000\" + number;\n return s.substr(s.length - size);\n}", "function pad(num) {\n\tnum = \"0\".repeat(2 - num.toString().length) + num.toString();\n\treturn num;\n}", "function padNumber(number, length = 2, str = \"0\") {\n return number.toString().padStart(length, str);\n}", "function pad(num) {\r\n return (\"0\"+num).slice(-2);\r\n}", "function pad(n) {\n\treturn (n < 10) ? (\"0\" + n) : n;\n}", "function padZero(str) {\n var len = 2;\n var zeros = new Array(len).join('0');\n return (zeros + str).slice(-len);\n }", "function leftPad(data, length) {\r\n var result = data.toString();\r\n while (result.length < length) {\r\n result = \"0\" + result;\r\n }\r\n return result;\r\n}", "function leftPad(data, length) {\r\n var result = data.toString();\r\n while (result.length < length) {\r\n result = \"0\" + result;\r\n }\r\n return result;\r\n}", "function pad(n) {\n return n.toString().padStart(2, \" 0 \");\n}", "function pad(number) {\n var s = String(number);\n if (s.length < 2)\n return \"0\" + s;\n else \n return s;\n}", "function pad(num, size) {\n num = num.toString();\n while (num.length < size) num = '0' + num;\n return num;\n}", "function pad(num_str, size) {\n while (num_str.length < size) num_str = \"0\" + num_str;\n return num_str;\n}", "function pad(num_str, size) {\n while (num_str.length < size) num_str = \"0\" + num_str;\n return num_str;\n}", "function leadingZeros(number, length) {\n while (number.toString().length < length) {\n number = '0' + number;\n }\n\n return number;\n}", "function pad(n) {\n return n < 10 ? '0' + n : n;\n }", "function pad(n) {\n return n < 10 ? '0' + n.toString(10) : n.toString(10)\n}", "function pad(number) {\n\t\t\t\t\tif (number < 10) {\n\t\t\t\t\t\treturn '0' + number;\n\t\t\t\t\t}\n\t\t\t\t\treturn number;\n\t\t\t\t}", "function pad(n) {\n if (n < 10) {\n return \"0\" + n;\n } else {\n return n;\n }\n}", "function zeroPad(value) {\r\n let pad = value < 10 ? '0' : ''\r\n return `${pad}${value}`\r\n}", "function pad(number) {\n\t return (number < 10 ? '0' + number : number)\n\t}", "function pad(num) {\n return '\\0\\0\\0\\0'.slice(0, 4 - num.toString().length) + num;\n}", "function pad(number) {\n return (number < 10 ? '0' : '') + number;\n}", "function pad( n )\n{\n return (n < 10 ? '0' : '') + n;\n}", "function pad(n) {\n return n<10 ? '0'+n : n;\n }", "function pad(num, size) {\t\n var s = num + \"\";\n while (s.length < size) s = \"0\" + s;\n return s;\n}", "function PadNumber(number, length) {\n\t\tnumber += \"\";\n\t\tvar shortBy = length - number.length;\n\t\tif (shortBy > 0) { for (x = 0; x < shortBy; x++) { number = \"0\" + number; } }\n\t\treturn number;\n\t}", "static padZero(digits) {\n if (Number.isNaN(digits = parseInt(digits, 10)))\n return '--';\n return digits.toString().padStart(2, '0');\n }" ]
[ "0.8077738", "0.807471", "0.7882664", "0.7766571", "0.77501804", "0.7675339", "0.7675339", "0.7668982", "0.7639093", "0.7619183", "0.7608734", "0.7608734", "0.75990826", "0.7553923", "0.7553889", "0.7543505", "0.7541089", "0.75135636", "0.751268", "0.7509517", "0.7479051", "0.7477668", "0.7440994", "0.74407685", "0.7438193", "0.7415947", "0.7415724", "0.737116", "0.73362756", "0.7335221", "0.73149526", "0.73079586", "0.72949564", "0.72886163", "0.72766936", "0.72753674", "0.72686297", "0.72431415", "0.7242596", "0.7242596", "0.7242596", "0.7242596", "0.7242596", "0.7242596", "0.7242596", "0.7242596", "0.7242596", "0.7242596", "0.7242596", "0.7242596", "0.7242596", "0.7229329", "0.72246635", "0.72194225", "0.7217866", "0.7186591", "0.71827394", "0.71827394", "0.71782106", "0.7176608", "0.71717036", "0.71687967", "0.7156817", "0.71452683", "0.71434915", "0.7141232", "0.7128888", "0.71251196", "0.7120574", "0.7116535", "0.7109336", "0.7109336", "0.709665", "0.7084987", "0.7079685", "0.7076737", "0.7071586", "0.706087", "0.7059961", "0.70579684", "0.70579684", "0.70522684", "0.7049208", "0.70489395", "0.70476717", "0.70476717", "0.70442766", "0.7043613", "0.7036512", "0.7034797", "0.7028192", "0.7025835", "0.7023132", "0.7020776", "0.7019161", "0.7017742", "0.70176953", "0.69956166", "0.69932127", "0.69916224" ]
0.7808235
3
Format a date to yyyymmddThhmmssZ (UTC).
function formatDate(d) { "use strict"; var year, month, day, hour, minute, second; year = d.getUTCFullYear(); month = padInteger(d.getUTCMonth() + 1, 2); day = padInteger(d.getUTCDate(), 2); hour = padInteger(d.getUTCHours(), 2); minute = padInteger(d.getUTCMinutes(), 2); second = padInteger(d.getUTCSeconds(), 2); return year + month + day + 'T' + hour + minute + second + 'Z'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dateToUTC(d) {\n var arr = [];\n [\n d.getUTCFullYear(), (d.getUTCMonth() + 1), d.getUTCDate(),\n d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds()\n ].forEach(function(n) {\n arr.push((n >= 10) ? n : '0' + n);\n });\n return arr.splice(0, 3).join('-') + ' ' + arr.join(':');\n }", "function formatDate(date) {\n const event = new Date(date).toISOString().split('T');\n const yyyymmdd = event[0].split('-').join('');\n const hhmmss = event[1].split('.')[0].split(':').join('');\n\n return `${yyyymmdd}T${hhmmss}Z`;\n }", "function formatDateUTC(date) {\n if (date instanceof Date) {\n return date.getUTCFullYear() + '-' +\n padZeros(date.getUTCMonth()+1, 2) + '-' +\n padZeros(date.getUTCDate(), 2);\n\n } else {\n return null;\n }\n}", "function formatDate(date) {\r\n function pad(n) {\r\n return n >9 ? n : \"0\" + n;\r\n }\r\n\r\n return [ date.getUTCFullYear(), \"-\", pad(date.getUTCMonth() + 1), \"-\",\r\n pad(date.getUTCDate() + 1), \"T\", pad(date.getUTCHours()), \":\",\r\n pad(date.getUTCMinutes()) ].join(\"\");\r\n }", "function formatDate(date) {\n // date is a date object\n const options = { year: 'numeric', month: 'short', day: 'numeric', timeZone: 'UTC' };\n return date.toLocaleString('en-US', options);\n}", "function jstzFormatDate(date, format, utc) {\n var MMMM = [\"\\x00\", \"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"];\n var MMM = [\"\\x01\", \"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\n var dddd = [\"\\x02\", \"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"];\n var ddd = [\"\\x03\", \"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\n \n function ii(i, len) {\n var s = i + \"\";\n len = len || 2;\n while (s.length < len) s = \"0\" + s;\n return s;\n }\n \n var y = utc ? date.getUTCFullYear() : date.getFullYear();\n format = format.replace(/(^|[^\\\\])Y+/g, \"$1\" + y);\n format = format.replace(/(^|[^\\\\])y/g, \"$1\" + y.toString().substr(2, 2));\n \n var M = (utc ? date.getUTCMonth() : date.getMonth()) + 1;\n format = format.replace(/(^|[^\\\\])F+/g, \"$1\" + MMMM[0]);\n format = format.replace(/(^|[^\\\\])M/g, \"$1\" + MMM[0]);\n format = format.replace(/(^|[^\\\\])m/g, \"$1\" + ii(M));\n format = format.replace(/(^|[^\\\\])n/g, \"$1\" + M);\n \n var d = utc ? date.getUTCDate() : date.getDate();\n format = format.replace(/(^|[^\\\\])l+/g, \"$1\" + dddd[0]);\n format = format.replace(/(^|[^\\\\])D/g, \"$1\" + ddd[0]);\n format = format.replace(/(^|[^\\\\])d/g, \"$1\" + ii(d));\n format = format.replace(/(^|[^\\\\])j/g, \"$1\" + d);\n \n var H = utc ? date.getUTCHours() : date.getHours();\n format = format.replace(/(^|[^\\\\])H+/g, \"$1\" + ii(H));\n format = format.replace(/(^|[^\\\\])G/g, \"$1\" + H);\n \n var h = H > 12 ? H - 12 : H === 0 ? 12 : H;\n format = format.replace(/(^|[^\\\\])h+/g, \"$1\" + ii(h));\n format = format.replace(/(^|[^\\\\])g/g, \"$1\" + h);\n \n var m = utc ? date.getUTCMinutes() : date.getMinutes();\n format = format.replace(/(^|[^\\\\])i+/g, \"$1\" + ii(m));\n \n var s = utc ? date.getUTCSeconds() : date.getSeconds();\n format = format.replace(/(^|[^\\\\])s+/g, \"$1\" + ii(s));\n \n var tz = -date.getTimezoneOffset();\n var P = utc || !tz ? \"Z\" : tz > 0 ? \"+\" : \"-\";\n var O = P;\n if (!utc) {\n tz = Math.abs(tz);\n var tzHrs = Math.floor(tz / 60);\n var tzMin = tz % 60;\n P += ii(tzHrs) + \":\" + ii(tzMin);\n O += ii(tzHrs) + ii(tzMin);\n }\n format = format.replace(/(^|[^\\\\])P/g, \"$1\" + P);\n format = format.replace(/(^|[^\\\\])O/g, \"$1\" + O);\n \n var T = H < 12 ? \"AM\" : \"PM\";\n format = format.replace(/(^|[^\\\\])A+/g, \"$1\" + T);\n \n var t = T.toLowerCase();\n format = format.replace(/(^|[^\\\\])a+/g, \"$1\" + t);\n \n var day = (utc ? date.getUTCDay() : date.getDay()) + 1;\n format = format.replace(new RegExp(dddd[0], \"g\"), dddd[day]);\n format = format.replace(new RegExp(ddd[0], \"g\"), ddd[day]);\n \n format = format.replace(new RegExp(MMMM[0], \"g\"), MMMM[M]);\n format = format.replace(new RegExp(MMM[0], \"g\"), MMM[M]);\n \n format = format.replace(/\\\\(.)/g, \"$1\");\n \n return format;\n}", "function _formatDate(date) {\n\t//remove timezone GMT otherwise move time\n\tvar offset = date.getTimezoneOffset() * 60000;\n\tvar dateFormatted = new Date(date - offset);\n dateFormatted = dateFormatted.toISOString();\n if (dateFormatted.indexOf(\"T\") > 0)\n dateFormatted = dateFormatted.split('T')[0];\n return dateFormatted;\n}", "function timeFormatFn() {\n let now = new Date();\n return now.toUTCString();\n}", "function formatDate(d, z){\n\t\tvar fixed = [];\n\t\tvar z = z;\n\t\tif(z===\"local\") {\n\t\t\tfixed = fixDate([d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds()]);\n\t\t\tz = d.toString().match(/\\(([A-Za-z\\s].*)\\)/)[1];\n\t\t} else {\n\t\t\tfixed = fixDate([d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate(), d.getUTCHours(), d.getUTCMinutes(), d.getUTCSeconds()]);\n\t\t}\n\n\t\treturn fixed[0] + \"/\" + fixed[1] + \"/\" + fixed[2] + \" \" + fixed[3] + \":\" + fixed[4] + \":\" + fixed[5] + \" \" + z;\n\t}", "function formatDate(date) {\n // date is a date object\n const options = { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' };\n return date.toLocaleDateString('en-US', options);\n}", "static formatDate(date) {\n let formattedDate = '';\n\n formattedDate += date.getUTCFullYear();\n formattedDate += '-' + ('0' + (date.getUTCMonth() + 1)).substr(-2);\n formattedDate += '-' + ('0' + date.getUTCDate()).substr(-2);\n\n return formattedDate;\n }", "function formatDate(date) {\n\tconst TEN = 10;\n\tfunction addZero(n){\n\t\treturn n<TEN ? '0'+n : n;\n\t}\n\tlet newDateMs = new Date(date.getTime());\n\tlet newYear = new Date(newDateMs).getFullYear();\n\tlet newMonth = addZero(new Date(newDateMs).getMonth()+1);\n\tlet newDate = addZero(new Date(newDateMs).getDate());\n\tlet newHours = addZero(new Date(newDateMs).getHours());\n\tlet newMinutes = addZero(new Date(newDateMs).getMinutes());\n\n\treturn `${newYear}/${newMonth}/${newDate} ${newHours}:${newMinutes}`;\n}", "formatDate(datestr) {\n\n // interpret date string as UTC always (comes from server this way)\n var d = new Date(datestr + 'UTC');\n\n // check if we have a valid date\n if (isNaN(d.getTime())) return null;\n\n // Convert to milliseconds, then add tz offset (which is in minutes)\n var nd = new Date(d.getTime() + (60000*this.state.timezoneOffset));\n\n // return time as a user-readable string\n return dateFormat(nd, \"mmmm d yyyy - hh:MM TT\")\n }", "function dateFormat(date){\n var newTime = new Date(date);\n //var utc8 = d.getTime();\n //var newTime = new Date(utc8);\n var Year = newTime.getFullYear();\n var Month = newTime.getMonth()+1;\n var myDate = newTime.getDate();\n var minute = newTime.getMinutes();\n if(minute<10){\n minute=\"0\"+minute;\n }\n if(myDate<10){\n myDate=\"0\"+myDate;\n }\n if(Month<10){\n Month=\"0\"+Month;\n }\n var hour = newTime.getHours()+\":\"+minute;\n var time = Year+\"-\"+Month+\"-\"+myDate+\" \"+hour;\n\n return time;\n}", "function formatDate(dateString) {\n const date = new Date(dateString);\n return date.toLocaleDateString(\"en-US\", { timeZone: \"UTC\" });\n}", "function formatDate(date){var d=new Date(date),month=''+(d.getMonth()+1),day=''+d.getDate(),year=''+d.getFullYear();hours=''+d.getHours();minutes=''+d.getMinutes();seconds=''+d.getSeconds();if(month.length<2)month='0'+month;if(day.length<2)day='0'+day;if(hours.length<2)hours='0'+hours;if(minutes.length<2)minutes='0'+minutes;if(seconds.length<2)seconds='0'+seconds;return[year,month,day].join('-')+\"T\"+[hours,minutes,seconds].join(':');}", "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 formatDate(date) {\n var year = date.getFullYear()\n var month = (1 + date.getMonth()).toString()\n var day = date.getUTCDate()\n return month + \"/\" + day + \"/\" + year\n}", "function convertDateToUTC(day, month, year){\n return year + \"-\" + month + \"-\" + day + \"T00:00:00\";\n }", "function formatDate(time) {\n var seconds = parseInt(time);\n var d = new Date(0);\n d.setUTCSeconds(seconds);\n\n return d.toLocaleString();\n}", "function formatDate(theDate) {\n return dateFormat(theDate, \"yyyy'-'mm'-'dd'T'HH:MM:sso\")\n}", "function formatDate(date) {\n const min = date.getMinutes();\n const hours = date.getHours();\n const day = date.getDate();\n const month = date.getMonth();\n const fullYear = date.getFullYear();\n const twoChar = 10;\n return (\n `${fullYear}/${month + 1}/${day} ` +\n `${hours < twoChar ? '0' : ''}${hours}:` +\n `${min < twoChar ? '0' : ''}${min}`\n );\n}", "function reformatDate(date) {\n\tif (!date || date == null) {\n\t\treturn \"\";\n\t}\n\t\n\t// split up the date and time components to make easier to change.\n\tvar datetime = date.split(' ');\n\t\n\t// reformat the calendar-date components.\n\tvar oldDate = datetime[0];\n\tvar oldDateComponents = oldDate.split('/');\n\tvar YYYY = oldDateComponents[2];\n\tvar MM = oldDateComponents[0].length === 1 ? '0' + oldDateComponents[0] : oldDateComponents[0]; // month should be in the form 'MM'.\n\tvar DD = oldDateComponents[1];\n\t\n\t// reformat the clock-time components.\n\tvar oldTime = datetime[1];\n\tvar oldTimeComponents = oldTime.split(':');\n\tvar hh = oldTimeComponents[0].length === 1 ? '0' + oldTimeComponents[0] : oldTimeComponents[0]; // hours should be in the form 'hh'.\n\tvar mm = oldTimeComponents[1];\n\tvar ss = '00'; // seconds aren't preserved in formatDate() from the original TimeStamp, so here just hardcoding 0...\n\tvar sss = '000'; // same situation as seconds, so here just hardcoding 0 for milliseconds...\n\t\n\t// assemble the iso date from the reformatted date and time components.\n\tvar isoDate = YYYY + '-' + MM + '-' + DD + 'T' + // add the date components.\n\t\thh + ':' + mm + ':' + ss + '.' + sss + 'Z'; // add the time components.\n\t\n\t// return the iso-formatted version of the date.\n\treturn isoDate;\n}", "function myformat(date, string) {\n\tlet TZ = '';\n\tconst match = date.toString().match(/(\\(.+\\))/);\n\tif (match) {\n\t\tTZ = match[1];\n\t}\n\treturn format(date, string.replace(/\\bZZZ\\b/g, '|||')).replace(/\\|\\|\\|/g, TZ);\n}", "function formatDate(date) {\n var result = '';\n result = result+date.getFullYear()+'-';\n if(date.getMonth()+1 < 10) {\n result = result+'0';\n }\n result = result+(date.getMonth()+1);\n result = result+'-';\n if(date.getDate() < 10) {\n result = result+'0';\n }\n result = result+date.getDate();\n result = result+'T';\n if(date.getHours() < 10) {\n result = result+'0';\n }\n result = result+date.getHours()+':';\n if(date.getMinutes() < 10) {\n result = result +'0';\n }\n result = result+date.getMinutes()+':';\n if(date.getSeconds() < 10) {\n result = result+'0';\n }\n result = result+date.getSeconds();\n return result;\n}", "function formatDate(date) {\n\treturn new Date(date.split(' ').join('T'))\n}", "function formatTime(date) {\n let now\n let h\n\n if (date) {\n now = new Date(convertLocalDateToUTCDate(date));\n h = now.getHours() + \":\" + (\"0\" + now.getMinutes()).slice(-2);\n } else {\n now = new Date();\n h = now.getHours() + \":\" + (\"0\" + now.getMinutes()).slice(-2);\n }\n return h\n }", "function formatTime(date) {\n const year = date.getFullYear()\n const month = date.getMonth() + 1\n const day = date.getDate()\n const hour = date.getHours()\n const minute = date.getMinutes()\n const second = date.getSeconds()\n\n return [year, month, day].map(formatNumber).join('/') + '+' + [hour, minute, second].map(formatNumber).join(':')\n}", "function makeDateStr(date) {\n let day = date.getDate();\n let month = date.getMonth() + 1;\n let year = date.getFullYear();\n let hours = date.getHours();\n let minutes = date.getMinutes();\n\n if (day < 10) {\n day = '0' + day;\n }\n if (month < 10) {\n month = '0' + month;\n }\n if (hours < 10) {\n hours = '0' + hours;\n }\n if (minutes < 10) {\n minutes = '0' + minutes;\n }\n\n let dateStr = day + '.' + month + '.' + year + ' ' + hours + ':' + minutes + ' Uhr';\n return dateStr;\n}", "function formatDate(date)\n{\n date = new Date(date * 1000);\n return '' + date.getFullYear() + '/' + lpad(date.getMonth(), 2, '0') + '/' + lpad(date.getDate(), 2, '0') + ' ' + lpad(date.getHours(), 2, '0') + ':' + lpad(date.getMinutes(), 2, '0');\n}", "function formatTime(date) {\n const d = new Date(date);\n return twoDigits(d.getHours()) + \":\" + twoDigits(d.getMinutes()) + \":\" + twoDigits(d.getSeconds());\n}", "_formatDate(date, tzOffset) {\n let str = window.iotlg.dateFormat;\n let actualDate = new Date();\n actualDate.setTime(date.getTime() + this._getMilliseconds(tzOffset, UNIT_HOUR));\n let hours = (actualDate.getUTCHours());\n let day = (actualDate.getUTCDate());\n\n str = str.replace(\"yyyy\", actualDate.getUTCFullYear());\n str = str.replace(\"mm\", this._fillUp(actualDate.getUTCMonth() + 1, 2));\n str = str.replace(\"dd\", this._fillUp(day, 2));\n str = str.replace(\"hh\", this._fillUp(hours, 2));\n str = str.replace(\"MM\", this._fillUp(actualDate.getUTCMinutes(), 2));\n str = str.replace(\"ss\", this._fillUp(actualDate.getUTCSeconds(), 2));\n str = str.replace(\" \", \"\\n\");\n return str;\n }", "function formatDate(date) {\n\n var year = date.getFullYear();\n var month = date.getMonth() + 1; // month starts with 0\n var day = date.getDate();\n\n var hour = date.getHours();\n var min = date.getMinutes();\n var sec = date.getSeconds();\n\n var dateString = year + \"-\" + month + \"-\" + day + \" \" + hour + \":\" + min + \":\" + sec;\n return dateString;\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 }", "formatTime(d){\n let time = new Date(d.replace('Z', ''));\n let date = new Date(time);\n let hours = date.getHours();\n let minutes = date.getMinutes();\n let ampm = hours >= 12 ? 'PM' : 'AM';\n hours = hours % 12;\n hours = hours ? hours: 12;\n minutes = minutes < 10 ? '0'+minutes : minutes;\n let formatedTime = `${hours}:${minutes} ${ampm}`\n\n return formatedTime;\n }", "function formatDate(date) {\n var date = new Date(date * 1000);\n return `${date.getMonth() + 1}/${date.getDate()}/${date.getUTCFullYear()}`;\n}", "function formatDate() {\n let d = new Date();\n function twoChars( string ) {\n if ( string.length < 2 ) {\n string = '0' + string;\n }\n return string;\n }\n\n let year = d.getFullYear();\n let month = twoChars( ( d.getMonth() + 1 ).toString() );\n let date = twoChars( ( d.getDate() ).toString() );\n\n let hours = twoChars( d.getHours().toString() );\n let minutes = twoChars( d.getMinutes().toString() );\n let seconds = twoChars( d.getSeconds().toString() );\n\n return year + '-' + month + '-' + date + ' ' + hours + ':' + minutes + ':' + seconds;\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 formatTimestamp(date) {\n return date.getFullYear()+'-'+('0'+(date.getMonth()+1)).slice(-2)+'-'+('0'+date.getDate()).slice(-2)+' '+('0'+date.getHours()).slice(-2)+':'+('0'+date.getMinutes()).slice(-2)+':'+('0'+date.getSeconds()).slice(-2);\n }", "formatDateTime(date, format) {\n date = new Date(date);\n var result = format || 'y-m-d h:i:s';\n result = result.replace('y', date.getFullYear());\n result = result.replace('m', this.pad(date.getMonth() + 1, 2));\n result = result.replace('d', this.pad(date.getDate(), 2));\n result = result.replace('h', this.pad(date.getHours(), 2));\n result = result.replace('i', this.pad(date.getMinutes(), 2));\n result = result.replace('s', this.pad(date.getSeconds(), 2));\n return result;\n }", "function dateToFullAussieString(d){\r\n return d.getDate() + \"/\" + (d.getMonth() + 1) + \"/\" + d.getFullYear() + \" \" + d.getHours() + \":\" + d.getMinutes() + \":\" + d.getSeconds();\r\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 formatTimeZone(datetime) {\r\n return datetime.substring(0,10) + \" \" + datetime.substring(11,19);\r\n}", "formatDate(x) {\n let date = new Date(x)\n let _month = date.getMonth() + 1 < 10 ? `0${date.getMonth() + 1}` : date.getMonth() + 1\n let _date = date.getDate() < 10 ? `0${date.getDate()}` : date.getDate()\n let _hour = date.getHours() < 10 ? `0${date.getHours()}` : date.getHours()\n let _minute = date.getMinutes() < 10 ? `0${date.getMinutes()}` : date.getMinutes()\n let _second = date.getSeconds() < 10 ? `0${date.getSeconds()}` : date.getSeconds()\n let dateStr = `${date.getFullYear()}-${_month}-${_date} ${_hour}:${_minute}:${_second}`\n return dateStr\n }", "function formDateString(high, low, tz) {\n var ticks = bn.dec(bn.add(bn.shl(bn.n2a(high), 4), bn.n2a(low)));\n var ms, c;\n var ns = bn.md(ticks.slice(-4), 4);\n if(ticks.length > 4)\n ms = parseInt(ticks.slice(0, ticks.length - 4));\n else\n ms = 0;\n var res = new Date(ms - msOffset).toISOString().split('Z')[0] + ns;\n if(res.indexOf('.') > 0)\n while(res.length > 0){\n c = res.charAt(res.length - 1);\n if(c == \"0\" || c == \".\") {\n res = res.slice(0, res.length - 1);\n if(c == \".\")\n break;\n } else\n break;\n }\n if(res.slice(-9) == \"T00:00:00\")\n res = res.slice(0, res.length - 9);\n if(tz == 1)\n res += 'Z';\n else if (tz == 2) {\n var offset = new Date().getTimezoneOffset();\n var a;\n if(offset > 0) {\n a = '-';\n } else {\n offset = -offset;\n a = '+';\n }\n var m = offset % 60;\n res += a + dig((offset - m)/60, 2) + ':' + dig(m, 2);\n }\n return res;\n}", "function date_to_str(date)\n{\n return format(\"%02u/%02u/%02u\", date.getUTCMonth()+1, date.getUTCDate(), date.getUTCFullYear()%100);\n}", "function formatDate(unformattedDate){\n\tvar date = new Date(unformattedDate);\n\tvar formattedDate = date.toLocaleDateString()+\"\\t\"+ date.toLocaleTimeString();\n\treturn formattedDate;\n}", "function formatDateInZform(originalDate)\n{\n\tvar formatedDate=\"\";\n\tvar dateComponants=[];\n\t//Check if at least it is timedate format\n\tvar dateCorrected=\"\";\n\tif(originalDate.includes(\"T\")==false)\n\t{\n\t\tdateCorrected=originalDate.replace(\" \",\"T\");\n\t\t//console.log(\"date: \"+originalDate);\n\t}\n\telse\n\t{\n\t\tdateCorrected=originalDate;\n\t}\n\t\n\t//console.log(\"Date :\"+dateCorrected);\n\tif(dateCorrected.includes(\"+\"))\n\t{\n\t\tvar dateComponants=dateCorrected.split(\"+\");\n\t\tif(dateComponants.length>0)\n\t\t{\n\t\t\tformatedDate=dateComponants[0];//+\"+00:00\"\n\t\t\t//formatedDate+=\"+00:00\";\n\t\t\tif(formatedDate.includes(\"Z\")||formatedDate.includes(\"z\"))\n\t\t\t{\n\t\t\t\tvar dateComponant2=formatedDate.split(\"Z\");\n\t\t\t\tformatedDate=dateComponant2[0];\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\t//add the timestamp part \n\t\t//console.log(dateCorrected+\"T00:00:00.000+01:00\");\n\t\tformatedDate=dateCorrected+\"T00:00:00.000\";\n\t}\n\t\n\treturn formatedDate+manifest.typeZone;\n}", "function _formatDateTime(date) {\n\t//remove timezone GMT otherwise move time\n\tvar offset = date.getTimezoneOffset() * 60000;\n\tvar dateFormatted = new Date(date - offset);\n dateFormatted = dateFormatted.toISOString();\n if (dateFormatted.indexOf(\".\") > 0)\n dateFormatted = dateFormatted.split('.')[0];\n return dateFormatted;\n}", "getFormattedDate(date) {\n const year = date.getFullYear();\n const month = (date.getUTCMonth() + 1).toString().padStart(2, '0');\n const day = (date.getUTCDate()).toString().padStart(2, '0');\n // Logger.log(`Day: ${day}, Month: ${month}, Year:${year}`)\n const dateFormatted = `${year}-${month}-${day}`;\n return dateFormatted;\n }", "function getDate(d) {\n function pad(n) {\n return n < 10 ? '0' + n : n;\n }\n return d.getUTCFullYear() + '-'\n + pad(d.getUTCMonth() + 1) + '-'\n + pad(d.getUTCDate()) + 'T'\n + pad(d.getUTCHours()) + ':'\n + pad(d.getUTCMinutes()) + ':'\n + pad(d.getUTCSeconds()) + 'Z';\n }", "function formatDate(date) {\n var d = new Date(date);\n d = d.toLocaleString();\n return d;\n }", "function formatUTCDateAtMidnight(date) {\n var dateString = '';\n dateString += ('000' + date.getUTCFullYear()).slice(-4);\n dateString += '-';\n dateString += ('0' + (date.getUTCMonth() + 1)).slice(-2); \n dateString += '-';\n dateString += ('0' + date.getUTCDate()).slice(-2);\n dateString += 'T00:00:00Z';\n return dateString;\n }", "function date2str(date) {\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;\n }", "static formatDate(date) {\n return new Date(date).toLocaleDateString();\n }", "format(value) {\n return moment.utc(value).format('YYYY-MM-DD');\n }", "function formatDate(date) {\n var year = date.getFullYear(),\n month = date.getMonth() + 1, // months are zero indexed\n day = date.getDate(),\n hour = date.getHours(),\n minute = date.getMinutes(),\n minuteFormatted = minute < 10 ? \"0\" + minute : minute;\n\n return year + \".\" + month + \".\" + day + \" \" + hour + \":\" + minuteFormatted;\n}", "function formatDate(dateString, formatString) {\n return format(getUtcDate(dateString), formatString);\n }", "function datestr (date) {\n const local = new Date(date);\n local.setMinutes(date.getMinutes() - date.getTimezoneOffset());\n return local.toJSON().slice(0, 10);\n}", "function datehashiso() { // @return ISO8601DateString: \"2000-01-01T00:00:00.000Z\"\r\n var padZero = (this.ms < 10) ? \"00\" : (this.ms < 100) ? \"0\" : \"\",\r\n dd = uuhash._num2dd;\r\n\r\n return uuformat(\"?-?-?T?:?:?.?Z\", this.Y, dd[this.M], dd[this.D],\r\n dd[this.h], dd[this.m], dd[this.s],\r\n padZero + this.ms);\r\n}", "function formatDate(date){\n var year = date.getFullYear();\n var month = date.getMonth() + 1;\n var day = date.getDate();\n var hour = date.getHours();\n var minute = date.getMinutes();\n\n if(day < 10) day = '0' + day;\n if(month < 10) month = '0' + month;\n if(hour < 10) hour = '0' + hour;\n if(minute < 10) minute = '0' + minute;\n\n return [year, month, day, hour, minute].join('-');\n}", "function ISODateString(d){\n function pad(n){return n<10 ? '0'+n : n}\n return d.getUTCFullYear()+'-'\n + pad(d.getUTCMonth()+1)+'-'\n + pad(d.getUTCDate())+'T'\n + pad(d.getUTCHours())+':'\n + pad(d.getUTCMinutes())+':'\n + pad(d.getUTCSeconds())+'Z'}", "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 formatJiveDate(date) {\n\n if (Date.prototype.toISOString) {\n return date.toISOString().replace(/Z$/, \"+0000\");\n }\n\n function pad(number) {\n var r = String(number);\n if ( r.length === 1 ) {\n r = '0' + r;\n }\n return r;\n }\n\n return date.getUTCFullYear()\n + '-' + pad( date.getUTCMonth() + 1 )\n + '-' + pad( date.getUTCDate() )\n + 'T' + pad( date.getUTCHours() )\n + ':' + pad( date.getUTCMinutes() )\n + ':' + pad( date.getUTCSeconds() )\n + '.' + String( (date.getUTCMilliseconds()/1000).toFixed(3) ).slice( 2, 5 )\n + '+0000';\n }", "function formatDate(date) {\n\t\treturn (date.getMonth() + 1 + '/' + date.getDate() + '/' + date.getFullYear() + ' - ' + formatTime([date.getHours(), date.getMinutes()]));\n\t}", "function formatDate() {\n\tvar date = new Date(Date.now())\n\tvar month = date.getMonth() + 1\n\tvar day = date.getUTCDate().toString()\n\tvar hours = date.getUTCHours()\n\tvar minutes = date.getUTCMinutes().toString()\n\n\tfunction pad(date) {\n\t\treturn (date < 10) ? \"0\" + date : date\n\t}\n\t// round minutes to previous multiple of 5\n\tvar Oldminutes = parseInt(minutes)\n\tminutes = 5 * Math.round(Oldminutes / 5)\n\tif (Oldminutes < minutes) {\n\t\tminutes = minutes - 5\n\t}\n\t//return formatted date\n\treturn date.getFullYear().toString() + pad(month) + pad(day) + pad(hours) + pad(minutes)\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}", "function getDate(d) {\n function pad(n){return n<10 ? '0'+n : n}\n return d.getUTCFullYear()+'-'\n + pad(d.getUTCMonth()+1)+'-'\n + pad(d.getUTCDate())+'T'\n + pad(d.getUTCHours())+':'\n + pad(d.getUTCMinutes())+':'\n + pad(d.getUTCSeconds())+'Z';\n }", "function ISODateString(d) {\r\n function pad(n) {\r\n return n < 10 ? '0' + n : n\r\n }\r\n return d.getUTCFullYear() + '-' +\r\n pad(d.getUTCMonth() + 1) + '-' +\r\n pad(d.getUTCDate()) + 'T' +\r\n pad(d.getUTCHours()) + ':' +\r\n pad(d.getUTCMinutes()) + ':' +\r\n pad(d.getUTCSeconds()) + 'Z'\r\n}", "function toUTCtime(dateStr) {\n //Date(1381243615503+0530),1381243615503,(1381243615503+0800)\n \n dateStr += \"\";\n var utcPrefix = 0;\n var offset = 0;\n var dateFormatString = \"yyyy-MM-dd hh:mm:ss\";\n var utcTimeString = \"\";\n var totalMiliseconds = 0;\n\n var regMatchNums = /\\d+/gi;\n var regSign = /[\\+|\\-]/gi;\n var arrNums = dateStr.match(regMatchNums);\n utcPrefix = parseInt(arrNums[0]);\n if (arrNums.length > 1) {\n offset = arrNums[1];\n offsetHour = offset.substring(0, 2);\n offsetMin = offset.substring(2, 4);\n offset = parseInt(offsetHour) * 60 * 60 * 1000 + parseInt(offsetMin) * 60 * 1000;\n }\n if(dateStr.lastIndexOf(\"+\")>-1){\n totalMiliseconds= utcPrefix - offset;\n } else if (dateStr.lastIndexOf(\"-\") > -1) {\n totalMiliseconds = utcPrefix + offset;\n }\n\n utcTimeString = new Date(totalMiliseconds).format(dateFormatString);\n return utcTimeString;\n}", "function timeformater(ts){\n let date = new Date(ts);\n let Y = date.getFullYear() + '-';\n let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';\n let D = date.getDate() + ' ';\n let result = Y+M+D\n return result; \n }", "formatTimeStamp (stamp) {\n this.ctatdebug (\"formatTimeStamp (\" + stamp + \")\");\n\n var s=\"\";\n var year= stamp.getUTCFullYear();\n s += year+\"-\";\n\n var month=stamp.getUTCMonth();\n month++;\n s += ((month<10) ? (\"0\"+month) : month)+\"-\";\n\n var date = stamp.getUTCDate();\n s += ((date<10) ? (\"0\"+date) : date)+\" \";\n\n var hours = stamp.getUTCHours();\n s += ((hours<10) ? (\"0\"+hours) : hours)+\":\";\n\n var mins = stamp.getUTCMinutes();\n s += ((mins<10) ? (\"0\"+mins) : mins)+\":\";\n\n var secs = stamp.getUTCSeconds();\n s += ((secs<10) ? (\"0\"+secs) : secs);\n\n var msec = stamp.getUTCMilliseconds ();\n s+=\".\";\n s+=(msec<10?\"00\":(msec<100?\"0\":\"\"))+msec;\n\n //s+=\" UTC\";\n\n return s;\n }", "function formatDate (date) {\n return dateFormat(date, 'HH:MM dd/mm/yyyy')\n}", "static formatTime(date, includeSeconds = false) {\n let formattedTime = '';\n\n formattedTime += ('0' + date.getUTCHours()).substr(-2);\n formattedTime += ':' + ('0' + date.getUTCMinutes()).substr(-2);\n\n if (includeSeconds)\n formattedTime += ':' + ('0' + date.getUTCSeconds()).substr(-2);\n\n return formattedTime;\n }", "function dateToCRMFormat(date) {\n return dateFormat(date, \"yyyy-mm-ddThh:MM:ss+\" + (-date.getTimezoneOffset() / 60) + \":00\");\n}", "function formatDateString(date) {\n return Utilities.formatDate(date, Session.getTimeZone(), 'yyyy-MM-dd');\n}", "function ISODateString(d) {\n function pad(n){\n return n<10 ? '0'+n : n\n }\n return d.getUTCFullYear()+'-'\n + pad(d.getUTCMonth()+1)+'-'\n + pad(d.getUTCDate())+'T'\n + pad(d.getUTCHours())+':'\n + pad(d.getUTCMinutes())+':'\n + pad(d.getUTCSeconds())+'Z'\n}", "function toUtcTimeString(source) {\r\n if (!source) {\r\n return source;\r\n }\r\n const wrapped = moment.utc(source);\r\n return (wrapped.isValid() ? wrapped.format() : source);\r\n}", "static getUTCDateTime() {\n return new Date().toISOString().replace(/T/, ' ').replace(/\\..+/, '')\n }", "function dateUTC( date ) {\n\t\tif ( !( date instanceof Date ) ) {\n\t\t\tdate = new Date( date );\n\t\t}\n\t\tvar timeoff = date.getTimezoneOffset() * 60 * 1000;\n\t\tdate = new Date( date.getTime() + timeoff );\n\t\treturn date;\n\t}", "function getFormattedDate(dt) {\n\tvar msgTime = dt.toString();\n\tvar tzPos = msgTime.search(' GMT') - ' GMT'.length;\n\t// minus bcoz it returns the last index of the search string\n\tmsgTime = msgTime.substr(4, tzPos);\n\treturn msgTime;\n}", "function formatDate(date) {\n var hours = date.getHours();\n var minutes = date.getMinutes();\n var ampm = hours >= 12 ? 'pm' : 'am';\n hours = hours % 12;\n hours = hours ? hours : 12; // the hour '0' should be '12'\n minutes = minutes < 10 ? '0'+minutes : minutes;\n var strTime = hours + ':' + minutes + ' ' + ampm;\n return date.getMonth()+1 + \"/\" + date.getDate() + \"/\" + date.getFullYear() + \" \" + strTime;\n }", "formatTheDate(date, format) {\n const [ year, month, day ] = (date.toISOString()).substr(0, 10).split('-');\n return dateFns.format(new Date(\n year,\n (month - 1),\n day,\n ), format);\n }", "format(value, options) {\n const format = options.dateOnly ? 'YYYY-MM-DD' : 'YYYY-MM-DD hh:mm:ss';\n return moment.utc(value).format(format);\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 icsDate(date) {\n\t\tdate = new Date(date);\n\n\t\treturn date.getUTCFullYear() +\n\t\t (\"0\" + (date.getUTCMonth() + 1)).substr(-2) +\n\t\t (\"0\" + date.getUTCDate()).substr(-2) +\n\t\t \"T\" +\n\t\t (\"0\" + date.getUTCHours()).substr(-2) +\n\t\t (\"0\" + date.getUTCMinutes()).substr(-2) +\n\t\t (\"0\" + date.getUTCSeconds()).substr(-2) +\n\t\t \"Z\";\n\t}", "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 }", "formatDate(date) {\n return date.getHours() + ':' + '0' + date.getMinutes();\n }", "function formatDateIso(date) {\n\tif (!date || date == null) {\n\t\treturn \"\";\n\t}\n\t\n\tvar jsDate = new Date(date);\n\t\n\t// get the calendar-date components of the iso date. \n\tvar YYYY = jsDate.getFullYear();\n\tvar MM = (jsDate.getMonth() + 1) < 10 ? '0' + (jsDate.getMonth() + 1) : (jsDate.getMonth() + 1); // month should be in the form 'MM'.\n\tvar DD = jsDate.getDate() < 10 ? '0' + jsDate.getDate() : jsDate.getDate(); // day should be in the form 'DD'.\n\t\n\t// get the clock-time components of the iso date.\n\tvar hh = jsDate.getHours() < 10 ? '0' + jsDate.getHours() : jsDate.getHours(); // hours should be in the form 'hh'.\n\tvar mm = jsDate.getMinutes() < 10 ? '0' + jsDate.getMinutes() : jsDate.getMinutes(); // minutes should be in the form 'mm'.\n\tvar ss = jsDate.getSeconds() < 10 ? '0' + jsDate.getSeconds() : jsDate.getSeconds(); // seconds should be in the form 'ss'.\n\tvar sss = '000'; //just hardcoded 000 for milliseconds...\n\t\n\t// assemble the iso date from the date and time components.\n\tvar isoDate = YYYY + '-' + MM + '-' + DD + 'T' + // add the date components.\n\t\thh + ':' + mm + ':' + ss + '.' + sss + 'Z'; // add the time components.\n\t\t\n\t// return the iso-formatted version of the date.\n\treturn isoDate;\n}", "function getFormatTime(date) {\n var now = date;\n var hour = now.getHours();\n var minute = now.getMinutes();\n var second = now.getSeconds();\n if (hour.toString().length == 1) {\n var hour = '0' + hour;\n }\n if (minute.toString().length == 1) {\n var minute = '0' + minute;\n }\n if (second.toString().length == 1) {\n var second = '0' + second;\n }\n var dateTime = hour + ':' + minute + ':' + second;\n return dateTime;\n }", "formatDate(date) {\n return date.toISOString().replaceAll(\"-\", \"\").substring(0, 8);\n }", "function convertUTCtoOttawa(date) {\n \n var d = new Date();\n if (d.getHours() === d.getUTCHours()) {\n d.setUTCHours(d.getUTCHours() - 5);\n }\n\n return d;\n}", "function dateUTC(date) {\n\treturn new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000);\n}", "function toString(dateObj) {\n return `\\\n${dateObj.getFullYear()}-\\\n${leadingZero(dateObj.getMonth() + 1)}-\\\n${leadingZero(dateObj.getDate())}T\\\n${leadingZero(dateObj.getHours())}:\\\n${leadingZero(dateObj.getMinutes())}:\\\n${leadingZero(dateObj.getSeconds())}\\\n`\n}", "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 formatTime(date) {\n var hour = date.getHours();\n var minute = date.getMinutes();\n\n hour = (hour < 10 ? '0' : '') + hour.toString();\n minute = (minute < 10 ? '0' : '') + minute.toString();\n\n return hour + ':' + minute;\n}", "function format_to_human_readable(rt) {\n var h = rt.getUTCHours() > 0 ? rt.getUTCHours() + STRING_HOURS : \"\"\n var m = rt.getUTCMinutes() < 10 && rt.getUTCHours() > 1 ? \"0\"+ rt.getUTCMinutes() : rt.getUTCMinutes();\n var s = rt.getUTCSeconds() < 10 ? \"0\"+ rt.getUTCSeconds() : rt.getUTCSeconds();\n var ts = h + m + STRING_MINUTES + s + STRING_SECONDS;\n return ts;\n }", "function formatDate(date, format) {\n format = format + \"\";\n var result = \"\";\n var i_format = 0;\n var c = \"\";\n var token = \"\";\n var y = date.getYear() + \"\";\n var M = date.getMonth() + 1;\n var d = date.getDate();\n var E = date.getDay();\n var H = date.getHours();\n var m = date.getMinutes();\n var s = date.getSeconds();\n var yyyy, yy, MMM, MM, dd, hh, h, mm, ss, ampm, HH, H, KK, K, kk, k;\n // Convert real date parts into formatted versions\n var value = new Object();\n if (y.length < 4) {\n y = \"\" + (y - 0 + 1900);\n }\n value[\"y\"] = \"\" + y;\n value[\"yyyy\"] = y;\n value[\"yy\"] = y.substring(2, 4);\n value[\"M\"] = M;\n value[\"MM\"] = LZ(M);\n value[\"MMM\"] = MONTH_NAMES[M - 1];\n value[\"NNN\"] = MONTH_NAMES[M + 11];\n value[\"d\"] = d;\n value[\"dd\"] = LZ(d);\n value[\"E\"] = DAY_NAMES[E + 7];\n value[\"EE\"] = DAY_NAMES[E];\n value[\"H\"] = H;\n value[\"HH\"] = LZ(H);\n if (H == 0) {\n value[\"h\"] = 12;\n } else if (H > 12) {\n value[\"h\"] = H - 12;\n } else {\n value[\"h\"] = H;\n }\n value[\"hh\"] = LZ(value[\"h\"]);\n if (H > 11) {\n value[\"K\"] = H - 12;\n } else {\n value[\"K\"] = H;\n }\n value[\"k\"] = H + 1;\n value[\"KK\"] = LZ(value[\"K\"]);\n value[\"kk\"] = LZ(value[\"k\"]);\n if (H > 11) {\n value[\"a\"] = \"PM\";\n } else {\n value[\"a\"] = \"AM\";\n }\n value[\"m\"] = m;\n value[\"mm\"] = LZ(m);\n value[\"s\"] = s;\n value[\"ss\"] = LZ(s);\n while (i_format < format.length) {\n c = format.charAt(i_format);\n token = \"\";\n while ((format.charAt(i_format) == c) && (i_format < format.length)) {\n token += format.charAt(i_format++);\n }\n if (value[token] != null) {\n result = result + value[token];\n } else {\n result = result + token;\n }\n }\n return result;\n}" ]
[ "0.6826333", "0.67047906", "0.651441", "0.6436641", "0.6324332", "0.6306206", "0.62392205", "0.61832565", "0.6170359", "0.61187994", "0.61064774", "0.61043894", "0.60808337", "0.6071499", "0.6040859", "0.60220987", "0.6017967", "0.59885806", "0.59659344", "0.5942233", "0.59299684", "0.5916239", "0.59132993", "0.5896845", "0.5889548", "0.5887258", "0.58831227", "0.5832341", "0.58221734", "0.5821479", "0.57980084", "0.57937115", "0.5790778", "0.5780124", "0.5755561", "0.57384586", "0.57353836", "0.57298034", "0.57298034", "0.57298034", "0.57236654", "0.57215095", "0.5681841", "0.5677023", "0.5658913", "0.5648123", "0.5646723", "0.56447273", "0.56398106", "0.56376964", "0.5636049", "0.5630086", "0.5628575", "0.56263053", "0.56259674", "0.56193197", "0.5615183", "0.5610808", "0.5604265", "0.55955267", "0.5589019", "0.5582413", "0.55727446", "0.5569806", "0.55602735", "0.55580264", "0.55527526", "0.55447835", "0.55403364", "0.55364895", "0.5528356", "0.5524593", "0.55237865", "0.5518925", "0.55170536", "0.5513424", "0.5509286", "0.5504623", "0.5480844", "0.54789144", "0.5478541", "0.5471108", "0.54696995", "0.5448379", "0.5447617", "0.54457885", "0.5440917", "0.54311365", "0.5423161", "0.54156375", "0.5403947", "0.54033846", "0.54033816", "0.5389239", "0.538651", "0.5379118", "0.53749317", "0.53701115", "0.53682584", "0.5365829" ]
0.65411615
2
Generate a snapshot name given a base.
function snapshotName(base) { "use strict"; var when = formatDate(new Date()); return base + '-' + when; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateUsername(base) {\n base = base.toLowerCase();\n var entries = [];\n var finalName;\n return userDB.allDocs({startkey: base, endkey: base + '\\uffff', include_docs: false})\n .then(function(results){\n if(results.rows.length === 0) {\n return BPromise.resolve(base);\n }\n for(var i=0; i<results.rows.length; i++) {\n entries.push(results.rows[i].id);\n }\n if(entries.indexOf(base) === -1) {\n return BPromise.resolve(base);\n }\n var num = 0;\n while(!finalName) {\n num++;\n if(entries.indexOf(base+num) === -1) {\n finalName = base + num;\n }\n }\n return BPromise.resolve(finalName);\n });\n }", "function NavMakeFileName(/**string*/ root, /**string*/ baseName, /**string*/ number, /**string*/ extension)\r\n{\r\n\treturn root + \"\\\\\" + baseName + number + \".\" + extension;\r\n}", "function makeUniqueName(baseName) {\n // Find the first unique 'name_n', where n is a positive number\n if (baseName.charCodeAt(baseName.length - 1) !== 95 /* _ */) {\n baseName += \"_\";\n }\n var i = 1;\n while (true) {\n var generatedName = baseName + i;\n if (isUniqueName(generatedName)) {\n return generatedNameSet[generatedName] = generatedName;\n }\n i++;\n }\n }", "function uniqueIDName(idBase, idIdx){\r\n /// returns unique ID name to be used when generating id names\r\n return idBase + idIdx;\r\n }", "publicName() {\n if (this.isSnapshot()) {\n return `${this.blobName}-${Date.parse(this.snapshotDate)}`;\n }\n if (this.isVirtualDirectory()) {\n return Buffer.from(this.blobName, 'utf8').toString('base64');\n }\n return this.blobName;\n }", "function getUniqScreenshotName() {\n //use the current date/time \"now\" variable captured when the program first ran \n //for the folder names\n const todaysDate = dateFormat(now, \"mm_dd_yy\");\n const startTime = dateFormat(now, \"h_MM_ss_TT\");\n \n //folder to store the screenshots\n const baseScreenshotFolder = \"screenshots\";\n const subFolder = todaysDate + \"__\" + startTime;\n const folderpath = baseScreenshotFolder + \"/\" + subFolder + \"/\";\n //create folders if they dont exist\n if (!fs.existsSync(baseScreenshotFolder)){fs.mkdirSync(baseScreenshotFolder);}\n if (!fs.existsSync(folderpath)){fs.mkdirSync(folderpath);} \n \n // increment the screenshot counter, i.e Awd3.png\n screenshotCounter = screenshotCounter + 1;\n console.log(\"should be creating screenshot: \" + folderpath + currModule + screenshotCounter + \".png\");\n return folderpath + currModule + screenshotCounter + \".png\";\n}", "publicName() {\n if (this.isSnapshot()) {\n return `${this.name}-${Date.parse(this.snapshotDate)}`;\n }\n if (this.isVirtualDirectory()) {\n return Buffer.from(this.name, 'utf8').toString('base64');\n }\n return this.name;\n }", "_getUniqueIdentifier(sourceFile, baseName) {\n if (this.isUniqueIdentifierName(sourceFile, baseName)) {\n this._recordUsedIdentifier(sourceFile, baseName);\n return ts.createIdentifier(baseName);\n }\n let name = null;\n let counter = 1;\n do {\n name = `${baseName}_${counter++}`;\n } while (!this.isUniqueIdentifierName(sourceFile, name));\n this._recordUsedIdentifier(sourceFile, name);\n return ts.createIdentifier(name);\n }", "function generateNewID(obj, base) {\n\t\tvar number = 1;\n\t\tbase = base || 'id';\n\t\tvar id = ('' + base + number);\n\t\twhile (obj.hasOwnProperty(id)) id = ('' + base + (++number));\n\n\t\treturn id;\n\t}", "function makeUniqueFrameName(baseName) {\n var objArray,tagCounter=1,i,possName,name,DOM,nameList=\"\";\n\n possName = baseName;\n DOM = dreamweaver.getDocumentDOM(\"parent\");\n if (!DOM) DOM = dreamweaver.getDocumentDOM(\"document\");\n objArray = DOM.body.getElementsByTagName('FRAME');\n if (objArray.length > 0) { //other images, check\n for (i=0; i<objArray.length; i++) { //create list of all img names\n name = objArray[i].getAttribute(\"name\"); if (name) nameList += \" \" + name + \" \";\n name = objArray[i].getAttribute(\"id\"); if (name) nameList += \" \" + name + \" \";\n }\n while (nameList.indexOf(possName) != -1) possName = baseName+tagCounter++; //find 1st avail\n }\n return possName\n}", "function globular_freshName(n) {\n return n.toString() + '-' + Math.random().toString(36).slice(2);\n}", "function _generateCurrentName() {\n NameWebAPIUtils.getNewCurrentName();\n}", "function baseName(str) {\n var base = new String(str).substring(str.lastIndexOf('/') + 1);\n if (base.lastIndexOf('.') !== -1) {\n base = base.substring(0, base.lastIndexOf('.'));\n }\n return base;\n}", "function profileNameToFileName(baseFileName, profileName) {\n var prefix = \"\";\n if (profileName) {\n prefix = profileName + \"-\";\n }\n return path.join(\n path.dirname(baseFileName),\n prefix + path.basename(baseFileName)\n );\n}", "function baseObj(name, baseDir) {\n var src = name.replace(/ /g , '');\n var baseDir = baseDir || 'Sp14/';\n return { name: name,\n img: baseDir + src + '.jpg',\n imgSrc: src + '.jpg' };\n}", "function getFullShotFileName (pageName, viewport) {\n return options.screenshotDir + '/originals/' + pageName + '_' + viewport.width + 'x' + viewport.height + '_full-page.png';\n }", "uniqueName(prefix) { return `${prefix}${this.nextNameIndex++}`; }", "uniqueName(prefix) { return `${prefix}${this.nextNameIndex++}`; }", "uniqueName(prefix) { return `${prefix}${this.nextNameIndex++}`; }", "function makeFileName (fileName) {\n\t\treturn (+new Date()) + '_' + fileName;\n\t}", "function generateUniqueString(prefix) {\n return `${prefix}-${Date.now()}-${Math.round(Math.random() * 1000000)}`;\n}", "function fn_getuniquefilename()\r\n{\r\n\tvar indate,inthr,intmi,intsec;\r\n\tindate = aqConvert.DateTimeToFormatStr(aqDateTime.Today(),\"%b_%d_%y\");\r\n\tinthr = aqDateTime.GetHours(aqDateTime.Now());\r\n\tintmi = aqDateTime.GetMinutes(aqDateTime.Now());\r\n\tintsec = aqDateTime.GetSeconds(aqDateTime.Now());\r\n\treturn indate + \"-\" + inthr + \"_\" + intmi + \"_\" + intsec;\r\n\t\r\n}", "createSnapshot(){\r\n let fs = require('fs');\r\n let fname = `data/snap${Date.now()}.bck`;\r\n let ws = fs.createWriteStream(fname);\r\n let base64Buffer = new Buffer.from(this.s.read());\r\n ws.write(base64Buffer.toString('base64'));\r\n }", "createSnapshot(){\r\n let fs = require('fs');\r\n let fname = `data/snap${Date.now()}.bck`;\r\n let ws = fs.createWriteStream(fname);\r\n let base64Buffer = new Buffer.from(this.s.read());\r\n ws.write(base64Buffer.toString('base64'));\r\n }", "function random_logo_name(max,prefix,suffix)\n{\n var rand_no = Math.floor((max+1) * Math.random())\n return prefix + rand_no + suffix\n}", "function generateName() {\n var sRnd = '';\n var sChrs = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz\";\n for (var i = 0; i < 5; i++) {\n var randomPoz = Math.floor(Math.random() * sChrs.length);\n sRnd += sChrs.substring(randomPoz, randomPoz + 1);\n }\n return sRnd;\n}", "generateResourceID(base=\"\"){function idPart(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return base+idPart()+idPart()+\"-\"+idPart()+\"-\"+idPart()+\"-\"+idPart()+\"-\"+idPart()+idPart()+idPart()}", "function getUniqueImageFileName( type ) {\n\t\tvar date = new Date(),\n\t\t\tdateParts = [ date.getFullYear(), date.getMonth() + 1, date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds() ];\n\n\t\tuniqueNameCounter += 1;\n\n\t\treturn 'image-' + CKEDITOR.tools.array.map( dateParts, padNumber ).join( '' ) + '-' + uniqueNameCounter + '.' + type;\n\t}", "function base(dec, base) {\n var len = base.length;\n var ret = '';\n while(dec > 0) {\n ret = base.charAt(dec % len) + ret;\n dec = Math.floor(dec / len);\n }\n return ret;\n}", "static generateHashMNameByMName(name) {\n return `yrv_${YrvUtil.getHashCode(name)}`\n }", "uniqueName(prefix) {\n return `${prefix}${this.nextNameIndex++}`;\n }", "uniqueName(prefix) {\n return `${prefix}${this.nextNameIndex++}`;\n }", "function bandNameGenerator(str) {\n let bandName = '';\n if (str.charAt(0) === str.charAt(str.length -1)) {\n bandName = str.slice(0, -1);\n bandName += str;\n return bandName.charAt(0).toUpperCase() + bandName.slice(1);\n } else {\n bandName = 'The ' + (str.charAt(0).toUpperCase() + str.slice(1));\n console.log(bandName);\n return bandName;\n }\n}", "function generateName(userInfo, name) {\n console.log(\"commonName\", name);\n var fauxLeague = {\n leagueName: name,\n UserId: userInfo.id\n };\n initializeLeague(fauxLeague);\n }", "function calcSlug(basename, fileRecord){\n if(fileRecord.data.jekyllFilename){\n var jn = fileRecord.data.jekyllFilename;\n return jn.year + \"/\" + jn.month + \"/\" + jn.day + \"/\" + jn.title + \".html\";\n }\n else {\n return basename;\n }\n}", "function h$ghcjsbn_showBase(b, base) {\n h$ghcjsbn_assertValid_b(b, \"showBase\");\n h$ghcjsbn_assertValid_s(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === 1) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}", "function h$ghcjsbn_showBase(b, base) {\n h$ghcjsbn_assertValid_b(b, \"showBase\");\n h$ghcjsbn_assertValid_s(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === 1) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}", "function h$ghcjsbn_showBase(b, base) {\n h$ghcjsbn_assertValid_b(b, \"showBase\");\n h$ghcjsbn_assertValid_s(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === 1) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}", "function h$ghcjsbn_showBase(b, base) {\n h$ghcjsbn_assertValid_b(b, \"showBase\");\n h$ghcjsbn_assertValid_s(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === 1) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}", "function generateName(list) {\n let total = parseInt(list[0][1])\n let sample = Math.floor(name_prng() * total);\n for (i = 1; i < list.length && sample > 0; i++) {\n sample -= parseInt(list[i][1])\n }\n return list[i][0]\n }", "function generateUniqueString(prefix = \"\") {\n return prefix+parseInt(time()*Math.random());\n }", "function getCookieName(base_name) {\n return config_cookie_name_prefix + base_name + '.' + tenant_id;\n }", "function makeFilename(i) {\n return \"../faces/\" + i.toString().padStart(5, '0') + \".jpg\";\n }", "buildFileName ( type ) {\n return JSON_ROOT + type + '.json';\n }", "function image_name() {\n return program.user + '/' + program.image;\n}", "function baseConverter(num, base) {\n const bases = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, \"a\", \"b\", \"c\", \"d\", \"e\", \"f\"]\n const possibleBases = bases.slice(0, base)\n\n let result = [];\n\n while (num >= base) {\n result.unshift(possibleBases[num % base])\n num = Math.floor(num / base)\n }\n result.unshift(num)\n return result.join(\"\")\n}", "function $builtin_base_convert_helper(obj, base) {\n var prefix = \"\";\n switch(base){\n case 2:\n prefix = '0b'; break\n case 8:\n prefix = '0o'; break\n case 16:\n prefix = '0x'; break\n default:\n console.log('invalid base:' + base)\n }\n\n if(obj.__class__ === $B.long_int){\n var res = prefix + obj.value.toString(base)\n return res\n }\n\n var value = $B.$GetInt(obj)\n\n if(value === undefined){\n // need to raise an error\n throw _b_.TypeError.$factory('Error, argument must be an integer or' +\n ' contains an __index__ function')\n }\n\n if(value >= 0){return prefix + value.toString(base)}\n return '-' + prefix + (-value).toString(base)\n}", "generateUID(target) {\n let uid = \"\";\n for (var i = 0; i < this.UIDlength; i++)\n uid += this.UIDChars.charAt(\n Math.floor(Math.random() * this.UIDChars.length)\n );\n return uid;\n }", "function generateUniqueName() {\n return uuid().replace(/-/g, '')\n .replace(/1/g, 'one')\n .replace(/2/g, 'two')\n .replace(/3/g, 'three')\n .replace(/4/g, 'four')\n .replace(/5/g, 'five')\n .replace(/6/g, 'six')\n .replace(/7/g, 'seven')\n .replace(/8/g, 'eight')\n .replace(/9/g, 'nine')\n .replace(/0/g, 'zero');\n}", "function generateResourceFileName(title, type, date, fileName) {\n const safeTitle = slugify(title).replace(/[^a-zA-Z0-9-]/g, '');\n if (title.length >= 100) console.log(fileName);\n return `${date}-${type}-${safeTitle}.md`;\n}", "function fname(url) {\n let x = url.substring(url.lastIndexOf('/')+1)+ \"_raw.json\";\n x = x.replace(/~/g, '_');\n console.log(`x is ${x}`);\n return x;\n}", "function pathof(baseUri, service, resource) {\n return baseUri + service.name.toLowerCase() + \"/\" + resource.name.toLowerCase();\n}", "function generateNewPhotoName(previousPhotoName) {\r\n\r\n //Remove username from the filename:\r\n var tempStr = previousPhotoName.replace(username,\"\");\r\n console.log(\"tempStr: \" + tempStr + typeof(tempStr));\r\n\r\n //Extract the numeric substring at the end of the filename:\r\n var tempStr2 = tempStr.replace(/[^0-9]+/ig,\"\");\r\n console.log(\"tempStr2: \" + tempStr2 + typeof(tempStr2));\r\n\r\n //Convert the numeric substring to an int:\r\n var tempInt = parseInt(tempStr2);\r\n console.log(\"tempInt: \" + tempInt + typeof(tempInt));\r\n\r\n //Incrment by one:\r\n tempInt += 1;\r\n console.log(\"tempInt + 1: \" + tempInt + typeof(tempInt));\r\n \r\n //Crete a new filename using the incremented number:\r\n var newName = `${username}-pic${tempInt}` \r\n\r\n return(newName);\r\n }", "function generateFullName(part, path) {\n const partKey = path[path.length - 1];\n if (appLib.appModel.metaschema.fullName && !part.fullName) {\n // some tests and potentially apps do not have fullName in metaschema\n part.fullName = camelCase2CamelText(partKey);\n }\n }", "function getSubgen(name, getLongName) {\r\n var subgens = {\r\n \"Red/Blue\": \"1-0\",\r\n \"RB\": \"1-0\",\r\n \"Yellow\": \"1-1\",\r\n \"RBY\": \"1-1\",\r\n \"RBY Stadium\": \"1-2\",\r\n \"Stadium\": \"1-2\",\r\n \"RBY Tradebacks\": \"1-3\",\r\n \"Gold/Silver\": \"2-0\",\r\n \"GS\": \"2-0\",\r\n \"Crystal\": \"2-1\",\r\n \"GSC\": \"2-1\",\r\n \"GSC Stadium\": \"2-2\",\r\n \"Stadium 2\": \"2-2\",\r\n \"Stadium2\": \"2-2\",\r\n \"Ruby/Sapphire\": \"3-0\",\r\n \"RS\": \"3-0\",\r\n \"Colosseum\": \"3-1\",\r\n \"FireRed/LeafGreen\": \"3-2\",\r\n \"FRLG\": \"3-2\",\r\n \"RSE\": \"3-3\",\r\n \"Emerald\": \"3-3\",\r\n \"XD\": \"3-4\",\r\n \"Diamond/Pearl\": \"4-0\",\r\n \"DP\": \"4-0\",\r\n \"Platinum\": \"4-1\",\r\n \"DPPt\": \"4-1\",\r\n \"HeartGold/SoulSilver\": \"4-2\",\r\n \"HGSS\": \"4-2\",\r\n \"Black/White\": \"5-0\",\r\n \"BW\": \"5-0\",\r\n \"Black/White 2\": \"5-1\",\r\n \"BW2\": \"5-1\",\r\n \"XY\": \"6-0\",\r\n \"Omega Ruby/Alpha Sapphire\": \"6-1\",\r\n \"ORAS\": \"6-1\",\r\n \"1\": \"1-3\",\r\n \"2\": \"2-2\",\r\n \"3\": \"3-4\",\r\n \"4\": \"4-2\",\r\n \"5\": \"5-1\",\r\n \"6\": \"6-1\"\r\n };\r\n if (getLongName) {\r\n for (var x in subgens) {\r\n if (cmp(name,subgens[x])) {\r\n return x;\r\n }\r\n }\r\n }\r\n else {\r\n for (var y in subgens) {\r\n if (cmp(name,y)) {\r\n return subgens[y];\r\n }\r\n }\r\n }\r\n return false;\r\n}", "function getFileName(entity, baseFolder) {\n\n var _dir, _fileName;\n\n try {\n\n _dir = baseFolder === undefined ? entity + 's' : baseFolder.substr(1) + '/' + entity + 's';\n _fileName = path.resolve(_dir + '/' + entity + '.json');\n\n if (!fs.existsSync(_fileName)) {\n mkdir('/' + _dir);\n writeDocument('{}', _fileName);\n }\n\n return q.resolve(_fileName);\n } catch (error) {\n return q.reject(error);\n }\n\n}", "function getName(phrase) {\n var md = forge.md.sha256.create();\n for(var n=0; n <100; n++)\n md.update(phrase);\n return md.digest().toHex()+ '.zip';\n}", "function makeFullName() {\n return `${nameIntro} ${firstName} ${lastName}`;\n }", "function h$ghcjsbn_showBase(b, base) {\n ASSERTVALID_B(b, \"showBase\");\n ASSERTVALID_S(base, \"showBase\");\n if(h$ghcjsbn_cmp_bb(b, h$ghcjsbn_zero_b) === GHCJSBN_EQ) {\n return \"0\";\n } else {\n return h$ghcjsbn_showBase_rec(b, base, Math.log(base), 0);\n }\n}", "function createCurrentLocation(base, location) {\r\n const { pathname, search, hash } = location;\r\n // allows hash bases like #, /#, #/, #!, #!/, /#!/, or even /folder#end\r\n const hashPos = base.indexOf('#');\r\n if (hashPos > -1) {\r\n let slicePos = hash.includes(base.slice(hashPos))\r\n ? base.slice(hashPos).length\r\n : 1;\r\n let pathFromHash = hash.slice(slicePos);\r\n // prepend the starting slash to hash so the url starts with /#\r\n if (pathFromHash[0] !== '/')\r\n pathFromHash = '/' + pathFromHash;\r\n return stripBase(pathFromHash, '');\r\n }\r\n const path = stripBase(pathname, base);\r\n return path + search + hash;\r\n}", "function createCurrentLocation(base, location) {\r\n const { pathname, search, hash } = location;\r\n // allows hash bases like #, /#, #/, #!, #!/, /#!/, or even /folder#end\r\n const hashPos = base.indexOf('#');\r\n if (hashPos > -1) {\r\n let slicePos = hash.includes(base.slice(hashPos))\r\n ? base.slice(hashPos).length\r\n : 1;\r\n let pathFromHash = hash.slice(slicePos);\r\n // prepend the starting slash to hash so the url starts with /#\r\n if (pathFromHash[0] !== '/')\r\n pathFromHash = '/' + pathFromHash;\r\n return stripBase(pathFromHash, '');\r\n }\r\n const path = stripBase(pathname, base);\r\n return path + search + hash;\r\n}", "function base(path, ext) {\n var name = split(path).peek();\n if (ext && name) {\n var diff = name.length - ext.length;\n if (diff > -1 && name.lastIndexOf(ext) == diff) {\n return name.substring(0, diff);\n }\n }\n return name;\n}", "function renamer_minify(base, i) {\n var tail, name, m;\n if (base.length === 1 && i === 0) {\n return base;\n }\n tail = false;\n name = '';\n while (true) {\n do {\n m = -1;\n if (tail) {\n m = i % TAILLEN;\n name += TAIL.charAt(m);\n i = (i - m) / TAILLEN;\n }\n else {\n m = i % HEADLEN;\n name += HEAD.charAt(m);\n i = (i - m) / HEADLEN;\n }\n } while (i > 0);\n if (iskw(name)) {\n name = '';\n i++;\n continue;\n }\n break;\n }\n return name;\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}", "static generatePid(prefix) {\n return 'urn:' + (prefix ? prefix : 'ghsts') + ':' + UUID.v4();\n }", "get snapshotNameInput() {\n return this._snapshotName;\n }", "function createCompleteUri(uri) {\n // Add the passed parameter to the base\n return ApiUrlBase + uri;\n}", "function createCurrentLocation(base, location) {\n const { pathname, search, hash } = location;\n // allows hash based url\n const hashPos = base.indexOf('#');\n if (hashPos > -1) {\n // prepend the starting slash to hash so the url starts with /#\n let pathFromHash = hash.slice(1);\n if (pathFromHash[0] !== '/')\n pathFromHash = '/' + pathFromHash;\n return stripBase(pathFromHash, '');\n }\n const path = stripBase(pathname, base);\n return path + search + hash;\n}", "function guid(prefix) {\n\t return (prefix || '') + Math.round(Math.random() * 1000000).toString();\n\t }", "function reBase(mod) {\n var offset = mod.indexOf(REMOTE_SEPERATOR);\n if (offset > 0) {\n return REMOTE_BASE[mod.substr(0, offset)] + mod.substr(offset + 1);\n } else {\n return '';\n }\n }", "function nameString(obj) {\n}", "static getName(): String {\n return Date.now() + Math.random();\n }", "function makeFilename(netid){\n var date = dateFormat(Date.now(), \"isoDateTime\");\n return \"ResearchPortal_\" + (netid || \"report\") + \".\" + date + \".xlsx\";\n }", "function rebaseURL(base, url) {\n if (url.indexOf(\"://\")!==-1 || url[0]===\"/\")\n return url;\n return base.slice(0, base.lastIndexOf(\"/\")+1) + url;\n }", "function generateFileName(filename){\n\t\t\t// regular expression to extract the file name and file extension\n\t\t\tvar regExp = /(?:\\.([^.]+))?$/;\n\t\t\tvar extName = regExp.exec(filename)[1];\n\t\t\t\n\t\t\tvar date = new Date().getTime(); // no.of ms, between 1st jan 1970 and now\n\t\t\tvar charBank = \"abcdefghijklmnopqrstuvwxyz\";\n\t\t\tvar fString = '';\n\t\t\tfor(var i = 0; i < 14; i++){\n\t\t\t\tfString = fString + charBank[Math.round((Math.random()*26))];\n\t\t\t}\n\t\t\treturn (fString + date + '.' + extName);\n\t\t}", "function getReleaseName (config, version) {\n return config.releaseName.replace('{version}', version)\n}", "function testBase(base, char = '_') {\n for (let divine of divines) {\n if (usedDivines.indexOf(divine) >= 0) {\n continue;\n }\n console.log(`\\n\\n${base} + ${divine}:`);\n for (let i = 2; i < base.length - 1; i++) {\n const bFront = base.substring(0, i);\n const bBack = base.substring(i);\n for (let j = 2; j < divine.length - 1; j++) {\n const dFront = divine.substring(0, j);\n const dBack = divine.substring(j);\n console.log(`${bFront}${dBack} / ${dFront}${char}${bBack}`);\n }\n }\n }\n}", "function getRandomIdBase() {\n return Math.round(Math.random() * 9);\n}", "function m(t)\n {\n if (!t)\n t = \"aosmevbtihgfp\";\n t = t.charAt(rnd(t.length));\n var name = t + rnd(OBJECTS_PER_TYPE);\n switch(rnd(16)) {\n case 0: return m(\"o\") + \".\" + name;\n case 1: return m(\"g\") + \".\" + name;\n case 2: return \"this.\" + name;\n default: return name;\n }\n }", "function m(t)\n {\n if (!t)\n t = \"aosmevbtihgfp\";\n t = t.charAt(rnd(t.length));\n var name = t + rnd(OBJECTS_PER_TYPE);\n switch(rnd(16)) {\n case 0: return m(\"o\") + \".\" + name;\n case 1: return m(\"g\") + \".\" + name;\n case 2: return \"this.\" + name;\n default: return name;\n }\n }", "function m(t)\n {\n if (!t)\n t = \"aosmevbtihgfp\";\n t = t.charAt(rnd(t.length));\n var name = t + rnd(OBJECTS_PER_TYPE);\n switch(rnd(16)) {\n case 0: return m(\"o\") + \".\" + name;\n case 1: return m(\"g\") + \".\" + name;\n case 2: return \"this.\" + name;\n default: return name;\n }\n }", "function m(t)\n {\n if (!t)\n t = \"aosmevbtihgfp\";\n t = t.charAt(rnd(t.length));\n var name = t + rnd(OBJECTS_PER_TYPE);\n switch(rnd(16)) {\n case 0: return m(\"o\") + \".\" + name;\n case 1: return m(\"g\") + \".\" + name;\n case 2: return \"this.\" + name;\n default: return name;\n }\n }", "function m(t)\n {\n if (!t)\n t = \"aosmevbtihgfp\";\n t = t.charAt(rnd(t.length));\n var name = t + rnd(OBJECTS_PER_TYPE);\n switch(rnd(16)) {\n case 0: return m(\"o\") + \".\" + name;\n case 1: return m(\"g\") + \".\" + name;\n case 2: return \"this.\" + name;\n default: return name;\n }\n }", "function genGuid() {\n\t\treturn (S4() + S4() + \"-\" + S4() + \"-4\" + S4().substr(0, 3) + \"-\" + S4() + \"-\" + S4() + S4() + S4()).toLowerCase();\n\t}", "function uuidWithLetter (length) {\n return 'u' + uuid(length)\n}", "function createInternalIdentifier({name, surname}) {\n return `ID-INT:${name}-${surname}`;\n}", "function guid(prefix) {\n return (prefix || '') + Math.round(Math.random() * 1000000).toString();\n}", "function dwscripts_getRecordsetBaseName()\n{\n // default to Recordset for non-dynamic document types\n var retVal = MM.LABEL_RecordsetBaseName;\n \n var dom = dw.getDocumentDOM();\n if (dom)\n {\n var baseName = dom.serverModel.getRecordsetBaseName();\n if (baseName)\n {\n retVal = baseName;\n }\n }\n \n return retVal;\n}", "function soapboxgetimagefilename(nrating){\r\n return \"sbrating\" + nrating + \".bmp\";\r\n}", "function generateCWDName() {\n var requestId = createRequestId();\n return path.join(TEMP_DIR, requestId);\n }", "function fileBaseName(file) {\n return path__namespace.basename(file, path__namespace.extname(file));\n}", "function basepath(uri) {\n return 'views/' + uri;\n }", "function buildTableRangeName_(tableName) {\n return tableName.replace(/^[0-9]/, '').replace(/[^a-zA-Z0-9]/g, \"\") + ManagementService_.managementSheetName()\n }", "function getBackupSheetName(name){\n return name + \".\" + (new Date()).toString();\n}", "baseName (propertyName) {\n return propertyName;\n }", "static prefixName(data){\n let result = `Ust. ${data}`\n return result\n }", "async snap(name) {\n await this.nemo.screenshot.snap(name || 'screenshot')\n }", "function tmpName() {\n return '.'+Date.now().toString(36)+'-'+Math.random().toString(36).substr(2);\n}", "static GenerateUUID() {\n // https://github.com/couchbase/couchbase-lite-net/blob/995053a919d30ec59a0d03e680160aca191018f5/src/Couchbase.Lite.Shared/Util/Misc.cs#L44\n const buffer = Buffer.from(new Array(16));\n uuid(null, buffer, 0);\n return `-${buffer.toString('base64').replace(/\\//g, '_').replace(/\\+/g, '-').substring(0, 22)}`;\n }", "function sanitizeArtifactName(x) {\n let sani = x.replace(/[^A-Za-z0-9_]/g, '_'); // Charset requirement is imposed by CodeBuild\n const maxLength = 100; // Max length of 100 is imposed by CodePipeline library\n if (sani.length > maxLength) {\n const fingerprint = crypto.createHash('sha256').update(sani).digest('hex').slice(0, 8);\n sani = sani.slice(0, maxLength - fingerprint.length) + fingerprint;\n }\n return sani;\n}" ]
[ "0.65490043", "0.6277193", "0.6116239", "0.60826117", "0.5952341", "0.5876089", "0.58199483", "0.573663", "0.5692679", "0.5687249", "0.5618089", "0.5602993", "0.5602118", "0.5575302", "0.5533787", "0.5522069", "0.55129623", "0.55129623", "0.55129623", "0.5436213", "0.5373377", "0.5371866", "0.5304354", "0.5299467", "0.52868545", "0.52741456", "0.5271267", "0.5249236", "0.52096784", "0.52070713", "0.5199388", "0.5199388", "0.51599807", "0.5147633", "0.5140731", "0.51285034", "0.51285034", "0.51285034", "0.51285034", "0.51250696", "0.51156557", "0.51036", "0.506046", "0.5059012", "0.50589836", "0.5055352", "0.50440663", "0.50399303", "0.5039075", "0.5029439", "0.5026112", "0.5012332", "0.50061285", "0.49991655", "0.49937412", "0.4986255", "0.49819723", "0.49748436", "0.496228", "0.4956771", "0.4956771", "0.49526903", "0.49487993", "0.49415997", "0.49406332", "0.4934238", "0.49316147", "0.49312264", "0.4923009", "0.49215797", "0.4919915", "0.49119827", "0.49061966", "0.49025786", "0.49014455", "0.49012738", "0.48969162", "0.4895683", "0.48949972", "0.48949972", "0.48949972", "0.48949972", "0.48949972", "0.48908934", "0.48859188", "0.48764992", "0.48738652", "0.48715326", "0.4856485", "0.4844953", "0.48443615", "0.4842707", "0.4838918", "0.4838789", "0.4836422", "0.48238146", "0.48222405", "0.4817793", "0.4802919", "0.48010665" ]
0.8544114
0
Create a snapshot on the specified dataset with the specified name, exluding all datasets in excl.
function createSnapshot(ds, sn, excl) { "use strict"; function destroyExcludes(snaps, excl) { var toDestroy = snaps.filter(function (s) { var fields = s.name.split('@'); var createdNow = fields[1] === sn; var inExclude = _.contains(excl, fields[0]); return createdNow && inExclude; }); async.forEachSeries(toDestroy, function (snap, cb) { util.log('Destroy snapshot ' + snap.name + ' (excluded)'); zfs.destroy({ name: snap.name, recursive: true }, cb); }); } util.log('Create snapshot ' + ds + '@' + sn); zfs.snapshot({ dataset: ds, name: sn, recursive: true }, function (err) { if (err) { util.log(err); } else { zfs.list({ type: 'snapshot' }, function (err, snaps) { if (err) { util.log(err); } else { destroyExcludes(snaps, excl); } }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async snap(name) {\n await this.nemo.screenshot.snap(name || 'screenshot')\n }", "takeMemorySnapshot(name) {\n if (!isProfiling) return;\n const snapshot = profiler.takeSnapshot(name);\n const heapFileName = path.join(__dirname, `../../performance/memory/${name}_${(new Date().toISOString())}.heapsnapshot`);\n\n console.log(snapshot.getHeader());\n snapshot.export((error, result) => {\n if (error) {\n console.error('ERROR == ', error);\n }\n fs.writeFile(heapFileName, result, { flag: 'wx' }, (err) => {\n if (err) throw err;\n snapshot.delete();\n });\n });\n }", "function createSnapshot() {\n let xmlDom = Blockly.Xml.workspaceToDom(Blockly.mainWorkspace);\n let xmlText = Blockly.Xml.domToPrettyText(xmlDom);\n localStorage.setItem(\"blockly.xml\", xmlText);\n displaySuccessNotification(\".menu\",\"Snapshot created\");\n}", "function saveImageData(data, name) {\n //combine all data into object\n ret = {}\n for (key in data) {\n //get images for one product\n var imagePath = data[key][name];\n var jdata = JSON.parse(imagePath);\n\n //put the images into object, key is product id(0,1,2,3,4...)\n ret[key] = jdata;\n }\n allData[name] = ret;\n}", "function copyDatasetForRenaming(dataset) {\n return utils.defaults({\n layers: dataset.layers.map(function(lyr) {return utils.extend({}, lyr);})\n }, dataset);\n }", "function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscription() {\n return __awaiter(this, void 0, void 0, function* () {\n const subscriptionId = \"{subscription-id}\";\n const resourceGroupName = \"myResourceGroup\";\n const snapshotName = \"mySnapshot2\";\n const snapshot = {\n creationData: {\n createOption: \"Copy\",\n sourceResourceId: \"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1\"\n },\n location: \"West US\"\n };\n const credential = new DefaultAzureCredential();\n const client = new ComputeManagementClient(credential, subscriptionId);\n const result = yield client.snapshots.beginCreateOrUpdateAndWait(resourceGroupName, snapshotName, snapshot);\n console.log(result);\n });\n}", "function createASnapshotFromAnExistingSnapshotInTheSameOrADifferentSubscriptionInADifferentRegion() {\n return __awaiter(this, void 0, void 0, function* () {\n const subscriptionId = \"{subscription-id}\";\n const resourceGroupName = \"myResourceGroup\";\n const snapshotName = \"mySnapshot2\";\n const snapshot = {\n creationData: {\n createOption: \"CopyStart\",\n sourceResourceId: \"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Compute/snapshots/mySnapshot1\"\n },\n location: \"West US\"\n };\n const credential = new DefaultAzureCredential();\n const client = new ComputeManagementClient(credential, subscriptionId);\n const result = yield client.snapshots.beginCreateOrUpdateAndWait(resourceGroupName, snapshotName, snapshot);\n console.log(result);\n });\n}", "function createDataDir(snapshot) {\n return __awaiter(this, void 0, void 0, function* () {\n console.log('Writing snapshot data ...');\n const genPath = path.join(snapshot.rootPath, '.data');\n util.mkdirP(genPath);\n });\n}", "function addDataset(element, dataset) {\r\n for (var name_2 in dataset) {\r\n element.setAttribute(\"data-\" + name_2, dataset[name_2]);\r\n }\r\n }", "function setDataToLocalStroage(name, data) {\n let weatherData = {\n lastModifiedDate: today.getTime(),\n data: data\n };\n\n stroage.setItem(name, JSON.stringify(weatherData));\n}", "function saveSnapshot() {\n console.log(\"save snapshot\");\n}", "function data(name) {\n all(\"body /deep/ [data~=\\\"\" + name + \"\\\"]:not([inert])\").map(invoke);\n }", "function copyDatasetForExport(dataset) {\n var d2 = utils.extend({}, dataset);\n d2.layers = d2.layers.map(copyLayerShapes);\n if (d2.arcs) {\n d2.arcs = d2.arcs.getFilteredCopy();\n }\n return d2;\n }", "function useSelectedDataset() {\n let modUrl = \"/models-for-dataset?dataset=\" + getSelectedDatasetName();\n let imgUrl = \"/dataset-details?dataset=\" + getSelectedDatasetName();\n\n populateModels(modUrl);\n populateStaticImages(imgUrl);\n}", "function createASnapshotByImportingAnUnmanagedBlobFromTheSameSubscription() {\n return __awaiter(this, void 0, void 0, function* () {\n const subscriptionId = \"{subscription-id}\";\n const resourceGroupName = \"myResourceGroup\";\n const snapshotName = \"mySnapshot1\";\n const snapshot = {\n creationData: {\n createOption: \"Import\",\n sourceUri: \"https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd\"\n },\n location: \"West US\"\n };\n const credential = new DefaultAzureCredential();\n const client = new ComputeManagementClient(credential, subscriptionId);\n const result = yield client.snapshots.beginCreateOrUpdateAndWait(resourceGroupName, snapshotName, snapshot);\n console.log(result);\n });\n}", "function snapshot() {\n\t\t\tvar tmp;\n\n\t\t\tif (!hasSnapshot()) { // has no snapshots yet\n\t\t\t\tsnap.history = [angular.copy(object)];\n\t\t\t} else if (isChanged()) { // has snapshots and is changed since last version\n\t\t\t\ttmp = angular.copy(object);\n\t\t\t\tsnap.history.push(tmp);\n\t\t\t}\n\n\t\t\tsaveSnap();\n\t\t}", "updatedata(name, data) {\n let current = this.head;\n try {\n while (current != null) {\n if (current.name === name) current.nameset = data;\n current = current.next;\n }\n } catch (error) {\n console.log(\"/\" + dat + \"/\" + \"was entered\");\n }\n }", "function datasetDangerously () {}", "createSnapshot(){\r\n let fs = require('fs');\r\n let fname = `data/snap${Date.now()}.bck`;\r\n let ws = fs.createWriteStream(fname);\r\n let base64Buffer = new Buffer.from(this.s.read());\r\n ws.write(base64Buffer.toString('base64'));\r\n }", "createSnapshot(){\r\n let fs = require('fs');\r\n let fname = `data/snap${Date.now()}.bck`;\r\n let ws = fs.createWriteStream(fname);\r\n let base64Buffer = new Buffer.from(this.s.read());\r\n ws.write(base64Buffer.toString('base64'));\r\n }", "withSnapshot(snapshot) {\n return new AppendBlobClient(setURLParameter(this.url, URLConstants.Parameters.SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline);\n }", "withSnapshot(snapshot) {\n return new AppendBlobClient(setURLParameter(this.url, URLConstants.Parameters.SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline);\n }", "setData(name, data) {\n if(!App.pathFinder.data.visualisation_enabled) {\n return;\n }\n\n App.pathFinder.chart.series.find(\n el => el.name === name\n ).setData(data);\n }", "withSnapshot(snapshot) {\n return new BlobClient(setURLParameter(this.url, URLConstants.Parameters.SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline);\n }", "withSnapshot(snapshot) {\n return new BlobClient(setURLParameter(this.url, URLConstants.Parameters.SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline);\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 }", "_constructLevel2Snapshot(data, market) {\n let asks = [];\n let bids = [];\n for (let datum of data) {\n // Construct the price lookup map for all values supplied here.\n // Per the documentation, the id is a unique value for the\n // market and the price.\n if (this.constructL2Price) {\n this.l2PriceMap.set(datum.id, datum.price.toFixed(8));\n }\n\n // build the data point\n let point = new Level2Point(datum.price.toFixed(8), datum.size.toFixed(8), undefined, {\n id: datum.id,\n });\n\n // add the datapoint to the asks or bids depending if its sell or bid side\n if (datum.side === \"Sell\") asks.push(point);\n else bids.push(point);\n }\n\n // asks arrive in descending order (best ask last)\n // ccxws standardizes so that best bid/ask are array index 0\n asks = asks.reverse();\n\n return new Level2Snapshot({\n exchange: \"BitMEX\",\n base: market.base,\n quote: market.quote,\n id: market.id,\n asks,\n bids,\n });\n }", "MakeManualSnapshot(serviceName) {\n let url = `/hosting/reseller/${serviceName}/snapshot`;\n return this.client.request('POST', url);\n }", "function writeNewCollection(uid, name) {\n\n return new Promise(function(resolve,reject){\n\n // A Collection Entry\n var collectionData = {\n name: name,\n dateCreated: new Date().toString(),\n public: true,\n }\n\n db.ref('/user-posts/' + uid + '/collections/').push(collectionData).once(\"value\")\n .then(function(snapshot) {\n state.currentCollection.id = snapshot.key\n state.currentCollection.data = snapshot.val()\n resolve();\n });\n\n });\n\n }", "function writeData(name, data){\n return dbPromise\n .then(function(db){\n const tx = db.transaction(name, 'readwrite');\n const store = tx.objectStore(name);\n store.put(data);\n \n return tx.complete;\n });\n}", "function copyDataset(dataset) {\n var d2 = utils.extend({}, dataset);\n d2.layers = d2.layers.map(copyLayer);\n if (d2.arcs) {\n d2.arcs = d2.arcs.getFilteredCopy();\n }\n return d2;\n }", "async function saveSnapshot(snapshot) {\n // Ensure file doesn't collide with another snapshot first\n try {\n const existingSnapshot = await getSnapshot(snapshot.filename);\n if (existingSnapshot) {\n return existingSnapshot;\n }\n } catch (e) {\n \n }\n \n // See if there's a previous snapshot to link this new one to it\n const previousSnapshot = await getPrevious(snapshot);\n if (previousSnapshot) {\n console.log(\"Found previous snapshot -------\");\n console.log(previousSnapshot);\n snapshot.previous = previousSnapshot;\n console.log(snapshot.previous);\n\n console.log(\"About to call getsnapshot on\")\n console.log(previousSnapshot)\n // Compute deltas\n const prevReadings = await getSnapshot(previousSnapshot);\n\n console.log(prevReadings);\n\n for (var i = 0; i < snapshot.data.length; i++) {\n snapshot.data[i].delta = parseFloat(snapshot.data[i].value) - parseFloat(prevReadings.data[i].value);\n }\n }\n\n // Convert to JSON and write to disk\n const data = JSON.stringify(snapshot);\n const error = await fs.writeFile(SNAPSHOT_DIR + snapshot.filename, data);\n return snapshot;\n}", "async refreshDatasets () {\r\n window.clearTimeout(this._refreshDatasetPollTimeout);\r\n const newDatasetLookup = {};\r\n this.datasetList = (await d3.json('/datasets')).map((info, index) => {\r\n let linkedState;\r\n // If we already had a linkedState for this dataset, pass it as an\r\n // option to the new linkedState (so we can take over its event listeners,\r\n // handle any of its pending event callbacks, and preserve state like its\r\n // current view layout + selection)\r\n const priorLinkedState = this.datasetList[this.datasetLookup[info.datasetId]];\r\n if (info.sourceFiles.some(d => d.fileType === 'otf2')) {\r\n linkedState = new TracedLinkedState({ info, priorLinkedState });\r\n } else {\r\n linkedState = new LinkedState({ info, priorLinkedState });\r\n }\r\n newDatasetLookup[linkedState.info.datasetId] = index;\r\n\r\n if (linkedState.isBundling) {\r\n // If any of the datasets are still loading something, call this\r\n // function again in 30 seconds\r\n this._refreshDatasetPollTimeout = window.setTimeout(() => {\r\n this.refreshDatasets();\r\n }, 30000);\r\n }\r\n return linkedState;\r\n });\r\n this.datasetLookup = newDatasetLookup;\r\n if (!this.attemptedAutoHashOpen) {\r\n // The first time we load the page, do a check to see if the URL is\r\n // telling us to navigate to a specific one, or if there's only one\r\n // dataset that exists\r\n this.attemptedAutoHashOpen = true;\r\n const hash = window.decodeURIComponent(window.location.hash).substring(1);\r\n if (this.datasetLookup[hash] !== undefined) {\r\n this.currentDatasetId = hash;\r\n } else if (this.datasetList.length === 1) {\r\n this.currentDatasetId = this.datasetList[0].info.datasetId;\r\n } else {\r\n // Auto-expand the menu if we aren't starting with a dataset open\r\n this.menuView.expanded = true;\r\n }\r\n }\r\n await this.render();\r\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 createASnapshotByImportingAnUnmanagedBlobFromADifferentSubscription() {\n return __awaiter(this, void 0, void 0, function* () {\n const subscriptionId = \"{subscription-id}\";\n const resourceGroupName = \"myResourceGroup\";\n const snapshotName = \"mySnapshot1\";\n const snapshot = {\n creationData: {\n createOption: \"Import\",\n sourceUri: \"https://mystorageaccount.blob.core.windows.net/osimages/osimage.vhd\",\n storageAccountId: \"subscriptions/{subscription-id}/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount\"\n },\n location: \"West US\"\n };\n const credential = new DefaultAzureCredential();\n const client = new ComputeManagementClient(credential, subscriptionId);\n const result = yield client.snapshots.beginCreateOrUpdateAndWait(resourceGroupName, snapshotName, snapshot);\n console.log(result);\n });\n}", "didSnap(dataUri) {\n Ember.debug('didSnap', arguments);\n this.set('isFrozen', false);\n this.set('dataUri', dataUri);\n\n const now = new Date();\n const timestamp = +now;\n const captureImage = Ember.Object.create({\n 'name': `${timestamp}.jpg`,\n 'content_type': 'image/jpg',\n 'data': dataUri\n // 'data': btoa(dataUri) // base64-encoded `String`, or a DOM `Blob`, or a `File`\n });\n\n this.get('model.newCapture.images').addObject(captureImage)\n }", "function latestSnapshot(rds, name) {\n return new Promise(resolve => {\n rds.describeDBSnapshots({\n DBInstanceIdentifier: name\n }, (err, data) => {\n if (err) die(err);\n let snapshots = _.sortBy(data.DBSnapshots, 'SnapshotCreateTime');\n resolve(_.last(snapshots));\n });\n });\n}", "function outputData(setName){\n\t\tdocument.getElementById(\"letter1\").innerHTML = setName.firstLetter;\n\t\tdocument.getElementById(\"letter3\").innerHTML = setName.lastLetter;\n\t\tvar mainImageStill = document.getElementById(\"answerImage\"); //represents the main image on the page\n\t\tmainImageStill.src = \"images/\" + setName.name + \".png\";\n\t\t\n}", "async snapshot({\n name,\n waitForTimeout,\n waitForSelector,\n execute,\n ...options\n }) {\n // wait for any specified timeout\n if (waitForTimeout) {\n this.log.debug(`Wait for ${waitForTimeout}ms timeout`, this.meta);\n await new Promise(resolve => setTimeout(resolve, waitForTimeout));\n }\n\n // wait for any specified selector\n if (waitForSelector) {\n this.log.debug(`Wait for selector: ${waitForSelector}`, this.meta);\n\n /* istanbul ignore next: no instrumenting injected code */\n await this.eval(function waitForSelector({ waitFor }, selector, timeout) {\n return waitFor(() => !!document.querySelector(selector), timeout)\n .catch(() => Promise.reject(new Error(`Failed to find \"${selector}\"`)));\n }, waitForSelector, PAGE_TIMEOUT);\n }\n\n // execute any javascript\n await this.evaluate(typeof execute === 'function'\n ? execute : execute?.beforeSnapshot);\n\n // wait for any final network activity before capturing the dom snapshot\n await this.network.idle();\n\n // inject @percy/dom for serialization by evaluating the file contents which adds a global\n // PercyDOM object that we can later check against\n /* istanbul ignore next: no instrumenting injected code */\n if (await this.eval(() => !window.PercyDOM)) {\n this.log.debug('Inject @percy/dom', this.meta);\n let script = await fs.readFile(require.resolve('@percy/dom'), 'utf-8');\n await this.eval(new Function(script)); /* eslint-disable-line no-new-func */\n }\n\n // serialize and capture a DOM snapshot\n this.log.debug('Serialize DOM', this.meta);\n\n /* istanbul ignore next: no instrumenting injected code */\n return await this.eval((_, options) => ({\n /* eslint-disable-next-line no-undef */\n dom: PercyDOM.serialize(options),\n url: document.URL\n }), options);\n }", "function createDataset(name, callback) {\n var data = { name: name, tables: [{ name: \"Messages\", columns: [{ name: \"Id\", dataType: \"string\" }, { name: \"Thread\", dataType: \"string\" }, { name: \"Created\", dataType: \"DateTime\" }, { name: \"Client\", dataType: \"string\" }, { name: \"User\", dataType: \"string\" }, { name: \"UserPic\", dataType: \"string\" }, { name: \"Attachments\", dataType: \"Int64\" }, { name: \"Likes\", dataType: \"Int64\" }, { name: \"Url\", dataType: \"string\" }] }] };\n $.ajax({\n url: \"/api/PowerBI/CreateDataset\",\n type: \"POST\",\n data: JSON.stringify(data),\n contentType: \"application/json\",\n success: function (datasetId) {\n callback(datasetId);\n },\n error: function (er) {\n $(\"#alert\").html(\"Error creating dataset...\");\n $(\"#alert\").show();\n }\n });\n}", "load_dataset(dataset, dataset_elec) {\n if (dataset === undefined || dataset_elec === undefined) {\n // console.log('dataset:', dataset);\n // console.log('dataset_elect:', dataset_elec);\n }\n this.dataset = dataset;\n this.dataset_elec = dataset_elec;\n }", "function createSolidDataset() {\n return dataset();\n}", "instantiate(name = null) {\n let res = new Entity(name);\n return this.updateEntity(res);\n }", "async attachScreenshot(_allure, _name) {\n const img = await this.driver.takeScreenshot()\n _allure.createAttachment(_name, new Buffer(img, 'base64'))\n }", "async function copyData(trx, iterator, tableName, alteredName) {\n const existingData = await trx.raw(`SELECT * FROM \"${tableName}\"`);\n return insertChunked(trx, 20, alteredName, iterator, existingData);\n}", "function createLayerSet(name) {\n var newLayerSet = srcDoc.layerSets.add();\n newLayerSet.name = name;\n}", "static restore(data) {\n return new TextureAtlas({\n sourcePath: data.sourcePath\n });\n }", "async _datasetNameChanged() {\n const url = `/dataset-auto-onboard/metrics?dataset=` + get(this, 'datasetName');\n const res = await fetch(url).then(checkStatus);\n const metricsProperties = res.reduce(function (obj, metric) {\n obj[metric[\"name\"]] = {\n \"id\": metric['id'], \"urn\": \"thirdeye:metric:\" + metric['id'], \"monitor\": true\n };\n return obj;\n }, {});\n const metricUrn = metricsProperties[Object.keys(metricsProperties)[0]]['id'];\n const idToNames = {};\n Object.keys(metricsProperties).forEach(function (key) {\n idToNames[metricsProperties[key]['id']] = key;\n });\n\n this.setProperties({\n metricsProperties: metricsProperties,\n metrics: Object.keys(metricsProperties),\n idToNames: idToNames,\n metricUrn: metricUrn\n });\n\n const result = await fetch(`/data/autocomplete/filters/metric/${metricUrn}`).then(checkStatus);\n\n this.setProperties({\n filterOptions: result, dimensions: {dimensions: Object.keys(result)}\n });\n }", "function generateSampleData() {\n \n console.log('Generating sample DB - remove before launch!');\n data = createSamplePrimitiveDB();\n\n console.log(data);\n\n}", "setDataRefFromUniformName(ns, dataRef) {\n if (this.uniformNameList != null) {\n let list = this.uniformNameList;\n let len = list.length;\n\n for (let i = 0; i < len; ++i) {\n if (ns == list[i]) {\n this.dataList[i] = dataRef;\n break;\n }\n }\n }\n }", "function take_snapshot() {\n // take snapshot and get image data\n Webcam.snap(function (data_uri) {\n // Send data_uri to the backend.\n var blob = dataURItoBlob(data_uri);\n fd = new FormData(document.forms.namedItem('regForm'));\n fd.append(\"webcam_pic\", blob,\n \"webcam_pic.jpg\");\n });\n}", "function Name() {\n\tddb.Data.apply(this, arguments)\n}", "addNewTrialbook(name) {\n this.fetchData({type: \"ADD_NEW_TRIALBOOK\", data: {name: name}})\n }", "function loopRecordedSample(name) {\n }", "function setData(node, name, value) {\n var id = node[exp] || (node[exp] = ++$.uuid),\n store = data[id] || (data[id] = attributeData(node))\n if (name !== undefined) store[camelize(name)] = value\n return store\n }", "function setData(node, name, value) {\n var id = node[exp] || (node[exp] = ++$.uuid),\n store = data[id] || (data[id] = attributeData(node))\n if (name !== undefined) store[camelize(name)] = value\n return store\n }", "function setData(node, name, value) {\n var id = node[exp] || (node[exp] = ++$.uuid),\n store = data[id] || (data[id] = attributeData(node))\n if (name !== undefined) store[camelize(name)] = value\n return store\n }", "function setData(node, name, value) {\n var id = node[exp] || (node[exp] = ++$.uuid),\n store = data[id] || (data[id] = attributeData(node))\n if (name !== undefined) store[camelize(name)] = value\n return store\n }", "function setData(node, name, value) {\n var id = node[exp] || (node[exp] = ++$.uuid),\n store = data[id] || (data[id] = attributeData(node))\n if (name !== undefined) store[camelize(name)] = value\n return store\n }", "function setData(node, name, value) {\n var id = node[exp] || (node[exp] = ++$.uuid),\n store = data[id] || (data[id] = attributeData(node))\n if (name !== undefined) store[camelize(name)] = value\n return store\n }", "function setData(node, name, value) {\n var id = node[exp] || (node[exp] = ++$.uuid),\n store = data[id] || (data[id] = attributeData(node))\n if (name !== undefined) store[camelize(name)] = value\n return store\n }", "function setData(node, name, value) {\n var id = node[exp] || (node[exp] = ++$.uuid),\n store = data[id] || (data[id] = attributeData(node))\n if (name !== undefined) store[camelize(name)] = value\n return store\n }", "function setData(node, name, value) {\n var id = node[exp] || (node[exp] = ++$.uuid),\n store = data[id] || (data[id] = attributeData(node))\n if (name !== undefined) store[camelize(name)] = value\n return store\n }", "async _writeNewSeed(name) {\n const seedPath = this._getNewStubFilePath(name);\n await writeJsFileUsingTemplate(\n seedPath,\n this._getStubPath(),\n { variable: 'd' },\n this.config.variables || {}\n );\n return seedPath;\n }", "saveSnapshot(p = '/tmp/') {\n let now = new Date();\n let dateStr = `${now.getFullYear()}-${\n now.getMonth() + 1\n }-${now.getDate()}-${now.getHours()}-${now.getMinutes()}-${now.getSeconds()}`;\n let destination = path.join(p, `DoorBell_${dateStr}.jpg`);\n this.digestClient\n .fetch(`http://${this.dahua_host}/cgi-bin/snapshot.cgi`)\n .then((r) => {\n return r.buffer();\n })\n .then((buf) => {\n fs.writeFile(destination, buf, 'binary', function (err) {\n if (err) {\n console.error('Error saving snapshot to disk', err);\n } else {\n console.info('Snapshot saved');\n }\n });\n });\n }", "function createDatasetIfNotExists() {\n [projectId, datasetId] = getConfiguration();\n\n try {\n BigQuery.Datasets.get(projectId, datasetId);\n } catch (e) {\n Logger.log('Dataset does not exist. Creating new dataset with ID: ' +\n datasetId);\n const dataset = BigQuery.newDataset();\n const reference = BigQuery.newDatasetReference();\n reference.datasetId = datasetId;\n dataset.datasetReference = reference;\n BigQuery.Datasets.insert(dataset, projectId);\n }\n return datasetId;\n}", "function cleanSnapshots(ds, base, num) {\n zfs.list({ type: 'snapshot' }, function (err, snaps) {\n // Find all snapshots that match the specified dataset and base.\n var ourSnaps = snaps.filter(function (s) {\n var fields = s.name.split('@');\n var parts = fields[1].split('-');\n return fields[0] === ds && parts[0] === base;\n });\n\n if (ourSnaps.length > num) {\n // Get just the sorted list of names.\n var snapNames = ourSnaps.map(function (s) { return s.name; });\n snapNames.sort();\n\n // Get the ones that exceed the specified number of snapshots.\n var toDestroy = snapNames.slice(0, snapNames.length - num);\n\n // Destroy them, one after the other.\n async.forEachSeries(toDestroy, function (sn, cb) {\n util.log('Destroy snapshot ' + sn + ' (cleaned)');\n zfs.destroy({ name: sn, recursive: true }, cb);\n });\n }\n });\n}", "function createProductsFromScratch() {\n for (let i = 0; i < productNames.length; i++) {\n const productName = productNames[i];\n new Picture(productName, './img/' + productName + '.jpg');\n }\n}", "function restore(opts) {\n let rds = new AWS.RDS({region: opts.region});\n latestSnapshot(rds, opts.name)\n .then(restoreSnapshot(rds, opts), die)\n .then(waitForInstance(rds, opts), die)\n .then(addSecurityGroups(rds, opts), die)\n .then(waitForInstance(rds, opts), die)\n .then(writeJson, die);\n}", "async function getSnapshot(filename) {\n return new Promise((resolve, reject) => {\n console.log(\"trying to open \" + filename);\n fs.readFile(SNAPSHOT_DIR + filename, function(err, item) {\n if (err) {\n reject(err);\n return\n }\n var snapshot = JSON.parse(item);\n console.log(\"Here's the old snapshot\")\n console.log(snapshot);\n resolve(snapshot);\n });\n });\n}", "function snapshot() {\n var ctx = canvas.getContext('2d');\n var feed = liveFeed.getContext('2d');\n imageData = feed.getImageData(0, 0, 224, 224);\n ctx.putImageData(imageData,0,0);\n}", "function addData(d_, i_) {\n plan_data.datasets[i_].data = d_;\n if (count === 2) { //only create graph if 3 datasets have been filled\n createGraph();\n } else {\n count += 1;\n }\n\n }", "function DatabaseDataset() {\n // call super\n BaseDataset.call(this);\n\n var dset = this.dset,\n priv = this.privates;\n\n dset.type = function() {\n return 'database';\n };\n\n dset.state = function() {\n return _.extend(priv.state(), {\n type: dset.type()\n });\n };\n\n // 'variables' is a list\n dset.getVariables = function(variables, config) {\n var defer = $q.defer(),\n configDefined = !_.isUndefined(config);\n\n var samplesEmpty = _.isEmpty(priv.samples),\n currentVariables = dset.variables(),\n intersection = lodashEq.intersection(currentVariables, variables),\n newVariables = lodashEq.difference(variables, intersection);\n\n if (samplesEmpty) {\n // get all variables\n priv.getVariables(variables, config, defer, dset.name());\n } else if (_.isEmpty(newVariables)) {\n // nothing to done, everything already fetched\n defer.resolve(priv.getResult(newVariables, config, false));\n } else {\n // fetch new variables\n priv.getVariables(newVariables, config, defer, dset.name());\n }\n return defer.promise;\n };\n\n return dset;\n }", "function buildHDCASave( _super ){\n return function _save( attributes, options ){\n if( this.isNew() ){\n options = options || {};\n options.url = this.urlRoot + this.get( 'history_id' ) + '/contents';\n attributes = attributes || {};\n attributes.type = 'dataset_collection';\n }\n return _super.call( this, attributes, options );\n };\n}", "addGesture(name, data, dataset) {\n let points = convert(data, dataset);\n this.PointClouds[this.PointClouds.length] = new PointCloud(name, points);\n var num = 0;\n for (var i = 0; i < this.PointClouds.length; i++) {\n if (this.PointClouds[i].Name == name) num++;\n }\n return num;\n }", "function setData(node, name, value) {\r\n var id = node[exp] || (node[exp] = ++$.uuid),\r\n store = data[id] || (data[id] = attributeData(node))\r\n if (name !== undefined) store[camelize(name)] = value\r\n return store\r\n }", "function restoreNames(student) {\n\t\n\t// get all .student>figure>figcaption elements\n\t// set all to 1 opacity\n\t\n\t$(\".student\").find(\"figcaption\").stop().animate({opacity: 1}, 200);\n\t\n\t// if we're hovering off of a particular student\n\tif (student) {\n\t\tvar studentName = student[0].getAttribute('data-name');\n\t\tstudent.find('figcaption')[0].innerHTML = studentName;\n\t}\n\t\n}", "function addDataSetEntry(id, name, sharing) {\n dom('#datasetstable').innerHTML += `\n <tr>\n <td>${name}</td>\n <td>\n <div class=\"dropdown\">\n <button class=\"btn btn-outline-primary dropdown-toggle\" type=\"button\" id=\"a${id}\" data-bs-toggle=\"dropdown\" aria-expanded=\"false\">\n ${sharing}\n </button>\n <ul class=\"dropdown-menu\" aria-labelledby=\"a${id}\">\n <li><a class=\"dropdown-item\" data-mutate=\"a${id}\">Private</a></li>\n <li><a class=\"dropdown-item\" data-mutate=\"a${id}\">View Only</a></li>\n <li><a class=\"dropdown-item\" data-mutate=\"a${id}\">Edit</a></li>\n </ul>\n </div>\n </td>\n </tr>`\n}", "function createData(avatar, name, _id) { return { avatar, name, _id }; }", "function storageData(name, data) {\n \n localStorage.setItem(name, JSON.stringify(data));\n \n}", "function ScreenshotRawdata(){\nimagename = \"RawData.png\"\n\n\twebshot1(\"https://thegreatleadr.github.io/Github_Module/GitHub_FOLDER_RAWDATA/\", imagename, optionsRaw, (err) => {\n\tif(err){\n\t return console.log(err);\n\t}\n\t console.log(\"RawData succesfully created\");\n\t});\n}", "function setData(data, directory = \"\") {\n database.ref(\"groups/\" + localStorage.getItem(\"groupKey\") + \"/\" + directory).set(data);\n}", "function setData(node, name, value) {\r\n var id = node[exp] || (node[exp] = ++$.uuid),\r\n store = data[id] || (data[id] = attributeData(node))\r\n if (name !== undefined) store[camelize(name)] = value\r\n return store\r\n }", "function cloneAssetCategory(catName) {\n let temp = document.getElementById(\"temp_asset_cat\");\n let clone = document.importNode(temp.content, true);\n catTitle = clone.querySelector('h3')\n catTitle.innerHTML = catName\n catTitle.addEventListener('click', e => {\n console.log(e.target.childNodes)\n })\n catContainer = clone.querySelector('div')\n catContainer.id = `ac_${catName}`\n if(catName == \"Texture\") {\n catContainer.dataset.atype = 'texture'\n } else {\n catContainer.dataset.atype = 'stamp'\n } \n return clone\n }", "function take_snapshot() {\n Webcam.snap(function(data_uri){\n document.getElementById(\"result\").innerHTML = \"<img id='snap' src='\" + data_uri + \"'>\";\n });\n}", "function takeSnapshot() {\n var img = document.createElement('img');\n var context;\n var width = video.offsetWidth\n , height = video.offsetHeight;\n canvas = document.getElementById('face_1');\n canvas.width = width;\n canvas.height = height;\n context = canvas.getContext('2d');\n context.drawImage(video, 0, 0, width, height);\n img.src = canvas.toDataURL('image/png');\n $(\"#face_snapshot\").attr(\"src\", img.src);\n return img;\n }", "static async create(name) {\n\n const newRevisionIndex = (await this.getLatestRevisionIndex()) + 1\n const newRevision = new this({\n _id: newRevisionIndex,\n name: name || `Revision started on ${(new Date()).toLocaleString()}`,\n })\n \n await newRevision.save()\n setLatestRevisionIndex(await this.getLatestRevisionIndex())\n return newRevision\n\n }", "function pathToData(path, dataset, name) {\n\n //promise for this subtree will be returned\n var deferred = q.defer();\n\n var pathStat = fs.lstatSync(path);\n // if it's a directory, we need to create a new place for it and\n // read subitems \n\n if (pathStat.isDirectory()) {\n //create new place for item\n var subtree = dataset;\n if (typeof name !== 'undefined') {\n subtree = dataset[name] = {};\n }\n\n //read sub items\n fs.readdir(path, function(err, items) {\n var promises = [];\n items.forEach(function(item) {\n //recursively read this subtree\n promises.push(pathToData(path + \"/\" + item, subtree, item));\n });\n\n //when all promises are done, resolve the deferred.\n q.allSettled(promises).then(function() {\n deferred.resolve();\n });\n });\n }\n\n //if it's a file, read and extend\n else if (pathStat.isFile() && getExtension(path) === \".json\") {\n var promise = readJSON(path);\n promise.done(function(content) {\n colog.warning(\" File \" + path + \" read!\");\n dataset = _.extend(dataset, content);\n deferred.resolve();\n });\n } else {\n return true;\n }\n\n //return promise for this subtree\n return deferred.promise;\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 }", "withSnapshot(snapshot) {\n return new PageBlobClient(setURLParameter(this.url, URLConstants.Parameters.SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline);\n }", "withSnapshot(snapshot) {\n return new PageBlobClient(setURLParameter(this.url, URLConstants.Parameters.SNAPSHOT, snapshot.length === 0 ? undefined : snapshot), this.pipeline);\n }", "changeBlobName(oldName, newName) {\n // Edge Cases\n if (oldName === newName) {\n log(\"Same name.\")\n return null\n }\n // Get the Blob\n const blob = this.getBlob(oldName)\n if (blob === null) {\n log(\"Blob not found.\")\n return null;\n }\n // Check if name is unique\n if (this.getBlob(newName) !== null) {\n log(\"Name already exists.\")\n return null\n }\n // Set the new Name\n blob.name = newName;\n log(\"Name Changed.\")\n return blob\n }", "createDB(name) {\r\n var res = data.readJson('db/mainconfig.json');\r\n console.log(res);\r\n\r\n if (this.nameExists(name, res) != 1) {\r\n res.count++;\r\n res.dbnames.push(name);\r\n _makeDB(name);\r\n }\r\n else {\r\n console.log(\"same name\");\r\n return 0;\r\n\r\n }\r\n\r\n\r\n console.log(res);\r\n console.log(data.updateJson('db/mainconfig.json', res));\r\n }", "function pushToArrays(name) {\n const newObject = Object.create(nameObject);\n newObject.splitName(name);\n const randomHouse = Object.keys(houses)[\n Math.floor(Math.random() * Object.keys(houses).length)\n ];\n\n newObject.house = randomHouse;\n students.push(newObject);\n}", "function handleSnapshots(err, data) {\n if (err) {\n console.error(err);\n } else {\n console.log('Looking for old snapshots to delete/expire, if any...');\n // browse through snapshots...\n for (let i = 0; i < data.relationalDatabaseSnapshots.length; i++) {\n const snapshotName = data.relationalDatabaseSnapshots[i].name;\n const snapshotDatabaseName = data.relationalDatabaseSnapshots[i].fromRelationalDatabaseName;\n if (\n (snapshotDatabaseName === databaseName) && // match this database\n (snapshotName.startsWith(`${prefix}-auto-`)) // only match automated snapshots\n ) {\n let keepSnapshot = false;\n const snapshotDate = new Date(data.relationalDatabaseSnapshots[i].createdAt);\n const snapshotDaysAgo = Math.floor((NOW - snapshotDate) / oneDAY);\n const snapshotWeeksAgo = Math.floor((NOW - snapshotDate) / (oneDAY * 7));\n const snapshotMonthsAgo = Math.floor((NOW - snapshotDate) / (oneDAY * 30));\n if (snapshotDaysAgo <= backupDaysMax) {\n keepSnapshot = true;\n } else if (snapshotWeeksAgo <= backupWeeksMax && snapshotDate.getDay() === 0) {\n keepSnapshot = true;\n } else if (snapshotMonthsAgo <= backupMonthsMax && snapshotDate.getDate() === 0) {\n keepSnapshot = true;\n }\n if (keepSnapshot) {\n console.log(`Keeping ${snapshotName}`);\n } else {\n console.log(`Deleting ${snapshotName}`);\n Lightsail.deleteRelationalDatabaseSnapshot({\n 'relationalDatabaseSnapshotName': snapshotName\n }, function (err2, data2) {\n if (err2) {\n console.error(err2);\n } else {\n console.log(`Deleted ${snapshotName}`);\n console.log(data2);\n }\n });\n }\n }\n }\n // pagenate and use recursion (for when we have lots of snapshots)\n if (typeof data.nextPageToken != 'undefined') {\n console.log('Recursing to next page (old snapshots)...');\n Lightsail.getRelationalDatabaseSnapshots({\n pageToken: data.nextPageToken\n }, handleSnapshots);\n }\n }\n }", "function getDataset(aDataSetCollector){\n\t\t\t//The increase the number of datasets that we are retriving\n\t\t\t//This is used to only render the collage when all groups have been loaded\n\t\t\tservice.datasetCount ++;\n\n\n\t\t\tckConsole.getGroup(aDataSetCollector.dataName).then(\n\t\t\t\t//Asynchronys method\n\t\t\t\t//This method doesn't run until the data has loaded (this can take quite a while)\n\t\t\t\tfunction(inputData){\n\t\t\t\t\tconsole.log('Loading: ' + aDataSetCollector.dataName);\n\t\t\t\t\ttry{\n\t\t\t\t\t\taDataSetCollector.inputParser(inputData);\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tservice.totalDatasetLoaded ++;\n\t\t\t\t\t}\n\t\t\t\t\tconsole.log(service.artifacts);\n\t\t\t\t});\n\t\t}", "function createDataVis_01(id) {\n\tvar selector = \"#vis-\" + id;\n\n\tvar selectorWidth = $(selector).outerWidth();\n\tvar selectorHeight = 200;\n\tvar svgData = createSvgEl(selector, selectorWidth, selectorHeight, id);\n\tvar dataset = createRandomDataset(50);\n\tvar scaleData = setScaleData(dataset, svgData);\n\tvar dataElements = enterDataElements(svgData, \"rect\", dataset, scaleData);\n}", "function writeTrailSummary(name, location, notes, image) {\n\tfirebase.database().ref('trails-database').child('trails').push().set({\n\t\tname: name,\n\t\tplace: location,\n\t\tnotes: notes,\n\t\timage: image\n\t});\n}", "function benchmarkShareWithGroup(benchmarkName: string, groupId: string) {\n benchmark(benchmarkName, async (state) => {\n const tanker = makeTanker(benchmarkAppId);\n const identity = await createIdentity(benchmarkAppId, benchmarkAppSecret, Math.random().toString());\n await tanker.start(identity);\n const verificationKey = await tanker.generateVerificationKey();\n await tanker.registerIdentity({ verificationKey });\n\n while (state.iter()) {\n state.pause();\n const encryptedData = await tanker.encrypt('make some noise');\n const resourceId = await tanker.getResourceId(encryptedData);\n state.unpause();\n\n await tanker.share([resourceId], { shareWithGroups: [groupId] });\n }\n\n await tanker.stop();\n });\n}", "createCopy() {\n let copy = new SketchLayer();\n if (this.name) {\n copy.name = this.name;\n }\n if (this.uniqueIdentifier) {\n copy.uniqueIdentifier = this.uniqueIdentifier;\n }\n if (this.objects) {\n copy.objects = [];\n for (let i = 0; i < this.objects.length; i++) {\n let child = this.objects[i].createCopy();\n copy.objects.push(child);\n }\n }\n if (this.visible) {\n copy.visible = this.visible;\n }\n return copy;\n }" ]
[ "0.57099885", "0.49952084", "0.49173602", "0.4823329", "0.48050103", "0.47906417", "0.47362155", "0.47198105", "0.46961048", "0.46948686", "0.4675691", "0.46605006", "0.4631633", "0.46235973", "0.46117425", "0.4595298", "0.45672947", "0.4545511", "0.45219707", "0.4511676", "0.45020017", "0.45020017", "0.44992778", "0.44965142", "0.44965142", "0.44883284", "0.44819725", "0.4470766", "0.44691095", "0.4460561", "0.44524795", "0.44475195", "0.44134477", "0.43972498", "0.43894884", "0.43652722", "0.43432015", "0.4341625", "0.43373868", "0.43306333", "0.43244183", "0.43030548", "0.42895064", "0.42837918", "0.42552704", "0.42457387", "0.42104498", "0.42033744", "0.41987985", "0.4198047", "0.4197103", "0.41833267", "0.41690052", "0.4156568", "0.41541043", "0.41541043", "0.41541043", "0.41541043", "0.41541043", "0.41541043", "0.41541043", "0.41541043", "0.41541043", "0.41475725", "0.4146824", "0.41440603", "0.4136979", "0.41356072", "0.41344798", "0.41266602", "0.41249573", "0.4122736", "0.41205242", "0.4100824", "0.40985954", "0.40968367", "0.40945736", "0.40900296", "0.40900263", "0.40875235", "0.4086281", "0.40862784", "0.40820113", "0.40751556", "0.4065672", "0.40631458", "0.40618834", "0.40588146", "0.40541855", "0.40533873", "0.40533873", "0.4050894", "0.4050722", "0.40438926", "0.40400228", "0.40284693", "0.4025441", "0.4022095", "0.40185818", "0.40125647" ]
0.5674466
1
Keep only num snapshots with the specified base on the specified dataset
function cleanSnapshots(ds, base, num) { zfs.list({ type: 'snapshot' }, function (err, snaps) { // Find all snapshots that match the specified dataset and base. var ourSnaps = snaps.filter(function (s) { var fields = s.name.split('@'); var parts = fields[1].split('-'); return fields[0] === ds && parts[0] === base; }); if (ourSnaps.length > num) { // Get just the sorted list of names. var snapNames = ourSnaps.map(function (s) { return s.name; }); snapNames.sort(); // Get the ones that exceed the specified number of snapshots. var toDestroy = snapNames.slice(0, snapNames.length - num); // Destroy them, one after the other. async.forEachSeries(toDestroy, function (sn, cb) { util.log('Destroy snapshot ' + sn + ' (cleaned)'); zfs.destroy({ name: sn, recursive: true }, cb); }); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pruneAggregated() {\n return Sample.destroy({\n where: { aggregated: false },\n }).then(count => {\n console.log('Pruned %d pre-aggregation samples', count);\n });\n}", "function filterData(dataset) {\n dList = [];\n \n for (i=0; i < dataset.otu_ids.length; i++) { \n // console.log(`ROw${i}]: ${results.otu_ids[i]}, ${results.sample_values[i]}, ${results.otu_labels[i]}`) ;\n dict = {};\n dict[\"otu_ids\"] = dataset.otu_ids[i];\n dict[\"smpl_values\"] = dataset.sample_values[i];\n dict[\"otu_labels\"] = dataset.otu_labels[i];\n dList.push(dict);\n }\n // console.log(dList);\n\n // Sort by sample_values\n dList.sort(function(a, b) {\n return parseFloat(b.smpl_values) - parseFloat(a.smpl_values);\n });\n\n // Slice the first 10 objects for plotting\n results = dList.slice(0, 10);\n\n return results;\n}", "queryAllFilterLatestData(callback) {\n this.collection.find({}).project({_id: 0, data: {$slice: -1}})\n .toArray(callback);\n }", "function limitToFive(dataSet){\n let newArray = dataSet.sort((countA, countB) => (countA.count < countB.count ? 1 : -1));\nreturn newArray.slice(0, 5);\n}", "limitData(data) {\n if (this.metricsLimit === 0) { // we dont want to limit at all\n return data;\n }\n\n let currentSize = Object.keys(this.uniqMetrics).length;\n\n return data.filter((metric) => {\n const metricName = metric.MetricName;\n\n if (this.uniqMetrics[metricName]) {\n return true;\n }\n\n if (currentSize >= this.metricsLimit) {\n this.logger(`cloudwatch - ERROR - metrics limit reached - throwing away ${metricName}`);\n return false;\n }\n\n this.uniqMetrics[metricName] = true;\n currentSize += 1;\n return true;\n });\n }", "async filterAlreadyScraped(){\n //Get the existing reports' URIs\n const countStatement = this.db.prepare( `SELECT uri FROM data WHERE uri IN (${this.reportsURLs.map(() => '?').join(',')})`, this.reportsURLs )\n const asyncAll = promisify(countStatement.all).bind(countStatement)\n const alreadyInDb = (await asyncAll()).map((row) => row.uri)\n countStatement.finalize()\n\n //Filter out the existing reports\n this.reportsURLs = this.reportsURLs.filter((uri) => !alreadyInDb.includes( uri ))\n //Update the count\n this.howManyAlreadyScraped += alreadyInDb.length\n }", "function distill_analytics(table, filter) {\n\tswitch (filter) {\n\t\tcase \"all\":\n\t\t\t// Don't filter the checkins.\n\t\t\tvar grouped = google.visualization.data.group(table, [0], [Analytics.count_column]);\n\t\t\treturn [grouped, grouped.getSortedRows([{ column: 1, desc: true }]).slice(0,5)];\n\t\t\tbreak;\n\t\tcase \"month\":\n\t\t\t// Filter the checkins by month.\n\t\t\tvar now = new Date();\n\t\t\tvar rows_filtered = table.getFilteredRows([\n\t\t\t\t{ column: 1, minValue: (new Date(now - milliseconds_in_month)), maxValue: now }\n\t\t\t]);\n\t\t\tvar view = new google.visualization.DataView(table);\n\t\t\tview.setRows(rows_filtered);\n\t\t\tvar grouped = google.visualization.data.group(view.toDataTable(), [0], [Analytics.count_column]);\n\t\t\treturn [grouped, grouped.getSortedRows([{ column: 1, desc: true }]).slice(0,5)];\n\t\t\tbreak;\n\t\tcase \"quarter\":\n\t\t\t// Filter the checkins by quarter.\n\t\t\tvar now = new Date();\n\t\t\tvar rows_filtered = table.getFilteredRows([\n\t\t\t\t{ column: 1, minValue: (new Date(now - (milliseconds_in_month * 3))), maxValue: now }\n\t\t\t]);\n\t\t\tvar view = new google.visualization.DataView(table);\n\t\t\tview.setRows(rows_filtered);\n\t\t\tvar grouped = google.visualization.data.group(view.toDataTable(), [0], [Analytics.count_column]);\n\t\t\treturn [grouped, grouped.getSortedRows([{ column: 1, desc: true }]).slice(0,5)];\n\t\t\tbreak;\n\t\tcase \"half\":\n\t\t\t// Filter the checkins by half.\n\t\t\tvar now = new Date();\n\t\t\tvar rows_filtered = table.getFilteredRows([\n\t\t\t\t{ column: 1, minValue: (new Date(now - (milliseconds_in_month * 6))), maxValue: now }\n\t\t\t]);\n\t\t\tvar view = new google.visualization.DataView(table);\n\t\t\tview.setRows(rows_filtered);\n\t\t\tvar grouped = google.visualization.data.group(view.toDataTable(), [0], [Analytics.count_column]);\n\t\t\treturn [grouped, grouped.getSortedRows([{ column: 1, desc: true }]).slice(0,5)];\n\t\t\tbreak;\n\t\tcase \"year\":\n\t\t\t// Filter the checkins by year.\n\t\t\tvar now = new Date();\n\t\t\tvar rows_filtered = table.getFilteredRows([\n\t\t\t\t{ column: 1, minValue: (new Date(now - milliseconds_in_year)), maxValue: now }\n\t\t\t]);\n\t\t\tvar view = new google.visualization.DataView(table);\n\t\t\tview.setRows(rows_filtered);\n\t\t\tvar grouped = google.visualization.data.group(view.toDataTable(), [0], [Analytics.count_column]);\n\t\t\treturn [grouped, grouped.getSortedRows([{ column: 1, desc: true }]).slice(0,5)];\n\t\t\tbreak;\n\t}\n}", "function selectBarData(dataset, startDate, endDate, grp) {\n var ds = {};\n var date;\n var totalViews = 0;\n var totalVisits = 0;\n barGroup = grp;\n for (entry in dataset) {\n date = new Date(Date.parse(dataset[entry].key));\n if (date >= startDate && date <= endDate) {\n var appData = d3.entries(dataset[entry].value[barGroup]);\n for (app in appData) { \n if (ds[appData[app].key] === undefined) {\n ds[appData[app].key] = {};\n ds[appData[app].key]['views'] = appData[app].value.views;\n ds[appData[app].key]['visits'] = appData[app].value.visits;\n } else {\n ds[appData[app].key]['views'] += appData[app].value.views;\n ds[appData[app].key]['visits'] += appData[app].value.visits;\n }\n totalViews += appData[app].value.views;\n totalVisits += appData[app].value.visits;\n }\n }\n }\n return { data: ds, tvw: totalViews, tvs: totalVisits };\n}", "function getDataSubset() {\n const calculations = [{\n value: thirdParameter,\n method: \"Average\",\n },\n {\n value: \"Height\",\n method: \"Min\",\n },\n {\n value: \"Height\",\n method: \"Max\",\n },\n {\n value: \"Weight\",\n method: \"Min\",\n },\n {\n value: \"Weight\",\n method: \"Max\",\n },\n {\n value: \"Age\",\n method: \"Min\",\n },\n {\n value: \"Age\",\n method: \"Max\",\n },\n ];\n return gmynd.cumulateData(segmentedAthletes, [\"Sex\", ...currentFilters], calculations);\n}", "function removeData() {\n\t var newIndex = crossfilter_index(n, n),\n\t removed = [];\n\t for (var i = 0, j = 0; i < n; ++i) {\n\t if (filters[i]) newIndex[i] = j++;\n\t else removed.push(i);\n\t }\n\n\t // Remove all matching records from groups.\n\t filterListeners.forEach(function(l) { l(0, [], removed); });\n\n\t // Update indexes.\n\t removeDataListeners.forEach(function(l) { l(newIndex); });\n\n\t // Remove old filters and data by overwriting.\n\t for (var i = 0, j = 0, k; i < n; ++i) {\n\t if (k = filters[i]) {\n\t if (i !== j) filters[j] = k, data[j] = data[i];\n\t ++j;\n\t }\n\t }\n\t data.length = j;\n\t while (n > j) filters[--n] = 0;\n\t }", "function clearProceedingSnapshots(snapshots) {\n if (canMoveCurrentSnapshot_1.default(snapshots, 1)) {\n var removedSize = 0;\n for (var i = snapshots.currentIndex + 1; i < snapshots.snapshots.length; i++) {\n removedSize += snapshots.snapshots[i].length;\n }\n snapshots.snapshots.splice(snapshots.currentIndex + 1);\n snapshots.totalSize -= removedSize;\n }\n}", "function checkMatches(drawData) {\n const { winningNumbers, drawedSets} = drawData;\n //const numAmount = winningNumbers.size;\n for (set of drawedSets) {\n set.match = 0;\n for (let num of set.numbers) {\n if (winningNumbers.includes(num)) {\n set.match++;\n }\n }\n }\n //console.log(winningNumbers, drawedSets);\n}", "function splitVideoIdsIntoSets() {\n var tmpArray = [];\n // grab the first 100 as a new array, push into sets array\n tmpArray = videoIds.splice(0, 100);\n videoIdSets.push(tmpArray);\n // function recalls itself until videoIds array is empty\n if (videoIds.length > 0) {\n splitVideoIdsIntoSets();\n } else {\n return;\n }\n }", "function sort_data(datasets, schem) {\n var cut_data = $scope.summary_rows;\n var number_of_cuts = schem.cuts.length;\n var lumberSizes = $scope.lumberSizes;\n for (var a = 0; a < lumberSizes.length; a++) {\n for (var i = 0; i < number_of_cuts; i++) {\n if (cut_data[i][0].includes(lumberSizes[a])) {\n datasets.push(cut_data[i]);\n }\n }\n }\n }", "function filterStreams() {\n let filteredStreams = [];\n for (let i = 0; i < globalSetIndex.length; i++) {\n if (globalSetIndex[i].isFoV.FoV) {\n filteredStreams.push({\n index: i,\n id: globalSetIndex[i].id\n });\n }\n }\n return filteredStreams;\n}", "function perform5minAggregatBC2(siteId, startEpoch, endEpoch) {\n // create temp collection as placeholder for aggreagation results\n const aggrResultsName = `aggr${moment().valueOf()}`;\n const AggrResults = new Meteor.Collection(aggrResultsName);\n\n // gather all data, group by 5min epoch\n const pipeline = [\n {\n $match: {\n $and: [\n {\n epoch: {\n $gt: parseInt(startEpoch, 10),\n $lt: parseInt(endEpoch, 10)\n }\n }, {\n site: siteId\n }\n ]\n }\n }, {\n $sort: {\n epoch: 1\n }\n }, {\n $project: {\n epoch5min: 1,\n epoch: 1,\n site: 1,\n subTypes: 1\n }\n }, {\n $group: {\n _id: '$epoch5min',\n site: {\n $last: '$site'\n },\n subTypes: {\n $push: '$subTypes'\n }\n }\n }, {\n $out: aggrResultsName\n }\n ];\n\n Promise.await(LiveData.rawCollection().aggregate(pipeline, { allowDiskUse: true }).toArray());\n\n /*\n * Only aggregate data if a certain percentage (defined by thresholdPercent) of the required data is in the 5minepoch.\n * There is supposed to be 630 database documents per 5minepoch.\n *\n * 30 documents for DAQFactory, 300 documents for TAP01, and 300 documents for TAP02.\n * Eventually we'll just pull how many datapoints are expected from the database. This will work for now\n *\n * Take for example if thresholdPercent were .75.\n *\n * There would need to be:\n * 30 * .75 = 22.5 \n * round(22.5) = 23 documents for DAQFactory required\n *\n * 300 * .75 = 225\n * 225 documents for TAP01 and TAP02 are required\n *\n * ONE EXCEPTION:\n * aggregate regardless of missing data if it is 55 min from the startEpoch\n *\n * Also, left these outside the loop because unnecessary calculations slow the loop down. \n * Additionally, we will be querying for this data rather than relying on hardcoded numbers later on.\n * Querying a database is slow. The less of those we do, the better.\n */\n\n const thresholdPercent = .75;\n // Hard coded numbers. Should not be hardcoded but oh well. Should be changed in the future.\n const maxDAQFactoryCount = 30, maxTAPCount = 300;\n const minDAQFactoryCount = Math.round(thresholdPercent * maxDAQFactoryCount);\n const minTAPcount = Math.round(thresholdPercent * maxTAPCount);\n\n // tap switch variables ***MUST*** be viable over iterations of the foreach loop\n // 8 is offline. Assume offline unless specified otherwise in TAP switch implementation\n var TAP01Flag = 8, TAP02Flag = 8;\n var TAP01Epoch = 0, TAP02Epoch = 0;\n\n // For some god aweful reason, some sites don't have neph flags. Need to check for neph flag before assigning whatever\n let hasNephFlag = false;\n\n // Tap data filtration is required. These variables are simply placeholders for where the rgb abs coef indeces and sampleFlow index is at.\n // ***MUST*** be viable over for loop\n let hasCheckedTAPdataSchema = false;\n let tapDataSchemaIndex = {};\n tapDataSchemaIndex.RedAbsCoef = undefined, tapDataSchemaIndex.GreenAbsCoef = undefined, tapDataSchemaIndex.BlueAbsCoef = undefined, tapDataSchemaIndex.SampleFlow = undefined;\n let TAP01Name = undefined;\n let TAP02Name = undefined;\n const allElementsEqual = arr => arr.every(v => v === arr[0]);\n\n AggrResults.find({}).forEach((e) => {\n const subObj = {};\n subObj._id = `${e.site}_${e._id}`;\n subObj.site = e.site;\n subObj.epoch = e._id;\n const subTypes = e.subTypes;\n const aggrSubTypes = {}; // hold aggregated data\n let newData = (endEpoch - 3300 - subObj.epoch) < 0;\n\n let subTypesLength = subTypes.length\n for (let i = 0; i < subTypesLength; i++) {\n for (const subType in subTypes[i]) {\n if (subTypes[i].hasOwnProperty(subType)) {\n const data = subTypes[i][subType];\n let numValid = 1;\n var newkey;\n\n // if Neph flag is undefined, flag it 1, otherwise ignore\n if (subType.includes(\"Neph\")) {\n if (data[0].metric === 'Flag') {\n hasNephFlag = true;\n }\n if (!hasNephFlag) {\n data.unshift({ metric: 'Flag', val: 1, unit: 'NA' });\n }\n }\n\n\n /** Tap flag implementation **/\n // Get flag from DAQ data and save it\n if (subType.includes('TAP01')) {\n TAP01Flag = data[0].val === 10 ? 1 : data[0].val;\n TAP01Epoch = subObj.epoch;\n } else if (subType.includes('TAP02')) {\n TAP02Flag = data[0].val === 10 ? 8 : data[0].val\n TAP02Epoch = subObj.epoch;\n }\n\n // Get flag from TAP0(1|2)Flag and give it to the appropriate instrument\n if (subType.includes('tap_')) {\n\n // TAP01 = even\n // TAP02 = odd\n // confusing amirite!?\n // EXAMPLE:\n // tap_SN36 <- even goes to TAP01\n // tap_SN37 <- odd goes to TAP02\n // This is parsing tap_* string for integer id\n var subTypeName = subType;\n let epochDiff;\n do {\n subTypeName = subTypeName.slice(1);\n } while (isNaN(subTypeName));\n let subTypeNum = subTypeName;\n if (parseInt(subTypeNum) % 2 === 0) {\n // Even - Needs flag from TAP01\n // Make sure that tap data has a corresponding timestamp in DaqFactory file\n // If not, break and do not aggregate datapoint\n epochDiff = subObj.epoch - TAP01Epoch;\n\n if (epochDiff >= 0 && epochDiff < 10) {\n data[0].val = TAP01Flag;\n } else {\n data[0].val = 20;\n }\n } else {\n // Odd - Needs flag from TAP02\n // Make sure that tap data has a corresponding timestamp in DaqFactory file\n // If not, break and do not aggregate datapoint\n epochDiff = subObj.epoch - TAP02Epoch;\n if (epochDiff >= 0 && epochDiff < 10) {\n data[0].val = TAP02Flag;\n } else {\n data[0].val = 20;\n }\n }\n\n /** Data filtration start **/\n\n /* Reason for data filtration to be inside this subType.includes is for performance reasons. The less if statements ran, the faster.\n */\n\n /* Matlab code\n * Some data filtration is required. We will not aggregate datapoints (not records) that do not fit our standards.\n * To Note: Comments in matlab are my own comments\n\n % Do not aggregate data point if r, g, b is < 0 or > 100 \n r1=numa(:,7);\n g1=numa(:,8);\n b1=numa(:,9);\n r2(r2 < 0 | r2 > 100) = NaN;\n g2(g2 < 0 | g2 > 100) = NaN;\n b2(b2 < 0 | b2 > 100) = NaN;\n\n\n %TAP_02data defined here\n TAP_02data = [JD2 time2 A_spot2 R_spot2 flow2 r2 g2 b2 Tr2 Tg2 Tb2];\n\n % Don't aggregate data point if SampleFlow / Flow(L/min) is off 5% from 1.7 Min: 1.615, Max: 1.785\n idx = find(TAP_02data (:,5) <1.63 | TAP_02data (:,5) >1.05*1.7); %condition if flow is 5% off 1.7lpm\n TAP_02data(idx,5:8) = NaN; clear idx time2 A_spot2 R_spot2 flow2 r2 g2 b2 Tr2 Tg2 Tb2\n\n\n % This is for the TAP switching. It was a way to get the TAP switching working in the matlab script.\n % Don't aggregate the first 100s after a switch has occured. Let instrument recalibrate. \n R01 = strfind(isnan(TAP_02data(:,5)).', [1 0]); % Find Indices Of [0 1] Transitions\n for i=1:100\n TAP_02data(R01+i,6:8) = NaN; % Replace Appropriate Values With 'NaN '\n end\n\n\n 20 = potentially invalid data\n 1 = valid data\n */\n\n // Reason for if statement is to speed the code up alot. \n // Having to check for the schema every run is VERY significant.\n // Only having to do it once and assuming the rest will be the same is a very safe assumption.\n // If this isn't true, then lord help us all\n if (!hasCheckedTAPdataSchema) {\n let dataLength = data.length;\n for (let k = 0; k < dataLength; k++) {\n if (data[k].metric === 'RedAbsCoef') {\n tapDataSchemaIndex.RedAbsCoef = k;\n }\n if (data[k].metric === 'GreenAbsCoef') {\n tapDataSchemaIndex.GreenAbsCoef = k;\n }\n if (data[k].metric === 'BlueAbsCoef') {\n tapDataSchemaIndex.BlueAbsCoef = k;\n }\n if (data[k].metric === 'SampleFlow') {\n tapDataSchemaIndex.SampleFlow = k;\n }\n }\n hasCheckedTAPdataSchema = true;\n }\n\n // We flag the faulty data with flag 20.\n if (data[tapDataSchemaIndex.RedAbsCoef].val < 0 || data[tapDataSchemaIndex.RedAbsCoef].val > 100 || isNaN(data[tapDataSchemaIndex.RedAbsCoef].val)) {\n data[tapDataSchemaIndex.RedAbsCoef].Flag = 20;\n }\n\n if (data[tapDataSchemaIndex.GreenAbsCoef].val < 0 || data[tapDataSchemaIndex.GreenAbsCoef].val > 100 || isNaN(data[tapDataSchemaIndex.GreenAbsCoef].val)) {\n data[tapDataSchemaIndex.GreenAbsCoef].Flag = 20;\n }\n\n if (data[tapDataSchemaIndex.BlueAbsCoef].val < 0 || data[tapDataSchemaIndex.BlueAbsCoef].val > 100 || isNaN(data[tapDataSchemaIndex.BlueAbsCoef].val)) {\n data[tapDataSchemaIndex.BlueAbsCoef].Flag = 20;\n }\n\n if (data[tapDataSchemaIndex.SampleFlow].val < 1.615 || data[tapDataSchemaIndex.SampleFlow].val > 1.785 || isNaN(data[tapDataSchemaIndex.SampleFlow].val)) {\n data[tapDataSchemaIndex.SampleFlow].Flag = 20;\n }\n\n\n /** Data filtration finished **/ \n }\n\n /** End of TAP switch implementation **/\n\n // Don't aggregate TAP01 and TAP02 subtype. They are only useful for giving TAP_SNXX flags\n if (subTypes.includes(\"TAP01\") || subTypes.includes(\"TAP02\")) {\n continue;\n }\n\n\n // if flag is not existing, put 9 as default, need to ask Jim?\n if (data[0].val === '') {\n data[0].val = 9;\n }\n if (data[0].val !== 1) { // if flag is not 1 (valid) don't increase numValid\n numValid = 0;\n }\n for (let j = 1; j < data.length; j++) {\n newkey = subType + '_' + data[j].metric;\n\n // TAP data requires data filtration. Setting flag to 20 if such for specified values. \n // Otherwise, use suggested flag value from file\n const flag = data[j].Flag !== undefined ? data[j].Flag : data[0].val;\n\n if (flag !== 1) { // if flag is not 1 (valid) don't increase numValid\n numValid = 0;\n }\n\n if (!aggrSubTypes[newkey]) {\n if (numValid === 0) {\n data[j].val = 0;\n }\n\n aggrSubTypes[newkey] = {\n sum: Number(data[j].val),\n 'avg': Number(data[j].val),\n 'numValid': numValid,\n 'totalCounter': 1, // initial total counter\n 'flagstore': [flag], // store all incoming flags in case we need to evaluate\n unit: data[j].unit // use unit from first data point in aggregation\n };\n } else {\n if (numValid !== 0) { // keep aggregating only if numValid\n aggrSubTypes[newkey].numValid += numValid;\n aggrSubTypes[newkey].sum += Number(data[j].val); // holds sum until end\n if (aggrSubTypes[newkey].numValid !== 0) {\n aggrSubTypes[newkey].avg = aggrSubTypes[newkey].sum / aggrSubTypes[newkey].numValid;\n }\n }\n aggrSubTypes[newkey].totalCounter += 1; // increase counter\n aggrSubTypes[newkey].flagstore.push(flag); // /store incoming flag\n }\n numValid = 1; // reset numvalid\n }\n }\n }\n }\n\n // This is prep for calculations. Need ensure that we are working with data that has the data necessary to do calculations.\n // The for loop for transforming aggregated data to a generic data format is more useful for calculations than raw aggrSubTypes.\n // All I'm doing here is collecting a little bit of information of what we are working with before I do calculations.\n let hasTap = false;\n let hasNeph = false;\n // Don't have to do this with neph. Neph will always have the same name. Tap will always have different numbers\n let tapNames = [];\n\n // transform aggregated data to generic data format using subtypes etc.\n const newaggr = {};\n for (const aggr in aggrSubTypes) {\n if (aggrSubTypes.hasOwnProperty(aggr)) {\n const split = aggr.lastIndexOf('_');\n const instrument = aggr.substr(0, split);\n const measurement = aggr.substr(split + 1);\n\n if (!newaggr[instrument]) {\n newaggr[instrument] = {};\n }\n\n const obj = aggrSubTypes[aggr]; // makes it a little bit easier\n\n // dealing with flags\n if ((obj.numValid / obj.totalCounter) >= 0.75) {\n obj.Flag = 1; // valid\n } else {\n // find out which flag was majority\n const counts = {};\n for (let k = 0; k < obj.flagstore.length; k++) {\n counts[obj.flagstore[k]] = 1 + (counts[obj.flagstore[k]] || 0);\n }\n const maxObj = _.max(counts, function(obj) {\n return obj;\n });\n const majorityFlag = (_.invert(counts))[maxObj];\n obj.Flag = majorityFlag;\n }\n\n // Some specific setting up for tap calculations and skipping\n if (instrument.includes(\"Neph\")) {\n hasNeph = true;\n\n // If obj.totalCounter (which is documentation for the amount of datapoints in our 5minepoch) is < minTAPcount\n // And what we are aggregating is greater than 55 minutes from endEpoch: \n // SKIP \n if (obj.totalCounter < minDAQFactoryCount && newData) {\n // This forces the forEach loop to go to the next loop skipping pushing data into database\n return;\n }\n }\n\n if (instrument.includes(\"tap_\")) {\n hasTap = true;\n if (!tapNames.includes(instrument)) {\n tapNames.push(instrument);\n }\n\n if (obj.totalCounter < 300)\n // If obj.totalCounter (which is documentation for the amount of datapoints in our 5minepoch) is < minTAPcount\n // And what we are aggregating is greater than 55 minutes from endEpoch: \n // SKIP \n if (obj.totalCounter < minTAPcount && newData) {\n // This forces the forEach loop to go to the next loop skipping pushing data into database\n return;\n }\n }\n\n if (!newaggr[instrument][measurement]) { newaggr[instrument][measurement] = [];\n }\n\n // automatic flagging of aggregated values that are out of range for NO2 to be flagged with 9(N)\n if (instrument === '42i') {\n if (obj.avg < -0.5) {\n obj.Flag = 9;\n }\n }\n\n newaggr[instrument][measurement].push({ metric: 'sum', val: obj.sum });\n newaggr[instrument][measurement].push({ metric: 'avg', val: obj.avg });\n newaggr[instrument][measurement].push({ metric: 'numValid', val: obj.numValid });\n newaggr[instrument][measurement].push({ metric: 'unit', val: obj.unit });\n newaggr[instrument][measurement].push({ metric: 'Flag', val: obj.Flag });\n }\n }\n\n // If TAP or NEPH is missing AND what we are aggregating is greater than 55 minutes from endEpoch:\n // SKIP\n if ((tapNames.length < 2 || !hasNeph) && newData) {\n // This forces the forEach loop to go to the next loop skipping pushing data into database\n return; \n }\n\n /** Helpful functions for calculations **/\n\n // flips sign for all elements in array\n function flipSignForAll1D(arr) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] *= -1;\n }\n }\n\n // flips sign for all elements in 2D array\n function flipSignForAll2D(M) {\n for (let i = 0; i < M.length; i++) {\n flipSignForAll1D(M[i]);\n }\n }\n\n // returns row reduced echelon form of given matrix\n // if vector, return rref vector\n // if invalid, do nothing\n function rref(M) {\n let rows = M.length;\n let columns = M[0].length;\n if (((rows === 1 || rows === undefined) && columns > 0) || ((columns === 1 || columns === undefined) && rows > 0)) {\n M = [];\n let vectorSize = Math.max(isNaN(columns) ? 0 : columns, isNaN(rows) ? 0 : rows);\n for (let i = 0; i < vectorSize; i++) {\n M.push(0);\n }\n M[0] = 1;\n return M;\n } else if (rows < 0 || columns < 0) {\n return;\n }\n\n let lead = 0;\n for (let k = 0; k < rows; k++) {\n if (columns <= lead) {\n return;\n }\n\n let i = k;\n while (M[i][lead] === 0) {\n i++;\n if (rows === i) {\n i = k;\n lead++;\n if (columns === lead) { \n return;\n }\n }\n }\n let p = M[i]\n let s = M[k];\n M[i] = s, M[k] = p;\n\n let scalar = M[k][lead];\n for (let j = 0; j < columns; j++) {\n M[k][j] /= scalar;\n }\n\n for (let i = 0; i < rows; i++) {\n if (i === k) continue;\n scalar = M[i][lead];\n for (let j = 0; j < columns; j++) {\n M[i][j] -= scalar * M[k][j];\n }\n }\n lead++;\n }\n return M;\n }\n /** END of Helpful functions for calculations **/\n\n // Calculations for Nepholometer is done here\n if (hasNeph) {\n newaggr['Neph']['SAE'] = [];\n\n if (newaggr['Neph']['RedScattering'] === undefined || newaggr['Neph']['GreenScattering'] === undefined || newaggr['Neph']['BlueScattering'] === undefined) {\n newaggr['Neph']['SAE'].push({ metric: 'calc', val: 'NaN' });\n newaggr['Neph']['SAE'].push({ metric: 'unit', val: \"undefined\" });\n newaggr['Neph']['SAE'].push({ metric: 'Flag', val: 20});\n } else {\n\n let RedScatteringFlagIndex = 0;\n let RedScatteringAvgIndex = 0;\n for (let index = 0; index < newaggr['Neph']['RedScattering'].length; index++) {\n if (newaggr['Neph']['RedScattering'][index].metric === 'Flag') {\n RedScatteringFlagIndex = index;\n }\n if (newaggr['Neph']['RedScattering'][index].metric === 'avg') {\n RedScatteringAvgIndex = index;\n }\n }\n\n let GreenScatteringFlagIndex = 0;\n let GreenScatteringAvgIndex = 0;\n for (let index = 0; index < newaggr['Neph']['GreenScattering'].length; index++) {\n if (newaggr['Neph']['GreenScattering'][index].metric === 'Flag') {\n GreenScatteringFlagIndex = index;\n }\n if (newaggr['Neph']['GreenScattering'][index].metric === 'avg') {\n GreenScatteringAvgIndex = index;\n }\n }\n\n let BlueScatteringFlagIndex = 0;\n let BlueScatteringAvgIndex = 0;\n for (let index = 0; index < newaggr['Neph']['BlueScattering'].length; index++) {\n if (newaggr['Neph']['BlueScattering'][index].metric === 'Flag') {\n BlueScatteringFlagIndex = index;\n }\n if (newaggr['Neph']['BlueScattering'][index].metric === 'avg') {\n BlueScatteringAvgIndex = index;\n }\n }\n\n\n // SAE calculations begin here \n // Need to make sure that Neph has valid data before calculations can begin\n if (newaggr['Neph']['RedScattering'][RedScatteringFlagIndex].val === 1 && newaggr['Neph']['GreenScattering'][GreenScatteringFlagIndex].val === 1 && newaggr['Neph']['BlueScattering'][BlueScatteringFlagIndex].val === 1) {\n let x = [635, 525, 450]; // Matlab code: x=[635,525,450]; %Wavelength values for Nephelometer \n let y_Neph = [\n newaggr['Neph']['RedScattering'][RedScatteringAvgIndex].val,\n newaggr['Neph']['GreenScattering'][GreenScatteringAvgIndex].val,\n newaggr['Neph']['BlueScattering'][BlueScatteringAvgIndex].val\n ]; // Matlab code: y_Neph = outdata_Neph(:,2:4); %Scattering coefficient values from Daqfactory for Neph\n\n let lx = mathjs.log(x); // Matlab code: lx = log(x); %Taking log of wavelength\n let ly_Neph = mathjs.log(y_Neph); // Matlab code: ly_Neph = log(y_Neph); %Taking log of scattering coefficient values\n\n // Matlab code: log_Neph = -[lx(:) ones(size(x(:)))] \\ ly_Neph(:,:)'; %Step 1- SAE calulation\n // going to have to break this down a little bit\n let log_Neph = [ // [lx(:) ones(size(x(:)))]\n lx, \n mathjs.ones(mathjs.size(x))\n ];\n log_Neph = mathjs.transpose(log_Neph); // Needed to make matrix 3 x 2\n\n // - operator just negates everything in the matrix\n flipSignForAll2D(log_Neph);\n /*\n * if A is a rectangular m-by-n matrix with m ~= n, and B is a matrix with m rows, then A\\B returns a least-squares solution to the system of equations A*x= B.\n * Least squares solution approximation is needed.\n * Links to calculating least squares solution:\n * https://textbooks.math.gatech.edu/ila/least-squares.html\n * https://www.youtube.com/watch?v=9UE8-6Jlezw\n */\n\n // A^T*A\n let ATA = mathjs.multiply(mathjs.transpose(log_Neph), log_Neph);\n // A^T*b\n let ATb = mathjs.multiply(mathjs.transpose(log_Neph), ly_Neph);\n\n // Create augmented matrix to solve for least squares solution\n ATA[0].push(ATb[0]);\n ATA[1].push(ATb[1]);\n\n log_Neph = rref(ATA);\n // Reason for index 0,2 is because I am skipping a step in the least squares approximation.\n // It is supposed to return a vector with 2 values, but I just shortcut it straight to the correct answer from the 3x2 rref matrix\n let SAE_Neph = log_Neph[0][2]; // SAE_Neph = log_Neph(1,:)'; %Step 2- SAE calulation\n\n // SAE ranges should be: -1 - 5\n // Matlab code: SAE_Neph(SAE_Neph > 5)= NaN;\n // Sujan said this ^^^\n // Unsure If I want to check for zero value\n if (SAE_Neph === undefined || SAE_Neph < -1 || SAE_Neph > 5) { \n newaggr['Neph']['SAE'].push({ metric: 'calc', val: ((SAE_Neph === undefined) ? 'NaN' : SAE_Neph) });\n newaggr['Neph']['SAE'].push({ metric: 'unit', val: \"undefined\" });\n newaggr['Neph']['SAE'].push({ metric: 'Flag', val: 20 });\n } else {\n newaggr['Neph']['SAE'].push({ metric: 'calc', val: SAE_Neph });\n newaggr['Neph']['SAE'].push({ metric: 'unit', val: \"undefined\" });\n // Must be valid data if it it came this far\n newaggr['Neph']['SAE'].push({ metric: 'Flag', val: 1 });\n }\n } else {\n newaggr['Neph']['SAE'].push({ metric: 'calc', val: 'NaN' });\n newaggr['Neph']['SAE'].push({ metric: 'unit', val: \"undefined\" });\n // It's just easier to assign flag 20 when if fails\n newaggr['Neph']['SAE'].push({ metric: 'Flag', val: 20 });\n }\n }\n }\n\n // Unfortunately, Neph doesn't really have a flag. It's just trusted that if there is data, it is valid. \n // I'll ensure data exists before a calculation for safety reasons.\n // Calculations for tap instruments done here\n tapNames.forEach((instrument) => {\n newaggr[instrument]['SSA_Red'] = [];\n newaggr[instrument]['SSA_Green'] = [];\n newaggr[instrument]['SSA_Blue'] = [];\n newaggr[instrument]['AAE'] = [];\n if (newaggr['Neph'] !== undefined && newaggr['Neph']['RedScattering'] !== undefined && newaggr['Neph']['GreenScattering'] !== undefined && newaggr['Neph']['BlueScattering'] !== undefined) {\n let RedScatteringFlagIndex = 0;\n let RedScatteringAvgIndex = 0;\n for (let index = 0; index < newaggr['Neph']['RedScattering'].length; index++) {\n if (newaggr['Neph']['RedScattering'][index].metric === 'Flag') {\n RedScatteringFlagIndex = index;\n }\n if (newaggr['Neph']['RedScattering'][index].metric === 'avg') {\n RedScatteringAvgIndex = index;\n }\n }\n\n let GreenScatteringFlagIndex = 0;\n let GreenScatteringAvgIndex = 0;\n for (let index = 0; index < newaggr['Neph']['GreenScattering'].length; index++) {\n if (newaggr['Neph']['GreenScattering'][index].metric === 'Flag') {\n GreenScatteringFlagIndex = index;\n }\n if (newaggr['Neph']['GreenScattering'][index].metric === 'avg') {\n GreenScatteringAvgIndex = index;\n }\n }\n\n let BlueScatteringFlagIndex = 0;\n let BlueScatteringAvgIndex = 0;\n for (let index = 0; index < newaggr['Neph']['BlueScattering'].length; index++) {\n if (newaggr['Neph']['BlueScattering'][index].metric === 'Flag') {\n BlueScatteringFlagIndex = index;\n }\n if (newaggr['Neph']['BlueScattering'][index].metric === 'avg') {\n BlueScatteringAvgIndex = index;\n }\n }\n\n let RedAbsCoefFlagIndex = 0;\n let RedAbsCoefAvgIndex = 0;\n for (let index = 0; index < newaggr[instrument]['RedAbsCoef'].length; index++) {\n if (newaggr[instrument]['RedAbsCoef'][index].metric === 'Flag') {\n RedAbsCoefFlagIndex = index;\n }\n if (newaggr[instrument]['RedAbsCoef'][index].metric === 'avg') {\n RedAbsCoefAvgIndex = index;\n }\n }\n\n let GreenAbsCoefFlagIndex = 0;\n let GreenAbsCoefAvgIndex = 0;\n for (let index = 0; index < newaggr[instrument]['GreenAbsCoef'].length; index++) {\n if (newaggr[instrument]['GreenAbsCoef'][index].metric === 'Flag') {\n GreenAbsCoefFlagIndex = index;\n }\n if (newaggr[instrument]['GreenAbsCoef'][index].metric === 'avg') {\n GreenAbsCoefAvgIndex = index;\n }\n }\n\n let BlueAbsCoefFlagIndex = 0;\n let BlueAbsCoefAvgIndex = 0;\n for (let index = 0; index < newaggr[instrument]['BlueAbsCoef'].length; index++) {\n if (newaggr[instrument]['BlueAbsCoef'][index].metric === 'Flag') {\n BlueAbsCoefFlagIndex = index;\n }\n if (newaggr[instrument]['BlueAbsCoef'][index].metric === 'avg') {\n BlueAbsCoefAvgIndex = index;\n }\n }\n\n // If any of the SSA calculations fail, AAE calculations will fail.\n // Allows Different SSA colors to still do calculations whilst preventing AAE from failing\n let SSAFailed = false;\n\n //SSA calculations begin here:\n let obj = {\n Flag:newaggr[instrument]['RedAbsCoef'][RedAbsCoefFlagIndex].val,\n avg:newaggr[instrument]['RedAbsCoef'][RedAbsCoefAvgIndex].val\n };\n if (parseInt(newaggr['Neph']['RedScattering'][RedScatteringFlagIndex].val) === 1 && parseInt(obj.Flag) === 1) {\n let redScatteringAvg = parseFloat(newaggr['Neph']['RedScattering'][RedScatteringAvgIndex].val);\n let TotalExtinction_R = redScatteringAvg + obj.avg; // Matlab code: TotalExtinction_R = AC_R_Combined + outdata_Neph(:,2); %Total Extinction calculation for Red wavelength\n let SSA_R = redScatteringAvg / TotalExtinction_R; // Matlab code: SSA_R = outdata_Neph(:,2)./TotalExtinction_R; % SSA calculation for Red Wavelength\n\n newaggr[instrument]['SSA_Red'].push({ metric: 'calc', val: SSA_R });\n newaggr[instrument]['SSA_Red'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Red'].push({ metric: 'Flag', val: obj.Flag});\n\n // Matlab code: SSA_R (SSA_R < 0 | SSA_R ==1)=NaN;\n // decided > 1 because I have no idea why he used == and not >\n // I decided to make it SSA_R <= 0 to because javascript sends error values to zero by default\n if (SSA_R === undefined || SSA_R <= 0 || SSA_R > 1) {\n newaggr[instrument]['SSA_Red'].push({ metric: 'calc', val: ((SSA_R === undefined) ? 'NaN' : SSA_R) });\n newaggr[instrument]['SSA_Red'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Red'].push({ metric: 'Flag', val: 20});\n }\n } else {\n newaggr[instrument]['SSA_Red'].push({ metric: 'calc', val: 'NaN' });\n newaggr[instrument]['SSA_Red'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Red'].push({ metric: 'Flag', val: obj.Flag});\n SSAFailed = true;\n }\n\n obj = {\n Flag:newaggr[instrument]['GreenAbsCoef'][GreenAbsCoefFlagIndex].val,\n avg:newaggr[instrument]['GreenAbsCoef'][GreenAbsCoefAvgIndex].val \n };\n if (parseInt(newaggr['Neph']['GreenScattering'][GreenScatteringFlagIndex].val) === 1 && parseInt(obj.Flag) === 1) {\n let greenScatteringAvg = parseFloat(newaggr['Neph']['GreenScattering'][GreenScatteringAvgIndex].val);\n let TotalExtinction_G = greenScatteringAvg + obj.avg; // Matlab code: TotalExtinction_G = AC_G_Combined + outdata_Neph(:,3); %Total Extinction calculation for Green wavelength\n let SSA_G = greenScatteringAvg / TotalExtinction_G; // Matlab code: SSA_G = outdata_Neph(:,3)./TotalExtinction_G; % SSA calculation for Green Wavelength\n newaggr[instrument]['SSA_Green'].push({ metric: 'calc', val: SSA_G });\n newaggr[instrument]['SSA_Green'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Green'].push({ metric: 'Flag', val: obj.Flag});\n\n // Matlab code: SSA_G (SSA_G < 0 | SSA_G ==1)=NaN;\n // decided > 1 because I have no idea why he used == and not >\n // I decided to make it SSA_G <= 0 to because javascript sends error values to zero by default\n if (SSA_G === undefined || SSA_G <= 0 || SSA_G > 1) {\n newaggr[instrument]['SSA_Green'].push({ metric: 'calc', val: ((SSA_G === undefined) ? 'NaN' : SSA_G) });\n newaggr[instrument]['SSA_Green'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Green'].push({ metric: 'Flag', val: 20 });\n }\n } else {\n newaggr[instrument]['SSA_Green'].push({ metric: 'calc', val: 'NaN' });\n newaggr[instrument]['SSA_Green'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Green'].push({ metric: 'Flag', val: obj.Flag});\n SSAFailed = true;\n }\n\n obj = {\n Flag:newaggr[instrument]['BlueAbsCoef'][BlueAbsCoefFlagIndex].val,\n avg:newaggr[instrument]['BlueAbsCoef'][BlueAbsCoefAvgIndex].val\n };\n if (parseInt(newaggr['Neph']['BlueScattering'][BlueScatteringFlagIndex].val) === 1 && parseInt(obj.Flag) === 1) {\n let blueScatteringAvg = parseFloat(newaggr['Neph']['BlueScattering'][BlueScatteringAvgIndex].val);\n let TotalExtinction_B = blueScatteringAvg + obj.avg; // Matlab code: TotalExtinction_B = AC_B_Combined + outdata_Neph(:,4); %Total Extinction calculation for Blue wavelength\n let SSA_B = blueScatteringAvg / TotalExtinction_B; // Matlab code: SSA_B = outdata_Neph(:,4)./TotalExtinction_B; % SSA calculation for Blue Wavelength\n\n newaggr[instrument]['SSA_Blue'].push({ metric: 'calc', val: SSA_B });\n newaggr[instrument]['SSA_Blue'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Blue'].push({ metric: 'Flag', val: obj.Flag});\n\n // Matlab code: SSA_B (SSA_B < 0 | SSA_B ==1)=NaN; \n // I decided to make it SSA_B <= 0 to because javascript sends error values to zero by default\n if (SSA_B === undefined || (SSA_B <= 0 || SSA_B == 1)) {\n newaggr[instrument]['SSA_Blue'].push({ metric: 'calc', val: ((SSA_B === undefined) ? 'NaN' : SSA_B) });\n newaggr[instrument]['SSA_Blue'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Blue'].push({ metric: 'Flag', val: 20});\n }\n } else {\n newaggr[instrument]['SSA_Blue'].push({ metric: 'calc', val: 'NaN' });\n newaggr[instrument]['SSA_Blue'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['SSA_Blue'].push({ metric: 'Flag', val: obj.Flag});\n SSAFailed = true;\n }\n if (!SSAFailed) {\n // AAE calculations begin here:\n // Make sure tap instrument is valid\n let x = [640, 520, 365]; // Matlab code: x=[640,520,365]; % Wavelengths values\n let y_TAP = [ // Matlab code: y_TAP_01 = outdata1_TAP_01(:,6:8); %Absorption coefficients from TAP01\n parseFloat(newaggr[instrument]['RedAbsCoef'][RedAbsCoefAvgIndex].val), \n parseFloat(newaggr[instrument]['GreenAbsCoef'][GreenAbsCoefAvgIndex].val), \n parseFloat(newaggr[instrument]['BlueAbsCoef'][BlueAbsCoefAvgIndex].val)\n ];\n\n let lx = mathjs.log(x); // Matlab code: lx = log(x); %Taking log of the wavelengths\n let ly_TAP = mathjs.log(y_TAP);// Matlab code: ly_TAP_01 = log(y_TAP_01); %Taking log of the absorption coefficients for TAP01\n for (let i = 0; i < ly_TAP.length; i++) {\n if (isNaN(ly_TAP[i]) || ly_TAP[i] < 0) {\n ly_TAP[i] = 0;\n }\n }\n\n // Going to have to break this matlab code down a bit, again:\n // Matlab code: log_TAP_01 = -[lx(:) ones(size(x(:)))] \\ ly_TAP_01(:,:)'; %Step 1 -AAE from TAP 01 data\n let log_TAP = [ // Matlab code: [lx(:) ones(size(x(:)))] \n lx,\n mathjs.ones(mathjs.size(x))\n ];\n log_TAP = mathjs.transpose(log_TAP); // Needs to be transposed into 3x2 matrix\n // - operator just negates everything in the matrix\n flipSignForAll2D(log_TAP);\n\n\n /* More information on how I came to the lines below is in the SAE calculations. \n * Essentially, we are finding the least squares solution to the system of equations:\n * A*x=b\n */\n\n // A \\ b\n let ATA = mathjs.multiply(mathjs.transpose(log_TAP), log_TAP);\n let ATb = mathjs.multiply(mathjs.transpose(log_TAP), ly_TAP);\n\n // Create augmented matrix to solve for least squares solution\n ATA[0].push(ATb[0]);\n ATA[1].push(ATb[1]);\n\n log_TAP = rref(ATA);\n // Reason for index 0,2 is because I am skipping a step in the least squares approximation.\n // It is supposed to return a vector with 2 values, but I just shortcut it straight to the correct answer from the 3x2 rref matrix\n let AAE_TAP = log_TAP[0][2]; // Matlab code: SAE_Neph = log_Neph(1,:)'; %Step 2- SAE calulation\n\n // AAE normal ranges: .5 - 3.5\n // Sujan said this ^^^\n // matlab comment: % AAE__TAP_A(AAE__TAP_A < 0)= NaN;\n // I decided to make it AAE_TAP <= 0 to because javascript sends error values to zero by default\n if (AAE_TAP === undefined || AAE_TAP <= 0 || AAE_TAP > 3.5) {\n newaggr[instrument]['AAE'].push({ metric: 'calc', val: ((AAE_TAP === undefined) ? 'NaN' : AAE_TAP) });\n newaggr[instrument]['AAE'].push({ metric: 'unit', val: \"undefined\"});\n newaggr[instrument]['AAE'].push({ metric: 'Flag', val: 20 });\n } else {\n newaggr[instrument]['AAE'].push({ metric: 'calc', val: AAE_TAP });\n newaggr[instrument]['AAE'].push({ metric: 'unit', val: \"undefined\"});\n newaggr[instrument]['AAE'].push({ metric: 'Flag', val: obj.Flag});\n }\n } else {\n newaggr[instrument]['AAE'].push({ metric: 'calc', val: 'NaN' });\n newaggr[instrument]['AAE'].push({ metric: 'unit', val: \"undefined\" });\n newaggr[instrument]['AAE'].push({ metric: 'Flag', val: 20 });\n }\n }\n });\n\n subObj.subTypes = newaggr;\n AggrData.insert(subObj, function(error, result) {\n if (result === false) {\n Object.keys(newaggr).forEach(function(newInstrument) {\n Object.keys(newaggr[newInstrument]).forEach(function(newMeasurement) {\n // test whether aggregates for this instrument/measurement already exists\n const qry = {};\n qry._id = subObj._id;\n qry[`subTypes.${newInstrument}.${newMeasurement}`] = { $exists: true };\n\n if (AggrData.findOne(qry) === undefined) {\n const newQuery = {};\n newQuery.epoch = subObj.epoch;\n newQuery.site = subObj.site;\n const $set = {};\n const newSet = [];\n newSet[0] = newaggr[newInstrument][newMeasurement][0];\n newSet[1] = newaggr[newInstrument][newMeasurement][1];\n newSet[2] = newaggr[newInstrument][newMeasurement][2];\n newSet[3] = newaggr[newInstrument][newMeasurement][3];\n newSet[4] = newaggr[newInstrument][newMeasurement][4];\n $set['subTypes.' + newInstrument + '.' + newMeasurement] = newSet;\n\n // add aggregates for new instrument/mesaurements\n AggrData.findAndModify({\n query: newQuery,\n update: {\n $set: $set\n },\n upsert: false,\n new: true\n });\n } else {\n // Some aggregations will have less than 5 parts to it. \n // Need if statements to make sure it doesn't generate errors.\n // I really think that this whole thing should change, but I have no idea how it works.\n // So just leave this be and it will keep working.\n let newaggrLength = newaggr[newInstrument][newMeasurement].length;\n if (newaggrLength > 1) {\n const query0 = {};\n query0._id = subObj._id;\n query0[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'sum';\n const $set0 = {};\n $set0[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][0].val;\n AggrData.update(query0, { $set: $set0 });\n }\n if (newaggrLength > 1) {\n const query1 = {};\n query1._id = subObj._id;\n query1[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'avg';\n const $set1 = {};\n $set1[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][1].val;\n AggrData.update(query1, { $set: $set1 });\n }\n if (newaggrLength > 2) {\n const query2 = {};\n query2._id = subObj._id;\n query2[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'numValid';\n const $set2 = {};\n $set2[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][2].val;\n AggrData.update(query2, { $set: $set2 });\n }\n if (newaggrLength > 3) {\n const query3 = {};\n query3._id = subObj._id;\n query3[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'unit';\n const $set3 = {};\n $set3[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][3].val;\n AggrData.update(query3, { $set: $set3 });\n }\n if (newaggrLength > 4) {\n const query4 = {};\n query4._id = subObj._id;\n query4[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'Flag';\n const $set4 = {};\n $set4[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][4].val;\n AggrData.update(query4, { $set: $set4 });\n }\n }\n });\n });\n }\n });\n });\n // drop temp collection that was placeholder for aggreagation results\n AggrResults.rawCollection().drop();\n}", "function subSets(arr, n){\n if( arr.length <=3 )return arr;\n let result = [];\n result.push([]);\n \n arr.forEach(function (item){\n let len = result.length;\n for(let i=0; i<len; i++){\n let newArr =result[i].slice(0);\n\n newArr.push(item);\n result.push(newArr)\n }\n})\n return result.filter(elem => elem.length ===n)\n }", "function ExistenceFilter(count){this.count=count;}", "function filter_data(){\n //console.log(sliderValues)\n new_data = []\n for(i =0; i < dataset_size; i++){\n filtered_out = false;\n for(let slider in sliderValues){\n min = parseFloat(sliderValues[slider][0])\n max = parseFloat(sliderValues[slider][1])\n attr = sliderIdToAttr[slider]\n val = parseFloat(data[i][attr])\n //console.log(val, min, max)\n if(val < min || val>max){\n //remove from screen if dataset doesnt meet any filter range\n filtered_out = true\n }\n }\n if (!filtered_out) {\n new_data.push(data[i])\n }\n }\n return new_data\n }", "function num_availHouses(ndx, group) {\n dc.dataCount('.dc-data-count')\n .crossfilter(ndx)\n .groupAll(group)\n .transitionDuration(500);\n}", "function selectBarDataHourly(group, dataset, startDate, endDate) {\n var ds = {};\n var totalViews = 0;\n var totalVisits = 0;\n for (x in dataset) {\n if (dataset[x].key === group) {\n for (hour in dataset[x].value.views) {\n ds[hour] = {};\n ds[hour]['views'] = dataset[x].value.views[hour];\n }\n for (hour in dataset[x].value.visits) {\n ds[hour]['visits'] = dataset[x].value.visits[hour];\n }\n }\n }\n return ds;\n}", "function getSum(){\n\tnumImages = 0;\n\tfor(var i = 0; i < data_cube.length; i++){\n\t\t\n\t\tif (data_cube[i].PATIENT_ID == patient_value &&\n\t\t\tdata_cube[i].TEST_TYPE == test_type_value &&\n\t\t\tdata_cube[i].DATSTR == date_value) {\n\t\t\t\tfound = true;\n\t\t\t\tnumImages = data_cube[i].CNT;\n\t\t\t}\n\t}\n\t$(\".data-sum\").html(\"<p>\" + numImages + \" </p>Images\");\n}", "_filterLiveProfiles() {\n const profiles = this.sessionLiveProfile;\n const toKeep = new Set();\n let newItem = {};\n profiles.forEach((profile) => {\n let bwToKeep = this._getNearestBandwidth(profile.bw, Object.keys(this.mediaManifestURIs));\n toKeep.add(bwToKeep);\n });\n toKeep.forEach((bw) => {\n newItem[bw] = this.mediaManifestURIs[bw];\n });\n this.mediaManifestURIs = newItem;\n }", "function ls(t) {\n return ne(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, \"F\" /* First */ , t.startAt, t.endAt);\n}", "function filterGB(data) {\n for(d in data.tracks) {\n if(data.tracks[d].album.availability.territories.indexOf('GB') > 0) delete data.tracks[d];\n }\n console.log(data);\n return data;\n}", "getLatestEmptyFiltersForTelemetry() {\n let cumulativeSize = 0;\n return this.latestEmptyFilters.filter(filterText => (cumulativeSize += filterText.length) <= 8192);\n }", "function remove3s(arr) {\n var bucket = [];\n arr.forEach(function (num) {\n if (num !==3) {\n bucket.push(num);\n }\n })\n return bucket\n}", "deleteAnyPastReservations(bank, branch) {\r\n //Get current day time\r\n var currentDate = new Date();\r\n var month = currentDate.getMonth() + 1;\r\n var day = currentDate.getDate();\r\n var year = currentDate.getFullYear();\r\n\r\n //Get timeframes referrence\r\n var timeFramesRef = database.getDocumentFromCollection(bank, branch).collection('TimeFrames');\r\n\r\n var yearLookup = 'year';\r\n var monthLookup = 'month';\r\n var dayLookup = 'day';\r\n\r\n //Find old timeframes and write a batch do delete them\r\n timeFramesRef.get().then(function (querySnapshot, docId) {\r\n var batch = database.getBatch();\r\n querySnapshot.forEach(doc => {\r\n\r\n if (!(doc.data()[yearLookup] > year) &&\r\n !(doc.data()[yearLookup] == year &&\r\n doc.data()[monthLookup] > month) &&\r\n !(doc.data()[yearLookup] == year &&\r\n doc.data()[monthLookup] == month &&\r\n doc.data()[dayLookup] >= day)) {\r\n batch.delete(doc.ref);\r\n }\r\n });\r\n return batch.commit();\r\n }).catch(err => {\r\n console.log(err.message);\r\n });\r\n }", "function randomSubset(data) {\n \treturn data.filter(d => Math.random() > 0.5);\n}", "function filterAll() {\n emptyDatasets();\n filters[dimensionName] = members;\n return dimensionObj;\n }", "function emptyDatasets() {\n for (var dim in datasets) {\n delete datasets[dim];\n }\n }", "computeRecentTestWeights() {\n this.snapshots.slice( 0, 2 ).forEach( snapshot => snapshot.tests.forEach( test => {\n test.weight = this.getTestWeight( test );\n } ) );\n }", "pruneLogs() {\n const {flags: {history}} = this.parse(LogsCommand)\n if (this.logs.length > history) {\n this.logs = this.logs.slice(this.logs.length - history)\n }\n }", "movieGenres(data,genres){\n //filter the dataset and create an array of genres => one object for each genre in the db\n genres.forEach((genre, index)=>myApp.vm.genres.push({name :genre, movies: data.filter(movie=>movie.genre_name===genre)}));\n\n }", "static mergeStories(snapshots){\n for(let i=0;i<snapshots.length;i++){\n let snap = snapshots[i];\n // loop forwards through the array except for the last element, since the last element will have ever referrer that occurs\n // don't loop over the last so we don't double count its stats\n let lastStory = snap.stories[snap.stories.length-1];\n for(let s=0;s<snap.stories.length-1;s++){\n let story = snap.stories[s];\n // merge story stats\n lastStory.views += story.views;\n lastStory.reads += story.reads;\n lastStory.claps += story.claps;\n lastStory.upvotes += story.upvotes;\n // now merge the referrers\n for(let r=0;r<story.referrers.length;r++){\n let found = false;\n for(let re=0;re<lastStory.referrers.length;re++){\n if(lastStory.referrers[re].name == story.referrers[r].name){\n lastStory.referrers[re].views += story.referrers[r].views;\n found=true;\n }\n }\n if(!found){\n lastStory.referrers.push(story.referrers[r]);\n }\n }\n }\n // for some reason undefiend seems to turn up in the list of referrals. Easier to clean it out here rather than trace its source.\n lastStory.referrers = lastStory.referrers.map(item=>{if (item != undefined) return item})\n // set only the properties we want\n snapshots[i] = {\n views: lastStory.views,\n reads: lastStory.reads,\n claps: lastStory.claps,\n upvotes: lastStory.upvotes,\n referrers: lastStory.referrers,\n snapshotTimestamp: snap.snapshotTimestamp\n }\n }\n return snapshots\n }", "getStoriesByMetric(entry) {\n const stories = [];\n for (const e of this.sampleArr) {\n if (e.name !== entry) {\n continue;\n }\n let nameOfStory = this.guidValue.get(e.diagnostics.stories);\n if (nameOfStory === undefined) {\n continue;\n }\n if (typeof nameOfStory !== 'number') {\n nameOfStory = nameOfStory[0];\n }\n stories.push(nameOfStory);\n }\n return _.uniq(stories);\n }", "#reset_working_dataset() {\n\t\tthis.working_dataset = [];\n\t\tfor (const i in this.master_dataset) {\n\t\t\tthis.working_dataset.push(this.master_dataset[i]);\n\t\t}\n\t}", "function camAllArtifactsPickedUp()\n{\n\t// FIXME: O(n) lookup here\n\treturn __camNumArtifacts === Object.keys(__camArtifacts).length;\n}", "function checkDataSize () {\n DataPoint.collection.stats()\n .then(result => {\n // calculate percentage of used disk space\n const storageSize = result.storageSize / (1024 * 1024);\n const maxGB = config.maxDatabaseSize;\n\n const usedStorage = storageSize / (maxGB * 1000);\n \n if (usedStorage > 0.8) {\n // Remove the last 2000000 documents\n DataPoint.find({}).sort({date: 'ascending'}).limit(2000000)\n .then(docs => {\n var ids = docs.map(function(doc) { return doc._id; });\n\n DataPoint.remove({_id: {$in: ids}})\n .then(docs => {\n console.log(`removed ${docs.length} docs`)\n })\n .catch(err => console.log(err))\n })\n .catch(err => console.log(err))\n }\n })\n}", "function filter(timeStamp){\n //needs to now which bench, starts with benchChoice as one\n database.ref(\"\" + benchChoice + \"\").once(\"value\").then(function(benchChoiceSnapshot){\n database.ref(\"\" + otherChoice + \"\").once(\"value\").then(function(otherChoiceSnapshot){\n benchChoiceSnapshot.forEach(function(benchChoiceReservation){\n otherChoiceSnapshot.forEach(function(otherChoiceReservation){\n let benchChoiceValue = benchChoiceSnapshot.val();\n let otherChoiceValue = otherChoiceSnapshot.val();\n\n //If both benches are reserved at this time\n if((timeStamp == benchChoiceValue) && (timeStamp == otherChoiceValue)){\n $(\"#td\" + timeStamp).text(\"Reserved\");\n $(\"#td\" + timeStamp).addClass(\"reserved-text\");\n $(\"tr[data-timestamp='\" + timeStamp + \"']\").prop(\"disabled\", true);\n $(\"tr[data-timestamp='\" + timeStamp + \"']\").removeClass(\"time-item\");\n }\n\n //If the other bench is reserved at this time, then it can be reserved\n if((timeStamp != benchChoiceValue) && (timeStamp == otherChoiceValue)){\n $(\"#td\" + timeStamp).text(\"Reserved\");\n $(\"#td\" + timeStamp).addClass(\"reserved-text\");\n $(\"tr[data-timestamp='\" + timeStamp + \"']\").prop(\"disabled\", true);\n $(\"tr[data-timestamp='\" + timeStamp + \"']\").removeClass(\"time-item\");\n }\n\n //If the other bench is reserved at this time, then it can be reserved\n if((timeStamp == benchChoiceValue) && (timeStamp != otherChoiceValue)){\n\n }\n\n //If neither bench are reserved at this time than it shoul be available\n if((timeStamp != benchChoiceValue) && (timeStamp != otherChoiceValue)){\n\n }\n\n //---------------\n });\n });\n });\n });\n}", "function subs_filter_has_index(subSet, params) {\n return params.v < subSet.inst.nodes.length;\n }", "function randomSubset(data) {\n return data.filter(d => Math.random() > 0.5);\n}", "function filterData(filterValue){\n episodeArr = [];\n episodeIndices = [];\n\n d3.json(elementsURL).then(function(elementData){\n if (filterValue == 'ALL'){\n Object.values(elementData.EPISODE).forEach(function(value){\n episodeArr.push(value);\n })\n }\n else {\n Object.entries(elementData).forEach(function([columnName, columnData]){\n if (columnName == filterValue){\n Object.entries(columnData).forEach(function([episodeIndex, elementFlag]){\n if (elementFlag == 1){\n episodeIndices.push(episodeIndex);\n }\n })\n }\n })\n\n Object.entries(elementData.EPISODE).forEach(function([episodeIndex, episodeID]){\n if (episodeIndices.includes(episodeIndex)){\n episodeArr.push(episodeID);\n }\n })\n }\n\n function getFilteredData(episode){\n return episodeArr.includes(episode.episode_id)\n }\n\n var finalArray = dataArray.filter(getFilteredData);\n\n //IMAGES\n //##################################################\n var selection = d3.select('#painting-table').select('.row').selectAll('div')\n\n var thumbnails = selection.data(finalArray)\n .enter()\n .append('div')\n .classed('col-xs-6 col-md-2', true)\n .append('a')\n .classed('thumbnail', true)\n .attr('href', d=>d.video_url)\n \n thumbnails.append('img')\n .classed('image', true)\n .attr('src', d=>d.img_url)\n .attr('alt', d=>d.episode_name);\n \n thumbnails.append('div')\n .classed('caption', true)\n .append('h4')\n .classed('text', true)\n .html(d=> `${d.episode_id}:<br>${d.episode_name}`);\n })\n}", "function perform5minAggregat(siteId, startEpoch, endEpoch) {\n // create temp collection as placeholder for aggreagation results\n const aggrResultsName = `aggr${moment().valueOf()}`;\n const AggrResults = new Meteor.Collection(aggrResultsName);\n\n // gather all data, group by 5min epoch\n const pipeline = [\n {\n $match: {\n $and: [\n {\n epoch: {\n $gt: parseInt(startEpoch, 10),\n $lt: parseInt(endEpoch, 10)\n }\n }, {\n site: siteId\n }\n ]\n }\n }, {\n $project: {\n epoch5min: 1,\n epoch: 1,\n site: 1,\n subTypes: 1\n }\n }, {\n $group: {\n _id: '$epoch5min',\n site: {\n $last: '$site'\n },\n subTypes: {\n $push: '$subTypes'\n }\n }\n }, {\n $out: aggrResultsName\n }\n ];\n\n Promise.await(LiveData.rawCollection().aggregate(pipeline, { allowDiskUse: true }).toArray());\n\n // create new structure for data series to be used for charts\n AggrResults.find({}).forEach((e) => {\n const subObj = {};\n subObj._id = `${e.site}_${e._id}`;\n subObj.site = e.site;\n subObj.epoch = e._id;\n const subTypes = e.subTypes;\n const aggrSubTypes = {}; // hold aggregated data\n\n for (let i = 0; i < subTypes.length; i++) {\n for (const subType in subTypes[i]) {\n if (subTypes[i].hasOwnProperty(subType)) {\n const data = subTypes[i][subType];\n let numValid = 1;\n var newkey;\n\n // if flag is not existing, put 9 as default, need to ask Jim?\n if (data[0].val === '') {\n data[0].val = 9;\n }\n if (data[0].val !== 1) { // if flag is not 1 (valid) don't increase numValid\n numValid = 0;\n }\n\n if (subType.indexOf('RMY') >= 0) { // HNET special calculation for wind data\n // get windDir and windSpd\n let windDir;\n let windSpd;\n let windDirUnit;\n let windSpdUnit;\n for (let j = 1; j < data.length; j++) {\n if (data[j].val === '' || isNaN(data[j].val)) { // taking care of empty or NaN data values\n numValid = 0;\n }\n if (data[j].metric === 'WD') {\n windDir = data[j].val;\n windDirUnit = data[j].unit;\n }\n if (data[j].metric === 'WS') {\n windSpd = data[j].val;\n windSpdUnit = data[j].unit;\n }\n }\n\n // Convert wind speed and wind direction waves into wind north and east component vectors\n const windNord = Math.cos(windDir / 180 * Math.PI) * windSpd;\n const windEast = Math.sin(windDir / 180 * Math.PI) * windSpd;\n\n let flag = data[0].val;\n\n if (flag !== 1) { // if flag is not 1 (valid) don't increase numValid\n numValid = 0;\n }\n\n // automatic flagging of high wind speed values/flag with 9(N)\n if (windSpd >= 35) {\n numValid = 0;\n flag = 9;\n }\n\n // Aggregate data points\n newkey = subType + '_' + 'RMY';\n if (!aggrSubTypes[newkey]) {\n aggrSubTypes[newkey] = {\n sumWindNord: windNord,\n sumWindEast: windEast,\n avgWindNord: windNord,\n avgWindEast: windEast,\n numValid: numValid,\n totalCounter: 1, // initial total counter\n flagstore: [flag], // store all incoming flags in case we need to evaluate\n WDunit: windDirUnit, // use units from last data point in the aggregation\n WSunit: windSpdUnit // use units from last data point in the aggregation\n };\n } else {\n if (numValid !== 0) { // taking care of empty data values\n aggrSubTypes[newkey].numValid += numValid;\n aggrSubTypes[newkey].sumWindNord += windNord; // holds sum until end\n aggrSubTypes[newkey].sumWindEast += windEast;\n aggrSubTypes[newkey].avgWindNord = aggrSubTypes[newkey].sumWindNord / aggrSubTypes[newkey].numValid;\n aggrSubTypes[newkey].avgWindEast = aggrSubTypes[newkey].sumWindEast / aggrSubTypes[newkey].numValid;\n }\n aggrSubTypes[newkey].totalCounter += 1; // increase counter\n aggrSubTypes[newkey].flagstore.push(flag); // store incoming flag\n }\n } else { // normal aggreagation for all other subTypes\n for (let j = 1; j < data.length; j++) {\n newkey = subType + '_' + data[j].metric;\n\n if (data[j].val === '' || isNaN(data[j].val)) { // taking care of empty or NaN data values\n numValid = 0;\n }\n\n const flag = data[0].val;\n\n if (flag !== 1) { // if flag is not 1 (valid) don't increase numValid\n numValid = 0;\n }\n\n if (!aggrSubTypes[newkey]) {\n if (numValid === 0) {\n data[j].val = 0;\n }\n\n aggrSubTypes[newkey] = {\n sum: Number(data[j].val),\n 'avg': Number(data[j].val),\n 'numValid': numValid,\n 'totalCounter': 1, // initial total counter\n 'flagstore': [flag], // store all incoming flags in case we need to evaluate\n unit: data[j].unit // use unit from first data point in aggregation\n };\n } else {\n if (numValid !== 0) { // keep aggregating only if numValid\n aggrSubTypes[newkey].numValid += numValid;\n aggrSubTypes[newkey].sum += Number(data[j].val); // holds sum until end\n if (aggrSubTypes[newkey].numValid !== 0) {\n aggrSubTypes[newkey].avg = aggrSubTypes[newkey].sum / aggrSubTypes[newkey].numValid;\n }\n }\n aggrSubTypes[newkey].totalCounter += 1; // increase counter\n aggrSubTypes[newkey].flagstore.push(flag); // /store incoming flag\n }\n numValid = 1; // reset numvalid\n }\n }\n }\n }\n }\n\n // transform aggregated data to generic data format using subtypes etc.\n const newaggr = {};\n for (const aggr in aggrSubTypes) {\n if (aggrSubTypes.hasOwnProperty(aggr)) {\n const split = aggr.lastIndexOf('_');\n const instrument = aggr.substr(0, split);\n const measurement = aggr.substr(split + 1);\n if (!newaggr[instrument]) {\n newaggr[instrument] = {};\n }\n\n const obj = aggrSubTypes[aggr]; // makes it a little bit easier\n\n // dealing with flags\n if ((obj.numValid / obj.totalCounter) >= 0.75) {\n obj.Flag = 1; // valid\n } else {\n // find out which flag was majority\n const counts = {};\n for (let k = 0; k < obj.flagstore.length; k++) {\n counts[obj.flagstore[k]] = 1 + (counts[obj.flagstore[k]] || 0);\n }\n const maxObj = _.max(counts, function(obj) {\n return obj;\n });\n const majorityFlag = (_.invert(counts))[maxObj];\n obj.Flag = majorityFlag;\n }\n\n if (measurement === 'RMY') { // special treatment for wind measurements\n if (!newaggr[instrument].WD) {\n newaggr[instrument].WD = [];\n }\n if (!newaggr[instrument].WS) {\n newaggr[instrument].WS = [];\n }\n const windDirAvg = (Math.atan2(obj.avgWindEast, obj.avgWindNord) / Math.PI * 180 + 360) % 360;\n const windSpdAvg = Math.sqrt((obj.avgWindNord * obj.avgWindNord) + (obj.avgWindEast * obj.avgWindEast));\n\n newaggr[instrument].WD.push({ metric: 'sum', val: 'Nan' });\n newaggr[instrument].WD.push({ metric: 'avg', val: windDirAvg });\n newaggr[instrument].WD.push({ metric: 'numValid', val: obj.numValid });\n newaggr[instrument].WD.push({ metric: 'unit', val: obj.WDunit });\n newaggr[instrument].WD.push({ metric: 'Flag', val: obj.Flag });\n\n newaggr[instrument].WS.push({ metric: 'sum', val: 'Nan' });\n newaggr[instrument].WS.push({ metric: 'avg', val: windSpdAvg });\n newaggr[instrument].WS.push({ metric: 'numValid', val: obj.numValid });\n newaggr[instrument].WS.push({ metric: 'unit', val: obj.WSunit });\n newaggr[instrument].WS.push({ metric: 'Flag', val: obj.Flag });\n } else { // all other measurements\n if (!newaggr[instrument][measurement]) {\n newaggr[instrument][measurement] = [];\n }\n\n // automatic flagging of aggregated values that are out of range for NO2 to be flagged with 9(N)\n if (instrument === '42i') {\n if (obj.avg < -0.5) {\n obj.Flag = 9;\n }\n }\n\n newaggr[instrument][measurement].push({ metric: 'sum', val: obj.sum });\n newaggr[instrument][measurement].push({ metric: 'avg', val: obj.avg });\n newaggr[instrument][measurement].push({ metric: 'numValid', val: obj.numValid });\n newaggr[instrument][measurement].push({ metric: 'unit', val: obj.unit });\n newaggr[instrument][measurement].push({ metric: 'Flag', val: obj.Flag });\n }\n }\n }\n\n subObj.subTypes = newaggr;\n\n AggrData.insert(subObj, function(error, result) {\n // only update aggregated values if object already exists to avoid loosing edited data flags\n if (result === false) {\n Object.keys(newaggr).forEach(function(newInstrument) {\n Object.keys(newaggr[newInstrument]).forEach(function(newMeasurement) {\n // test whether aggregates for this instrument/measurement already exists\n const qry = {};\n qry._id = subObj._id;\n qry[`subTypes.${newInstrument}.${newMeasurement}`] = { $exists: true };\n\n if (AggrData.findOne(qry) === undefined) {\n const newQuery = {};\n newQuery.epoch = subObj.epoch;\n newQuery.site = subObj.site;\n const $set = {};\n const newSet = [];\n newSet[0] = newaggr[newInstrument][newMeasurement][0];\n newSet[1] = newaggr[newInstrument][newMeasurement][1];\n newSet[2] = newaggr[newInstrument][newMeasurement][2];\n newSet[3] = newaggr[newInstrument][newMeasurement][3];\n newSet[4] = newaggr[newInstrument][newMeasurement][4];\n $set['subTypes.' + newInstrument + '.' + newMeasurement] = newSet;\n\n // add aggregates for new instrument/mesaurements\n AggrData.findAndModify({\n query: newQuery,\n update: {\n $set: $set\n },\n upsert: false,\n new: true\n });\n } else {\n const query0 = {};\n query0._id = subObj._id;\n query0[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'sum';\n const $set0 = {};\n $set0[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][0].val;\n AggrData.update(query0, { $set: $set0 });\n const query1 = {};\n query1._id = subObj._id;\n query1[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'avg';\n const $set1 = {};\n $set1[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][1].val;\n AggrData.update(query1, { $set: $set1 });\n const query2 = {};\n query2._id = subObj._id;\n query2[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'numValid';\n const $set2 = {};\n $set2[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][2].val;\n AggrData.update(query2, { $set: $set2 });\n const query3 = {};\n query3._id = subObj._id;\n query3[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'unit';\n const $set3 = {};\n $set3[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][3].val;\n AggrData.update(query3, { $set: $set3 });\n const query4 = {};\n query4._id = subObj._id;\n query4[`subTypes.${newInstrument}.${newMeasurement}.metric`] = 'Flag';\n const $set4 = {};\n $set4[`subTypes.${newInstrument}.${newMeasurement}.$.val`] = newaggr[newInstrument][newMeasurement][4].val;\n AggrData.update(query4, { $set: $set4 });\n }\n });\n });\n }\n });\n });\n // drop temp collection that was placeholder for aggreagation results\n AggrResults.rawCollection().drop();\n}", "function listdatacollector(min,max,malwareFlag){\n\t\n\t// console.log(\"min listdatacollector1\"+min+\" max listdatacollector1:\"+max);\n\tvar list_data=data.filter(function(d){\n\t\t\n\t\treturn (d.instr<=max && d.instr>=min);\n\t});\n if(malwareFlag==\"malware\")\n {\n\tlist_data=list_data.filter(function(d){\n\t\t\n\t\treturn d.pname == \"bbc03a5638e801\";\n\t});\n \n }\n\tvar pdata=list_data.filter(function(d){\n\t\t\n\t\treturn (d.call_name==\"new_pid\"||d.call_name==\"nt_create_user_process\"||d.call_name==\"nt_terminate_process\");\n\t});\n\tvar count = 0;\n\tfor (var k in pdata) {\n\t\tif (pdata.hasOwnProperty(k)) {\n\t\t\t++count;\n\t\t}\n\t}\n\tlist_map[0]=count;\n\tconsole.log(count);\n\tvar pdata=list_data.filter(function(d){\n\t\t\n\t\treturn (d.call_name==\"nt_create_file\"||d.call_name==\"nt_read_file\"||d.call_name==\"nt_write_file\"||d.call_name==\"nt_delete_file\");\n\t});\n\tvar count = 0;\n\tfor (var k in pdata) {\n\t\tif (pdata.hasOwnProperty(k)) {\n\t\t\t++count;\n\t\t}\n\t}\n\tlist_map[1]=count;\n\tvar pdata=list_data.filter(function(d){\n\t\t\n\t\treturn (d.call_name==\"nt_create_key\"||d.call_name==\"nt_create_key_transacted\"||d.call_name==\"nt_open_key\"||d.call_name==\"nt_open_key_ex\"||d.call_name==\"nt_open_key_transacted\"||d.call_name==\"nt_open_key_transacted_ex\"||d.call_name==\"nt_delete_key\"||d.call_name==\"nt_query_key\");\n\t});\n\tvar count = 0;\n\tfor (var k in pdata) {\n\t\tif (pdata.hasOwnProperty(k)) {\n\t\t\t++count;\n\t\t}\n\t}\n\tlist_map[2]=count;\n\tvar pdata=list_data.filter(function(d){\n\t\t\n\t\treturn (d.call_name==\"nt_create_section\"||d.call_name==\"nt_open_section\"||d.call_name==\"nt_map_view_of_section\");\n\t});\n\tvar count = 0;\n\tfor (var k in pdata) {\n\t\tif (pdata.hasOwnProperty(k)) {\n\t\t\t++count;\n\t\t}\n\t}\n\tlist_map[3]=count;\n\tvar pdata=list_data.filter(function(d){\n\t\t\n\t\treturn (d.call_name==\"nt_read_virtual_memory\"||d.call_name==\"nt_write_virtual_memory\");\n\t});\n\tvar count = 0;\n\tfor (var k in pdata) {\n\t\tif (pdata.hasOwnProperty(k)) {\n\t\t\t++count;\n\t\t}\n\t}\n\tlist_map[4]=count;\n\tvar pdata=list_data.filter(function(d){\n\t\t\n\t\treturn (d.call_name==\"nt_create_port\"||d.call_name==\"nt_connect_port\"||d.call_name==\"nt_listen_port\"||d.call_name==\"nt_accept_connect_port\"||d.call_name==\"nt_complete_connect_port\"||d.call_name==\"nt_request_port\"||d.call_name==\"nt_request_wait_reply_port\"||d.call_name==\"nt_reply_port\"||d.call_name==\"nt_reply_wait_reply_port\"||d.call_name==\"nt_reply_wait_receive_port\"||d.call_name==\"nt_impersonate_client_of_port\");\n\t});\n\tvar count = 0;\n\tfor (var k in pdata) {\n\t\tif (pdata.hasOwnProperty(k)) {\n\t\t\t++count;\n\t\t}\n\t}\n\tlist_map[5]=count;\n\tconsole.log(list_map);\n}", "function identifyUnsettledTransfers() {\n var unsettledTransactions = [];\n var hashedEvents = [];\n var originalDataset = newDataset.getDataset();\n var eventLogDataset = JSON.parse(document.getElementById(\"event_log_data_input\").value);\n for (var eventi = 0; eventi < eventLogDataset.length; eventi++) {\n hashedEvents.push(web3.utils.sha3(eventLogDataset[eventi][0].toString() + eventLogDataset[eventi][1].toString()));\n console.log(JSON.stringify(hashedEvents));\n }\n console.log(JSON.stringify(hashedEvents));\n for (var origi = 0; origi < originalDataset.length; origi++) {\n var origiTemp = web3.utils.sha3(originalDataset[origi][0].toString() + originalDataset[origi][1].toString());\n console.log(\"Processing: \" + origiTemp);\n if (!hashedEvents.includes(origiTemp)) {\n var tempSingle = [originalDataset[origi][0], originalDataset[origi][1]];\n unsettledTransactions.push(tempSingle);\n tempSingle = [];\n }\n }\n document.getElementById(\"unsettled_data_output\").innerHTML = JSON.stringify(unsettledTransactions);\n\n}", "function captureReportImages(imagesContainer, length) {\n var totalImageCount = length;\n for (var bucketIdentifier in imagesContainer) {\n // skip map buckets\n if (imagesContainer[bucketIdentifier].isMapBucket) {\n totalImageCount -= 1;\n continue;\n }\n\n // test whether bucket has multiple pages and if so add them to the total count.\n var bucketElement = $('#' + bucketIdentifier);\n var pagingControl = $(bucketElement).find('.navi');\n if (pagingControl.length > 0) {\n var pageCount = $(pagingControl).children('a').length;\n totalImageCount = totalImageCount + pageCount - 1;\n }\n\n captureBucketImage(bucketIdentifier, 0, imagesContainer, totalImageCount);\n }\n}", "function splitDataset(dataset) {\n return dataset.layers.map(function(lyr) {\n var split = {\n arcs: dataset.arcs,\n layers: [lyr],\n info: utils.extend({}, dataset.info)\n };\n dissolveArcs(split); // replace arcs with filtered + dissolved copy\n return split;\n });\n }", "function pruneImageCache(keep) {\n for (var imageId in gImageCache) {\n imageId = parseInt(imageId);\n if (gImageCache[imageId] !== undefined && keep.indexOf(imageId) === -1) {\n delete gImageCache[imageId];\n }\n }\n }", "function patchedTakeRecords() {\n return filterMutationRecords(originalTakeRecords.call(this), this);\n}", "async function studentsTask5() {\n try {\n const {result} = await studentCollection.aggregate([\n {$unwind: '$scores'},\n {$match: {$and: [{'scores.type': 'quiz'}, {'scores.score': { $gt: 80, $lt: 100 }}]}},\n {$set: {markd: 'true'}}\n ])\n console.log(`Marked ${result} records`);\n } catch (err) {\n console.error(err);\n }\n}", "getDatasets (callback, isPublic, isSignedOut) {\n scitran.getProjects({authenticate: !isPublic, snapshot: false, metadata: true}, (projects) => {\n scitran.getProjects({authenticate: !isPublic, snapshot: true, metadata: true}, (pubProjects) => {\n projects = projects.concat(pubProjects);\n scitran.getUsers((err, res) => {\n let users = !err && res && res.body ? res.body : null;\n let resultDict = {};\n // hide other user's projects from admins & filter snapshots to display newest of each dataset\n if (projects) {\n for (let project of projects) {\n let dataset = this.formatDataset(project, null, users);\n let datasetId = dataset.hasOwnProperty('original') ? dataset.original : dataset._id;\n let existing = resultDict[datasetId];\n if (\n !existing ||\n existing.hasOwnProperty('original') && !dataset.hasOwnProperty('original') ||\n existing.hasOwnProperty('original') && existing.snapshot_version < project.snapshot_version\n ) {\n if (isPublic || this.userAccess(project)){\n resultDict[datasetId] = dataset;\n }\n }\n }\n }\n\n let results = [];\n for (let key in resultDict) {\n results.push(resultDict[key]);\n }\n callback(results);\n }, isSignedOut);\n });\n });\n }", "function optionChanged(newSample) {\n\n // Mostly the same, except we're using newSet.\n var selection = d3.select(\"#selDataset\");\n var newSet = selection.property(\"value\");\n region_array = []\n d3.json(\"/burrito_data\").then(function(data) {\n region_array = []\n data_length = Object.keys(data).length;\n for (x = 0; x < data_length; x++) {\n region_array.push(data[x].Neighborhood);\n }\n function distinct(value, index, self) {\n return self.indexOf(value) === index;\n }\n every_region = region_array.filter(distinct);\n every_region.sort();\n TopFiveBuilder(newSet);\n });\n\n}", "async function pruneGuilds() {\n \n let deleted = await guildsCollection.deleteMany({\n $or: [\n { //last requested > 24hrs ago and members < 80\n lastRequested: {\n $lt: Date.now() - 1000 * 60 * 60 * 24\n },\n players: {\n $lt: 80\n }\n },\n { //last requested > 24hrs ago and avg weight < 1000\n lastRequested: {\n $lt: Date.now() - 1000 * 60 * 60 * 24\n },\n averageWeight: {\n $lt: 1000\n }\n },\n { //last requested > 7 days ago and avg weight < 2000\n lastRequested: {\n $lt: Date.now() - 1000 * 60 * 60 * 24 * 7\n },\n averageWeight: {\n $lt: 2000\n }\n },\n { // last requested > 14 days and avg weight < 3000\n lastRequested: {\n $lt: Date.now() - 1000 * 60 * 60 * 24 * 14\n },\n averageWeight: {\n $lt: 3000\n }\n }\n ]\n });\n console.log(`Deleted ${deleted.deletedCount} inadequate guilds`);\n}", "function exclude_data() {\n new_data = _.difference(data, actives());\n if (new_data.length == 0) {\n alert(\"I don't mean to be rude, but I can't let you remove all the data.\\n\\nTry selecting just a few data points then clicking 'Exclude'.\");\n return false;\n }\n data = new_data;\n rescale();\n}", "function grepDatasource() {\r\n var data = [];\r\n if (opts.dataSource != null) {\r\n data = jQuery.grep(opts.dataSource, function(d, index) {\r\n return (index >= opts.actualPage * opts.recordCount && index < (opts.actualPage * opts.recordCount) + opts.recordCount);\r\n });\r\n }\r\n return data;\r\n }", "function question5() {\n data.forEach(function(element) {\n if (element.materials.length >= 8) {\n console.log(element.title, element.materials.length, element.materials);\n }\n });\n}", "async function example14() {\n try {\n const {result} = await studentsCollection.deleteMany({\n scores: {\n $elemMatch: {\n type: 'homework',\n score: {$lt: 60}\n }\n }\n });\n console.log(`Deleted ${result.n} articles with results lower than 60`);\n } catch (error) {\n console.log(error);\n }\n}", "function filterAll(item) {\n \n //Store the first 5 values of a data entry in dataTrue.\n var dataTrue = Object.values(item);\n dataTrue = dataTrue.slice(0,5);\n \n //Loop through dataInput and dataTrue, compare value at the same index.\n //Return false if there is an input but does not match the dataset.\n //Otherwise, do nothing until the for loop ends and return true.\n for (i=0; i<5; i++) {\n if (dataInput[i] === '' || dataInput[i] === dataTrue[i]) {\n }\n else {\n return false;\n }\n }\n return true;\n}", "function addSnapshot(snapshots, snapshot) {\n if (snapshots.currentIndex < 0 || snapshot != snapshots.snapshots[snapshots.currentIndex]) {\n clearProceedingSnapshots_1.default(snapshots);\n snapshots.snapshots.push(snapshot);\n snapshots.currentIndex++;\n snapshots.totalSize += snapshot.length;\n var removeCount = 0;\n while (removeCount < snapshots.snapshots.length &&\n snapshots.totalSize > snapshots.maxSize) {\n snapshots.totalSize -= snapshots.snapshots[removeCount].length;\n removeCount++;\n }\n if (removeCount > 0) {\n snapshots.snapshots.splice(0, removeCount);\n snapshots.currentIndex -= removeCount;\n }\n }\n}", "function filterData(data,date){\t\n\n\t\t\tfor (var n in data.nodes) {\n\t\t\t\tif (data.nodes[n].hasOwnProperty(\"date\")) {\n\t\t\t\t\tif (data.nodes[n].date>date)\n\t\t\t\t\t\tdelete data.nodes[n];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor(var i = data.nodes[\"\"].children.length -1; i >= 0 ; i--){\n\t\t\t\tif(data.nodes[\"\"].children[i].date>date){\n\t\t\t\t\tdata.nodes[\"\"].children.splice(i, 1);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor(var j = data.links.length -1; j >= 0 ; j--){\n\t\t\t\tif(data.links[j].source.date>date && data.links[j].target.date>date){\n\t\t\t\t\tdata.links.splice(n, 1);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn data;\n\t\t}", "function getData(dataset) {\n filter_format=dataset;\n}", "function remove_empty_bins(source_group) {\n return {\n all:function () {\n return source_group.all().filter(function(d) {\n return d.value != 0;\n });\n }\n };\n }", "function aggregateSamples() {\n return Sample.destroy({\n where: { aggregated: true }\n }).then(() => {\n // mark one-offs as aggregated\n return Sample.findAll({\n where: { aggregated: false },\n attributes: ['id'],\n group: ['region', 'date', 'latitude', 'longitude', 'species_code'],\n having: Sequelize.where(\n Sequelize.fn('COUNT', Sequelize.literal('1')), 1)\n });\n }).then(results => {\n return Sample.update({ aggregated: true}, {\n where: { id: results.map(s => { return s.dataValues.id; }) }\n }).then(count => { console.log('Aggregated %d non-dupes', count)});\n }).then(() => {\n // create aggregates for dupes\n return Sample.findAll({\n where: { aggregated: false },\n attributes: [\n 'region', 'date', 'latitude', 'longitude', 'species_code', 'protected',\n [Sequelize.fn('COUNT', Sequelize.literal('1')), 'count'],\n [Sequelize.fn('SUM', Sequelize.col('number')), 'total'],\n [Sequelize.fn('SUM', Sequelize.literal('number*length')), 'lenWeight'],\n [Sequelize.fn('SUM', Sequelize.literal('number*depth')), 'depWeight'],\n ],\n group: ['region', 'date', 'latitude', 'longitude', 'species_code'],\n having: Sequelize.where(\n Sequelize.fn('COUNT', Sequelize.literal('1')),\n { $gt: 1 }\n )\n });\n }).then(results => {\n var dupeCount = 0,\n aggregates = results.map(sample => {\n sample = sample.dataValues;\n dupeCount += sample.count;\n\n return {\n species_code: sample.species_code,\n region: sample.region,\n date: sample.date,\n latitude: sample.latitude,\n longitude: sample.longitude,\n depth: sample.depWeight / sample.total,\n length: sample.lenWeight / sample.total,\n number: sample.total,\n protected: sample.protected,\n aggregated: true,\n }\n });\n\n console.log('Total dupe count: %d', dupeCount);\n\n function insertNextChunk() {\n console.log('%d aggregations remaining', aggregates.length);\n\n if (aggregates.length) {\n return Sample.bulkCreate(aggregates.splice(-10000))\n .then(rs => {\n console.log('Created %d aggregated samples', rs.length);\n })\n .then(insertNextChunk);\n }\n }\n\n return insertNextChunk();\n });\n}", "function collectGarbage() {\n //delete old games\n //delete old bookings\n Booking.aggregate({ $group: { _id: \"$player\", count: { $sum: 1 } } }).match({ count: { $gt: 30 } }).exec(function (err, playerArr) {\n if (!err) {\n playerArr.forEach(function (player2) {\n Booking.remove({ player: player2._id }).sort({ bookMonth: \"desc\", bookDay: \"desc\" }).skip(30).exec(function (err2, playerBooking) {\n if (err2)\n console.log(err2);\n\n });\n })\n }\n else {\n console.log(\"Error in accessing Bookings \");\n console.log(err);\n }\n\n })\n\n}", "function filterid(work, worksetid) {\n for (var ids of worksetid) {\n work.delete(ids);\n }\n return work;\n }", "function filteredData3(ds){\n\t\treturn ds.filter(function(entry){\n\t\t\t\treturn (UOA3Filter === null || UOA3Filter === String(entry[\"Unit of assessment name\"])); // keep if no year filter or year filter set to year being read,\n\t\t\t})\n\t}", "function filterData(data, startYear, endYear) {\n // Start with emptying filteredData\n var filteredData = [];\n\n // Create deep copy of data set into the function\n var deepCopy = JSON.parse(JSON.stringify(data));\n\n deepCopy.forEach(function(d) {\n // Delete unwanted key-value pairs\n delete d[\"Tsu Src\"];\n delete d[\"Vol\"];\n delete d[\"More Info\"];\n delete d[\"Period\"];\n delete d[\"First Motion\"];\n\n // Filter for criteria:\n // - Year of current record is within the range passed into this function\n // - Tsunami Event Validity = 4, meaning Definite Tsunami\n // - Doubtful Runup = \"n\", meaning runup entry was not doubtful\n if (((d[\"Year\"] >= startYear) && (d[\"Year\"] <= endYear)) &&\n (d[\"Tsunami Event Validity\"] == 4) &&\n (d[\"Doubtful Runup\"] == \"n\") &&\n (d[\"Maximum Water Height (m)\"] > 0)) {\n filteredData.push(d);\n } // end if\n }); // end forEach()\n\n return filteredData;\n} // end function filterData()", "getLimitedViews(props = this.props) {\n const { minDetail, maxDetail } = props;\n\n return allViews.slice(allViews.indexOf(minDetail), allViews.indexOf(maxDetail) + 1);\n }", "onStoreDataChange({ action, source: store }) {\n // If the next mixin up the inheritance chain has an implementation, call it\n super.onStoreDataChange && super.onStoreDataChange(...arguments);\n\n if (['dataset', 'batch'].includes(action)) {\n const selectedRecords = this.recordCollection,\n toRemove = [];\n\n selectedRecords.forEach((record) => {\n if (!store.includes(record)) {\n toRemove.push(record);\n }\n });\n\n // Remove in one go to fire a single selectionChange event\n selectedRecords.remove(toRemove);\n }\n }", "deleteLastRound() {\n this.store.getItem(this.DATASET_KEY).then((dataset)=> {\n let trainingData = [];\n dataset.forEach((line)=> {\n if(line.recordingRound < this.recordingRound - 1)\n {\n trainingData.push({input:line.input, output:line.output});\n }\n });\n \tthis.recordingRound--;\n \tthis.store.setItem(this.REC_KEY, this.recordingRound);\n this.store.setItem(this.DATASET_KEY, trainingData).then(()=> {\n this.updateRows();\n });\n });\n }", "function filterData1Alt(data) {\n // {'genre1': count1, genre2: count2, ...}\n let genre_counts = {};\n for (let i = 0; i < data.length; i++) {\n const genres_str = data[i]['listed_in'];\n const genres = genres_str.split(',');\n for (let j = 0; j < genres.length; j++) {\n const genre = genres[j];\n const clean_genre = genre.trim();\n if (clean_genre in genre_counts) {\n genre_counts[clean_genre] += 1;\n } else {\n genre_counts[clean_genre] = 1;\n }\n }\n }\n // console.log(genre_counts)\n // Convert to something easier for D3\n // [{\"genre\": comedy, \"count\": 2}, {\"genre\": action, \"count\": 3}, ...]\n let return_list = [];\n for (let genre in genre_counts) {\n return_list.push({\"genre\": genre, \"count\": genre_counts[genre], \"parent\": \"Origin\"});\n }\n // console.log(return_list);\n // Let's go ahead and sort them too while we're at it\n let sorted_data = return_list.sort(function (a, b) {\n return b[\"count\"] - a[\"count\"];\n });\n return_list.push({\"genre\": \"Origin\", \"count\": null, \"parent\": null}); // Add the origin\n // console.log(sorted_data);\n return sorted_data;\n}", "function filterExact(value) {\n emptyDatasets();\n return filterFunction(function(d) {\n return d == value;\n });\n }", "function barsByMap(){\n\tbars.once(\"value\").then(function(snapshot) {\n\t\tloaderBars.style.display = \"none\";\n\t\tnoResults.style.display = \"block\";\n\t\tsnapshot.forEach(function(childSnapshot) {\n\t\t\tbarFilter(childSnapshot);\n\t\t});\n\t});\n}", "async function getFilteredVersions() {\n const versions = await dockerLogic.getVersions();\n const now = new Date().getTime();\n const elapsedTime = now - lastImagePulled;\n\n for (const version in versions) {\n if (Object.prototype.hasOwnProperty.call(versions, version)) {\n let filtered = false;\n\n if (elapsedTime < constants.TIME.NINETY_MINUTES_IN_MILLIS || pullingImages) {\n filtered = true;\n versions[version].updatable = false;\n }\n\n // Return the fact that all services are being filtered.\n versions[version].filtered = filtered;\n }\n }\n\n return versions;\n}", "function filterData() {\n selectedData = dataByState.filter(function (d) {\n return selectedStates.indexOf(d.key) > -1\n })\n }", "function excludeAllSamplesFromSearch() {\n\tfor (var i=0; i<allTissues.length; i++){\n\t\tif (allTissues[i].view === allViews[activeView]) { // only include items for the active view\n\t\t\tallTissues[i].value = \"excluded\";\n\t\t\tallTissues[i].color = \"#FFFFFF\";\n\t\t}\n\t}\n\tupdateColors();\n}", "function filter_singletons_index(g_by_index){\n return by_index(filter_singletons_id(by_history_id(g_by_index)));\n}", "function subsets(collections, currentIndex) {\n\t\t// TODO: a better version\n\t}", "function getFilteredSubSets(subSetsToFilter){if(!subSetsToFilter){subSetsToFilter=subSets;}if(!UpSetState.hideEmpties){return subSetsToFilter.slice(0);}var filteredSubSets=[];for(var i=0;i<subSetsToFilter.length;i++){if(subSetsToFilter[i].items.length>0){filteredSubSets.push(subSetsToFilter[i]);}}return filteredSubSets;}", "function exclude_data() {\n\t new_data = _.difference(data, actives());\n\t if (new_data.length == 0) {\n\t alert(\"I don't mean to be rude, but I can't let you remove all the data.\\n\\nTry selecting just a few data points then clicking 'Exclude'.\");\n\t return false;\n\t }\n\t data = new_data;\n\t rescale();\n\t}", "function randomSubset() {\n let dataFile = document.getElementById('dataset').value;\n if (document.getElementById('random').checked) {\n d3.csv('data/' + dataFile + '.csv', function (error, data) {\n let subset = [];\n for (let d of data) {\n if (Math.random() > 0.5) {\n subset.push(d);\n }\n }\n update(error, subset);\n });\n }\n else {\n changeData();\n }\n}", "function question5() {\n for (var i = 0; i < data.length; i++) {\n if (data[i].materials.length >= 8) {\n console.log(\n data[i].title + \" \" + data[i].materials.length + \" \" + data[i].materials\n )\n }\n }\n}", "prune(p) {\n let counter = p ? p : this.chain.prune;\n if (counter) {\n fs.readdir(this.chainPath, (err, items) => {\n let blocks = items.filter((item) => {\n return /[0-9]+\\.tx/.test(item)\n })\n if (blocks.length > counter) {\n // find files to delete\n blocks.sort((a, b) => {\n let aa = parseInt(a.split(\",\")[0])\n let bb = parseInt(b.split(\",\")[0])\n return aa-bb;\n })\n blocks.slice(0, blocks.length-counter).forEach((item) => {\n fs.unlinkSync(this.chainPath + \"/\" + item)\n fs.unlinkSync(this.chainPath + \"/\" + (item.split(\".\")[0]) + \".json\")\n })\n }\n })\n } else {\n console.log(\"pass the prune count or, must set the 'chain.prune' attribute when initializing\")\n }\n }", "function diversWhoSawAndDidNotSeeDivesiteSpecific() {\n\n console.log(\"diversWhoSaw-/diversWhoDidNotSee- DivesiteSpecific\");\n\n sightingsThisMonth.get().then(snapshot => {\n\n var diverData = {}\n\n // looping through all the sightings\n snapshot.forEach(sighting_doc => {\n\n const divesite_id = databasify(sighting_doc.data()[\"divesite\"]);\n\n if (!diverData[divesite_id])\n diverData[divesite_id] = {};\n // for every sighting document\n for (const spec_id in sighting_doc.data()) {\n\n if (spec_id === \"divesite\" || spec_id === \"timestamp\") continue;\n\n const numSeen = sighting_doc.data()[spec_id];\n\n // diversWhoSaw, diversWhoDidNotSee\n if (diverData[divesite_id][spec_id])\n if (numSeen > 0)\n diverData[divesite_id][spec_id][\"saw\"] += 1;\n else\n diverData[divesite_id][spec_id][\"didNotSee\"] += 1;\n else\n if (numSeen > 0)\n diverData[divesite_id][spec_id] = { \"saw\": 1, \"didNotSee\": 0 }\n else\n diverData[divesite_id][spec_id] = { \"saw\": 0, \"didNotSee\": 1 }\n\n }\n });\n\n for (const divesite_id in diverData)\n for (const spec_id in diverData[divesite_id])\n statistics.doc(spec_id).collection(divesite_id).doc(\"stats\").set({\n \"diversWhoSaw\": diverData[divesite_id][spec_id][\"saw\"],\n \"diversWhoDidNotSee\": diverData[divesite_id][spec_id][\"didNotSee\"],\n }, { merge: true });\n\n return 0;\n\n }).catch(reason => {\n console.log(reason);\n return 1;\n });\n\n}", "function question5 () {\n for (let i = 0; i < data.length; i++) {\n if (data[i].materials.length >= 8) {\n // measures the length of each item's materials and if it is 8 or more\n console.log(data[i].title, data[i].materials.length, data[i].materials);\n }\n }\n}", "subset(set) {\n if (this.size() > set.size()) {\n return false;\n } else {\n for (let member of this.dataStore) {\n if (!set.contain(member)) {\n return false;\n }\n }\n }\n return true;\n }", "function filterTree(aTotalBytes, aT)\n{\n const omitThresholdPerc = 0.5; /* percent */\n\n function shouldOmit(aBytes)\n {\n return !gVerbose &&\n aTotalBytes !== kUnknown &&\n (100 * aBytes / aTotalBytes) < omitThresholdPerc;\n }\n\n aT._kids.sort(TreeNode.compare);\n\n for (var i = 0; i < aT._kids.length; i++) {\n if (shouldOmit(aT._kids[i]._amount)) {\n // This sub-tree is below the significance threshold\n // Remove it and all remaining (smaller) sub-trees, and\n // replace them with a single aggregate node.\n var i0 = i;\n var aggBytes = 0;\n for ( ; i < aT._kids.length; i++) {\n aggBytes += aT._kids[i]._amount;\n }\n aT._kids.splice(i0, aT._kids.length);\n var n = i - i0;\n var rSub = new TreeNode(\"(\" + n + \" omitted)\");\n rSub._amount = aggBytes;\n rSub._description =\n n + \" sub-trees that were below the \" + omitThresholdPerc +\n \"% significance threshold. Click 'More verbose' at the bottom of \" +\n \"this page to see them.\";\n\n // Add the \"omitted\" sub-tree at the end and then re-sort, because the\n // sum of the omitted sub-trees may be larger than some of the shown\n // sub-trees.\n aT._kids[i0] = rSub;\n aT._kids.sort(TreeNode.compare);\n break;\n }\n filterTree(aTotalBytes, aT._kids[i]);\n }\n}", "difference(set) {\n let tempSet = new Set();\n for (let i = 0; i < this.dataStore.length; i++) {\n if (!set.contain(this.dataStore[i])) {\n tempSet.add(this.dataStore[i]);\n }\n }\n return tempSet.show();\n }", "function subsetSums(var = deckCards[], var index, var deckCards.length)\n{\n // Print current subset\n if (index==size1)\n {\n // printf(\" ((1)) %d %d %d \\n\\n\",l,r,sum);\n cout << sum << \" \";\n return;\n }\n // cout<<\"hiiii\"<<endl;\n sum+=arr[index];\n // Subset including arr[l]\n subsetSums(arr, index+1, size1, sum );\n//printf(\" ((2)) %d %d %d \\n\\n\",l,r,sum);\nsum-=arr[index];\n // Subset excluding arr[l]\n subsetSums(arr, index+1, size1, sum);\n//printf(\" ((3)) %d %d %d \\n\\n\",l,r,sum);\n}", "filterSimilarResults(similar, currentId) {\n let usedIds = [];\n let resultLimit = 7;\n let filteredResults = [];\n //get an id for every matched collection\n similar.forEach(result => {\n if (usedIds.indexOf(result.id) === -1) {\n usedIds.push(result.id);\n filteredResults.push(result);\n }\n });\n //select an image from a random matched collection and limit the results\n let randomSelection = function(limit, results) {\n let duplicateIds = [];\n let counter = limit;\n let random = [];\n while (counter >= 0) {\n let randomIndex = Math.floor(Math.random() * results.length);\n if (\n duplicateIds.indexOf(results[randomIndex].id) === -1 &&\n results[randomIndex].Key !== '' &&\n results[randomIndex].id !== currentId\n ) {\n duplicateIds.push(results[randomIndex].id);\n random.push(results[randomIndex]);\n }\n counter--;\n }\n\n return random;\n };\n return randomSelection(resultLimit, filteredResults);\n }", "prune() {\n const cut = this.size() - this.maxSize;\n if(cut > 0) {\n let dates = [];\n let dateToIp = {};\n for(var forecast of this) {\n dates.push(forecast.date);\n // different ips could have the same date\n if (dateToIp[forecast.date]) {\n dateToIp[forecast.date].push(forecast.ip);\n } else {\n dateToIp[forecast.date] = [forecast.ip];\n }\n }\n dates.sort();\n let offset = dates.slice(-cut);\n for(var remove of offset) {\n for (var date of dateToIp[remove]) {\n this.remove(date);\n }\n }\n return true;\n }\n return false;\n }", "function generateStats(dataset, rangeCount, rangeSize, _offset) {\n const offset = _offset || 0;\n\n const ranges = generateRanges(rangeCount);\n\n const data = ranges.map(week => {\n let startDate = now() - offset - ((ranges.length - week + 1) * rangeSize);\n let endDate = now() - offset - ((ranges.length - week) * rangeSize);\n\n return dataset.filter(node => node.created_at >= startDate && node.created_at < endDate).length;\n });\n\n return { ranges, data };\n}", "function canMoveCurrentSnapshot(snapshots, step) {\n var newIndex = snapshots.currentIndex + step;\n return newIndex >= 0 && newIndex < snapshots.snapshots.length;\n}", "filterByLaunchYr(year) {\n this.launchYear = year;\n this.isLoading = true;\n this.getSpaceData();\n setTimeout(() => {\n this.isLoading = false;\n }, 2000);\n }", "function pruneGroup(group) {\n\tif (group.length < 9) {\n\t\t// Need at least 9 in a group\n\t\tgroup = [];\n\t\treturn;\n\t}\n\tvar avgEdgeLength = 0;\n\t_.each(group, function(blob) {\n\t\tavgEdgeLength += blob.avgEdgeLength();\n\t});\n\tavgEdgeLength /= group.length;\n\tvar minDistance = Math.sqrt(2 * Math.pow(avgEdgeLength*3, 2));\n\tvar numClose = 0;\n\tvar onSameRow = 0;\n\tvar onSameCol = 0;\n\tfor (var i=0; i < group.length; i++) {\n\t\tvar source = group[i];\n\t\tfor (var j=0; j < group.length; j++) {\n\t\t\tvar consider = group[j];\n\t\t if (consider != source) {\n\t\t\t\tif (source.getDistance(consider) < minDistance) {\n\t\t\t\t\tif (source.isSameRow(consider)) {\n\t\t\t\t\t\tonSameRow++;\n\t\t\t\t\t}\n\t\t\t\t\tif (source.isSameColumn(consider)) {\n\t\t\t\t\t\tonSameCol++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (onSameRow < 2 || onSameCol < 2) {\n\t\t\tgroup.splice(i, 1);\n\t\t\ti--;\n\t\t}\n\t}\n}", "function pagerFilter(data){\n if (typeof data.length == 'number' && typeof data.splice == 'function'){ // is array\n data = {\n total: data.length,\n rows: data\n };\n }\n var dg = $(this);\n var opts = dg.datagrid('options');\n var pager = dg.datagrid('getPager');\n pager.pagination({\n \tonBeforeRefresh:function(){\n \t\tdg.datagrid(\"reload\");\n \t},\n onSelectPage:function(pageNum, pageSize){\n opts.pageNumber = pageNum;\n opts.pageSize = pageSize;\n pager.pagination('refresh',{\n pageNumber:pageNum,\n pageSize:pageSize\n });\n dg.datagrid('loadData',data);\n }\n });\n if (!data.originalRows){\n data.originalRows = (data.rows);\n }\n var start = (opts.pageNumber-1)*parseInt(opts.pageSize);\n var end = start + parseInt(opts.pageSize);\n data.rows = (data.originalRows.slice(start, end));\n return data;\n}", "filter(callback) {\n let oldData = this.all();\n for (let i = 0; i < oldData.length; i++) {\n let result = callback(oldData[i].data, oldData[i].ID, i, this);\n if (result)\n delete oldData[i];\n }\n this.data = Util_1.default.fromDataset(oldData);\n }", "static filterNodesByEdgeNum(graph, num = 2) {\n // count edges for each node\n let edgeCount = values(graph.edges).reduce((result, edge) => {\n result[edge.node1_id] = (result[edge.node1_id] || 0) + 1;\n result[edge.node2_id] = (result[edge.node2_id] || 0) + 1;\n return result;\n }, {});\n\n let nodeIds = Object.keys(edgeCount).filter(nodeId => edgeCount[nodeId] >= num);\n\n return this.limitGraphToNodeIds(graph, nodeIds);\n }", "async function getDailySnapShots(from, to, kioskId) {\n const rangeDates = DateManager.getRange(from, to);\n const ruleGroup = {\n _id: { month: { $month: '$at' }, day: { $dayOfMonth: '$at' }, year: { $year: '$at' } },\n kioskId: { $first: '$kioskId' },\n name: { $first: 'name' },\n addressCity: { $first: '$addressCity' },\n addressState: { $first: '$addressState' },\n addressZipCode: { $first: '$addressZipCode' },\n bikesAvailable: { $first: '$bikesAvailable' },\n totalDocks: { $first: '$totalDocks' },\n kioskType: { $first: '$kioskType' },\n kioskPublicStatus: { $first: '$kioskPublicStatus' },\n kioskStatus: { $first: '$kioskStatus' },\n at: { $first: '$at' },\n };\n\n const stations = await Station.aggregate()\n .match({\n kioskId,\n at: {\n $gte: rangeDates.current,\n $lt: rangeDates.next,\n },\n })\n .sort({ at: -1 })\n .group(ruleGroup)\n .exec();\n\n if (!stations || !stations.map || !stations.length) return null;\n const promises = stations.map((item) => {\n return Entry.findOne({ at: item.at }).select('-_id -stations -__v -weather._id').exec();\n });\n const entries = await Promise.all(promises);\n const result = stations.map((station, i) => {\n const _entry = entries[i].toObject();\n return {\n at: _entry.at,\n station,\n weather: _entry.weather,\n };\n });\n return result;\n}" ]
[ "0.5298788", "0.49141982", "0.4851278", "0.48118484", "0.46582255", "0.4651824", "0.4643439", "0.46391973", "0.46039373", "0.4591683", "0.4539239", "0.4504699", "0.44960055", "0.44899675", "0.4475318", "0.44503573", "0.44395456", "0.443218", "0.43800408", "0.4331613", "0.43246093", "0.43229643", "0.43221474", "0.43171734", "0.43059638", "0.42977807", "0.42751735", "0.42734602", "0.4261451", "0.4251059", "0.4250741", "0.42457297", "0.4242232", "0.42292595", "0.42278138", "0.42270613", "0.42260218", "0.42115703", "0.4206648", "0.41942096", "0.41866207", "0.4184492", "0.41641703", "0.41603258", "0.41523919", "0.41519025", "0.41506982", "0.41479498", "0.4124437", "0.4123286", "0.41212136", "0.41209057", "0.41168982", "0.41154388", "0.41104963", "0.41063467", "0.41059712", "0.410018", "0.4094763", "0.40800905", "0.40767545", "0.40725031", "0.4069305", "0.40636605", "0.40608785", "0.40604314", "0.40495732", "0.404342", "0.40417722", "0.4041126", "0.40374526", "0.40299118", "0.4026663", "0.40264514", "0.40254658", "0.40242556", "0.4019996", "0.40114334", "0.4010355", "0.4000418", "0.39999393", "0.39955246", "0.3994125", "0.39929", "0.3986577", "0.3981509", "0.3976116", "0.3972394", "0.39717266", "0.39687014", "0.39666268", "0.39542258", "0.39482808", "0.3940689", "0.3940489", "0.39367646", "0.39332435", "0.3933033", "0.39320594", "0.3931417" ]
0.60423595
0
change view of page
function setPageTo(pageName, doNotPushState = false) { let pages = $(".pages"); let delay = 100, fadePromises = []; let activeIndex = -1; for(let p in self.models.pages){ self.models.pages[p].isActive = p === pageName; if(p === pageName){ activeIndex = Object.keys(self.models.pages).indexOf(p); } // toggle page sections based on isActive let pageSection = pages.find(self.models.pages[p].el); fadePromises.push(new Promise((fulfill,reject) => { pageSection.fadeOut(delay, () => fulfill()); })); } if(activeIndex === -1){ pageName = "Error"; activeIndex = Object.keys(self.models.pages).indexOf(pageName); //default to error page on invalid tab } self.log("activeIndex", activeIndex); self.tabBars.forEach(tabBar => tabBar.activeTabIndex = activeIndex); if(!doNotPushState){ window.history.pushState('pagechange', `JCCC - ${pageName}`, `./?link=${pageName}`); // from https://stackoverflow.com/questions/824349/modify-the-url-without-reloading-the-page } $('title').text(`JCCC - ${pageName}`); return Promise.all(fadePromises) .then(() => { return new Promise((fulfill,reject) => { if(self.models.pages[pageName]){ pages.find(self.models.pages[pageName].el) .animate({ scrollTop: 0 }, 0) .fadeIn(delay, () => fulfill()); }else{ fulfill(); //don't do anything --> may change to showing error page? } }); }).then(() => self.log("Set page to",pageName)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setView(view){\n\t\t\t\tif(this.currentView){\n\t\t\t\t\tthis.currentView.close();\n\t\t\t\t}\n\t\t\t\tthis.currentView = view;\n\t\t\t\t$('#mainContent').html(view.render().$el);\n\t\t\t}", "static view(v) {\n // Add history\n window.history.replaceState(State.preserve(), document.title);\n // Change views\n for (let view of Array.from(arguments)) {\n // Store view\n let element = UI.find(view);\n // Store parent\n let parent = element.parentNode;\n // Hide all\n for (let child of parent.children) {\n UI.hide(child);\n }\n // Show view\n UI.show(element);\n }\n // Add history\n window.history.pushState(State.preserve(), document.title);\n }", "changeView(view) {\n\n // Close and unbind any existing page view\n if (this.currentView && _.isFunction(this.currentView.close)) {\n this.currentView.close();\n }\n\n // Establish the requested view into scope\n this.currentView = view;\n \n // Re-delegate events (unbound when closed)\n //this.currentView.delegateEvents(this.currentView.events)\n\n Backbone.Radio.channel('app').request('layout').showChildView('main', view);\n }", "function changeView( id ) {\n //console.log('threeEntryPoint changeView called');\n sceneManager.changeView(id);\n }", "function changeView(view)\n{\n // basically: determine which view is required and call taskView or archiveView()\n if (view === \"archive\")\n {\n archiveView();\n }\n else if (view == \"tasks\")\n {\n taskView();\n }\n else\n {\n developerError(\"changeView() called with invalid view type\");\n }\n}", "function change_view(view)\n{\n\tif(view_mode == 'errors')\n\t\treturn; // You cannot escape Errors View!\n\tswitch(view)\n\t{\n\t\tcase 'loader':\n\t\t\t$('body div').fadeOut('fast', function()\n\t\t\t{\n\t\t\t\t$('#loader_view').fadeIn('fast');\n\t\t\t});\n\t\t\tbreak;\n\t\tcase 'errors':\n\t\t\t// TODO: Flash menacingly.\n\t\t\t$('body div').fadeOut('fast', function()\n\t\t\t{\n\t\t\t\t$('#errors_view').fadeIn('fast');\n\t\t\t});\n\t\t\tbreak;\n\t\tcase 'galaxy':\n\t\t\t// TODO: Zoom out from Sector View.\n\t\t\t$('body div').fadeOut('fast', function()\n\t\t\t{\n\t\t\t\t$('#galaxy_view').fadeIn('fast');\n\t\t\t});\n\t\t\tbreak;\n\t\tcase 'sector':\n\t\t\t// TODO: Zoom in from Galaxy View, or out from System View.\n\t\t\t$('body div').fadeOut('fast', function()\n\t\t\t{\n\t\t\t\t$('#sector_view').fadeIn('fast');\n\t\t\t});\n\t\t\tbreak;\n\t\tcase 'system':\n\t\t\t// TODO: Zoom in from Sector View, or out from Object View.\n\t\t\t$('body div').fadeOut('fast', function()\n\t\t\t{\n\t\t\t\t$('#system_view').fadeIn('fast');\n\t\t\t});\n\t\t\tbreak;\n\t\tcase 'object':\n\t\t\t// TODO: Zoom in from System View.\n\t\t\t$('body div').fadeOut('fast', function()\n\t\t\t{\n\t\t\t\t$('#object_view').fadeIn('fast');\n\t\t\t});\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tconsole.log('Cannot change_view() to: ' + view);\n\t}\n\tview_mode = view;\n}", "function refreshView() {\n\tchangeView(currentView[0], currentView[1], true);\n}", "function clickSwitchPage(e) {\n scheduled.currentView = $(e.currentTarget).attr('data-switch');\n switchPage(scheduled.currentView);\n updatePageUrl();\n }", "@action update_current_view(data) {\n this.page_state.update_current_view(data);\n }", "function CB_PageView(params) {\r\n\tthis.TYPE = \"PAGE_VIEW\";\r\n\tthis.setting(params);\r\n\t\r\n}", "function visSingleView() {\n console.log(\"visSingleView\");\n //add history.back();\n //Konstant der bestemmer window.location.search\n //Konstant der definerer en unik egenskab (her fx. navn).\n //Konstant der definerer URL til json\n //Andre lokale variabler\n //opret en klon med alle info fra json og sæt ind på siden vha textContent, link til billede + alt.\n}", "function switchToView(view) {\n switch (view) {\n case 'edit-form': showElement(['edit-form']); hideElement(['listing', 'main-controls']); break;\n case 'listing': hideElement(['edit-form']); showElement(['listing', 'main-controls']); renderList(); break;\n }\n}", "function ChangePage( lay )\r\n{\r\n //Set the current page.\r\n curPage = lay;\r\n \r\n //Fade out current content.\r\n if( layWebView.IsVisible() ) layWebView.Animate( \"FadeOut\",OnFadeOut,200 );\r\n if( laySettings.IsVisible() ) laySettings.Animate( \"FadeOut\",OnFadeOut,200 );\r\n}", "function changePageView() {\n registerForm.style.display = 'none';\n authUser.style.display = 'block';\n}", "function changeContent() {\n\t\t$(\"#view\").empty();\n\t\t$(\"#view\").load(this.id + \".html\");\t\t\n\t}", "function screen(view) {\n history.pushState({page: view}, view, '#'+view);\n cl(\"Changing to \"+view+\"!\");\n $('#battle, #menu, #shop, #settings, #deckbuilder, #guilds, #trophies, #cutscene, #help').hide();\n $('#'+view).show();\n if(view=='shop') {shopTab('recipes');}\n if(view=='menu') {$('#logo, #extra').show(); $('#menu .mode').addClass('lurking');}\n if(view=='trophies') {\n // set shop height so page doesn't scroll\n cl('hello');\n var busy = $('header:visible').outerHeight(); //cl(busy);\n var winHeight = window.innerHeight; //cl(winHeight);\n var newH = winHeight - busy; //cl(newH);\n $('.achievements').height(newH);\n }\n }", "function changeView(type) {\r\n\t//var orient = \"orientPortrait\";\r\n\tvar nodes = {};\r\n\tnodes.mapPane = dijit.byId(\"mapPane\");\r\n\tnodes.mapBox = dojo.byId(\"objContents\");\r\n\tnodes.dateArea = dojo.byId(\"dateArea\");\r\n\tnodes.printSettings = dojo.byId(\"printSettings\");\r\n\t//nodes.settings = dojo.byId(\"settingPane\");\r\n\tnodes.settings = dojo.byId(\"workingSettings\");\r\n\t\r\n\tnodes.detailsPort = dijit.byId(\"details_port\");\r\n\tnodes.detailsLand = dijit.byId(\"details_land\");\r\n\t\r\n\t//Are we closing the printView, or opening it?\r\n\tif (type === \"print\") {\r\n\t\tsidebar(dijit.byId(\"toggleButton\"), 300, true);\r\n\t\r\n\t\t//After the sidebar has collapsed, create the print preview\r\n\t\tsetTimeout(function () {\r\n\t\t\torientPrint(nodes, 300);\r\n\t\t}, 400);\r\n\t} else {\r\n\t\torientWorking(nodes, 300);\r\n\t}\r\n}", "requestView(){\t\t\n\t\tthis.trigger('requestView');\n\t}", "function getIt(thepage){\n changeView(thepage);\n override();\n $('#footer').fadeIn('slow');\n }", "open( viewName, options ){\n _history.push( this.current );\n _options.push( _currentOptions );\n\n viewport.replace( viewName, options );\n }", "function changePage(page) { \n clearPage();\n extractData(page);\n }", "function changePage() {\n const url = window.location.href;\n const main = document.querySelector('main');\n loadPage(url).then((responseText) => {\n const wrapper = document.createElement('div');\n wrapper.innerHTML = responseText;\n const oldContent = document.querySelector('.mainWrapper');\n const newContent = wrapper.querySelector('.mainWrapper');\n main.appendChild(newContent);\n animate(oldContent, newContent);\n });\n }", "function toggleView(){\n\n }", "function toggleView(){\n\n }", "function toggleView(view) {\n\t\tsetActiveView(view);\n\t}", "function switchView(view){\n setState('vis.0.control.instance', 'FFFFFFFF');\n setState('vis.0.control.data', view);\n setState('vis.0.control.command', 'changeView');\n}", "function View() {\n }", "function changePage() {\n // re-rendering pager widget\n this\n .render();\n\n // triggering changed event\n this.ui()\n .trigger('pagerChanged', {\n widget: this,\n page: this.currentPage()\n });\n }", "function updateView(newView){\n currentView.value = newView;\n }", "function setView(newState) {\r\n _updateView(null, newState);\r\n }", "goToView(viewName, options, variable) {\n options = options || {};\n const pageName = options.pageName;\n const transition = options.transition || '';\n const $event = options.$event;\n const activePage = this.app.activePage;\n const prefabName = variable && variable._context && variable._context.prefabName;\n // Check if app is Prefab\n if (this.app.isPrefabType) {\n this.goToElementView($(parentSelector).find('[name=\"' + viewName + '\"]'), viewName, pageName, variable);\n }\n else {\n // checking if the element is present in the page or not, if no show an error toaster\n // if yes check if it is inside a partial/prefab in the page and then highlight the respective element\n // else goto the page in which the element exists and highlight the element\n if (pageName !== activePage.activePageName && !prefabName) {\n if (this.isPartialWithNameExists(pageName)) {\n this.goToElementView($('[partialcontainer][content=\"' + pageName + '\"]').find('[name=\"' + viewName + '\"]'), viewName, pageName, variable);\n }\n else {\n // Todo[Shubham]: Make an API call to get all pages and check if the page name\n // is a page and then do this call else show an error as:\n // this.app.notifyApp(CONSTANTS.WIDGET_DOESNT_EXIST, 'error');\n this.goToPage(pageName, {\n viewName: viewName,\n $event: $event,\n transition: transition,\n urlParams: options.urlParams\n });\n // subscribe to an event named pageReady which notifies this subscriber\n // when all widgets in page are loaded i.e when page is ready\n const pageReadySubscriber = this.app.subscribe('pageReady', (page) => {\n this.goToElementView($(parentSelector).find('[name=\"' + viewName + '\"]'), viewName, pageName, variable);\n pageReadySubscriber();\n });\n }\n }\n else if (prefabName && this.isPrefabWithNameExists(prefabName)) {\n this.goToElementView($('[prefabName=\"' + prefabName + '\"]').find('[name=\"' + viewName + '\"]'), viewName, pageName, variable);\n }\n else if (!pageName || pageName === activePage.activePageName) {\n this.goToElementView($(parentSelector).find('[name=\"' + viewName + '\"]'), viewName, pageName, variable);\n }\n else {\n this.app.notifyApp(CONSTANTS.WIDGET_DOESNT_EXIST, 'error');\n }\n }\n }", "function changeView () { \n\tif (view === \"week\"){ // if current view is a week view => change to month view\n\t\tchangeWeeksDisplay(\"flex\"); // show all weeks except model one (= view: month) \n\t\tdocument.getElementById(\"details\").style.display = \"none\"; // hide event details\n\t\tdocument.getElementById(\"prvMonth\").style.display = \"block\"; // show \"previous month\" button\n\t\tdocument.getElementById(\"nxtMonth\").style.display = \"block\"; // show \"next month\" button\n\t\tdocument.getElementById(\"prvWeek\").style.display = \"none\"; // hide \"previous week\" button\n\t\tdocument.getElementById(\"nxtWeek\").style.display = \"none\"; // hide \"previous week\" button\n\t\tview = \"month\"; // change view status to month\n\t} else { // if current view is a month view => change to week view\n\t\tchangeWeeksDisplay(\"none\"); // hide all week elements\n\t\tdocument.getElementById(weekToDisplay).style.display = \"flex\"; // show current week\n\t\tdocument.getElementById(\"details\").style.display = \"flex\"; // show event details\n\t\tdocument.getElementById(\"prvMonth\").style.display = \"none\"; // hide \"previous month\" button\n\t\tdocument.getElementById(\"nxtMonth\").style.display = \"none\"; // hide \"next month\" button\n\t\tdocument.getElementById(\"prvWeek\").style.display = \"block\"; // show \"previous week\" button\n\t\tdocument.getElementById(\"nxtWeek\").style.display = \"block\"; // show \"next week\" button\n\t\tview = \"week\"; // change view status to week\n\t}\n}", "changeView() {\n console.log('changing the view');\n //when this function is called, change the view in the state\n //if the state is 'Homepage'\n if (this.state.view === 'Homepage') {\n //then set it to Carousel\n this.setState({\n view: 'Carousel'\n });\n //else if the state is 'Carousel'\n } else if (this.state.view === 'Carousel') {\n //then set it to 'Homepage\n this.setState({\n view: 'Homepage'\n });\n }\n }", "function changePage(page) {\n\n\t// Can't change from current page to current page\n\tif( currentPage == page ) {\n\t\treturn;\n\t}\n\n\tconsole.log(\"Changing from page \" + currentPage + \" to page \" + page);\n\n\t// Testing for populating final page\n\tif( page == 9 ) {\n\t\tpopulateFinalPage();\n\t}\n\n\n\t$('.page' + currentPage).collapse('hide');\n\t$('.page' + page).collapse('show');\n\n\tcurrentPage = page;\n}", "set View(value) {}", "function setActiveView(view) {\n app.activeView = view;\n }", "function displaySpecificView(view) {\n $(view).css('display', 'block');\n }", "function switch_index_view() {\n\n\tif (localStorage.indexViewMode == 1) {\n\t\tlocalStorage.indexViewMode = 0;\n\t\t$(\"#viewbtn\").val(\"Switch to Thumbnail View\");\n\t}\n\telse {\n\t\tlocalStorage.indexViewMode = 1;\n\t\t$(\"#viewbtn\").val(\"Switch to List View\");\n\t}\n\n\t//Redraw the table yo\n\tarcTable.draw();\n\n}", "function changePage(pane, page){\n\t\t//console.log('going to Pane: '+pane+' Page: '+page);\n\t\tif(!$('[data-role=\"pane\"][data-pane=\"'+pane+'\"]').is(\":visible\")){\n\t\t//\tconsole.log('change both');\n\t\t\t$('[data-role=\"pane\"]').hide();\n\t\t\t$('[data-role=\"page\"]').hide();\n\t\t\t$('[data-page=\"'+page+'\"]').show();\n\t\t\t$('[data-pane=\"'+pane+'\"]').fadeIn();\n\t\t\t//$('[data-page=\"'+page+'\"]').fadeIn();\n\t\t\treturn true;\n\t\t}\n\t\tif(!$('[data-pane=\"'+pane+'\"] [data-page=\"'+page+'\"]').is(':visible')){\n\t\t\tconsole.log('change just page');\n\t\t\t$('[data-role=\"page\"]').hide();\n\t\t\t$('[data-page=\"'+page+'\"]').fadeIn();\n\t\t\t\n\t\t}\n\t}", "function renderPage(newLocation, state, animate) {\n ConferenceApp.View.beforeView();\n var view = ConferenceApp.Views[newLocation];\n currentView = view;\n view.beforeRender(state);\n updateOuterPage(view.title);\n MSApp.execUnsafeLocalFunction(function () {\n $('#contentHost').html($.template(view.template, state));\n });\n if (animate) {\n var incoming = $('#topBanner, #contentHost');\n WinJS.UI.Animation.enterPage(incoming);\n }\n view.hooks(state);\n }", "set mainview(value) {\n if (value) {\n this.node.setAttribute(\"mainview\", true);\n } else {\n this.node.removeAttribute(\"mainview\");\n }\n }", "function changePage(){\n\t\twindow.location = \"processing.html\";\n\t}", "function selectView(active_page_type, inactive_page_type, active_tab, inactive_tab) {\n var active_page = document.getElementById(active_page_type);\n var inactive_page = document.getElementById(inactive_page_type);\n var active_tab = document.getElementById(active_tab);\n var inactive_tab = document.getElementById(inactive_tab);\n\n active_page.style.display = \"inline-block\";\n inactive_page.style.display = \"none\";\n active_tab.style.color = \"#c0100d\";\n inactive_tab.style.color = \"white\";\n}", "function changePage (newID) {\n $('.page').hide();\n $(newID).show();\n $('.navbar').show();\n}", "function SetViewChanging(changing) {\n viewChangeInProgress = changing;\n}", "function goToView(viewElement, viewName, pageName) {\n\n var $is, parentDialog;\n\n if (viewElement.length) {\n if (pageName === $rs.activePageName) {\n viewElement = getViewElementInActivePage(viewElement);\n }\n\n $is = viewElement.isolateScope();\n switch ($is._widgettype) {\n case 'wm-view':\n showAncestors(viewElement);\n ViewService.showView(viewName);\n break;\n case 'wm-accordionpane':\n showAncestors(viewElement);\n $is.expand();\n break;\n case 'wm-tabpane':\n showAncestors(viewElement);\n $is.select();\n break;\n case 'wm-segment-content':\n showAncestors(viewElement);\n $is.navigate();\n break;\n case 'wm-panel':\n /* flip the active flag */\n $is.expanded = true;\n break;\n }\n } else {\n parentDialog = showAncestorDialog(viewName);\n $timeout(function () {\n if (parentDialog) {\n goToView(WM.element('[name=\"' + viewName + '\"]'), viewName, pageName);\n }\n });\n }\n }", "function switchView() {\n var active = _activeCameraToolpath;\n if (active == 'camera') {\n _activeCameraToolpath = 'toolpath';\n //Place code here to change in application\n } else {\n _activeCameraToolpath = 'camera';\n //Place code here to change in application\n }\n component.forceUpdate();\n }", "function show(view){\n\t\tif(view === 'about' ){\n\t\t\tsetHomeState(false)\n\t\t\tsetToggleWork(!toggleWork)\n\t\t\tsetContainerXPos('50')\n\t\t\tsetNavProjects(navWork === 'Work' ? '' : 'Projects')\n\t\t\tsetNavWork(navWork === 'Work' ? '': 'Work')\n\t\t\tsetNavAbout(navAbout === 'About' ? 'Home': 'About')\n\t\t\tsetGitState(gitState === 'Portfolio Git' ? '' : 'Portfolio Git')\n\t\t}\n\t\telse{\n\t\t\t\n\t \t\tsetGrayScale(!grayScale) \n\t\t\tsetHomeState(false)\n\t\t\tsetToggleWork(!toggleWork)\n\t\t\tsetContainerXPos('-50%')\n\t\t\tsetButton(button === '>' ? 'x': '>')\n\t\t\tsetNavWork(navWork === 'Work' ? 'Home': 'Work')\n\t\t}\n\t\n\t\t//We disable the html from scrolling when we are not on the home page\n\t\t!toggleWork ? document.querySelector('body').classList.remove('bodyNoScroll') : document.querySelector('body').classList.add('bodyNoScroll');\n\n\n\t\t//disable the ability to scroll if you're not on the Home section\n\t\t!toggleWork ? setHomeState(true) : setHomeState(false)\n\t\t!toggleWork ? setWidth(scrollBarW) : setWidth(0)\n\n\t\n\t}", "function ofChangePage() {\n\tcurrent = getCurrentFromHash(); \n\tloadCurrentShader();\n\tstartFade();\n\n}", "goTo (x, y) {\n\t\tthis.props.changeThatView(x,y)\n\t}", "function pageFirst()\n{\n\tcurrentPage = 1;\n\tviewPage();\n}", "_goToDateInView(date, view) {\n this.activeDate = date;\n this.currentView = view;\n }", "_goToDateInView(date, view) {\n this.activeDate = date;\n this.currentView = view;\n }", "function toggleView(view) {\n var show = model.views[view];\n model.views[view] = !show;\n }", "static changePage(photographer)\n {\n document.querySelector(\".main\").innerHTML = \"\"\n document.querySelector(\"nav\").remove()\n\n ProfilPages.displayInfoProfile(photographer)\n ProfilPages.displayGallery(photographer)\n }", "function onPageChange(p) {\n setPage(p);\n }", "setPageToShow(page){\n\t\t this.updateState({pageToShow : page});\n\t }", "OnChangeView(view_id) {\n this.setState({\n activeView: view_id\n });\n\n if (this.state.activeView === \"homeScreen\") {\n if (window.location.hash) {\n this.OnChangePanel(\"party-info\");\n }\n }\n }", "function editPage () {\n EditReviewService.setFromReviewPage(true)\n $state.go(this.goToRoute)\n }", "function changePage(newIndex) {\n var resultsURL = '#/results/' + $scope.client_name + '/' +\n $scope.forms[newIndex].name + '/' + $scope.client_id +\n '/' + $scope.forms[newIndex].id + '/' + $scope.assessment_id;\n $window.location.assign(resultsURL);\n }", "function handleChangePage(event, newPage) {\n setPage(newPage);\n }", "function UserFrontPage(props){\n const [view,setView] = React.useState(<PostPage/>)\n\n const changeView = (nextview) =>{\n if(nextview === 'Placement')\n {\n setView(<Placement/>)\n }\n else if(nextview === 'Post')\n {\n setView(<PostPage/>)\n }\n else if(nextview==='alumni')\n {\n setView(<Alumni />)\n }\n else if(nextview==='club')\n {\n setView(<Club />)\n }\n }\n\n return(\n <div>\n <Aapbar changeView={(nextview)=>changeView(nextview)}/>\n {view}\n </div>\n )\n}", "function updatePushStateWithCurrentView() {\n\tif (!isSpa() || isNative()) {return;}\n\tlet current_view = getUrlInputParameter(\"view\");\n\tif (current_view !== null) {\n\t\twindow.history.pushState(root_history_index, null, getServerRootPath()+'?view='+current_view);\n\t\twindow.history.replaceState(root_history_index, null, location.pathname);\n\t}\n}", "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function OnStateUpdate(self, state)\n {\n set_view(self, state)\n }", "function pageChanged(newPage){\n\t\t$state.go(\"root.sectionList\" , {pageId:newPage});\n\t}", "function LView() { }", "function LView() { }", "function changeViewHandler(obj)\n{\n const viewType = $(obj).attr(\"id\");\n changeView(viewType);\n}", "setView(state, val = true){\n state.updateView = Math.random();\n }", "changePage(value) {\n Vue.set(vue, 'page', value)\n }", "function view(index) {\r\n localStorage.setItem(LOCKER_INDEX_KEY, index);\r\n window.location = \"view.html\";\r\n}", "changeView() {\r\n if (this.graph.currView < this.graph.cameras.length - 1) {\r\n this.graph.currView++;\r\n }\r\n else {\r\n this.graph.currView = 0;\r\n }\r\n\r\n this.camera = this.graph.cameras[this.graph.currView];\r\n this.interface.setActiveCamera(this.camera);\r\n }", "function goTo(event) {\n\n function hideAllViews() {\n _.each(views, function (viewcontainer) {\n viewcontainer.style.display = \"none\";\n });\n }\n\n hideAllViews();\n\n switch (event.data.target) {\n case 'info':\n vc_navbar.activate(event.data.target)\n vc_info.activate();\n break;\n\n case 'map':\n vc_navbar.activate(event.data.target)\n vc_map.activate();\n break;\n\n case 'contact':\n vc_navbar.activate(event.data.target)\n vc_contact.activate();\n break;\n\n }\n }", "function showView(viewName) {\n $('main > section').hide();\n $('#view' + viewName).show();\n }", "function switchToHomeView() {\n timerTout = setTimeout(function () {\n var timer = parseInt(getState(pfad0 + 'Timer_View_Switch').val, 10);\n if (timer > 1) {\n setState(pfad0 + 'Timer_View_Switch',timer - 1);\n switchToHomeView();\n }\n else{\n setState(pfad0 + 'Timer_View_Switch', 0);\n setState('vis.0.control.instance', 'FFFFFFFF'); //getState(\"vis.0.control.instance\").val/*Control vis*/);\n setState('vis.0.control.data', project + DefaultView);\n setState('vis.0.control.command', 'changeView');\n }\n }, 1000);\n}", "function changeView() {\n $('.btn_nav').click(function() {\n var target = $(this).attr('rel');\n var view = 'views/' + target + '.html';\n // Specific Views\n if (target === 'gameplay') {\n appContainer.fadeOut(300, function(){\n $(this).load('views/gameplay.html', callback_gameplay).fadeIn(300);\n });\n } else if (target === 'test') {\n appContainer.hide(function(){\n $(this).load('views/test.html', callback_test).fadeIn(300);\n });\n } else {\n appContainer.hide().load(view, changeView).fadeIn(800);\n }\n });\n}", "function change() {\r\n console.log(\"correct\");\r\n window.location = \"main/main.html\";\r\n}", "function updateViews(event) {\n manageContentObjectsByState(event.currentState);\n fillElements(event.currentState);\n setNavigationButtonsDisabledState(event.currentState);\n resetViews();\n }", "function viewSwap(currentView) {\n\n if (currentView === 'profile') {\n viewDiv[0].className = 'view hidden';\n viewDiv[1].className = 'view';\n data.view = 'profile';\n viewDiv[1].innerHTML = '';\n viewDiv[1].appendChild(renderProfile(data));\n } else if (currentView === 'edit-profile') {\n viewDiv[1].className = 'view hidden';\n viewDiv[0].className = 'view';\n data.view = 'edit-profile';\n formElement.avatarUrl.value = data.profile.avatarUrl;\n formElement.username.value = data.profile.username;\n formElement.fullName.value = data.profile.fullName;\n formElement.location.value = data.profile.location;\n formElement.bio.value = data.profile.bio;\n img.setAttribute('src', data.profile.avatarUrl);\n }\n}", "function setPage() {\n setNavigation();\n $('#tabs').tabs();\n resetGeneralDetailsForm();\n resetReportBugsForm();\n getAdminDetails();\n loadTermsOfUseDetails();\n}", "function GrouponPageView() {\n BaseView.apply(this, arguments);\n }", "function onChange() {\n setPage(pageStore.getPage());\n }", "function view(element) {\n removeFromView();\n element.classList.add('view'); //view class does the magic\n}", "function directUserFromViewInfo() {\n if (nextStep == \"Departments\") {\n viewDepartments();\n }\n if (nextStep == \"Roles\") {\n viewRoles();\n }\n if (nextStep == \"Employees\") {\n viewEmployees();\n }\n if (nextStep == \"All Information\") {\n viewAll();\n } \n }", "changeView() {\n\t\tthis.state.view === \"signup\" ? this.setState({view: \"signin\"}) : this.setState({view: \"signup\"});\n\t\tthis.setState({errorMessage: \"\"});\n\t}", "function changePage(appID, getPage) {\r\n\t\t\tchangeDivContent(\"appLoad.cc?cid=\" + classID + \"&id=\" + appID + \"&appType=\" + appType + \"&page=\" + cleanData(getPage));\r\n\t\t}", "function openView(id){\n dispatch(changeView(id));\n }", "function adminView(){\r\n window.location=\"/pages/Admin/admin.html\";\r\n}", "function updatePage() {\n switch (currentState)\n {\n case pageStates.DEFAULT:\n displayDefault();\n break;\n case pageStates.UNITY:\n displayUnity();\n break;\n case pageStates.CUSTOM:\n displayCustom();\n break;\n case pageStates.WEB:\n displayWeb();\n break;\n default:\n displayDefault();\n break;\n }\n}", "function changeView(newViewName) {\n\t\tif (!currentView || newViewName != currentView.name) {\n\t\t\tignoreWindowResize++; // because setMinHeight might change the\n\t\t\t// height before render (and subsequently\n\t\t\t// setSize) is reached\n\n\t\t\tunselect();\n\n\t\t\tvar oldView = currentView;\n\t\t\tvar newViewElement;\n\n\t\t\tif (oldView) {\n\t\t\t\t(oldView.beforeHide || noop)(); // called before changing\n\t\t\t\t// min-height. if called after,\n\t\t\t\t// scroll state is reset (in\n\t\t\t\t// Opera)\n\t\t\t\tsetMinHeight(content, content.height());\n\t\t\t\toldView.element.hide();\n\n\t\t\t} else {\n\t\t\t\tsetMinHeight(content, 1); // needs to be 1 (not 0) for IE7, or\n\t\t\t\t// else view dimensions\n\t\t\t\t// miscalculated\n\t\t\t}\n\t\t\tcontent.css('overflow', 'hidden');\n\t\t\tcurrentView = viewInstances[newViewName];\n\t\t\tif (currentView) {\n\t\t\t\tcurrentView.element.show();\n\t\t\t} else {\n\t\t\t\tcurrentView = viewInstances[newViewName] = new fcViews[newViewName](\n\t\t\t\t\t\tnewViewElement = absoluteViewElement = $(\n\t\t\t\t\t\t\t\t\"<div class='fc-view fc-view-\" + newViewName\n\t\t\t\t\t\t\t\t\t\t+ \"' style='position:absolute'/>\")\n\t\t\t\t\t\t\t\t.appendTo(content), t // the calendar object\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (oldView) {\n\t\t\t\theader.deactivateButton(oldView.name);\n\t\t\t}\n\t\t\theader.activateButton(newViewName);\n\t\t\t// alert(\"selectedWeek: \"+selectedWeek);\n\t\t\trenderView(); // after height has been set, will make\n\t\t\t// absoluteViewElement's position=relative, then set\n\t\t\t// to null\n\t\t\t/*\n\t\t\t * if (!oldView && selectedWeek != 0) { for ( var i = 0; i <\n\t\t\t * selectedWeek; i++) { renderView(1); } }\n\t\t\t */\n\t\t\tcontent.css('overflow', '');\n\t\t\tif (oldView) {\n\t\t\t\tsetMinHeight(content, 1);\n\t\t\t}\n\n\t\t\tif (!newViewElement) {\n\t\t\t\t(currentView.afterShow || noop)(); // called after setting\n\t\t\t\t// min-height/overflow, so\n\t\t\t\t// in final scroll state\n\t\t\t\t// (for Opera)\n\t\t\t}\n\n\t\t\tignoreWindowResize--;\n\t\t}\n\t}", "function renderPage() {\n\n if (STORE.view === 'start') {\n if (game1.sessionToken) {\n $('start-button').attr('disabled', false);\n }\n $('.page').html(renderStartView());\n }\n if (STORE.view === 'questions') {\n console.log('about to render');\n $('.page').html(renderQuestionView());\n }\n if (STORE.view === 'feedback' && STORE.showFeedback === true) {\n $('.page').html(renderFeedbackView());\n }\n if (STORE.view === 'results') {\n $('.page').html(renderResultsView());\n }\n}", "function switchView() {\r\n displayScore();\r\n id(\"intro\").classList.toggle(\"hidden\");\r\n id(\"game\").classList.toggle(\"hidden\");\r\n }", "goTo(page) {\n this.currentPageNumber = page > 0 ? page - 1 : 0;\n this.updateData();\n }", "static reload(){\n\t\tPage.load(Page.currentPage);\n\t}", "function renderPage() {\n if (count > 5) {\n location.replace(\"hr.html\");\n } else {\n location.replace(\"lr.html\");\n }\n}", "onPageClick(i){\n this.changePage(i);\n }", "function loadHome(){\r\n switchToContent(\"page_home\");\r\n}", "function changeView() {\r\n document.querySelector(\".g\").style.display = \"block\";\r\n document.querySelector(\".h\").style.display = \"block\";\r\n document.querySelector(\".i\").style.display = \"block\";\r\n document.querySelector(\".j\").style.display = \"block\";\r\n document.querySelector(\".k\").style.display = \"block\";\r\n document.querySelector(\".b\").style.display = \"none\";\r\n document.querySelector(\".c\").style.display = \"none\";\r\n document.querySelector(\".d\").style.display = \"none\";\r\n document.querySelector(\".e\").style.display = \"none\";\r\n document.querySelector(\".f\").style.display = \"none\";\r\n }", "function setPage()\n{\n var winH = $(window).height();\n var winW = $(window).width();\n var winName = location.pathname.\n substring(location.pathname.lastIndexOf(\"/\") + 1);\n $('#restofpage').css('height', winH-90);\n $('#restofpage').css('width', winW);\n}" ]
[ "0.7079589", "0.70540684", "0.69162357", "0.6901261", "0.68437594", "0.6839553", "0.6809734", "0.6743118", "0.66911536", "0.6654995", "0.6650799", "0.6650175", "0.6619408", "0.65656096", "0.65633875", "0.6555766", "0.65324944", "0.6510089", "0.650337", "0.6487248", "0.64441746", "0.6438807", "0.6431826", "0.6431826", "0.6428598", "0.6387576", "0.6363875", "0.635333", "0.6326727", "0.630612", "0.63046676", "0.630348", "0.6295033", "0.6283534", "0.62795377", "0.6273978", "0.62616247", "0.62529707", "0.6236437", "0.6204633", "0.61843455", "0.6177929", "0.61721385", "0.6170186", "0.6143626", "0.6139143", "0.6131468", "0.61313874", "0.612933", "0.6121914", "0.6115922", "0.6115079", "0.6115079", "0.61057013", "0.61054087", "0.6105152", "0.60980994", "0.6089828", "0.60868084", "0.6085154", "0.60770833", "0.60684955", "0.6065103", "0.6060278", "0.6060278", "0.6060278", "0.6058088", "0.6039406", "0.6039406", "0.60345846", "0.60248756", "0.60234576", "0.6016901", "0.6012372", "0.5987082", "0.5983635", "0.5981303", "0.5979068", "0.5976578", "0.5961908", "0.5953942", "0.59481376", "0.5947207", "0.594611", "0.59439915", "0.594218", "0.59412146", "0.5938085", "0.5935195", "0.593518", "0.59327465", "0.5931373", "0.59289074", "0.59265554", "0.59262294", "0.59233654", "0.5909783", "0.59028155", "0.59017307", "0.5894735", "0.58905596" ]
0.0
-1
The unique Id used by omnichat integration to keep retailer in sync with the pipedrive related entry
get pipeDriveOrganizationId() { return this.get('pipeDriveId'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "generateId() { return this._get_uid() }", "generateId() {\n return `INV-${this.guid()}`;\n }", "id(){\n if(!this.uniqueID){\n var hashids = new Hashids(this.body.substring(0, this.body.length));\n this.uniqueID = hashids.encode([Math.floor(Math.random() * Math.floor(1000))]);\n }\n return this.uniqueID;\n }", "get id() {\r\n return utils.hash(TX_CONST + JSON.stringify({\r\n proof: this.proof,\r\n cm: this.cm }));\r\n }", "function id() {\n return '_' + Math.random().toString(36).substr(2, 9);\n }", "_id () {\n return (Math.random().toString(16) + '000000000').substr(2, 8)\n }", "_uniqueID() {\n const chr4 = () => Math.random().toString(16).slice(-4);\n return `${chr4()}${chr4()}-${chr4()}-${chr4()}-${chr4()}-${chr4()}${chr4()}${chr4()}`;\n }", "get id() {\n if (!this._id) {\n this._id = Util.GUID();\n }\n return this._id;\n }", "function uniqueId() {\n return new Date().getTime();\n }", "function id () {\n return '_' + Math.random().toString(36).substr(2, 9);\n}", "_generateID() {\n this._getWestley().execute(\n Inigo.create(Inigo.Command.ArchiveID)\n .addArgument(encoding.getUniqueID())\n .generateCommand(),\n false // prepend to history\n );\n }", "get _id() {\n if (!this.__id) {\n this.__id = `ui5wc_${++autoId}`;\n }\n return this.__id;\n }", "function getId () {\n return '_' + Math.random().toString(36).substr(2, 9);\n}", "function makeId() {\n //create an id from praxis number, username and suffix\n //complete version\n vm.setId = praxis+''+vm.name+''+vm.ownId;\n console.log('Setting own id from '+vm.setId+' to '+vm.ownId);\n //send complete peer id to all clients\n socket.emit('update:pid', vm.setId);\n }", "getId() {\n const parent = this.getParent();\n return parent ? `${parent.getId()}/${this.getInternalId()}` : this.getInternalId();\n }", "function uniqueId () {\n return ('xxxxxxxx-xxxx-xxxx-yxxx-xxxxxxxxxxxx').replace(/[xy]/g, function(c) {\n var r = Math.random() * 16 | 0,\n v = c === 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n}", "function uniqueId() {\n return (new Date).getTime()\n }", "function guid() {return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();}", "function $uid() {\n unique_id += 2;\n return unique_id;\n }", "function uniqueId() {\n return Date.now() + 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\n var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8);\n return v.toString(16);\n });\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() {}", "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() {}", "_uuid() {\n return this.uid++;\n }", "idString() {\n return ( Date.now().toString( 36 ) + Math.random().toString( 36 ).substr( 2, 5 ) ).toUpperCase();\n }", "function OwnerID() { }", "generateRoomId() {\n\t\treturn `r${Date.now()}`;\n\t}" ]
[ "0.7009648", "0.6920787", "0.68806195", "0.6834801", "0.68126905", "0.68031836", "0.6782387", "0.67252517", "0.6636345", "0.66344", "0.6633762", "0.6618529", "0.6610944", "0.6605844", "0.660432", "0.6552705", "0.65194535", "0.65178496", "0.65169245", "0.65164095", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.65148973", "0.6511184", "0.64942366", "0.6477692", "0.6474213" ]
0.0
-1
End GC related code A utility function that returns a function that returns a timeout promise of the given value
function weShouldWait(delay) { return function (value) { return WinJS.Promise.timeout(delay). then(function () { return value; }); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function timeout(t = 0){\n return new Promise((resolve, reject) =>{\n setTimeout(resolve, duration); \n })\n}", "function timeout() {\n return new Promise(function (resolve) {\n setTimeout(resolve, 1);\n });\n }", "function timeout(duration) { // Thanks joews\n return new Promise(function(resolve) {\n setTimeout(resolve, duration);\n });\n}", "function exitPromise(fn, _setTimeout) {\n\t _setTimeout(fn, 0);\n\t}", "async function timerExample() {\n try {\n console.log('Before I/O callbacks');\n let cacheTimeOut = timeout();\n await setImmediatePromise();\n if(cacheTimeOut._called){\n return 'timed out value';\n }else{\n console.log('After I/O callbacks');\n return 'not called';\n }\n //return value;\n \n } catch (error) {\n console.log('error >>>', error);\n }\n\n}", "function exitPromise(fn, _setTimeout) {\n _setTimeout(fn, 0);\n}", "static timeout(ms) {\n const signal = new AbortSignal();\n const timer = setTimeout(abortSignal, ms, signal);\n // Prevent the active Timer from keeping the Node.js event loop active.\n if (typeof timer.unref === \"function\") {\n timer.unref();\n }\n return signal;\n }", "static timeout(ms) {\n const signal = new AbortSignal();\n const timer = setTimeout(abortSignal, ms, signal);\n // Prevent the active Timer from keeping the Node.js event loop active.\n if (typeof timer.unref === \"function\") {\n timer.unref();\n }\n return signal;\n }", "static timeout(ms) {\n const signal = new AbortSignal();\n const timer = setTimeout(abortSignal, ms, signal);\n // Prevent the active Timer from keeping the Node.js event loop active.\n if (typeof timer.unref === \"function\") {\n timer.unref();\n }\n return signal;\n }", "function setTimeoutPromiseFunction () {\n\n return new Promise((resolve, reject) => {\n setTimeout(() => {\n // console.log('hello')\n // resolve('goodbye')\n // reject('Oh no!')\n }, 0);\n })\n}", "async __timeoutPromise() {\n // console.log('calling TO');\n return new Promise((resolve, reject) => {\n setTimeout(resolve, 1000 / this.fps);\n }).then(() => {\n // console.log('resolved TO');\n return null;\n });\n }", "promiseTimeout(promise) {\n\n // Create a promise that rejects in <ms> milliseconds\n let timeout = new Promise((resolve, reject) => {\n let id = setTimeout(() => {\n clearTimeout(id);\n\n let name = promise.name;\n if (name != undefined) {\n console.log(\"Timed out: \" + name);\n }\n resolve(this.promise_timed_out_flag);\n }, this.promise_time_out_duration);\n })\n\n // Returns a race between our timeout and the passed in promise\n return Promise.race([\n promise,\n timeout\n ]);\n }", "function timeout(ms) {\r\n\treturn new Promise(resolve => setTimeout(resolve, ms));\r\n}", "function timeout_(self, d) {\n return (0, _managed.managedApply)(T.uninterruptibleMask(({\n restore\n }) => T.gen(function* (_) {\n const env = yield* _(T.environment());\n const {\n tuple: [r, outerReleaseMap]\n } = env;\n const innerReleaseMap = yield* _(makeReleaseMap.makeReleaseMap);\n const earlyRelease = yield* _(add.add(exit => releaseAll.releaseAll(exit, T.sequential)(innerReleaseMap))(outerReleaseMap));\n const raceResult = yield* _(restore(T.provideAll_(T.raceWith_(T.provideAll_(self.effect, Tp.tuple(r, innerReleaseMap)), T.as_(T.sleep(d), O.none), (result, sleeper) => T.zipRight_(F.interrupt(sleeper), T.done(Ex.map_(result, tp => E.right(tp.get(1))))), (_, resultFiber) => T.succeed(E.left(resultFiber))), r)));\n const a = yield* _(E.fold_(raceResult, f => T.as_(T.chain_(T.fiberId, id => T.forkDaemon(T.ensuring_(F.interrupt(f), releaseAll.releaseAll(Ex.interrupt(id), T.sequential)(innerReleaseMap)))), O.none), v => T.succeed(O.some(v))));\n return Tp.tuple(earlyRelease, a);\n })));\n}", "function setTimeoutUnref(callback, time, args) {\n\t var ref = setTimeout.apply(null, arguments);\n\t if (ref && typeof ref === 'object' && typeof ref.unref === 'function')\n\t ref.unref();\n\t return ref;\n\t}", "function ptimeout(delay) {\nreturn new Promise(function(resolve, reject){\n setTimeout(resolve, delay);\n console.log(`Delay is ` + delay);\n\n });\n\n }", "static timeout(t) {\n if ( !(typeof t === 'undefined' ))\n _timeout = t;\n else\n return _timeout;\n }", "async function step1() {\n // REPLACE with an actual async function\n let result = await timeout(2000, 'step 1');\n console.log(result);\n}", "function timeout(ms) {\n\treturn new Promise(resolve => setTimeout(resolve, ms))\n}", "function timeoutPromise() {\n let interval=getRandomInt(1,10);\n //console.log(\"interval:\"+interval);\n return new Promise((resolve, reject) => {\n setTimeout(function(){\n resolve(\"successful\");\n }, interval*1000);\n });\n}", "function timeout(ms) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}", "function microCreatesMacro()\n{\n Promise.resolve().then(() => \n {\n setTimeout(() => console.log(\"timeout\"), 0);\n }).then(() => \n {\n console.log(\"promise\");\n });\n}", "function cleanUpTimeout(inv) {\n if (!inv) return;\n delete timeouts[inv.timerKey];\n delete inv.timerKey;\n inv.release(); // return to pool \n}", "function createTimeout(timeout, fun) {\n var tid;\n return function() {\n if (tid != null)\n clearTimeout(tid);\n tid = setTimeout(fun, timeout);\n }\n }", "function r(){var e=setTimeout.apply(void 0,arguments);return e.unref&&e.unref(),e}", "async function fpWait() {\n return new Promise((resolve) => setTimeout(() => resolve(undefined), 2));\n}", "function timeout(d) {\n return self => timeout_(self, d);\n}", "stopWhenTimedOut() {\n return new Promise((resolve) => {\n this._stoppingInfo = {\n doStopWhenTimedOut: true,\n resolve,\n };\n });\n }", "function timeoutDefer(fn) {\n var time = +new Date(),\n timeToCall = Math.max(0, 16 - (time - lastTime));\n lastTime = time + timeToCall;\n return window.setTimeout(fn, timeToCall);\n }", "onTimeout() {}", "function timeoutDefer(fn) {\n var time = +new Date(),\n timeToCall = Math.max(0, 16 - (time - lastTime));\n\n lastTime = time + timeToCall;\n return window.setTimeout(fn, timeToCall);\n }", "function timeoutDefer(fn) {\n \tvar time = +new Date(),\n \t timeToCall = Math.max(0, 16 - (time - lastTime));\n\n \tlastTime = time + timeToCall;\n \treturn window.setTimeout(fn, timeToCall);\n }", "function timeoutDefer(fn) {\n \tvar time = +new Date(),\n \t timeToCall = Math.max(0, 16 - (time - lastTime));\n\n \tlastTime = time + timeToCall;\n \treturn window.setTimeout(fn, timeToCall);\n }", "timeout(subTask, time) {\n return new Promise(resolve => {\n this._harnessTest.step_timeout(() => {\n let result = subTask();\n if (result && typeof result.then === \"function\") {\n // Chain rejection directly to the harness test Promise, to report\n // the rejection against the subtest even when the caller of\n // timeout does not handle the rejection.\n result.then(resolve, this._reject());\n } else {\n resolve();\n }\n }, time);\n });\n }", "function timeoutFunction() {\n\t\t\tif (timeouts.length) {\n\t\t\t\t(timeouts.shift())();\n\t\t\t}\n\t\t}", "function timeoutFunction() {\n\t\t\tif (timeouts.length) {\n\t\t\t\t(timeouts.shift())();\n\t\t\t}\n\t\t}", "promiseTimeout(promise, timeout) {\n var error = new Error(\"Promise hanging, timed out\");\n return new Promise((resolve, reject) => {\n var rejectout = setTimeout(() => {\n reject(error);\n resolve = null;\n reject = null;\n }, timeout);\n promise.then(\n function() {\n clearTimeout(rejectout);\n if (resolve) resolve.apply(this, arguments);\n },\n function() {\n clearTimeout(rejectout);\n if (reject) reject.apply(this, arguments);\n }\n );\n });\n }", "createTimer() {\n this.timer = new Promise(function(resolve) {\n setTimeout(resolve, 800)\n })\n }", "function Gen(time) {\n return new Promise((resolve, reject) => {\n setTimeout(function() {\n resolve(time)\n }, time)\n })\n}", "function timeoutDefer(fn) {\n\t\t\tvar time = +new Date(),\n\t\t\t timeToCall = Math.max(0, 16 - (time - lastTime));\n\t\n\t\t\tlastTime = time + timeToCall;\n\t\t\treturn window.setTimeout(fn, timeToCall);\n\t\t}", "function SafeTimeoutFunction_(win, fn) {\n var timeoutfn = function() {\n try {\n fn(win);\n\n var t = win._tm;\n if (t) {\n delete t[timeoutfn.id];\n }\n } catch (e) {\n DumpException(e);\n }\n };\n return timeoutfn;\n}", "function delay(timeout){\n return waitAndCall.bind(null, timeout); \n}", "function timeoutDefer(fn) {\n\t\tvar time = +new Date(),\n\t\t timeToCall = Math.max(0, 16 - (time - lastTime));\n\n\t\tlastTime = time + timeToCall;\n\t\treturn window.setTimeout(fn, timeToCall);\n\t}", "function setTimeoutPromise(time) {\n return new Promise((resolve) => {\n setTimeout(() => {\n resolve()\n }, time);\n });\n}", "function promiseWhen(condition, timeout){\r\n\tif(!timeout){\r\n\t\ttimeout = 2000\r\n\t}\r\n\treturn new Promise((resolve, reject)=>{\r\n\t\tsetTimeout(()=>reject(new Error(\"Promise when expired.\")), timeout)// reject promise if given timeout is exceeded\r\n\t\tfunction loop(){\r\n\t\t\tif(condition()){//check condition\r\n\t\t\t\tresolve()\r\n\t\t\t} else {\r\n\t\t\t\tsetTimeout(loop,0)\r\n\t\t\t}\r\n\t\t}\r\n\t\tsetTimeout(loop,0)\r\n\t})\r\n}", "function gc(t, e) {\n return function(t, e) {\n var n = this, r = new Ir;\n return t.asyncQueue.enqueueAndForget((function() {\n return Object(tslib__WEBPACK_IMPORTED_MODULE_3__[\"__awaiter\"])(n, void 0, void 0, (function() {\n var n;\n return Object(tslib__WEBPACK_IMPORTED_MODULE_3__[\"__generator\"])(this, (function(i) {\n switch (i.label) {\n case 0:\n return n = Ms, [ 4 /*yield*/ , Au(t) ];\n\n case 1:\n return [ 2 /*return*/ , n.apply(void 0, [ i.sent(), e, r ]) ];\n }\n }));\n }));\n })), r.promise;\n }(ca(t), e);\n}", "function timeoutDefer(fn) {\r\n \tvar time = +new Date(),\r\n \t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n \tlastTime = time + timeToCall;\r\n \treturn window.setTimeout(fn, timeToCall);\r\n }", "function timeoutDefer(fn) {\r\n \tvar time = +new Date(),\r\n \t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n \tlastTime = time + timeToCall;\r\n \treturn window.setTimeout(fn, timeToCall);\r\n }", "function setTimeout(callback, timeout) {return callback()} // TODO", "timeout(ms, promise) {\n return new Promise((resolve, reject) => {\n setTimeout(() => reject(new Error(\"Connection timeout\")), ms)\n promise.then(resolve, reject)\n })\n }", "async function makeUpYourOwnFunctionNameFnc(resolvAfterSec) {\n return new Promise(resolve => {\n setTimeout(() => {\n resolve();\n }, resolvAfterSec * 1000);\n });\n }", "function asyncWait (time, token = {}) {\n return new Promise ((resolve, reject) => {\n let t = setTimeout(resolve, time);\n\n token.reject = function() {\n clearTimeout(t);\n reject(new Error('Timer cleared.'));\n }\n });\n}", "function timeoutPromiseX(interval) {\n return new Promise((resolve, reject) => {\n setTimeout(function(){\n resolve(\"done\");\n }, interval);\n });\n}", "function timeoutDefer(fn) {\r\n \tvar time = +new Date(),\r\n \t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n \tlastTime = time + timeToCall;\r\n \treturn window.setTimeout(fn, timeToCall);\r\n }", "function cancellableTimeout(f, milliseconds) { \n\tlet timerId = 0\n\t\n\tif (Number(milliseconds) === NaN || milliseconds <= 0) throw new Error('time:' + milliseconds + ' must be a number greater than zero.')\n\tif (typeof f !== 'function') throw new Error('action is not a function')\n\n\treturn {\n\t\tpromise: (arg) => new Promise((resolve, reject) => {\n\t\t\ttimerId = setTimeout(() => {\n\t\t\t\t\ttimerId = 0 \t\t\t\t\t \n\t\t\t\t\tresolve(f.call(undefined, arg))\n\t\t\t\t}, Number(milliseconds))\n\t\t}),\n\t\tcancel: () => {\n\t\t\tif (timerId > 0) {\n\t\t\t\tclearTimeout(timerId)\n\t\t\t}\n\t\t}\n\t}\n}", "function timeoutDefer(fn) {\r\n\t \tvar time = +new Date(),\r\n\t \t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n\t \tlastTime = time + timeToCall;\r\n\t \treturn window.setTimeout(fn, timeToCall);\r\n\t }", "function wait () { return new Promise( (resolve,reject)=>{ setTimeout(resolve,5000)} )}", "function pegarValor(){\r\n return new Promise(resolve => {\r\n setTimeout(() => resolve(10), 5000)\r\n })\r\n}", "function race (fun, onTimeout) {\n const cancel = cancelableDelay(500, onTimeout)\n return new Promise(resolve => {\n fun(function finishRace (value) {\n cancel()\n resolve(value)\n })\n })\n}", "function t(e) {\n return {\n setTimeout: function setTimeout(t, o) {\n var r = e.setTimeout(t, o);\n return {\n remove: function remove() {\n return e.clearTimeout(r);\n }\n };\n }\n };\n }", "function timeoutDefer(fn) {\n\tvar time = +new Date(),\n\t timeToCall = Math.max(0, 16 - (time - lastTime));\n\n\tlastTime = time + timeToCall;\n\treturn window.setTimeout(fn, timeToCall);\n}", "function timeoutDefer(fn) {\n\tvar time = +new Date(),\n\t timeToCall = Math.max(0, 16 - (time - lastTime));\n\n\tlastTime = time + timeToCall;\n\treturn window.setTimeout(fn, timeToCall);\n}", "function timeoutDefer(fn) {\n\tvar time = +new Date(),\n\t timeToCall = Math.max(0, 16 - (time - lastTime));\n\n\tlastTime = time + timeToCall;\n\treturn window.setTimeout(fn, timeToCall);\n}", "function timeoutDefer(fn) {\n\tvar time = +new Date(),\n\t timeToCall = Math.max(0, 16 - (time - lastTime));\n\n\tlastTime = time + timeToCall;\n\treturn window.setTimeout(fn, timeToCall);\n}", "function timeoutDefer(fn) {\n\tvar time = +new Date(),\n\t timeToCall = Math.max(0, 16 - (time - lastTime));\n\n\tlastTime = time + timeToCall;\n\treturn window.setTimeout(fn, timeToCall);\n}", "function timeoutDefer(fn) {\n\tvar time = +new Date(),\n\t timeToCall = Math.max(0, 16 - (time - lastTime));\n\n\tlastTime = time + timeToCall;\n\treturn window.setTimeout(fn, timeToCall);\n}", "function _fpWait() {\n let ms = 8000;\n return new Promise(resolve => setTimeout(resolve, ms));\n }", "function delayedPromise(timeout) {\n return new Promise((resolve) => setTimeout(resolve, timeout));\n}", "function delayLonger() {\n return new Promise(resolve => setTimeout(resolve, 300));\n}", "function I(){return a.setTimeout(function(){eb=void 0}),eb=fa.now()}", "function timeoutDefer(fn) {\r\n\tvar time = +new Date(),\r\n\t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n\tlastTime = time + timeToCall;\r\n\treturn window.setTimeout(fn, timeToCall);\r\n}", "function timeoutDefer(fn) {\r\n\tvar time = +new Date(),\r\n\t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n\tlastTime = time + timeToCall;\r\n\treturn window.setTimeout(fn, timeToCall);\r\n}", "function timeoutDefer(fn) {\r\n\tvar time = +new Date(),\r\n\t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n\tlastTime = time + timeToCall;\r\n\treturn window.setTimeout(fn, timeToCall);\r\n}", "function timeoutDefer(fn) {\r\n\tvar time = +new Date(),\r\n\t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n\tlastTime = time + timeToCall;\r\n\treturn window.setTimeout(fn, timeToCall);\r\n}", "function timeoutDefer(fn) {\r\n\tvar time = +new Date(),\r\n\t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n\tlastTime = time + timeToCall;\r\n\treturn window.setTimeout(fn, timeToCall);\r\n}", "function timeoutDefer(fn) {\r\n\tvar time = +new Date(),\r\n\t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n\tlastTime = time + timeToCall;\r\n\treturn window.setTimeout(fn, timeToCall);\r\n}", "function timeoutDefer(fn) {\r\n\tvar time = +new Date(),\r\n\t timeToCall = Math.max(0, 16 - (time - lastTime));\r\n\r\n\tlastTime = time + timeToCall;\r\n\treturn window.setTimeout(fn, timeToCall);\r\n}", "function timeoutPromise(racedPromise, milliseconds, valueAfterTimeout) {\n var timeoutPromise = new Promise(function (resolve) {\n window.setTimeout(function () {\n return resolve(valueAfterTimeout);\n }, milliseconds);\n });\n return Promise.race([racedPromise, timeoutPromise]);\n}", "function zeroTimeout() {\n return new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n}", "function retornaValor() {\r\n return new Promise(resolve => {\r\n setTimeout(() => resolve(10), 5000);\r\n });\r\n}", "function promise(func, res){\nsetTimeout(function(){func.then(dt => {res(dt)})},5000)\n}", "function tercerPromesa() {\n return new Promise((res, rej) => setTimeout(res, 600, \"Tercer hola mundo\"));\n}", "pause(time) {\r\n return new Promise((resolve) => setTimeout(resolve, time * 1000));\r\n }", "function delayV2() {\n return new Promise((resolve, reject) => {\n //wrap existing callbacks inside promise,so other developer use only promise.\n setTimeout(resolve, 6000, 'Hello!Promise');\n });\n}", "function retornarValor() {\n return new Promise (resolve => {\n setTimeout(() => resolve(10), 5000)\n })\n}", "function sleeper(ms) {\n return function (x) {\n return new Promise(resolve => setTimeout(() => resolve(x), ms));\n };\n }", "function timeoutResolver (deferred) {\n setTimeout(function () {\n deferred.reject(Error('timeout'))\n }, 1000)\n}", "function setTimeOutPromise(time) {\r\n return new Promise((res, rej) => {\r\n setTimeout(() => {\r\n res(`resolved in ${time} seconds`);\r\n // rej('rejected in a sec');\r\n }, time * 1000);\r\n\r\n });\r\n\r\n}", "function setTimeoutPromise(setTime){\n \n return new Promise(resolve=>{\n setTimeout(() => {\n \n resolve();\n \n \n }, setTime); \n }) \n \n}", "function sleep( timeout ) {\n\n return new Promise(resolve => setTimeout(resolve, timeout));\n\n}", "function timeout(seconds) {\n return new Promise(function (_, reject) {\n setTimeout(function () {\n reject(new Error('request took too long'));\n }, seconds * 1000);\n });\n}", "function sleeper(ms) {\n\treturn function (x) {\n\t\treturn new Promise(resolve => setTimeout(() => resolve(x), ms));\n\t};\n}", "function o(){throw new Error(\"setTimeout has not been defined\")}", "function delay(t) {\n\treturn new Promise(function(resolve) {\n\t\tsetTimeout(resolve, t);\n\t});\n}", "function timer(start, duration, repeat_Interval, repeat_Func) {\n function start_Interval(len, rep_time, rep_func) {\n //start given function at the interval given\n let intervalID = (setInterval(rep_func, rep_time))\n\n //setup function to clear the interval set above\n //after the len of time (in ms) has passed\n setTimeout(()=>clearInterval(intervalID), len)\n\n return intervalID\n }\n let root = this;\n let cancelID;\n root.intID = new Promise(function(resolve){\n return cancelID = setTimeout(()=>{\n result = start_Interval(duration, repeat_Interval, repeat_Func);\n resolve(result)\n }, start)\n })\n //output consists of the first element of the array to be the ID used to\n //cancel the inital setTimeout (before it starts), and the second element\n //of the array to be a Promise that returns the result\n return [cancelID, root.intID]\n}", "function timer(ms, func) {\n var ref;\n if (ms) {\n ref = setTimeout(func, ms);\n } else {\n ref = setImmediate(func);\n }\n return function abortTimer() {\n if (ms) {\n clearTimeout(ref);\n } else {\n clearImmediate(ref);\n }\n };\n}", "function bluePhaseTimeoutFunction(){\n bluePhaseTimeout = setTimeout(endBlueGhostPhase, 5000)\n }", "function cancellableTimeout(f, milliseconds) {\n\tvar timerId = 0;\n\n\tif (Number(milliseconds) === NaN || milliseconds <= 0) throw new Error('time:' + milliseconds + ' must be a number greater than zero.');\n\tif (typeof f !== 'function') throw new Error('action is not a function');\n\n\treturn {\n\t\tpromise: function promise(arg) {\n\t\t\treturn new Promise(function (resolve, reject) {\n\t\t\t\ttimerId = setTimeout(function () {\n\t\t\t\t\ttimerId = 0;\n\t\t\t\t\tresolve(f.call(undefined, arg));\n\t\t\t\t}, Number(milliseconds));\n\t\t\t});\n\t\t},\n\t\tcancel: function cancel() {\n\t\t\tif (timerId > 0) {\n\t\t\t\tclearTimeout(timerId);\n\t\t\t}\n\t\t}\n\t};\n}", "function setTimeout(f,r) { return f(); }", "function timeoutPromise(ms, message) {\n return new Promise((resolve, reject) => {\n let id = setTimeout(() => {\n clearTimeout(id);\n reject(message);\n }, ms);\n });\n}" ]
[ "0.692368", "0.6794298", "0.6661205", "0.64586014", "0.6369239", "0.6356154", "0.6314156", "0.6314156", "0.6314156", "0.62891346", "0.62516814", "0.6213788", "0.6203829", "0.61843014", "0.61169535", "0.60962045", "0.6076807", "0.6047119", "0.60334164", "0.6032602", "0.60030526", "0.5965901", "0.5954268", "0.59133106", "0.5906746", "0.5855145", "0.5833972", "0.575724", "0.5743975", "0.5719328", "0.5705017", "0.56980556", "0.56980556", "0.5697379", "0.56929827", "0.56929827", "0.56922716", "0.56837183", "0.5680813", "0.5667094", "0.5663215", "0.5659537", "0.5656102", "0.5647088", "0.5637917", "0.5633769", "0.56260926", "0.56260926", "0.56212103", "0.56198037", "0.5618082", "0.56142104", "0.56136054", "0.5612841", "0.56118506", "0.55994916", "0.5598649", "0.55963045", "0.5596166", "0.5591917", "0.55897397", "0.55897397", "0.55897397", "0.55897397", "0.55897397", "0.55897397", "0.5584835", "0.5581179", "0.55774933", "0.55735195", "0.55641603", "0.55641603", "0.55641603", "0.55641603", "0.55641603", "0.55641603", "0.55641603", "0.55516255", "0.5535032", "0.5533938", "0.55286914", "0.55250394", "0.5519552", "0.55194074", "0.5502686", "0.5490308", "0.5488094", "0.5478949", "0.54754657", "0.5473575", "0.54662067", "0.54649025", "0.5451946", "0.5450308", "0.5449523", "0.5445342", "0.54432297", "0.5441352", "0.54325694", "0.5428391" ]
0.556977
70
A general purpose asynchronous looping function
function asyncWhile(conditionFunction, workFunction) { function loop() { return WinJS.Promise.as(conditionFunction()). then(function (shouldContinue) { if (shouldContinue) { return WinJS.Promise.as(workFunction()).then(loop); } else { return WinJS.Promise.wrap(); } }); } return loop(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "loop() {}", "loop() {}", "function asyncLoop(iterations, func, callback) {\nvar index = 0;\nvar done = false;\nvar loop = {\n next: function() {\n if (done) {\n return;\n }\n\n if (index < iterations) {\n index++;\n func(loop);\n\n } else {\n done = true;\n callback();\n }\n },\n\n iteration: function() {\n return index - 1;\n },\n\n break: function() {\n done = true;\n callback();\n }\n};\nloop.next();\nreturn loop;\n}", "function asyncLoop(iterations, func, callback) {\n var index = 0;\n var done = false;\n var loop = {\n next: function() {\n if (done) return;\n if (index < iterations) {\n index += 1;\n func(loop);\n } else {\n done = true;\n if (callback) callback();\n }\n },\n iteration: function() {\n return index - 1;\n },\n break: function() {\n done = true;\n if (callback) callback();\n }\n };\n loop.next();\n return loop;\n }", "function loop() {\r\n}", "function loop(value, testFn, updateFn, bodyFn) {}", "async loopFunction(iterate) {\n \t\tlet results = [];\n \t\twhile (true) {\n let result = await iterate.next();\n if (result.value && result.value.value.toString()) {\n \t\t\t\tresults.push(JSON.parse(result.value.value.toString('utf8')));\n }\n if (result.done) {\n \t\t\t\tawait iterate.close();\n return results;\n }\n }\n \t}", "function TaskLoop() {\n\t\n}", "async function loop() {\r\n\twhile (true) {\r\n\t\tawait wait();\r\n\t\tawait observer();\r\n\t}\r\n}", "async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await (0, exports.nextTick)();\n ts += diff;\n }\n}", "function loopForever() {\n while (true) { }\n}", "async function loop(num, fn, ...fnArgs){\n for(let i = 0; i<num; i++){\n console.log(\"loop start\");\n try{\n await fn(...fnArgs);\n console.log(\"loop end\");\n } catch(e){\n console.log(e);\n console.log(\"loop error\");\n }\n // console.log(\"loop end\");\n // await sleep(1000);\n }\n}", "loop(fn) {\n let schedule = this;\n const coroutine = Promise.coroutine(function*() {\n let doItAgain = true;\n let result = undefined;\n\n function next(date) {\n if (date)\n schedule = date;\n\n doItAgain = true;\n }\n\n while(doItAgain) {\n doItAgain = false;\n debug(\"Waiting for\", schedule);\n yield schedule.wait();\n\n result = yield Promise.resolve(fn(schedule, next));\n }\n\n return result;\n });\n\n return coroutine();\n }", "async iterator() {\n return iteratorFn();\n }", "function myLoop() { // create a loop function\n setTimeout(function () { // call a 3s setTimeout when the loop is called\n getDownloadUrl(sectionList[i], function (videourl) {\n console.log(videourl);\n })\n i++; // increment the counter\n if (i < sectionList.length) { // if the counter < 10, call the loop function\n myLoop(); // .. again which will trigger another \n } // .. setTimeout()\n }, 30000)\n}", "function loopData() {\n\n}", "function loop() {\n api.ping(function (err, message) {\n if (err) throw err;\n console.log(\"Got %s from parent\", message);\n })\n setTimeout(loop, Math.random() * 1000);\n }", "function loop(start, test, update, body) {\n for (let value = start; test(value); value = update(value)) {\n body(value);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n }", "function loop(i, test, update, body)\n{\n while (true)\n {\n if (!test(i))\n break;\n \n body(i);\n i = update(i);\n }\n}", "async function forAwait(iterable, cb) {\n const iter = getIterator(iterable);\n while (true) {\n const { value, done } = await iter.next();\n if (value) await cb(value);\n if (done) break\n }\n if (iter.return) iter.return();\n}", "async function forAwait(iterable, cb) {\n const iter = getIterator(iterable);\n while (true) {\n const { value, done } = await iter.next();\n if (value) await cb(value);\n if (done) break\n }\n if (iter.return) iter.return();\n}", "function loopIt(numberOfLoops, callback) {\n var counter = 1;\n\n function looper(start, stop) {\n callback();\n if (start < stop) {\n\n return looper(start += 1, stop);\n }\n }\n\n looper(counter, numberOfLoops);\n}", "function loopInfinito() {\n while (true) { }\n}", "function loop() {\r\n // if (is_loop) {\r\n setTimeout(manage_loop, manager.interval);\r\n // is_loop = false;\r\n // }\r\n }", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n}", "waitForCompletionLoop () {\n setTimeout(async () => {\n // Main loop\n while (!this.stopped) {\n // Wait for both execution and interval\n await Promise.all([\n this.tick(),\n new Promise((resolve) => {\n setTimeout(function () {\n resolve()\n }, this.interval)\n })\n ])\n }\n }, 0)\n }", "function loop(value, test, update, body) {\n if (test(value)) {\n body(value);\n } else return; \n return loop(update(value),test,update,body);\n\n\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n }", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n }", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n }", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n }", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n }", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n }", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n workInProgress = performUnitOfWork(workInProgress);\n }\n }", "startLoop () {\n this.loop = true;\n\n while (this.loop) {\n switch (this.state) {\n case GET_INFO:\n this.getInfo();\n break;\n case GET_PAYLOAD_LENGTH_16:\n this.getPayloadLength16();\n break;\n case GET_PAYLOAD_LENGTH_64:\n this.getPayloadLength64();\n break;\n case GET_MASK:\n this.getMask();\n break;\n case GET_DATA:\n this.getData();\n break;\n default: // `INFLATING`\n this.loop = false;\n }\n }\n }", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n}", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n }", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n }", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n }", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n }", "function workLoopSync() {\n // Already timed out, so perform work without checking if we need to yield.\n while (workInProgress !== null) {\n performUnitOfWork(workInProgress);\n }\n }", "function get_data_loop()\r\n{\r\n if(!ansvers){\r\n \tget_data();\r\n \tansvers = 1;\r\n }\r\n \tsetTimeout(\"get_data_loop()\",10000);\r\n}", "function loop$1(callback) {\n var task;\n if (tasks$1.size === 0) raf$1(run_tasks$1);\n return {\n promise: new Promise(function (fulfill) {\n tasks$1.add(task = {\n c: callback,\n f: fulfill\n });\n }),\n abort: function abort() {\n tasks$1[\"delete\"](task);\n }\n };\n }", "function controlLoop(){\r\n refreshData();\r\n setInterval(refreshData,10000);\r\n}", "async function foo() {\n for (;;await[]) {\n break;\n }\n}", "function loop_request(){\r\n let waisted_count = 0; // set to 0\r\n \r\n //requset from api\r\n async function StartR() \r\n {\r\n // request, fetch api data\r\n const response = await fetch(api_url); //fetch\r\n const data = await response.json(); //api\r\n let json_split = JSON.parse(JSON.stringify(data)); // split api data\r\n\r\n // only for the first request\r\n if (beginvar == true){\r\n console.log(\"first try\");\r\n render_call(json_split, waisted_count, beginvar);\r\n last_api = json_split[0].id;\r\n beginvar = false; \r\n } \r\n else{\r\n console.log(\"secound try\");\r\n waisted_count = while_count(last_api, json_split);\r\n render_call(json_split, waisted_count, beginvar);\r\n }\r\n console.log(\"assync vege 15perc \" + \"Last API: \" + last_api);\r\n }\r\n StartR();\r\n}", "startLoop () {\n\t this.loop = true;\n\n\t while (this.loop) {\n\t switch (this.state) {\n\t case GET_INFO:\n\t this.getInfo();\n\t break;\n\t case GET_PAYLOAD_LENGTH_16:\n\t this.getPayloadLength16();\n\t break;\n\t case GET_PAYLOAD_LENGTH_64:\n\t this.getPayloadLength64();\n\t break;\n\t case GET_MASK:\n\t this.getMask();\n\t break;\n\t case GET_DATA:\n\t this.getData();\n\t break;\n\t default: // `INFLATING`\n\t this.loop = false;\n\t }\n\t }\n\t }", "function loop(t, f) {\n let stopped = false;\n\n const newF = () => {\n if (stopped) {\n return;\n }\n f();\n wait(t, newF);\n };\n\n newF();\n\n return () => (stopped = true);\n }", "async function g() {\n for await (const x of createAsyncIterable(['e', 'f', 'g'])) {\n console.log(x);\n break;\n }\n}", "startLoop () {\n this._loop = true;\n\n do {\n switch (this._state) {\n case GET_INFO:\n this.getInfo();\n break;\n case GET_PAYLOAD_LENGTH_16:\n this.getPayloadLength16();\n break;\n case GET_PAYLOAD_LENGTH_64:\n this.getPayloadLength64();\n break;\n case GET_MASK:\n this.getMask();\n break;\n case GET_DATA:\n this.getData();\n break;\n default: // `INFLATING`\n this._loop = false;\n }\n } while (this._loop);\n }", "function loop ( start, test, updt, body ) {\r\n let val = start;\r\n while (test(val)) {\r\n body (val)\r\n val = updt (val)\r\n } \r\n}", "startLoop () {\n this._loop = true;\n\n while (this._loop) {\n switch (this._state) {\n case GET_INFO:\n this.getInfo();\n break;\n case GET_PAYLOAD_LENGTH_16:\n this.getPayloadLength16();\n break;\n case GET_PAYLOAD_LENGTH_64:\n this.getPayloadLength64();\n break;\n case GET_MASK:\n this.getMask();\n break;\n case GET_DATA:\n this.getData();\n break;\n default: // `INFLATING`\n this._loop = false;\n }\n }\n }", "static loop(func, time) {\n this.loopId = setInterval(func, time);\n }", "static loop(func, time) {\n this.loopId = setInterval(func, time);\n }", "async * [Symbol.asyncIterator]() {\n try {\n while (1) {\n await last[_p]\n yield last.get()\n }\n } catch (e) {\n } finally {\n }\n }", "async function scenario2() { // eslint-disable-line no-unused-vars\n console.log(`Scenario2: Sequential Scenario using for..of`);\n const nums = [1, 2, 3, 4, 5];\n \n \n async function processArray(array) {\n const results = [];\n for (const item of array) {\n const processedItem = await asyncOperation(item); // using for of results in blocking\n results.push(processedItem);\n }\n return results;\n }\n \n async function asyncOperation(item) {\n return new Promise(resolve => {\n setTimeout(() => {\n console.log(`Asynchronously processing item ${ item }`);\n resolve(item + 1);\n }, 1000);\n });\n }\n \n console.log(`before processing = ${ nums }`);\n const processedNums = await processArray(nums); // This does not block\n console.log(`after processing = ${ processedNums }`);\n console.log(`===========================\\n`); \n}" ]
[ "0.72461885", "0.72461885", "0.7172995", "0.70806426", "0.7041076", "0.6972913", "0.6813423", "0.670328", "0.6668472", "0.6651891", "0.6619193", "0.6540084", "0.64790845", "0.64158434", "0.63714194", "0.63507307", "0.62406176", "0.6235394", "0.6219778", "0.6201414", "0.61760986", "0.61760986", "0.61716163", "0.616738", "0.6153453", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61490685", "0.61443454", "0.6136296", "0.612739", "0.612739", "0.612739", "0.612739", "0.612739", "0.612739", "0.612739", "0.6108797", "0.61080134", "0.61080134", "0.61080134", "0.61080134", "0.61080134", "0.61080134", "0.61080134", "0.61080134", "0.61080134", "0.61080134", "0.61080134", "0.61080134", "0.61080134", "0.61080134", "0.61080134", "0.61080134", "0.6075071", "0.6075071", "0.6075071", "0.6075071", "0.6075071", "0.60577786", "0.6017318", "0.6015816", "0.6014242", "0.60024875", "0.59963214", "0.59869844", "0.59836346", "0.59825957", "0.59815377", "0.5980432", "0.5978253", "0.5978253", "0.59746397", "0.5974105" ]
0.60111964
89
TODO this is ugly, fux it!
function onTask1ButtonClick() { resultPlace.innerHTML = task1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static private internal function m121() {}", "static final private internal function m106() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "static transient final private internal function m43() {}", "static transient private protected internal function m55() {}", "static transient final protected internal function m47() {}", "transient final protected internal function m174() {}", "static private protected internal function m118() {}", "transient private protected public internal function m181() {}", "static transient final private protected internal function m40() {}", "static transient final protected public internal function m46() {}", "static transient private protected public internal function m54() {}", "obtain(){}", "transient final private protected internal function m167() {}", "static transient private internal function m58() {}", "apply () {}", "function Hx(a){return a&&a.ic?a.Mb():a}", "transient final private internal function m170() {}", "static final private protected internal function m103() {}", "static protected internal function m125() {}", "static transient private public function m56() {}", "function find() {}", "function __it() {}", "function ze(a){return a&&a.ae?a.ed():a}", "__previnit(){}", "static transient final protected function m44() {}", "static transient final private protected public internal function m39() {}", "static private protected public internal function m117() {}", "static final private public function m104() {}", "function StupidBug() {}", "prepare() {}", "function a(e){return void 0===e&&(e=null),Object(r[\"p\"])(null!==e?e:i)}", "transient private public function m183() {}", "lowX() {return this.stringX()}", "function o1109()\n{\n var o1 = {};\n var o2 = \"aabccddeeffaaggaabbaabaabaab\".e(/((aa))/);\n try {\nfor(var o3 in e)\n { \n try {\nif(o4.o11([7,8,9,10], o109, \"slice(-4) returns the last 4 elements - [7,8,9,10]\"))\n { \n try {\no4.o5(\"propertyFound\");\n}catch(e){}\n }\n}catch(e){}\n }\n}catch(e){}\n try {\nreturn o2;\n}catch(e){}\n}", "function sr(e,t){Object.keys(e).forEach((function(n){return t(e[n],n)}))}", "function i(e,t){return t}", "function o0(o1)\n{\n var o2 = -1;\n try {\nfor (var o259 = 0; o3 < o1.length; function (o502, name, o38, o781, o782, o837, o585, o838, o549) {\n try {\no839.o468();\n}catch(e){}\n // TODO we should allow people to just pass in a complete filename instead\n // of parent and name being that we just join them anyways\n var o840 = name ? o591.resolve(o591.o592(o502, name)) : o502;\n\n function o841(o842) {\n function o843(o842) {\n try {\nif (!o838) {\n try {\no474.o800(o502, name, o842, o781, o782, o549);\n}catch(e){}\n }\n}catch(e){}\n try {\nif (o837) try {\no837();\n}catch(e){}\n}catch(e){}\n try {\no334('cp ' + o840);\n}catch(e){}\n }\n var o844 = false;\n try {\nModule['preloadPlugins'].forEach(function (o845) {\n try {\nif (o844) try {\nreturn;\n}catch(e){}\n}catch(e){}\n try {\nif (o845['canHandle'](o840)) {\n try {\no845['handle'](o842, o840, o843, function () {\n try {\nif (o585) try {\no585();\n}catch(e){}\n}catch(e){}\n try {\no334('cp ' + o840);\n}catch(e){}\n });\n}catch(e){}\n try {\no844 = true;\n}catch(e){}\n }\n}catch(e){}\n });\n}catch(e){}\n try {\nif (!o844) try {\no843(o842);\n}catch(e){}\n}catch(e){}\n }\n try {\no332('cp ' + o840);\n}catch(e){}\n try {\nif (typeof o38 == 'string') {\n try {\no839.o846(o38, function (o842) {\n try {\no841(o842);\n}catch(e){}\n }, o585);\n}catch(e){}\n } else {\n try {\no841(o38);\n}catch(e){}\n }\n}catch(e){}\n })\n {\n try {\nif (o1[o3] == undefined)\n {\n try {\nif (o2 == -1)\n {\n try {\no2 = o3;\n}catch(e){}\n }\n}catch(e){}\n }\n else\n {\n try {\nif (o2 != -1)\n {\n try {\no4.o5(o2 + \"-\" + (o3-1) + \" = undefined\");\n}catch(e){}\n try {\no2 = -1;\n}catch(e){}\n }\n}catch(e){}\n try {\no4.o5(o3 + \" = \" + o1[o3]);\n}catch(e){}\n }\n}catch(e){}\n }\n}catch(e){}\n}", "static final private protected public internal function m102() {}", "static transient protected internal function m62() {}", "function l(e){var n={};return me.each(e.match(Ae)||[],function(e,t){n[t]=!0}),n}", "function _____SHARED_functions_____(){}", "function DWRUtil() { }", "function TMP(){return;}", "function TMP(){return;}", "function miFuncion (){}", "lastUsed() { }", "static transient final private public function m41() {}", "function i(t,e){return e.split(\".\").reduce((function(t,e){return t[e]}),t)}", "function i(t,e){return e.split(\".\").reduce((function(t,e){return t[e]}),t)}", "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 l(){t={},u=\"\",w=\"\"}", "static transient final private protected public function m38() {}", "function $t(t,e){Object.keys(t).forEach(function(n){return e(t[n],n)})}", "function s(e){return e}", "static final protected internal function m110() {}", "function gatherStrings(obj) {\n\n}", "match(input){ return null }", "static get END() { return 6; }", "_firstRendered() { }", "transient final private protected public internal function m166() {}", "function i(t){return void 0===t&&(t=null),Object(r[\"l\"])(null!==t?t:o)}", "function GraFlicUtil(paramz){\n\t\n}", "function o0(o1)\n{\n try {\nfor (var o51 = \"foo22\" in o1)\n {\n try {\no3.o4(o2 + \" = \" + o1[o2]);\n}catch(e){}\n }\n}catch(e){}\n}", "function i(e){return g[e]}", "function Sr(e,t){Object.keys(e).forEach((function(n){return t(e[n],n)}))}", "function r() {}", "function r() {}", "function r() {}", "function AeUtil() {}", "function undici () {}", "function _0x329edd(_0x38ef9f){return function(){return _0x38ef9f;};}", "find(input) {}", "function dummy(){}", "function dummy(){}", "function dummy(){}", "function findCanonicalReferences() {\n\n }", "function r(t,e){return e.split(\".\").reduce((function(t,e){return t[e]}),t)}", "function r(t,e){return e.split(\".\").reduce((function(t,e){return t[e]}),t)}", "function r(t,e){return e.split(\".\").reduce((function(t,e){return t[e]}),t)}", "function oi(){}", "function st(e,t){Object.keys(e).forEach(function(n){return t(e[n],n)})}", "function ea(){}", "getResult() {}" ]
[ "0.6259916", "0.60524917", "0.5910974", "0.5601794", "0.5559397", "0.5552204", "0.5447177", "0.53826153", "0.53333807", "0.52727056", "0.5226325", "0.5216695", "0.5129453", "0.50363356", "0.50354457", "0.5033487", "0.49476758", "0.49302447", "0.49243104", "0.4894097", "0.488793", "0.48851314", "0.48767915", "0.4858398", "0.48421517", "0.4821775", "0.4792144", "0.4788077", "0.47841987", "0.47535196", "0.4747975", "0.47047192", "0.46934596", "0.46792907", "0.4672397", "0.4668019", "0.46620277", "0.46594524", "0.46472093", "0.46419552", "0.463836", "0.46362185", "0.4598393", "0.45932925", "0.45927235", "0.45870814", "0.4583822", "0.45785362", "0.4576119", "0.4576119", "0.45642033", "0.45627752", "0.45572156", "0.45568526", "0.45568526", "0.45527858", "0.45527858", "0.45527858", "0.45527858", "0.45527858", "0.45527858", "0.45527858", "0.45527858", "0.45527858", "0.45527858", "0.45527858", "0.45527858", "0.45527858", "0.45520845", "0.45460254", "0.4544346", "0.45423558", "0.4533314", "0.45283145", "0.45218104", "0.45126063", "0.4508936", "0.44875193", "0.4484594", "0.44723603", "0.44647157", "0.44635767", "0.44562468", "0.44497126", "0.44497126", "0.44497126", "0.44491282", "0.44482756", "0.4446032", "0.44459814", "0.4440223", "0.4440223", "0.4440223", "0.44362652", "0.44274053", "0.44274053", "0.44274053", "0.44267833", "0.44258174", "0.44234887", "0.4419916" ]
0.0
-1
Restores select box and checkbox state using the preferences stored in chrome.storage.
function restoreOptions() { console.log('restoreOptions') // Use default value color = 'red' and likesColor = true. chrome.storage.local.get({ maximumSize: 100, }, function(items) { console.log(items) document.getElementById('maximumSize').value = items.maximumSize }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function restore_options() {\n $('#options-list input[type=\"checkbox\"]').each(function() {\n var obj = {};\n var check = $(this);\n obj[$(this).attr('id')] = 1;\n chrome.storage.sync.get(obj,\n function(item) {\n $(\"#\" + check.attr('id')).prop(\"checked\", item[check.attr('id')]);\n }\n );\n });\n $('#options-list input[type=\"text\"]').each(function() {\n var obj = {};\n var text = $(this);\n obj[$(this).attr('id')] = $(this).text();\n chrome.storage.sync.get(obj,\n function(item) {\n $(\"#\" + text.attr('id')).prop(\"value\", item[text.attr('id')]);\n }\n );\n });\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n panel: true,\n remove: true,\n notify: true,\n restyle: true,\n console: false,\n console_deep: false,\n }, (items) => {\n for (let item in items) {\n document.getElementById(item).checked = items[item];\n }\n });\n}", "function restoreOptions() {\n // Default values.\n chrome.storage.sync.get({\n notifications: true,\n counters: true,\n buttons: true,\n }, function(items) {\n $(INPUT_NOTIFICATIONS_SELECTOR).prop('checked', items.notifications);\n $(INPUT_COUNTERS_SELECTOR).prop('checked', items.counters);\n $(INPUT_BUTTONS_SELECTOR).prop('checked', items.buttons);\n });\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n \"gore\": false,\n \"bugs\": false,\n \"swears\": false,\n \"slurs\": false,\n \"nsfw\": true,\n \"selfharm\": false,\n \"drugs\": false,\n \"war\": false,\n \"scary\": false,\n \"suicide\": false,\n \"firsttime\": true,\n \"bans\": \"\"\n }, function(items) {\n document.getElementById('gore').checked = items.gore;\n document.getElementById('bugs').checked = items.bugs;\n document.getElementById('swears').checked = items.swears;\n document.getElementById('slurs').checked = items.slurs;\n document.getElementById('nsfw').checked = items.nsfw;\n document.getElementById('self-harm').checked = items.selfharm;\n document.getElementById('drugs').checked = items.drugs;\n document.getElementById('war').checked = items.war;\n document.getElementById('scary').checked = items.scary;\n document.getElementById('suicide').checked = items.suicide;\n document.getElementById('bans').value = items.bans;\n });\n}", "function restore_options() {\r\n chrome.storage.sync.get({\r\n hideExtensions: false,\r\n autoTheatre: false,\r\n cursorMute: false\r\n }, function(items) {\r\n document.getElementById('hideExtensions').checked = items.hideExtensions;\r\n document.getElementById('autoTheatre').checked = items.autoTheatre;\r\n document.getElementById('cursorMute').checked = items.cursorMute;\r\n });\r\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n darkGithub: false,\n darkSemaphore: false,\n darkLogentries: false,\n darkThundertix: false,\n darkThunderstage: false,\n darkThunderlocal: false\n }, function(items) {\n document.getElementById('dark_github').checked = items.darkGithub;\n document.getElementById('dark_semaphore').checked = items.darkSemaphore;\n document.getElementById('dark_logentries').checked = items.darkLogentries;\n document.getElementById('dark_thundertix').checked = items.darkThundertix;\n document.getElementById('dark_thunderstage').checked = items.darkThunderstage;\n document.getElementById('dark_localthundertix').checked = items.darkThunderlocal;\n });\n}", "function restoreOptions() {\n // defaults set to true\n chrome.storage.sync.get({\n translateHeadings: true,\n translateParagraphs: true,\n translateOthers: true,\n azurekey: ''\n }, function (items) {\n document.getElementById('selectorH').checked = items.translateHeadings\n document.getElementById('selectorP').checked = items.translateParagraphs\n document.getElementById('selectorOthers').checked = items.translateOthers\n if (items.azurekey != '') {\n document.getElementById('key').value = '***'\n }\n });\n}", "function restore_options() {\n\tfor( i in pOptions){\n\t\tif(typeof(pOptions[i].def)=='boolean')\n\t\t\tdocument.getElementById(i).checked = ((localStorage[i]=='true')?true:pOptions[i].def);\n\t\telse\n\t\t\tdocument.getElementById(i).value = ((localStorage[i])?localStorage[i]:pOptions[i].def);\n\t}\n\n\n// var favorite = localStorage[\"favorite_color\"];\n// if (!favorite) {\n// return;\n// }\n// var select = document.getElementById(\"color\");\n// for (var i = 0; i < select.children.length; i++) {\n// var child = select.children[i];\n// if (child.value == favorite) {\n// child.selected = \"true\";\n// break;\n// }\n// }\n}", "function restore_options() {\n chrome.storage.sync.get({\n definitionsCheckbox: 0,\n examplesCheckbox: 0,\n windowWidth: 1024,\n windowHeight: 768\n }, function (items) {\n document.getElementById('definitionsCheckbox').checked = items.definitionsCheckbox;\n document.getElementById('examplesCheckbox').checked = items.examplesCheckbox;\n document.getElementById('windowWidth').value = items.windowWidth;\n document.getElementById('windowHeight').value = items.windowHeight;\n });\n}", "function restore_options() {\n chrome.storage.sync.get({\n showBrowserNotifications: true,\n showAccumulatedPoints: false,\n hideBonusChests: false,\n }, function(items) {\n document.getElementById('showBrowserNotifications').checked = items.showBrowserNotifications;\n document.getElementById('showAccumulatedPoints').checked = items.showAccumulatedPoints;\n document.getElementById('hideBonusChests').checked = items.hideBonusChests;\n });\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.local.get({\n 'checkFrequency': 15000,\n 'notificationEnable': false,\n 'alertEnable': false,\n 'notificationTimeout': 30000,\n 'notificationEnableStatus': false,\n 'notificationEnablePlayers': false,\n 'notificationPlayerList': 'Banxsi, externo6, LukeHandle'\n }, function (items) {\n document.getElementById('checkFrequency').value = items.checkFrequency;\n document.getElementById('notificationEnable').checked = items.notificationEnable;\n document.getElementById('alertEnable').checked = items.alertEnable;\n document.getElementById('notificationTimeout').value = items.notificationTimeout;\n document.getElementById('notificationEnableStatus').checked = items.notificationEnableStatus;\n document.getElementById('notificationEnablePlayers').checked = items.notificationEnablePlayers;\n document.getElementById('notificationPlayerList').value = items.notificationPlayerList;\n });\n}", "function restore_options() {\n assignNodeReferences();\n chrome.storage.sync.get({\n payWallOption: true,\n adRemovalOption: true,\n trumpOption: true,\n trumpNameOption: 'florida man',\n yoHeaderOption: true,\n yoSuffixOption: 'yo'\n }, function(items) {\n payWallOption.checked = items.payWallOption;\n adRemovalOption.checked = items.adRemovalOption;\n trumpOption.checked = items.trumpOption;\n trumpNameOption.value = items.trumpNameOption.slice(0,30).toLowerCase();\n yoSuffixOption.value = items.yoSuffixOption.slice(0,30).toLowerCase();\n yoHeaderOption.checked = items.yoHeaderOption;\n closeButton.addEventListener(\"click\", function() {save_options()});\n closeButton.removeAttribute('disabled');\n });\n}", "function restoreOptions() {\n var i, len, elements, elem, setting, set;\n\n elements = mainview.querySelectorAll('#skinSection input');\n for (i = 0, len = elements.length ; i < len ; i += 1) {\n elem = elements[i];\n if (elem.value === localStorage[elem.name]) {\n elem.checked = true;\n }\n else {\n elem.checked = false;\n }\n }\n\n elements = mainview.querySelectorAll('#dictSection select');\n for (i = 0, len = elements.length ; i < len ; i += 1) {\n elem = elements[i];\n elem.querySelector('option[value=' + localStorage[elem.name] + ']').selected = true;\n }\n\n\n elements = mainview.querySelectorAll('#captureSection tbody tr');\n setting = JSON.parse(localStorage.capture);\n for (i = 0, len = elements.length ; i < len ; i += 1) {\n elem = elements[i];\n set = setting[i];\n elem.querySelector('input').checked = set.status;\n elem.querySelector('select').value = set.assistKey;\n }\n }", "function restoreOptions()\n{\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get(\n {\n 'favoriteColor': 'red',\n 'likesColor': true\n },\n function(items)\n {\n color_select.value = items.favoriteColor;\n color_selected.textContent = items.favoriteColor;\n color_selected.style.color = items.favoriteColor;\n like_checkbox.checked = items.likesColor;\n }\n );\n}", "function restore_options() {\n chrome.storage.sync.get(\n\t\tchrome.extension.getBackgroundPage().defaultSettings, \n \t\tfunction (settings) {\n \t\t\tdocument.getElementById(settings.o_theme).checked = true;\n \t\t\tdocument.getElementById(settings.o_live_output).checked = true;\n \t\t\tfor (let i = 0; i < settings.o_live_direction.length; i++) {\n \t\t\t\tdocument.getElementById(settings.o_live_direction[i]).checked = true;\n \t\t\t}\n \t\t\tfor (let i = 0; i < settings.o_live_type.length; i++) {\n \t\t\t\tdocument.getElementById(settings.o_live_type[i]).checked = true;\n \t\t\t}\n \t\t\tdocument.getElementById(settings.o_live_donation).checked = true;\n\n \t\t\tchrome.extension.getBackgroundPage().currentSettings = settings;\n \t\t}\n \t);\n}", "function restore_options() {\n chrome.storage.sync.get({\n fb: true,\n gmail: true,\n timeout: 600,\n alert: true\n }, function(items) {\n document.getElementById('fb').checked = items.fb;\n document.getElementById('gmail').checked = items.gmail;\n document.getElementById('timeout').value = items.timeout;\n document.getElementById('units').value = 'sec';\n document.getElementById('alert').checked = items.alert;\n });\n}", "function restore_options() {\n chrome.storage.sync.get({\n // Set defaults.\n\ttitleEnabled: true,\n metaDescEnabled: true,\n\th1Enabled: true,\n\th2Enabled: false,\n\twmtEnabled: true,\n\tgaEnabled: true,\n\typaEnabled: false,\n\timgAltEnabled: false\n }, function(items) {\n document.getElementById('titleEnable').checked = items.titleEnabled;\n document.getElementById('metaDescEnable').checked = items.metaDescEnabled;\n\tdocument.getElementById('h1Enable').checked = items.h1Enabled;\n\tdocument.getElementById('h2Enable').checked = items.h2Enabled;\n\tdocument.getElementById('wmtEnable').checked = items.wmtEnabled;\n\tdocument.getElementById('gaEnable').checked = items.gaEnabled;\n\tdocument.getElementById('ypaEnable').checked = items.ypaEnabled;\n\tdocument.getElementById('imgAltEnable').checked = items.imgAltEnabled;\n\tdocument.getElementById('mainDiv').style.display = \"inline\";\n\tdocument.getElementById('loadingDiv').style.display = \"none\";\n });\n}", "function restore_options() {\n var settings = getFromLocalStorage(\"settings\");\n document.getElementById('apply').checked = settings.apply;\n document.getElementById('show').checked = settings.show;\n}", "function restore_options() {\n\n chrome.storage.sync.get({\n colourBlindMode: false,\n hideAOM: false,\n checkCreditBalances: false,\n highlightNegativesNegative: false,\n enableRetroCalculator: true,\n budgetRowsHeight: 0,\n categoryPopupWidth: 0\n }, function(items) {\n document.getElementById('colourBlindMode').checked = items.colourBlindMode;\n document.getElementById('hideAOM').checked = items.hideAOM;\n document.getElementById('checkCreditBalances').checked = items.checkCreditBalances;\n document.getElementById('highlightNegativesNegative').checked = items.highlightNegativesNegative;\n document.getElementById('enableRetroCalculator').checked = items.enableRetroCalculator;\n var budgetRowsHeightSelect = document.getElementById('budgetRowsHeight');\n budgetRowsHeightSelect.value = items.budgetRowsHeight;\n var categoryPopupWidthSelect = document.getElementById('categoryPopupWidth');\n categoryPopupWidthSelect.value = items.categoryPopupWidth;\n });\n}", "function restoreSettings() {\n function setCurrentChoice(result) {\n if(result !== undefined && result.insert !== undefined && result.insert !== \"\"){\n document.getElementById('cmn-toggle-1').checked = result.insert;\n }\n else{\n console.log(\"No Settings Found\");\n return null;\n }\n }\n\n chrome.storage.local.get(\"insert\", setCurrentChoice);\n chrome.storage.local.get(\"lang\", function(result) {\n if(result !== undefined && result.lang !== undefined && result.lang !== \"\") {\n lang = result.lang;\n updateStrings();\n var select = document.getElementById('lang-sel').value = result.lang;\n }\n });\n}", "function restore_options() {\n chrome.storage.sync.get({\n settingEnabled: true //default = true\n }, function (items) {\n settingsCheckboxObj.checked = items.settingEnabled;\n });\n}", "function restore_options() {\r\n\tchrome.storage.sync.get({\r\n\t\tcolor: '8AFFFB',\r\n\t\tselector: \"background\",\r\n\t\tdebugOption: false\r\n\t}, function(items) {\r\n\t\t\tif(items.selector == \"link\") {\r\n\t\t\t\tdocument.getElementById(\"link\").checked = true;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tdocument.getElementById(\"background\").checked = true;\r\n\t\t\t}\r\n\t\t\tdocument.getElementById('color').value = items.color;\r\n\t\t\tdocument.getElementById('debug').checked = items.debugOption;\r\n\t\t});\r\n}", "function restore_options() {\n $('input:checkbox').click(function() {\n localStorage[this.id] = this.checked;\n chrome.tabs.sendRequest(parseInt(localStorage[\"tabID\"]), {'action' : 'restore_settings'}, function(response) {\n\n });\n show_success();\n if (this.id == 'notifications') {\n $('#mini_player').attr('disabled', !this.checked);\n $('#mini_player').parents('blockquote').toggleClass('disabled');\n }\n });\n $('input:checkbox').each(function(index) {\n if (localStorage[this.id] === undefined && this.id != 'support' && this.id != 'mini_player') {\n // console.log('first run, setting to true');\n localStorage[this.id] = 'false';\n }\n if (localStorage[this.id] == 'true') {\n this.checked = true;\n\n }\n else {\n this.checked = false;\n }\n });\n\n }", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.local.get({\n 'favoriteColor': 'red',\n 'likesColor': true\n }, function(items) {\n document.getElementById('color').value = items.favoriteColor;\n document.getElementById('like').checked = items.likesColor;\n });\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n favoriteColor: 'red',\n likesColor: true,\n\tinstancia: ''\n }, function(items) {\n document.getElementById('color').value = items.favoriteColor;\n document.getElementById('like').checked = items.likesColor;\n\tdocument.getElementById('instancia').value = items.instancia;\n });\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n add_rmp_links: true,\n highlight_easy_classes: true,\n hide_full_classes: false\n }, function(items) {\n document.getElementById('add_rmp_links').checked = items.add_rmp_links;\n document.getElementById('highlight_easy_classes').checked = items.highlight_easy_classes;\n document.getElementById('hide_full_classes').checked = items.hide_full_classes;\n });\n }", "function restore_options() {\n var storageArea = chrome.storage.local;\n storageArea.get(\"keybindings\", function(data) {\n if (!data.keybindings) {\n return;\n }\n choice = data.keybindings;\n var select = document.getElementById(\"keybindings\");\n for (var i = 0; i < select.children.length; i++) {\n var child = select.children[i];\n if (child.value == choice) {\n child.selected = \"true\";\n break;\n }\n }\n });\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n bugBugs: false,\n bugSpiders: true,\n bugMax: 3,\n bugMin: 1,\n bugDelay: 3.5,\n bugOdds: 70\n }, function(items) {\n document.getElementById('bugs').checked = items.bugBugs;\n document.getElementById('spiders').checked = items.bugSpiders;\n document.getElementById('maxnum').value = items.bugMax;\n document.getElementById('minnum').value = items.bugMin;\n document.getElementById('delay').value = items.bugDelay;\n document.getElementById('odds').value = items.bugOdds;\n });\n}", "function restore_options() {\r\n chrome.storage.sync.get({\r\n hideGmailLogo: true,\r\n hideEmail: false,\r\n hideSubject: false,\r\n hideContactDetails: false\r\n }, function(items) {\r\n document.getElementById('hideGmailLogo').checked = items.hideGmailLogo;\r\n document.getElementById('hideEmail').checked = items.hideEmail;\r\n document.getElementById('hideSubject').checked = items.hideSubject;\r\n document.getElementById('hideContactDetails').checked = items.hideContactDetails;\r\n });\r\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n priceDelta: 0.1,\n tangDelta: 0.1,\n isNotifyTop: true,\n isNotifyPump: true,\n isNotifyDumpT: true,\n smallCoinVolume: 10,\n bigCoinVolume: 1000,\n isNotifySmallCoin: true,\n lotsize: 0.1,\n isAutoFillLot: true,\n }, function(items) {\n console.log(\"loaded item\", items)\n document.getElementById('priceDelta').value = items.priceDelta;\n document.getElementById('tangDelta').value = items.tangDelta;\n document.getElementById('isNotifyTop').checked = items.isNotifyTop;\n document.getElementById('isNotifyPump').checked = items.isNotifyPump;\n document.getElementById('isNotifyDumpT').checked = items.isNotifyDumpT;\n document.getElementById('smallCoinVolume').value = items.smallCoinVolume;\n document.getElementById('bigCoinVolume').value = items.bigCoinVolume;\n document.getElementById('isNotifySmallCoin').checked = items.isNotifySmallCoin;\n document.getElementById('lotsize').value = items.lotsize;\n document.getElementById('isAutoFillLot').checked = items.isAutoFillLot;\n });\n}", "function restoreOptions(cb) {\n\tchrome.storage.sync.get({\n\t\temailButton: \"\",\n\t\tminiEmailBtn: false,\n\t\tminiClinicBtn: false,\n\t\tclinicButton: \"\",\n\t\tclinicFeedbackBtn: \"\",\n\t\tminiTicketButton: \"\",\n\t\tminiTakeTicketBtn: \"\",\n\t\tminiSupportPhoneBtn: \"\",\n\t\tminiClientIssueBtn: \"\",\n\t\tdesignTab: false,\n\t\tplaybookTab: \"\",\n\t\todoTheme: null,\n\t\ttips: true,\n\t\tename: \"\",\n\t\tpanels: false,\n\t\tcalmAlerts: true,\n\t\tminPosts: true,\n\t\tloginText: \"\",\n\t\thidePosts: false,\n\t\tblockSpam: true,\n\t\tomniSearch: true,\n\t\tshowQuniTickets: false,\n\t\tshowSIQueue: false,\n\t\tshowTAQueue: false,\n\t\tshow360Queue: false,\n\t\tshowEEQueue: false,\n\t\tshowThemesQueue: false,\n\t\tshowVocQueue: false,\n\t\tshowStatQueue: false,\n\t\tshowIntQueue: false,\n\t\tlikeAndCloseBLC: true,\n\t\tnewBarnaby: true\n\t}, function(items) {\n\t\t$('#EmailButton').prop('checked', items.emailButton);\n\t\t$('#ClinicFeedbackButton').prop('checked', items.clinicFeedbackBtn);\n\t\t$('#MiniEmailButton').prop('checked', items.miniEmailBtn);\n\t\t$('#MiniClinicButton').prop('checked', items.miniClinicBtn);\n\t\t$('#ClinicButton').prop('checked', items.clinicButton);\n\t\t$('#MiniTicketButton').prop('checked', items.miniTicketButton);\n\t\t$('#MiniTakeTicket').prop('checked', items.miniTakeTicketBtn);\n\t\t$('#MiniSupportPhone').prop('checked', items.miniSupportPhoneBtn);\n\t\t$('#MiniClientIssue').prop('checked', items.miniClientIssueBtn);\n\t\t$('#Design').prop('checked', items.designTab);\n\t\t$('#EasterEggs').prop('checked', items.ee);\n\t\t$('#Playbook').prop('checked', items.playbookTab);\n\t\t$('#Theme').val(items.odoTheme);\n\t\t$('#Tips').prop('checked', items.tips);\n\t\t$('#Name').val(items.ename);\n\t\t$('#LoginText').val(items.loginText);\n\t\t$('#Panels').prop('checked', items.panels);\n\t\t$('#greyAlerts').prop('checked', items.calmAlerts);\n\t\t$('#shrinkPosts').prop('checked', items.minPosts);\n\t\t$('#hideSquawkPosts').prop('checked', items.hidePosts);\n\t\t$('#SpamCount').val(items.spamCount);\n\t\t$('#BlockSpam').prop('checked', items.blockSpam);\n\t\t$('#OmniSearch').prop('checked', items.omniSearch);\n\t\t$('#QuniTickets').prop('checked', items.showQuniTickets);\n\t\t$('#SIQueue').prop('checked', items.showSIQueue);\n\t\t$('#TAQueue').prop('checked', items.showTAQueue);\n\t\t$('#360Queue').prop('checked', items.show360Queue);\n\t\t$('#EEQueue').prop('checked', items.showEEQueue);\n\t\t$('#ThemesQueue').prop('checked', items.showThemesQueue);\n\t\t$('#VocQueue').prop('checked', items.showVocQueue);\n\t\t$('#StatQueue').prop('checked', items.showStatQueue);\n\t\t$('#IntQueue').prop('checked', items.showIntQueue);\n\t\t$('#LikeAndCloseBLC').prop('checked', items.likeAndCloseBLC);\n\t\t$('#NewBarnaby').prop('checked', items.newBarnaby);\n\t\tcb();\n\t});\n}", "function restore_options() {\n chrome.storage.local.get(null, function (result) {\n document.getElementById(\"newProductSelection\").selectedIndex = result.newProductCellColorUser;\n if (result.jiraPreviewLiveChecked) {\n document.getElementById('jiraPreviewLiveChecked').checked = true;\n }\n });\n}", "function restore_options() {\n chrome.storage.sync.get({\n moodPredict: true,\n recommendedContent: true,\n moodUpdate: 'weekly'\n }, function(items) {\n document.getElementById('moodPredict').checked = items.moodPredict;\n document.getElementById('recommendedContent').checked = items.recommendedContent;\n document.getElementById('moodUpdate').value = items.moodUpdate;\n });\n}", "function restoreSettingValues() {\n browser.storage.local.get()\n .then(function(items) {\n document.getElementById(\"delayBeforeCleanInput\").value = items.delayBeforeClean;\n document.getElementById(\"activeModeSwitch\").checked = items.activeMode;\n\t\tdocument.getElementById(\"statLoggingSwitch\").checked = items.statLoggingSetting;\n document.getElementById(\"showNumberOfCookiesInIconSwitch\").checked = items.showNumberOfCookiesInIconSetting;\n document.getElementById(\"notifyCookieCleanUpSwitch\").checked = items.notifyCookieCleanUpSetting;\n document.getElementById(\"contextualIdentitiesEnabledSwitch\").checked = items.contextualIdentitiesEnabledSetting;\n\n });\n}", "function restore_options() {\n\tchrome.storage.sync.get(['auto_duo'], function (items) {\n\t\t(document.getElementById('auto_duo')).checked = items.auto_duo;\n\t});\n}", "function restore_options() {\n chrome.storage.local.get('default_mode',function(items){\n var mode_ = items['default_mode'];\n if (!mode_) {\n return;\n }\n var select = document.getElementById(\"mode\");\n for (var i = 0; i < select.children.length; i++) {\n var child = select.children[i];\n if (child.value == mode_) {\n child.selected = \"true\";\n break;\n }\n }\n });\n }", "function restore_options() {\r\n chrome.storage.sync.get('options', function(items) {\r\n $('#options').val(JSON.stringify(items.options || options_default, undefined, 4));\r\n });\r\n}", "function restore_options() {\n $(\"input[name=etym][value=\"+localStorage[\"etym\"]+\"]\").attr(\"checked\",true);\n $(\"input[name=click2s][value=\"+localStorage[\"click2s\"]+\"]\").attr(\"checked\",true);\n $(\"input[name=root2note][value=\"+localStorage[\"root2note\"]+\"]\").attr(\"checked\",true);\n $(\"input[name=afx2note][value=\"+localStorage[\"afx2note\"]+\"]\").attr(\"checked\",true);\n $(\"input[name=hide_cn][value=\"+localStorage[\"hide_cn\"]+\"]\").attr(\"checked\",true);\n $(\"input[name=web_en][value=\"+localStorage[\"web_en\"]+\"]\").attr(\"checked\",true);\n var hider=localStorage[\"hider\"]\n if(undefined==hider) hider=[]\n else hider=hider.split(',')\n $(\"input[name=hider]:checkbox\").val(hider)\n}", "function restore_options() {\r\n // Use default value color = 'red' and likesColor = true.\r\n chrome.storage.sync.get({\r\n TimeRefresh: '1',\r\n DeskNotify: true\r\n }, function(items) {\r\n document.getElementById('time').value = items.TimeRefresh;\r\n document.getElementById('desktop').checked = items.DeskNotify;\r\n });\r\n}", "function restore_options() {\n chrome.storage.sync.get({\n isEnabled: true,\n language: \"jp\"\n }, function(items) {\n document.getElementById('enabled').checked = items.isEnabled;\n // Enable for multiple languages\n // document.getElementById('language').value = items.language;\n });\n}", "function restore_options() {\n chrome.storage.sync.get({\n username: '',\n customGreeting: '',\n customAvatar: '',\n improveUI: true,\n addMarketStats: true\n }, function(items) {\n document.getElementById('username').innerHTML = items.username;\n document.getElementById('customGreeting').value = items.customGreeting;\n document.getElementById('customAvatar').value = items.customAvatar;\n document.getElementById('improveUI').checked = items.improveUI;\n document.getElementById('addMarketStats').checked = items.addMarketStats;\n });\n}", "function restore_options() {\n chrome.storage.sync.get({\n pages: DEFAULT_PAGES,\n random: DEFAULT_RANDOM\n }, function(items) {\n clean_pages();\n set_pages(items.pages);\n document.getElementById('random').checked = items.random;\n });\n}", "function restoreOptions() {\n chrome.storage.local.get(function (data) {\n //console.warn(JSON.stringify(data));\n $('#block').val(data.blackListBlock);\n $('#completelyTrust').val(data.completelyTrust);\n $('#imagesTrust').val(data.imagesTrust);\n $('#videosTrust').val(data.videosTrust);\n $('#iframesTrust').val(data.iframesTrust);\n $('#downloadsTrust').val(data.downloadsTrust);\n //console.log(\"data.fileTypeTrust: \" + data.fileTypeTrust);\n $.each(data.fileTypeTrust, function () {\n //console.log(\"type: \" + this);\n $(\"input[value='\" + this + \"']\").prop(\"checked\", true);\n });\n $(\"input[name='blockSettings']\").prop(\"checked\", data.blockSettings);\n });\n\n $('#save').click(saveOptions);\n}", "function restore_options() {\n\tchrome.storage.sync.get(\n\t{\n\t\taddress: 'address',\n\t\tport: 'port',\n\t\tlogin: 'login',\n\t\tpassword: 'password'\n\t}, \n\tfunction(items) {\n\t\tdocument.getElementById('address').value = items.address;\n\t\tdocument.getElementById('port').value= items.port;\n\t\tdocument.getElementById('login').value = items.login;\n\t\tdocument.getElementById('password').value= items.password;\n\t});\n}", "function restoreOptions() {\n\tchrome.storage.sync.get(['savedOnce', 'displayType', 'increment', 'contentIsVisible', 'staticView', 'secretMenu'], function(data) {\n\t\tsavedOnce = data.savedOnce;\n\t\tdisplayType = data.displayType;\n\t\tincrement = data.increment;\n\t\tcontentIsVisible = data.contentIsVisible;\n\t\tstaticView = data.staticView;\n\t\tsecretMenu = data.secretMenu;\n\n\t\tif (displayType == \"fill\") { document.getElementById(\"fillRadio\").checked=true;\n\t\t\t} else { document.getElementById(\"fillRadio\").checked=false; }\n\t\tif (displayType == \"hybrid\") { document.getElementById(\"hybridRadio\").checked=true;\n\t\t\t} else { document.getElementById(\"hybridRadio\").checked=false; }\n\t\tif (displayType == \"none\") { document.getElementById(\"noneRadio\").checked=true;\n\t\t\t} else { document.getElementById(\"noneRadio\").checked=false; }\n\t\tif (displayType == \"yellowHybrid\") { document.getElementById(\"yellowHybridRadio\").checked=true;\n\t\t\t} else { document.getElementById(\"yellowHybridRadio\").checked=false; }\n\t\tif (displayType == \"blackHybrid\") { document.getElementById(\"blackHybridRadio\").checked=true;\n\t\t\t} else { document.getElementById(\"blackHybridRadio\").checked=false; }\n\n\t\tif (isNaN(increment)) { document.getElementById(\"incrementField\").value = 50;\n\t\t} else { document.getElementById(\"incrementField\").value = increment;\n\t\t}\n\n\t\tif (contentIsVisible) { \n\t\t\tdocument.getElementById(\"showArticleContentCheckbox\").checked=true;\n\t\t} else { \n\t\t\tdocument.getElementById(\"showArticleContentCheckbox\").checked=false; \n\t\t\thideWikiContent();\n\t\t}\n\n\t\tif (staticView) { \n\t\t\tdocument.getElementById(\"staticViewCheckbox\").checked=true;\n\t\t} else { \n\t\t\tdocument.getElementById(\"staticViewCheckbox\").checked=false; \n\n\t\t\t// If staticView is false, then turn on bind parallax effect to scroll\n\t\t\t$(document).ready(function() {\t\n\t\t\t $(window).bind('scroll',function(e){\n\t\t\t \tscrolled = $(window).scrollTop();\n\t\t\t\t\t// Go through each wikilink...\n\t\t\t\t\tfor (index = 0; index < wikilinks.length; index++) {\n\t\t\t\t\t\tmoveCircles(index);\n\t\t\t\t }\n\t\t\t });\n\t\t\t});\n\n\t\t}\n\n\t\tif (secretMenu) { $(\"#displayChoicesHidden\").css(\"display\",\"inline-block\"); }\n\n\t\t// If settings have never been saved, automatically set fill = true, increment = 50, contentIsVisible = true, staticView = false\n\t\tif (!savedOnce) {\n\t\t\tchrome.storage.sync.set({\"displayType\": \"hybrid\"}, function() {});\n\t\t\tchrome.storage.sync.set({\"increment\": 50}, function() {});\n\t\t\tdisplayType = \"hybrid\";\n\t\t\tdocument.getElementById(\"hybridRadio\").checked=true;\n\t\t\t$(\"#optionsForm\").slideToggle();\n\t\t\tincrement = 50;\n\t\t\tcontentIsVisible = true;\n\t\t\tstaticView = false;\n\t\t} \n\n\t});\n}", "function restoreOptions() {\n // retrieves data saved, if not found then set these to default parameters\n chrome.storage.sync.get({\n color: \"FFEB3B\",\n opac: .5,\n rad: 50,\n trigger: \"F2\",\n\t\ttoggle: true,\n activePage: false\n }, function(items) {\n \t// sets value of the sliders and settings to saved settings\n document.getElementById('trigger').value = items.trigger;\n\n // draws the circle and text preview to loaded preferences\n\t\topacity = items.opac;\n\t\tradius = items.rad;\n\t\thighlight = items.color;\n\t\tcheck = items.toggle;\n\t\t$('#toggle').prop('checked', check);\n\t\tdrawCircle(opacity, radius, highlight);\n });\n}", "function restore_options () {\n\t\tfor ( var i = 0, l = OPTIONS.length; i < l; i++ ) {\n\t\t\tvar o = OPTIONS[ i ].id;\n\t\t\tvar val = localStorage.getItem( o );\n\t\t\tval = val === null ? OPTIONS[ i ].def : val;\n\t\t\tvar element = $( '#' + o );\n\t\t\tif ( typeof val != 'undefined' && element ) {\n\t\t\t\tif ( element.is( 'input[type=checkbox]' ) ) {\n\t\t\t\t\telement.prop( 'checked', !!val );\n\t\t\t\t} else if ( element.is( 'input[type=text]' ) || element.is( 'input[type=password]' ) ) {\n\t\t\t\t\telement.val( val );\n\t\t\t\t} else {\n\t\t\t\t\tthrow 'unknown element: ' + element;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$( '#link_regex' ).prop( 'disabled', !$( '#enable_leftclick' ).prop( 'checked' ) );\n\t\t}\n\t}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n preferredName: '',\n investmentUrl: '',\n donationUrl: ''\n }, function(items) {\n $('#preferred-name').val(items.preferredName)\n $('#investment-url').val(items.investmentUrl)\n $('#donation-url').val(items.donationUrl)\n });\n}", "function restore_options() {\n\tbrowser.storage.sync.get({ sheetIdValue: '', baseUrlValue: '', debugModeValue: ''}).then( (items) => {\n\t\tconsole.log(items);\n\t\tdocument.getElementById('sheet_id').value = items.sheetIdValue;\n\t\tdocument.getElementById(\"base_url\").value = items.baseUrlValue;\n\t\tdocument.getElementById(\"debug_mode\").checked = items.debugModeValue;\n\n\t})\n}", "function restore_options() {\n //Defaults\n chrome.storage.sync.get({\n cardSize: 'medium',\n displayCard: true,\n caseSensitive: true,\n cardMatch: true,\n linkMatch: true,\n deckButton: true\n }, function(items) {\n document.getElementById('card-size').value = items.cardSize;\n document.getElementById('case-sensitive').checked = items.caseSensitive;\n document.getElementById('card-match').checked = items.cardMatch;\n document.getElementById('link-match').checked = items.linkMatch;\n document.getElementById('deck-button').checked = items.deckButton;\n });\n}", "function restore_options() {\n chrome.storage.sync.get({\n prefixText: '',\n prefixAvailable: false\n }, function(items) {\n document.getElementById('prefix_text').value = items.prefixText\n document.getElementById('prefix_available').checked = items.prefixAvailable\n })\n}", "function restore_options() {\n \n log('restoring options from saved - options:');\n \n chrome.storage.local.get({\n enabled: 'Ready',\n blockStreams: [],\n userSitePreset: [],\n baseInterval: 1,\n sites: [],\n }, (items) => {\n \n write_sites_to_page(items.sites);\n \n //reset other options, too\n log('items.blockStreams',items.blockStreams);\n document.getElementById('block_streams').checked = items.blockStreams;\n document.getElementById('enabled_status').textContent = items.enabled;\n document.getElementById('new_site').value = items.userSitePreset;\n console.log('setting base', items.baseInterval);\n document.getElementById('linkChangeInterval').value = items.baseInterval;\n });\n}", "function restoreOptions () {\n // Use default checked selected = true.\n chrome.storage.sync.get({\n mute: true\n }, function (items) {\n document.querySelector('.ios-switch').checked = items.mute\n })\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n ns_server: '',\n ns_username: \"\",\n ns_password: \"\",\n zd_server: '',\n zd_username: \"\",\n zd_password: \"\"\n }, function(items) {\n document.getElementById('server').value = items.ns_server;\n document.getElementById('username').value = items.ns_username;\n document.getElementById('password').value = items.ns_password;\n document.getElementById('zdserver').value = items.zd_server;\n document.getElementById('zdusername').value = items.zd_username;\n document.getElementById('zdpassword').value = items.zd_password;\n });\n}", "function restoreOptions() {\n chrome.storage.sync.get(['master', 'slave'], function(items) {\n document.getElementById('master').value = items.master || '';\n document.getElementById('slave').value = items.slave || '';\n });\n }", "function restore_options() {\n\n left.value \t= localStorage[\"left\"];\n right.value \t= localStorage[\"right\"];\n tops.value \t= localStorage[\"tops\"];\n bottom.value \t= localStorage[\"bottom\"];\n\n //alert(\"Test\");\n /* var select = document.getElementById(\"color\");\n for (var i = 0; i < select.children.length; i++) {\n var child = select.children[i];\n if (child.value == favorite) {\n child.selected = \"true\";\n break;\n }\n }*/\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({\n frequency: 'red',\n appearance: 'textImages',\n content: 'Informative Facts',\n category: 'Poaching',\n on: true,\n ads: 0\n }, function(items) {\n document.getElementById('myRange').value = items.frequency;\n setSelectedChbox( document.getElementById('view'),items.appearance);\n setSelectedChbox( document.getElementById('content'),items.content);\n setSelectedChbox( document.getElementById('category'),items.category);\n document.getElementById('earn').innerHTML = \"You have helped donate: \" +items.ads*5 + \" cents!\";\n\n if(items.on){\n document.getElementById(\"onoff\").value = \"Turn Off\";\n } else {\n document.getElementById(\"onoff\").value = \"Turn On\";\n }\n });\n}", "function restore_options() {\n chrome.storage.local.get(['ProgramDate','TicketNumber','ProgramSit'], items => {\n if (items) {\n document.getElementById('ProgramDate').value = items.ProgramDate;\n document.getElementById('ProgramSit').value = items.ProgramSit;\n document.getElementById('TicketNumber').selectedIndex = items.TicketNumber;\n }\n });\n}", "function restore_options() {\n\t//var badgerEndpoint = document.getElementById('badgerEndpoint');\n\tvar opts = {\n transparentArticles: true,\n hideNotAvailable: false,\n\t\tbadgerEndpoint: 'https://o2r.uni-muenster.de/api/1.0/badge/',\n enabled: true\n\t};\n\t//Restore badge settings\n\tfor(var i = 0; i < BadgeTypes.length; i++) {\n\t\tvar key = BadgeTypes[i].key;\n\t\t\n\t\topts[key + 'Badge'] = true;\n\t\t\n\t\tvar checkboxes = document.getElementById('checkboxes');\n\t\tcheckboxes.innerHTML += '<input type=\"checkbox\" id=\"' + key + '\" name=\"' + key + '\" /> <label for=\"' + key + '\">' + BadgeTypes[i].value + '</label><br>';\n\t}\n\t//Restore ERC button settings\n\tfor(var i = 0; i < RepositoryTypes.length; i++) {\n\t\tvar key = RepositoryTypes[i].key;\n\t\t\n\t\topts[key + 'Repository'] = true;\n\t\t\n\t\tvar ercCheckboxes = document.getElementById('ercCheckboxes');\n\t\tercCheckboxes.innerHTML += '<input type=\"checkbox\" id=\"' + key + '\" name=\"' + key + '\" /> <label for=\"' + key + '\">' + RepositoryTypes[i].value + '</label><br>';\n\t}\n\tchrome.storage.sync.get(opts, function (items) {\n\t\tfor(var i = 0; i < BadgeTypes.length; i++) { //Badges\n\t\t\tvar key = BadgeTypes[i].key;\n\t\t\tdocument.getElementById(key).checked = items[key + 'Badge'];\n\t\t}\t\n\t\tfor(var i = 0; i < RepositoryTypes.length; i++) { //Repositories\n\t\t\tvar key = RepositoryTypes[i].key;\n\t\t\tdocument.getElementById(key).checked = items[key + 'Repository'];\n\t\t}\n\t\tdocument.getElementById('transparentArticles').checked = items.transparentArticles;\n\t\tdocument.getElementById('hideNotAvailable').checked = items.hideNotAvailable;\n\t\tdocument.getElementById('badgerEndpoint').value = items.badgerEndpoint;\n\t\tdocument.getElementById('globalEnable').checked = items.enabled;\n\t});\n}", "function restore_options() {\n var q = $.Deferred();\n // Use default value color = 'red' and likesColor = true.\n var flat_options_list = key_list();\n\n chrome.storage.sync.get(flat_options_list, function(options) {\n $.each(options,function(idx,option){\n var two_part = idx.split(':::');\n options_defaults[two_part[0]].options[two_part[1]].value = option;\n });\n q.resolve();\n });\n return q;\n}", "function restore_options() {\n var opt = this\n chrome.storage.sync.get({\n syncVolume: true,\n saveVolume: true\n }, function(items) {\n document.getElementById('saveVol').checked = items.saveVolume; \n document.getElementById('syncVol').checked = items.syncVolume;\n if(items.saveVolume == false) {\n document.getElementById('syncVol').checked = false;\n document.getElementById('syncVol').disabled = true;\n document.getElementById('syncVolSpan').style.opacity = 0.6;\n } else {\n document.getElementById('syncVol').disabled = false;\n document.getElementById('syncVolSpan').style.opacity = 1;\n }\n\n // If it's a first time visit, then these values will not already be set. So, set them.\n opt.save_options();\n\n });\n}", "function save_options() {\n// var select = document.getElementById(\"color\");\n// var color = select.children[select.selectedIndex].value;\n// localStorage[\"favorite_color\"] = color;\n \t\n \tfor( i in pOptions){\n \t\tif(typeof(pOptions[i].def)=='boolean')\n \t\t\tlocalStorage[i] = document.getElementById(i).checked;\n \t\telse\n \t\t\tlocalStorage[i] = document.getElementById(i).value;\n \t}\n\t\n\t\n\t//localStorage[\"hqthumbs\"] = document.getElementById(\"hqthumbs\").checked;\n\t//localStorage[\"showCurrentTab\"] = document.getElementById(\"showCurrentTab\").checked;\n\t//localStorage[\"maxhistory\"] = document.getElementById(\"maxhistory\").value;\n\t\n\t\n // Update status to let user know options were saved.\n var status = document.getElementById(\"status\");\n Cr.empty(status).appendChild(Cr.txt(\"Options Saved.\"));\n setTimeout(function() {\n Cr.empty(status);\n }, 750);\n \n chrome.runtime.sendMessage({greeting: \"reloadprefs\"}, function(response) { });\n}", "function restoreOptions() {\n chrome.storage.local.get('chromeNotifications',function(data){\n document.getElementById(\"chromeNotifications\").checked=data.chromeNotifications;\n });\n}", "function restore_options() {\n\n forEachField(function(id){\n\n val = localStorage[id];\n $('#' + id).val(val);\n\n });\n\n}", "function restore_options() {\r\n\tchrome.storage.sync.get({\r\n\t\ttabsBehavior: 'new',\r\n\t\tsortBehavior: 'alpha',\r\n\t\tshowRecentBehavior: true,\r\n\t\trecentItemCount: 3,\r\n\t\trecentExclude: false,\r\n\t\texcludeFolders: new Array(),\r\n\t}, function(items) {\r\n\t\tdocument.getElementById('tabs').value = items.tabsBehavior;\r\n\t\tdocument.getElementById('sort').value = items.sortBehavior;\r\n\t\tdocument.getElementById('show_recent').checked = items.showRecentBehavior;\r\n\t\tdocument.getElementById('recent_count').value = items.recentItemCount;\r\n\t\tdocument.getElementById('recent_exclude').checked = items.recentExclude;\r\n\t\r\n\t\tvar exclude_checks = document.getElementById('exclude-folder-list').getElementsByClassName('exclude-checkbox');\r\n\t\tif(items.excludeFolders) {\r\n\t\t\t[].forEach.call(exclude_checks, function (el) {\r\n\t\t\t\t\t\t\t\t\t\t\t\tvar folder_id = el.id.match(/\\[(\\d+)\\]/i)[1];\r\n\t\t\t\t\t\t\t\t\t\t\t\tif(items.excludeFolders.indexOf(folder_id) != -1) {\r\n\t\t\t\t\t\t\t\t\t\t\t\t\tel.checked = true;\r\n\t\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}\r\n\t\tif(items.showRecentBehavior) {\r\n\t\t\tdocument.getElementById('recent_count_div').style.visibility = 'visible';\r\n\t\t}\r\n\t\r\n\t});\r\n}", "function restore_options() {\n\tchrome.storage.sync.get({\n\t\tsourceUrl: '',\n\t\tincludeInvestors: false\n\t}, function(items) {\n\n\t\tif (items.sourceUrl) {\n\t\t\tdocument.getElementById('sourceUrl').value = items.sourceUrl;\n\t\t}\n\t\tdocument.getElementById('includeInvestors').checked = items.includeInvestors;\n\t});\n}", "function restoreOptions() {\r\n try {\r\n var api = chrome || browser;\r\n api.storage.sync.get(null, (res) => {\r\n document.querySelector(\"#voice\").value = res.voice || getFirstVoice();\r\n document.querySelector(\"#speed\").value = res.speed || 1;\r\n document.querySelector(\"#pitch\").value = res.pitch || 1;\r\n document.querySelector(\"#colorBackground\").value =\r\n res.colorBackground || \"light\";\r\n restoreColor();\r\n document.querySelector(\"#fontSize\").value = res.fontSize || \"medium\";\r\n\t restoreFontSize();\r\n if (\r\n res.experimentalMode &&\r\n res.definiteArticleCheck &&\r\n res.definiteArticleColor\r\n ) {\r\n colorDefiniteArticles(res.definiteArticleColor);\r\n }\r\n if (\r\n res.experimentalMode &&\r\n res.indefiniteArticleCheck &&\r\n res.indefiniteArticleColor\r\n ) {\r\n colorIndefiniteArticles(res.indefiniteArticleColor);\r\n }\r\n if (res.experimentalMode && res.eclipseMode) {\r\n eclipseMode();\r\n }\r\n });\r\n } catch (err) {\r\n console.log(err);\r\n }\r\n}", "function restore_options() {\n // Use default value autoForward = false.\n chrome.storage.sync.get({\n autoForward: false, \n clubId: 4787\n }, function(items) {\n document.getElementById('autoForward').checked = items.autoForward;\n document.getElementById('clubId').value = items.clubId;\n });\n}", "function restore_options() {\n\tchrome.storage.sync.get({\n\t\tunicornImage: 'https://i.imgur.com/XeEii4X.png',\n\t\tunicornAdd: 'u',\n\t\tunicornClear: 'c'\n\t}, function(settings) {\n\t\tdocument.getElementById('unicorn-img-setting').value = settings.unicornImage;\n\t\tdocument.getElementById('unicorn-add-setting').value = settings.unicornAdd;\n\t\tdocument.getElementById('unicorn-clear-setting').value = settings.unicornClear;\n\t});\n}", "function restore_options(storageName, elementId) {\n var favorite = localStorage[storageName];\n if (!favorite) {\n return;\n }\n var select = document.getElementById(elementId);\n for (var i = 0; i < select.children.length; i++) {\n var child = select.children[i];\n if (child.value == favorite) {\n child.selected = \"true\";\n break;\n }\n }\n}", "function restore_options() {\n chrome.storage.sync.get({\n apiKey: 'a4bc2b1cb23bce56eddd44',\n sandBox: true,\n }, function(items) {\n document.getElementById('apikey').value = items.apiKey;\n document.getElementById('sandbox').checked = items.sandBox;\n });\n}", "function restore_options() {\n\tconsole.log(\"Params loaded\");\n chrome.storage.sync.get({\n prohibited: \"\"\n }, function(items) {\n document.getElementById('prohibited').value = items.prohibited;\n });\n}", "function restore_options() {\n chrome.storage.sync.get(['lang'], function (result) {\n let lang = result.lang;\n if (lang !== undefined) {\n document.querySelector(\"select#country\").value = lang;\n let elems = document.querySelectorAll('select');\n let instances = M.FormSelect.init(elems);\n }\n });\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.local.get({\n newTab: false,\n buttonText: 'shortName',\n\n googleButton: true,\n youtubeButton: true,\n googleImagesButton: true,\n googleMapsButton: true,\n googleTranslateButton: true,\n dictionaryButton: true,\n wikipediaButton: true,\n googleNewsButton: false,\n hackerNewsButton: false,\n facebookButton: false,\n twitterButton: false,\n imdButton: false,\n bingButton: false,\n githubButton: false,\n stackOverflowButton: false,\n redditButton: false,\n amazonButton: false,\n piratebayButton: false,\n avaxhomeButton: false,\n rarbgButton: false,\n\n duckDuckGoLink: false,\n googleLink: true,\n youtubeLink: true,\n googleImagesLink: true,\n googleMapsLink: true,\n googleTranslateLink: true,\n dictionaryLink: true,\n googleNewsLink: true,\n wikipediaLink: true,\n hackerNewsLink: false,\n facebookLink: false,\n twitterLink: false,\n imdLink: false,\n bingLink: false,\n githubLink: false,\n stackOverflowLink: false,\n redditLink: false,\n amazonLink: false,\n piratebayLink: false,\n avaxhomeLink: false,\n rarbgLink: false\n\n\n }, function(items) {\n document.getElementById('newTab').checked = items.newTab;\n document.getElementById('buttonText').value = items.buttonText;\n\n document.getElementById('googleButton').checked = items.googleButton;\n document.getElementById('youtubeButton').checked = items.youtubeButton;\n document.getElementById('googleImagesButton').checked = items.googleImagesButton;\n document.getElementById('googleMapsButton').checked = items.googleMapsButton;\n document.getElementById('googleTranslateButton').checked = items.googleTranslateButton;\n document.getElementById('dictionaryButton').checked = items.dictionaryButton;\n document.getElementById('googleNewsButton').checked = items.googleNewsButton;\n document.getElementById('hackerNewsButton').checked = items.hackerNewsButton;\n document.getElementById('facebookButton').checked = items.facebookButton;\n document.getElementById('twitterButton').checked = items.twitterButton;\n document.getElementById('wikipediaButton').checked = items.wikipediaButton;\n document.getElementById('imdButton').checked = items.imdButton;\n document.getElementById('bingButton').checked = items.bingButton;\n document.getElementById('githubButton').checked = items.githubButton;\n document.getElementById('stackOverflowButton').checked = items.stackOverflowButton;\n document.getElementById('redditButton').checked = items.redditButton;\n document.getElementById('amazonButton').checked = items.amazonButton;\n document.getElementById('piratebayButton').checked = items.piratebayButton;\n document.getElementById('avaxhomeButton').checked = items.avaxhomeButton;\n document.getElementById('rarbgButton').checked = items.rarbgButton;\n\n document.getElementById('duckDuckGoLink').checked = items.duckDuckGoLink;\n document.getElementById('googleLink').checked = items.googleLink;\n document.getElementById('youtubeLink').checked = items.youtubeLink;\n document.getElementById('googleImagesLink').checked = items.googleImagesLink;\n document.getElementById('googleMapsLink').checked = items.googleMapsLink;\n document.getElementById('googleTranslateLink').checked = items.googleTranslateLink;\n document.getElementById('dictionaryLink').checked = items.dictionaryLink;\n document.getElementById('googleNewsLink').checked = items.googleNewsLink;\n document.getElementById('hackerNewsLink').checked = items.hackerNewsLink;\n document.getElementById('facebookLink').checked = items.facebookLink;\n document.getElementById('twitterLink').checked = items.twitterLink;\n document.getElementById('wikipediaLink').checked = items.wikipediaLink;\n document.getElementById('imdLink').checked = items.imdLink;\n document.getElementById('bingLink').checked = items.bingLink;\n document.getElementById('githubLink').checked = items.githubLink;\n document.getElementById('stackOverflowLink').checked = items.stackOverflowLink;\n document.getElementById('redditLink').checked = items.redditLink;\n document.getElementById('amazonLink').checked = items.amazonLink;\n document.getElementById('piratebayLink').checked = items.piratebayLink;\n document.getElementById('avaxhomeLink').checked = items.avaxhomeLink;\n document.getElementById('rarbgLink').checked = items.rarbgLink;\n\n });\n}", "function restore_options() {\r\n chrome.storage.sync.get({\r\n hostname: 'localhost',\r\n port_number: 8888,\r\n debug_mode: false\r\n }, (items) => {\r\n document.getElementById('hostname').value = items.hostname;\r\n document.getElementById('port-number').value = items.port_number;\r\n document.getElementById('debug-mode').checked = items.debug_mode;\r\n });\r\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get({ settings: \n {\n targethost: '127.0.0.1',\n targetport: '9666',\n targetproto: 'http',\n targetuser: \"\",\n targetpasswd: \"\"\n\n }\n }, function(storage) {\n console.log(storage.settings)\n document.getElementById('targethost').value = storage.settings.targethost;\n document.getElementById('targetport').value = parseInt(storage.settings.targetport);\n document.getElementById('targetproto').value = storage.settings.targetproto;\n document.getElementById('targetuser').value = storage.settings.targetuser;\n document.getElementById('targetpasswd').value = storage.settings.targetpasswd;\n });\n}", "function restore_options() {\n\t// get options, or return default values if not set\n\tchrome.storage.sync.get(bb_values.default_options, function (items) {\n\t\tdocument.getElementById(\"forum_view\").value = items.forum_view;\n\t\tdocument.getElementById(\"blackboard_domains\").value = items.blackboard_domains.join(\"\\n\");\n\t});\n}", "function restore_options() {\n if ( window.localStorage.username != undefined )\n document.getElementById(\"username\").value = window.localStorage.username;\n\n if ( window.localStorage.url != undefined ) {\n document.getElementById(\"url\").value = window.localStorage.url;\n }\n\n if ( window.localStorage.refresh != undefined ) {\n document.getElementById(\"refresh\").value = window.localStorage.refresh;\n } else {\n document.getElementById(\"refresh\").value = 30;\n }\n\n if ( window.localStorage.ignoreServicesRegexp != undefined ) {\n document.getElementById(\"ignoreServicesRegexp\").value = window.localStorage.ignoreServicesRegexp;\n }\n\n if ( window.localStorage.dateFormat != undefined && window.localStorage.dateFormat != '' ) {\n document.getElementById(\"dateFormat\").value = window.localStorage.dateFormat;\n } else {\n document.getElementById(\"dateFormat\").value = \"DD-MM-YYYY hh:mm:ss\";\n }\n\n if ( window.localStorage.ignoreHostsRegexp != undefined ) {\n document.getElementById(\"ignoreHostsRegexp\").value = window.localStorage.ignoreHostsRegexp;\n }\n\n document.getElementById(\"ignoreCaseSensitivity\").checked = (window.localStorage.ignoreCaseSensitivity === \"false\") ? false : true;\n\n document.getElementById(\"hideAcked\").checked = (window.localStorage.hideAcked === \"true\") ? true : false;\n document.getElementById(\"hideDowntimeed\").checked = (window.localStorage.hideDowntimeed === \"true\") ? true : false;\n}", "function restoreOptions() {\n // Default values.\n chrome.storage.sync.get({\n dailyTasks: [],\n startOfDay: 480,\n endOfDay: 0,\n leeway: 100,\n shortEventDuration: 30,\n transitionTime: 10,\n blink: true,\n colorR: 255,\n colorG: 0,\n colorB: 0\n }, function(items) {\n restoreDailyTasks(items.dailyTasks);\n $(INPUT_START_OF_DAY_SELECTOR).val(minutesToTimeString(items.startOfDay));\n $(INPUT_END_OF_DAY_SELECTOR).val(minutesToTimeString(items.endOfDay));\n $(INPUT_LEEWAY_SELECTOR).val(items.leeway);\n $(INPUT_SHORT_EVENT_DURATION_SELECTOR).val(items.shortEventDuration);\n $(INPUT_TRANSITION_TIME_SELECTOR).val(items.transitionTime);\n $(INPUT_BLINK_SELECTOR).prop('checked', items.blink);\n $(INPUT_COLOR_R).val(items.colorR);\n $(INPUT_COLOR_G).val(items.colorG);\n $(INPUT_COLOR_B).val(items.colorB);\n });\n}", "function restore_options() {\n // restore options for popupDisplay\n var selection = localStorage[\"popupDisplayOption\"];\n var radios = document.popupOptionsForm.tabCountRadios;\n if (!selection) {\n document.getElementById(\"defaultPopupSelection\").checked = true;\n }\n for (var i = 0; i < radios.length; i++) {\n if (radios[i].value == selection) {\n radios[i].checked = true;\n }\n }\n\n // restore options for tabDedupe\n document.getElementById(\"tabDedupe\").checked = Boolean(localStorage[\"tabDedupe\"]);\n\n // Restore tab janitor options.\n document.getElementById(\"tabJanitor\").checked = Boolean(localStorage[\"tabJanitor\"]);\n document.getElementById(\"tabJanitorDays\").value = localStorage[\"tabJanitorDays\"] || 5;\n\n}", "function restore_options() {\n showContent(0);\n\n for (var i in boolIdArray) {\n var id = boolIdArray[i];\n var value = localStorage[\"gc_\" + id];\n\n if (value == \"true\") {\n var element = document.getElementById(id);\n element.checked = true;\n }\n\n console.log(\"restored: \" + id + \" as \" + value);\n }\n\n spawnIconRow(\"set1\", \"Default\");\n spawnIconRow(\"set2\", \"Default Grey\");\n spawnIconRow(\"set3\", \"Default White\");\n spawnIconRow(\"set11\", \"Native\");\n spawnIconRow(\"set12\", \"Native Grey\");\n spawnIconRow(\"set8\", \"Gmail Glossy\");\n spawnIconRow(\"set9\", \"Gmail Mini\");\n spawnIconRow(\"set10\", \"Gmail Monochrome\");\n spawnIconRow(\"set4\", \"Alternative 1\");\n spawnIconRow(\"set5\", \"Alternative 2\");\n spawnIconRow(\"set6\", \"Chromified Classic\");\n spawnIconRow(\"set7\", \"Chromified Grey\");\n\n var iconRadios = document.forms[0].icon_set;\n var iconFound = false;\n for (var i in iconRadios) {\n if (iconRadios[i].value == localStorage[\"gc_icon_set\"]) {\n iconRadios[i].checked = true;\n iconFound = true;\n break;\n }\n }\n if (!iconFound) {\n iconRadios[0].checked = true;\n }\n\n var previewRadios = document.forms[0].preview_setting;\n for (var i in previewRadios) {\n if (previewRadios[i].value == localStorage[\"gc_preview_setting\"]) {\n previewRadios[i].checked = true;\n break;\n }\n }\n\n if (localStorage[\"gc_poll\"] != null) {\n document.getElementById(\"poll_\" + localStorage[\"gc_poll\"]).selected = true;\n }\n\n accounts = localStorage.getObject(\"gc_accounts\");\n if (accounts == null) {\n accounts = new Array();\n }\n\n var langSel = document.getElementById(\"languages\");\n for (var i in languages) {\n langSel.add(new Option(languages[i].what, languages[i].id), languages[i].id);\n }\n langSel.value = localStorage[\"gc_language\"];\n\n sortlist(langSel);\n\n var acc_sel = document.getElementById(\"accounts\");\n for (var i in accounts) {\n if (accounts[i] == null || accounts[i].domain == null)\n break;\n acc_sel.add(new Option(accounts[i].domain), null);\n }\n\n //chrome.extension.getBackgroundPage().getLabels(\"https://mail.google.com/mail/\", loadLabels);\n}", "function restore_options() {\n // Use default value color = 'red' and likesColor = true.\n chrome.storage.sync.get(['takeoverEnabled'], function(items) {\n console.log(items.takeoverEnabled);\n document.getElementById('always_noise').checked = items.takeoverEnabled;\n });\n}", "function restore_options() {\n chrome.storage.local.get({\n username: '',\n password: ''\n }, function(options) {\n document.getElementById('username').value = options.username;\n document.getElementById('password').value = options.password;\n });\n}", "function restoreSettings() {\n \n $(\"#quality_input\").val(settings.quality).slider(\"refresh\");\n $(\"#width_input\").val(settings.targetWidth).slider(\"refresh\");\n $(\"#height_input\").val(settings.targetHeight).slider(\"refresh\");\n \n if (settings.allowEdit) {\n $(\"#edit_input\").attr(\"checked\", true).checkboxradio(\"refresh\");\n } else {\n $(\"#edit_input\").removeAttr(\"checked\").checkboxradio(\"refresh\");\n }\n \n if (settings.correctOrientation) {\n $(\"#orient_input\").attr(\"checked\", true).checkboxradio(\"refresh\");\n } else {\n $(\"#orient_input\").removeAttr(\"checked\").checkboxradio(\"refresh\"); \n }\n \n var saveSwitch = $(\"#save_input\");\n saveSwitch[0].selectedIndex = ((settings.saveToPhotoAlbum === true) ? 1 : 0);\n saveSwitch.slider(\"refresh\");\n \n $(\"#encod_input\").val(settings.encodingType).selectmenu(\"refresh\");\n $(\"#media_input\").val(settings.mediaType).selectmenu(\"refresh\");\n}", "function restore_options() {\n if (common.options.getRSSChannels()) {\n var rss_channels_config = JSON.parse(common.options.getRSSChannels());\n Object.keys(rss_channels_config).forEach(function (key) {\n document.getElementById(key).checked = (rss_channels_config[key] === \"true\");\n });\n }\n document.getElementById(common.storageKey.showLastItems).value = common.options.getShowLastItems();\n document.getElementById(common.storageKey.updatePeriod).value = common.options.getUpdatePeriod();\n document.getElementById(common.storageKey.windowWidth).value = common.options.getWindowWith();\n}", "function restore_options() {\n $(\"#theme\").val(\"blue\");\n $(\"#font_size\").val(\"0.9em\");\n $(\"#popup_width\").val(\"610\");\n $(\"#popup_height\").val(\"620\");\n $(\"#bookmark_url\").val(\"http://www.google.com/bookmarks/\");\n $(\"#sig_url\").val(\"http://www.google.com/bookmarks/find\");\n}", "function restore_options() {\n // Use default values.\n chrome.storage.sync.get({\n openInNewTab: false, \n authorURL:'localhost:4502',\n publishURL:'localhost:4503',\n liveURL:'https://www.example.com', \n siteRootPath:'/content/aem-ninja',\n languagemastersPath:'/content/aem-ninja/language-masters/en',\n languagePath:'/content/aem-ninja/en-us',\n languagecodelength: '4',\n showStage: false,\n stageAuthorURL: 'https://localhost:4502',\n stagePublishURL: 'https://localhost:4503',\n stageLiveURL: 'https://stage.example.com' }, function(items) {\n document.getElementById('openInNewTab').checked = items.openInNewTab; \n document.getElementById('authorURL').value = items.authorURL;\n document.getElementById('publishURL').value=items.publishURL;\n document.getElementById('liveURL').value=items.liveURL; \n document.getElementById('siteRootPath').value=items.siteRootPath;\n document.getElementById('languagemastersPath').value=items.languagemastersPath;\n document.getElementById('languagePath').value=items.languagePath;\n document.getElementById('languagecodelength').value=items.languagecodelength;\n document.getElementById('showStage').checked=items.showStage;\n document.getElementById('stageAuthorURL').value=items.stageAuthorURL;\n document.getElementById('stagePublishURL').value=items.stagePublishURL;\n document.getElementById('stageLiveURL').value=items.stageLiveURL;\n \n showstageOptions();\n });\n}", "function restore_options() {\n chrome.storage.sync.get(tcDefaults, function(storage) {\n updateShortcutInputText('popKeyInput', storage.popKeyCode);\n });\n}", "function restoreOptions() {\n\tvar getting = browser.storage.local.get(SETTINGS_KEY.DEFAULTS);\n\tgetting.then((result) => {\n\t\tconsole.debug(JSON.parse(JSON.stringify(result)));\n\t\tif (result[SETTINGS_KEY.DEFAULTS]) {\n\t\t\tlet width = result[SETTINGS_KEY.DEFAULTS][SETTINGS_KEY.DEFAULT_MAX_WIDTH];\n\t\t\tlet enabled = result[SETTINGS_KEY.DEFAULTS][SETTINGS_KEY.DEFAULT_ENABLED];\n\t\t\tpopulateUI(width, enabled);\n\t\t} else {\n\t\t\tcallWithStorageDefaults(populateUI);\n\t\t}\n\t});\n}", "function restore_options() {\r\n console.debug(\"options restore_options function\");\r\n console.debug(localStorage[\"favorite_color\"]);\r\n var favorite = localStorage[\"favorite_color\"];\r\n if (!favorite) {\r\n return;\r\n }\r\n var select = document.getElementById(\"color\");\r\n for (var i = 0; i < select.children.length; i++) {\r\n var child = select.children[i];\r\n if (child.value == favorite) {\r\n child.selected = \"true\";\r\n break;\r\n }\r\n }\r\n}", "function restoreOptions() {\n\n var getting = browser.storage.local.get(\"currency\");\n getting.then(setCurrentChoice, onError);\n\n function setCurrentChoice(result) {\n document.querySelector(\"#currency\").value = result.currency || \"USD\";\n }\n\n function onError(error) {\n console.log(`Error: ${error}`);\n }\n}", "function restore_options() {\n chrome.storage.sync.get({\n publicKey: 'none',\n privateKey: 'none',\n passphrase: 'none',\n type: 'no'\n }, function(items) {\n document.getElementById('extcrypt-publicKey').value = items.publicKey;\n document.getElementById('extcrypt-privateKey').value = items.privateKey;\n document.getElementById('extcrypt-passphrase').value = items.passphrase;\n document.getElementById('extcrypt-select').value = items.type;\n });\n}", "function restore_options() {\n chrome.storage.local.get(null, function(items) {\n const fetchedValues = Object(items);\n document.querySelector(\"#localserverid\").value = fetchedValues.local_server_id || null;\n document.querySelector(\"#remoteserverid\").value = fetchedValues.remote_server_id || DEFAULT_MYOPENHAB_URL;\n document.querySelector(\"#pathid\").value = fetchedValues.path_id || DEFAULT_PATH;\n document.querySelector(\"#widthid\").value = fetchedValues.width_id || DEFAULT_WIDTH;\n document.querySelector(\"#heightid\").value = fetchedValues.height_id || DEFAULT_HEIGHT;\n });\n}", "function restore_options() {\r\n // Use default value keywords = 'none'.\r\n chrome.storage.sync.get({\r\n keywords: '',\r\n }, function(items) {\r\n document.getElementById('keywords').value = items.keywords;\r\n });\r\n}", "function restore_options() {\n if (typeof save === \"undefined\") {\n save = true;\n }\n\n if (typeof warn === \"undefined\") {\n warn = true;\n }\n\n if (typeof modify === \"undefined\") {\n modify = true;\n }\n\n if (typeof keyCommand === \"undefined\") {\n keyCommand = 69;\n }\n\n keyString.value = stringFromCharCode(keyCommand);\n keyValue.value = keyCommand;\n\n if (warn === \"true\") {\n warnYes.checked = true;\n } else {\n warnNo.checked = true;\n }\n\n if (save === \"true\") {\n saveYes.checked = true;\n } else {\n saveNo.checked = true;\n }\n\n if (modify === \"true\") {\n modifyYes.checked = true;\n } else {\n modifyNo.checked = true;\n }\n}", "function restore_options() {\t\n // Use default value badge = 'contact' and likesBadge = true.\n\tchrome.storage.local.get({\n\t\tfavoriteBadge: 'Contact',\n\t\tlikesBadge: true\n\t}, function(items) {\n\t\tdocument.getElementById('badge').value = items.favoriteBadge;\n\t\tdocument.getElementById('like').checked = items.likesBadge;\n\t\tvar chosenoption2 = items.favoriteBadge;\n\t\t//console.log('log: options='+chosenoption2);\n\t\tvar detail = document.getElementById('detail');\n\t\tif (chosenoption2 == \"none\"){\t \n\t\t\tdetail.textContent = '* Badge is Off.';\n\t\t}else if (chosenoption2 == \"contact\"){\n\t\t\tdetail.textContent = '* Show number of contact send new chat to you.';\n }else if (chosenoption2 == \"icontact\"){\n\t\t\tdetail.textContent = '* Show number of contact send new chat to you (inside icon). *This option is beta.';\n\t\t}else if (chosenoption2 == \"total\"){\n\t\t\tdetail.textContent = '* Show the total number of messages. (Next ver.)';\n\t\t}else {\n\t\t\tdetail.textContent = \"* First (Empty) default is 'Contacts'.\";\n\t\t}\n });\n \n}", "function restoreOptions() {\n\tdocument.getElementById(\"mail\").value = chrome.extension.getBackgroundPage().settings.getMail();\n\tdocument.getElementById(\"url\").value = chrome.extension.getBackgroundPage().settings.getURL();\n\tdocument.getElementById(\"contextMenu\").checked = chrome.extension.getBackgroundPage().settings.isContextMenu();\n\tdocument.getElementById(\"insertIntoPage\").checked = chrome.extension.getBackgroundPage().settings.isInsertIntoPage();\n\tdocument.getElementById(\"copyToClipboard\").checked = chrome.extension.getBackgroundPage().settings.isCopyToClipboard();\n\tdocument.getElementById(\"dateFormat\").value = chrome.extension.getBackgroundPage().settings.getDateFormat();\n }", "function saveOptions() {\n chrome.storage.sync.set(\n {\n translateHeadings: document.getElementById('selectorH').checked,\n translateParagraphs: document.getElementById('selectorP').checked,\n translateOthers: document.getElementById('selectorOthers').checked,\n }, function () {\n var status = document.getElementById('status');\n status.textContent = 'Options saved.';\n setTimeout(function () {\n status.textContent = '';\n }, 2000);\n });\n}", "function restore_options() {\n chrome.storage.sync.get({\n username: '',\n password: ''\n }, function(items) {\n document.getElementById('username').value = items.username;\n document.getElementById('password').value = items.password;\n });\n}", "function restore_options() {\n var favorite = localStorage[\"favorite_class\"];\n if (!favorite) {\n return;\n }\n var select = document.getElementById(\"trida\");\n for (var i = 0; i < select.children.length; i++) {\n var child = select.children[i];\n if (child.value == favorite) {\n child.selected = \"true\";\n break;\n }\n }\n}", "function restore_options() {\n\tchrome.storage.sync.get({\n\t\tname: '',\n\t\temail: '',\n\t\tphone: '',\n\t\taddress: '',\n\t\taddress2: '',\n\t\taddress3: '',\n\t\tcity: '',\n\t\tzip: '',\n\t\tstate: '',\n\t\tprefecture: '',\n\t\tcountry: '',\n\n\t\tcard_type: '',\n\t\tcard_no: '',\n\t\texpiry_month: '',\n\t\texpiry_year: '',\n\t\tcvv: '',\n\t\talt_size: '',\n\t\tany_size: '',\n\t\tautoco: '',\n\t\ttryagain: '',\n\t\tbypass: '',\n\t\tdelay: '',\n\n\t\tkw_enabled: '',\n\t\tar_enabled: '',\n\t\tstart_time: '',\n\t\tcategory: '',\n\t\tkeywords: '',\n\t\tcolour: '',\n\t\tsize: '',\n\t\tqueue: [],\n\t\treport: '',\n\t\tproxy: '',\n\t\tproxy_enabled: '',\n\t\t//tc_accepted: ''\n\t}, \n\tfunction(items) {\n\t\tdocument.getElementById(\"log-out\").innerText = JSON.stringify(items.report, null, 2);\n\t\t$(\"#changelog-out\").load(\"CHANGELOG\");\n\n\t\tdocument.getElementById('name').value = items.name;\n\t\tdocument.getElementById(\"email\").value = items.email;\n\t\tdocument.getElementById(\"phone\").value = items.phone;\n\t\tdocument.getElementById(\"address\").value = items.address;\n\t\tdocument.getElementById(\"address2\").value = items.address2;\n\t\tdocument.getElementById(\"address3\").value = items.address3;\n\t\tdocument.getElementById(\"city\").value = items.city;\n\t\tdocument.getElementById(\"zip\").value = items.zip;\n\t\tdocument.getElementById(\"state\").value = items.state;\n\t\tdocument.getElementById(\"prefecture\").value = items.prefecture;\n\t\tdocument.getElementById(\"country\").value = items.country;\n\n\t\tdocument.getElementById(\"card_type\").value = items.card_type;\n\t\tdocument.getElementById(\"card_no\").value = items.card_no;\n\t\tdocument.getElementById(\"expiry_month\").value = items.expiry_month;\n\t\tdocument.getElementById(\"expiry_year\").value = items.expiry_year;\n\t\tdocument.getElementById(\"cvv\").value = items.cvv;\n\t\tdocument.getElementById(\"alt-size\").value = items.alt_size;\n\t\tdocument.getElementById(\"any_size\").checked = items.any_size;\n\t\tdocument.getElementById(\"autoco\").checked = items.autoco;\n\t\tdocument.getElementById(\"tryagain\").checked = items.tryagain;\n\t\tdocument.getElementById(\"delay\").value = items.delay;\n\t\tdocument.getElementById(\"delay_text\").innerText = items.delay + \" seconds\";\n\n\t\tdocument.getElementById(\"kw_enabled\").checked = items.kw_enabled;\n\t\tdocument.getElementById(\"ar_enabled\").checked = items.ar_enabled;\n\t\tdocument.getElementById(\"start_time\").value = items.start_time;\n\t\tdocument.getElementById(\"category\").value = items.category;\n\t\tdocument.getElementById(\"keywords\").value = items.keywords;\n\t\tdocument.getElementById(\"colour\").value = items.colour;\n\t\tdocument.getElementById(\"size\").value = items.size;\n\n\t\tqueue_list = items.queue;\n\t\tfor (item in items.queue) {\n\t\t\t$('#queue-list').append($('<li class=\"list-group-item shopping-item\">').html(items.queue[item][0]+\": \"+items.queue[item][1]+\" - \"+items.queue[item][2]+\" (\"+items.queue[item][3]+\") <p class=\\\"delete-hint\\\">delete</p>\"));\n\t\t}\n\n\t\tif (items.kw_enabled) {\n\t\t\tdocument.getElementById(\"alt-size-group\").hidden = true;\n\t\t\tdocument.getElementById(\"kw-form-group\").hidden = false;\n\t\t}\n\t\telse {\n\t\t\tdocument.getElementById(\"alt-size-group\").hidden = false;\n\t\t\tdocument.getElementById(\"kw-form-group\").hidden = true;\n\t\t}\n\n\t\tdocument.getElementById(\"ver\").innerHTML = chrome.runtime.getManifest().version + \"&nbsp;\";\n\n\t\tdocument.getElementById(\"proxy-data\").value = items.proxy;\n\t\tdocument.getElementById(\"proxy_enabled\").checked = items.proxy_enabled;\n\n\t\tif (items.bypass) {\n\t\t\tdocument.getElementById(\"bypass\").checked = false;\n\t\t\tchrome.storage.sync.set({bypass: false}, null);\n\t\t}\n\t});\n}" ]
[ "0.81279916", "0.79553115", "0.79523224", "0.79512316", "0.7809927", "0.78080046", "0.7783688", "0.77806747", "0.77361786", "0.7689198", "0.76792824", "0.76773286", "0.76684135", "0.7657092", "0.76448876", "0.7644227", "0.7636709", "0.7631444", "0.7629365", "0.7624595", "0.7599532", "0.75879514", "0.75814027", "0.755545", "0.7550784", "0.7550072", "0.7546461", "0.75435585", "0.751141", "0.7480256", "0.74792665", "0.7469634", "0.7444717", "0.74412787", "0.7431839", "0.74312276", "0.74304295", "0.74039644", "0.7397963", "0.7390283", "0.73902524", "0.7381434", "0.73678887", "0.73281974", "0.7311348", "0.7308939", "0.73016465", "0.7298602", "0.72724205", "0.72507405", "0.7250501", "0.7234736", "0.7211961", "0.7204124", "0.7184035", "0.7179929", "0.716254", "0.71549284", "0.71189594", "0.7099789", "0.7094828", "0.7093426", "0.7093332", "0.7070715", "0.70703375", "0.7050222", "0.7003835", "0.6993126", "0.69865006", "0.6983445", "0.69825554", "0.69604796", "0.69522476", "0.6936509", "0.69291675", "0.691822", "0.6917714", "0.6901938", "0.69006246", "0.6898961", "0.68919075", "0.68815064", "0.68771553", "0.6867105", "0.6848873", "0.68441844", "0.6840189", "0.6836803", "0.68354535", "0.6829589", "0.6829178", "0.6796866", "0.67954415", "0.679536", "0.6777878", "0.6774007", "0.6768676", "0.6765509", "0.67550224", "0.6754094", "0.67515963" ]
0.0
-1
funcion que controla que se muestre el dialogo
function muestra(){ if(!$("#dialogoemergente").dialog("isOpen")){ $("#dialogoemergente").dialog("open"); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ConfirmDialog(){\r\n\r\n \r\n \r\n }", "function mostrarDialogoConfirmacion(){\n\t$('#dialog-confirm-001').dialog('open');\n\treturn false;\n}", "function EnviarAviso(){\n\t$(\"#dialogEnviarAviso\").dialog(\"open\");\n}", "function terminaTurnoProduzione(){\r\n \"use strict\";\r\n var spostamentiTot= getSommaSpostamenti();\r\n\tif(spostamentiTot===0){\r\n\t\t$(\"#fineTurnoPBody\").html(\"Hai terminato gli spostamenti da effettuare.\");\r\n\t}else{\r\n\t\t$(\"#fineTurnoPBody\").html(\"Hai ancora \"+spostamentiTot+\" spostamenti che potresti effettuare: <br>sei sicuro di terminare il turno?\");\r\n\t}\r\n\t\r\n $(\"#fineTurnoPDialog\").modal();\r\n}", "accept() {\n this.dialog = false;\n this.snackbarOk = true;\n this.runRoutine();\n }", "function clickDialogGetOut() {\n $(function () {\n $(\"#dialog-form\").dialog({\n buttons: [\n {\n text: \"Выдать\",\n click: function () {\n $(\"#loaderClaimGive\").show();\n var userSourceId = $(\"#userSource\").val().split(\";\")[0];\n var userTargetId = $(\"#userTarget\").val().split(\";\")[0];\n var employeId = null;\n if (userTargetId) {\n employeId = userTargetId;\n } else {\n employeId = currentUserId;\n }\n\n if ($(\"#getFile\").get(0).files.length === 0) {\n clickAcceptTask(null, moment(new Date()).format(), userSourceId, $(\"#discriptionModal\").val(), $(\"#urgencyModalClaim option:selected\").text(),\n $(\"#categoryModalClaim option:selected\").text(), null, employeId);\n } else {\n sendClaimWithFile(function (itemId) {\n clickAcceptTask(null, moment(new Date()).format(), userSourceId, $(\"#discriptionModal\").val(), $(\"#urgencyModalClaim option:selected\").text(),\n $(\"#categoryModalClaim option:selected\").text(), itemId, employeId);\n });\n }\n }\n }\n ],\n title: 'Выдать Заявку: ',\n width: 600,\n modal: true,\n resizable: false\n });\n });\n}", "function dialogOn() {\n\n if (typeof uiVersion != 'undefined' && uiVersion === 'Minuet' && dialog !== 'active') {\n openMinuetWarningDialog();\n }\n else {\n dialog = openWarningDialog();\n }\n isDialogOn = true;\n setCounter();\n\n\n }", "function selObjectDialog(){\n $('#dlgokcancel').dialog('option', 'title', _('Объекты'));\n $(\"#dlgokcancel_title\").show().text(_('Выберите из списка'));\n\n // инициализация диалога\n $(\"#dlgokcancel_content\").html('<strong>'+_('Загрузка...')+'</strong>').load('systems_objects_by_type', {id_system: cur_id_system, obj_type: $(\"#dlgoptedit_type_cmb>option:selected\").val()}, function(){\n //alert('async load content');\n $(\"#tbl_systems_objects_by_type\").Scrollable(180, '100%').tablesorter().find(\"thead>tr\").css(\"cursor\",\"pointer\");\n\n if ($(\"#dlgoptedit_obj_id_edt\").val())\n $(\"input:radio\").val([$(\"#dlgoptedit_obj_id_edt\").val()]);\n else\n $(\"input:radio\").val([$(\"input:radio:first\").val()]);\n\n // определение кнопок\n $(\"#dlgokcancel_ok_btn\").unbind('click').click(function()\n {\n //fill_input_filtered_users();\n var sel_object_id=$('input:radio[name=sel_object]:checked').val();\n\n fill_inputs_filtered_object(sel_object_id, 'from_table');\n\n // закрываем\n $(\"#dlgokcancel\").dialog(\"close\");\n //alert('after dlgokcancel.close');\n\n }); //dlgoptedit_save_btn click\n //alert('after filtered_users, bind');\n });\n\n //alert('selUsersDialog2');\n\n // события\n $(\"#dlgokcancel\").unbind('keypress').keypress(function(e){if(e.keyCode==13){$(\"#dlgokcancel_ok_btn\").click();}});\n\n // определение кнопок\n $(\"#dlgokcancel_cancel_btn\").unbind('click').click(function(){$(\"#dlgokcancel\").dialog(\"close\");});\n\n if ($.browser.msie) {\n $( \"#dlgokcancel\" ).unbind( \"dialogclose\").bind( \"dialogclose\", function(event, ui) {\n $('#dlgoptedit_type_cmb').css('visibility', 'visible');\n });\n }\n // запуск диалога\n $(\"#dlgokcancel\").show().dialog(\"open\");\n //обязательно после show dialog\n if ($.browser.msie) {\n $('#dlgoptedit_type_cmb').css('visibility', 'hidden');\n $('#dlgokcancel .full_height').css('height', '250px');\n }\n //$(\"#dlgeoptdit_login_edt\").focus().select();\n\n //alert('selUsersDialog3');\n}", "function X_Inac() {\n $(\"#Dialog_Inactivar\").dialog(\"close\");\n}", "onAgregar() {\n this.dialog.show({\n title: \"Agregar Nuevo Tipo de Mascota\",\n body: \"Ingrese el nombre del nuevo tipo de mascota:\",\n prompt: Dialog.TextPrompt({\n placeholder: \"Nombre del tipo de mascota\",\n initialValue: \"\",\n required: true\n }),\n actions: [Dialog.CancelAction(), Dialog.OKAction((dialog) =>{\n axios.post(rutaApi+'animal', {idRaza:this.state.tipoMascota,Descripcion: dialog.value }).then(()=>{console.log('works'); window.location.replace(\"/AdministrarTiposDeMascotas\");})\n \n })],\n bsSize: \"small\",\n onHide: dialog => {\n dialog.hide();\n console.log(\"closed by clicking background.\");\n }\n });\n }", "function confirm_dialog(mensaje) {\n\n var contenido='<div id=\"mensaje\">';\n\t contenido+='<p style=\"color:black; text-align:center;\" class=\"mensaje\">Esta Seguro de '+mensaje+' el Usuario?</p>';\n\t\t contenido+='<div class=\"botones\" style=\"text-align:center;\">';\n\t\t contenido+='<a href=\"#\" style=\"color:#fff;\" id=\"aceptar\" class=\"btn btn-primary\">Aceptar</a>';\n\t\t contenido+='<a href=\"#\" style=\"color:#fff; margin-left:10px;\" id=\"cancelar\" class=\"btn btn-primary\">Cancelar</a>';\n\t\t contenido+='</div>'\n\t contenido+='</div>';\n\t \n\t modals(\"Informaci&oacute;n <i class='icon-question-sign'></i>\",contenido);\n\t \n\t $(\"#aceptar\").click(function(){\n\t\n\t\tvar cuanto=$(\".cedula_super\").length;\n\t\tif(cuanto >0){\n\t\t\tvar cedula=$(\".cedula_super\").html();\n\t\t\tvar estado=$(\".estado_super\").html();\n\t\t\t\n\t\t\t$.ajax({\n\t\t\t\turl:'activar_super.php',\n\t\t\t\ttype:'POST',\n\t\t\t\tdata:\"cedula=\"+cedula+\"&estado=\"+estado,\n\t\t\t\tsuccess:function(data){\n\t\t\t\t\t//document.write(data); return false;\n\t\t\t\t\tif(data=='3'){\n\t\t\t\t\t\t$(\".mensaje\").html(\"\");\n\t\t\t\t\t\t$(\".mensaje\").html('No se puede inactivar el usuario porque esta cubriendo un turno');\n\t\t\t\t\t\t$(\"#cancelar\").css(\"display\",\"none\");\n\t\t\t\t\t\t $(\"#aceptar\").click(function(){\n\t\t\t\t\t\t\t$('#myModal2').modal('hide');\n\t\t\t\t\t\t });\t \t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t}else if(data=='1'){\n\t\t\t\t\t\t\n\t\t\t\t\t\t$(\".mensaje\").html(\"\");\n\t\t\t\t\t\t$(\".mensaje\").html('Se hicieron los cambios correctamente');\n\t\t\t\t\t\t $(\"#content\").load('supernumerario_catalogo.php');\n\t\t\t\t\t\t $(\"#cancelar\").css(\"display\",\"none\");\n\t\t\t\t\t\t$(\"#aceptar\").click(function(){\n\t\t\t\t\t\t\t$('#myModal2').modal('hide');\n\t\t\t\t\t\t })\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t});\t\n\t\t}\n\t\treturn false;\n\t });\n\t \n\t $(\"#cancelar\").click(function(){\n\t\t$('#myModal2').modal('hide');\n\t });\n\t \n\t \n}", "function openDialog()\n{\n\tif (inviteOrCall==\"invite\")\n\t{\n\t\t$.dialog.buttonNames= ['Invite', 'Cancel'],\n\t\t$.dialog.message=\"Do you want to invite \"+ contact.getFullName();+\" to become a bofff ?\";\n\t\t$.dialog.show();\n\t}\n\telse\n\tif (inviteOrCall==\"call\")\n\t{\n\t\t$.dialog.buttonNames= ['Call', 'Cancel'],\n\t\t$.dialog.message=\"Are you sure want to call \"+ contact.getFullName()+\" on this number: \"+numberToCall+\" ?\";\n\t\t$.dialog.show();\n\t}\n\t\t\n}", "function startMessage() {\r\n $(\"#intro\").dialog({\r\n modal: true,\r\n buttons: {\r\n No: optionNo,\r\n Yes: optionYes\r\n },\r\n });\r\n}", "function ConfirmDialog() {\n\n //MessageLog.trace(\"\\n===================ConfirmDialog\\n\")\n\n if (Find_Unexposed_Substitutions()) {\n\n var d = new Dialog\n\n d.title = \"Delete_unexposed_substitutions\";\n\n rapport = \"The following subsitutions will be deleted : \"\n\n\n for (var c = 0; c < substituions_tab.columns.length; c++) {\n\n var currentColumn = substituions_tab.columns[c];\n\n var drawing = substituions_tab.drawings[c];\n\n for (var u = 0; u < substituions_tab.substitions[c].length; u++) {\n\n var sub_to_delete = substituions_tab.substitions[c][u];\n\n rapport += \"\\n\" + drawing + \" : \" + sub_to_delete;\n }\n\n }\n\n MessageLog.trace(rapport);\n\n if (rapport.length > 500) {\n rapport = \"Sorry too much informations to display please see the MessageLog\"\n\n }\n\n MessageBox.information(rapport)\n\n\n var rc = d.exec();\n\n if (rc) {\n\n Delete_Substitutions();\n\n }\n\n\n } else {\n\n \tMessageLog.trace(rapport);\n\n if (rapport.length > 500) {\n rapport = \"Sorry too much informations to display please see the MessageLog\"\n\n }\n\n MessageBox.information(rapport);\n\n }\n\n }", "function dialogoMensaje(mensaje) {\n $(\"#mensajeModal\").text(mensaje);\n $(\"#dialog-mensaje\").dialog({\n open: function(event, ui) { $(\".ui-dialog-titlebar-close\").hide();},\n draggable: false,\n resizable: false,\n width:300,\n height:150,\n modal: true,\n buttons: {\n \"Aceptar\": function() {\n $( this ).dialog( \"close\" );\n }\n }\n });\n }", "openDialog() {\n var message = this.getQuestion() + chalk.dim(this.messageCTA + ' Waiting...');\n this.screen.render(message, '');\n\n // Pause Readline to prevent stdin and stdout from being modified while the editor is showing\n this.rl.pause();\n this.dialog.open(this.endDialog.bind(this));\n }", "function selOptionDialog(){\n $(\"#dlgokcancel_title\").text('');\n $(\"#dlgokcancel_title\").show().text(_('Выберите из списка'));\n\n //$.getJSON('systems_view_name', {view_tag: 'options'}, function(json){\n $('#dlgokcancel').dialog('option', 'title', _('Опции'));\n //$('#dlgokcancel').dialog('option', 'title', json.ext_data);\n //alert($(\"#dlgokcancel_title\").text());\n //});\n\n // инициализация диалога\n $(\"#dlgokcancel_content\").html('<strong>'+_('Загрузка...')+'</strong>').load('systems_options', function(){\n //alert('async load content');\n $(\"#tbl_systems_options\").Scrollable(280, '100%').tablesorter().find(\"thead>tr\").css(\"cursor\",\"pointer\");\n\n if ($(\"#dlgoptedit_opt_edt\").val())\n $(\"input:radio\").val([parseOptId($(\"#dlgoptedit_opt_edt\").val())]);\n else\n //$(\"input:radio\").val([$(\"input:radio:first\").val()])\n ;\n\n // определение кнопок\n $(\"#dlgokcancel_ok_btn\").unbind('click').click(function()\n {\n //fill_input_filtered_users();\n var sel_opt_id=$('input:radio[name=sel_option]:checked').val();\n\n fill_input_filtered_option(sel_opt_id, 'from_table');\n\n // закрываем\n $(\"#dlgokcancel\").dialog(\"close\");\n //alert('after dlgokcancel.close');\n\n }); //dlgoptedit_save_btn click\n //alert('after filtered_users, bind');\n });\n\n //alert('selUsersDialog2');\n\n // события\n $(\"#dlgokcancel\").unbind('keypress').keypress(function(e){if(e.keyCode==13){$(\"#dlgokcancel_ok_btn\").click();}});\n\n // определение кнопок\n $(\"#dlgokcancel_cancel_btn\").unbind('click').click(function(){$(\"#dlgokcancel\").dialog(\"close\");});\n\n if ($.browser.msie) {\n $( \"#dlgokcancel\" ).unbind( \"dialogclose\").bind( \"dialogclose\", function(event, ui) {\n $('#dlgoptedit_type_cmb').css('visibility', 'visible');\n });\n }\n // запуск диалога\n $(\"#dlgokcancel\").show().dialog(\"open\");\n //обязательно после show dialog\n if ($.browser.msie) {\n $('#dlgoptedit_type_cmb').css('visibility', 'hidden');\n $('#dlgokcancel .full_height').css('height', '346px');\n }\n //$(\"#dlgeoptdit_login_edt\").focus().select();\n //alert('selUsersDialog3');\n}", "function DialogoModal(){\n$(\"#divModal\").dialog({\n\t\t\tautoOpen: false,\n\t\t//\twidth: 200, //alto\n\t\t\twidth : 380, \t//ancho\n\t\t\tmodal: true,\t//modo\n\t\t\tbuttons: [\n\t\t\t\t{\n\t\t\t\t\ttext: \"Ok\",\n\t\t\t\t\tclick: function() {\n var corroborado = false;\n if (CorroborarCampoVacio(corroborado)){\n GuardarDatosModal();//Guarda datos del formulario de modal\n EnviaDatosModal();//Envia datos de modal\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttext: \"Cancel\",\n\t\t\t\t\tclick: function() {\n\t\t\t\t\tLimpiarForm(); //limpia los campos del formulario\n\t\t\t\t\t\t$( this ).dialog( \"close\" );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t]\n\t\t});\n\t\t}", "function onDialogCancel()\n{\n\tdialogClosed();\n\treturn true;\n}", "function dialog_edita_devolucion_asignar_responsable_vehiculo(div_dialog,direccion,titulo)\n{\n// alert('entra');\n burl=$('#b_url').val();\n this.cargar_contenido_html(div_dialog,direccion,0);//modulo=0 no sirve\n $( \"#\"+div_dialog ).dialog({\n title:titulo,\n autoOpen: true,\n height: 500,\n width: 630,\n modal: true,\n closeOnEscape: false,\n \n buttons:[\n {\n id: \"editar\",\n text: \"Guardar editar\",\n disabled:\"true\",\n click: function() {\n \n $.post(burl+\"vehiculo/guardar_vehiculo_asignado_responsable_editado\",{\n 'id_asig':$('#id_asig').val(),\n // 'id_asig_responsable':$('#id_asig_responsable').val(),\n //'id_vehiculo_resp':$('#id_vehiculo_resp').val(),\n // 'fecha_hora_asig':$('#fecha_hora_asig').val(),\n 'fecha_hora_dev':$('#fecha_hora_dev').val(),\n 'estado_registro':\"Activo\",\n //'id_estado_asig':$('#id_estado_asig').val(),\n // 'id_responsable':$('#asignado').val(),\n // 'ciudad_asig':$('#ciudad_asig :selected').val(),\n 'observaciones':$('#observaciones').val()\n \n \n }\n \n ,function(data){\n // alert (\"entra \");\n $(\"#\"+div_dialog +\" #respuesta\").html(data);\n //if($('#ayudata').val()!=0)\n \n setTimeout(function(){\n nuevadireccion=this.quita_parametros(direccion,1);\n // alert('direccion,'+direccion+\",nueva_direccion,\"+nuevadireccion);\n cargar_contenido_html(div_dialog,nuevadireccion+$('#ayudata').val(),0);\n }, 1000);//alert('funciona'); \n \n });}\n },\n {\n id: \"devolucion\",\n text: \"Guardar devolucion\",\n disabled:\"true\",\n click: function() {\n $.post(burl+\"vehiculo/guardar_vehiculo_asignado_responsable_devolucion\",{\n 'id_asig':$('#id_asig').val(),\n //'id_asig_responsable':$('#id_asig_responsable').val(),\n 'id_vehiculo_resp':$('#id_vehiculo_resp').val(),\n // 'fecha_hora_asig':$('#fecha_hora_asig').val(),\n 'fecha_hora_dev':$('#fecha_hora_dev').val(),\n 'id_estado_asig':$('#id_estado').val(),\n 'id_devolucion_veh':$('#id_asig').val(),\n 'estado_registro':\"Inactivo\",\n 'tipo_asignacion':\"Devolucion\",\n 'id_responsable':$('#asignado').val(),\n // 'ciudad_asig':$('#ciudad_asig :selected').val(),\n 'observaciones':$('#observaciones').val()\n \n \n }\n \n ,function(data){\n // alert (\"entra \");\n $(\"#\"+div_dialog +\" #respuesta\").html(data);\n //if($('#ayudata').val()!=0)\n \n setTimeout(function(){\n nuevadireccion=this.quita_parametros(direccion,1);\n // alert('direccion,'+direccion+\",nueva_direccion,\"+nuevadireccion);\n cargar_contenido_html(div_dialog,nuevadireccion+$('#ayudata').val(),0);\n }, 1000);\n location.reload(); //alert('funciona'); \n \n }); }\n },\n {\n id: \"button-ok\",\n text: \"Cerrar\",\n click: function() {\n // $(this).dialog(\"close\");\n //$(\"#mensaje\").dialog\n $( this ).dialog( \"close\" );\n location.reload(); \n //$(this).dialog();\n }\n }\n \n ]\n });\n}", "function getUserCreateForm(){\n showCreateDialog();\n}", "function dialog_edita_devolucion_asignar_vehiculo(div_dialog,direccion,titulo)\n{\n \n burl=$('#b_url').val();\n this.cargar_contenido_html(div_dialog,direccion,0);//modulo=0 no sirve\n $( \"#\"+div_dialog ).dialog({\n title:titulo,\n autoOpen: true,\n height: 500,\n width: 630,\n modal: true,\n closeOnEscape: false,\n \n buttons:[\n {\n id: \"editar\",\n text: \"Guardar editar\",\n disabled:\"true\",\n click: function() {\n \n $.post(burl+\"asignacion_vehiculo_regional/guardar_vehiculo_asignado_editando\",{\n 'id_asig':$('#id_asig').val(),\n // 'id_asig_responsable':$('#id_asig_responsable').val(),\n 'id_vehiculo_resp':$('#id_vehiculo_resp').val(),\n // 'fecha_hora_asig':$('#fecha_hora_asig').val(),\n 'fecha_hora_dev':$('#fecha_hora_dev').val(),\n 'estado_registro':\"Activo\",\n //'id_estado_asig':$('#id_estado_asig').val(),\n // 'id_responsable':$('#asignado').val(),\n // 'ciudad_asig':$('#ciudad_asig :selected').val(),\n 'observaciones':$('#observaciones').val()\n \n \n }\n \n ,function(data){\n // alert (\"entra \");\n $(\"#\"+div_dialog +\" #respuesta\").html(data);\n //if($('#ayudata').val()!=0)\n \n setTimeout(function(){\n nuevadireccion=this.quita_parametros(direccion,1);\n // alert('direccion,'+direccion+\",nueva_direccion,\"+nuevadireccion);\n cargar_contenido_html(div_dialog,nuevadireccion+$('#ayudata').val(),0);\n }, 1000);//alert('funciona'); \n \n });}\n },\n {\n id: \"devolucion\",\n text: \"Guardar devolucion\",\n disabled:\"true\",\n click: function() {\n $.post(burl+\"vehiculo/guardar_vehiculo_asignado_responsable_devolucion\",{\n 'id_asig':$('#id_asig').val(),\n //'id_asig_responsable':$('#id_asig_responsable').val(),\n 'id_vehiculo_resp':$('#id_vehiculo_resp').val(),\n // 'fecha_hora_asig':$('#fecha_hora_asig').val(),\n 'fecha_hora_dev':$('#fecha_hora_dev').val(),\n 'id_estado_asig':$('#id_estado').val(),\n 'id_devolucion_veh':$('#id_asig').val(),\n 'estado_registro':\"Inactivo\",\n 'tipo_asignacion':\"Devolucion\",\n 'id_responsable':$('#asignado').val(),\n // 'ciudad_asig':$('#ciudad_asig :selected').val(),\n 'observaciones':$('#observaciones').val()\n \n \n }\n \n ,function(data){\n // alert (\"entra \");\n $(\"#\"+div_dialog +\" #respuesta\").html(data);\n //if($('#ayudata').val()!=0)\n \n setTimeout(function(){\n nuevadireccion=this.quita_parametros(direccion,1);\n // alert('direccion,'+direccion+\",nueva_direccion,\"+nuevadireccion);\n cargar_contenido_html(div_dialog,nuevadireccion+$('#ayudata').val(),0);\n }, 1000);\n location.reload(); //alert('funciona'); \n \n }); }\n },\n {\n id: \"button-ok\",\n text: \"Cerrar\",\n click: function() {\n // $(this).dialog(\"close\");\n //$(\"#mensaje\").dialog\n $( this ).dialog( \"close\" );\n location.reload(); \n //$(this).dialog();\n }\n }\n \n ]\n });\n}", "function showConfirmationDialog() {\r\n\tconfirmationDialog = generateDialog(language.data.account_deleted, '<p>' + language.data.account_del_successful + '</p><input class=\"input-button\" type=\"submit\" id=\"okay\" value=\"' + language.data.okay + '\" />');\r\n\topenDialog(confirmationDialog);\r\n\t$('input#okay').click(function() {closeDialog(confirmationDialog);});\r\n}", "accept() {\n this._dialog_ref.close('done');\n this.event.emit({ reason: 'done' });\n }", "function TRiotDialog(){\r\n\r\n }", "function showDialog(status)\n{\n novel.dialog.style.visibility = status;\n}", "function openDialogMove(){\r\n if(selectContacts(\"movConts\",\"hidegroupmov\")){\r\n\t\t fillgroup(\"seltomove\");\r\n\t $('#moveContacts').dialog('open');\r\n\t }\r\n\t else {\r\n\t errorF(\"No contacts selected\");\r\n\t $('#moveContacts').dialog('close');\r\n\t }\r\n}", "function motionDialog(choose, sw)\n\t\t{\n\t closeDialog();\n\t $(\"#dialog\").fadeIn(\"slow\", function()\n\t\t\t\t{\n\t\t\t\t\tshowDialog(choose);\n\t\t\t\t});\n\t\t}", "function successfullysent() {\n console.log(\"Invio delle notizie riuscito!\");\n $(\"#dialog\").fadeIn(750);\n $(\"#infomsg\").text(\"Invio delle notizie riuscito!\");\n $(\"#dialog\").delay(3000).fadeOut(2000);\n}", "function modalDialog2_handleOK (e) {\r\n\t\tvar window = e.data.window;\r\n\t\tvar form = e.data.form;\r\n\t\tvar errorDiv = e.data.errorDiv;\r\n\t\tvar waitDiv = e.data.waitDiv;\r\n\t\tvar options = e.data.options;\r\n\t\t\r\n\t\tvar action = form ? form.attr(\"action\") : \"\";\r\n\r\n\t\terrorDiv.hide();\r\n\t\tvar message = form ? form.attr(\"confirm\") : \"\";\r\n\r\n\t\tif (options.confirmationMessageFunction)\r\n \t\tmessage = options.confirmationMessageFunction();\r\n \t\r\n \tif (options.confirmationMessage)\r\n \t\tmessage = options.confirmationMessage;\r\n\t\t\r\n \tif (message)\r\n \t{\r\n\t\t\tjConfirm(message, 'Confirma\\u00E7\\u00E3o', function(result) {\r\n\t\t\t\tif (result)\r\n\t\t\t\t\tmodalDialog2_executeCommand(window, form, action, errorDiv, waitDiv, options);\r\n\t\t\t});\r\n \t}\r\n \telse\r\n \t\tmodalDialog2_executeCommand(window, form, action, errorDiv, waitDiv, options);\r\n\t}", "function showPrompt(idPedido) {\n ons.notification.prompt('Ingrese un comentario')\n .then(function (input) {\n agregarComentario(idPedido, input);\n var message = input ? 'Gracias por su comentario' : 'El comentario no puede estar vacio';\n ons.notification.alert(message);\n });\n}", "_startDialogue () {\n this.app.DOM.messengerBtn.onclick = () => {\n let value = this.app.DOM.messengerInput.value;\n\n if (value != '') this._sendMessageFromUser(value);\n this.app.DOM.messengerInput.value = '';\n }\n }", "function ShowlolDialog(modal)\n {\n $(\"#loloverlay\").show();\n $(\"#loldialog\").fadeIn(300);\n\n if (modal)\n {\n $(\"#loloverlay\").unbind(\"click\");\n }\n else\n {\n $(\"#loloverlay\").click(function (e)\n {\n HidelolDialog();\n });\n }\n }", "function keepGoingDialog() {\n\tvar continueTimeoutID\n $(\"#continueAlert\").dialog({\n autoOpen: false,\n open: function(event, ui) {\n continueTimeoutID = setTimeout(function() {\n $(\"#continueAlert\").dialog(\"close\");\n logout();\n }, 180000);\n },\n buttons: [\n {\n text: \"Yes\",\n click: function() {\n $(this).dialog(\"close\");\n clearTimeout(continueTimeoutID);\n var resetComplete = reset();\n resetComplete.done(function() {\n $(\"#flowStart\").slideDown('slow');\n });\n }\n },\n {\n text: \"No\",\n click: function() {\n $(this).dialog(\"close\");\n clearTimeout(continueTimeoutID);\n logout();\n }\n }\n ],\n closeOnEscape: false,\n modal: true,\n draggable: false,\n resizable: false\n\n });\n}", "function ouvrir() {\n creationModal();\n }", "function X_Emer() {\n $(\"#Dialog_emergente\").dialog(\"close\");\n}", "function dialogGenerico(titulo, dato) {\r\n $(\"#mensajesPantalla\").dialog({\r\n height: \"auto\",\r\n width: \"auto\",\r\n resizable: true\r\n });\r\n $(\"#mensajesPantalla\").dialog('option', 'title', titulo);\r\n $(\"#mensajesPantalla\").html('<center> <div style=\"align:center\"><br>' + dato + '<\\/div><\\/center>');\r\n $(\"#mensajesPantalla\").dialog('option', 'buttons', {\r\n OK: function() {\r\n $(this).dialog('close')\r\n }\r\n });\r\n $(\"#mensajesPantalla\").dialog('open');\r\n}", "function dialogKreiren(stadtteil){\n let stadtTeilId = stadtteil.id;\n let selektorId = \"#\"+stadtTeilId;\n $(selektorId).click(function(){\n tortenDiagrammErstellen(stadtTeilId);\n $(\"#dialog\").dialog(\"open\");\n });\n}", "function optionIHateYou() {\r\n // If the user rudely refuses\r\n // to play\r\n $(this).dialog(\"close\");\r\n setChoice(\"No\");\r\n $(\"#Ihateyou\").dialog({\r\n modal: true,\r\n buttons: {\r\n Ok: function() {\r\n // the body will empty and\r\n // turn black\r\n $('body').empty();\r\n $('body').css(\"background-color\", \"black\");\r\n }\r\n }\r\n });\r\n}", "function buttonOkClickFunc(){\r\n\t\tself.close(); //关闭对话框\r\n\t\tconsole.log(\"button ok clicked!\");\r\n\t\tif(self.buttonOkCallback!=null){\r\n\t\t\tself.buttonOkCallback();\r\n\t\t}\r\n\t}", "function popup(){\n $( \"#dialog-message\" ).dialog({\n modal: true,\n buttons: {\n Start: function() {\n level ++;\n $( this ).dialog( \"close\" );\n callTimer(15);\n makeTrash(5, trashArray1);\n \n \n }\n }\n });\n}", "function cAlert(message, idElementFocus, tipo, fnSuccessName, fnSuccessName2) {\n\n\t// verifica mensaje\n\tvar n = message.length;\n\tvar ancho = 320;\n\tvar alto = 170;\n\tif (n > 40) {\n\t\tancho = 400;\n\t\talto = 200;\n\t}\n\n\t//tipo:0\n\tif (tipo == \"0\") {\n\t\t\n\t\tvar advertencia = '<div id=\"dialog-message\" style=\"display:none;\">'\n\t\t\t\t+ message + '</div>';\n\t\t$(\"body\").append(advertencia);\n\n\t\t// carga dialog\n\t\t$(\"#dialog-message\").dialog({\n\t\t\ttitle : \"Mensaje del sistema\",\n\t\t\twidth : ancho,\n\t\t\theight : alto,\n\t\t\tmodal : true,\n\t\t\tresizable : false,\n\t\t\tcloseText : \"Cerrar\",\n\t\t\tbuttons : {\n\t\t\t\t\"Aceptar\" : function() {\n\t\t\t\t\t\n\t\t\t\t\t//cerrar dialog\n\t\t\t\t\t$(this).dialog(\"close\");\n\t\t\t\t\t\n\t\t\t\t\t//ejecutar funcion\n\t\t\t\t\tif(fnSuccessName != \"\" && fnSuccessName != null){\n\t\t\t\t\t\teval(fnSuccessName);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t},\n\t\t\tclose : function(event, ui) {\n\n\t\t\t\t// elimina dialog\n\t\t\t\t$(\"#dialog-message\").remove();\n\n\t\t\t\t// enfoca control\n\t\t\t\tidElementFocus = \"#\" + $.trim(idElementFocus);\n\t\t\t\t$(idElementFocus).focus();\n\t\t\t}\n\t\t});\n\n\t//tipo:1\n\t} else if (tipo == \"1\") {\n\t\t\n\t\tvar advertencia = '<div id=\"dialog-message\" style=\"display:none;\">'\n\t\t\t\t+ message + '</div>';\n\t\t$(\"body\").append(advertencia);\n\n\t\t$(\"#dialog-message\").dialog({\n\t\t\ttitle : \"Mensaje del sistema\",\n\t\t\twidth : ancho,\n\t\t\theight : alto,\n\t\t\tmodal : true,\n\t\t\tresizable : false,\n\t\t\tcloseText : \"Cerrar\",\n\t\t\tbuttons : {\n\t\t\t\t\"Aceptar\" : function() {\n\t\t\t\t\twindow.location.href = \"inicio.htm\";\n\t\t\t\t}\n\t\t\t},\n\t\t\tclose : function(event, ui) {\n\n\t\t\t\t// elimina dialog\n\t\t\t\t$(\"#dialog-message\").remove();\n\n\t\t\t\twindow.location.href = \"inicio.htm\";\n\t\t\t}\n\t\t});\n\n\t//tipo:2\n\t} else if (tipo == \"2\") {\n\t\t\n\t\tvar advertencia = '<div id=\"dialog-message\" style=\"display:none;\">' + message + '</div>';\n\t\t$(\"body\").append(advertencia);\n\n\t\t$(\"#dialog-message\").dialog({\n\t\t\ttitle : \"Mensaje del sistema\",\n\t\t\twidth : 375,\n\t\t\theight : 200,\n\t\t\tmodal : true,\n\t\t\tresizable : false,\n\t\t\tcloseText : \"Cerrar\",\n\t\t\tbuttons : {\n\t\t\t\t\"Sí, satisfactoriamente\" : function() {\n\t\t\t\t\t\n\t\t\t\t\t//cerrar dialog\n\t\t\t\t\t$(this).dialog(\"close\");\n\t\t\t\t\t\n\t\t\t\t\t//ejecutar funcion\n\t\t\t\t\tif(fnSuccessName != \"\" && fnSuccessName != null){\n\t\t\t\t\t\teval(fnSuccessName);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t},\n\t\t\t\t\"Generar PDF nuevamente\" : function() {\n\t\t\t\t\t\n\t\t\t\t\t//cerrar dialog\n\t\t\t\t\t$(this).dialog(\"close\");\n\t\t\t\t\t\n\t\t\t\t\t//ejecutar funcion\n\t\t\t\t\tif(fnSuccessName2 != \"\" && fnSuccessName2 != null){\n\t\t\t\t\t\teval(fnSuccessName2);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t},\n\t\t\tclose : function(event, ui) {\n\n\t\t\t\t// elimina dialog\n\t\t\t\t$(\"#dialog-message\").remove();\n\n\t\t\t}\n\t\t});\n\t\t\n\t//tipo:3\n\t} else if (tipo == \"3\") {\n\t\t\n\t\tvar advertencia = '<div id=\"dialog-message\" style=\"display:none;\">' + message + '</div>';\n\t\t$(\"body\").append(advertencia);\n\n\t\t$(\"#dialog-message\").dialog({\n\t\t\ttitle : \"Mensaje del sistema\",\n\t\t\twidth : ancho,\n\t\t\theight : alto,\n\t\t\tmodal : true,\n\t\t\tresizable : false,\n\t\t\tcloseText : \"Cerrar\",\n\t\t\tbuttons : {\n\t\t\t\t\"Realizar Nuevo Registro\" : function() {\n\t\t\t\t\t\n\t\t\t\t\t//cerrar dialog\n\t\t\t\t\t$(this).dialog(\"close\");\n\t\t\t\t\t\n\t\t\t\t\t//ejecutar funcion\n\t\t\t\t\tif(fnSuccessName != \"\" && fnSuccessName != null){\n\t\t\t\t\t\teval(fnSuccessName);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t},\n\t\t\t\t\"Ir al Menú Principal\" : function() {\n\t\t\t\t\t\n\t\t\t\t\t//cerrar dialog\n\t\t\t\t\t$(this).dialog(\"close\");\n\t\t\t\t\t\n\t\t\t\t\t//ejecutar funcion\n\t\t\t\t\tif(fnSuccessName2 != \"\" && fnSuccessName2 != null){\n\t\t\t\t\t\teval(fnSuccessName2);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t},\n\t\t\tclose : function(event, ui) {\n\n\t\t\t\t// elimina dialog\n\t\t\t\t$(\"#dialog-message\").remove();\n\n\t\t\t}\n\t\t});\n\t}\n\n}", "function confirmation(id){\n $( \"#confirmation\" ).dialog({\n resizable: false,\n height:375,\n width:485,\n autoOpen: false,\n modal: true,\n buttons: {\n \"Terminer\": function() {\n $( this ).dialog( \"close\" ); \t \n return false;\n }\n }\n });\n}", "function showManage(mode,num,event) {\r\n var idK = document.getElementById('karyawanid_'+num);\r\n var param = \"mode=\"+mode+\"&num=\"+num+\"&karyawanid=\"+idK.value;\r\n \r\n function respon() {\r\n if (con.readyState == 4) {\r\n if (con.status == 200) {\r\n busy_off();\r\n if (!isSaveResponse(con.responseText)) {\r\n alert('ERROR TRANSACTION,\\n' + con.responseText);\r\n } else {\r\n // Success Response\r\n showDialog1('Manajemen Personalia',con.responseText,'800','400',event);\r\n var dialog = document.getElementById('dynamic1');\r\n dialog.style.top = '10%';\r\n dialog.style.left = '15%';\r\n }\r\n } else {\r\n busy_off();\r\n error_catch(con.status);\r\n }\r\n }\r\n }\r\n \r\n post_response_text('sdm_slave_karyawanadmin_detail.php', param, respon);\r\n}", "onEditar(idAnimal,Descripcion) {\n this.dialog.show({\n title: \"Editar Tipo de Mascota\",\n body: \"Ingrese el nombre del tipo de mascota:\",\n prompt: Dialog.TextPrompt({\n placeholder: Descripcion,\n initialValue: Descripcion,\n required: true\n }),\n actions: [Dialog.CancelAction(), Dialog.OKAction((dialog) =>{\n axios.put(rutaApi+'animal/'+idAnimal, {Descripcion: dialog.value }).then(()=>{console.log('works');window.location.replace(\"/AdministrarTiposDeMascotas\");})\n \n })],\n bsSize: \"small\",\n onHide: dialog => {\n dialog.hide();\n console.log(\"closed by clicking background.\");\n }\n });\n }", "function llenar_tabla_res() {\n //modal\n $(\"#dialog\").show();\n\n remover_datos_tabla();\n\n //checamos si hay fechas seleccionadas\n if ($(\"#fecha_inicio\").val() != \"\" && $(\"#fecha_termino\").val() != \"\") {\n //si el valor es el de por defecto\n if ($(\"#sect_Establecimientos\").val() == 0) {\n alert(\"¡seleccione Establecimiento(s)!\");\n }//fin if\n //si en valor es numerico y mayor al de por defecto\n else if ($(\"#sect_Establecimientos\").val() > 0) {\n //funcion para obtener por establecimiento\n obtener_datos_por_establecimiento()\n }//fin if\n //si el valor no es numerico y es igual a 'todos'\n else if ($(\"#sect_Establecimientos\").val() == \"todos\") {\n // alert(\"usted selecciono reporte de todos los establecimientos\");\n \n obtener_datos_todos_establecimiento();\n }//fin\n }//fin fechas\n else\n alert(\"seleccione fechas\");\n $(\"#dialog\").hide();\n}//fin", "function dlgAccept()\n{\n\tsaveIni();\n\tg_form.accept();\n}", "function mourir(){\n if(personnage.sante<0){\n presenceEnnemi = 666;\n dialogBox(\"Oh, on dirait que \" + rndEnnemi.nom + \" a eu raison de toi\\nT'es un peu une merde, et t'as un peu pas d'bol\\n\\ntu as tout de même niqué \"+compteurEnnemiVaincu +\" Boloss sur ta route\\n\\nf5 pour recommencer... DU DEBUT HAHAHA\")\n}\n}", "closeDialog() {\n this.dialog = false;\n this.errors = \"\";\n this.valid = true;\n }", "function DialogSuccess(message) {\n\n BootstrapDialog.show({\n type: BootstrapDialog.TYPE_SUCCESS,\n title: \"Exito\",\n message: \"<b>\" + message + \"</b>\",\n buttons: [{\n cssClass: 'btn-success',\n label: 'Cerrar',\n action: function (dialogItself) {\n location.href = $Ctr_help;\n }\n }]\n });\n}", "function close_ok_dialog() {\r\n\t \tdialog.hide();\r\n\t \treturn_focus.focus();\r\n\t }", "function _openDialog( pDialog ) {\n var lWSDlg$, lTitle, lId,\n lButtons = [{\n text : MSG.BUTTON.CANCEL,\n click : function() {\n lWSDlg$.dialog( \"close\" );\n }\n }];\n\n function _displayButton(pAction, pLabel, pHot, pClose ) {\n var lLabel, lStyle;\n\n if ( pLabel ) {\n lLabel = pLabel;\n } else {\n lLabel = MSG.BUTTON.APPLY;\n }\n if ( pHot ) {\n lStyle = 'ui-button--hot';\n }\n lButtons.push({\n text : lLabel,\n class : lStyle,\n click : function() {\n that.actions( pAction );\n if ( pClose ) {\n lWSDlg$.dialog( \"close\" );\n }\n }\n });\n }\n\n if ( pDialog==='WEBSHEET' ) {\n lTitle = MSG.DIALOG_TITLE.PROPERTIES;\n _displayButton( 'websheet_properties_save', null, true, false );\n } else if ( pDialog==='ADD_COLUMN' ) {\n lTitle = MSG.DIALOG_TITLE.ADD_COLUMN;\n _displayButton( 'column_add', null, true, false );\n } else if ( pDialog==='COLUMN_PROPERTIES' ) {\n lTitle = MSG.DIALOG_TITLE.COLUMN_PROPERTIES;\n _displayButton( 'column_properties_save', null, true, false );\n } else if ( pDialog==='LOV' ) {\n lTitle = MSG.DIALOG_TITLE.LOV;\n lId = apex.item( \"apexir_LOV_ID\" ).getValue();\n if ( lId ) {\n _displayButton( 'lov_delete', MSG.BUTTON.DELETE, false, false );\n }\n _displayButton( 'lov_save', null, true, false );\n } else if ( pDialog==='GROUP' || pDialog==='GROUP2' ) {\n lTitle = MSG.DIALOG_TITLE.COLUMN_GROUPS;\n lId = apex.item( \"apexir_GROUP_ID\" ).getValue();\n if ( lId ) {\n _displayButton( 'column_groups_delete', MSG.BUTTON.DELETE, false, false );\n }\n _displayButton( 'column_groups_save', null, true, false );\n } else if ( pDialog==='VALIDATION' ) {\n lTitle = MSG.DIALOG_TITLE.VALIDATION;\n lId = apex.item( \"apexir_VALIDATION_ID\" ).getValue();\n if ( lId ) {\n _displayButton( 'VALIDATION_DELETE', MSG.BUTTON.DELETE, false, false );\n }\n _displayButton( 'VALIDATION_SAVE', null, true, false );\n } else if ( pDialog==='REMOVE_COLUMN' ) {\n lTitle = MSG.DIALOG_TITLE.DELETE_COLUMNS;\n _displayButton( 'column_remove', MSG.BUTTON.DELETE, true, false );\n } else if ( pDialog==='SET_COLUMN_VALUE' ) {\n lTitle = MSG.DIALOG_TITLE.SET_COLUMN_VALUES;\n _displayButton( 'set_column_value', null, true, false );\n } else if ( pDialog==='REPLACE' ) {\n lTitle = MSG.DIALOG_TITLE.REPLACE;\n _displayButton( 'replace_column_value', null, true, false );\n } else if ( pDialog==='FILL' ) {\n lTitle = MSG.DIALOG_TITLE.FILL;\n _displayButton( 'fill_column_value', null, true, false );\n } else if ( pDialog==='DELETE_ROWS' ) {\n lTitle = MSG.DIALOG_TITLE.DELETE_ROWS;\n _displayButton( 'delete_rows', MSG.BUTTON.DELETE, true, false );\n } else if ( pDialog==='COPY' ) {\n lTitle = MSG.DIALOG_TITLE.COPY_DATA_GRID;\n _displayButton( 'copy', MSG.BUTTON.COPY, true, false );\n } else if ( pDialog==='DELETE' ) {\n lTitle = MSG.DIALOG_TITLE.DELETE_DATA_GRID;\n _displayButton( 'delete_websheet', MSG.BUTTON.DELETE, true, false );\n } else if ( pDialog==='ATTACHMENT' ) {\n lTitle = MSG.DIALOG_TITLE.ADD_FILE;\n _displayButton( 'ATTACHMENT_SAVE', null, true, true );\n } else if ( pDialog==='NOTE' ) {\n lTitle = MSG.DIALOG_TITLE.ADD_NOTE;\n _displayButton( 'NOTE_SAVE', null, true, false );\n } else if ( pDialog==='LINK' ) {\n lTitle = MSG.DIALOG_TITLE.ADD_LINK;\n _displayButton( 'LINK_SAVE', null, true, false );\n } else if ( pDialog==='TAGS' ) {\n lTitle = MSG.DIALOG_TITLE.ADD_TAGS;\n _displayButton( 'TAG_SAVE', null, true, false );\n }\n\n lWSDlg$ = $( \"#a-IRR-dialog-js\", apex.gPageContext$ ).dialog({\n modal : true,\n dialogClass: \"a-IRR-dialog\",\n width : \"auto\",\n height : \"auto\",\n minWidth : \"360\",\n title : lTitle,\n buttons : lButtons,\n close : function() {\n lWSDlg$.dialog( \"destroy\");\n }\n });\n }", "function startDialogValidator()\n{\n dialogsValidator(ig.global.data.dialogs);\n}", "function fn_mdl_alert(pHTML, pFuncion, pTitulo) {\r\n if ((pTitulo == null) | (pTitulo == 'undefined')) { pTitulo = 'VALIDACIONES PRINCIPALES'; }\r\n $(\"body\").append(\"<div id='divMessageDialogB'></div>\");\r\n $(\"#divMessageDialogB\").html(pHTML + '<br />');\r\n $(\"#divMessageDialogB\").dialog({\r\n modal: true\r\n , title: pTitulo\r\n , resizable: false\r\n\t , beforeclose: function (event, ui) {\r\n\t $(this).remove();\r\n\t if (pFuncion != null) pFuncion();\r\n\t },\r\n buttons: {\r\n \"Aceptar\": function () {\r\n $(this).remove();\r\n if (pFuncion != null) pFuncion(); \r\n }\r\n }\r\n });\r\n}", "function showDialog($type){\n\tif($type == dltOK){\n\n\t}else if($type == dltValidate) {\n\t\tswal(\"Warning\", \"Please check your input key.\",\"warning\");\n\t}\n}", "function open(dialog) {\n\t\n}", "function confirmDialog() {\n let confirmDialogID = document.getElementById(\"confirmCustomDialog\");\n confirmDialogID.close();\n document.getElementById(\"resultTxt\").innerHTML=\"Confirm result: true\";\n}", "function handleClose() {\n navigate(\"/EscolherCondominio\"); // vai pra tela de condominios\n setDialog(false);\n }", "function choose_297e201048183a730148183ad85c0001() {\n if (typeof(windowapi) == 'undefined') {\n $.dialog({content: 'url:departController.do?departSelect', zIndex: 2100, title: '<t:mutiLang langKey=\"common.department.list\"/>', lock: true, width: 400, height: 350, left: '85%', top: '65%', opacity: 0.4, button: [\n {name: '<t:mutiLang langKey=\"common.confirm\"/>', callback: clickcallback_297e201048183a730148183ad85c0001, focus: true},\n {name: '<t:mutiLang langKey=\"common.cancel\"/>', callback: function () {\n }}\n ]});\n } else {\n $.dialog({content: 'url:departController.do?departSelect', zIndex: 2100, title: '<t:mutiLang langKey=\"common.department.list\"/>', lock: true, parent: windowapi, width: 400, height: 350, left: '85%', top: '65%', opacity: 0.4, button: [\n {name: '<t:mutiLang langKey=\"common.confirm\"/>', callback: clickcallback_297e201048183a730148183ad85c0001, focus: true},\n {name: '<t:mutiLang langKey=\"common.cancel\"/>', callback: function () {\n }}\n ]});\n }\n}", "function showYouWon() {\n const text = \"Hurrraaay You get It.\";\n let dialog = getDialog('won', text)\n document.getElementById(\"result\").innerHTML = dialog;\n}", "function cent_op2()\r\n{\r\n\t'domready', Sexy = new SexyAlertBox();\r\n \tSexy.confirm('<h1>Confimar</h1><p>¿Esta seguro que desea regresar al centro de operaciones?</p><p>Pulsa \"Ok\" para continuar, o pulsa \"Cancelar\" para salir.</p>', \r\n\t{ onComplete: \r\n\t\tfunction(returnvalue) { \r\n\t\t if(returnvalue)\r\n\t\t {\r\n\t\t\tdocument.location=\"centro_op.php\";\r\n\t\t }\r\n\t\t}\r\n\t})\r\n}", "function validate_updateHelp() {\n\n BootstrapDialog.show({\n type: BootstrapDialog.TYPE_DANGER,\n title: \"Actualizar\",\n message: \"¿Tus datos son correctos?.\",\n buttons: [{\n label: 'Cerrar',\n action: function (dialogItself) {\n dialogItself.close();\n }\n }, {\n cssClass: 'btn-warning',\n label: 'Guardar',\n action: function () {\n formHelp();\n }\n }]\n });\n return false;\n\n}", "function showPayeePage() {\n gTrans.showDialogCorp = true;\n document.addEventListener(\"evtSelectionDialogInput\", handleInputPayeeAccOpen, false);\n document.addEventListener(\"evtSelectionDialogCloseInput\", handleInputPayeeAccClose, false);\n document.addEventListener(\"tabChange\", tabChanged, false);\n document.addEventListener(\"onInputSelected\", okSelected, false);\n //Tao dialog\n dialog = new DialogListInput(CONST_STR.get('TRANS_LOCAL_DIALOG_TITLE_ACC'), 'TH', CONST_PAYEE_INTER_TRANSFER);\n dialog.USERID = gCustomerNo;\n dialog.PAYNENAME = \"1\";\n dialog.TYPETEMPLATE = \"0\";\n dialog.showDialog(callbackShowDialogSuccessed, '');\n}", "function confirmarLiz () {\n\tliz.lizOK = true;\n\tdibujar();\n}", "showConfirmDialog() {\n this.props.showMakeOrderDialog();\n }", "function confirmUser() {\n resetOutput();\n let confirmDialogID = document.getElementById(\"confirmCustomDialog\");\n confirmDialogID.showModal();\n}", "function dialog_Click(e)\n{\n\tif (e.index==0)\n {\n \tif(inviteOrCall== \"invite\")\n \t{\n \t\talert (\"inviting\");\n \t\t//TODO: add SMS sending here\n \t}\n \telse\n \tif(inviteOrCall==\"call\")\n \t{\n \t\talert(\"calling\");\n \t\tcallContact(numberToCall);\n \t\t\n \t}\n }\n}", "function irAAgregarMaestro(){\r\n\tvar msg = \"Desea Agregar un NUEVO REGISTRO?.. \";\r\n\tif(confirm(msg)) Cons_maestro(\"\", \"agregar\",tabla,titulo);\r\n}", "function makeDialog(who, whoName, btns, left){\r\n $(who).dialog({\r\n \"autoOpen\": true,\r\n \"title\": whoName,\r\n \"buttons\": btns,\r\n\t\t\"modal\": true,\r\n\t\t\"position\": [left],\r\n \"minHeight\": 300,\r\n \"width\": 540,\r\n \"resizable\": true,\r\n \"open\": function (event, ui) {\r\n $('.ui-widget-overlay').css({'opacity':'0.2'});\r\n }\r\n });\r\n\t//dialog的X事件\r\n\t$('.ui-icon-closethick').click(function () {\r\n fn_ClearDialogData();\r\n\t});\r\n}", "function muestraMsg(titulo, mensaje, okButton, tipoMsg, okMsg = \"OK\", closeMsg = \"Close\") {\n document.getElementById(\"idMdlOK\").innerHTML = okMsg;\n document.getElementById(\"idMdlClose\").innerHTML = closeMsg;\n\n myModal.hide();\n switch (tipoMsg) {\n case \"error\":\n {\n titulo = \"<i style='color:red ' class='bi bi-exclamation-octagon-fill'></i> \" + titulo;\n }\n break;\n case \"question\":\n {\n titulo = \"<i style='color:blue' class='bi bi-question-circle-fill'></i> \" + titulo;\n }\n break;\n default:\n {\n titulo = \"<i style='color:green' class='bi bi-check-circle-fill'></i> \" + titulo;\n }\n break;\n }\n document.getElementById(\"idMdlTitle\").innerHTML = titulo;\n document.getElementById(\"idMdlMsg\").innerHTML = mensaje;\n document.getElementById(\"idMdlOK\").style.display = okButton ? \"block\" : \"none\";\n\n myModal.show();\n}", "function muestraMsg(titulo, mensaje, okButton, tipoMsg, okMsg = \"OK\", closeMsg = \"Close\") {\n document.getElementById(\"idMdlOK\").innerHTML = okMsg;\n document.getElementById(\"idMdlClose\").innerHTML = closeMsg;\n\n myModal.hide();\n switch (tipoMsg) {\n case \"error\":\n {\n titulo = \"<i style='color:red ' class='bi bi-exclamation-octagon-fill'></i> \" + titulo;\n }\n break;\n case \"question\":\n {\n titulo = \"<i style='color:blue' class='bi bi-question-circle-fill'></i> \" + titulo;\n }\n break;\n default:\n {\n titulo = \"<i style='color:green' class='bi bi-check-circle-fill'></i> \" + titulo;\n }\n break;\n }\n document.getElementById(\"idMdlTitle\").innerHTML = titulo;\n document.getElementById(\"idMdlMsg\").innerHTML = mensaje;\n document.getElementById(\"idMdlOK\").style.display = okButton ? \"block\" : \"none\";\n\n myModal.show();\n}", "function AddMemberHospitalSuccess() {\n\n if ($(\"#updateTargetId\").html() == \"True\") {\n\n //now we can close the dialog\n $('#addMemberHospitalDialog').dialog('close');\n\n //JQDialogAlert mass, status\n JQDialogAlert(\"Hospital saved successfully.\", \"dialogSuccess\");\n\n memberHospitalObjData.fnDraw();\n\n }\n else {\n //show message in popup\n $(\"#updateTargetId\").show();\n }\n}", "function onLoadPag(){\t\n\tconfigurarMenuSecundario(\"formulario\");\n\tfMostrarMensajeError();\n\tmanejarLista('hidden');\n\n\tvar opcionMenu = get('formulario.opcionMenu').toLowerCase();\n\tif(opcionMenu == 'modificar concurso'){\n\t\tdocument.getElementById(\"lblVersion\").style.display='none';\n\t\tdocument.getElementById(\"txtVersion\").style.display='none';\n\t}\n\n\tfocaliza(\"formulario.cbNumConcurso\", \"\");\n\tif (window.dialogArguments) { // Si es modal (se abrió mediante showModalDialog) DBLG500000915\n btnProxy(2,1); // boton 'volver', habilitado\n btnProxy(3,0); // boton 'Ir a pantalla de inicio', deshabilitado\n }\n\n\n }", "function OpenDialog_Upd_CategoryLevel1(IDCategoryLevel1) {\n var title = \"\";\n var width = 1200;\n var height = 900;\n if ($(\"#PositionShowDialog\").length <= 0) {\n $(\"body\").append('<div id=\"PositionShowDialog\" style=\"display:none; overflow-x:hidden; overflow-y:scroll;\" title=\"' + title + '\"></div>');\n }\n\n Fill_CategoryLevel1_Dialog_Upd(IDCategoryLevel1);\n\n $(\"#PositionShowDialog\").dialog({\n modal: true,\n width: width,\n //open: setTimeout('Change_TextareaToTinyMCE_OnPopup(\"#txt_InfoAlbumLang1\")', 2000), // Cần phải có settimeout,\n \n height: height,\n resizable: false,\n show: {\n effect: \"clip\",\n duration: 1000\n },\n hide: {\n effect: \"explode\",\n duration: 1000\n },\n\n buttons: {\n 'Đóng': function () {\n $(this).dialog('close');\n },\n 'Sửa': function () {\n //Save_Multi_TinyMCE(\"txt_Info_Lang\", sys_NumLang);\n Upd_CategoryLevel1(IDCategoryLevel1);\n \n $(this).dialog('close');\n }\n },\n close: function () {\n\n }\n });\n}", "function validate_addHelp() {\n\n BootstrapDialog.show({\n type: BootstrapDialog.TYPE_DANGER,\n title: \"Recuperar Contraseña.\",\n message: \"¿Tus datos son correctos?.\",\n buttons: [{\n label: 'Cerrar',\n action: function (dialogItself) {\n dialogItself.close();\n }\n }, {\n cssClass: 'btn-warning',\n label: 'Guardar',\n action: function () {\n formHelp_add();\n }\n }]\n });\n\n return false;\n\n}", "function actionCanceled() { \n\tOK = 3;\n\tdlg.hide();\n}", "function viewFR(id){\n $.Dialog({\n shadow: true,\n overlay: true,\n draggable: true,\n width: 500,\n padding: 10,\n onShow: function(){\n var titl,cont;\n if(id!=''){ //form mode : edit \n titl= 'Ubah '+mnu;\n var u =dir;\n var d ='aksi=ambiledit&replid='+id;\n ajax(u,d).done(function(r){\n $('#idformH').val(id);\n $('#gelombangDV').text(': '+r.gelombang);\n $('#tglmulaiTB').val(r.tglmulai);\n $('#tglselesaiTB').val(r.tglselesai);\n cmbdepartemen('form',r.departemen);\n cmbtahunajaran('form',r.tahunajaran);\n });\n }else{ // form mode : add \n titl='Tambah '+mnu;\n cmbtingkat('form','');\n }$.Dialog.title(titl);\n $.Dialog.content(contentFR);\n $('#tingkatH').val($('#tingkatS').val());\n }\n });\n }", "function AddRequestTypeSuccess() {\n\n if ($(\"#updateTargetId\").html() == \"True\") {\n\n //now we can close the dialog\n $('#addRequestTypeDialog').dialog('close');\n\n //JQDialogAlert mass, status\n JQDialogAlert(\"Data saved successfully.\", \"dialogSuccess\");\n\n ResetRequestTypeGrid();\n\n }\n else {\n //show message in popup\n $(\"#updateTargetId\").show();\n }\n}", "popupRefreshGift() {\n if (this.data.type != \"gift\")\n return console.warn(\"Tried to refresh a non-gift item: \" + this);\n\n const item = this.data;\n const itemData = item.data;\n\n let confirmed = false;\n let speaker = getMacroSpeaker(this.actor);\n let dlog = new Dialog({\n title: game.i18n.format(\"urbanjungle.dialog.refreshGift.title\", { \"name\": speaker.alias }),\n content: `\n <form>\n <h1>${game.i18n.format(\"urbanjungle.dialog.refreshGift.header\", { \"item\": this.data.name, \"actor\": this.actor?.data.name })}</h1>\n <div class=\"form-group\">\n <label class=\"normal-label\">Send to chat?</label>\n <input type=\"checkbox\" id=\"send\" name=\"send\" value=\"1\" checked></input>\n </div>\n </form>\n `,\n buttons: {\n one: {\n icon: '<i class=\"fas fa-check\"></i>',\n label: game.i18n.localize(\"urbanjungle.dialog.refresh\"),\n callback: () => confirmed = true\n },\n two: {\n icon: '<i class=\"fas fa-times\"></i>',\n label: game.i18n.localize(\"urbanjungle.dialog.cancel\"),\n callback: () => confirmed = false\n }\n },\n default: \"one\",\n render: html => { },\n close: html => {\n if (confirmed) {\n this.update({ \"data.exhausted\": false });\n let SEND = html.find('[name=send]');\n let sent = SEND.length > 0 ? SEND[0].checked : false;\n\n if (sent) {\n let contents = `<div class=\"urbanjungle\"><header class=\"chat-item flexrow\">\n <img class=\"item-image\" src=\"${item.img}\" title=\"${item.name}\" width=\"20\" height=\"20\"/>\n <div class=\"chat-header-small\">${game.i18n.format(\"urbanjungle.dialog.refreshGift.chatMessage\", { \"name\": item.name })}</div>\n </header>\n </div>`;\n let chatData = {\n \"content\": contents,\n \"speaker\": speaker\n };\n ChatMessage.applyRollMode(chatData, game.settings.get(\"core\", \"rollMode\"));\n CONFIG.ChatMessage.documentClass.create(chatData);\n }\n }\n }\n });\n dlog.render(true);\n }", "function AddMemberDonateTypeSuccess() {\n\n if ($(\"#updateTargetId\").html() == \"True\") {\n\n //now we can close the dialog\n $('#addMemberDonateTypeDialog').dialog('close');\n\n //JQDialogAlert mass, status\n JQDialogAlert(\"Donate Type saved successfully.\", \"dialogSuccess\");\n\n memberDonateTypeObjData.fnDraw();\n\n }\n else {\n //show message in popup\n $(\"#updateTargetId\").show();\n }\n}", "function showStatus() {\n\n if ((reporteSeleccionado == 13) || (reporteSeleccionado == 14)) {\n\n if (banderas.banderaTodoSeleccionado == 0) {\n if (Calles.length == 0) {\n ngNotify.set('Seleccione al menos una calle', { type: 'error' });\n }\n else {\n modalStatus();\n }\n }\n else if (banderas.banderaTodoSeleccionado == 1) {\n modalStatus();\n }\n }\n }", "function ShowWaitDialog() {\n}", "function confirmation(id){\n $( \"#confirmationSuppression\" ).dialog({\n resizable: false,\n height:170,\n width:405,\n autoOpen: false,\n modal: true,\n buttons: {\n \"Oui\": function() {\n $( this ).dialog( \"close\" );\n \n var cle = id;\n var chemin = '/simens/public/pharmacie/supprimer';\n $.ajax({\n type: 'POST',\n url: chemin , \n data:'id='+cle,\n success: function(data) { \n \t var result = jQuery.parseJSON(data);\n \t $(\"#\"+cle).fadeOut(function(){$(\"#\"+cle).empty();});\n \t $(\"#compteur\").html(result);\n \t \n },\n error:function(e){console.log(e);alert(\"Une erreur interne est survenue!\");},\n dataType: \"html\"\n });\n \t //return false;\n \t \n },\n \"Annuler\": function() {\n $( this ).dialog( \"close\" );\n }\n }\n });\n}", "function EditMemberHospitalSuccess() {\n if ($(\"#updateTargetId\").html() == \"True\") {\n\n //now we can close the dialog\n $('#editMemberHospitalDialog').dialog('close');\n\n //JQDialogAlert mass, status\n JQDialogAlert(\"Hospital updated successfully.\", \"dialogSuccess\");\n\n memberHospitalObjData.fnDraw();\n\n }\n else {\n //show message in popup\n $(\"#updateTargetId\").show();\n }\n}", "function ObtenerFormaAgregarCondicionPago() {\n $(\"#dialogAgregarCondicionPago\").obtenerVista({\n nombreTemplate: \"tmplAgregarCondicionPago.html\",\n despuesDeCompilar: function(pRespuesta) {\n $(\"#dialogAgregarCondicionPago\").dialog(\"open\");\n }\n });\n}", "function DialogAlertConfirm(msg, nombrefuncion) {\n\n if (cleanStr(msg) === \"\") {\n msg = \"Esta seguro que desea realizar esta operacion?\";\n }\n\n if (cleanStr(nombrefuncion) != \"\") {\n var booleano = true;\n nombrefuncion = nombrefuncion + \"(\" + booleano + \");\";\n } else {\n nombrefuncion = \"#\";\n }\n\n var dialogalert = \"\";\n dialogalert += '<div class=\"modal fade dialogbox\" id=\"DialogAlertConfirm\" data-bs-backdrop=\"static\" tabindex=\"-1\" role=\"dialog\">';\n dialogalert += '<div class=\"modal-dialog\" role=\"document\">';\n dialogalert += '<div class=\"modal-content\">';\n dialogalert += '<div class=\"modal-header\">';\n dialogalert += '<h5 class=\"modal-title\">MENSAJE IMPORTANTE</h5>';\n dialogalert += '</div>';\n dialogalert += '<div class=\"modal-body\">';\n dialogalert += msg;\n dialogalert += '</div>';\n dialogalert += '<div class=\"modal-footer\">';\n dialogalert += '<div class=\"btn-inline\">';\n dialogalert += '<a href=\"#\" class=\"btn btn-text-danger\" data-bs-dismiss=\"modal\">';\n dialogalert += '<ion-icon name=\"close-outline\"></ion-icon>';\n dialogalert += 'CANCELAR';\n dialogalert += '</a>';\n dialogalert += '<button onclick=\"' + nombrefuncion + '\" class=\"btn btn-text-primary\" data-bs-dismiss=\"modal\">';\n dialogalert += '<ion-icon name=\"checkmark-outline\"></ion-icon>';\n dialogalert += 'ACEPTAR';\n dialogalert += '</a>';\n dialogalert += '</div>';\n dialogalert += '</div>';\n dialogalert += '</div>';\n dialogalert += '</div>';\n dialogalert += '</div>';\n document.getElementById(\"divdialogalert\").innerHTML = \"\";\n document.getElementById(\"divdialogalert\").innerHTML = dialogalert;\n $(\"#DialogAlertConfirm\").modal('show');\n\n}", "function openDialogSave($alamat,$judul,$lebar,$tinggi,$halaman, $callback){\n\tvar rand = 'save-dialog'+Math.floor((Math.random()*1000)+3);\n\tvar $dialog = jQuery(\"<div title='\" + $judul + \"'></div>\");\n\tjQuery($dialog).dialog({\n\t\tmodal:true,\t\t\n\t\theight:$tinggi,\n\t\tdialogClass: rand,\n\t\twidth:$lebar,\t\n\t\topen: function ()\n\t\t\t{ jQuery(this).load($alamat); },\n\t\tbuttons: {\n\t\t\t'Close': function() {\t\t\t\n\t\t\t\tjQuery(this).dialog('close');\n\t\t\t},\n\t\t\t'Save': function() {\n\t\t\t\t//bypass validation if halaman kosong\n\t\t\t\tif($halaman != undefined) {\n\t\t\t\t\tif(validateForm($halaman)) {\n\t\t\t\t\t\tsubmitForm(jQuery(this).find('form'), rand, $dialog, true, $callback);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsubmitForm(jQuery(this).find('form'), rand, $dialog, true, $callback);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tclose: function(ev, ui) {\n\t\t\tjQuery(this).load(OEmpty);\n\t\t}\n \t});\n}", "function setDialogClick(e, id){\n e.preventDefault();\n setDialog(id);\n}", "function verMovimientoEntrada(id_control_movimiento){\n\t$.fancybox({\n\t\ttype: 'iframe',\n\t\thref: 'verMovimientosDeAlmacen.php?id_control_movimiento='+id_control_movimiento,\n\t\tmaxWidth\t: 900,\n\t\tmaxHeight\t: 800,\n\t\tfitToView\t: false,\n\t\twidth\t\t: '80%',\n\t\theight\t\t: '80%',\n\t\tautoSize\t: false,\n\t\tcloseClick\t: false,\n\t\topenEffect\t: 'none',\n\t\tcloseEffect\t: 'elastic',\n\t\tafterClose : function(){\n\t\t\t//$(\"#cantidadIAux\"+idOrdenCompra+numeroRenglon).val(numeroSerie);\n\t\t}\n\t});\n}", "function confirmDlg(msg, addr){\r\n\tif (confirm(msg)){\r\n\t\tgotoUrl(addr);\r\n\t}\r\n}", "showAlertDialogFalse(){\n dialog.showMessageBox({ \n title: 'Neue Map',\n type: 'info', \n buttons: ['OK'], \n message: 'Ihr Netzwerkplan ist bereits leer.'\n });\n }", "function viewFR(id){\n // $.Dialog({\n $.Dialog({\n shadow: true,\n overlay: true,\n draggable: true,\n width: 500,\n padding: 10,\n onShow: function(){\n var titlex='';\n\n // form :: departemen (disabled field) -----------------------------\n $.ajax({\n url:dir2,\n data:'aksi=cmb'+mnu2+'&replid='+$('#departemenS').val(),\n type:'post',\n dataType:'json',\n success:function(dt){\n titlex+='';\n $('#departemenH').val($('#departemenS').val());\n $('#tahunajaranH').val($('#tahunajaranS').val());\n $('#tingkatH').val($('#tingkatS').val());\n var out;\n if(dt.status!='sukses'){\n out=dt.status;\n }else{\n out=dt.departemen[0].nama;\n }$('#departemenTB').val(out);\n \n // form :: tahun ajaran (disabled field) --------------\n $.ajax({\n url:dir3,\n // data:'aksi=cmbtahunajaran&departemen='+$('#departemenS').val()+'&replid='+$('#tahunajaranS').val(),\n data:'aksi=cmbtahunajaran&replid='+$('#tahunajaranS').val(),\n dataType:'json',\n type:'post',\n success:function(dt2){\n // alert(titlex+' ok');\n var out2;\n if(dt.status!='sukses'){\n out2=dt2.status;\n }else{\n out2=dt2.tahunajaran[0].tahunajaran;\n }$('#tahunajaranTB').val(out2);\n \n // form :: tingkat (disabled field) --------------\n $.ajax({\n url:dir4,\n data:'aksi=cmbtingkat&replid='+$('#tingkatS').val(),\n dataType:'json',\n type:'post',\n success:function(dt3){\n // alert(titlex+' ok');\n var out3;\n if(dt3.status!='sukses'){\n out3=dt3.status;\n }else{\n out3=dt3.tingkat[0].tingkat;\n }$('#tingkatTB').val(out3);\n \n if (id!='') { // edit mode\n // form :: edit :: tampilkan data \n $.ajax({\n url:dir,\n data:'aksi=ambiledit&replid='+id,\n type:'post',\n dataType:'json',\n success:function(dt3){\n $('#idformH').val(id);\n $('#kelasTB').val(dt3.kelas);\n $('#kapasitasTB').val(dt3.kapasitas);\n $('#waliTB').val(dt3.wali);\n $('#keteranganTB').val(dt3.keterangan);\n }\n });\n // end of form :: edit :: tampilkan data \n // titlex='<span class=\"icon-pencil\"></span> Ubah ';\n titlex+='<span class=\"icon-pencil\"></span> Ubah ';\n }else{ //add mode\n // alert('judul ='+titlex);\n titlex+='<span class=\"icon-plus-2\"></span> Tambah ';\n // titlex='<span class=\"icon-plus-2\"></span> Tambah ';\n }\n }\n });\n\n }\n });\n // alert(titlex);\n //end of form :: tahun ajaran (disabled field) --------------\n }\n });\n //end of form :: departemen (disabled field) -----------------------------\n $.Dialog.title(titlex+' '+mnu);\n $.Dialog.content(contentFR);\n }\n });\n }", "_onLongRest(event) {\n event.preventDefault();\n new Dialog({\n title: \"Long Rest\",\n content: '<p>Take a long rest?</p><p>On a long rest you will recover hit points, half your maximum hit dice, ' +\n 'primary or secondary resources, and spell slots per day.</p>',\n buttons: {\n rest: {\n icon: '<i class=\"fas fa-bed\"></i>',\n label: \"Rest\",\n callback: async dlg => {\n const update = await this.actor.longRest();\n let msg = `${this.actor.name} takes a long rest and recovers ${update.dhp} Hit Points and ${update.dhd} Hit Dice.`;\n ChatMessage.create({\n user: game.user._id,\n speaker: {actor: this.actor, alias: this.actor.name},\n content: msg\n });\n }\n },\n cancel: {\n icon: '<i class=\"fas fa-times\"></i>',\n label: \"Cancel\"\n },\n },\n default: 'rest'\n }).render(true);\n }", "function isOver(){\n // stop the timer\n clearTimeout(stopTime);\n // show dialog message \n let stars = $(\".fa-star\").length;\n vex.dialog.confirm({\n message: `Congratulations!!! You matched all the cards in ${timeCount} seconds and earned ${stars}/3 star rating. Would you like to play again?`,\n callback: function(value){\n if (value){\n startGame();\n }\n }\n });\n}", "function dialog(text, type, onConfirm) {\n let box = $(admin).find('.sb-dialog-box').attr('data-type', type);\n $(box).find('p').html((type == 'alert' ? sb_('Are you sure?') + ' ' : '') + sb_(text));\n $(box).sbActivate().css({ 'margin-top': ($(box).outerHeight() / -2) + 'px', 'margin-left': ($(box).outerWidth() / -2) + 'px' });\n $(overlay).sbActivate();\n alertOnConfirmation = onConfirm;\n }", "onDialogButtonClick(){\n\n this.setState({isShowDialog:false});\n this.setState({dialogMsg:''});\n Actions.pop();\n setTimeout(()=> Actions.refresh(), 100); \n }", "function DeleteMenuMakananConfirm(IdMenuMakanan, MenuMakanan)\n{\n new Messi('Apakah anda yakin menghapus menu :<b>' + MenuMakanan + '</b>' , {title: 'Warning', modal: true, titleClass: 'warning', buttons: [{id: 0, label: 'Yes', val: 'Y' , btnClass: 'btn-danger'}, {id: 1, label: 'No', val: 'N', btnClass: 'btn-success'}], \n callback: function(val) \n {\n if (val==\"Y\")\n {\n parent.window.location = '?m=menumakanan&a=Delete&IdMenuMakanan='+IdMenuMakanan;\n }\n }\n });\n}", "function IniciarEventos(){\n\t$('#guardar').click(guardardatos)\n\t$('#cancelar').click(function(){window.history.back()})\n\tshowmessage()\n}", "function confirmarCompra (){\n $('#grillaContainer').fadeOut()\n grillaFinal.removeClass('d-none')\n if (carrito.length !=0){\n changuito.verTotal(grillaFinal)\n }\n $('#1cuota').click()\n}", "createPlayerOneDialog() {\n this.playerOneDialog = new Dialog({\n game: this.game,\n parent: this.game.world,\n name: 'player-one-dialog',\n options: {\n mainTextString: this.game.world.store.match.uid,\n secondaryTextString: `send this match id to a buddy${'\\n'}(they gotta pick Luke)`,\n buttonStates: [\n {\n textString: 'PLAY',\n inputDownCallback: function inputDownCallback() {\n this.tint(0xffdd00);\n },\n inputUpCallback: function inputUpCallback() {\n this.tint(0xffffff);\n this.game.world.store.howlManager.playHowl('selected');\n this.game.world.store.howlManager.fadeStopHowl('introMusic');\n this.game.state.start('Tutorial');\n },\n },\n {\n textString: 'COPY',\n inputDownCallback: function inputDownCallback() {\n this.tint(0xffdd00);\n },\n inputUpCallback: function inputUpCallback() {\n copy(this.game.world.store.match.uid);\n this.changeText('COPIED');\n setTimeout(() => {\n this.tint(0xffffff);\n this.changeText('COPY');\n }, 3000);\n },\n },\n ],\n },\n });\n }" ]
[ "0.7060399", "0.69042224", "0.68499523", "0.68241924", "0.67973536", "0.672315", "0.6715193", "0.67069167", "0.66626483", "0.6587793", "0.6583492", "0.6580355", "0.65671825", "0.6523991", "0.6501562", "0.64727396", "0.643945", "0.6425483", "0.64140314", "0.6410298", "0.64079946", "0.6402145", "0.6386514", "0.6381271", "0.6377422", "0.6377232", "0.6369856", "0.6367151", "0.63592803", "0.63280815", "0.63256294", "0.63128173", "0.6310085", "0.6307315", "0.63055784", "0.62989014", "0.62902975", "0.6288374", "0.6287136", "0.6275685", "0.6275417", "0.6268872", "0.6268546", "0.6258948", "0.6246048", "0.62385213", "0.62314844", "0.6223732", "0.62138456", "0.62074214", "0.62018615", "0.6198924", "0.6185975", "0.6184499", "0.61749667", "0.6168241", "0.6161902", "0.6154833", "0.6154096", "0.6150955", "0.6145781", "0.61286044", "0.6128241", "0.6121266", "0.6120381", "0.6113035", "0.6101791", "0.6100631", "0.60884327", "0.6086342", "0.6086342", "0.60860664", "0.60797614", "0.6069691", "0.6069619", "0.60601854", "0.6043752", "0.60383606", "0.6035447", "0.6029452", "0.6028154", "0.6027316", "0.6024371", "0.60176814", "0.6016663", "0.6011897", "0.6010946", "0.6008754", "0.6000518", "0.5998501", "0.5996317", "0.5988784", "0.5984501", "0.59801257", "0.59798265", "0.5978622", "0.59757847", "0.5974261", "0.5973588", "0.59641665" ]
0.68879086
2
Funcion para que se envien los datos mediante submit (que es lo que enlaza con php)
function enviaPHP() { var nombreusuario=$("#user").val(); var passusuario=$("#contra").val(); if(nombreusuario=="" || passusuario==""){//comprovamos que no sean campos vacios $("#errores").html("Todos los campos deben estar completos.");//si están vacios sacamos un mensaje por pantalla en el div "errores" $( "#shake" ).effect( "shake",{distance: 10},2000,oculta);//hacermos el efecto shake }else{ $("#loginsusuario").submit();//lo enviamos a la página de php para que compruebe en el servidor si el usuario existe } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onSubmit(ev) {\n ev.preventDefault()\n console.log(`Iniciando submit`)\n\n if (!validacionFinal(aNodosValidables)) {\n return\n }\n aFormData.forEach(item => oDatos[item.name] = item.value)\n aCheckBox.forEach(item => oDatos[item.name] = item.checked)\n aSelects.forEach(item => oDatos[item.name] = item.value)\n oDatos.sitio = getRadio(aRadioSitio)\n renderModal()\n }", "function fetchgo() {\r\n // (A) GET FORM DATA\r\n let data = new URLSearchParams();\r\n data.append(\"panjang\", document.getElementById(\"panjang1\").value);\r\n data.append(\"lebar\", document.getElementById(\"lebar1\").value);\r\n data.append(\"tinggi\", document.getElementById(\"tinggi1\").value);\r\n\r\n // (B) FETCH\r\n fetch(\"luas-volume-balok.php\", {\r\n method: 'POST',\r\n body: data\r\n })\r\n .then(function (response) {\r\n return response.text();\r\n })\r\n .then(function (text) {\r\n console.log(text);\r\n })\r\n .catch(function (error) {\r\n console.log(error)\r\n });\r\n\r\n // (C) PREVENT HTML FORM SUBMIT\r\n return false;\r\n}", "function submitForm(event) \n{\n let data_name = [\n \"Nom\",\n \"Prenom\",\n \"Genre\",\n \"Ville\",\n \"Code Postal\",\n \"Adresse\",\n \"Telephone\",\n \"Adresse Email\",\n \"Nombres d'habitants\",\n \"Modalites d'hebergement\",\n \"Duree d'hebergement\",\n \"Date\",\n \"Attente\",\n \"Questions\"\n ]\n let data = [];\n const data_containers = document.querySelectorAll('.input_container');\n console.log(data_containers);\n for (let i = 0; i < data_containers.length; i++) {\n console.log('clicked')\n let answer = data_containers[i].querySelector('.data').value;\n if (answer == \"\" && i != 13) {\n alert(\"Vous n'avez pas repondu a une des cases obligatoires.\");\n return;\n }\n data.push(answer);\n\n }\n\n let parameters = [];\n for (let i = 0; i < data.length; i++) {\n parameters.push(data_name[i] + '=' + data[i]) \n }\n\n let encoded_url = encodeURI(`https://script.google.com/macros/s/AKfycbzTM2nRDBcn4vDs2dTAJTnm7diQakYLrwTDxEGazT0oFMbowL7z/exec?${parameters.join('&')}`);\n fetch(encoded_url);\n location.reload();\n alert('Merci a vous. Vos coordonées ont bien étés enregistrées.');\n scroll(0,0);\n}", "function gps_generarIPK() {\n\n var veh_sel = document.getElementById(\"splaca\").value;\n var fecha_ini = document.getElementById(\"fechaInicio\").value;\n var fecha_fin = document.getElementById(\"fechaFinal\").value;\n\n if (veh_sel == \"\") {\n document.getElementById(\"msg\").innerHTML = \"* Seleccione un veh&iacute;culo para reporte IPK.\";\n return;\n }\n\n var data = null;\n var placa = \"\";\n if (veh_sel.indexOf(\",\") > 0)\n placa = veh_sel.split(\",\")[0];\n\n document.getElementById(\"placa_ipk\").value = placa;\n document.getElementById(\"fechaInicio_ipk\").value = fecha_ini;\n document.getElementById(\"fechaFinal_ipk\").value = fecha_fin;\n\n document.getElementById(\"form-ipk\").submit();\n\n //gps_verificarParametrosRespuesta();\n}", "submitForm(e) {\n e.preventDefault();\n window.M.updateTextFields();\n let data = Util.getDataElementsForm(e.target, false);\n\n MakeRequest({\n method: 'post',\n url: 'actividad/post',\n data : data\n }).then(response => {\n if (response.error) {\n return Util.getMsnDialog('danger', Util.getModelErrorMessages(response.message));\n }\n\n this.getActivitiesByCategory();\n return Util.getMsnDialog('success', 'Created');\n });\n }", "async function handleSubmit() {\n // check what text was put into the form field\n let loc = await document.getElementById('location').value;\n const postURL = 'http://localhost:8800/inputSubmit';\n // call to post function\n await postData(postURL, loc);\n}", "async function sendData() {\r\n const res = await fetch(\"/formulier/afhalen\", {\r\n method: \"POST\",\r\n body: JSON.stringify({\r\n naam: `${voorNaam} ${achterNaam}`,\r\n \"materiaal\": materiaal,\r\n datumTijd: currentDate,\r\n \"teruggebracht\": \"neen\",\r\n }),\r\n headers: {\r\n \"content-type\": \"application/json; charset=UTF-8\"\r\n }\r\n });\r\n if (!res.ok || res.status !== 200) {\r\n console.error('Error at sending data: ', res);\r\n return\r\n };\r\n const feedback = await res.json();\r\n if (feedback.message !== \"\") {\r\n sendErrorMessage(feedback.message);\r\n } else {\r\n const wrapper = document.querySelector(\".afhalen-wrapper\");\r\n wrapper.style.display = \"none\";\r\n // just to clear the error box if there is any\r\n sendErrorMessage(\"\");\r\n // reset the state\r\n resetState();\r\n }\r\n }", "function sendData(){\n\n\n\n\n\n \n var sexo = document.getElementsByName(\"sexo\");\n var input_sexo = \"No Definido\";\n\n for(var i = 0; i < sexo.length; i++) {\n if(sexo[i].checked)\n input_sexo = sexo[i].value;\n }\n\n\n\n\n\n\n\n\n\n \n // let name = document.querySelector(\"#name\").value;\n\n let data = {\n \"thing\": {\n \"sexo\": input_sexo,\n \"nombre\": input_nombre.value,\n \"email\": input_email.value,\n \"mensaje\": input_mensaje.value\n }\n\n\n };\n fetch(baseURL + groupID + \"/\" + collectionID, {\n \"method\": \"POST\",\n \"headers\": { \"Content-Type\": \"application/json\" },\n \"body\": JSON.stringify(data)\n }).then(function(r){\n if(!r.ok){\n console.log(\"error\")\n }\n // console.log(r.json());\n return r.json()\n })\n .then(function(json) {\n alert(\"Consulta enviada!\");\n // console.log(JSON.stringify(json));\n // contenedor.innerHTML = JSON.stringify(json);\n })\n .catch(function(e){\n console.log(e)\n })\n \n }", "submitForm(){\n\t\tlet instance = this;\n\t\tconst\tdata = JSON.stringify({\n\t\t\tinterest: instance.dropdownData.interest,\n\t\t\tloan: instance.calculatorData,\n\t\t\tnumberOfMonths: instance.dropdownData.months,\n\t\t\ttotalDebt: instance.debt\n\t\t});\n\t\t\n\t\t\n\t\tfetch(instance.endpoint, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t'Accept': 'application/json, text/plain, */*',\n\t\t\t\t'Content-Type': 'application/json'\n\t\t\t},\n\t\t\tbody: data\n\t\t}).then(resp => resp.json())\n\t\t\t.then(({status}) => instance.showFormMessage(status))\n\t\t\t.catch(err => instance.showFormMessage(`something wrong. Please contact the administrator.`, true))\n\t}", "function sendData () {\n\t\t\tfetch(form.action, {\n\t\t\t\tmethod: 'POST',\n\t\t\t\tbody: new FormData(form),\n\t\t\t\theaders: {\n\t\t\t\t\t'Accept': 'application/json'\n\t\t\t\t}\n\t\t\t}).then(function (response) {\n\t\t\t\tif (response.ok) {\n\t\t\t\t\treturn response.json();\n\t\t\t\t}\n\t\t\t\tthrow response;\n\t\t\t}).then(function (data) {\n\t\t\t\tshowStatus(data.msg, true);\n\t\t\t\tif (data.redirect) {\n\t\t\t\t\twindow.location.href = data.redirect;\n\t\t\t\t}\n\t\t\t}).catch(function (error) {\n\t\t\t\terror.json().then(function (err) {\n\t\t\t\t\tshowStatus(err.msg);\n\t\t\t\t});\n\t\t\t}).finally(function () {\n\t\t\t\tform.removeAttribute('data-submitting');\n\t\t\t});\n\t\t}", "function accionForm (datos) {\n var id_boton = $(this).attr('id');\n var tabla = $(\"#nom-tabla\").val();\n var nom = encodeURIComponent($(\"#nom\").val());\n var campos = $(\"#campos\").val();\n var requeridos = $(\"#requeridos\").val();\n var camp = campos.split(',');\n var campo_post = \"\";\n if(requeridos.length){\n var req = requeridos.split(',');\n for (var i = 0; i < req.length; i++) {\n var valor_req = $(\"#\"+req[i]).val();\n if(valor_req === ''){\n swal({title: \"Error!\",text: \"Este campo es requerido.\",type: \"error\",confirmButtonText: \"Aceptar\",confirmButtonColor: \"#E25856\"},function(){$(\"#\"+req[i]).focus();});\n return false;\n }\n }\n }\n for(var i = 0; i < camp.length; i++){\n if(i === 0){\n campo_post += camp[i]+\"=\"+$(\"#\"+camp[i]).val();\n }\n else{\n campo_post += \"&\"+camp[i]+\"=\"+$(\"#\"+camp[i]).val();\n }\n }\n // validamos si la tabla es la de banner\n if((tabla === 'rmb_banner') || (tabla === 'rmb_tcont')){\n var datos_form = new FormData($(\"#form_master\")[0]);\n }\n\n switch(id_boton){\n case 'cancel':\n $(\"#col-md-12\").load(\"./lista.php?tabla=\"+tabla+\"&nom=\"+nom);\n return;\n break;\n case 'ingresar':\n if((tabla === 'rmb_banner') || (tabla === 'rmb_tcont')){\n var send_post = datos_form;\n }\n else{\n var send_post = \"ins=1&tabla=\"+tabla+\"&\"+campo_post;\n }\n break;\n case 'actualizar':\n if((tabla === 'rmb_banner') || (tabla === 'rmb_tcont')){\n var send_post = datos_form;\n }\n else{\n var id = $(\"#id\").val();\n var send_post = \"id_upd=\"+id+\"&tabla=\"+tabla+\"&\"+campo_post;\n }\n break;\n }\n //Enviar los datos para ingresar o actualizar\n if((tabla === 'rmb_banner') || (tabla === 'rmb_tcont')){\n $.ajax({\n url:\"./edicion.php\",\n cache:false,\n type:\"POST\",\n contentType:false,\n data:send_post,\n processData:false,\n success: function(datos){\n if(datos !== ''){\n swal({\n title: \"Felicidades!\",\n text: datos,\n type: \"success\",\n confirmButtonText: \"Continuar\",\n confirmButtonColor: \"#94B86E\"\n },\n function() {\n $(\"#col-md-12\").load(\"./lista.php?tabla=\"+tabla+\"&nom=\"+nom);\n });\n }\n else{\n swal({\n title: \"Error!\",\n text: \"No se pudo \"+id_boton+\" el registro\",\n type: \"error\",\n confirmButtonText: \"Aceptar\",\n confirmButtonColor: \"#E25856\"\n },\n function() {\n $(\"#\"+req[i]).focus();\n });\n }\n }\n });\n }\n else{\n $.ajax({\n url:\"./edicion.php\",\n cache:false,\n type:\"POST\",\n data:send_post,\n success: function(datos){\n if(datos !== ''){\n swal({\n title: \"Felicidades!\",\n text: datos,\n type: \"success\",\n confirmButtonText: \"Continuar\",\n confirmButtonColor: \"#94B86E\"\n },\n function() {\n $(\"#col-md-12\").load(\"./lista.php?tabla=\"+tabla+\"&nom=\"+nom);\n });\n }\n else{\n swal({\n title: \"Error!\",\n text: \"No se pudo \"+id_boton+\" el registro\",\n type: \"error\",\n confirmButtonText: \"Aceptar\",\n confirmButtonColor: \"#E25856\"\n },\n function() {\n $(\"#\"+req[i]).focus();\n });\n }\n }\n });\n }\n}", "function submitForm(event){\n event.preventDefault();\n const arr = [];\n Object.entries(inputs).map(([key,val])=>{\n return arr.push(inputs[key][2])\n })\n Axios.post('/api/words/', arr).then((response)=>{\n history.push('/results/1')\n }).catch(err=>{\n console.log(err);\n })\n }", "function procesarFormularioCliente(){\n $('#form-vent-nuevo-cliente').on('submit', function(e){\n e.preventDefault();\n if($('#form-vent-nuevo-cliente').valid()){\n var datos = $(this).serializeArray();\n var out = ajaxCall(urlRegistroCliente, 'POST', datos);\n out.then(function(json){\n json = JSON.parse(json);\n $('#div-venta-nuevo-cliente').dialog('close');\n $('#nombre').val(json.nombre);\n $('#NIT').val(json.nit);\n $('#id-cliente').val(json.codcliente);\n });\n }else{\n $('#msg-error-cliente-form').append('<p> Los datos no estan completos</p>');\n }\n\n });\n}", "function handleSubmit(e) {\n e.preventDefault()\n setValue(input.value)\n console.log(data)\n }", "function _EnvioDatosyModal() {\n inputs = LSModule.LeerInputs();\n LSModule.GuardarInputs();\n console.log('enviodatos');\n $.post(url, inputs,\n function (data, textStatus, jqXHR) {\n console.log('Recibido');\n console.log(inputs);\n $('#modalmsg').html(\"Me gusta tu elección amigo<br>ZampApp's Actitude Always\");\n $('#modalfeedback').modal('show');\n setTimeout(_enlaceResultados, 4000);\n },\n )\n .fail(function () {\n ErrorEnvio()\n });\n // .fail(function (obj, textStatus, jqXHR) {\n // console.log('No Recibido');\n // $('#textModal').html(\"Parece que tenemos algún tipo de problema en la cocina<br>En unos segundos te redirigiremos a la página principal\");\n // $('#myModal').modal('show');\n // setTimeout(_enlaceHome, 4000);\n }", "function handleSubmit(e) {\n e.preventDefault()\n\n axios.post('http://localhost:3001/orders/finished', {\n email: form.email,\n\n order_id: orderData.order_id,\n\n firstName: form.firstName,\n lastName: form.lastName,\n address: form.address,\n depto: form.depto,\n phone: form.phone,\n products: products,\n discount: form.discount\n\n }).then((res) => console.log('oka'))\n\n\n axios.put(`http://localhost:3001/orders/${orderData.order_id}`, {\n state: \"Procesando\"\n }).then(() => setshowPostVenta(true))\n\n }", "function enviarCambioSucursal(){\n\t\n\t$(\"#form_cambiarSucursal\").submit();\n\t\n}", "function doPost(e) {\r\n // data e kita verifikasi\r\n var update = tg.doPost(e);\r\n\r\n // jika data valid proses pesan\r\n if (update) {\r\n prosesPesan(update);\r\n }\r\n}", "function enviar(){\n /* FormData:\n Recoge del form de HTML el \"name\" y \"value\" de cada \"INPUT\" para montar los datos y enviarlos al servidor.\n Esta objeto ya cuenta con la seguridad de \"csrf_token\"\n */\n const data = new FormData(document.getElementById('formulario'));\n fetch(\"http://127.0.0.1:8000/ProyectoAPP/ActualizarClienteAJAX/\", {\n method: \"POST\",\n body: data\n })\n .then(response => response.json())\n .then((data) => {\n alert(\"Cliente modificado correctamente!\")\n })\n\n}", "async function handleOnSubmit(e) {\n e.preventDefault();\n const formData = {};\n // Object with properties associated with the names of each field and their value\n Array.from(e.currentTarget.elements).map((field) => {\n if (!field.name) return;\n formData[field.name] = field.value;\n });\n\n //fetch form data\n fetch(\"/api/referral\", {\n method: \"post\",\n body: JSON.stringify(formData),\n });\n\n console.log(formData);\n }", "onSubmit(){\n\n \n // pegamos o evento submit do formulario\n // como ja pegamos o formulario no construtor\n // aqui so passa a variavel formEl.\n // Outra coisa aqui, vamos usar o arrow function dentro do metodo\n // para evitar conflito com o this da classe que passaria a ser o this da function. \n // Nesta arrow function nao for colocado os () poi tem apenas um paramentro\n this.formEl.addEventListener(\"submit\", event => {\n\n // cancela o evento padrao do form\n event.preventDefault();\n\n let btn = this.formEl.querySelector(\"[type=submit]\");\n\n btn.disabled = true;\n\n //aqui recriamaos a variavel values para tratar a variavel de imagem\n let values = this.getValues(); \n \n if(!values){\n return false;\n }\n\n // o then tem duas funcoes de retorno, a primeira para certo e a segunda para errado\n // foi usado arrow funcion nos parametros de retorno para evitar conflito com o this que esta \n // dentro da funcao\n this.getFoto().then(\n (content)=>{\n\n //aqui recebe o retorno da funcao de parametro\n //que a imagem criptografada\n values.photo = content;\n\n // pega os valores digitados no formulario e nao da request no formulario,\n // apenas cria uma linha no grid com os dados do formulario\n this.addLine( values );\n \n this.formEl.reset();\n\n btn.disabled = false;\n\n }, \n (e)=>{\n console.log(e);\n\n }\n ); \n\n });\n\n }", "function onSubmitAjout(e) {\n e.preventDefault();\n\n //On execute la requete sur le serveur distant\n let request = constructRequest(\"index.php?page=equipeajoutws\", \"POST\", $(this).serialize() );\n\n //En cas de succe de la requete\n request.done(function( infos ) {\n //on verifie si il n'y pas eu d'erreur lors du traitement par le controleur\n if(infos.message_invalid_ajout !== undefined) {\n //si il y en a eu une, on affiche le message d'erreur dans une alerte au dessus des entree du formulaire\n let ajoutMessage = $(\"#modal-ajout-message\");\n ajoutMessage.html(infos.message_invalid_ajout);\n ajoutMessage.show(250);\n } else {\n //sinon on cache le formulaire d'ajout et on affiche un message de succé tout en rechargeant les equipe\n $(\"#modal-ajout\").modal(\"hide\");\n showPopup(infos.popup_message, infos.popup_type);\n loadEquipes();\n }\n });\n}", "_submitData(event) {\n\n // prevent submit form\n event.preventDefault();\n\n if( !this._controlDataBeforeSend() ) {\n document.body.scrollTop = document.documentElement.scrollTop = 0;\n return;\n }\n\n //let xhr = new XMLHttpRequest();\n let data = {\n name: this.options.title,\n description: this.options.describe,\n clients: this.options.data\n };\n\n var xhr = $.ajax({\n type: \"POST\",\n url: this._config.url,\n contentType: \"application/json; charset=utf-8\",\n dataType: \"json\",\n data: JSON.stringify(data)\n });\n\n var complete = false;\n\n xhr\n .done(function() {\n complete = true;\n\n })\n .fail(function() {\n complete = false;\n })\n .always(function() {\n if(complete) {\n window.location = \"/autodialer/tasks?saved\";\n } else {\n noty({\n text: 'К сожалению произошла ошибка, попробуйте ещё раз!'\n });\n }\n });\n }", "function insertarDatosEmpeno(){\n \n \n\n var datos = new FormData(formulario);\n datos.append('fecha_inicial',fechaInicial);\n datos.append('cedula_empleado',idA);\n datos.append('ubicacionF',localStorage.getItem('filaU'));\n datos.append('ubicacionC',localStorage.getItem('columnaU'));\n datos.append('Insertar',1);\n\n var url='../php/Producto.php';\n for (var p of datos.entries()){\n \n console.log (p);\n }\n fetch(url,{\n method: 'POST',\n body: datos\n })\n .then( res => res.json())\n .then( data => {\n if(data==='Si'){\n formulario.reset();\n mensaje.innerHTML = `\n <div class=\"alert alert-danger\" role=\"alert\">\n Registro Exitoso\n </div>\n `;\n mensaje.style.display='block';\n console.log('Datos Insertados');\n }else{\n console.log(\"Error\");\n }\n });\n}", "function processProcedure() {\n var form = document.forms[0];\n if (hasEmptyFields(form)) {\n alert('Es müssen alle Felder ausgefüllt werden!\\nDie Texte dürfen außerdem keine Sonderzeichen enthalten!');\n return;\n }\n var submitForm = document.forms[1];\n submitForm.elements[1].value = form.elements['name'].value;\n submitForm.elements[2].value = generateJson(form);\n submitForm.submit();\n}", "function submitForm(e)\n{\n // Dit is de opdracht die de browser verteld niet de standaard actie uit te voeren\n e.preventDefault();\n\n // Hieronder, en nu pas, gaan we zelf bepalen wat er wel moet gebeuren na de submit\n // We roepen daarvoor een asynchrone functie aan om de api te benaderen met de formulier\n // gegevens.\n callAPI();\n}", "function frm_buscar_bienes()\r\n{\r\n var frm = $('#frm_buscar_bienes');\r\n var data_form ;\r\n frm.submit(function(e){\r\n e.preventDefault();\r\n data_form = $(this).serialize();\r\n $.ajax({\r\n url: 'controller/puente.php',\r\n type: 'POST',\r\n dataType: 'json',\r\n data: data_form,\r\n })\r\n .done(function(data) {\r\n console.log(data);\r\n })\r\n .fail(function() {\r\n console.log(\"error\");\r\n });\r\n \r\n });\r\n return false;\r\n}", "function submitForm(e){\n e.preventDefault(); // preventing default functionality of data\n const url = document.getElementById('article-url').value; // getting url typed by user\n if(checkURL(url)){\n console.log('Posting');\n postUrl('http://localhost:8081/data', {url: url}).then( // performng post request\n (data) => { // updating UI\n console.log('back');\n console.log(data);\n document.getElementById('text').innerHTML = `Text is: ${data.text}`;\n document.getElementById('agreement').innerHTML = `Agreement state: ${data.agreement}`;\n document.getElementById('subjectivity').innerHTML = `Subjectivity sate: ${data.subjectivity}`;\n document.getElementById('confidence').innerHTML = `Degree of confidence: ${data.confidence}`;\n document.getElementById('irony').innerHTML = `Irony state: ${data.irony}`;\n document.getElementById('score_tag').innerHTML = `Score Tag: ${data.score_tag}`;\n },\n (err)=>{\n console.log(err);\n }\n ) \n }\n else{ // If url is not valid, show aler and clear form\n alert('please enter a valid url'); \n document.getElementById('article-url').value = '';\n }\n}", "function submitData() {\n const url = '../functions/signuper.php';\n const formData = new FormData();\n const id = Math.random().toString(36).substr(2, 9);\n formData.append('mail', mail.value);\n formData.append('username', username.value);\n formData.append('password', password.value);\n formData.append('id', id);\n\n fetch(url, {\n method: 'POST',\n body: formData,\n }).then(response => response.text())\n .then(data => {\n if (data === 'set') {\n return window.location.href = '../login.php?m=Account created! Login here';\n } else if (data === 'already set') {\n return window.location.href = '../dashboard.php?m=Already Logged in!';\n } else {\n return showError(data);\n }\n })\n .catch( (error) => {\n showError('You are disconnected');\n });\n}", "function sceglidata(){\r\n\tvar a=document.datatessera.data.value;\r\n\tdocument.datatessera.action = \"riassuntoiscritti.php\";\r\n document.datatessera.submit();\r\n}", "function salvarInfInternauta(frm) {\n frm.resultado.style.display = 'none';\n frm.tipoSubmit.value = 'Normal';\n if (!validaFormInternauta(frm))\n return false;\n\n var Url;\n Url = './action/grava_Internauta.php';\n\n var XMLHttp = createRequest();\n if (XMLHttp == null)\n frm.submit();\n var fieldsValues = generateFieldsValues(frm);\n\n\n XMLHttp.open(\"post\", Url, true);\n XMLHttp.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n\n XMLHttp.onreadystatechange = function() {\n if (XMLHttp.readyState == 4) {\n if (XMLHttp.responseText.substr(0, 2) == 'OK') {\n frm.resultado.value = \"Cadastro alterado com sucesso\";\n frm.resultado.style.display = '';\n window.scroll(0, 0);\n } else {\n alert('Erro: ' + XMLHttp.responseText);\n }\n } else {\n// result.innerHTML = \"Verificando conexao: \" + XMLHttp.statusText;\n }\n };\n// alert(fieldsValues);\n XMLHttp.send(fieldsValues);\n\n// frm.tipoSubmit.value = 'Ajax';\n// var frmData = new FormData(frm);\n// XMLHttp.send(frmData);\n }", "function submitForm(){\n let arrColums = Array.prototype.slice.call(document.getElementsByClassName('colum'))\n let table = $('#Table') // Campo de tabela\n table = table.value.trim().toUpperCase()\n let pk = getSelectPrimaryKey()\n console.log(pk)\n if(pk === ''){\n alert('Selecione uma chave primaria')\n return\n }\n //Json\n $('#Convert-area-json').value = getJson(table,arrColums)\n // Aliasign\n $('#Convert-area-select').value = getAliasing(table, arrColums)\n // GET one\n $('#Convert-area-get-one').value = getGetOne(table, arrColums, pk)\n $('#uri-one').innerHTML = `${table.toLowerCase()}?${pk}={${pk}}`\n // GET all\n $('#Convert-area-get-all').value = getGetAll(table, arrColums)\n $('#uri-all').innerHTML = `${table.toLowerCase()}?pagina={page}`\n // POST\n $('#Convert-area-post').value = getPost(table, arrColums)\n $('#uri-post').innerHTML = `${table.toLowerCase()}`\n\n window.scrollTo(0,570)\n}", "function datosFormulario(frm) {\n let nombre= frm.nombre.value;\n let email = frm.email.value;\n let asunto= frm.asunto.value;\n let mensaje = frm.mensaje.value\n \n console.log(\"Nombre \",nombre);\n console.log(\"Email \",email);\n console.log(\"Asunto \",asunto);\n console.log(\"Mensaje \",mensaje);\n\n}", "function submitPai(event) {\n event.preventDefault();\n const data = new FormData(event.target);\n const formJSON = Object.fromEntries(data.entries());\n listaPessoas.pessoas.push({\n nome: formJSON.nome,\n filhos: [],\n });\n atualizarLista();\n listarPessoas(formJSON.nome, listaPessoas.pessoas.length - 1);\n} //Insere o pai ao array", "async function mensajeEnviado(){\n const form = new FormData(formulario);\n const response = await fetch(formulario.action,{\n method: formulario.method,\n body: form,\n headers:{\n 'Accept': 'application/json'\n }\n })\n if(response.ok){\n formulario.reset()\n alert(\"El formulario ha sido enviado correctamente, te escribire pronto\"); \n }\n \n}", "function formPOST(){\n\n\tthis.submit();\n\n}", "function guardarFormData() {\n this.datos;\n this.fmodificado;\n this.usrid;\n this.casid;\n}", "function onSubmit()\n{\n\tlet setupObj = getFormSetup();\n\tlet postString = \"\";\n\tif (setupObj)\n\t{\n\t\tpostString = makePOSTParams(setupObj);\n\t\tconsole.log(`Sending postString of ${postString}`);\n\t} else {\n\t\treturn false;\n\t}\n\n\tlet xmlhttp = new XMLHttpRequest();\n\txmlhttp.onload = function() {\n\t\tconsole.log(this.responseXML.body.outerHTML);\n\t\tlet message = this.responseXML.body.getElementById('responseMessage');\n\t\tdocument.body.insertBefore(document.body.firstChild.nextSibling, message);\n\t}\n\txmlhttp.open(\"POST\", \"../Generated/AddProduct.php\");\n\txmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n\txmlhttp.responseType = \"document\";\n\txmlhttp.send(postString);\n}", "function InsertarTareas(){\n\n\n\n const data = new FormData(document.getElementById('uno'));\n\n fetch(tareas, {\n method: \"POST\",\n body: data\n })\n .then(response => response.json())\n .then((data) => {\n\n\n\n alert(\"Tarea enviada correctamente\")\n })\n\n\n}", "function agregarFilaDeForm(event) {\r\n event.preventDefault();\r\n let data =\r\n {\r\n \"thing\":\r\n {\r\n \"numCapitulo\": capitulo.value,\r\n \"numTemporada\": temporada.value,\r\n \"titulo\": tituloSerie.value,\r\n \"fechaEmision\": emision.value,\r\n \"sinopsis\": sinop.value,\r\n }\r\n };\r\n\r\n guardarEnServicio(data)\r\n .then(function () {\r\n imprimirTabla();\r\n });\r\n\r\n\r\n}", "async function handleSubmit() {\n await api\n .post(`/delivery/${deliveryData.id}/problems`, {\n description: textInput,\n courier_id: profile.id,\n })\n .then(\n () => {\n Alert.alert('Sucesso!', 'Problema cadastrado com sucesso!');\n setTextInput('');\n },\n (error) => {\n console.tron.log(error);\n Alert.alert(\n 'Erro!',\n 'O problema não foi registrado. Por favor, tente mais tarde!'\n );\n }\n );\n }", "function submitData(data) {\n fetch(url, {\n method: \"POST\",\n body: JSON.stringify(data),\n headers: { \"Content-Type\": \"application/json\", Accept: \"application/json\" }\n });\n}", "function submit(e){\n e.preventDefault();\n if ( values.name,\n values.img &&\n values.height &&\n values.weight&&\n values.yearsOfLife&&\n values.temp) {\n \n dispatch(postTemperaments(values))\n alert('dogs creado')\n setValues({\n name:'',\n img:'',\n height: '',\n weight:'',\n yearsOfLife:'',\n temp:[],\n \n })\n history.push('/home')\n }else(\n alert('llenar todos los campos')\n )\n \n }", "function submitForm(e)\r\n {\r\n e.preventDefault();\r\n var namect = document.getElementById(\"namect\");\r\n var selectct = document.getElementById(\"selectct\");\r\n var emailct = document.getElementById(\"emailct\");\r\n var numberct = document.getElementById(\"numberct\");\r\n saveMessage(namect, selectct, emailct, numberct);\r\n }", "function sendPuntosRuta2 () {\n var puntos = extractPuntosRuta2(); \n var ruta = document.getElementById(\"sruta\").value;\n var msg = document.getElementById(\"msg\"); \n \n if (ruta == \"\") {\n msg.innerHTML = \"* Especifique una ruta.\";\n msg.setAttribute(\"class\", \"form-msg alert alert-info\");\n return;\n }\n \n if (puntos != false) {\n document.getElementById(\"ruta\").value = ruta;\n document.getElementById(\"puntos\").value = puntos;\n document.getElementById(\"form-nueva-ruta\").submit();\n } else { \n msg.innerHTML = \"* Especificaci&oacute;n de puntos es incorrecta. Verifique la existencia y orden de las bases.\";\n msg.setAttribute(\"class\", \"form-msg alert alert-info\");\n }\n}", "function Agregar(){\n const inputUbicacion = document.getElementById(\"ubicacion\").value;\n const inputCapacidad = document.getElementById(\"capacidad\").value;\n const inputNombreSalon = document.getElementById(\"nombresalon\").value;\n objClaveMateria = {\n \"Ubicacion\": inputUbicacion,\n \"NombreClave\": inputNombreSalon,\n \"Capacidad\": inputCapacidad\n }\n fetch(uri,{\n method: 'POST',\n headers:{\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(objClaveMateria)\n })\n .then(response => response.text())\n .then(data => Mensaje(data))\n .catch(error => console.error('Unable to Agregar Item.',error ,objClaveMateria));\n}", "function CambiarTransaccion(nombre,filtro)\n\n{ \n\n var f=document.forms[0]; \n\n f.Transaccion.value=nombre;\n\n f.Filtro.value=filtro;\n\n f.submit();\n\n return true;\n\n}", "submit() {\r\n\r\n this.inputsCheck();\r\n this.submitBtn.click(() => {\r\n this.pushToLocal();\r\n this.clearForm();\r\n\r\n })\r\n }", "async function handleSubmit() {\n Keyboard.dismiss();\n\n if (product !== \"\" && quantity !== \"\" && price !== \"\" && name !== \"\") {\n setLoading(true);\n\n try {\n const data = {\n name,\n product,\n quantity: parseInt(quantity),\n price: priceStringToFloat(price),\n orderDate,\n notes,\n isPaid,\n paymentDate: isPaid ? paymentDate : null,\n isDelivered,\n deliveryDate: isDelivered ? deliveryDate : null,\n type,\n platform,\n };\n\n if (type === \"sales\") {\n await SaleController.create(data);\n } else if (type === \"purchases\") {\n await PurchaseController.create(data);\n }\n\n new Message(\"Registro inserido com sucesso!\");\n\n clearFields();\n setLoading(false);\n } catch (err) {\n setLoading(false);\n\n throw new ErrorManager(err.message);\n }\n } else {\n new FillAllFields();\n }\n }", "function onSubmitModif(e) {\n e.preventDefault();\n\n //On execute la requete sur le serveur distant\n let request = constructRequest(\"index.php?page=equipemodifws\", \"POST\", $(this).serialize() );\n\n //En cas de succe de la requete\n request.done(function( infos ) {\n //on verifie si il n'y pas eu d'erreur lors du traitement par le controleur\n if(infos.message_invalid_modif !== undefined) {\n //si il y en a eu une, on affiche le message d'erreur dans une alerte au dessus des entree du formulaire\n let modifMessage = $(\"#modal-modif-message\");\n modifMessage.html(infos.message_invalid_modif);\n modifMessage.show(250);\n } else {\n //sinon on cache le formulaire de modification et on affiche un message de succé tout en rechargeant les equipe\n $(\"#modal-modif\").modal(\"hide\");\n showPopup(infos.popup_message, infos.popup_type);\n loadEquipes();\n }\n });\n}", "function handleSubmit(e) {\n e.preventDefault()\n if (validateForm()) {\n setLoading(true)\n\n createAPIEndpoint(ENDPIONTS.POSTEMPLOYEES20).createPrison( customers.EmployeeFormID, \"0\" ,values)\n .then(res => {\n setLoading(false)\n notify()\n SetCustomers(res.data.data)\n resetFormControls();\n \n })\n .then(res => {\n handlehistory( action.ADD , 'بيانات أولاد الاعمام ' , \" اضافه بيانات أولاد الاعمام \")\n })\n .catch(function (response) {\n //handle error\n notifyErr()\n setLoading(false)\n // notify()\n console.log(response);\n }); \n \n } \n console.log(values);\n }", "function submitForm (e) {\n e.preventDefault();\n let formData = new FormData(e.target);\n let body = [...formData.entries()] // expand the elements from the .entries() iterator into an actual array\n .map(e => encodeURIComponent(e[0]) + \"=\" + encodeURIComponent(e[1])) // transform the elements into encoded key-value-pair\n\n xhr.open(e.target.getAttribute('method') ? e.target.getAttribute('method') : e.target.method, e.target.action, true);\n xhr.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\n xhr.onload = (e) => {\n let json = JSON.parse(e.target.responseText);\n switch (json.type){\n case 'clone':\n if(json.result.error !== undefined ) {\n responseDOM.className = \"alert alert-danger\";\n responseDOM.innerText = json.result.error;\n } else {\n responseDOM.className = \"alert alert-success\";\n responseDOM.innerText = 'Successfully added! To complete installation you\\'ll have to restart Franz.'\n }\n break;\n case 'remove':\n responseDOM.className = \"alert alert-success\";\n responseDOM.innerText = json.result;\n break;\n case 'update':\n responseDOM.className = \"alert alert-success\";\n responseDOM.innerText = json.result;\n\n getPlugins();\n break;\n default:\n responseDOM.className = \"alert alert-info\";\n responseDOM.innerText = e.target.responseText;\n }\n };\n xhr.send(body);\n}", "submit() {\n const namedFieldNode = this.$['form-fields'].assignedNodes()\n .filter(node => node.hasAttribute && node.hasAttribute(\"name\"));\n\n const allValid = this.novalidate || namedFieldNode.every(node => node.validate ? node.validate() : true);\n\n if (allValid) {\n const reqData = namedFieldNode.reduce((result, node) => {\n const key = node.getAttribute('name');\n const value = node.value;\n result[key] = value;\n return result;\n }, {});\n const method = (this.method || '').toUpperCase();\n if(method === 'GET') {\n this._get(reqData);\n } else if(method === 'POST') {\n this._post(reqData);\n } else {\n throw new TypeError(`Unsupported method: ${this.method}`);\n }\n }\n }", "function submitData(currentForm, formType){ \n\t\t\n formSubmitted = 'true';\t\t\n\t\tvar formInput = $('#' + currentForm).serialize();\n \n arrAgendaHost = [];\n arrSalaHost = [];\n arrSessoesHost = [];\n\n\t\t$.post(ExternalURL+$('#' + currentForm).attr('action'),formInput, function(data){\t\t\t\n\t\t\t \n \n if(data.mensagem === 'fail')\n {\n formSubmitted = 'false';\n $('#authError').fadeIn(500);\n }\n else \n {\n \n //SESSION DATA\n sessionStorage.userlogado = 'true';\n sessionStorage.userId = data.mensagem['inscricoesId'];\n sessionStorage.userNome = data.mensagem['inscricoesNome'];\n sessionStorage.userEmail = data.mensagem['inscricoesEmail'];\n sessionStorage.userNomeCracha = data.mensagem['inscricoesNomeCracha'];\n sessionStorage.userStatus = data.mensagem['inscricoesStatus'];\n sessionStorage.userTipoInscricoesId = data.mensagem['inscricoesTipoInscricoesId'];\n sessionStorage.userTipoParticipantesId = data.mensagem['inscricoesTipoParticipanteId']; \n \n arrDadosCampos = [];\n arrDadosValues = [];\n campos = '';\n values = '';\n arrDadosCampos.push('inscricoesId, inscricoesNome, inscricoesEmail, inscricoesNomeCracha, inscricoesTipoInscricoesId, inscricoesTipoParticipanteId, inscricoesStatus');\n arrDadosValues.push('\"'+\n html_entity_decode(data.mensagem['inscricoesId'])+'\", \"'+\n html_entity_decode(data.mensagem['inscricoesNome'])+'\", \"'+\n html_entity_decode(data.mensagem['inscricoesEmail'])+'\", \"'+\n html_entity_decode(data.mensagem['inscricoesNomeCracha'])+'\", \"'+\n html_entity_decode(data.mensagem['inscricoesTipoInscricoesId'])+'\", \"'+\n html_entity_decode(data.mensagem['inscricoesTipoParticipanteId'])+'\", \"'+\n html_entity_decode(data.mensagem['inscricoesStatus'])+\n '\"');\n campos = implode(\", \", arrDadosCampos);\n values = implode(\", \", arrDadosValues);\n\n //Verificando se há usuarios cadastrados.\n dbSqlLite.handleGetDataSqlLite({tabela:'inscricoes', function:returnGetData});\n \n \n \n \n $('#home-form').hide('slow');\n $('#formSuccessMessageWrap').fadeIn(500);\n \n \n function returnGetData(boo, res)\n {\n if(!boo)\n {\n db.transaction(function(tx) {\n\n tx.executeSql(\"INSERT INTO tb_inscricoes (\"+campos+\") VALUES (\"+values+\")\");\n window.location = 'homepage.html';\n \n });\n }\n else\n {\n \n setTimeout(function() {\n \n $('#uppercaseSuccess').html('Carregando informações, aguarde...');\n\n $.when(\n\n $.getJSON(ExternalURL+'agenda/handleSelect/isApp/true'), \n\n $.getJSON(ExternalURL+'salas/handleSelect/isApp/true'), \n\n $.getJSON(ExternalURL+'sessoes/handleSelect/isApp/true')\n\n ).done(function(a, b, c) { // or \".done\"\n\n db.transaction(handleGetMysqlToSqlliteSuccess, handleGetMysqlToSqlliteError);\n\n var arrAgendaHost = a[0].mensagem;\n var arrSalaHost = b[0].mensagem;\n var arrSessoesHost = c[0].mensagem;\n \n //SUCCESS\n function handleGetMysqlToSqlliteSuccess(tx, result)\n {\n var txs= tx;\n //AGENDA\n \n for(var i=0; i< arrValuesDb.length; i++)\n {\n //AGENDA\n if(arrValuesDb[i].tabela === 'agenda' && arrValuesDb[i].value === false) {\n\n $.each(arrAgendaHost, function(i, index) {\n\n arrDadosCampos = [];\n arrDadosValues = [];\n campos = '';\n values = '';\n\n $.each(index, function(key, value)\n {\n arrDadosCampos.push(key);\n arrDadosValues.push('\"'+html_entity_decode(value)+'\"');\n\n });\n\n campos = implode(\", \", arrDadosCampos);\n values = implode(\", \", arrDadosValues);\n\n dbSqlLite.handleInsert({txDb:tx, tabela:'tb_agenda', field:campos, value:values});\n });\n }\n\n //SALAS\n if(arrValuesDb[i].tabela === 'salas' && arrValuesDb[i].value === false) {\n\n $.each(arrSalaHost, function(i, index) {\n\n arrDadosCampos = [];\n arrDadosValues = [];\n campos = '';\n values = '';\n\n $.each(index, function(key, value)\n {\n\n arrDadosCampos.push(key);\n arrDadosValues.push('\"'+html_entity_decode(value)+'\"');\n\n });\n\n campos = implode(\", \", arrDadosCampos);\n values = implode(\", \", arrDadosValues);\n\n dbSqlLite.handleInsert({txDb:tx, tabela:'tb_salas', field:campos, value:values});\n });\n }\n\n //SESSOES\n if(arrValuesDb[i].tabela === 'sessoes' && arrValuesDb[i].value === false) {\n\n //SESSOES\n $.each(arrSessoesHost, function(i, index) {\n\n arrDadosCampos = [];\n arrDadosValues = [];\n campos = '';\n values = '';\n\n $.each(index, function(key, value)\n {\n\n arrDadosCampos.push(key);\n arrDadosValues.push('\"'+html_entity_decode(value)+'\"');\n\n });\n\n campos = implode(\", \", arrDadosCampos);\n values = implode(\", \", arrDadosValues);\n \n dbSqlLite.handleInsert({txDb:tx, tabela:'tb_sessoes', field:campos, value:values});\n });\n }\n\n\n }\n\n // \n\n }\n\n \n\n //ERROR\n function handleGetMysqlToSqlliteError(tx, result){\n console.log('REMOVER TODOS OS DADOS')\n }\n \n window.location = 'homepage.html';\n });\n\n //\n }, 2000);\n }\n\n //\n }\n }\n //window.location = 'homepage.html';\n\t\t},'json');\n\n\t}", "function frm_editar_bien() \r\n{\r\n /*Buscar la info del bien seleccionado*/\r\n $('#frm_editar_bien').submit(function(e) {\r\n e.preventDefault();\r\n /*Recuperar la información del form*/\r\n var data_form = $(this).serialize();\r\n $.ajax({\r\n url: 'controller/puente.php',\r\n type: 'POST',\r\n dataType: 'json',\r\n data: data_form,\r\n async: false ,\r\n cache: false,\r\n })\r\n .done(function(data) {\r\n alerta(data.estado,data.message,'alerta-editar','editar-estado','editar-mensaje');\r\n\r\n })\r\n .fail(function() {\r\n console.log(\"Error al actualizar los datos -> load_data_edit\");\r\n });\r\n \r\n });\r\n \r\n return false;\r\n}", "function handleSubmit(){\n let paddock = {name,description,meassure}\n console.log(paddock);\n const api = `${URL}${idSelecter}/paddocks/`; \n console.log(api);\n axios.post(api ,paddock,{ headers: {\"Content-type\": \"application/json\", \"Authorization\" : `Token ${token}`} })\n .then( ( response ) => {\n console.log( response.status )\n console.log(response.data);\n if(response.status == 201){\n console.log(\"tas bien\");\n console.log(response.data);\n setIsSuccessfully(true);\n }else{\n console.log('tas mal');\n }\n } )\n .catch( (error) =>{\n // handle error\n console.log(error);\n }) \n\n }", "function onSubmit(e){\n if (prefix === \"\" || domain === \"\" || folder === \"\" || username === \"\" || password === \"\"){\n alert(\"Prefix,Domain,Folder,Username and Password are the required fields\") \n // return <Alert severity=\"warning\">\n // <AlertTitle>Warning</AlertTitle>\n // Attributes missing\n // </Alert>\n }\n else{\n let array = {\n comment: comment,\n repo_loc: repo_loc,\n local_loc: local_loc,\n subfold: subfold,\n branch: branch,\n prefix: prefix,\n domain: domain,\n folder: folder,\n username: username,\n password: password,\n radio1: radio1,\n radio2: radio2,\n subdir: subdir\n };\n\n console.log(array);\n fetch(\"http://localhost:8000/code_mover\", {\n method: \"post\",\n headers: {\n \"Content-Type\": \"application/json\"\n },\n body: JSON.stringify(array)\n })\n .then((resp)=>{ return resp.text() }).then((text)=>{ alert(text)})\n}\n }", "async function handleSubmit(e)\n {\n e.preventDefault();\n //check if empty\n if(ifEmpty(\"titel\", titel) && ifEmpty(\"inter\", inter) && ifEmpty(\"tech\", tech) /**&& ifEmpty(\"tech2\", tech2)*/ ){\n //add job to db\n const result = await addJobdb4params(titel, inter, tech, email)\n if(result === true){\n //get all jobs from db\n var jobs = await getJobs(email)\n //set all jobs in db\n props.updateUser(jobs)\n //redirect to /profile\n history.push(\"/profile\");\n }\n } \n }", "function sendData() {\n var empresa = $('#companyCol').val();\n var email = $('#emailCol').val();\n var proyecto = $('#proyectPickerCol').val();\n var donacion = $('#opcion').val();\n var fondo = $('#fondo').val();\n var colorFondo = $('#colorPickerCol').val();\n var colorLetra = $('#colorFontCol').val();\n createScript(empresa, email, proyecto, donacion, fondo, colorFondo, colorLetra);\n}", "function submit_fillter(){\n\n\t}", "function ejecutarComo(nombre)\n{\t\n\tvar f=document.forms[0];\t\n\tf.Transaccion.value=nombre;\n\tf.submit();\n\treturn true;\n}", "function doSubmit() {\n \t/* data to be sent should follow fomat as:\n \t\tdata = {'channel': channelNo,\n \t\t\t\t'selectedPoints': array of peak, e.g. [[1, 20], [5, 40]]\n \t\t}\n \t*/\n \t//console.log(choice.find('input').filter('[checked=checked]').attr(\"value\"));\n \tvar pdata = {//'channel': selectedPoints[0].series.label.substring(8),\n \t\t\t'qPoint': [qPoint.x/xPointInterval, qPoint.y/xPointInterval],\n \t\t\t'tPoint': [tPoint.x/xPointInterval, tPoint.y/xPointInterval],\n \t\t\t'bin': parseInt(bin.val()),\n \t\t\t'lead': choice.find('input').filter('[checked=checked]').attr(\"value\")\t\n \t\t\t};\n\t\tplotAccordingToChoices();\n\t\t$.ajax({\n\t\t\ttype: 'GET',\n\t\t\turl: submitUrl,\n\t\t\tdataType: 'json',\n\t\t\tcache: false,\n\t\t\tdata: {\"data\":JSON.stringify(pdata)},\n\t\t\tbeforeSend: showSpinner,\n\t\t\tcomplete: hideSpinner,\n\t\t\tsuccess: onBinDataReceived,\n\t\t\terror: function() {alert(\"ECG module Error!!\");}\n\t\t});\n }", "async function formSubmitHandler(e) {\n e.preventDefault();\n if (!checkIsDuplicatingInputs(deviceNum)) {\n alert('Введены два или более устройств с одинаковым серийным номером!');\n return\n }\n const address = cityInput.value;\n const coords = await getCoordsFromAddress(address);\n document.getElementById('coords').value = JSON.stringify(coords);\n\n form.submit();\n }", "function handleSubmit() {\n const {\n fandomName,\n level,\n type,\n } = values;\n\n // Request to join Fandom\n fetch(joinFandomURL, {\n method: 'post',\n mode: 'cors',\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n },\n body: JSON.stringify({\n level,\n type,\n fandomName,\n username: loggedInUser,\n }),\n }).then((response) => {\n switch (response.status) {\n case 200:\n handleTrigger(true);\n return response.json();\n case 404:\n throw new Error('Fandom not found.');\n case 409:\n throw new Error('User already joined fandom.');\n case 400:\n throw new Error('Invalid type or level.');\n default:\n throw new Error('Something went wrong joining a fandom.');\n }\n }).catch((err) => {\n alert(err);\n });\n }", "function handleThis(form) {\n\n for (let element of form.elements){\n if(element.name){\n pokeObj[element.name] = element.value;\n }\n }\n req.onload = () => {\n window.location = \"/viewPC.html\";\n };\n req.open(\"POST\", \"http://35.235.50.146:9000/pokemon\");\n req.setRequestHeader(\"Content-Type\", \"application/json\");\n req.send(JSON.stringify(pokeObj));\n\n return false;\n}", "function buscarArticulos() {\n $(\"#buscar-articulos\").submit();\n\n}", "function storeformdata(){\r\n\tvar form =[[$('#fname').val(), $('#lname').val(), $('#genderselect').val(),\r\n\t\t\t\t\t\t$('#lengthofstay').val(), $('#address1').val(), $('#address2').val(),\r\n\t\t\t\t\t\t $('#city').val(), $('#state1').val(), $('#zip1').val(),\r\n\t\t\t\t\t\t $('#ccnumber').val(), $('#ccexpmonth').val(), $('#ccexpyear').val(),\r\n\t\t\t\t\t\t $('#ccsecuritycode').val(), $('#ccnameoncard').val(),\r\n\t\t\t\t\t ]];\r\n\tsendformdata({forminfo:form});\r\n}", "function saveEtapePosteParam() {\n var postes = [];\n $(document).find('.poste-affect-item').each(function(index, item) {\n if ($(item).prop('checked')) {\n postes.push($(item).attr('data-id'));\n }\n });\n var url = Routing.generate('parametre_organisation_poste_update', { etape:selected_etape }),\n formData = new FormData();\n formData.append('postes', JSON.stringify(postes));\n\n fetch(url, {\n method: 'POST',\n credentials: 'include',\n body: formData\n }).then(function(response) {\n return response.json();\n }).then(function(data) {\n show_info(\"\", \"Paramètres enregistrés.\", \"info\");\n console.log(data);\n }).catch(function(error) {\n show_info(\"Erreur\", \"Une erreur est survenue.\", \"error\");\n console.log(error);\n });\n\n }", "function handleSubmit(event){\n event.preventDefault()\n \n const pothole = {\n 'location': event.target.location.value,\n 'diameter': event.target.diameter.value,\n 'description': event.target.description.value\n }\n\n props.handlePotholePost(pothole)\n }", "function getData()\n{\n\tlet data_1 = input_text_1.value\n\tlet data_2 = input_text_2.value\n\n\tclearInputs() \n\n\n\tajaxPost(data_1, data_2) // Llamada a ajax post\n}", "_submitHandler(event) {\n event.preventDefault();\n const userData = this._getUserInput();\n if (!userData) {\n return this;\n }\n // Destructure the data\n const [title, desc, people] = userData;\n console.log(title, desc, people);\n this._clearInputs();\n return this;\n }", "async function submitForm(data) {\n setBusinessInfo(data);\n const res = await axios({\n url: '/api/business/create',\n method: 'post',\n data\n }); \n }", "POST_fotografias(event) {\n\n // Esto solo es pare que no se recargue la pagina cuando mandamos el formulario\n event.preventDefault()\n\n // Se agrega la muestra a los datos del formulario\n var updated_form_data = this.state.form_data;\n updated_form_data[\"idMuestra\"] = this.props.muestra;\n this.setState({ form_data: updated_form_data });\n\n // Datos del formulario\n const datos_formulario = new FormData()\n\n for (const name in this.state.form_data) {\n datos_formulario.append(name, this.state.form_data[name])\n }\n\n // Variables utiles\n var status_response\n const url = \"http://127.0.0.1:8081/fotografias/\";\n\n // Peticion a la API\n fetch(url, {\n method: 'POST',\n headers: {\n 'Authorization': 'Token ' + this.props.user_data.token,\n },\n // Se toman los datos de la variable form_data del estado \n body: datos_formulario\n })\n .then((response) => {\n status_response = response.status;\n return response.json()\n })\n .then(respuesta_post => {\n if (status_response === 200) {\n // Para evitar recargar la pagina se toma la respuesta de la API y \n // se agrega directamente al estado.\n // Si la peticion a la API fue un exito\n this.setState({\n table_data: this.state.table_data.concat(respuesta_post),\n })\n console.log(\"status: \" + status_response)\n console.log(respuesta_post)\n }\n else {\n console.log(\"status: \" + status_response)\n console.log(respuesta_post)\n }\n })\n\n this.toggle_add_modal()\n }", "function submitPost(){\n const title = document.querySelector('#title').value;\n const body = document.querySelector('#body').value;\n const id = document.querySelector('#id').value;\n\n const data = {\n title, // em ES6, esta linha equivale a title:title\n body // em ES6, esta linha equivale a body:body\n }\n\n // verifica que campos do form nao estao vazios\n if (title === '' || body === '') {\n ui.showAlert('Please fill in all fields', 'alert alert-danger');\n } else {\n\n // condicional verifica se eh um estado de ADD ou EDIT, pois o campo oculto de ID vem vazio por padrao, e eh limpo ao cancelar o estado de edicao\n if (id === '') {\n // cria post\n http.post('http://localhost:3000/posts', data)\n .then(data => {\n // confirma envio do post\n ui.showAlert('Post added', 'alert alert-success');\n // limpa campos do formulario\n ui.clearFields();\n \n // retorna na interface todos os posts, inclusive o que acabamos de adicionar\n getPosts();\n })\n .catch(err => console.log(err));\n } else {\n // edita post\n http.put(`http://localhost:3000/posts/${id}`, data)\n .then(data => {\n // confirma edicao do post\n ui.showAlert('Post updated', 'alert alert-success');\n // retorna estado para ADD\n ui.changeFormState('add');\n \n // retorna na interface todos os posts, inclusive o que acabamos de editar\n getPosts();\n })\n .catch(err => console.log(err));\n \n }\n }\n}", "submitQuery(e) {\n e.preventDefault();\n const formElem = e.target;\n const queryObject = {};\n Array.prototype.forEach.call(formElem.querySelectorAll(\"input\"), elem=>{\n queryObject[elem.name] = elem.value;\n });\n const textarea = formElem.querySelector(\"textarea\");\n queryObject[textarea.name] = textarea.value;\n\n ReactifyCore.Utils.AJAX.request(\"/submit-query\", \"POST\", queryObject, \"application/json\").then(response=>{\n console.log(\"query form response\", response);\n }).catch((err)=>{\n console.log(\"query form submit error\", err);\n });\n }", "function submitForm(){\n console.log(\"entered submit function\");\n// e.preventDefault();\n\n // Get values\n var type=\"cc\"\n var name = \"ram\";\n var age = \"\";\n var email = getInputVal('mail');\n var phone = \"num\";\n\n // Save message\n saveMessage(type,name,age,email, phone);\n}", "function envia_form() {\n jQuery(\"#retorno\").empty();\n \n // pegando os campos do formulário\n var fnome = jQuery(\"#fnome\").val();\n var ftelefone = jQuery(\"#ftelefone\").val();\n var femail = jQuery(\"#femail\").val();\n var fmensagem = jQuery(\"#fmensagem\").val();\n \n // tipo dos dados, url do documento, tipo de dados, campos enviados \n // para GET mude o type para GET \n jQuery.ajax({\n type: \"POST\",\n url: \"php/enviarEmail.php\",\n dataType: \"html\",\n data: \"&fnome=\" + fnome + \"&ftelefone=\" + ftelefone + \"&femail=\" + femail + \"&fmensagem=\" + fmensagem,\n \n // enviado com sucesso\n success: function(response){\n jQuery(\"#retorno\").append(response);\n alert(\"Mensagem enviada com sucesso\");\n },\n // quando houver erro\n error: function(){\n alert(\"Erro no envio da mensagem, caso o erro persista ligue - (48) 3045 7857\");\n }\n }); \n }", "function userInformationSend() {\n let data = {\n email: document.getElementById('email').value,\n phoneNumber: document.getElementById('phoneNumber').value,\n bio: document.getElementById('bio').value\n }\n /* Use Fetch API */\n fetch(`/admin/mypage/${userId}/submit`, {\n method: 'POST',\n body: JSON.stringify(data),\n headers: new Headers({\n 'Content-type': 'application/json'\n })\n }).then(res => res.json()).then(data => {\n Swal.fire(\n 'Modification completed',\n '',\n 'success'\n )\n }).catch((err) => {\n Swal.fire(\n 'ERROR?',\n `${err}`,\n `error`\n )\n })\n}", "async function handleSubmit() {\n\n //si pongo las peticiones axios dentro de una funcion entonces no es necesario el useEffect\n //lo que si es correcto es definir los axios en el componente que se utilizaran no mandarlos por props\n //Aqui mando el form que contiene los datos insertados por el usuario\n await createUser(form);\n\n\n //hago otro llamado a la funcion getAllUsers para que se actualize en tiempo real la insercion que hice\n getAllUsers(props.setUsers);\n\n //finalmente cierro el modal\n\n props.closeModal();\n }", "function enviarDatos(datos) {\n var url = document.getElementById('serialize').attributes['endpoint'].value;\n $.post(url, datos, function(resp) {\n if(resp == 0) window.toastr.error('Lo sentimos ha ocurrido un error al procesar tu solicitud.');\n var r = confirm('Aceptar pago (Respuesta pasarela)');\n if(r) {\n apiService.get('dashboard/pagoOk/'+resp, null, true);\n }\n // else window.alert('falta la pasarela de pagos id = ' + resp + ' url = ' + url); \n });\n }", "function submitData(){\r\n localStorage.clear();\r\n setFinalData(finalData => [...finalData, userData]);\r\n setUserData('');\r\n setStep(4);\r\n onSubmitRegister();\r\n }", "function submitForm(e) {\r\n e.preventDefault();\r\n //get values\r\n var name = document.getElementById('name1').value;\r\n var email = document.getElementById('mail1').value;\r\n var phone = document.getElementById('phone1').value;\r\n var subject = document.getElementById('subject1').value;\r\n var message = document.getElementById('message1').value;\r\n // var message=document.getElementById('textme').value;\r\n saveMessage(name, email, phone, subject, message);\r\n\r\n}", "function gps_exportarExcel() {\n\n var form_excel = document.getElementById(\"form-excel\");\n var infogps = parametros_infogps();\n\n document.getElementById(\"placa_excel\").value = infogps.placa;\n document.getElementById(\"fechaInicio_excel\").value = infogps.fechaInicio;\n document.getElementById(\"fechaFinal_excel\").value = infogps.fechaFinal;\n document.getElementById(\"verPuntoControl_excel\").value = infogps.verPuntoControl;\n document.getElementById(\"verPasajero_excel\").value = infogps.verPasajero;\n document.getElementById(\"verAlarma_excel\").value = infogps.verAlarma;\n document.getElementById(\"verConsolidado_excel\").value = infogps.verConsolidado;\n\n form_excel.submit();\n}", "function submitData(username, userEmail) {\n let formData = {\n name: username,\n email: userEmail\n };\n\n let configObj = {\n method: \"POST\", // Request with GET/HEAD method cannot have body while request with POST method can have body\n headers: {\n \"Content-Type\": \"application/json\",\n \"Accept\": \"application/json\"\n },\n body: JSON.stringify(formData) // data exchanged between a client and a server is sent as text; can be converted into object with key/value pairds\n };\n\n let content = document.body\n\n return fetch(\"http://localhost:3000/users\", configObj)\n .then(function(response) {\n return response.json();\n })\n .then(function(object) {\n let data = document.createElement('p')\n data.textContent = object.id;\n content.appendChild(data);\n })\n .catch(function(error) {\n let errorMessages = document.createElement('p')\n errorMessages.textContent = error.message;\n content.appendChild(errorMessages);\n });\n}", "handleSubmit(event) {\n axios\n .post(`${config.serverUrl}/api/register/registervoter`, {\n name: this.state.name,\n lastname: this.state.lastname,\n ci: this.state.ci,\n city: this.state.city,\n location: this.state.location,\n dataUri: this.state.dataUri\n })\n .then(res => {\n const info = res.data.body;\n alert(info);\n this.setState({ redirect: true });\n })\n .catch(e => {\n alert(\"Error de sintaxis\");\n });\n event.preventDefault();\n }", "async function handleFormSubmit(event) {\n event.preventDefault();\n\n let workoutData = {};\n\n if (workoutType === \"cardio\") {\n workoutData.type = \"cardio\";\n workoutData.name = cardioNameInput.value.trim();\n workoutData.distance = Number(distanceInput.value.trim());\n workoutData.duration = Number(durationInput.value.trim());\n } else if (workoutType === \"resistance\") {\n workoutData.type = \"resistance\";\n workoutData.name = nameInput.value.trim();\n workoutData.weight = Number(weightInput.value.trim());\n workoutData.sets = Number(setsInput.value.trim());\n workoutData.reps = Number(repsInput.value.trim());\n workoutData.duration = Number(resistanceDurationInput.value.trim());\n }\n\n await API.addExercise(workoutData);\n clearInputs();\n toast.classList.add(\"success\");\n}", "function leerFormulario(e) {\r\n //Esto es para prevenir la acción por default, la cual es que al dar click al botón, va a intentar\r\n //buscar una página para redireccionar, pero no es eso lo que queremos que haga\r\n e.preventDefault();\r\n\r\n //Leer los datos de los inputs\r\n const nombre = document.querySelector('#nombre').value,\r\n empresa = document.querySelector('#empresa').value,\r\n telefono = document.querySelector('#telefono').value,\r\n accion = document.querySelector('#accion').value;\r\n\r\n if (nombre === '' || empresa === '' || telefono === '') {\r\n //2 parámetros: texto y clase\r\n mostrarNotificacion('Todos los campos son obligatorios', 'error');\r\n } else {\r\n //Pasa la validación, crear llamado a Ajax\r\n //FormData se utiliza para guardar valores de formularios\r\n const infoContacto = new FormData();\r\n infoContacto.append('nombre', nombre);\r\n infoContacto.append('empresa', empresa);\r\n infoContacto.append('telefono', telefono);\r\n infoContacto.append('accion', accion);\r\n\r\n //Verificamos que todo funcione correctamente hasta ahora, viendo que los valores se guarden en el arreglo\r\n //Los puntos crean una copia del objeto, porque si no, no podría verse\r\n //console.log(...infoContacto);\r\n\r\n if (accion === 'crear') {\r\n //crearemos un nuevo contacto\r\n //esta función toma toda la información del formulario\r\n insertarBD(infoContacto);\r\n } else {\r\n //editar el contacto\r\n //leer el ID\r\n const idRegistro = document.querySelector('#id').value;\r\n infoContacto.append('id', idRegistro);\r\n actualizarRegistro(infoContacto);\r\n }\r\n }\r\n}", "function send_specific_info_into_db(form_submit){\t\t\n\t\t$(form_submit).submit(function(evt){\n\t\tvar article_id = $('#edit_article_container').attr('rel');\n\t\t\t//alert(article_id);\n\t\tevt.preventDefault();\n\t\tvar postData = $(this).serialize();\n\t\tvar url = $(this).attr('action');\n\t\t\t$.post(url, postData, function(php_table_data){\n\t\t\t\twindow.location = 'preview.php?article_id=' + article_id;\n\t\t\t});\n\t\t});\t\n\t}", "function setSubmitEvents() {\n\n $('form.new_submit').submit(function(event){\n event.preventDefault();\n\n var values = bindData($(this));\n if (!values) {\n alert('NENHUM VALOR!');\n // ERROR - No values to submit\n }\n\n var action = $(this).attr('action');\n if (action == null || action == \"\") {\n alert('ACTION VAZIO OU NULO!');\n // ERROR - Every form needs an action\n }\n\n // Make this block better\n /**********************************************************************/\n var method = $(this).attr('method');\n if ((method == null || action == \"\")) {\n method = \"POST\"; // Default method will be 'POST'\n }\n\n method = method.toUpperCase();\n if (method != 'POST' && method != 'GET') {\n alert('METHOD NÃO É POST NEM GET!');\n // ERROR - Method should be a POST or a GET\n }\n /**********************************************************************/\n\n var goodToGo = true;\n if ($(this).hasClass(\"needs-confirmation\")) {\n var message = \"Pressione OK caso realmente queira realizar esse envio.\";\n if ($(this).attr(\"data-confirm-msg\") != \"\") message = $(this).attr(\"data-confirm-msg\");\n if (!confirm(message)) goodToGo = false;\n }\n\n if (goodToGo) genericSubmit(action, method, values);\n });\n\n $('a.post').bind('click', function(event){\n event.preventDefault();\n\n var href = $(this).attr('href');\n var id = $(this).attr('id');\n\n var values = {};\n values['id'] = id;\n\n genericSubmit(href, 'POST', values);\n });\n}", "function controllerSubmit(event) {\n event.preventDefault();\n const form = getObjectWithExpectedType(() => event.target, HTMLFormElement);\n const data = new FormData(form);\n console.log(data);\n const delta = Number(data.get('delta'));\n if (Number.isSafeInteger(delta) && delta > 0) {\n update(0, delta);\n draw();\n }\n }", "function appliquerModalitesPmt(){\n\tvar form = new FormData();\n\t$tranchePmt = document.getElementById('tranchePmt').value;\n\tform.append('action','tranchePmt');\n\tform.append('tranchePmt',$tranchePmt);\n\tconsole.log(form);\n\t$.ajax({\n\t\ttype : 'POST',\n\t\turl : 'MVC/Controleur.php',\n\t\tcrossDomain: true,\n\t\tdata : form, //$('#formEnreg').serialize();\n\t\tdataType : 'json', //text pour le voir en format de string\n\t\t//async : false,\n\t\t//cache : false,\n\t\tcontentType : false,\n\t\tprocessData : false,\n\t\tsuccess : function (reponse){\n\t\t\t\t\tafficherVue(reponse);\n\t\t},\n\t\tfail : function (err){\n\t\t \n\t\t}\n\t});\n}", "function submitForm () {\n\n\t\t\t// Add submitting state\n\t\t\tform.setAttribute('data-submitting', true);\n\n\t\t\t// Send the data to the MailChimp API\n\t\t\tsendData(serializeForm(form));\n\n\t\t}", "function submit(event) {\n\n // Query the following values from user inputs form\n const recipientMessage = document.querySelector('#compose-recipients').value;\n const subjectMessage = document.querySelector('#compose-subject').value;\n const bodyMessage = document.querySelector('#compose-body').value;\n\n // post this inputs to server using fetch request with POST method\n fetch('/emails', {\n method: 'POST',\n body: JSON.stringify({\n recipients: recipientMessage,\n subject: subjectMessage,\n body: bodyMessage\n })\n })\n .then(response => response.json())\n .then(data => {\n // Give feedback to user: successful message or error\n if(!data.error){\n alert(data.message);\n stop()\n load_mailbox('sent');\n }\n else{\n alert(data.error);\n stop()\n }\n });\n}", "function cargarPagina(form, pagina) {\r\n\tform.method=\"POST\";\r\n\tform.action=pagina;\r\n\tform.submit();\r\n}", "function cargarPagina(form, pagina) {\r\n\tform.method=\"POST\";\r\n\tform.action=pagina;\r\n\tform.submit();\r\n}", "function handleFormSubmit(e) {\n e.preventDefault();\n if (Formulario.nombres != \"\") {\n if (Formulario.apellidos != \"\") {\n SetDonde({\n nombres: Formulario.nombres,\n apellidos: Formulario.apellidos\n })\n } else {\n SetDonde({\n nombres: Formulario.nombres\n })\n }\n } else {\n if (Formulario.apellidos != \"\") {\n SetDonde({\n apellidos: Formulario.apellidos\n })\n } else {\n SetDonde({})\n }\n }\n\n }", "function sendForm(){\n swal(\n 'DATOS ENVIADOS!',\n 'Se ha enviado la información correctamente, pronto nos contactaremos con usted.',\n 'success'\n ).then(() => {\n form.submit();\n });\n}", "function submitFormData(form,btnText,file,normal,before,after,message,debugError,scroll) {\n before();\n var param = $(form).serialize();\n // Open ajax loader on submit\n openLoader(form,true,btnText[0]); \n $.post(HANDLER+file+ENV,param,function(result){\n //Close ajax loader\n openLoader(form,false,btnText[1]);\n \n debugError(result);\n //When set to true, form will be submited.\n if (normal) {\n var data=JSON.parse(result);\n if (data.response===RESPONSE_SUCCESS) {\n after(data.message,\"success\");\n if (scroll) {\n scrollToObject($(form));\n }\n }\n else{\n message(data.message,\"danger\");\n if (scroll) {\n scrollToObject($(form));\n }\n }\n }\n });\n \n return false;\n}", "function senGuiData()\n{\n\tvar datasend={\n\t\tevent:\"guidata\"\n\t}\n\tqueryDataGet(\"php/api_process.php\",datasend,function(res){\n\t\t//nhan du lieu tu server tra ve\n\t\talert_info(res);\n\t});\n\tqueryDataPost(\"php/api_process_post.php\",datasend,function(res){\n\t\t//nhan du lieu tu server tra ve\n\t\talert_info(\"Post:\"+res);\n\t});\n}", "async function handleFormSubmit(event) {\n\n console.log('handle form submit function invoked on exercise.js');\n\n event.preventDefault();\n\n let workoutData = {};\n\n if (workoutType === \"cardio\") {\n workoutData.type = \"cardio\";\n workoutData.name = cardioNameInput.value.trim();\n workoutData.distance = Number(distanceInput.value.trim());\n workoutData.duration = Number(durationInput.value.trim());\n } \n else if (workoutType === \"resistance\") {\n workoutData.type = \"resistance\";\n workoutData.name = nameInput.value.trim();\n workoutData.weight = Number(weightInput.value.trim());\n workoutData.sets = Number(setsInput.value.trim());\n workoutData.reps = Number(repsInput.value.trim());\n workoutData.duration = Number(resistanceDurationInput.value.trim());\n }\n\n \n await API.addExercise(workoutData);\n clearInputs();\n toast.classList.add(\"success\");\n\n }", "function meuEscopo(){ // tudo que estiver aqui dentro estara protegido\n \n let form=document.querySelector('.formulario'); // usando a classe\n let resultado=document.querySelector('.resultado'); \n\n let pessoas=[];\n\n\n function recebeEventoForm (evento){\n evento.preventDefault();\n\n let nome=document.querySelector(`.nome`);\n let sobrenome=document.querySelector(`.sobrenome`);\n let idade=document.querySelector(`.idade`);\n let peso=document.querySelector(`.peso`);\n let altura=document.querySelector(`.altura`);\n\n //console.log(nome,sobrenome,altura, peso, idade);\n pessoas.push({nome:nome.value,sobrenome:sobrenome.value,peso:peso.value,idade:idade.value,altura:altura.value});\n \n resultado.innerHTML += `<p>${nome.value} - ${sobrenome.value} - ${idade.value} - ${peso.value} - ${altura.value}</p>`;\n console.log(pessoas);\n }\n\n form.addEventListener('submit', recebeEventoForm);\n}" ]
[ "0.69497025", "0.6778406", "0.66608065", "0.6570415", "0.6566612", "0.65514815", "0.6518139", "0.6515592", "0.65046453", "0.65041554", "0.6488728", "0.6485158", "0.6482255", "0.64678127", "0.64580643", "0.6441721", "0.6427507", "0.64092004", "0.6407309", "0.64032584", "0.63889384", "0.63877153", "0.63649255", "0.6364619", "0.6349079", "0.6334149", "0.63334376", "0.6332311", "0.63190514", "0.6317868", "0.63068765", "0.63010776", "0.6283557", "0.6264394", "0.62463903", "0.62463856", "0.62440646", "0.62396044", "0.6223854", "0.62213635", "0.62111723", "0.62032926", "0.61826116", "0.618237", "0.61656284", "0.61651456", "0.6153962", "0.61523944", "0.6149527", "0.61217856", "0.61187583", "0.6117349", "0.61099315", "0.6105159", "0.61025345", "0.608998", "0.6078035", "0.6062884", "0.6062221", "0.60521233", "0.60473084", "0.6044489", "0.6044279", "0.604124", "0.60392946", "0.6037423", "0.6036551", "0.60266083", "0.60204005", "0.6019852", "0.6011099", "0.60103816", "0.59836924", "0.5983553", "0.59823924", "0.5978647", "0.59721667", "0.5968833", "0.59666306", "0.59636235", "0.59625316", "0.59576005", "0.5956953", "0.5954099", "0.5952894", "0.5950329", "0.5943224", "0.5943103", "0.5937799", "0.5936962", "0.59360385", "0.5935299", "0.59340084", "0.593331", "0.593331", "0.593108", "0.59266394", "0.59262514", "0.5925082", "0.592487", "0.5922492" ]
0.0
-1
funcion que hace que una vez finalizado el efecto shake se oculte el texto
function oculta(){ $("#errores").html(" "); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "finish() {\r\n let finish = this.FINISH_TEXT[Math.floor((Math.random() * this.FINISH_TEXT.length))];\r\n this.isActive = false;\r\n return '```' + finish + '```';\r\n }", "handleShakeAnimationEnd_() {\n const {LABEL_SHAKE} = MDCFloatingLabelFoundation.cssClasses;\n this.adapter_.removeClass(LABEL_SHAKE);\n }", "handleShakeAnimationEnd_() {\n const {LABEL_SHAKE} = MDCFloatingLabelFoundation.cssClasses;\n this.adapter_.removeClass(LABEL_SHAKE);\n }", "function escreveConteudo(){}", "function finalizarCompra(){\n rl.question(\"Deseja finalizar a compra?\\n 1- Sim\\n 2- Não\\n\", (opcao) => {\n if(opcao === \"1\"){\n console.log(chalk.yellow(`Yeeew! Sua compra foi finalizada! Obrigada pela preferência! ${emoji.get('heart')} \\nVolta sempre tá? Estaremos aqui para você!\\n`));\n rl.close();\n }else{\n console.log(`Tudo bem. Obrigada por procurar nossos produtos. Te vejo na próxima! ${emoji.get('heart')}`)\n rl.close(); \n }\n })\n}", "function fin() {\n //ponemos el contados y el tiempo final a 0\n contador = 0;\n tiempoFinal = 0;\n console.log('fin');\n\n //desbloqueamos el boton de finalizar para que puedan guardar el movimiento\n document.getElementById('siguiente').innerHTML = '<b>FINALIZAR</b>';\n document.getElementById('siguiente').disabled = false;\n document.getElementById('siguiente').style.backgroundColor = 'rgb(3, 119, 25)';\n}", "function endturn() {\n $counter.style.opacity = 0;\n setTimeout(() => {\n $paquet.style.transform = 'translate(125%, 69%) rotate(-180deg)';\n resultShow();\n }, 1000);\n}", "function endAnimation() {\n let endAnimationText = getEndAnimation();\n endAnimationText.innerHTML = \"Finished!\";\n endAnimationText.style.fontSize = \"50px\";\n const finishedSound = audioFiles.finishedSound;\n if(audioOn && inhaleHold > 0) {\n finishedSound.load();\n finishedSound.play();\n }\n endEarlyDetails();\n}", "actionFinal() {\n this.generateAlertMessage(\"Good Job!\",`You won using ${this.steps} steps`,'success');\n this.reset();\n }", "function gameEnd(emoji) {\n gGame.isOn = false;\n timerStop();\n setEmoji(emoji);\n renderHintButton(0);\n showPlayAgainMsg();\n}", "function iAmSorrySaid() {\r\n $sentenceDisplayed.text(\"I AM SORRY\");\r\n $clearScreen.fadeIn('slow');\r\n // Reset when screen is cleared\r\n $clearScreen.click(start);\r\n}", "function gameEnd() {\n push();\n background(wallpaper);\n textSize(finishState.size);\n fill(255);\n textAlign(CENTER, CENTER);\n textStyle(BOLD);\n strokeWeight(10);\n text(finishState.string, finishState.x, finishState.y);\n pop();\n}", "function quitarMensaje() {\n document.getElementsByTagName('span')[0].textContent = \"\";\n clearInterval(cuentaAtras);\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 tryAgain() {\n character.say(\"Uh...\");\n var tryAgain = Scene.createTextBillboard(0, 5, 3);\n tryAgain.setText(\"Try Again\");\n tryAgain.onActivate(function() {\n tryAgain.deleteFromScene();\n newLine();\n })\n }", "function final(any) {\n element.wordGuess.textContent = string[any]; // will show win or lose string property\n sound[any].play(); //will play win or lose sound\n score[any]++; //will increment win or lose score\n update(); \n setTimeout(function () { //timer so that you can enjoy the music and strings\n reset();\n }, 2000);\n }", "function final() {\n character.say(\"Good, thank you!\")\n var win = Scene.createTextBillboard(0, 5, 3);\n win.setText(\"Awesome job!\");\n }", "function finalizaJogo() {\n console.log(\" vv\")\n console.log(\" ~~ -----|----- ~~\")\n console.log(\" ~~ *>=====[_]L) ~~\")\n console.log(\" v -'-`- ~~\")\n console.log() \n console.log(` Você olha para a floresta abaixo... e começa a rir. \"Toca pra próxima cidade, Zezinho!\"`) \n console.log()\n console.log(\" ^ ^ ^ ^ ___I_ ^ ^ ^ ^ ^ ^ ^\")\n console.log(\"/|\\\\/|\\\\/|\\\\ /|\\\\ /\\\\-_--\\\\ /|\\\\/|\\\\ /|\\\\/|\\\\/|\\\\ /|\\\\/|\\\\ /|\\\\/|\\\\ /|\\\\/|\\\\/|\\\\ /|\\\\/|\\\\\")\n console.log(\"/|\\\\/|\\\\/|\\\\ /|\\\\ / \\\\_-__\\\\ /|\\\\/|\\\\ /|\\\\/|\\\\/|\\\\ /|\\\\/|\\\\ /|\\\\/|\\\\ /|\\\\/|\\\\/|\\\\ /|\\\\/|\\\\\")\n console.log(\"/|\\\\/|\\\\/|\\\\ /|\\\\ |[]| [] | /|\\\\/|\\\\ /|\\\\/|\\\\/|\\\\ /|\\\\/|\\\\ /|\\\\/|\\\\ /|\\\\/|\\\\/|\\\\ /|\\\\/|\\\\\")\n console.log(textos.linhaDivisoria)\n process.exit(0)\n}", "function endGame() {\n setShouldStart(false)\n setWordCount(countWords(text))\n }", "getAnimatedText() {\n const shake = this.shakeAnimation.interpolate({\n inputRange: [0, 0.2, 0.4, 0.6, 0.8, 0.9, 1],\n outputRange: [0, -10, 10, -10, 10, -10, 0]\n });\n return (\n <Animated.Text style={[this.invalid ? styles.red : styles.grey, {marginLeft: shake}]}>\n {this.state.alert}\n </Animated.Text> \n )\n return animatedText;\n }", "endGame(deadBy){\n let message;\n this.canvas.ctx.font = \"normal 20px sans-serif\";\n switch (deadBy) {\n case 'rhino':\n message = `Looks an angry rhino caught you! :(`\n break;\n \n default:\n message = `Looks like you ${this.endingsCrash[Math.floor(Math.random() * this.endingsCrash.length)]}`\n break;\n }\n this.canvas.ctx.fillText(message, this.canvas.width / 2 - 100, 50);\n this.canvas.ctx.fillText(`Press ${String.fromCharCode(KEYS.RESTART)} to Restart`, this.canvas.width / 2 - 100, 100);\n }", "function endSala() {\r\n\tgame.endSala();\r\n}", "function shakeEventDidOccur() {\n alert('shooken');\n fShaker.page.getObject();\n }", "function shredAlertColor() {\n var theText = document.querySelector('.call-to-shred-text'),\n animation = Math.floor(Math.random() * textColorOptions) + 1,\n style = 'style';\n\n theText.removeAttribute(style);\n\n theText.setAttribute(style, 'animation-name: flash' + animation);\n}", "function setSucessMessageWithFade(message){\n setSucessMessage(message);\n setTimeout(function() {\n setSucessMessage('');\n }, 3000);\n }", "function C011_LiteratureClass_Outro_Click() {\n\n\t// Jump to the next animation\n\tTextPhase++;\n\tif (TextPhase >= C011_LiteratureClass_Outro_MaxTextPhase) SaveMenu(\"C012_AfterClass\", \"Intro\");\n\n}", "function endScreen() {\n push();\n textSize(30);\n fill(197, 26, 219);\n stroke(0);\n strokeWeight(5);\n textAlign(CENTER, CENTER);\n text(`You intoxicated yourself!`, width / 2, height / 2);\n pop();\n}", "function endSala() {\t\t\t\r\n\t\tremoveEventListener(document, 'keydown', keyDown);\r\n\t\t\r\n\t\tvar countSeg = 0;\r\n\t\tvar puntos = \".\";\r\n\t\tvar waitPuntos = function() {\r\n\t\t\tif(countSeg<5){\r\n\t\t\t\tmessageGeneral = \"Cancelled room, closing in 5 seconds \" + puntos;\t\r\n\t\t\t\tt = setTimeout(function() {\r\n\t\t\t\t\tpuntos = \"\";\r\n\t\t\t\t\tcountSeg += 1;\r\n\t\t\t\t\tfor(var i=0;i<countSeg;i++){\r\n\t\t\t\t\t\tpuntos += \".\";\r\n\t\t\t\t\t}\r\n\t\t\t\t\twaitPuntos();\r\n\t\t\t\t}, 800);\t\t\t\r\n\t\t\t}\r\n\t\t};\t\r\n\t\twaitPuntos();\r\n\t\t\t\t\t\t\r\n\t\tt = setTimeout(function() {\r\n\t\t\tpintarJuego = false;\r\n\t\r\n\t\t\t//Control\r\n\t\t\tMASTER = false;\r\n\t\t\tconnected = false;\r\n\t\t\tnumUsuarios = 1;\r\n\t\t\tuserId = 0;\r\n\t\t\tidUltimoConectado = 0;\r\n\t\t\t\r\n\t\t\t//Players\r\n\t\t\tplayers = new Array(); \t\t\r\n\t\t\tlocalPlayer = new Object(); \t\t\t\t\t\t\t\t\t\r\n\t\t}, 5000);\t\t\r\n\t}", "function shakey(){\n let shake = document.getElementById(\"game-container\");\n shake.classList.add(\"shake-up\");\n setTimeout(() => {shake.classList.remove(\"shake-up\");}, 600);\n}", "endMessage() {\n this.canvas[1].font = \"20px Arial\";\n this.canvas[1].strokeText(\"You Won!!.\",10,135);\n this.canvas[1].fillText(\"You Won!!.\",10,135);\n\n this.canvas[1].strokeText(\"End!!, Thank you for playing.\",10,this.canvas[0].height-50);\n this.canvas[1].fillText(\"End!!, Thank you for playing.\",10,this.canvas[0].height-50);\n }", "end() {\n // Debugging line.\n Helper.printDebugLine(this.end, __filename, __line);\n\n // Let the user know that the cache stored in the database will be cleared.\n let tmpSpinner = new Spinner('Clearing cache stored in the database %s');\n tmpSpinner.start();\n\n this.clearCacheDB().then(() => {\n // Remove the information with the spinner.\n tmpSpinner.stop(true);\n\n // If we used the database as cache, the user should know this.\n if (Global.get('useDB')) {\n this.output.writeLine(`Used database until page ${Global.get('useDB')}`, true);\n }\n\n // Write some ending lines.\n this.output.writeUserInput(this);\n this.getReadableTime();\n\n // Close the write stream to the log file.\n this.output.logger.end();\n this.removeLockFile();\n }).catch(error => {\n console.log(error);\n });\n }", "function cerrarCarrito() {\r\n $(\"#carrito\").fadeOut(\"fast\");\r\n carritoAbierto=false;\r\n}", "function wrongPass() {\n // input fields incorrect, assuming its password, we clear it\n var aName = \"animated shake\";\n $('.form-button').addClass(aName).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {\n /* Act on the event */\n $(this).removeClass(aName);\n });;\n $('input[name=usr]').val('');\n}", "function flash_saved(box) {\n codeReporter(\"flash_saved()\");\n // load_function_text(\"flash_saved\");\n var flash = $(\"<span>\").text(\"Saved.\").css({\n color: \"red\",\n textAlign: \"right\"\n });\n flash.appendTo(box);\n setTimeout(function() {\n flash.remove();\n }, 1000);\n}", "function finish () {\n let modal = document.querySelector('div.modal');\n modal.classList.add('show');\n \n let content = modal.querySelector('div.modal-content');\n\n let player = getPlayer();\n content.innerHTML = `\n FIM DE JOGO!\n <span class=\"loser\">${player.name}</span>\n FEZ O PIRATA PULAR!\n `;\n\n setTimeout(e => {\n reset();\n }, 5000);\n}", "function clearAPText()\n {\n // check if ap has text\n if (ap.text() != '')\n {\n // clear & fade out ap text\n ap.addClass(fadeOut)\n .text('');\n // reset AP classes after animation runs\n setTimeout(function()\n {\n ap.removeClass(fadeOut);\n }, fadeTime);\n }\n }", "function endGame() {\n $('#instructions').remove();\n $('#story').remove();\n $('#question').remove();\n $('#narrator').show();\n $('#narrator').css({'color':'white'});\n $('#narrator').text('You are missing something');\n $('#narrator').fadeOut(3000);\n $('body').css({'background-image':'url(\"assets/images/clown.jpg\")'});;\n}", "function saludo4(mensaje){\n return `Hola buen dia 3 ${mensaje}`;\n }", "function endGame()\n{\n stopTimer();\n $('#timer').text(\"\");\n $('#timer').css('width','0%');\n backgroundMusic.pause();\n disableUnflipped();\n gameOverPopup();\n return;\n}", "function clearScreeen()\n{\n\t// Clear the screen\n\tconsole.log('\\033[2J');\n}", "limpiarMsj() {\n \n setTimeout(() => {\n\n document.querySelector('#buscador > .alert').remove();\n }, 3000);\n }", "function verificarFin() {\n if (fin === 16) { //si todas las cartas estan volteadas\n Swal.fire({\n title: 'Felicidades, ganaste',\n text: 'numero de intentos: '+contador+'',\n icon: 'success',\n confirmButtonText: 'reiniciar'\n })\n //alert(\"Juego finalizado, lo has logrado en \" + contador + \" intentos\");\n reiniciar();\n }\n }", "function clearText () {\n guessMessage.innerHTML=\"\";\n guessedNumber.innerHTML=\"\";\n challengeMessage.innerHTML =\"\"\n flowerSpinner.classList.add('hidden');\n}", "function endGame() {\n datTime = 30;\n gameTimer.setText(datTime.toString());\n blackScreen.setHidden(false);\n blackScreen.animate().alpha(0.75).duration(500);\n wholeSpidey.animate().alpha(0).duration(500);\n deadpool.animate().alpha(0).duration(500).onEnd = function() {\n deadpool.setHidden(true);\n }\n endScore.setHidden(false);\n endScore.setClickable(true);\n endScore.setAlpha(1);\n endScore.setText('Nice!<br />Your Score is: ' + scoreNumber + '<br />Tap to Play Again');\n}", "function finish () {\n $(\".game\").html(\"\");\n $(\"#choices\").html(\"\");\n $(\"#wins\").text(\"Correct: \" + wins);\n $(\"#losses\").text(\"Incorrect: \" + losses);\n restart();\n }", "function clearCanvas() {\n canvas.classList.add('shake');\n ctx.clearRect(0, 0, width, height);\n // remove shake class after animation runs so that user can shake again\n canvas.addEventListener('animationend', function() {\n console.log(\"Did the Shake\");\n canvas.classList.remove('shake');\n // add third argument object (get something, listen for event, do something) to add event listener \n // once: true -- add event listener unbinds itself\n // prevents from having to manually remove animationend event listener each time\n }, { once: true }\n );\n}", "function completeContinuePhase () {\n /* show the player removing an article of clothing */\n prepareToStripPlayer(recentLoser);\n allowProgression(eGamePhase.STRIP);\n}", "function przegrana(tekst) {\n window.removeEventListener ('deviceorientation', ruszaj);\n ctx.font = `30pt Arial`;\n ctx.fillStyle = `pink`;\n ctx.textAlign = `center`;\n ctx.textBaseline = `middle`;\n ctx.fillText(`${tekst}`, canvas.width / 2, canvas.height / 2);\n ctx.font = `15pt Arial`;\n ctx.fillText(`Twój wynik: ${score}`, canvas.width / 2, (canvas.height / 2) + 40 );\n setTimeout(function() {reset();}, 2000);\n \n}", "function finishLine () {\n $(\"#playerProfile\").fadeOut(2000)\n setTimeout(displayFinishMessage, 2000)\n setTimeout(displayResetGame, 3000)\n character.attr(\"dataMoving\", \"0\")\n pumpkinFall()\n makeNoise(\"hoaw\")\n}", "function fadeOutMainMenu(){\n\n\n\tconst animationTiming = 800;\n\n\treturn new Promise((res,rej)=>{\n\t\t$('.mainMenu').css({\n\t\t\ttransition : `transform ${animationTiming}ms ease`,\n\t\t\ttransform : 'scale(.0001) rotate(15deg)'\n\t\t});\n\t\tsetTimeout(res,animationTiming);\n\t});\n\n\n}", "function clearStatus() {\n setTimeout(function () {\n $(\"#alert\").fadeOut(1000); // slowly faded div status\n $(\"#text\").html();\n }, 3000);\n}", "function clearCanvas() {\n canvas.classList.add(\"shake\");\n ctx.clearRect(0, 0, width, height);\n //the animation event is added and in the same function the class is removed from the button when the function ends.\n canvas.addEventListener(\"animationend\", function () {\n console.log(\"done the shake!\");\n canvas.classList.remove(\"shake\"); // the animation class is in css, and that animation only runs, when the class is first put on, therefore it has to be added and removed from the function, so that the animation works on the button, every time I know how to click\n //This third parameter is used, to tell the function, that the animation is only done once if the action was true.\n }, { once: true });\n}", "function endGame() {\n clearInterval(timer);\n timer = null;\n id(\"start\").disabled = false;\n id(\"stop\").disabled = true;\n text = null;\n index = 0;\n qs(\"textarea\").disabled = false;\n id(\"output\").innerText = \"\";\n }", "function endScreen(){\n push();\n textSize(32);\n textAlign(CENTER);\n fill(255);\n text(txtEnd, width/2, height/2);\n pop();\n }", "function C010_Revenge_Outro_Click() {\n\n\t// Jump to the next animation\n\tTextPhase++;\n\tif (TextPhase >= 3) SaveMenu(\"C011_LiteratureClass\", \"Intro\");\n\n}", "function endScreen() {\n push();\n textSize(30);\n fill(255, 0, 0);\n stroke(0);\n strokeWeight(5);\n textAlign(CENTER, CENTER);\n text(`You lost!`, width / 2, height / 2);\n pop();\n}", "applyShake(c) {\n\n if (this.shakeApplied) {\n\n c.setShake(this.waitTimer, (-this.item) | 0);\n this.shakeApplied = false;\n }\n }", "function dance() {\n\t$head.effect( \"bounce\", 500 );\n\t$torso.effect( \"shake\", 500 );\n\t$arms.effect( \"bounce\", 500 );\n\t$legs.effect( \"shake\", 500 );\n}", "function finish() {\n// if (--finished == 0) {\n if (!isFinished) {\n isFinished = true;\n Physics.there.style(self.from.getContainerBodyId(), {\n opacity: 0\n });\n\n self.dfd.resolve();\n }\n }", "function end() {\n console.log(`Commande : ${command} \\nArgs : ${args}\\nAuteur : ${author}\\n`);\n message.delete();\n return\n }", "function finalizar(id) {\n $.post(SITE_PATH + '/tarefas/finalizar', {id: id}, function (retorno) {\n if (retorno) {\n recarregarTarefas();\n toastr['success'](\"A tarefa foi finalizada com sucesso.\");\n } else {\n toastr['error'](\"Houve um erro ao finalizar a tarefa.\");\n }\n swal.close();\n });\n }", "function shakeIt()\r\n\t{\r\n\t\theader.addClass('mw-harlem_shake_me im_first');\r\n\t\t$(\"#logo a\").attr(\"href\",\"http://www.jeuxvideo.com/messages-prives/boite-reception.php\").attr(\"target\",\"_blank\");\r\n\t}", "function Finalizada(){\n\twindow.alert(\"Sua solicião foi finalizada com sucesso!!\");\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}", "onTerminate() {\n this.audio.fadeOut(0.5);\n setTimeout(() => this.audio.pause(), 500);\n }", "noSignature(){\n\t\tthis.context.font = \"25px Arial\";\n\t\tthis.context.fillStyle = \"red\";\n\t\tthis.context.fillText(\"Informations incomplètes.\", 7, 80);\n\t\tsetTimeout(function(){ // retrait du message après deux secondes\n\t\t\tthis.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\t\t}.bind(this), 2000);\n\t}", "function endGame(){\n if(trivia[currentQAndA] === (trivia.length)){\n stop();\n \n $(\".quiz\").html(\"<h1>\" + 'Done!' + \"</h1>\")\n }\n else{\n loading();\n }\n }", "endGame() {\r\n setTimeout(function () {\r\n alert(currentEnnemy.name + ' a gagné. Cliquez sur OK pour relancer la partie'),\r\n window.location.reload()\r\n }, 200)\r\n }", "function shoutOut(){\n return 'Halo Function!';\n}", "function tryAgainMessage() {\n textSize(40);\n fill(0, 102, 153);\n textStyle(BOLD);\n textAlign(LEFT);\n text(\"Sad Octocat. Click the button if you change your mind.\", octoX, octoY);\n}", "function tryAgain() {\n character.say(\"Uh...\");\n var tryAgain = Scene.createTextBillboard(0, 5, 3);\n tryAgain.setText(\"Try Again\");\n tryAgain.onActivate(function() {\n tryAgain.deleteFromScene();\n init();\n })\n }", "function destroyTextGameOver()\n{\n\tif (textGameOver) { textGameOver.destroy(); }\n}", "function loser() {\n console.log(\"Loser function\")\n $('#message').html(\"<h4>You Lose!</h4>\");\n $('#message').show();\n $('#message').fadeOut(3000);\n losses++;\n $('#losses').text(losses);\n reset()\n }", "function gameOverText () {\n style = { font: \"65px Arial\", fill: \"#fff\", align: \"center\" };\n var text = game.add.text(game.camera.x+450, game.camera.y+250, \"You Lose! Try Again...\", style);\n text.anchor.set(0.5);\n }", "function gameDone()\n\t{\n\t\tdisableCupClick();\n\t\tsetTimeout(function(){\n\t\t\t$('.cup').addClass(\"hide-anim\");\n\t\t\tball.addClass(\"hide-anim\");\n\t\t\t$('#message').removeClass(\"hide\").addClass(\"show\"); \n\t\t}, 2000);\n\t\tsetTimeout(function(){\n\t\t\t$('.cup').css('display','none');\n\t\t\tball.css('display','none');\n\t\t}, 4000);\n\n\t\tsetTimeout(function(){\n\t\t\t$('#btnRestart').removeClass(\"hide\").addClass(\"show\"); \n\t\t}, 4000);\n\t}", "function screenShake(elem) {\r\n\telem.onclick = \"\";\r\n\tshakeWrapper.classList.remove(\"shake\");\r\n\t//pause for one frame to allow update\r\n\tvoid shakeWrapper.offsetWidth;\r\n\tshakeWrapper.classList.add(\"shake\");\r\n}", "function animacion(algo){\n\tvar contenido = document.getElementById(\"esfera\");\n\t$(\"#esfera\").addClass('esfera');\n\t$(\"#direccion\").addClass('direccion');\n $(\"#escrituraA\").addClass('escrituraA');\n $(\"#direccion\").fadeIn();\n\n\tcontenido.addEventListener('animationend', function(){\n $(\"#direccion\").fadeOut();\n\t\t$(\"#esfera\").removeClass('esfera');\n\t\t$(\"#direccion\").removeClass('direccion');\n $(\"#escrituraA\").removeClass('escrituraA');\n $(\".datoTranformar\").empty(); // limpiar el contenido del \"p\"\n $(\".direccionHe\").empty(); // limpiar el contenido del \"p\"\n $(\"#demo2\").empty();\n alert('SU LETRA FUE GUARDADA CORRECTAMENTE...');\n\t}, false);\n}", "function incorrectAnswer() {\n var wrong = document.getElementById(\"incorrect\");\n wrong.play();\n setTimeout(function() {\n wordInput.classList.add(\"shake\");\n },100);\n setTimeout(function() {\n wordInput.classList.remove(\"shake\");\n },200);\n life--;\n totalLives.pop();\n livesLeft.innerHTML = totalLives.join(\"\");\n //console.log(\"print\" + totalLives.length);\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}", "onDestroy() {\n STATE.wheats--;\n }", "function onFinish() {\n\t\tclbk();\n\t}", "finish () {\n this.message.finish()\n }", "function finalOpacity() {\n firstText.style.transition = \"opacity 1.5s linear 0s\"\n let opacity = firstText.style.opacity = \"0\";\n setTimeout(finalText, 1500)\n}", "function check(){\n let textEntered=typedText.value;\n if(textEntered==originalText){\n complete.innerHTML=\"Completed!!\";\n typedText.style.borderColor=\"#429890\";\n theTimer.style.color=\"steelblue\";\n clearInterval(interval);\n \n }\n}", "function endGame () {\n\t\t$(\"#timer\").empty();\n\t\t$(\"#game\").html(\"<h2>Game Over! Next stop the Musicians Hall of Fame.</h2>\")\n\t\t$(\"#game\").append(\"<p>Correct answers: \" + correct + \"</p>\");\n\t\t$(\"#game\").append(\"<p>Incorrect answers: \" + incorrect + \"</p>\");\n\t\t$(\"#game\").append(\"<p>A bad guess is better than no guess. Unanswered: \" + unanswered + \"</p>\");\n\t\t$(\"#restart\").css(\"visibility\", \"visible\");\n\t}", "screenShake() {\n this.cameras.main.shake(192, 0.01, true);\n }", "function shoutOut() {\n return \"Halo Function!\";\n}", "function Clearup(){\n //TO DO:\n EventLogout();\n App.Timer.ClearTime();\n }", "function DoneMessage() {\n if (stat == status.completed)\n return (<Text>CONGRATULATIONS!!!!!! YOU'VE ACHIEVED YOUR GOAL!!!!!</Text>);\n if (stat == status.archived)\n return (<Text>wow.... lame.</Text>);\n }", "function clean() {\n setPet({ ...pet, boredom: Math.min(100, pet.boredom + 5), hygiene: Math.min(100, pet.hygiene + 40), action: 'clean' })\n // change the number based on the number of miliseconds the animation takes\n setTimeout(() => setPet({...pet, action: undefined}), 5000)\n if (!game.mute){\n cleanSound.play()\n }\n }", "function clearSuccessMessage() {\n\n }", "function enProceso(){\n resultado.innerHTML = \"\";\n borrarDisplay = 1;\n}", "function clearCanvas() {\n canvas.classList.add('shake');\n ctx.clearRect(0,0,width,height);\n // use 3rd argument for addEventListener, options\n // once === unbinds event listener once complete\n canvas.addEventListener('animationend', function() {\n canvas.classList.remove('shake')\n }, {once: true})\n}", "function borrarUlt ()\r\n{\r\n var cad = this.actual;\r\n if (cad.length > 0)\r\n {\r\n this.actual = cad.substring (0, cad.length - 1);\r\n }\r\n this.actualitza (\"black\");\r\n}", "function badrejectionEnd() {\n background(0);\n push();\n textSize(64);\n fill(166, 1, 7);\n textSize(50);\n text(`3 days later`, width / 2, height / 2 - 50);\n text(`You were fine, but he didn't quite... survive the breakup`, width / 2, height / 2);\n text(`Perhaps you took a wrong turn somewhere.`, width / 2, height / 2 + 50);\n textSize(80);\n textFont(onyxFont);\n text(`THE END`, width / 2, height / 2 + 200)\n pop();\n}", "function dismissText() {\n\n now = new Date();\n\n //console.log(\"Dismiss\");\n\n noteMess.style.display = \"none\";\n noteBG.style.display = \"none\";\n noteTime.style.display = \"none\";\n dismissButton.style.display = \"none\";\n snoozeButton.style.display = \"none\";\n\n vibration.stop();\n // clearTimeout(currTimeout);\n if (currAlarm != -1) {\n clearAlarm(currAlarm);\n // clearTimeout(buzzTimeout);\n // clearTimeout(snoozeTimeouts[currAlarm]);\n // snoozeTimeouts[currAlarm] = 0;\n \n // currSnooze = 0;\n lastAlarm = currAlarm; // so we can get it back again, if needed\n\n // writeNote(currAlarm, noteMess.text);\n writeNote(currAlarm);\n\n /* If any alarm has a \"snoozes\" time in the past, run it now */\n overlapAlarm();\n currAlarm = -1;\n }\n\n /*\n writeFileSync(\"snooze\", {\n number: currAlarm,\n timeout: 0,\n last: lastAlarm\n }, \"json\");\n */\n // remove any saved snooze file\n // try {\n // unlinkSync(\"snooze\");\n // } catch (err) {}\n}", "function checkStop( enc ){\n\tvar len = 0;\t\t\t\t\t\t\t\t\t\t//Variable to check current index against\n\tif( enc ) len = msg.length;\t\t\t//Grab length of message if encryption\n\telse\t\t\tlen = cip.length;\t\t\t//Grab length of cipher if decryption\n\n\tif( MSGIN >= len ){\t\t\t\t\t\t\t//If index of message has reached EOT\n\t\tif(\tGLOBTIMER != null ){\t\t\t//If the animation is npt stopped\n\t\t\tclearInterval( GLOBTIMER );\t//Stop the animation\n\t\t\tGLOBTIMER = null;\t\t\t\t\t\t//Resets the value for value checking\n\t\t}\n\t\tvar output = \"\"; \t\t\t\t\t\t\t\t\t\t\t//String containing output text\n\t\t$(\"button\").prop(\"disabled\", true);\t\t//Disable the buttons,\n\t\t$(\"#reset\").prop(\"disabled\", false);\t//Enable the reset button\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//Show the message in the banner box\n\t\tif( enc == true )\t\t\t\t\t\t\t\t\t\t\t//If doing encryption\n\t\t\tstring = \"Encrypted text: \\\"<b>\" + $(\"#ctext\").val() + \"</b>\\\"\";\n\t\telse\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//If doing decryption\n\t\t\tstring = \"Original Message: \\\"<b>\" + $(\"#ptext\").val() + \"</b>\\\"\";\n\t\t\n\t\t$(\"#resText\").html( string );\t\t\t\t\t//Output the string to the GUI\n\t\t$(\"#msgbox\").fadeOut(500);\t\t\t\t\t\t//Fades out the message box\n\t\t$(\"#resText\").slideDown( 500 );\t\t\t\t//Animate the message \n\t\treturn true;\t\t\t\t\t\t\t\t\t\t\t\t\t//Return true since at end of string\n\t}\n\treturn false;\t\t\t\t\t\t\t\t\t\t\t\t\t\t//Return false, not end of string\n}", "function finishStory(){\n\ttry {\n\t\tsaver(\"finished\");\n\t}\n\tcatch(e) {\n\t\tlog(\"story_slide_saver.js\", e.lineNumber, e);\n\t}\n}", "function AES_Done() {\n delete AES_Sbox_Inv;\n delete AES_ShiftRowTab_Inv;\n delete AES_xtime;\n}", "function reachedEndOfGame() {\n stop();\n $(\"#question\").html(\"Reached the end of the game :)\");\n $(\"#timer-view\").html(\"- -\");\n $(\".footer\").html(\"Yay!\");\n}", "function checkForEnd() {\n\t\tsetTimeout(function () {\n\t\t\t$(\"#content\").fadeOut(500, function () {\n\n\t\t\t\twindow.location = \"scene_pig3story.html\";\n\t\t\t});\n\t\t}, 2400);\n\t\tsetTimeout(function () {\n\t\t\t$(\"body\").removeClass(\"blackFade\");\n\t\t}, 1900);\n\t}" ]
[ "0.62259203", "0.6109418", "0.6109418", "0.6088812", "0.6060569", "0.59280056", "0.58706427", "0.5843161", "0.5830428", "0.57861495", "0.57644564", "0.5745211", "0.5696366", "0.56857187", "0.56516534", "0.5647392", "0.56357074", "0.56196386", "0.5602296", "0.55835384", "0.5580461", "0.5579702", "0.55720294", "0.55524606", "0.5547756", "0.55419034", "0.55372447", "0.5536666", "0.54778355", "0.54735935", "0.5459707", "0.5453508", "0.5429566", "0.5418154", "0.5395108", "0.5391204", "0.5390924", "0.53838456", "0.5378336", "0.53782827", "0.5372665", "0.5371834", "0.53679895", "0.5364161", "0.5357895", "0.5356666", "0.5350896", "0.5344907", "0.5340812", "0.53405607", "0.53376853", "0.53317446", "0.53256506", "0.53255373", "0.5324377", "0.53240013", "0.53226084", "0.5318063", "0.5313967", "0.5311518", "0.53026026", "0.5295718", "0.52911896", "0.5289363", "0.5285974", "0.5285875", "0.5284804", "0.5281657", "0.52803814", "0.5279016", "0.5276183", "0.52656406", "0.52540505", "0.5249849", "0.5246653", "0.5245515", "0.524525", "0.5242721", "0.5226792", "0.52211124", "0.52202415", "0.5218465", "0.5217896", "0.5214331", "0.52135736", "0.5212038", "0.52089036", "0.5208482", "0.5203718", "0.5202673", "0.52025163", "0.52003205", "0.5196062", "0.5195936", "0.5194239", "0.5192873", "0.5192324", "0.5189041", "0.5188663", "0.5188635", "0.5187327" ]
0.0
-1
Portions of this code are from MochiKit, received by The Closure Authors under the MIT license. All other code is Copyright 20052009 The Closure Authors. All Rights Reserved.
function lq(a,b){this.ve=[];this.Wf=a;this.Of=b||null;this.Ed=this.bd=!1;this.fc=void 0;this.lf=this.lg=this.Fe=!1;this.ye=0;this.ob=null;this.Ge=0}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "transient protected internal function m189() {}", "static private internal function m121() {}", "static final private internal function m106() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient private internal function m185() {}", "transient private protected public internal function m181() {}", "transient final protected internal function m174() {}", "static private protected internal function m118() {}", "static transient final protected public internal function m46() {}", "static transient final private internal function m43() {}", "static private protected public internal function m117() {}", "static transient private protected internal function m55() {}", "static private public function m119() {}", "static final private protected public internal function m102() {}", "static protected internal function m125() {}", "static final protected internal function m110() {}", "transient final private internal function m170() {}", "static transient final protected internal function m47() {}", "static transient private internal function m58() {}", "static final private public function m104() {}", "static transient final private protected internal function m40() {}", "static final private protected internal function m103() {}", "transient final private protected public internal function m166() {}", "static transient private public function m56() {}", "static transient private protected public internal function m54() {}", "transient final private protected internal function m167() {}", "transient private public function m183() {}", "function _____SHARED_functions_____(){}", "static transient protected internal function m62() {}", "function o0(stdlib,o1,buffer) {\n try {\nthis.o559 = this.o560;\n}catch(e){}\n var o2 = o254 = [].fround;\n //views\n var charCodeAt =new Map.prototype.keys.call(buffer);\n\n function o4(){\n var o5 = 0.5\n var o35 = { writable: false, value: 1, configurable: false, enumerable: false };\n try {\no849 = o6;\n}catch(e){}\n try {\nreturn +(o0[o1])\n}catch(e){}\n }\n try {\nreturn o4;\n}catch(e){}\n}", "function ie(a,b,c){this.$=a;this.M=[];this.ga=n;this.Fd=b;this.Jb=c}", "function CIQ(){}", "function M(){}", "function mbcs() {}", "function mbcs() {}", "function o0(o1)\n{\n var o2 = -1;\n try {\nfor (var o259 = 0; o3 < o1.length; function (o502, name, o38, o781, o782, o837, o585, o838, o549) {\n try {\no839.o468();\n}catch(e){}\n // TODO we should allow people to just pass in a complete filename instead\n // of parent and name being that we just join them anyways\n var o840 = name ? o591.resolve(o591.o592(o502, name)) : o502;\n\n function o841(o842) {\n function o843(o842) {\n try {\nif (!o838) {\n try {\no474.o800(o502, name, o842, o781, o782, o549);\n}catch(e){}\n }\n}catch(e){}\n try {\nif (o837) try {\no837();\n}catch(e){}\n}catch(e){}\n try {\no334('cp ' + o840);\n}catch(e){}\n }\n var o844 = false;\n try {\nModule['preloadPlugins'].forEach(function (o845) {\n try {\nif (o844) try {\nreturn;\n}catch(e){}\n}catch(e){}\n try {\nif (o845['canHandle'](o840)) {\n try {\no845['handle'](o842, o840, o843, function () {\n try {\nif (o585) try {\no585();\n}catch(e){}\n}catch(e){}\n try {\no334('cp ' + o840);\n}catch(e){}\n });\n}catch(e){}\n try {\no844 = true;\n}catch(e){}\n }\n}catch(e){}\n });\n}catch(e){}\n try {\nif (!o844) try {\no843(o842);\n}catch(e){}\n}catch(e){}\n }\n try {\no332('cp ' + o840);\n}catch(e){}\n try {\nif (typeof o38 == 'string') {\n try {\no839.o846(o38, function (o842) {\n try {\no841(o842);\n}catch(e){}\n }, o585);\n}catch(e){}\n } else {\n try {\no841(o38);\n}catch(e){}\n }\n}catch(e){}\n })\n {\n try {\nif (o1[o3] == undefined)\n {\n try {\nif (o2 == -1)\n {\n try {\no2 = o3;\n}catch(e){}\n }\n}catch(e){}\n }\n else\n {\n try {\nif (o2 != -1)\n {\n try {\no4.o5(o2 + \"-\" + (o3-1) + \" = undefined\");\n}catch(e){}\n try {\no2 = -1;\n}catch(e){}\n }\n}catch(e){}\n try {\no4.o5(o3 + \" = \" + o1[o3]);\n}catch(e){}\n }\n}catch(e){}\n }\n}catch(e){}\n}", "function Macex() {\r\n}", "function Kutility() {\n\n}", "function Kutility() {\n\n}", "function kd(){this.gc=void 0;this.group=w.i.Ik;this.Ob=w.i.Ob}", "static transient final protected function m44() {}", "function miFuncion (){}", "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 aI(dI){var dH,dF;if(dI){dH=self;dH.options=dF=dI.data;dH.WRCp=dH.WRCp||dG}function dG(dM,dR){(function(dT){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=dT()}else{if(typeof pakoDefine===\"function\"&&pakoDefine.amd){pakoDefine([],dT)}else{var dS;if(typeof window!==\"undefined\"){dS=window}else{if(typeof dM!==\"undefined\"){dS=dM}else{if(typeof self!==\"undefined\"){dS=self}else{dS=this}}}dS.pako=dT()}}})(function(){return(function dS(dU,dY,dW){function dV(d3,d1){if(!dY[d3]){if(!dU[d3]){var d0=typeof require==\"function\"&&require;if(!d1&&d0){return d0(d3,!0)}if(dT){return dT(d3,!0)}var d2=new Error(\"Cannot find module '\"+d3+\"'\");throw d2.code=\"MODULE_NOT_FOUND\",d2}var dZ=dY[d3]={exports:{}};dU[d3][0].call(dZ.exports,function(d4){var d5=dU[d3][1][d4];return dV(d5?d5:d4)},dZ,dZ.exports,dS,dU,dY,dW)}return dY[d3].exports}var dT=typeof require==\"function\"&&require;for(var dX=0;dX<dW.length;dX++){dV(dW[dX])}return dV})({1:[function(d2,dU,ee){var d7=d2(\"./zlib/deflate.js\");var ed=d2(\"./utils/common\");var dY=d2(\"./utils/strings\");var d0=d2(\"./zlib/messages\");var ec=d2(\"./zlib/zstream\");var d9=Object.prototype.toString;var d8=0;var eg=4;var dZ=0;var d4=1;var dV=-1;var dW=0;var d5=8;var ef=function(ei){this.options=ed.assign({level:dV,method:d5,chunkSize:16384,windowBits:15,memLevel:8,strategy:dW,to:\"\"},ei||{});var ej=this.options;if(ej.raw&&(ej.windowBits>0)){ej.windowBits=-ej.windowBits}else{if(ej.gzip&&(ej.windowBits>0)&&(ej.windowBits<16)){ej.windowBits+=16}}this.err=0;this.msg=\"\";this.ended=false;this.chunks=[];this.strm=new ec();this.strm.avail_out=0;var eh=d7.deflateInit2(this.strm,ej.level,ej.method,ej.windowBits,ej.memLevel,ej.strategy);if(eh!==dZ){throw new Error(d0[eh])}if(ej.header){d7.deflateSetHeader(this.strm,ej.header)}};ef.prototype.pushSingleChunk=function(ek,el){var ei=this.strm;var em=this.options.chunkSize;var eh,ej;if(this.ended){return false}ej=(el===~~el)?el:((el===true)?eg:d8);if(typeof ek===\"string\"){ei.input=dY.string2buf(ek)}else{if(d9.call(ek)===\"[object ArrayBuffer]\"){ei.input=new Uint8Array(ek)}else{ei.input=ek}}ei.next_in=0;ei.avail_in=ei.input.length;dX.call(this,ej);if(dN){return}if(ej===eg){eh=d7.deflateEnd(this.strm);this.onEnd(eh);this.ended=true;return eh===dZ}return true};function d1(eh){return eh<26?eh+65:eh<52?eh+71:eh<62?eh-4:eh===62?43:eh===63?47:65}function d6(eh){var ei=dM.btoa(String.fromCharCode.apply(null,eh));return ei}function eb(em){var ei,el=\"\";if(dM.btoa){return d6(em)}for(var ek=em.length,eh=0,ej=0;ej<ek;ej++){ei=ej%3;eh|=em[ej]<<(16>>>ei&24);if(ei===2||em.length-ej===1){el+=String.fromCharCode(d1(eh>>>18&63),d1(eh>>>12&63),d1(eh>>>6&63),d1(eh&63));eh=0}}return el.replace(/A(?=A$|$)/g,\"=\")}function dX(el){dL();var ej;var ei=this.strm;var em=this.options.chunkSize;var eh,ek;dT.call(this,ei,ek);if(dN){return}if(this.ended){return false}ek=(el===~~el)?el:((el===true)?eg:d8);if(ei.avail_out===0){ei.output=new ed.Buf8(em);ei.next_out=0;ei.avail_out=em;if(dQ()){ej=dO(dX,this,ek,null);dJ(ej);return}}eh=d7.deflate(ei,ek);if(eh===\"defer\"){ej=dO(dX,this,ek,null);dJ(ej);return}if(dQ()){ej=dO(dX,this,ek,null);dJ(ej);return}if(eh!==d4&&eh!==dZ){this.onEnd(eh);this.ended=true;return false}dT.call(this,ei,ek);if((ei.avail_in>0||ei.avail_out===0)&&eh!==d4){if(ei.avail_out===0){ei.output=new ed.Buf8(em);ei.next_out=0;ei.avail_out=em}dX.call(this,ek)}}function dT(ei,ek){if(ei.output&&(ei.avail_out===0||(ei.avail_in===0&&ek===eg))){if(this.options.to===\"string\"){var eh=eb(ed.shrinkBuf(ei.output,ei.next_out));this.onData(eh)}else{this.onData(ed.shrinkBuf(ei.output,ei.next_out))}if(dQ()){var ej=dO(dX,this,ek,null);dJ(ej);return}}}ef.prototype.push=function(el,em){var ej=this.strm;var en=this.options.chunkSize;var ei,ek,eh;if(this.ended){return false}ek=(em===~~em)?em:((em===true)?eg:d8);if(typeof el===\"string\"){ej.input=dY.string2buf(el)}else{if(d9.call(el)===\"[object ArrayBuffer]\"){ej.input=new Uint8Array(el)}else{ej.input=el}}ej.next_in=0;ej.avail_in=ej.input.length;do{if(ej.avail_out===0){ej.output=new ed.Buf8(en);ej.next_out=0;ej.avail_out=en}ei=d7.deflate(ej,ek);if(ei!==d4&&ei!==dZ){this.onEnd(ei);this.ended=true;return false}if(ej.avail_out===0|0|(ej.avail_in===0&&ek===eg)){if(this.options.to===\"string\"){eh=eb(ed.shrinkBuf(ej.output,ej.next_out));this.onData(eh)}else{this.onData(ed.shrinkBuf(ej.output,ej.next_out))}}}while((ej.avail_in>0||ej.avail_out===0)&&ei!==d4);if(ek===eg){ei=d7.deflateEnd(this.strm);this.onEnd(ei);this.ended=true;dM.options=undefined;dM.deflate=undefined;return ei===dZ}return true};ef.prototype.onData=function(eh){this.chunks.push(eh)};ef.prototype.onEnd=function(eh){if(eh===dZ){if(this.options.to===\"string\"){this.result=this.chunks.join(\"\")}else{this.result=ed.flattenChunks(this.chunks)}}this.chunks=[];this.err=eh;this.msg=this.strm.msg};function d3(eh,ei){var ej;if(!ei.level){ei.level=dV}ej=new ef(ei);(!ei.async&&ei.useDefer)?ej.pushSingleChunk(eh,true):ej.push(eh,true);if(ej.err){throw ej.msg}return ej.result}function ea(eh,ei){ei=ei||{};ei.raw=true;return d3(eh,ei)}ee.Deflate=ef;ee.deflate=d3;ee.deflateRaw=ea},{\"./utils/common\":3,\"./utils/strings\":4,\"./zlib/deflate.js\":8,\"./zlib/messages\":13,\"./zlib/zstream\":15}],2:[function(dU,dV,dT){},{\"./utils/common\":3,\"./utils/strings\":4,\"./zlib/constants\":6,\"./zlib/gzheader\":9,\"./zlib/inflate.js\":11,\"./zlib/messages\":13,\"./zlib/zstream\":15}],3:[function(dU,dV,dT){var dY=(typeof Uint8Array!==\"undefined\")&&(typeof Uint16Array!==\"undefined\")&&(typeof Int32Array!==\"undefined\");dT.assign=function(d2){var dZ=Array.prototype.slice.call(arguments,1);while(dZ.length){var d0=dZ.shift();if(!d0){continue}if(typeof(d0)!==\"object\"){throw new TypeError(d0+\"must be non-object\")}for(var d1 in d0){if(d0.hasOwnProperty(d1)){d2[d1]=d0[d1]}}}return d2};dT.shrinkBuf=function(dZ,d0){if(dZ.length===d0){return dZ}if(dZ.subarray){return dZ.subarray(0,d0)}dZ.length=d0;return dZ};var dW={arraySet:function(d0,d2,d4,dZ,d3){if(d2.subarray&&d0.subarray){d0.set(d2.subarray(d4,d4+dZ),d3);return}for(var d1=0;d1<dZ;d1++){d0[d3+d1]=d2[d4+d1]}},flattenChunks:function(d5){var d3,d1,d0,d4,d2,dZ;d0=0;for(d3=0,d1=d5.length;d3<d1;d3++){d0+=d5[d3].length}dZ=new Uint8Array(d0);d4=0;for(d3=0,d1=d5.length;d3<d1;d3++){d2=d5[d3];dZ.set(d2,d4);d4+=d2.length}return dZ}};var dX={arraySet:function(d0,d2,d4,dZ,d3){for(var d1=0;d1<dZ;d1++){d0[d3+d1]=d2[d4+d1]}},flattenChunks:function(dZ){return[].concat.apply([],dZ)}};dT.setTyped=function(dZ){if(dZ&&(dR.useBinary||dM.btoa)){dT.Buf8=Uint8Array;dT.Buf16=Uint16Array;dT.Buf32=Int32Array;dT.assign(dT,dW)}else{dT.Buf8=Array;dT.Buf16=Array;dT.Buf32=Array;dT.assign(dT,dX)}};dT.setTyped(dY)},{}],4:[function(dV,dT,dW){var d2=dV(\"./common\");var d0=true;var dY=true;try{String.fromCharCode.apply(null,[0])}catch(d1){d0=false}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(d1){dY=false}var dU=new d2.Buf8(256);for(var dX=0;dX<256;dX++){dU[dX]=(dX>=252?6:dX>=248?5:dX>=240?4:dX>=224?3:dX>=192?2:1)}dU[254]=dU[254]=1;dW.string2buf=function(d9){var d3,ea,d5,d6,d4,d8=d9.length,d7=0;for(d6=0;d6<d8;d6++){ea=d9.charCodeAt(d6);if((ea&64512)===55296&&(d6+1<d8)){d5=d9.charCodeAt(d6+1);if((d5&64512)===56320){ea=65536+((ea-55296)<<10)+(d5-56320);d6++}}d7+=ea<128?1:ea<2048?2:ea<65536?3:4}d3=new d2.Buf8(d7);for(d4=0,d6=0;d4<d7;d6++){ea=d9.charCodeAt(d6);if((ea&64512)===55296&&(d6+1<d8)){d5=d9.charCodeAt(d6+1);if((d5&64512)===56320){ea=65536+((ea-55296)<<10)+(d5-56320);d6++}}if(ea<128){d3[d4++]=ea}else{if(ea<2048){d3[d4++]=192|(ea>>>6);d3[d4++]=128|(ea&63)}else{if(ea<65536){d3[d4++]=224|(ea>>>12);d3[d4++]=128|(ea>>>6&63);d3[d4++]=128|(ea&63)}else{d3[d4++]=240|(ea>>>18);d3[d4++]=128|(ea>>>12&63);d3[d4++]=128|(ea>>>6&63);d3[d4++]=128|(ea&63)}}}}return d3};function dZ(d5,d4){if(d4<65537){if((d5.subarray&&dY)||(!d5.subarray&&d0)){return String.fromCharCode.apply(null,d2.shrinkBuf(d5,d4))}}var d3=\"\";for(var d6=0;d6<d4;d6++){d3+=String.fromCharCode(d5[d6])}return d3}dW.buf2binstring=function(d3){return dZ(d3,d3.length)};dW.binstring2buf=function(d6){var d4=new d2.Buf8(d6.length);for(var d5=0,d3=d4.length;d5<d3;d5++){d4[d5]=d6.charCodeAt(d5)}return d4};dW.buf2string=function(d8,d5){var d9,d7,ea,d6;var d4=d5||d8.length;var d3=new Array(d4*2);for(d7=0,d9=0;d9<d4;){ea=d8[d9++];if(ea<128){d3[d7++]=ea;continue}d6=dU[ea];if(d6>4){d3[d7++]=65533;d9+=d6-1;continue}ea&=d6===2?31:d6===3?15:7;while(d6>1&&d9<d4){ea=(ea<<6)|(d8[d9++]&63);d6--}if(d6>1){d3[d7++]=65533;continue}if(ea<65536){d3[d7++]=ea}else{ea-=65536;d3[d7++]=55296|((ea>>10)&1023);d3[d7++]=56320|(ea&1023)}}return dZ(d3,d7)};dW.utf8border=function(d4,d3){var d5;d3=d3||d4.length;if(d3>d4.length){d3=d4.length}d5=d3-1;while(d5>=0&&(d4[d5]&192)===128){d5--}if(d5<0){return d3}if(d5===0){return d3}return(d5+dU[d4[d5]]>d3)?d5:d3}},{\"./common\":3}],5:[function(dU,dV,dT){},{}],6:[function(dU,dV,dT){dV.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],7:[function(dU,dV,dT){},{}],8:[function(eY,fc,et){var eA=eY(\"../utils/common\");var fa=eY(\"./trees\");var es=eY(\"./adler32\");var eH=eY(\"./crc32\");var en=eY(\"./messages\");var ev=0;var eG=1;var e2=3;var d3=4;var eB=5;var d9=0;var ee=1;var eZ=-2;var ed=-3;var dX=-5;var dZ=-1;var ew=1;var el=2;var eh=3;var ea=4;var e3=0;var er=2;var eF=8;var e4=9;var ey=15;var d5=8;var eU=29;var e8=256;var fb=e8+1+eU;var ek=30;var eP=19;var eW=2*fb+1;var ez=15;var ep=3;var e0=258;var dV=(e0+ep+1);var d1=32;var eD=42;var d7=69;var eI=73;var eV=91;var d8=103;var ff=113;var ej=666;var eX=1;var eb=2;var eC=3;var dW=4;var e1=3;function eQ(fg,fh){fg.msg=en[fh];return fh}function ex(fg){return((fg)<<1)-((fg)>4?9:0)}function e7(fh){var fg=fh.length;while(--fg>=0){fh[fg]=0}}function dY(fh){var fi=fh.state;var fg=fi.pending;if(fg>fh.avail_out){fg=fh.avail_out}if(fg===0){return}eA.arraySet(fh.output,fi.pending_buf,fi.pending_out,fg,fh.next_out);fh.next_out+=fg;fi.pending_out+=fg;fh.total_out+=fg;fh.avail_out-=fg;fi.pending-=fg;if(fi.pending===0){fi.pending_out=0}}function d2(fg,fh){fa._tr_flush_block(fg,(fg.block_start>=0?fg.block_start:-1),fg.strstart-fg.block_start,fh);fg.block_start=fg.strstart;dY(fg.strm)}function dU(fh,fg){fh.pending_buf[fh.pending++]=fg}function ei(fh,fg){fh.pending_buf[fh.pending++]=(fg>>>8)&255;fh.pending_buf[fh.pending++]=fg&255}function em(fh,fi,fk,fj){var fg=fh.avail_in;if(fg>fj){fg=fj}if(fg===0){return 0}fh.avail_in-=fg;eA.arraySet(fi,fh.input,fh.next_in,fg,fk);if(fh.state.wrap===1){fh.adler=es(fh.adler,fi,fg,fk)}else{if(fh.state.wrap===2){fh.adler=eH(fh.adler,fi,fg,fk)}}fh.next_in+=fg;fh.total_in+=fg;return fg}function e6(ft,fk){var fn=ft.max_chain_length;var fu=ft.strstart;var fl;var fm;var fg=ft.prev_length;var fh=ft.nice_match;var fj=(ft.strstart>(ft.w_size-dV))?ft.strstart-(ft.w_size-dV):0;var fr=ft.window;var fo=ft.w_mask;var fi=ft.prev;var fq=ft.strstart+e0;var fs=fr[fu+fg-1];var fp=fr[fu+fg];if(ft.prev_length>=ft.good_match){fn>>=2}if(fh>ft.lookahead){fh=ft.lookahead}do{fl=fk;if(fr[fl+fg]!==fp||fr[fl+fg-1]!==fs||fr[fl]!==fr[fu]||fr[++fl]!==fr[fu+1]){continue}fu+=2;fl++;do{}while(fr[++fu]===fr[++fl]&&fr[++fu]===fr[++fl]&&fr[++fu]===fr[++fl]&&fr[++fu]===fr[++fl]&&fr[++fu]===fr[++fl]&&fr[++fu]===fr[++fl]&&fr[++fu]===fr[++fl]&&fr[++fu]===fr[++fl]&&fu<fq);fm=e0-(fq-fu);fu=fq-e0;if(fm>fg){ft.match_start=fk;fg=fm;if(fm>=fh){break}fs=fr[fu+fg-1];fp=fr[fu+fg]}}while((fk=fi[fk&fo])>fj&&--fn!==0);if(fg<=ft.lookahead){return fg}return ft.lookahead}function eT(fi){var fm=fi.w_size;var fj,fl,fg,fh,fk;do{fh=fi.window_size-fi.lookahead-fi.strstart;if(fi.strstart>=fm+(fm-dV)){eA.arraySet(fi.window,fi.window,fm,fm,0);fi.match_start-=fm;fi.strstart-=fm;fi.block_start-=fm;fl=fi.hash_size;fj=fl;do{fg=fi.head[--fj];fi.head[fj]=(fg>=fm?fg-fm:0)}while(--fl);fl=fm;fj=fl;do{fg=fi.prev[--fj];fi.prev[fj]=(fg>=fm?fg-fm:0)}while(--fl);fh+=fm}if(fi.strm.avail_in===0){break}fl=em(fi.strm,fi.window,fi.strstart+fi.lookahead,fh);fi.lookahead+=fl;if(fi.lookahead+fi.insert>=ep){fk=fi.strstart-fi.insert;fi.ins_h=fi.window[fk];fi.ins_h=((fi.ins_h<<fi.hash_shift)^fi.window[fk+1])&fi.hash_mask;while(fi.insert){fi.ins_h=((fi.ins_h<<fi.hash_shift)^fi.window[fk+ep-1])&fi.hash_mask;fi.prev[fk&fi.w_mask]=fi.head[fi.ins_h];fi.head[fi.ins_h]=fk;fk++;fi.insert--;if(fi.lookahead+fi.insert<ep){break}}}}while(fi.lookahead<dV&&fi.strm.avail_in!==0)}function eu(fj,fg){var fi=65535;if(fi>fj.pending_buf_size-5){fi=fj.pending_buf_size-5}for(;;){if(fj.lookahead<=1){eT(fj);if(fj.lookahead===0&&fg===ev){return eX}if(fj.lookahead===0){break}}fj.strstart+=fj.lookahead;fj.lookahead=0;var fh=fj.block_start+fi;if(fj.strstart===0||fj.strstart>=fh){fj.lookahead=fj.strstart-fh;fj.strstart=fh;d2(fj,false);if(fj.strm.avail_out===0){return eX}}if(fj.strstart-fj.block_start>=(fj.w_size-dV)){d2(fj,false);if(fj.strm.avail_out===0){return eX}}}fj.insert=0;if(fg===d3){d2(fj,true);if(fj.strm.avail_out===0){return eC}return dW}if(fj.strstart>fj.block_start){d2(fj,false);if(fj.strm.avail_out===0){return eX}}return eX}function d4(fi,fg){var fj;var fh;for(;;){if(fi.lookahead<dV){eT(fi);if(fi.lookahead<dV&&fg===ev){return eX}if(fi.lookahead===0){break}}fj=0;if(fi.lookahead>=ep){fi.ins_h=((fi.ins_h<<fi.hash_shift)^fi.window[fi.strstart+ep-1])&fi.hash_mask;fj=fi.prev[fi.strstart&fi.w_mask]=fi.head[fi.ins_h];fi.head[fi.ins_h]=fi.strstart}if(fj!==0&&((fi.strstart-fj)<=(fi.w_size-dV))){fi.match_length=e6(fi,fj)}if(fi.match_length>=ep){fh=fa._tr_tally(fi,fi.strstart-fi.match_start,fi.match_length-ep);fi.lookahead-=fi.match_length;if(fi.match_length<=fi.max_lazy_match&&fi.lookahead>=ep){fi.match_length--;do{fi.strstart++;fi.ins_h=((fi.ins_h<<fi.hash_shift)^fi.window[fi.strstart+ep-1])&fi.hash_mask;fj=fi.prev[fi.strstart&fi.w_mask]=fi.head[fi.ins_h];fi.head[fi.ins_h]=fi.strstart}while(--fi.match_length!==0);fi.strstart++}else{fi.strstart+=fi.match_length;fi.match_length=0;fi.ins_h=fi.window[fi.strstart];fi.ins_h=((fi.ins_h<<fi.hash_shift)^fi.window[fi.strstart+1])&fi.hash_mask}}else{fh=fa._tr_tally(fi,0,fi.window[fi.strstart]);fi.lookahead--;fi.strstart++}if(fh){d2(fi,false);if(fi.strm.avail_out===0){return eX}}}fi.insert=((fi.strstart<(ep-1))?fi.strstart:ep-1);if(fg===d3){d2(fi,true);if(fi.strm.avail_out===0){return eC}return dW}if(fi.last_lit){d2(fi,false);if(fi.strm.avail_out===0){return eX}}return eb}function eR(fj,fh){var fk;var fi;var fg;for(;;){if(fj.lookahead<dV){eT(fj);if(fj.lookahead<dV&&fh===ev){return eX}if(fj.lookahead===0){break}}fk=0;if(fj.lookahead>=ep){fj.ins_h=((fj.ins_h<<fj.hash_shift)^fj.window[fj.strstart+ep-1])&fj.hash_mask;fk=fj.prev[fj.strstart&fj.w_mask]=fj.head[fj.ins_h];fj.head[fj.ins_h]=fj.strstart}fj.prev_length=fj.match_length;fj.prev_match=fj.match_start;fj.match_length=ep-1;if(fk!==0&&fj.prev_length<fj.max_lazy_match&&fj.strstart-fk<=(fj.w_size-dV)){fj.match_length=e6(fj,fk);if(fj.match_length<=5&&(fj.strategy===ew||(fj.match_length===ep&&fj.strstart-fj.match_start>4096))){fj.match_length=ep-1}}if(fj.prev_length>=ep&&fj.match_length<=fj.prev_length){fg=fj.strstart+fj.lookahead-ep;fi=fa._tr_tally(fj,fj.strstart-1-fj.prev_match,fj.prev_length-ep);fj.lookahead-=fj.prev_length-1;fj.prev_length-=2;do{if(++fj.strstart<=fg){fj.ins_h=((fj.ins_h<<fj.hash_shift)^fj.window[fj.strstart+ep-1])&fj.hash_mask;fk=fj.prev[fj.strstart&fj.w_mask]=fj.head[fj.ins_h];fj.head[fj.ins_h]=fj.strstart}}while(--fj.prev_length!==0);fj.match_available=0;fj.match_length=ep-1;fj.strstart++;if(fi){d2(fj,false);if(fj.strm.avail_out===0){return eX}}}else{if(fj.match_available){fi=fa._tr_tally(fj,0,fj.window[fj.strstart-1]);if(fi){d2(fj,false)}fj.strstart++;fj.lookahead--;if(fj.strm.avail_out===0){return eX}}else{fj.match_available=1;fj.strstart++;fj.lookahead--}}}if(fj.match_available){fi=fa._tr_tally(fj,0,fj.window[fj.strstart-1]);fj.match_available=0}fj.insert=fj.strstart<ep-1?fj.strstart:ep-1;if(fh===d3){d2(fj,true);if(fj.strm.avail_out===0){return eC}return dW}if(fj.last_lit){d2(fj,false);if(fj.strm.avail_out===0){return eX}}return eb}function eN(fk,fh){var fj;var fl;var fi,fg;var fm=fk.window;for(;;){if(fk.lookahead<=e0){eT(fk);if(fk.lookahead<=e0&&fh===ev){return eX}if(fk.lookahead===0){break}}fk.match_length=0;if(fk.lookahead>=ep&&fk.strstart>0){fi=fk.strstart-1;fl=fm[fi];if(fl===fm[++fi]&&fl===fm[++fi]&&fl===fm[++fi]){fg=fk.strstart+e0;do{}while(fl===fm[++fi]&&fl===fm[++fi]&&fl===fm[++fi]&&fl===fm[++fi]&&fl===fm[++fi]&&fl===fm[++fi]&&fl===fm[++fi]&&fl===fm[++fi]&&fi<fg);fk.match_length=e0-(fg-fi);if(fk.match_length>fk.lookahead){fk.match_length=fk.lookahead}}}if(fk.match_length>=ep){fj=fa._tr_tally(fk,1,fk.match_length-ep);fk.lookahead-=fk.match_length;fk.strstart+=fk.match_length;fk.match_length=0}else{fj=fa._tr_tally(fk,0,fk.window[fk.strstart]);fk.lookahead--;fk.strstart++}if(fj){d2(fk,false);if(fk.strm.avail_out===0){return eX}}}fk.insert=0;if(fh===d3){d2(fk,true);if(fk.strm.avail_out===0){return eC}return dW}if(fk.last_lit){d2(fk,false);if(fk.strm.avail_out===0){return eX}}return eb}function eO(fi,fg){var fh;for(;;){if(fi.lookahead===0){eT(fi);if(fi.lookahead===0){if(fg===ev){return eX}break}}fi.match_length=0;fh=fa._tr_tally(fi,0,fi.window[fi.strstart]);fi.lookahead--;fi.strstart++;if(fh){d2(fi,false);if(fi.strm.avail_out===0){return eX}}}fi.insert=0;if(fg===d3){d2(fi,true);if(fi.strm.avail_out===0){return eC}return dW}if(fi.last_lit){d2(fi,false);if(fi.strm.avail_out===0){return eX}}return eb}var eL=function(fg,fk,fh,fj,fi){this.good_length=fg;this.max_lazy=fk;this.nice_length=fh;this.max_chain=fj;this.func=fi};var eK;eK=[new eL(0,0,0,0,eu),new eL(4,4,8,4,d4),new eL(4,5,16,8,d4),new eL(4,6,32,32,d4),new eL(4,4,16,16,eR),new eL(8,16,32,32,eR),new eL(8,16,128,128,eR),new eL(8,32,128,256,eR),new eL(32,128,258,1024,eR),new eL(32,258,258,4096,eR)];function eq(fg){fg.window_size=2*fg.w_size;e7(fg.head);fg.max_lazy_match=eK[fg.level].max_lazy;fg.good_match=eK[fg.level].good_length;fg.nice_match=eK[fg.level].nice_length;fg.max_chain_length=eK[fg.level].max_chain;fg.strstart=0;fg.block_start=0;fg.lookahead=0;fg.insert=0;fg.match_length=fg.prev_length=ep-1;fg.match_available=0;fg.ins_h=0}function dT(){this.strm=null;this.status=0;this.pending_buf=null;this.pending_buf_size=0;this.pending_out=0;this.pending=0;this.wrap=0;this.gzhead=null;this.gzindex=0;this.method=eF;this.last_flush=-1;this.w_size=0;this.w_bits=0;this.w_mask=0;this.window=null;this.window_size=0;this.prev=null;this.head=null;this.ins_h=0;this.hash_size=0;this.hash_bits=0;this.hash_mask=0;this.hash_shift=0;this.block_start=0;this.match_length=0;this.prev_match=0;this.match_available=0;this.strstart=0;this.match_start=0;this.lookahead=0;this.prev_length=0;this.max_chain_length=0;this.max_lazy_match=0;this.level=0;this.strategy=0;this.good_match=0;this.nice_match=0;this.dyn_ltree=new eA.Buf16(eW*2);this.dyn_dtree=new eA.Buf16((2*ek+1)*2);this.bl_tree=new eA.Buf16((2*eP+1)*2);e7(this.dyn_ltree);e7(this.dyn_dtree);e7(this.bl_tree);this.l_desc=null;this.d_desc=null;this.bl_desc=null;this.bl_count=new eA.Buf16(ez+1);this.heap=new eA.Buf16(2*fb+1);e7(this.heap);this.heap_len=0;this.heap_max=0;this.depth=new eA.Buf16(2*fb+1);e7(this.depth);this.l_buf=0;this.lit_bufsize=0;this.last_lit=0;this.d_buf=0;this.opt_len=0;this.static_len=0;this.matches=0;this.insert=0;this.bi_buf=0;this.bi_valid=0}function eS(fg){var fh;if(!fg||!fg.state){return eQ(fg,eZ)}fg.total_in=fg.total_out=0;fg.data_type=er;fh=fg.state;fh.pending=0;fh.pending_out=0;if(fh.wrap<0){fh.wrap=-fh.wrap}fh.status=(fh.wrap?eD:ff);fg.adler=(fh.wrap===2)?0:1;fh.last_flush=ev;fa._tr_init(fh);return d9}function ef(fg){var fh=eS(fg);if(fh===d9){eq(fg.state)}return fh}function fe(fg,fh){if(!fg||!fg.state){return eZ}if(fg.state.wrap!==2){return eZ}fg.state.gzhead=fh;return d9}function eo(fg,fn,fm,fj,fl,fk){if(!fg){return eZ}var fi=1;if(fn===dZ){fn=6}if(fj<0){fi=0;fj=-fj}else{if(fj>15){fi=2;fj-=16}}if(fl<1||fl>e4||fm!==eF||fj<8||fj>15||fn<0||fn>9||fk<0||fk>ea){return eQ(fg,eZ)}if(fj===8){fj=9}var fh=new dT();fg.state=fh;fh.strm=fg;fh.wrap=fi;fh.gzhead=null;fh.w_bits=fj;fh.w_size=1<<fh.w_bits;fh.w_mask=fh.w_size-1;fh.hash_bits=fl+7;fh.hash_size=1<<fh.hash_bits;fh.hash_mask=fh.hash_size-1;fh.hash_shift=~~((fh.hash_bits+ep-1)/ep);fh.window=new eA.Buf8(fh.w_size*2);fh.head=new eA.Buf16(fh.hash_size);fh.prev=new eA.Buf16(fh.w_size);fh.lit_bufsize=1<<(fl+6);fh.pending_buf_size=fh.lit_bufsize*4;fh.pending_buf=new eA.Buf8(fh.pending_buf_size);fh.d_buf=fh.lit_bufsize>>1;fh.l_buf=(1+2)*fh.lit_bufsize;fh.level=fn;fh.strategy=fk;fh.method=fm;return ef(fg)}function eE(fg,fh){return eo(fg,fh,eF,ey,d5,e3)}function d6(fi,fg,fl){var fk,fj,fh;dL();if(!fi||!fi.state||fg>eB||fg<0){return fi?eQ(fi,eZ):eZ}fj=fi.state;if(!fi.output||(!fi.input&&fi.avail_in!==0)||(fj.status===ej&&fg!==d3)){return eQ(fi,(fi.avail_out===0)?dX:eZ)}fj.strm=fi;fk=fj.last_flush;fj.last_flush=fg;if(fj.status===eD){eg(fj)}if(dQ()){return\"defer\"}if(fj.status===d7){e9(fj,fi)}if(dQ()){return\"defer\"}if(fj.status===eI){d0(fj,fi)}if(dQ()){return\"defer\"}if(fj.status===eV){eJ(fj,fi)}if(dQ()){return\"defer\"}if(fj.status===d8){fd(fj,fi)}if(dQ()){return\"defer\"}if(!fj.flushedPending){fh=eM(fj,fi,fg);if(typeof fh!==\"undefined\"){fj.flushedPending=null;return fh}}if(fg!==d3){return d9}if(fj.wrap<=0){return ee}if(dQ()){return\"defer\"}fj.flushedPending=null;ec(fj);dY(fj);if(fj.wrap>0){fj.wrap=-fj.wrap}return fj.pending!==0?d9:ee}function eg(fh,fg){if(fh.wrap===2){fg.adler=0;dU(fh,31);dU(fh,139);dU(fh,8);if(!fh.gzhead){dU(fh,0);dU(fh,0);dU(fh,0);dU(fh,0);dU(fh,0);dU(fh,fh.level===9?2:(fh.strategy>=el||fh.level<2?4:0));dU(fh,e1);fh.status=ff}else{dU(fh,(fh.gzhead.text?1:0)+(fh.gzhead.hcrc?2:0)+(!fh.gzhead.extra?0:4)+(!fh.gzhead.name?0:8)+(!fh.gzhead.comment?0:16));dU(fh,fh.gzhead.time&255);dU(fh,(fh.gzhead.time>>8)&255);dU(fh,(fh.gzhead.time>>16)&255);dU(fh,(fh.gzhead.time>>24)&255);dU(fh,fh.level===9?2:(fh.strategy>=el||fh.level<2?4:0));dU(fh,fh.gzhead.os&255);if(fh.gzhead.extra&&fh.gzhead.extra.length){dU(fh,fh.gzhead.extra.length&255);dU(fh,(fh.gzhead.extra.length>>8)&255)}if(fh.gzhead.hcrc){fg.adler=eH(fg.adler,fh.pending_buf,fh.pending,0)}fh.gzindex=0;fh.status=d7}}else{var fj=(eF+((fh.w_bits-8)<<4))<<8;var fi=-1;if(fh.strategy>=el||fh.level<2){fi=0}else{if(fh.level<6){fi=1}else{if(fh.level===6){fi=2}else{fi=3}}}fj|=(fi<<6);if(fh.strstart!==0){fj|=d1}fj+=31-(fj%31);fh.status=ff;ei(fh,fj);if(fh.strstart!==0){ei(fh,fg.adler>>>16);ei(fh,fg.adler&65535)}fg.adler=1}}function e9(fh,fg){if(fh.gzhead.extra){beg=fh.pending;while(fh.gzindex<(fh.gzhead.extra.length&65535)){if(fh.pending===fh.pending_buf_size){if(fh.gzhead.hcrc&&fh.pending>beg){fg.adler=eH(fg.adler,fh.pending_buf,fh.pending-beg,beg)}dY(fg);beg=fh.pending;if(fh.pending===fh.pending_buf_size){break}}dU(fh,fh.gzhead.extra[fh.gzindex]&255);fh.gzindex++}if(fh.gzhead.hcrc&&fh.pending>beg){fg.adler=eH(fg.adler,fh.pending_buf,fh.pending-beg,beg)}if(fh.gzindex===fh.gzhead.extra.length){fh.gzindex=0;fh.status=eI}}else{fh.status=eI}}function d0(fh,fg){if(fh.gzhead.name){beg=fh.pending;do{if(fh.pending===fh.pending_buf_size){if(fh.gzhead.hcrc&&fh.pending>beg){fg.adler=eH(fg.adler,fh.pending_buf,fh.pending-beg,beg)}dY(fg);beg=fh.pending;if(fh.pending===fh.pending_buf_size){val=1;break}}if(fh.gzindex<fh.gzhead.name.length){val=fh.gzhead.name.charCodeAt(fh.gzindex++)&255}else{val=0}dU(fh,val)}while(val!==0);if(fh.gzhead.hcrc&&fh.pending>beg){fg.adler=eH(fg.adler,fh.pending_buf,fh.pending-beg,beg)}if(val===0){fh.gzindex=0;fh.status=eV}}else{fh.status=eV}}function eJ(fh,fg){if(fh.gzhead.comment){beg=fh.pending;do{if(fh.pending===fh.pending_buf_size){if(fh.gzhead.hcrc&&fh.pending>beg){fg.adler=eH(fg.adler,fh.pending_buf,fh.pending-beg,beg)}dY(fg);beg=fh.pending;if(fh.pending===fh.pending_buf_size){val=1;break}}if(fh.gzindex<fh.gzhead.comment.length){val=fh.gzhead.comment.charCodeAt(fh.gzindex++)&255}else{val=0}dU(fh,val)}while(val!==0);if(fh.gzhead.hcrc&&fh.pending>beg){fg.adler=eH(fg.adler,fh.pending_buf,fh.pending-beg,beg)}if(val===0){fh.status=d8}}else{fh.status=d8}}function fd(fh,fg){if(fh.gzhead.hcrc){if(fh.pending+2>fh.pending_buf_size){dY(fg)}if(fh.pending+2<=fh.pending_buf_size){dU(fh,fg.adler&255);dU(fh,(fg.adler>>8)&255);fg.adler=0;fh.status=ff}}else{fh.status=ff}}function eM(fi,fh,fg){var fj=fi.last_flush;fi.flushedPending=true;if(fi.pending!==0){dY(fh);if(fh.avail_out===0){fi.last_flush=-1;return d9}}else{if(fh.avail_in===0&&ex(fg)<=ex(fj)&&fg!==d3){return eQ(fh,dX)}}if(fi.status===ej&&fh.avail_in!==0){return eQ(fh,dX)}if(fh.avail_in!==0||fi.lookahead!==0||(fg!==ev&&fi.status!==ej)){var fk=(fi.strategy===el)?eO(fi,fg):(fi.strategy===eh?eN(fi,fg):eK[fi.level].func(fi,fg));if(fk===eC||fk===dW){fi.status=ej}if(fk===eX||fk===eC){if(fh.avail_out===0){fi.last_flush=-1}return d9}if(fk===eb){if(fg===eG){fa._tr_align(fi)}else{if(fg!==eB){fa._tr_stored_block(fi,0,0,false);if(fg===e2){e7(fi.head);if(fi.lookahead===0){fi.strstart=0;fi.block_start=0;fi.insert=0}}}}dY(fh);if(fh.avail_out===0){fi.last_flush=-1;return d9}}}}function ec(fh,fg){if(fh.wrap===2){dU(fh,fg.adler&255);dU(fh,(fg.adler>>8)&255);dU(fh,(fg.adler>>16)&255);dU(fh,(fg.adler>>24)&255);dU(fh,fg.total_in&255);dU(fh,(fg.total_in>>8)&255);dU(fh,(fg.total_in>>16)&255);dU(fh,(fg.total_in>>24)&255)}else{ei(fh,fg.adler>>>16);ei(fh,fg.adler&65535)}}function e5(fh){var fg;if(!fh||!fh.state){return eZ}fg=fh.state.status;if(fg!==eD&&fg!==d7&&fg!==eI&&fg!==eV&&fg!==d8&&fg!==ff&&fg!==ej){return eQ(fh,eZ)}fh.state=null;return fg===ff?eQ(fh,ed):d9}et.deflateInit=eE;et.deflateInit2=eo;et.deflateReset=ef;et.deflateResetKeep=eS;et.deflateSetHeader=fe;et.deflate=d6;et.deflateEnd=e5;et.deflateInfo=\"pako deflate (from Nodeca project)\"},{\"../utils/common\":3,\"./adler32\":5,\"./crc32\":7,\"./messages\":13,\"./trees\":14}],9:[function(dU,dV,dT){function dW(){this.text=0;this.time=0;this.xflags=0;this.os=0;this.extra=null;this.extra_len=0;this.name=\"\";this.comment=\"\";this.hcrc=0;this.done=false}dV.exports=dW},{}],10:[function(dU,dV,dT){},{}],11:[function(dU,dV,dT){},{\"../utils/common\":3,\"./adler32\":5,\"./crc32\":7,\"./inffast\":10,\"./inftrees\":12}],12:[function(dV,dW,dU){var dT=dV(\"../utils/common\")},{\"../utils/common\":3}],13:[function(dU,dV,dT){},{}],14:[function(d1,dZ,eQ){var e0=d1(\"../utils/common\");var ey=4;var d9=0;var ej=1;var ek=2;function dT(e2){var e1=e2.length;while(--e1>=0){e2[e1]=0}}var eC=0;var eS=1;var er=2;var eZ=3;var el=258;var d6=29;var dW=256;var dX=dW+1+d6;var dU=30;var ec=19;var dY=2*dX+1;var eW=15;var ef=16;var eL=7;var dV=256;var eo=16;var en=17;var es=18;var d0=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];var ed=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];var ei=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];var ez=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var eA=512;var eu=new Array((dX+2)*2);dT(eu);var eG=new Array(dU*2);dT(eG);var eM=new Array(eA);dT(eM);var eg=new Array(el-eZ+1);dT(eg);var et=new Array(d6);dT(et);var eV=new Array(dU);dT(eV);var eJ=function(e4,e3,e2,e1,e5){this.static_tree=e4;this.extra_bits=e3;this.extra_base=e2;this.elems=e1;this.max_length=e5;this.has_stree=e4&&e4.length};var eO;var eF;var ee;var eY=function(e2,e1){this.dyn_tree=e2;this.max_code=0;this.stat_desc=e1};function eH(e1){return e1<256?eM[e1]:eM[256+(e1>>>7)]}function d4(e2,e1){e2.pending_buf[e2.pending++]=(e1)&255;e2.pending_buf[e2.pending++]=(e1>>>8)&255}function eN(e1,e3,e2){if(e1.bi_valid>(ef-e2)){e1.bi_buf|=(e3<<e1.bi_valid)&65535;d4(e1,e1.bi_buf);e1.bi_buf=e3>>(ef-e1.bi_valid);e1.bi_valid+=e2-ef}else{e1.bi_buf|=(e3<<e1.bi_valid)&65535;e1.bi_valid+=e2}}function eR(e2,e3,e1){eN(e2,e1[e3*2],e1[e3*2+1])}function eh(e3,e1){var e2=0;do{e2|=e3&1;e3>>>=1;e2<<=1}while(--e1>0);return e2>>>1}function eb(e1){if(e1.bi_valid===16){d4(e1,e1.bi_buf);e1.bi_buf=0;e1.bi_valid=0}else{if(e1.bi_valid>=8){e1.pending_buf[e1.pending++]=e1.bi_buf&255;e1.bi_buf>>=8;e1.bi_valid-=8}}}function d3(ff,fa){var fg=fa.dyn_tree;var fb=fa.max_code;var fe=fa.stat_desc.static_tree;var e3=fa.stat_desc.has_stree;var e5=fa.stat_desc.extra_bits;var e1=fa.stat_desc.extra_base;var fd=fa.stat_desc.max_length;var e8;var e2,e4;var fc;var e7;var e9;var e6=0;for(fc=0;fc<=eW;fc++){ff.bl_count[fc]=0}fg[ff.heap[ff.heap_max]*2+1]=0;for(e8=ff.heap_max+1;e8<dY;e8++){e2=ff.heap[e8];fc=fg[fg[e2*2+1]*2+1]+1;if(fc>fd){fc=fd;e6++}fg[e2*2+1]=fc;if(e2>fb){continue}ff.bl_count[fc]++;e7=0;if(e2>=e1){e7=e5[e2-e1]}e9=fg[e2*2];ff.opt_len+=e9*(fc+e7);if(e3){ff.static_len+=e9*(fe[e2*2+1]+e7)}}if(e6===0){return}do{fc=fd-1;while(ff.bl_count[fc]===0){fc--}ff.bl_count[fc]--;ff.bl_count[fc+1]+=2;ff.bl_count[fd]--;e6-=2}while(e6>0);for(fc=fd;fc!==0;fc--){e2=ff.bl_count[fc];while(e2!==0){e4=ff.heap[--e8];if(e4>fb){continue}if(fg[e4*2+1]!==fc){ff.opt_len+=(fc-fg[e4*2+1])*fg[e4*2];fg[e4*2+1]=fc}e2--}}}function eP(e2,e8,e3){var e5=new Array(eW+1);var e4=0;var e6;var e7;for(e6=1;e6<=eW;e6++){e5[e6]=e4=(e4+e3[e6-1])<<1}for(e7=0;e7<=e8;e7++){var e1=e2[e7*2+1];if(e1===0){continue}e2[e7*2]=eh(e5[e1]++,e1)}}function eB(){var e6;var e4;var e3;var e2;var e5;var e1=new Array(eW+1);e3=0;for(e2=0;e2<d6-1;e2++){et[e2]=e3;for(e6=0;e6<(1<<d0[e2]);e6++){eg[e3++]=e2}}eg[e3-1]=e2;e5=0;for(e2=0;e2<16;e2++){eV[e2]=e5;for(e6=0;e6<(1<<ed[e2]);e6++){eM[e5++]=e2}}e5>>=7;for(;e2<dU;e2++){eV[e2]=e5<<7;for(e6=0;e6<(1<<(ed[e2]-7));e6++){eM[256+e5++]=e2}}for(e4=0;e4<=eW;e4++){e1[e4]=0}e6=0;while(e6<=143){eu[e6*2+1]=8;e6++;e1[8]++}while(e6<=255){eu[e6*2+1]=9;e6++;e1[9]++}while(e6<=279){eu[e6*2+1]=7;e6++;e1[7]++}while(e6<=287){eu[e6*2+1]=8;e6++;e1[8]++}eP(eu,dX+1,e1);for(e6=0;e6<dU;e6++){eG[e6*2+1]=5;eG[e6*2]=eh(e6,5)}eO=new eJ(eu,d0,dW+1,dX,eW);eF=new eJ(eG,ed,0,dU,eW);ee=new eJ(new Array(0),ei,0,ec,eL)}function eq(e1){var e2;for(e2=0;e2<dX;e2++){e1.dyn_ltree[e2*2]=0}for(e2=0;e2<dU;e2++){e1.dyn_dtree[e2*2]=0}for(e2=0;e2<ec;e2++){e1.bl_tree[e2*2]=0}e1.dyn_ltree[dV*2]=1;e1.opt_len=e1.static_len=0;e1.last_lit=e1.matches=0}function d2(e1){if(e1.bi_valid>8){d4(e1,e1.bi_buf)}else{if(e1.bi_valid>0){e1.pending_buf[e1.pending++]=e1.bi_buf}}e1.bi_buf=0;e1.bi_valid=0}function d8(e3,e2,e1,e4){d2(e3);if(e4){d4(e3,e1);d4(e3,~e1)}e0.arraySet(e3.pending_buf,e3.window,e2,e1,e3.pending);e3.pending+=e1}function eE(e2,e6,e1,e5){var e4=e6*2;var e3=e1*2;return(e2[e4]<e2[e3]||(e2[e4]===e2[e3]&&e5[e6]<=e5[e1]))}function eX(e5,e1,e3){var e2=e5.heap[e3];var e4=e3<<1;while(e4<=e5.heap_len){if(e4<e5.heap_len&&eE(e1,e5.heap[e4+1],e5.heap[e4],e5.depth)){e4++}if(eE(e1,e2,e5.heap[e4],e5.depth)){break}e5.heap[e3]=e5.heap[e4];e3=e4;e4<<=1}e5.heap[e3]=e2}function eU(e2,e8,e5){var e7;var e4;var e6=0;var e3;var e1;if(e2.last_lit!==0){do{e7=(e2.pending_buf[e2.d_buf+e6*2]<<8)|(e2.pending_buf[e2.d_buf+e6*2+1]);e4=e2.pending_buf[e2.l_buf+e6];e6++;if(e7===0){eR(e2,e4,e8)}else{e3=eg[e4];eR(e2,e3+dW+1,e8);e1=d0[e3];if(e1!==0){e4-=et[e3];eN(e2,e4,e1)}e7--;e3=eH(e7);eR(e2,e3,e5);e1=ed[e3];if(e1!==0){e7-=eV[e3];eN(e2,e7,e1)}}}while(e6<e2.last_lit)}eR(e2,dV,e8)}function eD(e9,e6){var fa=e6.dyn_tree;var e8=e6.stat_desc.static_tree;var e3=e6.stat_desc.has_stree;var e1=e6.stat_desc.elems;var e2,e5;var e7=-1;var e4;e9.heap_len=0;e9.heap_max=dY;for(e2=0;e2<e1;e2++){if(fa[e2*2]!==0){e9.heap[++e9.heap_len]=e7=e2;e9.depth[e2]=0}else{fa[e2*2+1]=0}}while(e9.heap_len<2){e4=e9.heap[++e9.heap_len]=(e7<2?++e7:0);fa[e4*2]=1;e9.depth[e4]=0;e9.opt_len--;if(e3){e9.static_len-=e8[e4*2+1]}}e6.max_code=e7;for(e2=(e9.heap_len>>1);e2>=1;e2--){eX(e9,fa,e2)}e4=e1;do{e2=e9.heap[1];e9.heap[1]=e9.heap[e9.heap_len--];eX(e9,fa,1);e5=e9.heap[1];e9.heap[--e9.heap_max]=e2;e9.heap[--e9.heap_max]=e5;fa[e4*2]=fa[e2*2]+fa[e5*2];e9.depth[e4]=(e9.depth[e2]>=e9.depth[e5]?e9.depth[e2]:e9.depth[e5])+1;fa[e2*2+1]=fa[e5*2+1]=e4;e9.heap[1]=e4++;eX(e9,fa,1)}while(e9.heap_len>=2);e9.heap[--e9.heap_max]=e9.heap[1];d3(e9,e6);eP(fa,e7,e9.bl_count)}function d7(e9,fa,e8){var e2;var e6=-1;var e1;var e4=fa[0*2+1];var e5=0;var e3=7;var e7=4;if(e4===0){e3=138;e7=3}fa[(e8+1)*2+1]=65535;for(e2=0;e2<=e8;e2++){e1=e4;e4=fa[(e2+1)*2+1];if(++e5<e3&&e1===e4){continue}else{if(e5<e7){e9.bl_tree[e1*2]+=e5}else{if(e1!==0){if(e1!==e6){e9.bl_tree[e1*2]++}e9.bl_tree[eo*2]++}else{if(e5<=10){e9.bl_tree[en*2]++}else{e9.bl_tree[es*2]++}}}}e5=0;e6=e1;if(e4===0){e3=138;e7=3}else{if(e1===e4){e3=6;e7=3}else{e3=7;e7=4}}}}function ea(e9,fa,e8){var e2;var e6=-1;var e1;var e4=fa[0*2+1];var e5=0;var e3=7;var e7=4;if(e4===0){e3=138;e7=3}for(e2=0;e2<=e8;e2++){e1=e4;e4=fa[(e2+1)*2+1];if(++e5<e3&&e1===e4){continue}else{if(e5<e7){do{eR(e9,e1,e9.bl_tree)}while(--e5!==0)}else{if(e1!==0){if(e1!==e6){eR(e9,e1,e9.bl_tree);e5--}eR(e9,eo,e9.bl_tree);eN(e9,e5-3,2)}else{if(e5<=10){eR(e9,en,e9.bl_tree);eN(e9,e5-3,3)}else{eR(e9,es,e9.bl_tree);eN(e9,e5-11,7)}}}}e5=0;e6=e1;if(e4===0){e3=138;e7=3}else{if(e1===e4){e3=6;e7=3}else{e3=7;e7=4}}}}function em(e2){var e1;d7(e2,e2.dyn_ltree,e2.l_desc.max_code);d7(e2,e2.dyn_dtree,e2.d_desc.max_code);eD(e2,e2.bl_desc);for(e1=ec-1;e1>=3;e1--){if(e2.bl_tree[ez[e1]*2+1]!==0){break}}e2.opt_len+=3*(e1+1)+5+5+4;return e1}function ew(e2,e3,e1,e4){var e5;eN(e2,e3-257,5);eN(e2,e1-1,5);eN(e2,e4-4,4);for(e5=0;e5<e4;e5++){eN(e2,e2.bl_tree[ez[e5]*2+1],3)}ea(e2,e2.dyn_ltree,e3-1);ea(e2,e2.dyn_dtree,e1-1)}function ev(e2){var e1=4093624447;var e3;for(e3=0;e3<=31;e3++,e1>>>=1){if((e1&1)&&(e2.dyn_ltree[e3*2]!==0)){return d9}}if(e2.dyn_ltree[9*2]!==0||e2.dyn_ltree[10*2]!==0||e2.dyn_ltree[13*2]!==0){return ej}for(e3=32;e3<dW;e3++){if(e2.dyn_ltree[e3*2]!==0){return ej}}return d9}var eK=false;function ep(e1){if(!eK){eB();eK=true}e1.l_desc=new eY(e1.dyn_ltree,eO);e1.d_desc=new eY(e1.dyn_dtree,eF);e1.bl_desc=new eY(e1.bl_tree,ee);e1.bi_buf=0;e1.bi_valid=0;eq(e1)}function ex(e3,e1,e2,e4){eN(e3,(eC<<1)+(e4?1:0),3);d8(e3,e1,e2,true)}function eI(e1){eN(e1,eS<<1,3);eR(e1,dV,eu);eb(e1)}function d5(e6,e3,e5,e7){var e2,e1;var e4=0;if(e6.level>0){if(e6.strm.data_type===ek){e6.strm.data_type=ev(e6)}eD(e6,e6.l_desc);eD(e6,e6.d_desc);e4=em(e6);e2=(e6.opt_len+3+7)>>>3;e1=(e6.static_len+3+7)>>>3;if(e1<=e2){e2=e1}}else{e2=e1=e5+5}if((e5+4<=e2)&&(e3!==-1)){ex(e6,e3,e5,e7)}else{if(e6.strategy===ey||e1===e2){eN(e6,(eS<<1)+(e7?1:0),3);eU(e6,eu,eG)}else{eN(e6,(er<<1)+(e7?1:0),3);ew(e6,e6.l_desc.max_code+1,e6.d_desc.max_code+1,e4+1);eU(e6,e6.dyn_ltree,e6.dyn_dtree)}}eq(e6);if(e7){d2(e6)}}function eT(e1,e3,e2){e1.pending_buf[e1.d_buf+e1.last_lit*2]=(e3>>>8)&255;e1.pending_buf[e1.d_buf+e1.last_lit*2+1]=e3&255;e1.pending_buf[e1.l_buf+e1.last_lit]=e2&255;e1.last_lit++;if(e3===0){e1.dyn_ltree[e2*2]++}else{e1.matches++;e3--;e1.dyn_ltree[(eg[e2]+dW+1)*2]++;e1.dyn_dtree[eH(e3)*2]++}return(e1.last_lit===e1.lit_bufsize-1)}eQ._tr_init=ep;eQ._tr_stored_block=ex;eQ._tr_flush_block=d5;eQ._tr_tally=eT;eQ._tr_align=eI},{\"../utils/common\":3}],15:[function(dU,dV,dT){function dW(){this.input=null;this.next_in=0;this.avail_in=0;this.total_in=0;this.output=null;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg=\"\";this.state=null;this.data_type=2;this.adler=0}dV.exports=dW},{}],\"/\":[function(dV,dY,dU){var dT=dV(\"./lib/utils/common\").assign;var dX=dV(\"./lib/deflate\");var dW=dV(\"./lib/zlib/constants\");var dZ={};dT(dZ,dX,dW);dY.exports=dZ},{\"./lib/deflate\":1,\"./lib/inflate\":2,\"./lib/utils/common\":3,\"./lib/zlib/constants\":6}]},{},[])(\"/\")});function dO(dT,dS,dV,dU){return function(){dT.call(dS,dV,dU)}}function dQ(){if(!dR.async&&dR.useDefer&&!dN){var dS=new Date()-dL();if(dS>dR.threshold){return true}}return false}function dJ(dS){dN=true;setTimeout(function(){dN=false;dK();dS()},dR.defer);return true}pako.Deflate.prototype.onData=function(dS){dG.handler.apply(dG,[dS,this.strm.avail_out===0?false:true])};pako.Deflate.prototype.onEnd=function(dS){};this.options=dR;var dP=null;var dN=false;function dL(){return dP||(dP=new Date())}function dK(){return dP=null}}dG.prototype.deflate=function(dJ,dK){return pako.deflateRaw(dJ,dK)};dG.prototype.onEnd=function(){pako.onEnd.apply(this,arguments)};dG.prototype.process=function(dJ){dG.handler=dJ;if(!this.options.useBinary){this.options.to=\"string\"}pako.deflateRaw(this.options.text,this.options)};if(dH&&dH.options){if(!dH.deflate){dH.options.async=true;dH.options.useDefer=false;dH.deflate=new dG(self,dH.options)}dH.deflate.process(function(){postMessage({args:Array.prototype.slice.call(arguments),url:self.location&&self.location.href})})}return dG}", "static transient final private protected public internal function m39() {}", "function StupidBug() {}", "transient final private public function m168() {}", "function _G() {}", "function _G() {}", "function Mv(){var t=this;ci()(this,{$source:{enumerable:!0,get:function(){return t.$olObject}},$map:{enumerable:!0,get:function(){return t.$services&&uu()(t.$services)}},$view:{enumerable:!0,get:function(){return t.$services&&t.$services.view}},$sourceContainer:{enumerable:!0,get:function(){return t.$services&&t.$services.sourceContainer}}})}", "static transient final private protected public function m38() {}", "function i(e){var t=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(e),n=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(e),r=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),i=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),a=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),s=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),c=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),d=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),f=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),m=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),v=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),y=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),g=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),_=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),b=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),w=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),T=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),E=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),S=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(n),x=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(e),k=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(x),C=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(x),A=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(x),N=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(x),I=function(e){function t(){return(0,l.default)(this,t),(0,p.default)(this,(t.__proto__||(0,u.default)(t)).apply(this,arguments))}return(0,h.default)(t,e),t}(x);(0,o.default)(e,{0:t,NetworkOrCORSError:t,400:n,BadRequest:n,401:r,Unauthorized:r,402:i,PaymentRequired:i,403:a,Forbidden:a,404:s,NotFound:s,405:c,MethodNotAllowed:c,406:d,NotAcceptable:d,407:f,ProxyAuthenticationRequired:f,408:m,RequestTimeout:m,409:v,Conflict:v,410:y,Gone:y,411:g,LengthRequired:g,412:_,PreconditionFailed:_,413:b,RequestEntityTooLarge:b,414:w,RequestUriTooLong:w,415:T,UnsupportedMediaType:T,416:E,RequestRangeNotSatisfiable:E,417:S,ExpectationFailed:S,500:x,InternalServerError:x,501:k,NotImplemented:k,502:C,BadGateway:C,503:A,ServiceUnavailable:A,504:N,GatewayTimeout:N,505:I,HttpVersionNotSupported:I,select:function(t){if(void 0===t||null===t)return e;t=t.statusCode||t;var n=e[t];return n||(t=t.toString().split(\"\").shift()+\"00\",t=parseInt(t,10),e[t]||e)}})}", "function o0(e,o1,buffer) {\n try {\n\"use asm\";\n}catch(e){}\n function o7(o2,o3) {\n try {\nset.o27 = +o2;\n}catch(e){}\n try {\no384 = +o28;\n}catch(e){}\n try {\nreturn o1083 = o1062;\n}catch(e){}\n }\n \n function o4(o2,o3){\n try {\no4212]o4.o6(function() { try {\nObject.defineProperty(o3, key, { value: 'something', enumerable: true });\n}catch(e){} }, \"Object.defineProperty uses ToPropertyKey. Property is added to the object\")] = 2;\n}catch(e){}\n try {\no39.o38(o34);\n}catch(e){}\n var o673 = o215(1, \"i32*\", o212);\n var o1103 = 0;\n try {\no5 = +o7[this.o565[o810]](o2,o3);\n}catch(e){}\n try {\nreturn +o5;\n}catch(e){}\n }\n \n var o7 = [add,add,add,add];\n \n \n try {\nreturn o4.o10;\n}catch(e){}\n}", "function i(e){return void 0===e&&(e=null),Object(r[\"m\"])(null!==e?e:o)}", "function i(e){return void 0===e&&(e=null),Object(r[\"m\"])(null!==e?e:o)}", "function WMCache(param, // @arg Object - { name, deny, allow, limit, garbage }\n callback, // @arg Function - cache ready callback(cache:WMCache, backend:StorageString):void\n errCallback) { // @arg Function - error callback(err:Error):void\n // @param.name String = \"void\" - application name\n // @param.deny URLStringArray = [] - deny URL pattern\n // @param.allow URLStringArray = [] - allow URL pattern\n // @param.garbage URLStringArray = [] - garbage URL pattern\n // @param.limit Integer = 0 - cache limit (unit MB)\n param = param || {};\n\n//{@dev\n $valid($type(param, \"Object\"), WMCache, \"param\");\n $valid($type(callback, \"Function\"), WMCache, \"callback\");\n $valid($type(errCallback, \"Function\"), WMCache, \"errCallback\");\n $valid($keys(param, \"name|deny|allow|garbage|limit\"), WMCache, \"param\");\n $valid($type(param.name, \"String|omit\"), WMCache, \"param.name\");\n $valid($type(param.deny, \"URLStringArray|omit\"), WMCache, \"param.deny\");\n $valid($type(param.allow, \"URLStringArray|omit\"), WMCache, \"param.allow\");\n $valid($type(param.garbage, \"URLStringArray|omit\"), WMCache, \"param.garbage\");\n $valid($type(param.limit, \"Integer|omit\"), WMCache, \"param.limit\");\n//}@dev\n\n var that = this;\n var name = param[\"name\"] || \"void\";\n var deny = param[\"deny\"] || [];\n var allow = param[\"allow\"] || [];\n var garbage = param[\"garbage\"] || [];\n\n this._limit = (param[\"limit\"] || 0) * 1024 * 1024; // to MB\n this._errCallback = errCallback;\n this._control = new WMCacheControl(allow, deny, garbage);\n this._storage = FS[\"ready\"] ? new FS(name, _ready, errCallback) :\n DB[\"ready\"] ? new DB(name, _ready, errCallback) :\n new BH(name, _ready, errCallback);\n function _ready() {\n callback(that);\n }\n}", "obtain(){}", "function Hx(a){return a&&a.ic?a.Mb():a}", "function al(df){var de,dd;if(df){de=self;de.options=dd=df.data;de.WRCt=de.WRCt||dc}function dc(dj,dp){(function(dr){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=dr()}else{if(typeof pakoDefine===\"function\"&&pakoDefine.amd){pakoDefine([],dr)}else{var dq;if(typeof window!==\"undefined\"){dq=window}else{if(typeof dj!==\"undefined\"){dq=dj}else{if(typeof self!==\"undefined\"){dq=self}else{dq=this}}}dq.pako=dr()}}})(function(){var dt,dr,dq;return(function ds(dv,dz,dx){function dw(dE,dC){if(!dz[dE]){if(!dv[dE]){var dB=typeof require==\"function\"&&require;if(!dC&&dB){return dB(dE,!0)}if(du){return du(dE,!0)}var dD=new Error(\"Cannot find module '\"+dE+\"'\");throw dD.code=\"MODULE_NOT_FOUND\",dD}var dA=dz[dE]={exports:{}};dv[dE][0].call(dA.exports,function(dF){var dG=dv[dE][1][dF];return dw(dG?dG:dF)},dA,dA.exports,ds,dv,dz,dx)}return dz[dE].exports}var du=typeof require==\"function\"&&require;for(var dy=0;dy<dx.length;dy++){dw(dx[dy])}return dw})({1:[function(dD,dv,dP){var dI=dD(\"./zlib/deflate.js\");var dO=dD(\"./utils/common\");var dz=dD(\"./utils/strings\");var dB=dD(\"./zlib/messages\");var dN=dD(\"./zlib/zstream\");var dK=Object.prototype.toString;var dJ=0;var dR=4;var dA=0;var dF=1;var dw=-1;var dx=0;var dG=8;var dQ=function(dT){this.options=dO.assign({level:dw,method:dG,chunkSize:16384,windowBits:15,memLevel:8,strategy:dx,to:\"\"},dT||{});var dU=this.options;if(dU.raw&&(dU.windowBits>0)){dU.windowBits=-dU.windowBits}else{if(dU.gzip&&(dU.windowBits>0)&&(dU.windowBits<16)){dU.windowBits+=16}}this.err=0;this.msg=\"\";this.ended=false;this.chunks=[];this.strm=new dN();this.strm.avail_out=0;var dS=dI.deflateInit2(this.strm,dU.level,dU.method,dU.windowBits,dU.memLevel,dU.strategy);if(dS!==dA){throw new Error(dB[dS])}if(dU.header){dI.deflateSetHeader(this.strm,dU.header)}};dQ.prototype.pushSingleChunk=function(dV,dW){var dT=this.strm;var dX=this.options.chunkSize;var dS,dU;if(this.ended){return false}dU=(dW===~~dW)?dW:((dW===true)?dR:dJ);if(typeof dV===\"string\"){dT.input=dz.string2buf(dV)}else{if(dK.call(dV)===\"[object ArrayBuffer]\"){dT.input=new Uint8Array(dV)}else{dT.input=dV}}dT.next_in=0;dT.avail_in=dT.input.length;dy.call(this,dU);if(dk){return}if(dU===dR){dS=dI.deflateEnd(this.strm);this.onEnd(dS);this.ended=true;return dS===dA}return true};function dC(dS){return dS<26?dS+65:dS<52?dS+71:dS<62?dS-4:dS===62?43:dS===63?47:65}function dH(dS){var dT=dj.btoa(String.fromCharCode.apply(null,dS));return dT}function dM(dX){var dT,dW=\"\";if(dj.btoa){return dH(dX)}for(var dV=dX.length,dS=0,dU=0;dU<dV;dU++){dT=dU%3;dS|=dX[dU]<<(16>>>dT&24);if(dT===2||dX.length-dU===1){dW+=String.fromCharCode(dC(dS>>>18&63),dC(dS>>>12&63),dC(dS>>>6&63),dC(dS&63));dS=0}}return dW.replace(/A(?=A$|$)/g,\"=\")}function dy(dX){di();var dV;var dU=this.strm;var dY=this.options.chunkSize;var dT,dW,dS;du.call(this,dU,dW);if(dk){return}if(this.ended){return false}dW=(dX===~~dX)?dX:((dX===true)?dR:dJ);if(dU.avail_out===0){dU.output=new dO.Buf8(dY);dU.next_out=0;dU.avail_out=dY;if(dn()){dV=dl(dy,this,dW,null);dg(dV);return}}dT=dI.deflate(dU,dW);if(dT===\"defer\"){dV=dl(dy,this,dW,null);dg(dV);return}if(dn()){dV=dl(dy,this,dW,null);dg(dV);return}if(dT!==dF&&dT!==dA){this.onEnd(dT);this.ended=true;return false}du.call(this,dU,dW);if((dU.avail_in>0||dU.avail_out===0)&&dT!==dF){if(dU.avail_out===0){dU.output=new dO.Buf8(dY);dU.next_out=0;dU.avail_out=dY}dy.call(this,dW)}}function du(dT,dV){if(dT.output&&(dT.avail_out===0||(dT.avail_in===0&&dV===dR))){if(this.options.to===\"string\"){var dS=dM(dO.shrinkBuf(dT.output,dT.next_out));this.onData(dS)}else{this.onData(dO.shrinkBuf(dT.output,dT.next_out))}if(dn()){var dU=dl(dy,this,dV,null);dg(dU);return}}}dQ.prototype.push=function(dW,dX){var dU=this.strm;var dY=this.options.chunkSize;var dT,dV,dS;if(this.ended){return false}dV=(dX===~~dX)?dX:((dX===true)?dR:dJ);if(typeof dW===\"string\"){dU.input=dz.string2buf(dW)}else{if(dK.call(dW)===\"[object ArrayBuffer]\"){dU.input=new Uint8Array(dW)}else{dU.input=dW}}dU.next_in=0;dU.avail_in=dU.input.length;do{if(dU.avail_out===0){dU.output=new dO.Buf8(dY);dU.next_out=0;dU.avail_out=dY}dT=dI.deflate(dU,dV);if(dT!==dF&&dT!==dA){this.onEnd(dT);this.ended=true;return false}if(dU.avail_out===0|0|(dU.avail_in===0&&dV===dR)){if(this.options.to===\"string\"){dS=dM(dO.shrinkBuf(dU.output,dU.next_out));this.onData(dS)}else{this.onData(dO.shrinkBuf(dU.output,dU.next_out))}}}while((dU.avail_in>0||dU.avail_out===0)&&dT!==dF);if(dV===dR){dT=dI.deflateEnd(this.strm);this.onEnd(dT);this.ended=true;dj.options=undefined;dj.deflate=undefined;return dT===dA}return true};dQ.prototype.onData=function(dS){this.chunks.push(dS)};dQ.prototype.onEnd=function(dS){if(dS===dA){if(this.options.to===\"string\"){this.result=this.chunks.join(\"\")}else{this.result=dO.flattenChunks(this.chunks)}}this.chunks=[];this.err=dS;this.msg=this.strm.msg};function dE(dS,dT){var dU;if(!dT.level){dT.level=dw}dU=new dQ(dT);(!dT.async&&dT.useDefer)?dU.pushSingleChunk(dS,true):dU.push(dS,true);if(dU.err){throw dU.msg}return dU.result}function dL(dS,dT){dT=dT||{};dT.raw=true;return dE(dS,dT)}dP.Deflate=dQ;dP.deflate=dE;dP.deflateRaw=dL},{\"./utils/common\":3,\"./utils/strings\":4,\"./zlib/deflate.js\":8,\"./zlib/messages\":13,\"./zlib/zstream\":15}],2:[function(dv,dw,du){},{\"./utils/common\":3,\"./utils/strings\":4,\"./zlib/constants\":6,\"./zlib/gzheader\":9,\"./zlib/inflate.js\":11,\"./zlib/messages\":13,\"./zlib/zstream\":15}],3:[function(dv,dw,du){var dz=(typeof Uint8Array!==\"undefined\")&&(typeof Uint16Array!==\"undefined\")&&(typeof Int32Array!==\"undefined\");du.assign=function(dD){var dA=Array.prototype.slice.call(arguments,1);while(dA.length){var dB=dA.shift();if(!dB){continue}if(typeof(dB)!==\"object\"){throw new TypeError(dB+\"must be non-object\")}for(var dC in dB){if(dB.hasOwnProperty(dC)){dD[dC]=dB[dC]}}}return dD};du.shrinkBuf=function(dA,dB){if(dA.length===dB){return dA}if(dA.subarray){return dA.subarray(0,dB)}dA.length=dB;return dA};var dx={arraySet:function(dB,dD,dF,dA,dE){if(dD.subarray&&dB.subarray){dB.set(dD.subarray(dF,dF+dA),dE);return}for(var dC=0;dC<dA;dC++){dB[dE+dC]=dD[dF+dC]}},flattenChunks:function(dG){var dE,dC,dB,dF,dD,dA;dB=0;for(dE=0,dC=dG.length;dE<dC;dE++){dB+=dG[dE].length}dA=new Uint8Array(dB);dF=0;for(dE=0,dC=dG.length;dE<dC;dE++){dD=dG[dE];dA.set(dD,dF);dF+=dD.length}return dA}};var dy={arraySet:function(dB,dD,dF,dA,dE){for(var dC=0;dC<dA;dC++){dB[dE+dC]=dD[dF+dC]}},flattenChunks:function(dA){return[].concat.apply([],dA)}};du.setTyped=function(dA){if(dA&&(dp.useBinary||dj.btoa)){du.Buf8=Uint8Array;du.Buf16=Uint16Array;du.Buf32=Int32Array;du.assign(du,dx)}else{du.Buf8=Array;du.Buf16=Array;du.Buf32=Array;du.assign(du,dy)}};du.setTyped(dz)},{}],4:[function(dw,du,dx){var dD=dw(\"./common\");var dB=true;var dz=true;try{String.fromCharCode.apply(null,[0])}catch(dC){dB=false}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(dC){dz=false}var dv=new dD.Buf8(256);for(var dy=0;dy<256;dy++){dv[dy]=(dy>=252?6:dy>=248?5:dy>=240?4:dy>=224?3:dy>=192?2:1)}dv[254]=dv[254]=1;dx.string2buf=function(dK){var dE,dL,dG,dH,dF,dJ=dK.length,dI=0;for(dH=0;dH<dJ;dH++){dL=dK.charCodeAt(dH);if((dL&64512)===55296&&(dH+1<dJ)){dG=dK.charCodeAt(dH+1);if((dG&64512)===56320){dL=65536+((dL-55296)<<10)+(dG-56320);dH++}}dI+=dL<128?1:dL<2048?2:dL<65536?3:4}dE=new dD.Buf8(dI);for(dF=0,dH=0;dF<dI;dH++){dL=dK.charCodeAt(dH);if((dL&64512)===55296&&(dH+1<dJ)){dG=dK.charCodeAt(dH+1);if((dG&64512)===56320){dL=65536+((dL-55296)<<10)+(dG-56320);dH++}}if(dL<128){dE[dF++]=dL}else{if(dL<2048){dE[dF++]=192|(dL>>>6);dE[dF++]=128|(dL&63)}else{if(dL<65536){dE[dF++]=224|(dL>>>12);dE[dF++]=128|(dL>>>6&63);dE[dF++]=128|(dL&63)}else{dE[dF++]=240|(dL>>>18);dE[dF++]=128|(dL>>>12&63);dE[dF++]=128|(dL>>>6&63);dE[dF++]=128|(dL&63)}}}}return dE};function dA(dG,dF){if(dF<65537){if((dG.subarray&&dz)||(!dG.subarray&&dB)){return String.fromCharCode.apply(null,dD.shrinkBuf(dG,dF))}}var dE=\"\";for(var dH=0;dH<dF;dH++){dE+=String.fromCharCode(dG[dH])}return dE}dx.buf2binstring=function(dE){return dA(dE,dE.length)};dx.binstring2buf=function(dH){var dF=new dD.Buf8(dH.length);for(var dG=0,dE=dF.length;dG<dE;dG++){dF[dG]=dH.charCodeAt(dG)}return dF};dx.buf2string=function(dJ,dG){var dK,dI,dL,dH;var dF=dG||dJ.length;var dE=new Array(dF*2);for(dI=0,dK=0;dK<dF;){dL=dJ[dK++];if(dL<128){dE[dI++]=dL;continue}dH=dv[dL];if(dH>4){dE[dI++]=65533;dK+=dH-1;continue}dL&=dH===2?31:dH===3?15:7;while(dH>1&&dK<dF){dL=(dL<<6)|(dJ[dK++]&63);dH--}if(dH>1){dE[dI++]=65533;continue}if(dL<65536){dE[dI++]=dL}else{dL-=65536;dE[dI++]=55296|((dL>>10)&1023);dE[dI++]=56320|(dL&1023)}}return dA(dE,dI)};dx.utf8border=function(dF,dE){var dG;dE=dE||dF.length;if(dE>dF.length){dE=dF.length}dG=dE-1;while(dG>=0&&(dF[dG]&192)===128){dG--}if(dG<0){return dE}if(dG===0){return dE}return(dG+dv[dF[dG]]>dE)?dG:dE}},{\"./common\":3}],5:[function(dv,dw,du){},{}],6:[function(dv,dw,du){dw.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],7:[function(dv,dw,du){},{}],8:[function(ez,eN,d4){var eb=ez(\"../utils/common\");var eL=ez(\"./trees\");var d3=ez(\"./adler32\");var ei=ez(\"./crc32\");var dY=ez(\"./messages\");var d6=0;var eh=1;var eD=3;var dE=4;var ec=5;var dK=0;var dP=1;var eA=-2;var dO=-3;var dy=-5;var dA=-1;var d7=1;var dW=2;var dS=3;var dL=4;var eE=0;var d2=2;var eg=8;var eF=9;var d9=15;var dG=8;var ev=29;var eJ=256;var eM=eJ+1+ev;var dV=30;var eq=19;var ex=2*eM+1;var ea=15;var d0=3;var eB=258;var dw=(eB+d0+1);var dC=32;var ee=42;var dI=69;var ej=73;var ew=91;var dJ=103;var eQ=113;var dU=666;var ey=1;var dM=2;var ed=3;var dx=4;var eC=3;function er(eR,eS){eR.msg=dY[eS];return eS}function d8(eR){return((eR)<<1)-((eR)>4?9:0)}function eI(eS){var eR=eS.length;while(--eR>=0){eS[eR]=0}}function dz(eS){var eT=eS.state;var eR=eT.pending;if(eR>eS.avail_out){eR=eS.avail_out}if(eR===0){return}eb.arraySet(eS.output,eT.pending_buf,eT.pending_out,eR,eS.next_out);eS.next_out+=eR;eT.pending_out+=eR;eS.total_out+=eR;eS.avail_out-=eR;eT.pending-=eR;if(eT.pending===0){eT.pending_out=0}}function dD(eR,eS){eL._tr_flush_block(eR,(eR.block_start>=0?eR.block_start:-1),eR.strstart-eR.block_start,eS);eR.block_start=eR.strstart;dz(eR.strm)}function dv(eS,eR){eS.pending_buf[eS.pending++]=eR}function dT(eS,eR){eS.pending_buf[eS.pending++]=(eR>>>8)&255;eS.pending_buf[eS.pending++]=eR&255}function dX(eS,eT,eV,eU){var eR=eS.avail_in;if(eR>eU){eR=eU}if(eR===0){return 0}eS.avail_in-=eR;eb.arraySet(eT,eS.input,eS.next_in,eR,eV);if(eS.state.wrap===1){eS.adler=d3(eS.adler,eT,eR,eV)}else{if(eS.state.wrap===2){eS.adler=ei(eS.adler,eT,eR,eV)}}eS.next_in+=eR;eS.total_in+=eR;return eR}function eH(e4,eV){var eY=e4.max_chain_length;var e5=e4.strstart;var eW;var eX;var eR=e4.prev_length;var eS=e4.nice_match;var eU=(e4.strstart>(e4.w_size-dw))?e4.strstart-(e4.w_size-dw):0;var e2=e4.window;var eZ=e4.w_mask;var eT=e4.prev;var e1=e4.strstart+eB;var e3=e2[e5+eR-1];var e0=e2[e5+eR];if(e4.prev_length>=e4.good_match){eY>>=2}if(eS>e4.lookahead){eS=e4.lookahead}do{eW=eV;if(e2[eW+eR]!==e0||e2[eW+eR-1]!==e3||e2[eW]!==e2[e5]||e2[++eW]!==e2[e5+1]){continue}e5+=2;eW++;do{}while(e2[++e5]===e2[++eW]&&e2[++e5]===e2[++eW]&&e2[++e5]===e2[++eW]&&e2[++e5]===e2[++eW]&&e2[++e5]===e2[++eW]&&e2[++e5]===e2[++eW]&&e2[++e5]===e2[++eW]&&e2[++e5]===e2[++eW]&&e5<e1);eX=eB-(e1-e5);e5=e1-eB;if(eX>eR){e4.match_start=eV;eR=eX;if(eX>=eS){break}e3=e2[e5+eR-1];e0=e2[e5+eR]}}while((eV=eT[eV&eZ])>eU&&--eY!==0);if(eR<=e4.lookahead){return eR}return e4.lookahead}function eu(eT){var eX=eT.w_size;var eU,eW,eR,eS,eV;do{eS=eT.window_size-eT.lookahead-eT.strstart;if(eT.strstart>=eX+(eX-dw)){eb.arraySet(eT.window,eT.window,eX,eX,0);eT.match_start-=eX;eT.strstart-=eX;eT.block_start-=eX;eW=eT.hash_size;eU=eW;do{eR=eT.head[--eU];eT.head[eU]=(eR>=eX?eR-eX:0)}while(--eW);eW=eX;eU=eW;do{eR=eT.prev[--eU];eT.prev[eU]=(eR>=eX?eR-eX:0)}while(--eW);eS+=eX}if(eT.strm.avail_in===0){break}eW=dX(eT.strm,eT.window,eT.strstart+eT.lookahead,eS);eT.lookahead+=eW;if(eT.lookahead+eT.insert>=d0){eV=eT.strstart-eT.insert;eT.ins_h=eT.window[eV];eT.ins_h=((eT.ins_h<<eT.hash_shift)^eT.window[eV+1])&eT.hash_mask;while(eT.insert){eT.ins_h=((eT.ins_h<<eT.hash_shift)^eT.window[eV+d0-1])&eT.hash_mask;eT.prev[eV&eT.w_mask]=eT.head[eT.ins_h];eT.head[eT.ins_h]=eV;eV++;eT.insert--;if(eT.lookahead+eT.insert<d0){break}}}}while(eT.lookahead<dw&&eT.strm.avail_in!==0)}function d5(eU,eR){var eT=65535;if(eT>eU.pending_buf_size-5){eT=eU.pending_buf_size-5}for(;;){if(eU.lookahead<=1){eu(eU);if(eU.lookahead===0&&eR===d6){return ey}if(eU.lookahead===0){break}}eU.strstart+=eU.lookahead;eU.lookahead=0;var eS=eU.block_start+eT;if(eU.strstart===0||eU.strstart>=eS){eU.lookahead=eU.strstart-eS;eU.strstart=eS;dD(eU,false);if(eU.strm.avail_out===0){return ey}}if(eU.strstart-eU.block_start>=(eU.w_size-dw)){dD(eU,false);if(eU.strm.avail_out===0){return ey}}}eU.insert=0;if(eR===dE){dD(eU,true);if(eU.strm.avail_out===0){return ed}return dx}if(eU.strstart>eU.block_start){dD(eU,false);if(eU.strm.avail_out===0){return ey}}return ey}function dF(eT,eR){var eU;var eS;for(;;){if(eT.lookahead<dw){eu(eT);if(eT.lookahead<dw&&eR===d6){return ey}if(eT.lookahead===0){break}}eU=0;if(eT.lookahead>=d0){eT.ins_h=((eT.ins_h<<eT.hash_shift)^eT.window[eT.strstart+d0-1])&eT.hash_mask;eU=eT.prev[eT.strstart&eT.w_mask]=eT.head[eT.ins_h];eT.head[eT.ins_h]=eT.strstart}if(eU!==0&&((eT.strstart-eU)<=(eT.w_size-dw))){eT.match_length=eH(eT,eU)}if(eT.match_length>=d0){eS=eL._tr_tally(eT,eT.strstart-eT.match_start,eT.match_length-d0);eT.lookahead-=eT.match_length;if(eT.match_length<=eT.max_lazy_match&&eT.lookahead>=d0){eT.match_length--;do{eT.strstart++;eT.ins_h=((eT.ins_h<<eT.hash_shift)^eT.window[eT.strstart+d0-1])&eT.hash_mask;eU=eT.prev[eT.strstart&eT.w_mask]=eT.head[eT.ins_h];eT.head[eT.ins_h]=eT.strstart}while(--eT.match_length!==0);eT.strstart++}else{eT.strstart+=eT.match_length;eT.match_length=0;eT.ins_h=eT.window[eT.strstart];eT.ins_h=((eT.ins_h<<eT.hash_shift)^eT.window[eT.strstart+1])&eT.hash_mask}}else{eS=eL._tr_tally(eT,0,eT.window[eT.strstart]);eT.lookahead--;eT.strstart++}if(eS){dD(eT,false);if(eT.strm.avail_out===0){return ey}}}eT.insert=((eT.strstart<(d0-1))?eT.strstart:d0-1);if(eR===dE){dD(eT,true);if(eT.strm.avail_out===0){return ed}return dx}if(eT.last_lit){dD(eT,false);if(eT.strm.avail_out===0){return ey}}return dM}function es(eU,eS){var eV;var eT;var eR;for(;;){if(eU.lookahead<dw){eu(eU);if(eU.lookahead<dw&&eS===d6){return ey}if(eU.lookahead===0){break}}eV=0;if(eU.lookahead>=d0){eU.ins_h=((eU.ins_h<<eU.hash_shift)^eU.window[eU.strstart+d0-1])&eU.hash_mask;eV=eU.prev[eU.strstart&eU.w_mask]=eU.head[eU.ins_h];eU.head[eU.ins_h]=eU.strstart}eU.prev_length=eU.match_length;eU.prev_match=eU.match_start;eU.match_length=d0-1;if(eV!==0&&eU.prev_length<eU.max_lazy_match&&eU.strstart-eV<=(eU.w_size-dw)){eU.match_length=eH(eU,eV);if(eU.match_length<=5&&(eU.strategy===d7||(eU.match_length===d0&&eU.strstart-eU.match_start>4096))){eU.match_length=d0-1}}if(eU.prev_length>=d0&&eU.match_length<=eU.prev_length){eR=eU.strstart+eU.lookahead-d0;eT=eL._tr_tally(eU,eU.strstart-1-eU.prev_match,eU.prev_length-d0);eU.lookahead-=eU.prev_length-1;eU.prev_length-=2;do{if(++eU.strstart<=eR){eU.ins_h=((eU.ins_h<<eU.hash_shift)^eU.window[eU.strstart+d0-1])&eU.hash_mask;eV=eU.prev[eU.strstart&eU.w_mask]=eU.head[eU.ins_h];eU.head[eU.ins_h]=eU.strstart}}while(--eU.prev_length!==0);eU.match_available=0;eU.match_length=d0-1;eU.strstart++;if(eT){dD(eU,false);if(eU.strm.avail_out===0){return ey}}}else{if(eU.match_available){eT=eL._tr_tally(eU,0,eU.window[eU.strstart-1]);if(eT){dD(eU,false)}eU.strstart++;eU.lookahead--;if(eU.strm.avail_out===0){return ey}}else{eU.match_available=1;eU.strstart++;eU.lookahead--}}}if(eU.match_available){eT=eL._tr_tally(eU,0,eU.window[eU.strstart-1]);eU.match_available=0}eU.insert=eU.strstart<d0-1?eU.strstart:d0-1;if(eS===dE){dD(eU,true);if(eU.strm.avail_out===0){return ed}return dx}if(eU.last_lit){dD(eU,false);if(eU.strm.avail_out===0){return ey}}return dM}function eo(eV,eS){var eU;var eW;var eT,eR;var eX=eV.window;for(;;){if(eV.lookahead<=eB){eu(eV);if(eV.lookahead<=eB&&eS===d6){return ey}if(eV.lookahead===0){break}}eV.match_length=0;if(eV.lookahead>=d0&&eV.strstart>0){eT=eV.strstart-1;eW=eX[eT];if(eW===eX[++eT]&&eW===eX[++eT]&&eW===eX[++eT]){eR=eV.strstart+eB;do{}while(eW===eX[++eT]&&eW===eX[++eT]&&eW===eX[++eT]&&eW===eX[++eT]&&eW===eX[++eT]&&eW===eX[++eT]&&eW===eX[++eT]&&eW===eX[++eT]&&eT<eR);eV.match_length=eB-(eR-eT);if(eV.match_length>eV.lookahead){eV.match_length=eV.lookahead}}}if(eV.match_length>=d0){eU=eL._tr_tally(eV,1,eV.match_length-d0);eV.lookahead-=eV.match_length;eV.strstart+=eV.match_length;eV.match_length=0}else{eU=eL._tr_tally(eV,0,eV.window[eV.strstart]);eV.lookahead--;eV.strstart++}if(eU){dD(eV,false);if(eV.strm.avail_out===0){return ey}}}eV.insert=0;if(eS===dE){dD(eV,true);if(eV.strm.avail_out===0){return ed}return dx}if(eV.last_lit){dD(eV,false);if(eV.strm.avail_out===0){return ey}}return dM}function ep(eT,eR){var eS;for(;;){if(eT.lookahead===0){eu(eT);if(eT.lookahead===0){if(eR===d6){return ey}break}}eT.match_length=0;eS=eL._tr_tally(eT,0,eT.window[eT.strstart]);eT.lookahead--;eT.strstart++;if(eS){dD(eT,false);if(eT.strm.avail_out===0){return ey}}}eT.insert=0;if(eR===dE){dD(eT,true);if(eT.strm.avail_out===0){return ed}return dx}if(eT.last_lit){dD(eT,false);if(eT.strm.avail_out===0){return ey}}return dM}var em=function(eR,eV,eS,eU,eT){this.good_length=eR;this.max_lazy=eV;this.nice_length=eS;this.max_chain=eU;this.func=eT};var el;el=[new em(0,0,0,0,d5),new em(4,4,8,4,dF),new em(4,5,16,8,dF),new em(4,6,32,32,dF),new em(4,4,16,16,es),new em(8,16,32,32,es),new em(8,16,128,128,es),new em(8,32,128,256,es),new em(32,128,258,1024,es),new em(32,258,258,4096,es)];function d1(eR){eR.window_size=2*eR.w_size;eI(eR.head);eR.max_lazy_match=el[eR.level].max_lazy;eR.good_match=el[eR.level].good_length;eR.nice_match=el[eR.level].nice_length;eR.max_chain_length=el[eR.level].max_chain;eR.strstart=0;eR.block_start=0;eR.lookahead=0;eR.insert=0;eR.match_length=eR.prev_length=d0-1;eR.match_available=0;eR.ins_h=0}function du(){this.strm=null;this.status=0;this.pending_buf=null;this.pending_buf_size=0;this.pending_out=0;this.pending=0;this.wrap=0;this.gzhead=null;this.gzindex=0;this.method=eg;this.last_flush=-1;this.w_size=0;this.w_bits=0;this.w_mask=0;this.window=null;this.window_size=0;this.prev=null;this.head=null;this.ins_h=0;this.hash_size=0;this.hash_bits=0;this.hash_mask=0;this.hash_shift=0;this.block_start=0;this.match_length=0;this.prev_match=0;this.match_available=0;this.strstart=0;this.match_start=0;this.lookahead=0;this.prev_length=0;this.max_chain_length=0;this.max_lazy_match=0;this.level=0;this.strategy=0;this.good_match=0;this.nice_match=0;this.dyn_ltree=new eb.Buf16(ex*2);this.dyn_dtree=new eb.Buf16((2*dV+1)*2);this.bl_tree=new eb.Buf16((2*eq+1)*2);eI(this.dyn_ltree);eI(this.dyn_dtree);eI(this.bl_tree);this.l_desc=null;this.d_desc=null;this.bl_desc=null;this.bl_count=new eb.Buf16(ea+1);this.heap=new eb.Buf16(2*eM+1);eI(this.heap);this.heap_len=0;this.heap_max=0;this.depth=new eb.Buf16(2*eM+1);eI(this.depth);this.l_buf=0;this.lit_bufsize=0;this.last_lit=0;this.d_buf=0;this.opt_len=0;this.static_len=0;this.matches=0;this.insert=0;this.bi_buf=0;this.bi_valid=0}function et(eR){var eS;if(!eR||!eR.state){return er(eR,eA)}eR.total_in=eR.total_out=0;eR.data_type=d2;eS=eR.state;eS.pending=0;eS.pending_out=0;if(eS.wrap<0){eS.wrap=-eS.wrap}eS.status=(eS.wrap?ee:eQ);eR.adler=(eS.wrap===2)?0:1;eS.last_flush=d6;eL._tr_init(eS);return dK}function dQ(eR){var eS=et(eR);if(eS===dK){d1(eR.state)}return eS}function eP(eR,eS){if(!eR||!eR.state){return eA}if(eR.state.wrap!==2){return eA}eR.state.gzhead=eS;return dK}function dZ(eR,eY,eX,eU,eW,eV){if(!eR){return eA}var eT=1;if(eY===dA){eY=6}if(eU<0){eT=0;eU=-eU}else{if(eU>15){eT=2;eU-=16}}if(eW<1||eW>eF||eX!==eg||eU<8||eU>15||eY<0||eY>9||eV<0||eV>dL){return er(eR,eA)}if(eU===8){eU=9}var eS=new du();eR.state=eS;eS.strm=eR;eS.wrap=eT;eS.gzhead=null;eS.w_bits=eU;eS.w_size=1<<eS.w_bits;eS.w_mask=eS.w_size-1;eS.hash_bits=eW+7;eS.hash_size=1<<eS.hash_bits;eS.hash_mask=eS.hash_size-1;eS.hash_shift=~~((eS.hash_bits+d0-1)/d0);eS.window=new eb.Buf8(eS.w_size*2);eS.head=new eb.Buf16(eS.hash_size);eS.prev=new eb.Buf16(eS.w_size);eS.lit_bufsize=1<<(eW+6);eS.pending_buf_size=eS.lit_bufsize*4;eS.pending_buf=new eb.Buf8(eS.pending_buf_size);eS.d_buf=eS.lit_bufsize>>1;eS.l_buf=(1+2)*eS.lit_bufsize;eS.level=eY;eS.strategy=eV;eS.method=eX;return dQ(eR)}function ef(eR,eS){return dZ(eR,eS,eg,d9,dG,eE)}function dH(eW,eX,eY){var eV,eZ,eU,eR;var eT,eS;di();if(!eW||!eW.state||eX>ec||eX<0){return eW?er(eW,eA):eA}eZ=eW.state;if(!eW.output||(!eW.input&&eW.avail_in!==0)||(eZ.status===dU&&eX!==dE)){return er(eW,(eW.avail_out===0)?dy:eA)}eZ.strm=eW;eV=eZ.last_flush;eZ.last_flush=eX;if(eZ.status===ee){dR(eZ)}if(dn()){return\"defer\"}if(eZ.status===dI){eK(eZ,eW)}if(dn()){return\"defer\"}if(eZ.status===ej){dB(eZ,eW)}if(dn()){return\"defer\"}if(eZ.status===ew){ek(eZ,eW)}if(dn()){return\"defer\"}if(eZ.status===dJ){eO(eZ,eW)}if(dn()){return\"defer\"}if(!eZ.flushedPending){eR=en(eZ,eW,eX);if(typeof eR!==\"undefined\"){eZ.flushedPending=null;return eR}}if(eX!==dE){return dK}if(eZ.wrap<=0){return dP}if(dn()){return\"defer\"}eZ.flushedPending=null;dN(eZ);dz(eZ,eW);if(eZ.wrap>0){eZ.wrap=-eZ.wrap}return eZ.pending!==0?dK:dP}function dR(eS,eR){if(eS.wrap===2){eR.adler=0;dv(eS,31);dv(eS,139);dv(eS,8);if(!eS.gzhead){dv(eS,0);dv(eS,0);dv(eS,0);dv(eS,0);dv(eS,0);dv(eS,eS.level===9?2:(eS.strategy>=dW||eS.level<2?4:0));dv(eS,eC);eS.status=eQ}else{dv(eS,(eS.gzhead.text?1:0)+(eS.gzhead.hcrc?2:0)+(!eS.gzhead.extra?0:4)+(!eS.gzhead.name?0:8)+(!eS.gzhead.comment?0:16));dv(eS,eS.gzhead.time&255);dv(eS,(eS.gzhead.time>>8)&255);dv(eS,(eS.gzhead.time>>16)&255);dv(eS,(eS.gzhead.time>>24)&255);dv(eS,eS.level===9?2:(eS.strategy>=dW||eS.level<2?4:0));dv(eS,eS.gzhead.os&255);if(eS.gzhead.extra&&eS.gzhead.extra.length){dv(eS,eS.gzhead.extra.length&255);dv(eS,(eS.gzhead.extra.length>>8)&255)}if(eS.gzhead.hcrc){eR.adler=ei(eR.adler,eS.pending_buf,eS.pending,0)}eS.gzindex=0;eS.status=dI}}else{var eU=(eg+((eS.w_bits-8)<<4))<<8;var eT=-1;if(eS.strategy>=dW||eS.level<2){eT=0}else{if(eS.level<6){eT=1}else{if(eS.level===6){eT=2}else{eT=3}}}eU|=(eT<<6);if(eS.strstart!==0){eU|=dC}eU+=31-(eU%31);eS.status=eQ;dT(eS,eU);if(eS.strstart!==0){dT(eS,eR.adler>>>16);dT(eS,eR.adler&65535)}eR.adler=1}}function eK(eS,eR){if(eS.gzhead.extra){beg=eS.pending;while(eS.gzindex<(eS.gzhead.extra.length&65535)){if(eS.pending===eS.pending_buf_size){if(eS.gzhead.hcrc&&eS.pending>beg){eR.adler=ei(eR.adler,eS.pending_buf,eS.pending-beg,beg)}dz(eR);beg=eS.pending;if(eS.pending===eS.pending_buf_size){break}}dv(eS,eS.gzhead.extra[eS.gzindex]&255);eS.gzindex++}if(eS.gzhead.hcrc&&eS.pending>beg){eR.adler=ei(eR.adler,eS.pending_buf,eS.pending-beg,beg)}if(eS.gzindex===eS.gzhead.extra.length){eS.gzindex=0;eS.status=ej}}else{eS.status=ej}}function dB(eS,eR){if(eS.gzhead.name){beg=eS.pending;do{if(eS.pending===eS.pending_buf_size){if(eS.gzhead.hcrc&&eS.pending>beg){eR.adler=ei(eR.adler,eS.pending_buf,eS.pending-beg,beg)}dz(eR);beg=eS.pending;if(eS.pending===eS.pending_buf_size){val=1;break}}if(eS.gzindex<eS.gzhead.name.length){val=eS.gzhead.name.charCodeAt(eS.gzindex++)&255}else{val=0}dv(eS,val)}while(val!==0);if(eS.gzhead.hcrc&&eS.pending>beg){eR.adler=ei(eR.adler,eS.pending_buf,eS.pending-beg,beg)}if(val===0){eS.gzindex=0;eS.status=ew}}else{eS.status=ew}}function ek(eS,eR){if(eS.gzhead.comment){beg=eS.pending;do{if(eS.pending===eS.pending_buf_size){if(eS.gzhead.hcrc&&eS.pending>beg){eR.adler=ei(eR.adler,eS.pending_buf,eS.pending-beg,beg)}dz(eR);beg=eS.pending;if(eS.pending===eS.pending_buf_size){val=1;break}}if(eS.gzindex<eS.gzhead.comment.length){val=eS.gzhead.comment.charCodeAt(eS.gzindex++)&255}else{val=0}dv(eS,val)}while(val!==0);if(eS.gzhead.hcrc&&eS.pending>beg){eR.adler=ei(eR.adler,eS.pending_buf,eS.pending-beg,beg)}if(val===0){eS.status=dJ}}else{eS.status=dJ}}function eO(eS,eR){if(eS.gzhead.hcrc){if(eS.pending+2>eS.pending_buf_size){dz(eR)}if(eS.pending+2<=eS.pending_buf_size){dv(eS,eR.adler&255);dv(eS,(eR.adler>>8)&255);eR.adler=0;eS.status=eQ}}else{eS.status=eQ}}function en(eT,eS,eR){var eU=eT.last_flush;eT.flushedPending=true;if(eT.pending!==0){dz(eS);if(eS.avail_out===0){eT.last_flush=-1;return dK}}else{if(eS.avail_in===0&&d8(eR)<=d8(eU)&&eR!==dE){return er(eS,dy)}}if(eT.status===dU&&eS.avail_in!==0){return er(eS,dy)}if(eS.avail_in!==0||eT.lookahead!==0||(eR!==d6&&eT.status!==dU)){var eV=(eT.strategy===dW)?ep(eT,eR):(eT.strategy===dS?eo(eT,eR):el[eT.level].func(eT,eR));if(eV===ed||eV===dx){eT.status=dU}if(eV===ey||eV===ed){if(eS.avail_out===0){eT.last_flush=-1}return dK}if(eV===dM){if(eR===eh){eL._tr_align(eT)}else{if(eR!==ec){eL._tr_stored_block(eT,0,0,false);if(eR===eD){eI(eT.head);if(eT.lookahead===0){eT.strstart=0;eT.block_start=0;eT.insert=0}}}}dz(eS);if(eS.avail_out===0){eT.last_flush=-1;return dK}}}}function dN(eS,eR){if(eS.wrap===2){dv(eS,eR.adler&255);dv(eS,(eR.adler>>8)&255);dv(eS,(eR.adler>>16)&255);dv(eS,(eR.adler>>24)&255);dv(eS,eR.total_in&255);dv(eS,(eR.total_in>>8)&255);dv(eS,(eR.total_in>>16)&255);dv(eS,(eR.total_in>>24)&255)}else{dT(eS,eR.adler>>>16);dT(eS,eR.adler&65535)}}function eG(eS){var eR;if(!eS||!eS.state){return eA}eR=eS.state.status;if(eR!==ee&&eR!==dI&&eR!==ej&&eR!==ew&&eR!==dJ&&eR!==eQ&&eR!==dU){return er(eS,eA)}eS.state=null;return eR===eQ?er(eS,dO):dK}d4.deflateInit=ef;d4.deflateInit2=dZ;d4.deflateReset=dQ;d4.deflateResetKeep=et;d4.deflateSetHeader=eP;d4.deflate=dH;d4.deflateEnd=eG;d4.deflateInfo=\"pako deflate (from Nodeca project)\"},{\"../utils/common\":3,\"./adler32\":5,\"./crc32\":7,\"./messages\":13,\"./trees\":14}],9:[function(dv,dw,du){function dx(){this.text=0;this.time=0;this.xflags=0;this.os=0;this.extra=null;this.extra_len=0;this.name=\"\";this.comment=\"\";this.hcrc=0;this.done=false}dw.exports=dx},{}],10:[function(dv,dw,du){},{}],11:[function(dv,dw,du){},{\"../utils/common\":3,\"./adler32\":5,\"./crc32\":7,\"./inffast\":10,\"./inftrees\":12}],12:[function(dx,dv,dy){var dG=dx(\"../utils/common\");var dF=15;var dC=852;var dB=592;var dE=0;var dA=1;var dw=2;var dD=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0];var dH=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78];var dz=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0];var du=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]},{\"../utils/common\":3}],13:[function(dv,dw,du){},{}],14:[function(dC,dA,er){var eB=dC(\"../utils/common\");var d9=4;var dK=0;var dU=1;var dV=2;function du(eD){var eC=eD.length;while(--eC>=0){eD[eC]=0}}var ed=0;var et=1;var d2=2;var eA=3;var dW=258;var dH=29;var dx=256;var dy=dx+1+dH;var dv=30;var dN=19;var dz=2*dy+1;var ex=15;var dQ=16;var em=7;var dw=256;var dZ=16;var dY=17;var d3=18;var dB=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0];var dO=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];var dT=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7];var ea=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];var eb=512;var d5=new Array((dy+2)*2);du(d5);var eh=new Array(dv*2);du(eh);var en=new Array(eb);du(en);var dR=new Array(dW-eA+1);du(dR);var d4=new Array(dH);du(d4);var ew=new Array(dv);du(ew);var ek=function(eF,eE,eD,eC,eG){this.static_tree=eF;this.extra_bits=eE;this.extra_base=eD;this.elems=eC;this.max_length=eG;this.has_stree=eF&&eF.length};var ep;var eg;var dP;var ez=function(eD,eC){this.dyn_tree=eD;this.max_code=0;this.stat_desc=eC};function ei(eC){return eC<256?en[eC]:en[256+(eC>>>7)]}function dF(eD,eC){eD.pending_buf[eD.pending++]=(eC)&255;eD.pending_buf[eD.pending++]=(eC>>>8)&255}function eo(eC,eE,eD){if(eC.bi_valid>(dQ-eD)){eC.bi_buf|=(eE<<eC.bi_valid)&65535;dF(eC,eC.bi_buf);eC.bi_buf=eE>>(dQ-eC.bi_valid);eC.bi_valid+=eD-dQ}else{eC.bi_buf|=(eE<<eC.bi_valid)&65535;eC.bi_valid+=eD}}function es(eD,eE,eC){eo(eD,eC[eE*2],eC[eE*2+1])}function dS(eE,eC){var eD=0;do{eD|=eE&1;eE>>>=1;eD<<=1}while(--eC>0);return eD>>>1}function dM(eC){if(eC.bi_valid===16){dF(eC,eC.bi_buf);eC.bi_buf=0;eC.bi_valid=0}else{if(eC.bi_valid>=8){eC.pending_buf[eC.pending++]=eC.bi_buf&255;eC.bi_buf>>=8;eC.bi_valid-=8}}}function dE(eQ,eL){var eR=eL.dyn_tree;var eM=eL.max_code;var eP=eL.stat_desc.static_tree;var eE=eL.stat_desc.has_stree;var eG=eL.stat_desc.extra_bits;var eC=eL.stat_desc.extra_base;var eO=eL.stat_desc.max_length;var eJ;var eD,eF;var eN;var eI;var eK;var eH=0;for(eN=0;eN<=ex;eN++){eQ.bl_count[eN]=0}eR[eQ.heap[eQ.heap_max]*2+1]=0;for(eJ=eQ.heap_max+1;eJ<dz;eJ++){eD=eQ.heap[eJ];eN=eR[eR[eD*2+1]*2+1]+1;if(eN>eO){eN=eO;eH++}eR[eD*2+1]=eN;if(eD>eM){continue}eQ.bl_count[eN]++;eI=0;if(eD>=eC){eI=eG[eD-eC]}eK=eR[eD*2];eQ.opt_len+=eK*(eN+eI);if(eE){eQ.static_len+=eK*(eP[eD*2+1]+eI)}}if(eH===0){return}do{eN=eO-1;while(eQ.bl_count[eN]===0){eN--}eQ.bl_count[eN]--;eQ.bl_count[eN+1]+=2;eQ.bl_count[eO]--;eH-=2}while(eH>0);for(eN=eO;eN!==0;eN--){eD=eQ.bl_count[eN];while(eD!==0){eF=eQ.heap[--eJ];if(eF>eM){continue}if(eR[eF*2+1]!==eN){eQ.opt_len+=(eN-eR[eF*2+1])*eR[eF*2];eR[eF*2+1]=eN}eD--}}}function eq(eD,eJ,eE){var eG=new Array(ex+1);var eF=0;var eH;var eI;for(eH=1;eH<=ex;eH++){eG[eH]=eF=(eF+eE[eH-1])<<1}for(eI=0;eI<=eJ;eI++){var eC=eD[eI*2+1];if(eC===0){continue}eD[eI*2]=dS(eG[eC]++,eC)}}function ec(){var eH;var eF;var eE;var eD;var eG;var eC=new Array(ex+1);eE=0;for(eD=0;eD<dH-1;eD++){d4[eD]=eE;for(eH=0;eH<(1<<dB[eD]);eH++){dR[eE++]=eD}}dR[eE-1]=eD;eG=0;for(eD=0;eD<16;eD++){ew[eD]=eG;for(eH=0;eH<(1<<dO[eD]);eH++){en[eG++]=eD}}eG>>=7;for(;eD<dv;eD++){ew[eD]=eG<<7;for(eH=0;eH<(1<<(dO[eD]-7));eH++){en[256+eG++]=eD}}for(eF=0;eF<=ex;eF++){eC[eF]=0}eH=0;while(eH<=143){d5[eH*2+1]=8;eH++;eC[8]++}while(eH<=255){d5[eH*2+1]=9;eH++;eC[9]++}while(eH<=279){d5[eH*2+1]=7;eH++;eC[7]++}while(eH<=287){d5[eH*2+1]=8;eH++;eC[8]++}eq(d5,dy+1,eC);for(eH=0;eH<dv;eH++){eh[eH*2+1]=5;eh[eH*2]=dS(eH,5)}ep=new ek(d5,dB,dx+1,dy,ex);eg=new ek(eh,dO,0,dv,ex);dP=new ek(new Array(0),dT,0,dN,em)}function d1(eC){var eD;for(eD=0;eD<dy;eD++){eC.dyn_ltree[eD*2]=0}for(eD=0;eD<dv;eD++){eC.dyn_dtree[eD*2]=0}for(eD=0;eD<dN;eD++){eC.bl_tree[eD*2]=0}eC.dyn_ltree[dw*2]=1;eC.opt_len=eC.static_len=0;eC.last_lit=eC.matches=0}function dD(eC){if(eC.bi_valid>8){dF(eC,eC.bi_buf)}else{if(eC.bi_valid>0){eC.pending_buf[eC.pending++]=eC.bi_buf}}eC.bi_buf=0;eC.bi_valid=0}function dJ(eE,eD,eC,eF){dD(eE);if(eF){dF(eE,eC);dF(eE,~eC)}eB.arraySet(eE.pending_buf,eE.window,eD,eC,eE.pending);eE.pending+=eC}function ef(eD,eH,eC,eG){var eF=eH*2;var eE=eC*2;return(eD[eF]<eD[eE]||(eD[eF]===eD[eE]&&eG[eH]<=eG[eC]))}function ey(eG,eC,eE){var eD=eG.heap[eE];var eF=eE<<1;while(eF<=eG.heap_len){if(eF<eG.heap_len&&ef(eC,eG.heap[eF+1],eG.heap[eF],eG.depth)){eF++}if(ef(eC,eD,eG.heap[eF],eG.depth)){break}eG.heap[eE]=eG.heap[eF];eE=eF;eF<<=1}eG.heap[eE]=eD}function ev(eD,eJ,eG){var eI;var eF;var eH=0;var eE;var eC;if(eD.last_lit!==0){do{eI=(eD.pending_buf[eD.d_buf+eH*2]<<8)|(eD.pending_buf[eD.d_buf+eH*2+1]);eF=eD.pending_buf[eD.l_buf+eH];eH++;if(eI===0){es(eD,eF,eJ)}else{eE=dR[eF];es(eD,eE+dx+1,eJ);eC=dB[eE];if(eC!==0){eF-=d4[eE];eo(eD,eF,eC)}eI--;eE=ei(eI);es(eD,eE,eG);eC=dO[eE];if(eC!==0){eI-=ew[eE];eo(eD,eI,eC)}}}while(eH<eD.last_lit)}es(eD,dw,eJ)}function ee(eK,eH){var eL=eH.dyn_tree;var eJ=eH.stat_desc.static_tree;var eE=eH.stat_desc.has_stree;var eC=eH.stat_desc.elems;var eD,eG;var eI=-1;var eF;eK.heap_len=0;eK.heap_max=dz;for(eD=0;eD<eC;eD++){if(eL[eD*2]!==0){eK.heap[++eK.heap_len]=eI=eD;eK.depth[eD]=0}else{eL[eD*2+1]=0}}while(eK.heap_len<2){eF=eK.heap[++eK.heap_len]=(eI<2?++eI:0);eL[eF*2]=1;eK.depth[eF]=0;eK.opt_len--;if(eE){eK.static_len-=eJ[eF*2+1]}}eH.max_code=eI;for(eD=(eK.heap_len>>1);eD>=1;eD--){ey(eK,eL,eD)}eF=eC;do{eD=eK.heap[1];eK.heap[1]=eK.heap[eK.heap_len--];ey(eK,eL,1);eG=eK.heap[1];eK.heap[--eK.heap_max]=eD;eK.heap[--eK.heap_max]=eG;eL[eF*2]=eL[eD*2]+eL[eG*2];eK.depth[eF]=(eK.depth[eD]>=eK.depth[eG]?eK.depth[eD]:eK.depth[eG])+1;eL[eD*2+1]=eL[eG*2+1]=eF;eK.heap[1]=eF++;ey(eK,eL,1)}while(eK.heap_len>=2);eK.heap[--eK.heap_max]=eK.heap[1];dE(eK,eH);eq(eL,eI,eK.bl_count)}function dI(eK,eL,eJ){var eD;var eH=-1;var eC;var eF=eL[0*2+1];var eG=0;var eE=7;var eI=4;if(eF===0){eE=138;eI=3}eL[(eJ+1)*2+1]=65535;for(eD=0;eD<=eJ;eD++){eC=eF;eF=eL[(eD+1)*2+1];if(++eG<eE&&eC===eF){continue}else{if(eG<eI){eK.bl_tree[eC*2]+=eG}else{if(eC!==0){if(eC!==eH){eK.bl_tree[eC*2]++}eK.bl_tree[dZ*2]++}else{if(eG<=10){eK.bl_tree[dY*2]++}else{eK.bl_tree[d3*2]++}}}}eG=0;eH=eC;if(eF===0){eE=138;eI=3}else{if(eC===eF){eE=6;eI=3}else{eE=7;eI=4}}}}function dL(eK,eL,eJ){var eD;var eH=-1;var eC;var eF=eL[0*2+1];var eG=0;var eE=7;var eI=4;if(eF===0){eE=138;eI=3}for(eD=0;eD<=eJ;eD++){eC=eF;eF=eL[(eD+1)*2+1];if(++eG<eE&&eC===eF){continue}else{if(eG<eI){do{es(eK,eC,eK.bl_tree)}while(--eG!==0)}else{if(eC!==0){if(eC!==eH){es(eK,eC,eK.bl_tree);eG--}es(eK,dZ,eK.bl_tree);eo(eK,eG-3,2)}else{if(eG<=10){es(eK,dY,eK.bl_tree);eo(eK,eG-3,3)}else{es(eK,d3,eK.bl_tree);eo(eK,eG-11,7)}}}}eG=0;eH=eC;if(eF===0){eE=138;eI=3}else{if(eC===eF){eE=6;eI=3}else{eE=7;eI=4}}}}function dX(eD){var eC;dI(eD,eD.dyn_ltree,eD.l_desc.max_code);dI(eD,eD.dyn_dtree,eD.d_desc.max_code);ee(eD,eD.bl_desc);for(eC=dN-1;eC>=3;eC--){if(eD.bl_tree[ea[eC]*2+1]!==0){break}}eD.opt_len+=3*(eC+1)+5+5+4;return eC}function d7(eD,eE,eC,eF){var eG;eo(eD,eE-257,5);eo(eD,eC-1,5);eo(eD,eF-4,4);for(eG=0;eG<eF;eG++){eo(eD,eD.bl_tree[ea[eG]*2+1],3)}dL(eD,eD.dyn_ltree,eE-1);dL(eD,eD.dyn_dtree,eC-1)}function d6(eD){var eC=4093624447;var eE;for(eE=0;eE<=31;eE++,eC>>>=1){if((eC&1)&&(eD.dyn_ltree[eE*2]!==0)){return dK}}if(eD.dyn_ltree[9*2]!==0||eD.dyn_ltree[10*2]!==0||eD.dyn_ltree[13*2]!==0){return dU}for(eE=32;eE<dx;eE++){if(eD.dyn_ltree[eE*2]!==0){return dU}}return dK}var el=false;function d0(eC){if(!el){ec();el=true}eC.l_desc=new ez(eC.dyn_ltree,ep);eC.d_desc=new ez(eC.dyn_dtree,eg);eC.bl_desc=new ez(eC.bl_tree,dP);eC.bi_buf=0;eC.bi_valid=0;d1(eC)}function d8(eE,eC,eD,eF){eo(eE,(ed<<1)+(eF?1:0),3);dJ(eE,eC,eD,true)}function ej(eC){eo(eC,et<<1,3);es(eC,dw,d5);dM(eC)}function dG(eH,eE,eG,eI){var eD,eC;var eF=0;if(eH.level>0){if(eH.strm.data_type===dV){eH.strm.data_type=d6(eH)}ee(eH,eH.l_desc);ee(eH,eH.d_desc);eF=dX(eH);eD=(eH.opt_len+3+7)>>>3;eC=(eH.static_len+3+7)>>>3;if(eC<=eD){eD=eC}}else{eD=eC=eG+5}if((eG+4<=eD)&&(eE!==-1)){d8(eH,eE,eG,eI)}else{if(eH.strategy===d9||eC===eD){eo(eH,(et<<1)+(eI?1:0),3);ev(eH,d5,eh)}else{eo(eH,(d2<<1)+(eI?1:0),3);d7(eH,eH.l_desc.max_code+1,eH.d_desc.max_code+1,eF+1);ev(eH,eH.dyn_ltree,eH.dyn_dtree)}}d1(eH);if(eI){dD(eH)}}function eu(eC,eE,eD){eC.pending_buf[eC.d_buf+eC.last_lit*2]=(eE>>>8)&255;eC.pending_buf[eC.d_buf+eC.last_lit*2+1]=eE&255;eC.pending_buf[eC.l_buf+eC.last_lit]=eD&255;eC.last_lit++;if(eE===0){eC.dyn_ltree[eD*2]++}else{eC.matches++;eE--;eC.dyn_ltree[(dR[eD]+dx+1)*2]++;eC.dyn_dtree[ei(eE)*2]++}return(eC.last_lit===eC.lit_bufsize-1)}er._tr_init=d0;er._tr_stored_block=d8;er._tr_flush_block=dG;er._tr_tally=eu;er._tr_align=ej},{\"../utils/common\":3}],15:[function(dv,dw,du){function dx(){this.input=null;this.next_in=0;this.avail_in=0;this.total_in=0;this.output=null;this.next_out=0;this.avail_out=0;this.total_out=0;this.msg=\"\";this.state=null;this.data_type=2;this.adler=0}dw.exports=dx},{}],\"/\":[function(dw,dz,dv){var du=dw(\"./lib/utils/common\").assign;var dy=dw(\"./lib/deflate\");var dx=dw(\"./lib/zlib/constants\");var dA={};du(dA,dy,dx);dz.exports=dA},{\"./lib/deflate\":1,\"./lib/inflate\":2,\"./lib/utils/common\":3,\"./lib/zlib/constants\":6}]},{},[])(\"/\")});function dl(dr,dq,dt,ds){return function(){dr.call(dq,dt,ds)}}function dn(){if(!dp.async&&dp.useDefer&&!dk){var dq=new Date()-di();if(dq>dp.threshold){return true}}return false}function dg(dq){dk=true;setTimeout(function(){dk=false;dh();dq()},dp.defer);return true}pako.Deflate.prototype.onData=function(dq){dc.handler.apply(dc,[dq,this.strm.avail_out===0?false:true])};pako.Deflate.prototype.onEnd=function(dq){};this.options=dp;var dm=null;var dk=false;function di(){return dm||(dm=new Date())}function dh(){return dm=null}}dc.prototype.deflate=function(dg,dh){return pako.deflateRaw(dg,dh)};dc.prototype.onEnd=function(){pako.onEnd.apply(this,arguments)};dc.prototype.process=function(dg){dc.handler=dg;if(!this.options.useBinary){this.options.to=\"string\"}pako.deflateRaw(this.options.text,this.options)};if(de&&de.options){if(!de.deflate){de.options.async=true;de.options.useDefer=false;de.deflate=new dc(self,de.options)}de.deflate.process(function(){postMessage({args:Array.prototype.slice.call(arguments),url:self.location&&self.location.href})})}return dc}", "function pm(t,e){0}", "function CCUtility() {}", "function cc(){var a;!(a=Ja()&&!Zb(10))&&(a=bc||ac)&&(a=!(0<=ua($b,10)));this.ae=a;this.fg=!(this.ae||Jb&&!Zb(10));!Jb||Zb(11);this.Ug=Ka()||Ja();this.ug=n(window.Map)&&n(window.Map.prototype.values)&&n(window.Map.prototype.forEach)&&!this.ae;this.vg=n(window.Set)&&n(window.Set.prototype.values)&&n(window.Set.prototype.forEach)&&!this.ae}", "function o0(o1)\n{\n var o11 = function () {\n try {\nreturn (this.o4 - this.o5) + \" (overwritten)\";\n}catch(this.o665()){}\n};\n try {\nfor (var o2 = 0; __defineGetter__[o1091 >> [4.4, 5.5, 6.6]]; this.o391[0xFF68] = this.o902)\n {\n try {\nif (o6(o29) == \"this.lastOutput[\" + o214 + \"] = output\" + o214)\n {\n try {\nif (o259[10724 >> 2] = o1098 == -1)\n {\n try {\no2 = o3;\n}catch(e){}\n }\n}catch(e){}\n }\n else\n {\n try {\nif (o2 != -\"Array.prototype.copyWithin called on an object with length > 2^32 and a source range completely > 2^32 and destination range crossing 2^32\")\n {\n try {\no4.o5(o2 + \"-\" + (o3-'error!') + \" = undefined\");\n}catch(e){}\n try {\no421 = -1;\n}catch(e){}\n }\n}catch(e){}\n try {\no4.o5(o3 + \" = \" + o1[o3]);\n}catch(e){}\n }\n}catch(e){}\n }\n}catch(e){}\n}", "init() { }", "init() { }", "init() { }", "init() { }", "init() { }", "init () {}", "init () {}", "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.70156956", "0.68230677", "0.6473631", "0.64528495", "0.6364609", "0.63586444", "0.62848216", "0.6255084", "0.6182535", "0.6061806", "0.60070974", "0.5904644", "0.5878845", "0.5858129", "0.5827394", "0.58151114", "0.58105", "0.579608", "0.5785136", "0.57723707", "0.57715636", "0.5766768", "0.57309335", "0.5671333", "0.565239", "0.5646", "0.5596751", "0.55906725", "0.55496544", "0.5549049", "0.55114627", "0.5501852", "0.54760605", "0.5419449", "0.5405781", "0.5402426", "0.5388271", "0.5388271", "0.53694016", "0.53665674", "0.53549564", "0.53549564", "0.5354468", "0.53432447", "0.53218037", "0.5312511", "0.52908075", "0.5281603", "0.5230158", "0.5228217", "0.5226419", "0.5226419", "0.51968545", "0.5191623", "0.5177179", "0.51764345", "0.516347", "0.516347", "0.51609445", "0.5146827", "0.5141341", "0.5140468", "0.5131381", "0.5129847", "0.51202035", "0.5119798", "0.5119781", "0.5119781", "0.5119781", "0.5119781", "0.5119781", "0.5115371", "0.5115371", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556", "0.51107556" ]
0.0
-1
Automatically performs selection sort.
function autoSort(cards) { var steps = []; var toInsert = 0; var currentMin = Number.MAX_VALUE; var minIndex = Number.MAX_VALUE; var length = cards.length; for (var i = 0; i < length; i++) { // Find the minimum for (var j = toInsert; j < length; j++) { steps.push('consider:'+j); if (cards[j] < currentMin) { if (minIndex != Number.MAX_VALUE) { steps.push('unmarkMin:'+minIndex) } steps.push('markMin:'+j); currentMin = cards[j]; minIndex = j; } steps.push('unconsider:'+j); } // Move min to correct place steps.push('move:'+minIndex+';to;'+toInsert); steps.push('markSorted:'+toInsert); cards.move(minIndex, toInsert); toInsert++; currentMin = Number.MAX_VALUE; minIndex = Number.MAX_VALUE; } return steps; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_sortValues() {\n if (this.multiple) {\n const options = this.options.toArray();\n this._selectionModel.sort((a, b) => {\n return this.sortComparator ? this.sortComparator(a, b, options) :\n options.indexOf(a) - options.indexOf(b);\n });\n this.stateChanges.next();\n }\n }", "sort() {\n let time = 0;\n this.toggleSortButton(time);\n\n switch (this.state.currSelection) {\n case MERGESORT:\n time = this.mergeSort();\n break;\n case QUICKSORT:\n time = this.quickSort();\n break;\n case HEAPSORT:\n time = this.heapSort();\n break;\n case BUBBLESORT:\n time = this.bubbleSort();\n break;\n default:\n break;\n }\n\n this.toggleSortButton(time);\n }", "function findSort(){\n if(!started){\n startSort();\n }\n\n if(done)\n return;\n\n randomizeButton.disabled = true;\n\n let decision = sortSelector.value;\n switch(decision){\n case \"Selection\":\n selectionSort();\n break;\n case \"Quick\":\n quicksort();\n break;\n case \"Bubble\":\n bubblesort();\n break;\n case \"Insertion\":\n insertionSort();\n break;\n case \"Merge\":\n mergeSort();\n break;\n case \"Heap\":\n heapSort();\n break;\n case \"Bogo\":\n bogoSort();\n break;\n }\n\n \n}", "function AnimateSelectionSort() \n{ // This function is executed repeatedly via SetInterval()\n // Note: TargetTick is incremented with every call to this function \n \n Tick=0;\n // SelectionSort(A); \n SelectionSort_Rec(A,0) ;\n TargetTick++; \n}", "sort(predicate) {\n if (this._multiple && this.selected) {\n this._selected.sort(predicate);\n }\n }", "function createSelectionSort(){\n\t \n\tvar that = {},\n\t\tspec = {};\n\t \n\t/**\n\t * Swaps two values in an array.\n\t * @param {Array} items The array containing the items.\n\t * @param {int} firstIndex Index of first item to swap.\n\t * @param {int} secondIndex Index of second item to swap.\n\t * @return {void}\n\t */\n\tspec.swap = function(items, firstIndex, secondIndex){\n\t\tvar temp = items[firstIndex];\n\t\titems[firstIndex] = items[secondIndex];\n\t\titems[secondIndex] = temp;\n\t}\n\t \n\t/**\n\t * A selection sort implementation in JavaScript. The array\n\t * is sorted in-place.\n\t * @param {Array} items An array of items to sort.\n\t * @return {Array} The sorted array.\n\t */\n\tthat.sort = function(items){\n\n\t\tvar len = items.length,\n\t\t\tmin, i, j;\n\n\t\tfor (i=0; i < len; i++){\n\t\t\n\t\t\t// set minimum to this position\n\t\t\tmin = i;\n\t\t\t\n\t\t\t// check the rest of the array to see if anything is smaller\n\t\t\tfor (j=i+1; j < len; j++){\n\t\t\t\tif (items[j] < items[min]){\n\t\t\t\t\tmin = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// if the minimum isn't in the position, swap it\n\t\t\tif (i != min){\n\t\t\t\tspec.swap(items, i, min);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn items;\n\t}\n\t\n\tthat.getStrategyName = function(){\n\t\treturn \"SelectionSort\";\n\t}\n\t\n\treturn that;\n\t\n}", "changeSorting() {\n this.currentlySelectedOrder =\n (this.currentlySelectedColumn === this.columnName) ? !this.currentlySelectedOrder : false;\n this.currentlySelectedColumn = this.columnName;\n }", "visualizeSelectionSort() {\n console.log(\"Selection Sort\");\n const array = this.state.array;\n array.forEach((element) => {\n element.visited = false; // if already sorted and clicked the sort function again... we just need to reset the visited flags\n });\n\n for (let i = 0; i < BAR_COUNT - 1; i++) {\n let minPos = i;\n for (let j = i + 1; j < BAR_COUNT; j++) {\n setTimeout(() => {\n if (array[minPos].number > array[j].number) {\n minPos = j;\n }\n let key = array[minPos];\n while (minPos > i) {\n array[minPos] = array[minPos - 1];\n minPos--;\n }\n array[i] = key;\n array[i].visited = true;\n this.setState({array:array,sorted:i === BAR_COUNT - 2 && j === BAR_COUNT - 1});\n }, i * SORTING_SPEED);\n }\n }\n }", "function sortFromOption(){\n // console.log(\"sortFromOption\");\n getSortMethod(nowArray);\n pageNumber = 1;\n changeDisplayAmount(displayType,1);\n}", "function runAlgo() {\n switch(sel.value()) { // Current value in the drop-down menu.\n case \"Bubble Sort\":\n bubbleSort(values);\n break;\n case \"Merge Sort\":\n mergeSort();\n break;\n case \"Quick Sort\":\n quickSort(values, 0, values.length - 1);\n break;\n case \"Radix Sort\":\n radixSort();\n break;\n case \"Insertion Sort\":\n insertionSort(0, values.length);\n break;\n case \"Selection Sort\":\n selectionSort();\n break;\n case \"Cocktail Sort\":\n cocktailSort();\n break;\n case \"Shell Sort\":\n shellSort();\n break;\n }\n}", "function selectionSort(arr) {\n for (let i = 0; i < arr.length; i++) {\n let minIdx = i;\n for (let j = i + 1; j < arr.length; j++) {\n if (arr[j] < arr[minIdx]) {\n minIdx = j;\n }\n }\n let temp = arr[i];\n arr[i] = arr[minIdx];\n arr[minIdx] = temp;\n }\n}", "function selectionSort(arr) {\n // your code here\n for (let i=1; i<arr.length; i++) {\n let minIdx = i-1;\n for (let j=i; j<arr.length; j++) {\n if (arr[j] < arr[minIdx]) minIdx = j; \n }\n swap(arr, i-1, minIdx);\n }\n}", "function startSort(){\n sortSelector.disabled = true; //freezes the sortSelector\n orderArray = getOrder(); //sets selectionOrder to be the current order of the nodes\n started = true;\n stepNum = 1; //reset the number of steps\n\n if(selected){setClass(selectedNode, 2, \"Default\");} //if a node is selected for manual switching, set it to default\n\n selected = false; //remove the selected Section for the Node\n \n}", "sortChange() {\n let choice = this.selector.value;\n switch(choice) {\n case \"1\":\n return this.sortAlpha();\n case \"2\":\n return this.sortAlpha(true);\n case \"3\":\n return this.sortDonation();\n case \"4\":\n return this.sortDonation(true);\n }\n }", "function Sort() {}", "function selectionsort() {\n\tlet len = numbers.length,min;\n\t\tfor(let i = 0; i < len; i ++){\n\t\t\tmin = i; //set min val \n\t\t\tfor(let j = i+1; j < len; j ++){ //check to see if anything is smaller than min\n\t\t\t\tif(numbers[j] < numbers[min]){\n\t\t\t\t\tmin = j;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//setTimeout(() => {\n\t\t\t\tif(i != min){\n\t\t\t\t\tswap(numbers, i, min);\n\t\t\t\t}\n\t\t\t//},1);\n\t\t\t//if min isnt in the position, swap\n\t}\n}", "function selectionSetSorted(){\n setClass(nodes[selectionSmallest], 2, \"Default\");\n setClass(nodes[selectionCurrent], 2, \"Sorted\"); //sets the current node to \"sorted\" color\n addStep(\"Current Node \" + (selectionCurrent + 1) + \" is now sorted.\");\n sortedSwitchStep++;\n}", "function SelectionSort(arr){\n for (var i = 0; i < arr.length-1; i++){\n for (var k = i + 1; k < arr.length; k++){\n if (arr[k] < arr[i]){\n swap(k, i, arr);\n }\n }\n }\n return arr;\n }", "sort(predicate) {\n if (this._multiple && this.selected) {\n this._selected.sort(predicate);\n }\n }", "sort(predicate) {\n if (this._multiple && this.selected) {\n this._selected.sort(predicate);\n }\n }", "function sortSelector(event) {\n event.preventDefault();\n if ($(\".select-field\").val() == 1) {\n var sortOrder = \"asc\";\n var functionArray = currentSongResults[0];\n var sortedResultsObj = _.orderBy(functionArray, [\"title\"], [sortOrder]);\n var track = sortedResultsObj.map(createListing);\n node.append(track);\n playEventListener(track);\n\n } else if ($(\".select-field\").val() == 2) {\n var sortOrder = \"desc\";\n var functionArray = currentSongResults[0];\n var sortedResultsObj = _.orderBy(functionArray, [\"title\"], [sortOrder]);\n var track = sortedResultsObj.map(createListing);\n node.append(track);\n playEventListener(track);\n };\n}", "function selectionSort (array) {\n var arr = array;\n\tfor (var i = 0, l = arr.length; i < l; i++) {\n for (var j = i+1; j < l; j++) {\n if (arr[i] < arr[j]) { swap(arr, i, j); }\n }\n }\n\n return arr;\n}", "function sortFlights() {\n handleSelect();\n }", "function sortSelect(selElem) {\r\n\tvar tmpAry = new Array();\r\n\tfor (var i=0;i<selElem.options.length;i++) {\r\n\t\ttmpAry[i] = new Array();\r\n\t\ttmpAry[i][0] = selElem.options[i].text;\r\n\t\ttmpAry[i][1] = selElem.options[i].value;\r\n\t}\r\n\ttmpAry.sort();\r\n\twhile (selElem.options.length > 0) {\r\n\t\tselElem.options[0] = null;\r\n\t}\r\n\tfor (var i=0;i<tmpAry.length;i++) {\r\n\t\tvar op = new Option(tmpAry[i][0], tmpAry[i][1]);\r\n\t\tselElem.options[i] = op;\r\n\t}\r\n\treturn;\r\n}", "function selectionSort(arr) {\n\tlet min = 0;\n\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tmin = i;\n\t\tfor (let j = i + 1; j < arr.length; j++) {\n\t\t\tif (arr[min] >= arr[j]) min = j;\n\t\t}\n\t\t// Swap ES6 syntax, also only swaps if its not sorted already\n\t\tif (i !== min) [arr[i], arr[min]] = [arr[min], arr[i]];\n\t}\n\treturn arr;\n}", "function selectionSort(arr){\n var minIdx, temp, \n len = arr.length;\n for(var i = 0; i < len; i++){\n minIdx = i;\n for(var j = i+1; j<len; j++){\n if(arr[j]<arr[minIdx]){\n minIdx = j;\n }\n }\n temp = arr[i];\n arr[i] = arr[minIdx];\n arr[minIdx] = temp;\n }\n return arr;\n}", "function selectionSort(list) {\n\tlet n = list.length\n\tfor (let i = 0; i < n - 1; i++) {\n\t\tminIndex = i\n\t\tfor (let j = i + 1; j < n; j++) {\n\t\t\tif (list[j] < list[minIndex]) {\n\t\t\t\tminIndex = j\n\t\t\t}\n\t\t}\n\t\tif (minIndex !== i) {\n\t\t\tswap(list, minIndex, i)\n\t\t}\n\t}\n}", "function handleSort(event) {\n const selection = event.target.value;\n setSortSelection(selection);\n props.onSelection(selection);\n }", "function mySelectionSort(arr){\r\n let min = arr[0];\r\n for(let i = 0; i < arr.length; i++){\r\n \r\n if(arr[i] < min){\r\n min = arr[i];\r\n }\r\n }\r\n if(min !== arr[0]){\r\n let temp = arr[0];\r\n arr[0] = min;\r\n }\r\n}", "function selectionSort(arr){\n var minIdx, temp, \n len = arr.length;\n for(var i = 0; i < len; i++){\n minIdx = i;\n for(var j = i+1; j<len; j++){\n if(arr[j]<arr[minIdx]){\n minIdx = j;\n }\n }\n temp = arr[i];\n arr[i] = arr[minIdx];\n arr[minIdx] = temp;\n }\n return arr;\n}", "function selectionSort2(array) {\n for (let i = 0; i < array.length - 1; i++) {\n let minIndex = i;\n for (let j = i + 1; j < array.length; j++) {\n if (array[j] < array[minIndex]) {\n minIndex = j;\n }\n }\n if (i !== minIndex) {\n swap(array, i, minIndex);\n }\n }\n}", "function selectionSort(array) {\n const swap = (i, j) => {\n const temp = array[i]\n array[i] = array[j]\n array[j] = temp\n }\n const len = array.length\n for (let i = 0; i < len - 1; i++) {\n let min = i\n for (let j = i + 1; j < len; j++) {\n if (array[j] < array[min]) {\n min = j\n }\n }\n if (min != i) {\n swap(i, min)\n }\n }\n return array\n}", "function selection_simulate() {\n var numbers = $(\"arrayinput\").value;\n var toBeSorted = numbers.split(\",\");\n if (toBeSorted.length >= 1) {\n var toBeSortedi = new Array();\n for (var q = 0; q < toBeSorted.length; q++) {\n toBeSortedi[q] = parseInt(toBeSorted[q]);\n }\n drawarray(toBeSortedi);\n selectionSort(toBeSortedi);\n }\n}", "function selectionSort(arr) {\n for (let i = 0; i < arr.length; i++) {\n let min = i;\n for (let j = i + 1; j < arr.length; j++) {\n if (arr[min] > arr[j]) {\n min = j;\n }\n }\n let temp = arr[i];\n arr[i] = arr[min];\n arr[min] = temp;\n }\n return arr;\n}", "function selectSort() {\n const clickedSort = this;\n const direction = this.dataset.sortDirection;\n setSort(clickedSort, direction);\n\n const clickedSortButton = this;\n changeSortDirection(clickedSortButton, direction);\n}", "function sortby(picked) {\n // Based on what we picked, style spans and trigger sorting functions \n if (picked==1){$('#by-date').removeClass('sort-selected');$('#by-cat').addClass('sort-selected');catsort();}\n if (picked==0){$('#by-cat').removeClass('sort-selected');$('#by-date').addClass('sort-selected');datesort();}\n}", "function sortby(picked) {\n // Based on what we picked, style spans and trigger sorting functions \n if (picked==1){$('#by-date').removeClass('sort-selected');$('#by-cat').addClass('sort-selected');catsort();}\n if (picked==0){$('#by-cat').removeClass('sort-selected');$('#by-date').addClass('sort-selected');datesort();}\n}", "function selectionSort(arr) {\n for(let i = 0; i < arr.length; i++){\n let indexOfMin = i;\n for(let j = i + 1; j < arr.length; j++){\n if(arr[j] < arr[indexOfMin]){\n indexOfMin = j;\n }\n }\n if(arr[indexOfMin] < arr[i] ){\n const save = arr[i];\n arr[i] = arr[indexOfMin];\n arr[indexOfMin] = save;\n }\n }\n return arr;\n}", "function selectionSort (array) {\n for (let i = 0; i < array.length; i++) {\n let minIdx = i;\n for (let j = i; j < array.length; j++) {\n if (array[j] < array[minIdx]) {\n minIdx = j;\n }\n }\n const temp = array[i];\n array[i] = array[minIdx];\n array[minIdx] = temp;\n }\n return array;\n}", "function selectionSort(arr) {\n for (let i = 0; i < arr.length; i++) {\n let indexOfMin = i;\n for (let j = i + 1; j < arr.length; j++) {\n if (arr[j] < arr[indexOfMin]) {\n indexOfMin = j;\n }\n }\n if (i !== indexOfMin) {\n const swap = arr[i];\n arr[i] = arr[indexOfMin];\n arr[indexOfMin] = swap;\n }\n }\n return arr;\n}", "function selectionSort(input){\n for (let i = 0; i < input.length; i++) {\n let min = input[i];\n let minIndex = i;\n for (let j = i + 1; j < input.length; j++) {\n if (input[j] < min){\n min = input[j];\n minIndex = j;\n }\n }\n input[minIndex] = input[i];\n input[i] = min;\n }\n return input;\n}", "function selectionSort(arr) {\n\tfor(var swapI = 0; swapI < arr.length - 1; swapI++) {\n\t\t// Holds the lowest found value on this pass\n\t\tvar lowNum = Infinity;\n\t\tvar lowI = swapI;\n\n\t\tfor(var scanI = swapI; scanI < arr.length; scanI++) {\n\t\t\tif(arr[scanI] < lowNum) {\n\t\t\t\tlowNum = arr[scanI];\n\t\t\t\tlowI = scanI;\n\t\t\t}\n\t\t}\n\n\t\t// Swap the low value with the beginning of the array\n\t\tarr[lowI] = arr[swapI];\n\t\tarr[swapI] = lowNum;\n\t}\n}", "function selectionSort(arr) {\n let sv;\n for (let i = 0; i < arr.length; i++) {\n sv = i;\n for (let j = i + 1; j < arr.length; j++) {\n if (arr[j] < arr[sv]) {\n sv = j;\n }\n }\n if (sv !== i) {\n [arr[i], arr[sv]] = [arr[sv], arr[i]];\n }\n }\n return arr;\n}", "function sselectionSort(arr){\n for(var i = 0; i < arr.length; i++){\n var lowest = i;\n for(var j = i+1; j < arr.length; j++){\n if(arr[j] < arr[lowest]){\n lowest = j;\n }\n }\n if(i !== lowest){\n //SWAP!\n var temp = arr[i];\n arr[i] = arr[lowest];\n arr[lowest] = temp;\n }\n }\n return arr;\n}", "Sort() {\n\n }", "sort(){\n\n }", "function selectionSort(arr) {\n // get the length of the arr and iterate twice through the arr\n let length = arr.length;\n for (let i = 0; i < length; i++) {\n // assume the min is 0\n let min = i;\n for (let j = i + 1; j < length; j++) {\n // if the arr at index 0 is greater than arr[j]\n // reset min\n if (arr[min] > arr[j]) {\n min = j;\n }\n // if the first ele is not the min\n // move current ele to the left\n if (!min == i) {\n let currentEle = arr[i];\n arr[i] = arr[min];\n arr[min] = currentEle;\n }\n }\n }\n // return sorted array\n return arr;\n}", "function selectionSort(array){\n\tlet len = array.length;\n\tlet k = 0;\n\twhile (k<len){\n\t\tlet i = k;\n\t\tlet minIndex = i;\n\t\twhile (i<len-1){\n\t\t\tif (array[i+1]<array[i]){\n\t\t\t\tminIndex = i+1;\n\t\t\t}\n\t\t\ti++;\n\t\t}\n\t\tswap(k, minIndex, array);\n\t\tconsole.log(array)\n\t\tk++;\n\t}\n\treturn array;\n}", "function selection_sort(){\n let i, j, p; \n\n for(i=0;i<data.length-1;i++){\n p =i;\n for( j =i+1;j<data.length;j++){\n if (data1[p] > data1[j]) {\n p=j;\n }\n if(p!=i){\n \n let temp = data1[i];\n data1[i] = data1[p];\n data1[p] = temp;\n }\n \n \n \n }\n draw_chart2();\n \n }\n \n draw_chart3();\n \n \n}", "function selectionSort(array) {\n const length = array.length;\n for (let i=0; i< length; i++) {\n var minIndex = i;\n let temp = array[i]\n for (let j=i+1; j < length; j++) {\n if (array[j] < array[minIndex]) {\n minIndex = j\n }\n }\n array[i] = array[minIndex];\n array[minIndex] = temp;\n }\n return array;\n}", "function selectionSort(array) {\n for (let i = 0; i < array.length; i++) {\n let minIndex = i;\n\n for (let j = i + 1; j < array.length; j++) {\n if (array[minIndex] > array[j]) {\n minIndex = j;\n }\n }\n\n swap(array, i, minIndex);\n }\n return array;\n}", "function selectionSort(numbers) {\n var length = numbers.length;\n for (var index = 0; index < length; index++) {\n var smallestNumIndex = index;\n for (var nextNumIndex = index + 1; nextNumIndex < length; nextNumIndex++) {\n if (numbers[nextNumIndex] < numbers[smallestNumIndex]) {\n smallestNumIndex = nextNumIndex;\n }\n }\n if (smallestNumIndex != index) {\n var currentNumber = numbers[index];\n numbers[index] = numbers[smallestNumIndex];\n numbers[smallestNumIndex] = currentNumber;\n }\n }\n return numbers;\n}", "function selectionSort(arr) {\n let n=arr.length;\n for(var i=0;i<n;i++) {\n let min_idx=i;\n for(var j=i+1;j<n;j++) {\n if(arr[j]<arr[min_idx]) {\n min_idx=j;\n }\n }\n let tmp=arr[min_idx];\n arr[min_idx]=arr[i];\n arr[i]=tmp;\n }\n return arr;\n}", "sortDataset() {\n if (this.settings.disableClientSort) {\n this.restoreSortOrder = true;\n return;\n }\n\n if (this.settings.groupable && this.originalDataset) {\n this.settings.dataset = this.originalDataset;\n }\n const sort = this.sortFunction(this.sortColumn.sortId, this.sortColumn.sortAsc);\n\n this.saveDirtyRows();\n this.settings.dataset.sort(sort);\n this.setTreeDepth();\n this.restoreDirtyRows();\n\n // Resync the _selectedRows array\n if (this.settings.selectable) {\n this.syncDatasetWithSelectedRows();\n }\n }", "function selectionSort(nums){\n for(var i=0; i < nums.length; i++){\n for(var j=1; j<nums.length; j++){\n var temp = nums[i]\n if(nums[0] > nums[1]){\n temp = nums[1];\n nums[1] = nums[0];\n nums[0] = temp;\n }\n if(nums[j] > nums[i]){\n temp = nums[j];\n nums[j] = nums[i];\n nums[i] = temp;\n }\n }\n }\n return nums\n}", "function _fakeSort() {\n var resultsEls = $( '.all-results .search-result-full' ).get();\n var sortOn = this.attributes[\"sort-trigger\"].value;\n\n // toggle the classes\n $( '.search-results-order .selected' ).removeClass('selected');\n $( this ).addClass('selected');\n\n // change our parent sort val\n $( '.search-step-3' ).attr('sort', sortOn);\n\n $( resultsEls.reverse() ).each(function() {\n $(this).detach().appendTo('.all-results');\n });\n }", "function selection_sort(arr) {\n for (let i = 0; i < arr.length; i++) {\n let minIndex = i;\n for (let j = i + 1; j < arr.length; j++) {\n if (arr[j] < arr[minIndex]) {\n minIndex = j;\n }\n }\n // if (arr[minIndex] < arr[i]) swap(arr, i, minIndex);\n if (i !== minIndex) swap(arr, i, minIndex);\n }\n return arr;\n}", "function selectionSort(arr) {\n for (let i = 0; i < arr.length; i++) {\n let indexOfMin = i;\n\n for (let j = i + 1; j < arr.length; j++) {\n if (arr[j] < arr[indexOfMin]) {\n indexOfMin = j;\n }\n }\n // swap logic\n if (indexOfMin !== i) {\n let lesser = arr[indexOfMin];\n arr[indexOfMin] = arr[i];\n arr[i] = lesser;\n }\n }\n\n return arr;\n}", "function sortSelect(select) {\n if (select.options.length > 1) {\n var tempArray = [];\n for (i = 0; i < select.options.length; i++) {\n tempArray[i] = [];\n tempArray[i][0] = select.options[i].text;\n tempArray[i][1] = select.options[i].value;\n }\n tempArray.sort();\n while (select.options.length > 0) {\n select.options[0] = null;\n }\n for (i = 0; i < tempArray.length; i++) {\n select.options[i] = new Option(tempArray[i][0], tempArray[i][1]);\n }\n return;\n }\n }", "function selectionSort(arr) {\n var i, j;\n for ( i = 0; i < arr.length; i++) { // loop thru whole array\n\n var minIndex = i;\n for ( j = i + 1; j < arr.length; j++) { // find index of min element \n if ( arr[minIndex] > arr[j]) {\n minIndex = j;\n }\n }\n var temp = arr[i]; // move the min to the front \n arr[i] = arr[minIndex];\n arr[minIndex] = temp;\n }\n return arr;\n}", "function arraySort() {\n var selectedChoice = document.getElementById(\"arraySelect\").value;\n if (selectedChoice == \"Alfabetisk\") {\n globalEntries.sort();\n } else if (selectedChoice == \"Revers\") {\n globalEntries.reverse();\n }\n}", "sort() {\n\t}", "sort() {\n\t}", "function selectionSort(array){\n for(let i = 0; i < array.length - 1; ++i){\n let min = i;\n for(let j = i + 1; j < array.length; ++j){\n if(array[j] < array[min]){\n min = j;\n }\n }\n [array[min], array[i]] = [array[i], array[min]];\n }\n return array;\n}", "function selectionSort(array){\n var minIndex;\n for(var i = 0; i < array.length; i++){\n minIndex = findIndexOfMinimum(array, i);\n swap(array, i, minIndex);\n }\n return array;\n}", "function selectionSort(array) {\n if (array.length < 2) return array\n let smallest = 0\n let target = 1\n let count = 0\n while (target < array.length) {\n smallest = Math.min(array[smallest], array[target]) !== array[smallest] ? target : smallest\n target++\n if (target === array.length) {\n if (smallest === count) {\n break\n }\n let tmp = array[count]\n array[count] = array[smallest]\n array[smallest] = tmp\n smallest = count + 1\n target = smallest + 1\n count++\n }\n }\n return array\n}", "set overrideSorting(value) {}", "function selectionSort(array) {\n const swap = (array, index1, index2) => {\n [array[index1], array[index2]] = [array[index2], array[index1]]\n }\n for (let i = 0; i < array.length; i++) {\n let lowest = i // set first index as lowest first\n for (let j = i+1; j < array.length; j++) { // j should be one index ahead of i\n if (array[j] < array[lowest]) { // if index ahead is lower than array[i], \n lowest = j\n }\n }\n if (i !== lowest) swap(array, i, lowest)\n }\n return array\n}", "function selectionSort(arr) {\n for (let i = 0; i<arr.length; i++) {\n let min = i\n for (let j=i+1; j<arr.length; j++) {\n if (arr[j]<arr[min]) {\n min = j\n }\n }\n if (arr[min]<arr[i]) {\n [arr[i], arr[min]] = [arr[min], arr[i]]\n }\n }\n return arr\n}", "function selectionSort(arr) {\n for (let i = 0; i < arr.length; i++) {\n let lowest = i\n for (let j = i + 1; j < arr.length; j++) {\n if (arr[j] < arr[lowest]) lowest = j\n }\n if (i !== lowest) swap(arr, i, lowest)\n }\n return arr\n}", "function selectionSort(nums){\n var counter = 0;\n for(var i = 0; i < nums.length; i++){\n var min = nums[i];\n var minIndex = i;\n for(var j = 0+i; j < nums.length; j++){\n if(min > nums[j]){\n min = nums[j];\n minIndex = j;\n console.log(\"min is now \" + min);\n }\n counter++;\n }\n nums[minIndex] = nums[i];\n nums[i] = min;\n }\n console.log(\"Function ran this many times: \" + counter);\n return nums;\n }", "function selectionSort(arr) {\n for (let i = 0; i < arr.length; i++) {\n let indexOfMin = i;\n\n for (let j = i + 1; j < arr.length; j++) {\n if (arr[j] < arr[indexOfMin]) {\n indexOfMin = j;\n }\n }\n\n if (indexOfMin !== i) {\n [arr[indexOfMin], arr[i]] = [arr[i], arr[indexOfMin]];\n }\n }\n\n return arr;\n}", "function selectionSort(arr) {\n // loop through and compare element to the following items\n // in the array and find a smaller value\n for (let i = 0; i < arr.length; i++) {\n // make a variable to store minimum value\n let min = i;\n // loop for comparison (add one to the current index for comparisons)\n for (var j = i + 1; j < arr.length; j++) {\n // if found, store the new minimum index and finish loop\n if (arr[j] < arr[min]) {\n min = j;\n }\n }\n // if the minimum is not your starting index, swap it with the new min\n if (min !== i) {\n temp = arr[i];\n arr[i] = arr[min];\n arr[min] = temp;\n }\n }\n return arr;\n}", "function selectionSort(arr) {\n const swap = (arr, idx1, idx2) => {\n return ([arr[idx1], arr[idx2]] = [arr[idx2], arr[idx1]])\n }\n for (let i = 0; i < arr.length; i++) {\n // Store the first selection as the minimum value that the function has seen so far\n // the position of the smallest element we've seen so far\n let lowest = i\n // want to compare i to the value at the index in front of it, so j = i + 1\n for (let j = i + 1; j < arr.length; j++) {\n // check the value of lowest to the value at j\n // is arr[1] < arr[0] ? yes\n if (arr[j] < arr[lowest]) {\n // so we set lowest (0) to be j (1)\n // index 1 becomes the new index 0\n lowest = j\n }\n }\n if (i !== lowest) {\n swap(arr, i, lowest)\n }\n }\n\n return arr\n}", "function selectionSort() { // declare the function\n var arrayLength = array.length; // store the length of the array in a local variable\n for (var index = 0; index < arrayLength - 1; index++) { // loop through the array\n var minNum = index; // assume the 1st index [0] is the minimum number in the array and store as local variable\n for (var comparisonIndex = index + 1; comparisonIndex < arrayLength; comparisonIndex++) {\n // line 10 comment: set the comparisonIndex to the current index + 1 (since we assume the 1st index [0] is the minimum number);\n // if the comparisonIndex is less than the array's length, iterate through the following code and then increase the comparisonIndex by 1\n if(array[comparisonIndex] < array[minNum]) { // if the array's comparisonIndex is less than the minNum index\n minNum = comparisonIndex; // set the minNum equal to the comparisonIndex\n }\n }\n if(minNum != index) { // if the minNum is NOT equal to the index\n var swapIndices = array[index]; // set that index to the variable swapIndices\n array[index] = array[minNum]; // set the index to the minNum index\n array[minNum] = swapIndices; // set the minNum index to the swapIndices variable\n }\n }\n console.log('selectionSort array:', array); // print out the sorted array to the console\n var sortedArray = array; // store the newly sorted array in a new variable for clarity's sake\n return sortedArray; // upon completion of running the function, return the sortedArray for access elsewhere in the program\n}", "function handleSort(e, args) {\n collapseAll();\n }", "function selectionSort(arr){\n let min, minIdx;\n\n const swap = (arr, i1, i2) => {\n [arr[i1], arr[i2]] = [arr[i2], arr[i1]];\n };\n\n for(let i = 0; i < arr.length; i++){\n minIdx = i;\n min = arr[i];\n\n for(let j = i + 1; j < arr.length; j++){\n if(arr[j] < min) {\n min = arr[j];\n minIdx = j;\n };\n }\n\n if(minIdx !== i) swap(arr, i, minIdx);\n }\n return arr;\n}", "function sortSelectedCSI()\n {\n //sort them properly\n var arrSelCSI = new Array();\n //store the selected csis in an array\n if (obj_selectedCSI != null && obj_selectedCSI.length >0)\n {\n for (var m=0; m<obj_selectedCSI.length; m++)\n {\n arrSelCSI[arrSelCSI.length] = new Array(obj_selectedCSI[m].value, obj_selectedCSI[m].text);\n }\n }\n if (arrSelCSI.length > 0)\n {\n obj_selectedCSI.length = 0; //empty the select list\n //loop through selCSI select list get the csis\n for (var k=0; k<csiArray.length; k++)\n {\n var selCSIid = csiArray[k][2];\n if (obj_selectedCS.selectedIndex >= 0)\n {\n var selCS_id = obj_selectedCS[obj_selectedCS.selectedIndex].value;\n var arrCSid = csiArray[k][0];\n //loop through above array to get the matching csis\n if (selCS_id == arrCSid)\n {\n for (var m=0; m<arrSelCSI.length; m++)\n {\n var arrCSIid = arrSelCSI[m][0];\n if (arrCSIid == selCSIid)\n {\n var idx = obj_selectedCSI.length;\n obj_selectedCSI[idx] = new Option(arrSelCSI[m][1], arrCSIid);\n //keep it selected\n if (obj_selCSI.selectedIndex >= 0)\n {\n if (obj_selCSI[obj_selCSI.selectedIndex].value == arrCSIid)\n obj_selectedCSI[idx].selected = true;\n }\n break;\n }\n }\n }\n }\n }\n }\n }", "function setSort(x) { //these 3 functions are connected to the event of the buttons\n sortby = x;\n updateDoctorsList(); //they then invoke updatedoctorslist, that is meant to access the doctors on the server with the current criteria, the fetch..\n}", "function sort() {\n if (!active) {\n active = true;\n switch (sortingAlgo) {\n case algorithms.BUBBLE:\n console.log(\"Bubble sort\");\n bubbleSort();\n break;\n \n case algorithms.SELECTION:\n console.log(\"Selection sort\");\n selectionSort();\n break;\n\n case algorithms.INSERTION:\n console.log(\"Insertion sort\");\n insertionSort();\n break;\n\n case algorithms.QUICK:\n console.log(\"Quicksort\");\n quickSort();\n break; \n \n case algorithms.MERGE:\n console.log(\"Mergesort\");\n mergeSort();\n break;\n\n case algorithms.HEAP:\n console.log(\"Heapsort\");\n heapSort();\n break;\n\n default:\n alert(\"This algorithm not implemented yet.\\nPlease try another one.\");\n break;\n }\n }\n}", "function CdkDragSortEvent() {}", "function CdkDragSortEvent() {}", "function sortSelectCallback() {\n let sortType = $(this).val();\n setStatus(\"sortType\", sortType);\n\n console.log(\"sort clicked\");\n\n //TODO: Can we do this without referencing sg namespace?\n sg.cardContainer.sortCards(orderCodes[sortType]);\n }", "function selectionSort(arr) {\n let min;\n for (let i = 0; i < arr.length; i++) {\n min = i;\n for (let j = i + 1; j < arr.length; j++) {\n if (arr[j] < arr[min]) {\n min = j;\n }\n }\n if (i !== min) {\n [arr[i], arr[min]] = [arr[min], arr[i]];\n }\n }\n return arr;\n}", "function sortBoxes(leftID, rightID){\n var ids = '#' + leftID;\n if (rightID != null) { ids = ids + ', #' + rightID; }\n var toSort = $(ids);\t\t\t\t\t\n\n toSort.find('option').selso({\n type: 'alpha', \n extract: function(o){ return $(o).text().toLowerCase(); } \n });\n\n // clear highlights\n $('#' + leftID + ', #' + rightID).find('option:selected').removeAttr('selected');\n }", "repeaterOnSort() {\n }", "function quick_driver() {\n quicksort(0, array.length - 1);\n // display sorted array\n showSorted();\n}", "function selectSort(list) {\n function sort(index) {\n if (list.length === 0 || index === list.length - 1) {\n return total;\n }\n var min = list.reduce(function(prev, curr, idx) { // only compare from index;\n return idx <= index ? list[index] : Math.min(prev, curr);\n });\n var minIndex = list.indexOf(min, index);\n if (minIndex > 0) {\n selects.push([index, list[minIndex], minIndex, list[index]]);\n var temp = list[index];\n list[index] = list[minIndex];\n list[minIndex] = temp;\n total++;\n } // else list[0] is next smallest;\n return sort(index + 1);\n }\n var total = 0;\n return sort(0);\n}", "function selectionSort(arr) {\n for(let i = 0; i < arr.length; i++) {\n var min = arr[i];\n // store minimum in a var\n if(arr[i] < arr[i+1]) {\n min = arr[i];\n }\n }\n return arr;\n}", "function listsort(obj, by, num, cs) { /*updated from version 1.2*/\n\tobj = (typeof obj == \"string\") ? document.getElementById(obj) : obj;\n\tby = (parseInt(\"0\" + by) > 5) ? 0 : parseInt(\"0\" + by);\n\tif (obj.tagName.toLowerCase() != \"select\" && obj.length < 2)\n\t\treturn false;\n\tvar elements = new Array();\n\tfor (var i=0; i<obj.length; i++) {\n\t\telements[elements.length] = new Array((document.body.innerHTML ? obj[i].innerHTML : obj[i].text), obj[i].value, (obj[i].currentStyle ? obj[i].currentStyle.color : obj[i].style.color), (obj[i].currentStyle ? obj[i].currentStyle.backgroundColor : obj[i].style.backgroundColor), obj[i].className, obj[i].id, obj[i].selected);\n\t}\n\tsort2d(elements, by, num, cs);\n\tfor (i=0; i<obj.length; i++) {\n\t\tif (document.body.innerHTML) obj[i].innerHTML = elements[i][0];\n\t\telse obj[i].text = elements[i][0];\n\t\tobj[i].value = elements[i][1];\n\t\tobj[i].style.color = elements[i][2];\n\t\tobj[i].style.backgroundColor = elements[i][3];\n\t\tobj[i].className = elements[i][4];\n\t\tobj[i].id = elements[i][5];\n\t\tobj[i].selected = elements[i][6];\n\t}\n}", "function sortASelect(select){\r\n select.append($(select.selector +\" option\").remove().sort(function(a, b) {\r\n var at = $(a).text(), bt = $(b).text();\r\n return (at > bt)?1:((at < bt)?-1:0);\r\n }));\r\n}", "async function selectionSort() {\n if (delay && typeof delay !== \"number\") {\n alert(\"sort: First argument must be a typeof Number\");\n return;\n }\n \n blocks = htmlElementToArray(\".block\");\n\n for (let i = 0; i < blocks.length-1; i += 1) {\n min = i;\n for (let j = i+1; j < blocks.length; j += 1) {\n\n blocks[j].style.backgroundColor = bar_colours.selectedColour;\n blocks[min].style.backgroundColor = bar_colours.selectedColour2;\n\n const value1 = getValue(blocks[j]);\n const value2 = getValue(blocks[min]);\n\n await new Promise(resolve =>\n setTimeout(() => {\n resolve();\n }, delay)\n );\n \n if (value1 < value2) {\n blocks[min].style.backgroundColor = bar_colours.initColour;\n min = j;\n } else {\n blocks[j].style.backgroundColor = bar_colours.initColour;\n }\n\n blocks[j].style.backgroundColor = bar_colours.initColour;\n }\n\n blocks[i].style.backgroundColor = bar_colours.selectedColour;\n\n blocks = await swap(blocks, min, i);\n\n blocks[min].style.backgroundColor = bar_colours.initColour;\n blocks[i].style.backgroundColor = bar_colours.doneColour;\n }\n blocks[blocks.length-1].style.backgroundColor = bar_colours.doneColour;\n}", "function selectionSort(array) {\n const swap = (arr, i1, i2) => [arr[i1], arr[i2]] = [arr[i2], arr[i1]];\n\n // loop arr\n for (let o = 0; o < array.length; o++) {\n // min tracker\n let min = o;\n let noSwap = true;\n // inner loop n update min index\n for (let i = o + 1; i < array.length; i++) {\n if (array[i] < array[min]) {\n min = i;\n noSwap = false;\n }\n }\n // end of loop we swap\n if (min !== o) {\n swap(array, o, min);\n }\n console.log('array', array, noSwap);\n if (noSwap) break;\n }\n // return arr\n return array;\n}", "async function sort() {\n sortingProgram = new SortingProgram({\n arr: values,\n states: states,\n delay: getDelay()\n });\n $(\"#alg-runtime\").text(\"running...\");\n await sortingProgram.runSort(sortingStrategy);\n}", "function sortComplete(){\n isSorting = false\n updateMenu()\n}", "function selectionSort(arr) {\n // your code here!\n // arr is an array of unsorted integers (i.e. [3, 5, 1])\n let length = arr.length;\n arr.map((e, i) => {\n let min = i; //store index of min value\n for (let j = i + 1; j < length; j++) {\n if (arr[min] > arr[j]) {\n min = j; //updating the index\n }\n }\n if (i !== min) {\n [arr[i], arr[min]] = [arr[min], arr[i]];\n }\n });\n return arr;\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 selectionSort(array) {\n const length = array.length;\n for (let i = 0; i < length; i++) {\n //set current index as minimum number\n let minimum = i;\n let temp = array[i];\n for (let j = i + 1; j < length; j++) {\n if (array[j] < array[minimum]) {\n //update minimum number if current is lower than what we had previously\n minimum = j;\n }\n }\n array[i] = array[minimum];\n array[minimum] = temp;\n }\n return array;\n}", "function selectionSort(arr) {\n let start = 0;\n while (start < arr.length) {\n let smallestIndex = -1;\n let smallest = Infinity;\n for (let j = start + 1; j < arr.length; j++) {\n if (arr[j] <= smallest) {\n smallest = arr[j];\n smallestIndex = j;\n }\n }\n let temp = arr[start];\n arr[start] = arr[smallestIndex];\n arr[smallestIndex] = temp;\n start++;\n }\n return arr;\n}", "function sortBy(){\n var option = btnSelectBy.options[btnSelectBy.selectedIndex].value;\n resultHotel = resultHotel.sort((a, b)=>{\n var itemA = a[option];\n var itemB = b[option];\n return itemA < itemB ? -1 : itemA > itemB ? 1 : 0;\n });\n display(resultHotel);\n}", "function list_set_sort(col)\n {\n if (settings.sort_col != col) {\n settings.sort_col = col;\n $('#notessortmenu a').removeClass('selected').filter('.by-' + col).addClass('selected');\n rcmail.save_pref({ name: 'kolab_notes_sort_col', value: col });\n\n // re-sort table in DOM\n $(noteslist.tbody).children().sortElements(function(la, lb){\n var a_id = String(la.id).replace(/^rcmrow/, ''),\n b_id = String(lb.id).replace(/^rcmrow/, ''),\n a = notesdata[a_id],\n b = notesdata[b_id];\n\n if (!a || !b) {\n return 0;\n }\n else if (settings.sort_col == 'title') {\n return String(a.title).toLowerCase() > String(b.title).toLowerCase() ? 1 : -1;\n }\n else {\n return b.changed_ - a.changed_;\n }\n });\n }\n }" ]
[ "0.7324717", "0.7271149", "0.70171255", "0.69869155", "0.693823", "0.6932976", "0.6909064", "0.68955946", "0.6801726", "0.67874587", "0.67652714", "0.6755435", "0.6751376", "0.67510825", "0.6732474", "0.6725357", "0.67198277", "0.670808", "0.66885775", "0.66885775", "0.66589195", "0.6658035", "0.66478854", "0.6587457", "0.6552511", "0.65354204", "0.6515607", "0.65133053", "0.649029", "0.6488775", "0.64785385", "0.64750284", "0.6472399", "0.6467598", "0.6455399", "0.6454547", "0.6454547", "0.6450337", "0.64484006", "0.64084446", "0.63898385", "0.6388234", "0.63648", "0.63612086", "0.635089", "0.6350803", "0.63419825", "0.63410956", "0.6331684", "0.63213944", "0.632044", "0.6312168", "0.6300268", "0.62975883", "0.6266064", "0.62637955", "0.6254575", "0.62525", "0.62519056", "0.6241908", "0.62380147", "0.62367296", "0.62367296", "0.6234334", "0.62310386", "0.62308955", "0.6227245", "0.622611", "0.62191725", "0.6214835", "0.6206754", "0.62040895", "0.6202827", "0.61995524", "0.6198784", "0.6176109", "0.6165927", "0.6165816", "0.6155757", "0.6150581", "0.6149805", "0.6149805", "0.6141609", "0.6134665", "0.6132275", "0.6127739", "0.6122622", "0.61209226", "0.6120771", "0.61188257", "0.6118374", "0.611805", "0.6113058", "0.61047304", "0.6103611", "0.61009294", "0.60949975", "0.60795176", "0.6079204", "0.6074193", "0.607296" ]
0.0
-1
Adds animations to a queue.
function animToQueue(theQueue, selector, props, css, globals, params) { theQueue.queue(function(next) { // CSS changes before animation // Reveal a card if (css === "reveal") { var select = '#' + globals.cardArray[params].num; // race condition $(select).css({ backgroundImage: 'url(' + globals.cardArray[params].frontFace + ')' }); // Flip it back over } else if (css === "flip") { var select = '#' + globals.cardArray[params].num; // race condition $(select).css({ backgroundImage: 'url(' + globals.cardArray[params].normalBack + ')' }); // Mark card as new min / max } else if (css === "min") { var select = '#' + globals.cardArray[params].num; $('.droppable').css('background-image', 'url(' + globals.cardArray[params].frontFace + ')'); // Set card as sorted } else if (css == "sort") { var select = '#' + globals.cards[params].num; spacifyCards(globals); $(selector).css({ backgroundImage:'url(' + globals.cards[params].sortedBack + ')' }); } else if (css == "move") { var to = params.split(';')[2]; var from = params.split(';')[0]; var select = '#' + globals.cardArray[from].num; $(select).insertBefore($('#' + globals.cardArray[to].num)); // Update globals.cardArray globals.cardArray.move(from, to); } else if (css == "unmin") { var select = '#' + globals.cardArray[params].num; } // Animation $(select).animate(props, next); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "queueAnimation(animateRequest) {\n this._animationQueue.push(animateRequest);\n }", "function __addInteractionAnimationLayerForObject(animations){\n animationQueue.push(animations);\n queueOnAction.push(false);\n currentAnimation.push([]);\n finishedAnimationQueue.push([]);\n _startQueue(animationQueue.length-1);\n }", "addAnimation(_animation, _frameStart = 0, _frameEnd = 0, _sound, _animWidth, _animHeight, _frameCount = 0) {\n this.animations.push({\n name: _animation,\n frameStart: _frameStart,\n frameEnd: _frameEnd,\n sound: _sound,\n animWidth: _animWidth,\n animHeight: _animHeight,\n frameCount: _frameCount\n })\n }", "function _setAnimationQueue(_queue){\n __generateQueues(_queue.length);\n animationQueue = jQuery.extend(true,[],_queue);\n for(var i = 0; i<animationQueue.length; i++){\n for(var j = 0; j<animationQueue[i].length;j++){\n animationQueue[i][j]['id'] = i+'-'+j;\n }\n }\n _originalAnimationQueue = jQuery.extend(true,[],animationQueue);\n }", "_playAnimation() {\n if (this._animationLast === undefined && this._animationQueue.length > 0) {\n this._animationLast = this._animationCurrent;\n this._animationCurrent = this._animationQueue.shift();\n console.log(\"New: \" + this._animationCurrent.name);\n this._animationCurrent.runCount = 0;\n }\n this._serviceAnimation(this._animationCurrent, true);\n this._serviceAnimation(this._animationLast, false);\n if (this._animationLast && this._animationLast.cleanup) {\n this._animationLast.animation.stop();\n this._animationLast.animation = undefined;\n this._animationLast = undefined;\n }\n }", "function _addToQueue(_level,_node){\n var wasEmpty=false;\n if(animationQueue[_level].length===0){\n wasEmpty=true;\n }\n if(_node.constructor === Array){ //If adding an array of items\n for(var i=0;i<_node.length;i++){\n _node[i]['id'] = _level+'-'+animationQueue[_level].length;\n animationQueue[_level].push(_node[i]);\n _originalAnimationQueue[_level].push($.extend(_node, {}, true));\n }\n }else{ //Adding just one item\n _node['id'] = _level+'-'+animationQueue[_level].length;\n animationQueue[_level].push(_node);\n _originalAnimationQueue[_level].push($.extend(_node, {}, true));\n }\n if(wasEmpty && queueOnAction[_level]){\n _nextAnimation(_level, 'Add to running empty queue');\n }\n }", "animateInorderNodes() {\r\n let queue = [];\r\n let animations = [];\r\n animations.push(new Animation(\"display\", \"Traversing Inorder\", \"\"));\r\n\r\n this.animateInorderNodesHelper(this.root, queue, animations);\r\n\r\n animations.push(new Animation(\"display\", \"Finished Travering\", \"\"));\r\n\r\n return [queue, animations];\r\n }", "function addAnimations( FBXTree, connections, sceneGraph ) {\n \n sceneGraph.animations = [];\n \n var rawClips = parseAnimations( FBXTree, connections );\n \n if ( rawClips === undefined ) return;\n \n \n for ( var key in rawClips ) {\n \n var rawClip = rawClips[ key ];\n \n var clip = addClip( rawClip );\n \n sceneGraph.animations.push( clip );\n \n }\n \n }", "function animate (params) {\n // add new animation task to task queue\n tasks.push(new animationTask(params));\n\n if (tasks.length == 1) {\n // start animation interval timer since this is the first item in the task queue\n start();\n }\n }", "queueVisualEffect(action, isAnimated) {\n if (this.isInAnimation) {\n // queue\n this.visualEffectQueue.push({\n isAnimated: isAnimated,\n action: action,\n });\n } else {\n // execute\n this.isInAnimation = isAnimated;\n action();\n }\n }", "clearQueue() {\n if (this.isAnimating) {\n this._queue = [this._queueFirst];\n return;\n }\n this._queue = [];\n }", "addAnimations(...animations) {\n animations.forEach(animation => {\n Object.keys(animation).forEach(key => {\n UI.animations[key] = animation[key];\n });\n });\n }", "function addAnimations(FBXTree, connections, sceneGraph) {\n sceneGraph.animations = [];\n var rawClips = parseAnimations(FBXTree, connections);\n if (rawClips === undefined)\n return;\n for (var key in rawClips) {\n var rawClip = rawClips[key];\n var clip = addClip(rawClip);\n sceneGraph.animations.push(clip);\n }\n}", "function addAnimation() {\n const Burst1 = new mojs.Burst({\n parent: animationDiv,\n top: '50%',\n left: '50%',\n radius: {0: 80},\n count: 8,\n children: {\n shape: 'circle',\n fill: {'red': 'blue'},\n strokeWidth: 1,\n duration: 600,\n stroke: {'red': 'blue'}\n }\n });\n\n\n const Burst2 = new mojs.Burst({\n parent: animationDiv,\n top: '50%',\n left: '50%',\n radius: {0: 100},\n count: 4,\n children: {\n shape: 'rect',\n fill: 'white',\n strokeWidth: 1,\n duration: 300,\n stroke: 'white'\n }\n });\n\n\n const circle1 = new mojs.Shape({\n radius: {0: 40},\n parent: animationDiv,\n fill: 'none',\n stroke: 'white',\n strokeWidth: 15,\n duration: 300,\n opacity: {1: 0}\n });\n\n const circle2 = new mojs.Shape({\n radius: {0: 50},\n parent: animationDiv,\n fill: 'none',\n stroke: 'red',\n strokeWidth: 5,\n duration: 400,\n opacity: {1: 0}\n });\n\n\n const circle3 = new mojs.Shape({\n radius: {0: 60},\n parent: animationDiv,\n fill: 'none',\n stroke: 'blue',\n strokeWidth: 5,\n duration: 500,\n opacity: {1: 0}\n });\n\n const circle4 = new mojs.Shape({\n radius: {0: 70},\n parent: animationDiv,\n fill: 'white',\n\n stroke: 'white',\n strokeWidth: 5,\n duration: 600,\n opacity: {1: 0}\n });\n\n const timeline = new mojs.Timeline({\n\n repeat: 0\n }).add(circle4, circle1, circle2, circle3, Burst1, Burst2);\n\n timeline.play();\n }", "function add () {\n if(queue.length)\n append(content, render(queue.shift()), top, sticky)\n }", "function add () {\n if(queue.length)\n append(content, render(queue.shift()), top, sticky)\n }", "animateTo(id, position, rotation, time, onFinish = null) {\n\t\tthis._cameraAnimationQueue.push({\n\t\t\tid: id,\n\t\t\tposition: position,\n\t\t\trotation: rotation,\n\t\t\ttime: time,\n\t\t\tonFinish: onFinish\n\t\t})\n\t}", "animatePreorderNodes() {\r\n let queue = [];\r\n let animations = [];\r\n animations.push(new Animation(\"display\", \"Traversing Preorder\", \"\"));\r\n\r\n this.aniamtePreorderNodesHelper(this.root, queue, animations);\r\n\r\n animations.push(new Animation(\"display\", \"Finished Traversing\", \"\"));\r\n\r\n return [queue, animations];\r\n }", "addAnimation(anims,timeBetween = 1, loop = true){\n var animArr = []\n for (var i = 0; i < anims.length; i++){\n animArr[i] = new Image(this.width, this.height)\n animArr[i].src = anims[i]\n animArr[i].width = this.width\n animArr[i].height = this.height\n }\n\n this.animIndex = 0\n this.animsArray[this.numberOfAnimations] = animArr\n this.numberOfAnimations++;\n if (this.animsArray.length === 1){\n this.anims = animArr;\n this.timeBetweenAnim = timeBetween\n setInterval(function(){\n this.image = this.anims[this.animIndex];\n this.animIndex++;\n if (this.animIndex >=this.anims.length){\n this.animIndex =0\n }\n }.bind(this), this.timeBetweenAnim)\n }\n }", "animatePostorderNodes() {\r\n let queue = [];\r\n let animations = [];\r\n animations.push(new Animation(\"display\", \"Traversing Postorder\", \"\"));\r\n\r\n this.animatePostorderNodesHelper(this.root, queue, animations);\r\n\r\n animations.push(new Animation(\"display\", \"Finished Traversing\", \"\"));\r\n\r\n return [queue, animations];\r\n }", "initAnimations() {\n this.animations = [];\n let interpolant = new TransformationInterpolant();\n\n for (var key in this.graph.animations) {\n if (this.graph.animations.hasOwnProperty(key)) {\n let animation = this.graph.animations[key];\n let keyframes = animation.keyframes;\n let keyframeTrack = new TransformationTrack(keyframes, interpolant);\n this.animations[key] = new KeyframeAnimation(keyframeTrack);\n }\n }\n\n this.interface.addAnimations();\n }", "function startQueue() {\n if(running)\n return;\n running = true;\n setTimeout(doNext,queue[0].delay);\n\n function doNext() {\n queue[0].fn();\n removeItem(queue,0);\n if(queue.length>0) {\n setTimeout(doNext,queue[0].delay);\n } else\n running = false;\n }\n }", "function addToQueue() {\n queue.push(canvas.toDataURL('image/png'))\n}", "add(element) { \n // adding element to the queue \n this.items.push(element); \n }", "function _startQueue(_level){\n if(queueOnAction[_level]){ //Already running\n return;\n }\n queueOnAction[_level]=true;\n _nextAnimation(_level, 'start queue');\n }", "function fx_add_to_queue(fx, args) {\n var chain = fx.ch, queue = fx.options.queue;\n\n if (!chain || fx.$ch) {\n return (fx.$ch = false);\n }\n\n if (queue) {\n chain.push([args, fx]);\n }\n\n return queue && chain[0][1] !== fx;\n}", "function enqueue(fn) {\n if (!DEFERREDQUEUE.length) {\n requestAnimationFrame(function () {\n var q = DEFERREDQUEUE.length;\n while (DEFERREDQUEUE.length) {\n var func = DEFERREDQUEUE.shift();\n func();\n };\n __PS_MV_REG = [];\n return main.debug ? console.log('queue flushed', q) : null;\n });\n };\n __PS_MV_REG = [];\n return DEFERREDQUEUE.push(fn);\n}", "function queue(animId, i, targetPoint, delay, final) {\n /* If the global logo.animState value is false, or the animId does not match the global logo.logoId */\n if (c4.logo.animState === false || c4.logo.logoId !== animId) {\n return; //Do not start another animation\n }\n\n setTimeout(function () {\n if (final === true) {\n dropChar(animId, i, targetPoint, final);\n } else {\n dropChar(animId, i, targetPoint);\n }\n }, delay);\n}", "function addAnimation(){\n const Burst1 = new mojs.Burst ({\n parent: animationDiv,\n top: '50%',\n left: '50%', \n radius: {0: 80},\n count: 8,\n children: {\n shape: 'circle',\n fill: {'red':'blue'},\n strokeWidth: 1,\n duration: 600,\n stroke: {'red':'blue'}\n }\n });\n\n\n const Burst2 = new mojs.Burst ({\n parent: animationDiv,\n top: '50%',\n left: '50%', \n radius: {0: 100},\n count: 4,\n children: {\n shape: 'rect',\n fill: 'white',\n strokeWidth: 1,\n duration: 300,\n stroke: 'white'\n }\n });\n\n\n\n const circle1= new mojs.Shape ({\n radius: {0:40},\n parent: animationDiv,\n fill: 'none',\n stroke: 'white',\n strokeWidth:15,\n duration: 300,\n opacity: {1: 0}\n });\n\n const circle2= new mojs.Shape ({\n radius: {0:50},\n parent: animationDiv,\n fill: 'none',\n stroke: 'red',\n strokeWidth:5,\n duration: 400,\n opacity: {1: 0}\n });\n\n\n const circle3= new mojs.Shape ({\n radius: {0:60},\n parent: animationDiv,\n fill: 'none',\n stroke: 'blue',\n strokeWidth:5,\n duration: 500,\n opacity: {1: 0}\n });\n\n const circle4= new mojs.Shape ({\n radius: {0:70},\n parent: animationDiv,\n fill: 'white',\n \n stroke: 'white',\n strokeWidth:5,\n duration: 600,\n opacity: {1: 0}\n });\n\n const timeline = new mojs.Timeline ({\n \n repeat: 0\n }).add(circle4,circle1,circle2,circle3,Burst1,Burst2);\n\n timeline.play();\n}", "add(item) {\n\t\tthis.queue.set(item, item);\n\t}", "function addToQueue(fn) {\n if (working) {\n queue.push(fn);\n } else {\n fn();\n }\n}", "enQueue(element){\n return this.items.push(element); //item added to the queue array\n }", "function _startAllQueues(){\n for (var i=0;i<animationQueue.length;i++){\n _startQueue(i);\n }\n lastUserInteraction = new Date().getTime();\n _isPlaying = true;\n if(logHeartbeat){\n clearInterval(logHeartbeat);\n }\n logHeartbeat = setInterval(function(){\n if(_isPlaying){\n logger.logEvent('Video playing');\n }\n }, 5000);\n }", "function addAnimator(animator) {\n animatorList.push(animator);\n if (animatorList.length === 1) {\n start();\n }\n }", "function addAnimator(animator) {\n animatorList.push(animator);\n if (animatorList.length === 1) {\n start();\n }\n }", "function createAnimation(elems, values, duration, onFinishFn) {\n nativeGlobal.setTimeout(function() {\n var newAnimation = animate.animateTransforms(elems, values, duration, onFinishFn);\n runningAnimations.push(newAnimation);\n }, 18); // Wait one frame, for Firefox\n\n}", "function animateFrame(frameStack) {\n \n $.each(frameStack, function() {\n // here this represents the frame object \n var it = this\n // check if frame has no animation setted\n if(!f.o.doanimate) {\n // the frame its just positioned\n it.$item\n .hide()\n .css({ 'top' : it.top*1, 'left' : it.left*1 })\n .delay(300)\n .fadeToggle('fast', frameAnimationEnd); // execute callback\n }\n else // manage direction for each frame \n {\n f.$el.queue(function() {\n animateDirections(it.direction, it);\n $(this).dequeue();\n });\n }\n });\n // when reach end, star dequeue animations\n f.$el.dequeue();\n return;\n }", "expand() {\n this.queue.unshift({\n x: this.x,\n y: this.y\n });\n }", "enqueue(element) {\n // adding element to the queue \n this.items.push(element);\n }", "enqueue(element) {\n // adding element to the queue \n this.items.push(element);\n }", "enqueue(element) {\n // adding element to the queue \n this.items.push(element);\n }", "queue(initFn, runFn, retargetFn, isTransform) {\n this._queue.push({\n initialiser: initFn || noop,\n runner: runFn || noop,\n retarget: retargetFn,\n isTransform: isTransform,\n initialised: false,\n finished: false\n });\n\n var timeline = this.timeline();\n timeline && this.timeline()._continue();\n return this;\n }", "function __generateQueues(_level){\n animationQueue = [];\n _originalAnimationQueue = [];\n queueOnAction = [];\n currentAnimation = [];\n finishedAnimationQueue = [];\n _layerWaitQueue = [];\n _layerBreakPointWaitQueue = [];\n _userInteractionQueue = [];\n for(var i=0;i<_level;i++){\n animationQueue.push([]);\n _originalAnimationQueue.push([]);\n queueOnAction.push(false);\n currentAnimation.push([]);\n finishedAnimationQueue.push([]);\n _layerWaitQueue.push([]);\n _layerBreakPointWaitQueue.push([]);\n }\n }", "playAnimation() {\n for (var key in this.animations) {\n if (this.animations.hasOwnProperty(key)) {\n this.animations[key].setFinished(false);\n }\n }\n }", "function animationAdded() {\n let animation = document.getElementById('addToCartAnimId');\n let delay = 1500;\n\n animation.className = 'addToCartAnimated';\n setTimeout(function () {\n animation.className = 'addToCartAnim';\n }, delay)\n}", "function animationManager () {\n for (var i = tasks.length; i--;) {\n if (tasks[i].step() == false) {\n // remove animation tasks\n logToScreen(\"remove animation\");\n tasks.splice(i, 1);\n }\n }\n }", "addToQueue(f, pushFront = false) {\n if (pushFront) {\n this.commandQueue.unshift(f);\n }\n else {\n this.commandQueue.push(f);\n }\n }", "function runQueue() {\n if(queue.length) {\n const f = queue.shift();\n window.setTimeout(() => {\n f();\n runQueue();\n }, 50);\n }\n }", "function animate() {\n var timeNow = new Date().getTime();\n\n if (animate.timeLast) {\n var elapsed = timeNow - animate.timeLast;\n\n\n for (var i = 0; i < items.length; i++) {\n items[i].animate();\n }\n }\n animate.timeLast = timeNow;\n}", "[types.ADDMESSAGEQUEUE](state, queue) {\n state.messageQueue.push(queue)\n }", "initAnimations() {\n this.animations = new Map();\n\n for (let [id, animation] of this.graph.animations) {\n let anim = new MyKeyframeAnimation(animation.keyframes);\n this.animations.set(id, anim);\n }\n }", "function processQueue () {\n queue.forEach(function (func) { $mdUtil.nextTick(func); });\n queue = [];\n }", "function processQueue () {\n queue.forEach(function (func) { $mdUtil.nextTick(func); });\n queue = [];\n }", "function processQueue () {\n queue.forEach(function (func) { $mdUtil.nextTick(func); });\n queue = [];\n }", "function processQueue () {\n queue.forEach(function (func) { $mdUtil.nextTick(func); });\n queue = [];\n }", "createAnimation() {\n this.scene.anims.create({\n key: 'bullet-hit',\n frames: this.scene.anims.generateFrameNumbers('bullet-hit', {\n start: 0,\n end: 10\n }),\n frameRate: FRAMERATE\n });\n }", "add(job) {\n this.queue.push(job);\n }", "enqueue(item) {\n this.items.push(item); // adds an item to the queue\n }", "function doAnimations (animations, oldPos, newPos) {\n if (animations.length === 0) return\n\n var numFinished = 0\n function onFinishAnimation3 () {\n // exit if all the animations aren't finished\n numFinished = numFinished + 1\n if (numFinished !== animations.length) return\n\n drawPositionInstant()\n\n // run their onMoveEnd function\n if (isFunction(config.onMoveEnd)) {\n config.onMoveEnd(deepCopy(oldPos), deepCopy(newPos))\n }\n }\n\n for (var i = 0; i < animations.length; i++) {\n var animation = animations[i]\n\n // clear a piece\n if (animation.type === 'clear') {\n $('#' + squareElsIds[animation.square] + ' .' + CSS.piece)\n .fadeOut(config.trashSpeed, onFinishAnimation3)\n\n // add a piece with no spare pieces - fade the piece onto the square\n } else if (animation.type === 'add') {\n $('#' + squareElsIds[animation.square])\n .append(buildPieceHTML(animation.piece, true))\n .find('.' + CSS.piece)\n .fadeIn(config.appearSpeed, onFinishAnimation3)\n\n // move a piece from squareA to squareB\n } else if (animation.type === 'move') {\n animateSquareToSquare(animation.source, animation.destination, animation.piece, onFinishAnimation3)\n }\n }\n }", "animationHelper(animations, speedF) {\n const arrayBars = document.getElementsByClassName(\"array-bar\");\n\n this.postAnimation(animations.length, speedF);\n\n for (let i = 0; i < animations.length; i++) {\n const [barOneIndex, barTwoIndex] = animations[i];\n const barOneStyle = arrayBars[barOneIndex].style;\n const barTwoStyle = arrayBars[barTwoIndex].style;\n if (i % 2 === 0) {\n setTimeout(() => {\n animations.pop();\n barOneStyle.backgroundColor = \"yellowgreen\";\n barTwoStyle.backgroundColor = \"yellowgreen\";\n let tempHeight = barOneStyle.height;\n barOneStyle.height = barTwoStyle.height;\n barTwoStyle.height = tempHeight;\n }, (i + 1) * speedF);\n }\n else {\n setTimeout(() => {\n animations.pop();\n barOneStyle.backgroundColor = \"#20232a\";\n barTwoStyle.backgroundColor = \"#20232a\";\n }, (i + 1) * speedF);\n }\n }\n }", "function enqueue(newElement){\n queue.push(newElement);\n }", "enqueue(item) {\n queue.unshift(item);\n }", "enqueue(item) {\n queue.unshift(item);\n }", "enqueue(item) {\n this.queue.push(item);\n this.size += 1;\n }", "traverseQueue() {\n if (this.queue.length > 0) {\n /* Get the next index */\n const data = this.queue[0];\n /* compare cached version to next props */\n this.interpolator = d3.interpolate(this.state, data);\n timer(this.functionToBeRunEachFrame, this.props.delay);\n } else if (this.props.onEnd) {\n this.props.onEnd();\n }\n }", "function EventsQueue() {}", "function AnimationFrameStack() {\n var me = this;\n\n this.init = function(){\n if (!window){\n console.error(\"AnimationFrameStack(): ERROR - Unable to access window!\");\n } else {\n if (!window.aftcAnimStack){\n window.aftcAnimStack = {\n firstRun: true,\n enabled: true,\n stack: [],\n uid: Math.floor(Math.random()*99999)\n }\n }\n }\n\n if (window.aftcAnimStack.firstRun){\n window.aftcAnimStack.firstRun = false;\n this.processFnStack();\n }\n }\n\n this.start = function(){\n window.aftcAnimStack.enabled = true;\n this.processFnStack();\n }\n\n this.stop = function(){\n window.aftcAnimStack.enabled = false;\n }\n\n this.dispose = function(){\n if (window.aftcAnimStack){\n window.aftcAnimStack.enabled = false;\n window.aftcAnimStack.stack = [];\n delete window.aftcAnimStack.stack;\n }\n }\n\n this.processFnStack = function(){\n if (!window.aftcAnimStack.enabled){ return; }\n\n for(let i=0; i < window.aftcAnimStack.stack.length; i++){\n window.aftcAnimStack.stack[i].fn();\n }\n\n window.requestAnimationFrame(me.processFnStack);\n }\n\n this.add = function(uid,fn){\n window.aftcAnimStack.stack.push({\n uid: uid,\n fn: fn\n });\n }\n\n this.remove = function(uid){\n for(let i=0; i < window.aftcAnimStack.stack.length; i++){\n if (window.aftcAnimStack.stack[i].uid === uid){\n // window.aftcAnimStack.stack = arrayRemoveItem(window.aftcAnimStack.stack,fn);\n window.aftcAnimStack.stack.splice(i,1);\n }\n }\n }\n\n this.init();\n}", "animateLevelorderNodes() {\r\n let queue = [];\r\n let nodeQueue = [];\r\n let animations = [];\r\n animations.push(new Animation(\"display\", \"Traversing Levelorder\", \"\"));\r\n\r\n nodeQueue.push(this.root);\r\n\r\n while (nodeQueue.length !== 0) {\r\n const node = nodeQueue.shift();\r\n if (node === null) continue;\r\n queue.push(node);\r\n\r\n // insert animations\r\n if (this.root && !node.isEqual(this.root))\r\n animations.push(new Animation(\"line\", node.key, \"line-highlighted\"));\r\n animations.push(new Animation(\"node\", node.key, \"found-node\"));\r\n\r\n nodeQueue.push(node.left);\r\n nodeQueue.push(node.right);\r\n }\r\n\r\n animations.push(new Animation(\"display\", \"Finished Traversing\", \"\"));\r\n\r\n return [queue, animations];\r\n }", "function addAnimations() {\n images.forEach((element) => {\n element.classList.add('animation');\n })\n\n}", "function __clearObjectAnimationsFromQueues(_obj){ //We may need to pass objects to sleep etc. functions to be able to remove them here\n for(var i=0;i<animationQueue.length;i++){\n for(var j=0;j<animationQueue[i].length;j++){\n if(!animationQueue[i][j]['animation']['object']){\n continue;\n }\n if(animationQueue[i][j]['animation']['object'].selector ==='#'+_obj[0].id){ //TODO something better than concatenating with # ??\n animationQueue[i].splice(j,1);\n }\n }\n }\n }", "moveQueue() {\n if (this.crashed) {\n return;\n }\n if (this.queue.length) {\n this.queue.unshift({\n x: this.x,\n y: this.y\n });\n this.queue.pop();\n }\n }", "enqueue(element) {\n // adding element to the queue\n this.items.push(element);\n }", "function new_queue() {\n let items = [...get_queue(), ...truncated];\n run(items);\n }", "addAnimations() {\n\n // eyes animations (moving eyes of the inspector)\n let frameRate = 50; // frame rate of the animation\n\n // from mid to right\n this.anims.create({\n key: 'midToRight',\n frames: this.anims.generateFrameNames('eyes', {frames: [0, 1, 2, 3, 4, 5]}),\n frameRate: frameRate,\n paused: true\n });\n\n // from right to mid\n this.anims.create({\n key: 'rightToMid',\n frames: this.anims.generateFrameNames('eyes', {frames: [5, 4, 3, 2, 1, 0]}),\n frameRate: frameRate,\n paused: true\n });\n\n // from mid to left\n this.anims.create({\n key: 'midToLeft',\n frames: this.anims.generateFrameNames('eyes', {frames: [0, 6, 7, 8, 9, 10]}),\n frameRate: frameRate,\n paused: true\n });\n\n // from left to mid\n this.anims.create({\n key: 'leftToMid',\n frames: this.anims.generateFrameNames('eyes', {frames: [10, 9, 8, 7, 6, 0]}),\n frameRate: frameRate,\n paused: true\n });\n\n // from left to right\n this.anims.create({\n key: 'leftToRight',\n frames: this.anims.generateFrameNames('eyes', {frames: [10, 9, 8, 7, 6, 0, 1, 2, 3, 4, 5]}),\n frameRate: frameRate,\n paused: true\n });\n\n // from right to left\n this.anims.create({\n key: 'rightToLeft',\n frames: this.anims.generateFrameNames('eyes', {frames: [5, 4, 3, 2, 1, 0, 6, 7, 8, 9, 10]}),\n frameRate: frameRate,\n paused: true\n });\n\n }", "function Queues(){}", "function addAnimation (alpha, trail, i, lines) {\n\t var name = ['opacity', trail, ~~(alpha * 100), i, lines].join('-')\n\t , start = 0.01 + i/lines * 100\n\t , z = Math.max(1 - (1-alpha) / trail * (100-start), alpha)\n\t , prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase()\n\t , pre = prefix && '-' + prefix + '-' || ''\n\n\t if (!animations[name]) {\n\t sheet.insertRule(\n\t '@' + pre + 'keyframes ' + name + '{' +\n\t '0%{opacity:' + z + '}' +\n\t start + '%{opacity:' + alpha + '}' +\n\t (start+0.01) + '%{opacity:1}' +\n\t (start+trail) % 100 + '%{opacity:' + alpha + '}' +\n\t '100%{opacity:' + z + '}' +\n\t '}', sheet.cssRules.length)\n\n\t animations[name] = 1\n\t }\n\n\t return name\n\t }", "function addAnimation (alpha, trail, i, lines) {\n\t var name = ['opacity', trail, ~~(alpha * 100), i, lines].join('-')\n\t , start = 0.01 + i/lines * 100\n\t , z = Math.max(1 - (1-alpha) / trail * (100-start), alpha)\n\t , prefix = useCssAnimations.substring(0, useCssAnimations.indexOf('Animation')).toLowerCase()\n\t , pre = prefix && '-' + prefix + '-' || ''\n\n\t if (!animations[name]) {\n\t sheet.insertRule(\n\t '@' + pre + 'keyframes ' + name + '{' +\n\t '0%{opacity:' + z + '}' +\n\t start + '%{opacity:' + alpha + '}' +\n\t (start+0.01) + '%{opacity:1}' +\n\t (start+trail) % 100 + '%{opacity:' + alpha + '}' +\n\t '100%{opacity:' + z + '}' +\n\t '}', sheet.cssRules.length)\n\n\t animations[name] = 1\n\t }\n\n\t return name\n\t }", "function createObjectAnimations() {\r\n this.anims.create({\r\n key: 'jewelAnims',\r\n frames: this.anims.generateFrameNumbers('jewel', { start: 0, end: 4 }),\r\n frameRate: 10,\r\n repeat: -1,\r\n });\r\n\r\n this.anims.create({\r\n key: 'cherryAnims',\r\n frames: this.anims.generateFrameNumbers('cherry', { start: 0, end: 6 }),\r\n frameRate: 6,\r\n repeat: -1,\r\n });\r\n}", "queue(action){\n Mediator.queue.push(action);\n }", "function processQueue()\r\n{\r\n for(var i = 0 ; i < queue.length ; i++) {\r\n\r\n // get image\r\n loadImage(queue[i].renderer, queue[i].params, queue[i].tag, queue[i].target, false, true, queue[i].sequence);\r\n\r\n // store parameters for image update\r\n var obj = document.getElementById(queue[i].tag2);\r\n if(obj) {\r\n obj.value = queue[i].tag2params;\r\n }\r\n }\r\n\r\n // clear queue\r\n queue = [];\r\n}", "function processQueue() {\n\t\t if (updateQueue.length) {\n\t\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t\t clearQueue();\n\t\t }\n\t\t}", "function processQueue(){\n\t\trequestAnimFrame(processQueue);\n\t\tvar now = Date.now();\n\t\twhile (msgQueue.length > 0 && msgQueue[0].timetag < now){\n\t\t\tvar first = msgQueue.shift();\n\t\t\tif (first.address === \"_set\"){\n\t\t\t\tfirst.data();\n\t\t\t} else {\n\t\t\t\t_send(first);\n\t\t\t}\n\t\t}\n\t\t//send an update message to all the listeners\n\t\tupdateMessage.data = now - lastUpdate;\n\t\t_send(updateMessage);\n\t\tlastUpdate = now;\n\t}", "addFrame(frame) {\n this.frames.push(frame);\n }", "function enqueueChildren(queue, children){\n var len = children.length;\n for (let i = 0; i < len;i++){\n queue.push(children[i]);\n }\n}", "updateAnimations() {\n this.animations.forEach((animation, index) => {\n if (animation.finished) {\n this.animations.splice(index, 1);\n }\n });\n }", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}", "function processQueue() {\n\t if (updateQueue.length) {\n\t ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);\n\t clearQueue();\n\t }\n\t}" ]
[ "0.73108494", "0.69189286", "0.6872656", "0.6602309", "0.6313919", "0.62044454", "0.619323", "0.6176435", "0.6167839", "0.6128189", "0.6041635", "0.6002934", "0.5993195", "0.5976831", "0.5976292", "0.5976292", "0.5961554", "0.5945264", "0.59262663", "0.5842631", "0.5825194", "0.58035046", "0.57844293", "0.5754403", "0.5731055", "0.563462", "0.5612717", "0.5587859", "0.5557148", "0.55567294", "0.5554023", "0.55489856", "0.55417377", "0.55269927", "0.55269927", "0.5518236", "0.55115706", "0.54702914", "0.54693556", "0.54693556", "0.54693556", "0.54661196", "0.54585046", "0.5448823", "0.54447013", "0.5435968", "0.5428137", "0.54208523", "0.5420763", "0.5420762", "0.5415218", "0.5408987", "0.5408987", "0.5408987", "0.5408987", "0.5400061", "0.5395255", "0.53743494", "0.5368662", "0.53622305", "0.5358491", "0.5355543", "0.5355543", "0.53527385", "0.5350758", "0.5348945", "0.5344413", "0.5334245", "0.533407", "0.5330697", "0.5301783", "0.5301389", "0.5298725", "0.52655447", "0.5260037", "0.5249883", "0.5249883", "0.52481264", "0.5243751", "0.5239223", "0.52290374", "0.5224605", "0.5220387", "0.5216388", "0.5205289", "0.51993567", "0.51993567", "0.51993567", "0.51993567", "0.51993567", "0.51993567", "0.51993567", "0.51993567", "0.51993567", "0.51993567", "0.51993567", "0.51993567", "0.51993567", "0.51993567", "0.51993567" ]
0.63671196
4
Moves a card up to mimic mouseover.
function consider(globals, params, q) { animToQueue(q, '#' + globals.cardArray[params].num, {top:'-=' + globals.SELECT_MOVE}, "reveal", globals, params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mouseUp() { }", "onMouseUp(e) {}", "function over(e) {\n // Set the cursor to 'move' wihle hovering an element you can reposition\n e.target.style.cursor = 'move';\n\n // Add a green box-shadow to show what container your hovering on\n e.target.style.boxShadow = 'inset lime 0 0 1px, lime 0 0 1px';\n}", "function moveUp(){\n\t\t\tplayerPosition.x += 1\n\t\t\tplayer.attr({\n\t\t\t\t'cx': playerPosition.x\n\t\t\t})\n\t\t}", "function cardMovement(event) {\n // prevent default action (open as link for some elements)\n event.preventDefault();\n // move dragged element to the selected drop target\n let cardName = dragged.parentNode.className;\n let cardNum = parseFloat(cardName.slice(0, 3));\n let left = cardNum - 1 + \"_card\";\n let right = cardNum + 1 + \"_card\";\n let up = cardNum - 6 + \"_card\";\n let down = cardNum + 6 + \"_card\";\n\n if (event.target.className != \"card\") {\n if (\n event.target.className == left ||\n event.target.className == right ||\n event.target.className == up ||\n event.target.className == down\n ) {\n event.target.style.background = \"\";\n dragged.parentNode.removeChild(dragged);\n event.target.appendChild(dragged);\n }\n }\n}", "function cardUp() {\n openList.push($(this).children('i').attr('class'));\n counter++;\n $('.moves').html(Math.floor(counter / 2));\n startTimer();\n //once two cards are choosen\n if (openList.length === 2) {\n stars();\n modalStars();\n //if matched\n if (openList[0] === openList[1]) {\n matched();\n matchCount++;\n matchingCards.push(matchCount);\n if (matchingCards.length == 8) {\n winner();\n }\n //no match\n } else {\n unMatched();\n }\n }\n }", "mouseUp(pt) {}", "mouseUp(pt) {}", "over()\n {\n this.y -= 5;\n }", "function stepCardUp() {\n switchCard(activeCard + 1);\n}", "up () {\n let first = this.props.game.getTileList();\n this.props.game.board.moveTileUp();\n let second = this.props.game.getTileList();\n if (this.moveWasLegal(first, second) === false) {\n this.updateBoard();\n return;\n } else {\n this.props.game.placeTile();\n this.updateBoard();\n }\n }", "moveUp(amount) {\n this.y += amount;\n }", "moveUp(amount) {\n this.y += amount;\n }", "function up(object){\n object.y -= speed;\n }", "_onMouseUp() {\n if (this._animationFrameID) {\n this._didMouseMove();\n }\n this._onMoveEnd();\n }", "function animateUpArrow() {\n\t$(\".back-to-top\").mouseover(function() {\n\t\t$(\".fa-long-arrow-alt-up\").css(\"animation\", \"arrow-up 1s ease-in-out infinite\");\n\t});\n\t$(\".back-to-top\").mouseout(function() {\n\t\t$(\".fa-long-arrow-alt-up\").css(\"animation\", \"none\");\n\t});\n}", "moveUp() {\n dataMap.get(this).moveY = -5;\n }", "function MouseUpEvent() {}", "function moveUp() {\n if (images.bird.yPos > 25) {\n images.bird.yPos -= 25;\n }\n sounds.fly.play();\n }", "function up(){\n turd.css('top', parseInt(turd.css('top')) - 10);\n }", "hover(item, monitor) { //função chamada quando eu passar um card por cima de outro. Item é qual cart estou arrastando\n const draggedListIndex = item.listIndex; \n const targetListIndex = listIndex; //lista que está recebendo o novo item\n\n const draggedIndex = item.index;//index do item que está sendo carregado\n const targetIndex = index; //para qual item estou arrastando\n \n if (draggedIndex === targetIndex && draggedListIndex === targetListIndex){\n return; //se o usuário está arrastando o card para cima dele mesmo não faz nada\n };\n\n const targetSize = ref.current.getBoundingClientRect(); //retornando o tamanho do elemento\n const targetCenter = (targetSize.bottom - targetSize.top) /2; //calculando o ponto central do card\n\n const draggedOffset = monitor.getClientOffset(); //verifica o quanto do item arrastei \n const draggedTop = draggedOffset.y - targetSize.top;\n\n //se o item que estou arrastando veio antes do item que recebeu o arraste em cima, e a posição do dragget for menor que o centro do card\n if (draggedIndex < targetIndex && draggedTop < targetCenter) {\n return;\n };\n\n //se o item que estou arrastando veio depois do item que recebeu o arraste em cima, e a posição do dragget for maior que o centro do card\n if (draggedIndex > targetIndex && draggedTop > targetCenter) {\n return;\n };\n\n move(draggedListIndex, targetListIndex, draggedIndex, targetIndex);\n \n item.index = targetIndex; //mudando o index do item que foi movido\n item.listIndex = targetListIndex; //mudando o index da lista para onde o item foi arrastado\n }", "onMouseUp (e) {\n if (this.isMouseDown) {\n this.isMouseDown = false;\n this.emit('mouse-up', normaliseMouseEventToElement(this.canvas, e));\n }\n }", "hover({ id: draggedId }) {\n if (draggedId !== id) {\n console.log('hover',)\n const { index: overIndex } = findCard(id);\n moveCard(draggedId, overIndex);\n }\n }", "_onMouseUp () {\n Actions.changeDragging(false);\n }", "async hover() {\n await this._actions().mouseMove(this.element()).perform();\n await this._stabilize();\n }", "function up()\n{\n if(gameIsOn)\n {\n if(pos > 110)\n {\n pos-= speed;\n shark.style.top= pos + \"px\";\n }\n }\n}", "function move_up() {\n\t check_pos();\n\t blob_pos_y = blob_pos_y - move_speed;\n\t}", "function moveBack(){\n\t\telem.style.bottom = 0 + \"%\";\n\t\telem.style.right = 0 + \"%\";\n document.getElementById(clickedCardId).style.zIndex = 0; \t// The key card is set back to it's initial z-value\n\t\tcreateCard(contextPlayCard, playCard); \t\t\t\t\t// A new play card is created and displayed on the canvas\n\t\tclickable = true; \t\t\t\t\t\t\t\t\t\t// Clickable is set to true, so that a new card can be clicked\t\n\t}", "function handleHover(globals, cardClass) {\n var speed = globals.SELECT_SPEED;\n var move = globals.SELECT_MOVE;\n var maxCard = globals.maxCard;\n\n $(cardClass).hover(function () {\n if (!$(this).is(\":animated\")) {\n // Card goes up when mouse enters\n $(this).animate({top:'-=' + move}, speed);\n }\n }, function () {\n // Card sinks down when mouse leaves\n $(this).animate({top:'0px'}, speed);\n if (globals.maxCard != undefined){\n maxPosition(globals);\n }\n });\n}", "mouseMove(evt, point) {\n this.setHover(this.topBlockAt(point));\n }", "moveUpNext() {\r\n this.movement.y = -this.speed;\r\n this.move();\r\n }", "function mouseOut()\n{\n\tthis.className = this.className.replace(\"movablepiece\",'');\n\t//alert(\"Out:\" + this.id);\n}", "function onUp(event) {\n moveFilter(msgMoveMotion.Up);\n}", "function hoverOutCanvas() {\n onMouseUp();\n canvas.unmousedown(onMouseDown);\n }", "function moveRocketUp(target){\n\n target.style.order = '-1' + clickCount;\n clickCount++;\n \n console.log('clicked')\n}", "function moveUp(oEvent) {\n\t\tmoveSelectedItem.call(this, \"Up\");\n\t\toEvent.getSource().focus();\n\t}", "function mortyUp(){\n\tmUp -= 1;\n\t$('#morty').css('top', mUp+\"em\");\n}", "function mouseUp(e) {\n mousePress(e.button, false);\n}", "function mouseOverCard(){\n var delete_button = this.querySelector('button');\n transition(delete_button);\n delete_button.style.opacity = 1;\n}", "moveUp(){\n this.y -= 7;\n }", "moveUp() {\n this.y>0?this.y-=83:false;\n }", "function elOver() {\n // Verify if the card is showing front or back\n // if is front -> do the animation\n // if is back -> do the reverse animation\n if($(this).children(\".turned\")[0].innerText == \"front\"){\n $(this).children(\".turned\")[0].innerText = \"back\";\n this.animation.play();\n }else{\n $(this).children(\".turned\")[0].innerText = \"front\";\n this.animation.reverse();\n }\n}", "movedown() {\n\n this.posY = this.posY + 10; //change\n if (spiel.cover != null) {\n if (this.posY >= 280 && spiel.cover.length > 0) {\n\n document.getElementById('playerExp').play();\n spiel.cover[0].explode();\n spiel.cover.splice(0, 1);\n }\n }\n }", "onMouseUp(event) {\n this.setState({ moving: false });\n event.stopPropagation();\n event.preventDefault();\n }", "function mouseOver() {\n\t\tif (canMove(this)) {\n\t\t\tthis.className = \"piece hover\";\n\t\t}\n\t}", "onButtonUp() {\n\t\tif(character.isClicked) {\n\t\t\tcharacter.sprite.y += 100;\n\t\t\tcharacter.isClicked = false;\n\t\t}\n\t}", "function moveDown(){\n undraw()\n currentPosition += width\n // gameOver()\n draw()\n freeze()\n }", "hoverOverProductListingCard() {\n this\n .waitForElementVisible('@productListingCard', () => {\n this\n .moveToElement('@productListingCard', 100, 100);\n });\n return this;\n }", "function _onDragOver(e) {\n\n\t\t\t\t//disable default event behavior\n\t\t\t\te.preventDefault();\n\n\t\t\t\t//change cursor icon\n\t\t\t\te.dataTransfer.dropEffect = 'move';\n\n\t\t\t\tconsole.log(\"dragging: \" + dragEl.tagName);\n\n\t\t\t\t//target that triggered the event (note: it isn't the one that is being dragged)\n\t\t\t\tvar target = e.target;\n\n\t\t\t\t//choosing if the destination target is suitable to change its position in the album list\n\t\t\t\t//with the dragged element\n\t\t\t\tif( target && target !== dragEl && target.getAttribute(\"sortable\") === \"true\" ){\n\n\t\t\t\t\tvar rect = target.getBoundingClientRect(); //target card rect (used to get its size on screen)\n\t\t\t\t\tvar next = (e.clientY - rect.top)/(rect.bottom - rect.top) > .5; //true if we are up the target that triggered the event\n\n\t\t\t\t\t//thanks to \"next\" we understand where to put in the albumList the dragged album\n\t\t\t\t\trootEl.insertBefore(dragEl, next && target.nextSibling || target);\n\n\t\t\t\t}\n\t\t\t}", "function mouseOut() {\n\t\tif (canMove(this)) {\n\t\t\tthis.className = \"piece normal\";\n\t\t}\n\t}", "function moveUp(){ \n //paintSnake(x,10,\"#9c9\");\n paintSnake(x,y+10,\"#9c9\");\n paintSnake(x,y,\"black\");\n y = y - 10;\n return y;\n }", "onMouseUp(event) {\n\t\t// console.log(\"mouse up\");\n\t\tthis.props.setIsDrawing(false);\n\t}", "onMouseUp(event) {\n\t\tcurrentEvent = event\n\t\tthis.isClicked = false\n\t\tthis.render()\n\t}", "onMouseOut_() {\n this.updateHoverStying_(false);\n }", "async up(options = {}) {\n const { button = 'left', clickCount = 1 } = options;\n this._button = 'none';\n await this._client.send('Input.dispatchMouseEvent', {\n type: 'mouseReleased',\n button,\n x: this._x,\n y: this._y,\n modifiers: this._keyboard._modifiers,\n clickCount,\n });\n }", "async up(options = {}) {\n const { button = 'left', clickCount = 1 } = options;\n this._button = 'none';\n await this._client.send('Input.dispatchMouseEvent', {\n type: 'mouseReleased',\n button,\n x: this._x,\n y: this._y,\n modifiers: this._keyboard._modifiers,\n clickCount,\n });\n }", "moveUp() {\n this.point.y -= this.scrollSpeed;\n }", "shftUp(event) {\n // console.log(event)\n if (this.lineData.$parent.getIndexOfSon(this.lineData) != 0) {\n this.lineData.$parent.moveSonUp(this.lineData);\n }\n }", "function mouseUp(e) {\n removeMoveListener();\n removeUpListener();\n _callbacks.end.forEach(function(callback) {\n callback.call();\n });\n }", "function moveUp(){\n \n playerTank.body.velocity.y = -120;\n playerTank.animations.play('up');\n direction = 'up';\n playerTank.body.velocity.x = 0;\n}", "function update() {\r\n\r\n\tif ( this.cursors.left.isDown )\r\n this.card.x -= 4;\r\n\telse if ( this.cursors.right.isDown )\r\n this.card.x += 4;\r\n\r\n\r\n if ( this.cursors.up.isDown )\r\n this.card.y -= 4;\r\n else if ( this.cursors.down.isDown )\r\n this.card.y += 4;\r\n\r\n this.game.world.wrap( this.card, 0, true );\r\n}", "mouseUp(x, y, _isLeftButton) {}", "function moveUp() {\n //your code\n const fromFridge = fridge.pop();\n if (fromFridge) {\n buyList.push(fromFridge);\n updateDisplay();\n } else {\n return;\n }\n}", "function go_down(){\n turd.css('top', parseInt(turd.css('top')) + 8);\n }", "function dragEnter(e) {\n $(this).addClass(\"over\");\n}", "up() {\n this.y -= this.speed;\n this.comprobarLimitesBarra();\n }", "_onPointerOver() {\n this.addState(\"hovered\");\n }", "moveUp() {\n if (this.y === 0) {\n this.y = this.tape.length - 1;\n } else {\n this.y--;\n }\n }", "_onPointerOut() {\n this.removeState(\"hovered\");\n }", "function pointer_overIN(e){\n e.currentTarget.Sprites.d._filters = [new PIXI.filters.OutlineFilter (4, 0x16b50e, 1)];\n $mouse.onCase = e.currentTarget;\n }", "function moveDown()\r\n {\r\n undraw()\r\n currentPosition += width\r\n draw()\r\n freeze()\r\n addScore()\r\n gameOver()\r\n }", "function CanvasMouseup(action) {\n if (mouseMoved) {\n var x = action.offsetX / scrollOffset[2] + scrollOffset[0] - resizeOffset[0];\n var y = action.offsetY / scrollOffset[2] + scrollOffset[1] - resizeOffset[1];\n var diffX = x - mouseMovement[0];\n var diffY = y - mouseMovement[1];\n if (selectedSpots.length > 0) {\n // Update Spots' Locations\n for (var _i = 0, selectedSpots_2 = selectedSpots; _i < selectedSpots_2.length; _i++) {\n var spot = selectedSpots_2[_i];\n spot.X = spot.XRight += diffX;\n spot.Y = spot.YDown += diffY;\n }\n }\n else {\n // Update Pieces' Spots Locations\n for (var _a = 0, selectedPieces_2 = selectedPieces; _a < selectedPieces_2.length; _a++) {\n var piece = selectedPieces_2[_a];\n for (var _b = 0, _c = piece.Data; _b < _c.length; _b++) {\n var spot = _c[_b];\n spot.X = spot.XRight += diffX;\n spot.Y = spot.YDown += diffY;\n }\n }\n }\n Redraw();\n }\n mouseMovement = null;\n mouseMoved = false;\n}", "function moveup() {\r\n player.dy = -player.speed;\r\n}", "function moveDown() {\n\n}", "_strikePointerUp() {\n for (let i = 0; i < this._pointerUpCallbacks.length; i++) {\n let currentCallback = this._pointerUpCallbacks[i][0];\n\n currentCallback(this, event);\n }\n\n for (let i = 0; i < this._pointerUpCallbacks.length; i++) {\n if (this._pointerUpCallbacks[i][1])\n this._pointerUpCallbacks.splice(i--, 1);\n }\n }", "async mouseAway() {\n await this._actions().mouseMove(this.element(), { x: -1, y: -1 }).perform();\n await this._stabilize();\n }", "function mouseup(e) {\r\n fsw_state = 0;\r\n ui_modified = true;\r\n}", "function upDownEvent(e) {\n e = e || window.event;\n let newImagePointer = imagePointer; // Index of new image which we display\n if (e.keyCode == \"38\") {\n // up\n newImagePointer = Math.max(0, newImagePointer - 1);\n } else if (e.keyCode == \"40\") {\n // down\n newImagePointer = Math.min(imageContainer.length - 1, newImagePointer + 1);\n }\n switchImage(imagePointer, newImagePointer);\n}", "function mouseup() {\n if (!_this.props.mousedownNode && !_this.props.mousedownLink) {\n _this.resetSelected()\n }\n // avoid firing off unnecessary actions\n else {\n _this.props.onMousedownNodeUpdate(null)\n _this.props.onMousedownLinkUpdate(null)\n }\n }", "function rickUp(){\n\trUp -= 1;\n\t$('#rick').css('top', rUp+\"em\");\n}", "function onMouseUp(event) {\n\tpuzzle.releaseTile();\n}", "function onMouseUp() {\n // sets the new location to default till moved again\n mouseDown = false;\n }", "mouseDownUp(start, end) {}", "onMouseOver_() {\n if (this.isOpenable_()) {\n this.updateHoverStying_(true);\n }\n }", "function mouseUp(){\r\n isDown = false;\r\n box.style.border = 'none';\r\n }", "_onMouseUpWithHandMode() {\n const canvas = this.getCanvas();\n const { moveHand, stopHand } = this._listeners;\n\n canvas.off({\n 'mouse:move': moveHand,\n 'mouse:up': stopHand,\n });\n\n this._startHandPoint = null;\n }", "function mouseUp (e) {\n if (onplayhead === true) {\n moveplayhead(e)\n window.removeEventListener('mousemove', moveplayhead, true)\n // change current time\n player.currentTime = player.duration * clickPercent(e, timeline, timelineWidth)\n player.addEventListener('timeupdate', timeUpdate, false)\n }\n if (onVolhead === true) {\n console.log('Vol Up')\n moveVolHead(e)\n window.removeEventListener('mousemove', moveVolHead, true)\n // change current time\n player.volume = volPercent(e)\n }\n onVolhead = false\n onplayhead = false\n $('*').removeClass('nonselectable')\n }", "onMouseUp(event) {\n this.internalEnd(false, event);\n }", "onMouseUp(event) {\n this.internalEnd(false, event);\n }", "function mouseUpCanvas() {\n mouseDownPos.down = false;\n mouseDownPos.origRot = mouseDownPos.newRot;\n }", "function dragEnter(col) {\r\n itemLists[col].classList.add(\"over\");\r\n\r\n currentColumn = col;\r\n }", "function mouseUp(event) {\n if (onplayhead == true) {\n moveplayhead(event);\n window.removeEventListener('mousemove', moveplayhead, true);\n // change current time\n clip.currentTime = duration * clickPercent(event);\n clip.addEventListener('timeupdate', timeUpdate, false);\n }\n onplayhead = false;\n}", "function zIndexUp() {\n\t\t\tel.style.zIndex = 2;\n\t\t}", "function turnOver(card) {\n for (card=0; card < cardArray.length; card++) {\n if (cardArray[card].classList.contains(\"match\") === false) {\n cardArray[card].classList.remove(\"card-image\");\n cardArray[card].classList.remove(\"unclickable\");\n cards.classList.remove(\"unclickable\");\n }\n }\n}", "function moveUp() {\n\tconsole.log(\"Scroll up\");\n\trobot.scrollMouse(0, 20);\n}", "function mouseover() {\r\n\t// if the piece is movable, give a class name \"highlight\"\r\n\tif(movable(this)) {\r\n\t\tthis.className = \"highlight\";\r\n\t\t// if not, remove the class name \"highlight\"\r\n\t\t} else {\r\n\t\tthis.removeClassName(\"highlight\");\r\n\t}\r\n}", "function turnCardUp(numCard) {\n\n // let imgCard = newGame.imgCardID + numCard;\n let imgCard = 'back' + numCard.dataset.card;\n document.getElementById(imgCard).src = newGame.deckArray[numCard.dataset.card - 1];\n flipSound.play();\n numCard.parentNode.parentNode.classList.add('is-flipped');\n\n newGame.checkCards.push(numCard.dataset.card);\n if (newGame.firstCard) {\n newGame.firstCard = false;\n }\n else {\n newGame.board.classList.add('no-click');\n newGame.firstCard = true;\n displayMoves();\n compareCards();\n displayFoundPairs();\n }\n}", "function Agent_MouseOver(elem) {\r\n\r\n if (g_AgentDisabled)\r\n return;\r\n\r\n // If we don't have Agent, we're done\r\n\r\n if (null == g_AgentCharacter)\r\n return;\r\n\r\n if (g_bAgentIgnoreEvents || g_bAgentInternalIgnoreEvents)\r\n return;\r\n\r\n // If the character is hidden, we're done\r\n\r\n if (!g_AgentCharacter.Visible)\r\n return;\r\n\r\n if (g_strAgentCurrentPage == \"\")\r\n return;\r\n\r\n Agent_StopAll();\r\n\r\n Agent_MoveToElement(elem, \"TopCenterWidth\", 0);\r\n\r\n Agent_StartLookingAtElement(elem, \"Look\" + \"Down\");\r\n\r\n}", "function mouseUp(event) {\n const key = keys[keyIndexById(this.id)].key;\n if (keyIsValid(key)) {\n removeActiveClasses(key);\n executeKey(key);\n }\n}", "function mouseOver() {\n setMouseOver(true);\n }", "prev() {\n --this.move_index; //decrease move count\n this.draw_everything();\n }" ]
[ "0.6505599", "0.64355415", "0.64339775", "0.6355162", "0.6273372", "0.6264013", "0.6259771", "0.6259771", "0.6254348", "0.6240024", "0.62064296", "0.6192178", "0.6192178", "0.61564434", "0.6145803", "0.6122854", "0.61192125", "0.6097186", "0.6096158", "0.6090497", "0.6073136", "0.60522693", "0.6041336", "0.60395217", "0.60334367", "0.6026405", "0.6024964", "0.6023095", "0.60122263", "0.6007726", "0.59877497", "0.59549737", "0.59462804", "0.5942213", "0.5939101", "0.5935315", "0.59242576", "0.5919819", "0.5915428", "0.59149605", "0.59092164", "0.590032", "0.58891076", "0.5885749", "0.58755857", "0.586449", "0.5855453", "0.58432895", "0.5830192", "0.5830037", "0.582907", "0.5827076", "0.582579", "0.58167064", "0.58110595", "0.58110595", "0.58028394", "0.5801494", "0.5794593", "0.5785717", "0.57776105", "0.57770586", "0.5765533", "0.5759796", "0.5747328", "0.57439053", "0.5733938", "0.5729677", "0.57278067", "0.5693693", "0.5689598", "0.5688547", "0.5686492", "0.568242", "0.5670597", "0.56684035", "0.5664623", "0.5656927", "0.5655903", "0.56550425", "0.5650252", "0.564613", "0.5637443", "0.56370527", "0.56294245", "0.5622638", "0.56197995", "0.5619012", "0.5619012", "0.5618538", "0.56148845", "0.56050247", "0.56048226", "0.56027114", "0.5602351", "0.5595821", "0.5593315", "0.5592264", "0.558403", "0.5582794", "0.55743265" ]
0.0
-1
Stop considering a card
function unconsider(globals, params, q) { animToQueue(q, '#' + globals.cardArray[params].num, {top:'0px'}, "flip", globals, params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "loseCard(card) {\n this.numCards -= 1;\n if (this.numCards <= 0) {\n this.out = true;\n this.cards.pop();\n } else {\n if (this.cards[0] === card) {\n this.cards.shift();\n } else if (this.cards[1] === card) {\n this.cards.pop();\n }\n }\n }", "function endCardAnimation() {\n\t$(\".computer-card\").removeClass(\"animated-card\");\n\tanimating = false;\n\tif (!training && disabled) {\n\t\tenableButtons();\n\t}\n}", "playCard(card) {\n this.removeCards([card]);\n }", "card_startStopCommenting(card){\n card.commenting=!card.commenting;\n }", "function outOfPlay(){\n\n\t$.each(trackedCards,function(i, card){\n\t\t$(\".flipped\").off(\"click\", flipCard);});\n\t\ttrackedCards = [];\n\t\tcardsInPlay = [];\n\n}", "function deathCard(){\n//running through array of cards \n\tfor (var i = 0; i < cards.length; i++) {\n//checks each individual card with for the class for selectedCard \n\t\tif (cards[i].classList.contains(\"selectedCard\")){\n//if the condition is true its going to remove selectedCard\t\t\t\n\t\t\tcards[i].classList.remove(\"selectedCard\")\n\t\t\n\t\t};\n\t}\n}", "dropCard(card){\n if (card > this.hand.length-1){\n console.log(\"ERROR: Card is not in Deck array!\");\n } else {\n this.hand.splice(card, 1);\n }\n return;\n }", "function turnOver(card) {\n for (card=0; card < cardArray.length; card++) {\n if (cardArray[card].classList.contains(\"match\") === false) {\n cardArray[card].classList.remove(\"card-image\");\n cardArray[card].classList.remove(\"unclickable\");\n cards.classList.remove(\"unclickable\");\n }\n }\n}", "card_startStopTodoing(card){\n card.todoing=!card.todoing;\n }", "function disableCardClick() {\n setTimeout(() => {\n $(\".matched\").off(\"click\", clearCardInPlay);\n }, 500);\n }", "function noMatch() {\n let flipCardAnimation = document.querySelectorAll(\".flip-card-animation\");\n\n flipCardAnimation[0].classList.remove(\"flip-card-animation\");\n flipCardAnimation[1].classList.remove(\"flip-card-animation\");\n openedCards.length = 0;\n // prevent Cards from being clicked while turning.\n stopEventListener();\n}", "function ifNotMatching() {\n playAudio(tinyWhip);\n // hide cards that are open\n for (c of open) {\n c.card.classList.remove('open', `level${currentLevel}`); // flip cards back over\n }\n resetOpen();\n}", "_killCard(card) {\n const index = this.cards.getChildIndex(card);\n this.cards.removeChild(card);\n this.map[index].empty = true;\n }", "function notMatched() {\n checkCards[0].classList.remove(\"open\", \"show\");\n checkCards[1].classList.remove(\"open\", \"show\");\n \n checkCards = [];\n \n cardsBoard.classList.remove(\"stop-event\");\n}", "disableCards() {\n this.matchCount = this.matchCount + 1;\n this.counter.innerHTML = this.matchCount;\n this.firstCard.removeEventListener('click', this.flipCard);\n this.secondCard.removeEventListener('click', this.flipCard);\n this.resetBoard();\n }", "function uncoverCard() {\n\t// to store id of clicked card\n\tlet clickedCard = this.id;\n\tdocument.getElementById(clickedCard).classList.add(\"card-rotate\");\n}", "function disableCards(){\n // removes ability to flip the cards back over.\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n // add to matched cards counter\n matchedCards++;\n // reset the board \n resetBoard();\n}", "noMatch(card1, card2) {\n this.busy = true;\n setTimeout(() => {\n card1.classList.remove('visible');\n card2.classList.remove('visible');\n this.busy = false;\n }, 1000);\n }", "function endGame(){\n $('.card-container').removeClass(\"selected-card\");\n $('.card-container').remove();\n while(model.getCardObjArr().length > 0){\n model.removeFromCardObjArr(0);\n }\n\n while(model.getDisplayedCardArr().length > 0){\n model.removeFromDisplayedCardArr(0)\n }\n\n while(model.getSelectedCardObjArr().length > 0){\n model.removeFromSelectedCardArr(0)\n }\n if(($(\".card-display-container\").find(\".game-over-page\").length) === 0){\n createGameOverPage();\n createWinnerPage();\n } else {\n return;\n }\n }", "function noPair () {\n openCards[0].classList.add(\"noPair\");\n openCards[1].classList.add(\"noPair\");\n /*stops the possibility of clicking a third card*/\n disable();\n /*delay of animation after clicking two cards*/\n setTimeout (function(){\n openCards[0].classList.remove(\"show\", \"open\", \"noPair\");\n openCards[1].classList.remove(\"show\", \"open\", \"noPair\");\n /*when it isnt a match, allow player to click again on the cards*/\n enable();\n openCards = [];\n /*time of animation*/\n },600);\n }", "function recoverCards() {\n // set the stopEvents to true to prevent the user from interact intel the function end\n stopEvents = true;\n setTimeout(function() {\n firstCard.classList.remove('flip');\n secondCard.classList.remove('flip');\n // And reset the whole variables And Booleanes to the Default including The stopEvents booleane by calling the resetVars() Function\n resetVars();\n }, 1500);\n}", "function removeCards() {\n // console.log(\"The cards do not match\");\n displaySymbol(openCards[0]);\n displaySymbol(openCards[1]);\n // Reset open card array so it includes a new pair of cards\n openCards = [];\n}", "function untapCards(previousCard, currentCard) {\n turnedCards.pop();\n $(previousCard.dom).toggleClass(\"not-match shake-card\");\n $(currentCard.dom).toggleClass(\"not-match shake-card\");\n\n setTimeout(function () {\n $(previousCard.dom).toggleClass(\"open not-match shake-card\");\n $(currentCard.dom).toggleClass(\"open not-match shake-card\");\n }, 500);\n}", "cardNotmatch(card1, card2) {\n this.busy = true;\n setTimeout(() => {\n card1.classList.remove('visible');\n card2.classList.remove('visible');\n this.busy = false;\n }, 1000);\n }", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n winner();\n }", "function resetCards () {\n /*Close imgs*/\n for(let i = 0; i < countCards; i++) {\n cardsField.children[i].style.backgroundImage = 'none';\n cardsField.children[i].className = \"\";\n }\n selectedCards = [];\n pause = false;\n \n /*Check for End*/\n if (deletedCards == countCards) {\n resetBlock.style.display = \"block\";\n for(var j = 0; j < countCards; j++){\n /* delete elements li */\n cardsField.removeChild(document.getElementById(j));\n }\n }\n }", "function NonMatch(card) {\n setTimeout(function () {\n cardOnDeck.forEach(function (card) {\n card.classList.remove('open', 'show', 'visited', 'nonmatch');\n\n // remove the syle\n card.style.backgroundColor = \"\";\n });\n\n // set cardOnDeck to empty.\n cardOnDeck = [];\n }, 500);\n}", "function disableMatchedCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n }", "function hideCard() {\n for (let card of currCards) {\n card.className = 'card';\n }\n\n currCards.pop();\n currCards.pop();\n openedCards.pop();\n openedCards.pop();\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n\n resetBoard();\n }", "onCardClosed(cardNum) {\n if (cardNum === this.openCard) this.openCard = null\n }", "function DestroyCurrCard() {\n mc.off('press panstart panmove');\n mc.off('pressup panend');\n\n mc.destroy();\n currCard.remove();\n\n ResetSongVars();\n SliderPercentage(0);\n}", "function playCard(data) {\n var ownCards = $('#ownCards');\n var playedCard = $('#' + data['card'].id);\n //remove the played card\n ownCards.remove(playedCard);\n //play card effect\n playCardEffect(data['card'].id, data['card'].color, data['card'].card_type,\n data['card'].img_src, \"bounceInUp\");\n document.getElementById(\"currentColor\").removeAttribute(\"class\");\n $('#currentColor').addClass(data['card'].color);\n globalCurrentColor = data['card'].color;\n //action card and wild card effect\n actionAndWildCardEffect(data['card'].card_type);\n //reorganize own cards\n ownCards.html(\"\");\n document.getElementById('minEmptyIndex').value = 0;\n var cards = data['own_cards'];\n if (cards.length < 10) {\n $('#cardDistance').val(\"60\");\n }\n for (var i = 0; i < cards.length; i++) {\n getOneCard(cards[i], \"\");\n }\n waitUNO = true;\n // console.log(\"waiting uno..\");\n\n setTimeout(function () {\n waitUNO = false;\n // console.log(\"remove waiting uno..\");\n }, 4000);\n}", "function disableCards(){\n let name = secondCard.dataset.name;\n player.innerHTML = name;\n firstCard.removeEventListener(\"click\", flipCard);\n secondCard.removeEventListener(\"click\", flipCard);\n player.classList.add(\"active\");\n resetBoard();\n setTimeout(gameFinished,1000);\n setTimeout(()=>{\n player.classList.remove(\"active\");\n },2000)\n}", "close() {\n this.card.close();\n }", "function listenAgain() {\n debug(\"listenAgain\");\n cards().filter(function(card) {\n return card.className !== \"card mismatch\";\n }).forEach(function(item) {\n item.addEventListener('click', cardMagic);\n })\n }", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n}", "removeCard() { this.df = null; }", "function hideCards () {\n // first add event listeners back to all unmatched cards\n $('.flippable').on('click', function () {\n handleClick($(this));\n })\n //clear all non-matches\n $('.card').removeClass('red');\n $('.flippable').removeClass('show');\n $('.flippable').removeClass('open');\n //reset our arrays\n cardsFlipped = [];\n cardIDs = [];\n showGameResult();\n}", "removeCard(card) {\n this._decks.forEach(deck => deck.removeCard(card));\n return super.removeCard(card);\n }", "function enableClick() {\n for (let x = 0; x < allCards.length; x++) {\n allCards[x].classList.remove(\"stop-event\");\n }\n}", "function disableCards() {\n\n\tfirstCard.removeEventListener('click', flipCard);\n\tsecondCard.removeEventListener('click', flipCard);\n}", "function onDisableCards(e) {\n\t\tuserInterface.disableRestartBtn();\n\n\t\tcards.forEach(card => {\n\t\t\tcard.disableMe();\n\t\t});\n\t}", "function discardCard(numCard){\n\tif(dbg){\n\t\tdebug(\"Discarding card \" + numCard );\n\t}\n\t\n\tvar card;\n\t\n\tif (numCard == 1){\n\t\tcard = card1;\n\t\tcard1 = card4;\n\t\tcard4 = EMPTY;\n\t}\n\telse if (numCard == 2){ \n\t\tcard = card2;\n\t\tcard2 = card4;\n\t\tcard4 = EMPTY;\n\t}\t\n\telse if (numCard == 3){\n\t\tcard = card3;\n\t\tcard3 = card4;\n\t\tcard4 = EMPTY;\n\t}\n\telse{ \n\t\tcard = card4;\n\t\tcard4 = EMPTY;\n\t}\n\t\n\tupdate_hand();\n\tsend_event(EVENT_PUT_CARD, card);\n\tend_turn();\n}", "function matchNegative(){\n\tlet removedElement = cardList.pop();\n\tremovedElement.classList.remove(\"open\");\n\tremovedElement.classList.remove(\"show\");\n\tremovedElement = cardList.pop();\n\tremovedElement.classList.remove(\"show\");\n\tremovedElement.classList.remove(\"open\");\n}", "misMatched (card1, card2)\r\n {\r\n this.busy = true;\r\n setTimeout (() => {card1.classList.remove(\"visible\"); card2.classList.remove(\"visible\"); this.busy = false;}, 500)\r\n }", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n }", "function card_effect_play_burn_card(deck){\n\t//deck.empty();\n\treturn -1;\n}", "function disable() {\n firstCard.removeEventListener(\"click\", flipCard);\n secondCard.removeEventListener(\"click\", flipCard);\n matches++;\n match.innerHTML = `${matches}`;\n remains--;\n remaining.innerHTML = `${remains}`;\n\n reset();\n}", "function disableCorrectCards(){\n $(selectedCards[0]).find('.card-front').attr('src','images/done-card-back.png');\n $(selectedCards[1]).find('.card-front').attr('src','images/done-card-back.png');\n $(selectedCards[0]).find('.card-front').removeClass('active');\n $(selectedCards[1]).find('.card-front').removeClass('active');\n $(selectedCards[0]).off('click');\n $(selectedCards[1]).off('click');\n flipCardsBackDown();\n}", "function EndComputerGame(){\n flag=false;//set flag as a false value ** to be computer game **\n clearBox2();}", "function turnOverAny(card) {\n for (card=0; card < cardArray.length; card++) {\n cardArray[card].classList.remove(\"card-image\");\n cardArray[card].classList.remove(\"unclickable\");\n cards.classList.remove(\"unclickable\");\n }\n}", "function noMatch() {\n\tcardOne.classList.remove('shake');\n\tcardTwo.classList.remove('shake');\n\n\tcardOne.classList.remove('show');\n\tcardTwo.classList.remove('show');\n}", "function endGame() {\n\tif(matchedCards.length === 16){\n\t\ttimer.stop();\n\t\tdisplayPopup();\n\t}\n}", "function skip() {\n game.cutScene.style.display = 'none';\n game.soundInstance.stop();\n // TODO: stop and unload cut scene animation\n}", "function disableCards() {\r\n firstCard.removeEventListener('click', flipCard);\r\n secondCard.removeEventListener('click', flipCard);\r\n resetBoard();\r\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n ++score;\n checkForWin();\n resetBoard();\n}", "function creditsAbort() {\n \tmusic_rasero.stop();\t\t\t\t\t// Stop music\n \tdefDemo.next();\t\t\t\t\t\t\t// Go to next part (End \"crash\")\n }", "function removeOpenCards() {\n cardOpen = [];\n\n}", "function unturnAllCardsTurned (item){\n\tfor (var i = 0; i < memoryCards.length; i++){\n\t\tif (memoryCards[i].turned === true){\n\t\t\tmemoryCards[i].turned = false;\n\t\t}\n\t}\n\titem.src = card;\n\tpreviousItem = document.getElementById(idOfHtmlCards[0]);\n\tpreviousItem.src = card;\n\tidOfHtmlCards = [];\n\treturn true;\n\n\n}", "removeCard()\n\t{\n\t\tif (this.numCards >= 1)\n\t\t{\n\t\t\tthis.numCards--;\n\t\t\tconst card = this.cards[this.numCards];\n\t\t\tthis.cards[this.numCards] = null;\n\t\t\treturn card;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcerr(\"no card to remove\");\n\t\t}\n\t}", "function dropCard() {\n player.cards.onHand.forEach((element, c) => {\n if (element.selected) {\n element.selected = false;\n // element.bgc = \"#EEDFA6\";\n myDom.canvas3.removeEventListener(\"mousemove\", getCurPos, false);\n player.battleGround.spots.forEach((spot, s) => {\n // console.log(spot.x, spot.y, element.x, element.y + element.height);\n if (\n element.y + element.height > spot.y &&\n element.y + element.height < spot.y + spot.height &&\n element.x > spot.x &&\n element.x + element.width < spot.x + spot.width\n ){\n\n const ar = player.cards.onHand[c];\n player.cards.onHand.splice(c, 1);\n player.cards.onSpot[s] = new Card(\n s,\n ar.player,\n ar.image.src,\n ar.imageSelect.src,\n ar.imageBg,\n ar.physic,\n ar.magic,\n ar.hp,\n ar.atribute,\n ar.speaking,\n ar.degrees,\n true,\n false,\n \n player.battleGround.spots[s].x +\n player.battleGround.spots[s].width / 2 -\n ar.width / 2,\n player.battleGround.spots[s].y -\n player.battleGround.spots[s].height * 1.2,\n ar.height,\n ar.width\n );\n player.cards.onSpot[s].load();\n enemy.cards.onSpot[s] = new Card(\n s,\n false,\n ar.image.src,\n ar.imageSelect.src,\n ar.imageBg,\n ar.physic,\n ar.magic,\n ar.hp,\n ar.atribute,\n ar.speaking,\n ar.degrees,\n true,\n false,\n enemy.battleGround.spots[s].x +\n enemy.battleGround.spots[s].width / 2 -\n ar.width / 2,\n enemy.battleGround.spots[s].y -\n enemy.battleGround.spots[s].height * 1.2,\n ar.height,\n ar.width\n );\n enemy.cards.onSpot[s].load();\n\n\n // re index private index property\n for (let i = 0; i < player.cards.onHand.length; i++) {\n player.cards.onHand[i].index = i;\n }\n // console.log(card.onHand, card.onSpot);\n }\n });\n //if u put card somewhere else than in destiny point than resize,new position on hand\n for (let i = 0; i < player.cards.onHand.length; i++) {\n player.cards.onHand[i].resize();\n }\n }\n });\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n resetBoard();\n}", "function disableClick() {\n for (let x = 0; x < allCards.length; x++) {\n allCards[x].classList.add(\"stop-event\");\n }\n}", "function Unmatched(){\n openedCards[0].classList.add(\"unmatched\");\n openedCards[1].classList.add(\"unmatched\");\n Disable();\n setTimeout(function(){\n openedCards[0].classList.remove(\"show\", \"open\", \"no-event\", \"unmatched\");\n openedCards[1].classList.remove(\"show\", \"open\", \"no-event\", \"unmatched\");\n Enable();\n openedCards = [];\n }, 1100);\n}", "function unflipCards() {\n stopClicks = true;\n setTimeout(() => {\n gsap.to(cardOne, { duration: 1, rotationY: 720 });\n gsap.to(cardOne, { duration: 0.5, color: \"transparent\" });\n gsap.to(cardTwo, { duration: 1, rotationY: 720 });\n gsap.to(cardTwo, { duration: 0.5, color: \"transparent\" });\n stopClicks = false;\n }, 1500);\n}", "function removeTookCards() {\n\tif (cardsmatched < 7){\n\t\n\t\tcardsmatched++;\n\t\t$(\".card-removed\").remove();\n\t}else{\n\t\t$(\".card-removed\").remove();\n\t\tuiCards.hide();\n\t\tuiGamerestart.hide();\n\t\tuiGameInfo.hide();\n\t\tuiLogo.hide();\n\t\tuiComplete.show();\n\t\tvar gamecomplete = document.getElementById(\"gameComplete\").getElementsByClassName(\"button\");\n\t\t\t//default select first card\n\t\t$(gamecomplete).addClass(\"active\");\n\t\ttagelementcount=3;\n\t\tclearTimeout(scoreTimeout);\n\t}\t\n}", "dealCardToPlayer() {\n let theCards = $(\".playerCard\");\n for (let i = 0; i < theCards.length; i++) {\n if ($(\".playerCard\")[i].style.backgroundImage === \"\") {\n this.giveCard($(\".playerCard\")[i], \"player\");\n //TODO: do the ace\n }\n }\n }", "function disableCards()\n{\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n}", "function nonmatchingCards(cardElems) {\n // Some delay for ux\n setTimeout(function () {\n cardElems.forEach(function (cardElem) {\n\n deselectCard(cardElem);\n });\n }, 1000);\n }", "function maybeMatch (card) {\n if (click % 2 === 0){\n incrementMove();\n changeScore();\n symbol2 = card.children[0].className;\n if (symbol1 === symbol2){\n console.log('you find it');\n maybeEndGame(card); \n } else {\n preventClick = true;\n console.log('try again');\n setTimeout(function(){\n card.classList.remove(\"shown-card\");\n firstCard.classList.remove(\"shown-card\");\n preventClick = false;\n }, 700); \n }\n } else {\n symbol1 = card.children[0].className;\n firstCard = card;\n }\n}", "function disableCards() {\n firstCard.removeEventListener('click', flipCard);\n secondCard.removeEventListener('click', flipCard);\n\n resetBoard();\n}", "cardMisMatch(card1, card2) {\n this.busy = true; \n setTimeout(() => {\n card1.classList.remove(\"visible\");\n card2.classList.remove(\"visible\");\n this.busy = false;\n }, 1000);\n }", "function deselectCard(cardElem) {\n cardElem.classList.remove(FLIP);\n\n // Update aria label to face down\n cardElem.setAttribute('aria-label', FACE_DOWN);\n }", "allowedToFlip(card) {\n return !this.busy && !this.matchedCards.includes(card) && card !== this.verifyCard;\n }", "cardMisMatch(card1, card2) {\n this.busy = true;\n setTimeout(() => {\n card1.classList.remove('visible');\n card2.classList.remove('visible');\n this.busy = false;\n }, 1000);\n }", "stealLying(card) {\n let firstCard = this.cards[0];\n let secondCard = this.cards[1];\n\n if (card === \"ambassador\") {\n if (firstCard === \"ambassador\" || secondCard === \"ambassador\") {\n return false;\n } else {\n return true;\n }\n } else if (card === \"captain\") {\n if (firstCard === \"captain\" || secondCard === \"captain\") {\n return false;\n } else {\n return true;\n }\n }\n }", "function disableCards() {\n firstCard.removeEventListener('click', flipCard());\n secondCard.removeEventListener('click', flipCard());\n resetBoard();\n}", "function freezeEnBoard() {\n setTimeout(() => {\n if (enCardInPlay >= 1) {\n $(\".game-card-en\").off(\"click\", playGame);\n }\n }, 100);\n }", "function playCard(_event) {\n let chosenCard = _event.target;\n if (chosenCard.textContent === middleCards.textContent || chosenCard.className === middleCards.className) {\n middleCards.textContent = chosenCard.textContent;\n middleCards.className = chosenCard.className;\n playerCards.removeChild(chosenCard);\n computerTurn = true;\n handleComputerTurn();\n }\n }", "function removeDiscardedCardsOpponent() {\n let discardedCardsOpponent = document.getElementById('opponent-discard-pile')\n if (!discardedCardsOpponent)\n return\n\n discardedCardsOpponent.parentNode.removeChild(discardedCardsOpponent)\n}", "function disableCards() {\r\n firstCard.removeEventListener(\"click\", flipCard);\r\n secondCard.removeEventListener(\"click\", flipCard);\r\n\r\n resetBoard();\r\n}", "function hideUnmatchedCards(){\n //If the two cards doesnot match , both the cards disappears\n setTimeout(function() {\n openedCards.forEach(function(card) {\n card.classList.remove('open', 'show');\n });\n openedCards = [];\n },200);\n }", "endTurn(){\n this.currentPlayer = (Object.is(this.currentPlayer, this.player1)) ? this.player2 : this.player1;\n this.currentPlayer[\"deck\"].draw();\n this.toggle = {\n \"HD\":false,\n \"HR\":false,\n \"DT\":false,\n \"EZ\":false,\n \"FL\":false,\n \"SD\":false\n };\n\n this.wincon = \"v2\";\n\n for(let effect of this.effectManager.globalEffects){\n console.log(JSON.stringify(effect));\n if(effect[\"duration\"] == 0){\n let index = this.effectManager.globalEffects.indexOf(effect);\n this.effectManager.globalEffects.splice(index, 1);\n }else{\n effect[\"duration\"] = effect[\"duration\"]-1;\n }\n }\n\n }", "function stop() {\n isGameActive = false;\n }", "function clickOff() {\n openedCards.forEach(function(card) {\n card.off('click');\n });\n}", "removeCard() {\n delete this._response.card;\n }", "function disable() {\n Array.prototype.filter.call(cards, function(cards) {\n card.classList.add(\"disable\");\n });\n }", "function noMatch () {\n setTimeout(function() {\n cardsShow.forEach(function(card) {\n card.classList.remove('open', 'show');\n })\n cardsShow = [];\n }, 1000);\n}", "function removeOpenCards() {\n openCards = [];\n}", "function removeCard() {\n\tif ($('#light2').css('display') == 'none') {\n\t\t$('#light2 img').remove();\n\t}\n\tif ($('#light5').css('display') == 'none') {\n\t\t$('#light5 img').remove();\n\t}\n}", "canFlipCard(card) {\n return !this.busy && !matchedCards.includes(card) && card !== this.cardToCheck;\n }", "function stopCare(){\n\tpress = false;\n\tdocument.activeElement.blur();\n\tnotifications.forEach(notify => notify.close());\n\tclearInterval(changeIcon);\n\tchangeIcon = 0;\n\tclearInterval(pressTimer);\n\tpressTimer = 0;\n\tcheckMood();\n\tif (!sad) defaultMood();\n}", "function hideDoneCard(card) {\n $(card).css('display', 'none');\n}", "function celebration(){\n\t // if all cards = is solved then display (animation? and final photo) \n\t //in raw html/css first so image is on the page display none in css\n\t //show it with a slow fade in\n\t $(\"#group-silly\").fadeIn(\"slow\");\n\t // stop timer using variable \n\t clearTimeout(myVar);\n\t $(\".start-button\").html(\"Play Again\");\n\t $(\".start-button\").click(restartGame);\n\t // call restartGame function\n}", "function noMatch() {\n\t\tfor (card of chosenCards) {\n\t\t\t\tcard.classList.remove('open', 'show');\n\t\t};\n\t\tempty();\n}", "function unFlipCards() {\n clearCardInPlay();\n freezePlay = true;\n setTimeout(() => {\n cardOne.classList.remove(\"flip\");\n cardTwo.classList.remove(\"flip\");\n clearDeck();\n }, 1700);\n }", "dealCard(){\n // Deal a randmon card. Since the desk is already suffled, will POP from array\n if (this.cards.length < 1){\n console.log(\"ERROR: No cards left in deck!\");\n return;\n }\n return(this.cards.pop());\n }", "function handleCard() {\n playerTries++;\n if (activeCards.length == 2) {\n if (getCardName(activeCards[0].id) != getCardName(activeCards[1].id)) {\n turnBackCards(activeCards);\n }\n else {\n foundPairs++;\n if (foundPairs == (cards.length / 2)) {\n clearInterval(countdown);\n winner = true;\n popupFinalResults(\"Congratulations! You Won!\");\n }\n }\n }\n else {\n turnBackCards(activeCards);\n }\n clearTimeout(timer);\n activeCards.splice(0);\n}", "function stopEventListener() {\n\n getCardClass.forEach(getCardClass => getCardClass.removeEventListener(\"click\", flipCardToBackSide));\n setTimeout(startEventListener, 600);\n}", "function clickOnCard(e) {\n // if the target isn't a card, stop the function\n if (!e.target.classList.contains('card')) return;\n // if the user click the first time on a card (-->that is flip the first card) the timer starts\n if(isFirstCardclicked) {\n startTimer();\n isFirstCardclicked=false;\n }\n if (openCards.length<2) {\n let cardClicked = e.target;\n console.log(\"clicked \"+e.target.querySelector('i').classList);\n // show the card\n showSymbol(cardClicked);\n // save the card clicked\n addOpenCard(cardClicked);\n }\n if (openCards.length == 2) {\n // to stop from further clicking on cards until animation is finished\n deck.removeEventListener('click', clickOnCard);\n checkMatch(openCards[0], openCards[1]);\n updateMovesCounter();\n updateRating();\n }\n}" ]
[ "0.6761672", "0.66552377", "0.6654198", "0.6632151", "0.65951824", "0.65638", "0.64893425", "0.647694", "0.6449515", "0.6442261", "0.64283836", "0.6404401", "0.6365564", "0.6359606", "0.63533914", "0.63405293", "0.63027596", "0.63004005", "0.6297379", "0.6294201", "0.628659", "0.6285881", "0.6263097", "0.62521106", "0.6250063", "0.62458116", "0.6219865", "0.6216294", "0.6208832", "0.620316", "0.61854476", "0.6177725", "0.6172437", "0.6169743", "0.61224735", "0.61130303", "0.6113007", "0.61044127", "0.60992634", "0.6098986", "0.60982436", "0.6092433", "0.6088969", "0.60863006", "0.6082818", "0.60821116", "0.60782844", "0.6076009", "0.60681266", "0.606376", "0.60610205", "0.60600287", "0.6055849", "0.60549855", "0.6046733", "0.60446954", "0.6036333", "0.6033518", "0.60233843", "0.6023006", "0.6022607", "0.60204387", "0.6018041", "0.60169244", "0.60163385", "0.6014582", "0.601341", "0.60064906", "0.60054517", "0.60051787", "0.6003159", "0.600138", "0.5999727", "0.5994169", "0.59851086", "0.5984776", "0.59807044", "0.59676874", "0.5967497", "0.5966927", "0.5965785", "0.5964043", "0.5952972", "0.5950993", "0.59453094", "0.59440786", "0.59348243", "0.59333545", "0.5929121", "0.5927647", "0.59263253", "0.59201866", "0.5913854", "0.59132254", "0.5912343", "0.5909026", "0.5908942", "0.59072495", "0.5906164", "0.5904269", "0.59036964" ]
0.0
-1
Mark a card as the new minimum.
function markMin(globals, params, q) { animToQueue(q, '#' + globals.cardArray[params].num, {top:globals.SELECT_MOVE}, "min", globals, params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set min(value) {\n this.changeAttribute('min', value);\n }", "set min(value) {\n Helper.UpdateInputAttribute(this, 'min', value);\n }", "set _min(value) {\n Helper.UpdateInputAttribute(this, \"min\", value);\n }", "set minIndex(_val) {\n (typeof _val === \"number\") && this.setAttribute(\"min\", _val);\n }", "function addMinimumValues(response) {\n drawMap(response, 'card', 'addMinimumValues');\n}", "minimum(min) {\n this.min = min;\n return this;\n }", "static minimize(card) {\n\t\t//Move the element to the inactive card box\n\t\tdocument.getElementById(\"inactivecards\").appendChild(card);\n\t\t//Set the attribute\n\t\tcard.setAttribute(\"cardvisible\",\"false\");\n\t\t//Get the card icon\n\t\tvar cardicon = CardManager.getCardIcon(card.getAttribute(\"cardname\"));\n\t\t//Show the icon\n\t\tcardicon.style.display = \"inline-block\";\n\t\t//Save the card state\n\t\tCardManager.saveState();\n\t}", "function decreaseMin () {\n newMin = getMinimum()-10;\n min = newMin;\n return min;\n }", "function unmarkMin(globals, params, q) {\n animToQueue(q, '#' + globals.cardArray[params].num,\n {top:'0px'}, \"unmin\", globals, params);\n}", "function minPrice(element, value) {\n element.min = value;\n element.placeholder = value;\n }", "incrementMin() {\n this.alarm.minutes < 59 ? this.alarm.minutes++ : this.alarm.minutes = 0;\n this.setDisplay();\n }", "function resetQuestionValueToMin(questionValue) {\n if (questionValue < 0) {\n questionValue = 0;\n }\n return questionValue;\n}", "setValueDiffMin (valueDiffMin) {\n this._valueDiffMin = valueDiffMin\n }", "static updateMinimum(obj) {\n if (CSRankings.minToRank <= 500) {\n let t = obj.scrollTop;\n CSRankings.minToRank = 5000;\n CSRankings.getInstance().rank();\n return t;\n }\n else {\n return 0;\n }\n }", "function selectionChangeSmallest(){\n addStep(\"Index Node \" + (selectionIndex + 1) + \" is smaller than smallest node \" + (selectionSmallest + 1) + \". Set Node \" + (selectionIndex + 1) + \" to \\\"smallest\\\"\");\n setClass(nodes[selectionIndex], 2, \"Selected\"); //changing the current node to a blend of index and smallest (selected).\n \n if(selectionSmallest == selectionCurrent){ //the previous smallest node is the first unsorted node\n setClass(nodes[selectionSmallest], 2, \"Current\");\n }else{\n setClass(nodes[selectionSmallest], 2, \"Default\");\n }\n\n selectionSmallest = selectionIndex;\n foundNewSorted = false;\n selectionIndex++;\n}", "get min() { return this._min; }", "get min() { return this._min; }", "get min() { return this._min; }", "get min() { return this._min; }", "get min() { return this._min; }", "get min() { return this._min; }", "min() {\n const { value, operation } = this.state;\n if (operation === 0) {\n this.setState({\n num1: Number(value),\n operation: 2,\n });\n this.clear();\n }\n }", "function increaseSupply() {\n shiftSupply([1, -1]);\n }", "get min() {\r\n return this._min\r\n }", "set low(low){\n\t\tthis._low = low;\n\t}", "set low(low){\n\t\tthis._low = low;\n\t}", "minOrderQuantity(minValue) {\n return minValue;\n }", "get min() {\n return this._min;\n }", "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}", "min(other) {\n return other.pos < this.pos ? other : this;\n }", "function setRubricMinScoreAgainstMax(max) {\r\n var min = viewModel.assessment.rubricMinScore;\r\n if (min > max) {\r\n viewModel.set('assessment.rubricMinScore', max);\r\n }\r\n }", "calculateScoreOld() {\n let cardValues = this.cards.map(({ value }) => value).sort((a, b) => b - a);\n return cardValues.reduce((acc, val) => {\n return val === 1 && acc + val < 8 ? acc + val + 10 : acc + val;\n }, 0);\n }", "function selectionSetNextSmallest(){\n addStep(\"Set Node \" + (selectionSmallest + 1) + \" as the smallest node\");\n setClass(nodes[selectionSmallest], 2, \"Combined\"); //changes the color of the next to the \"current\" and \"smallest\" color\n selectionIndex = selectionCurrent + 1;\n sortedSwitchStep = 1;\n}", "function fixed(cardSize){\n\n\tif (cardSize === 'littleCard') {\n\n\t\tTweenMax.set('.card', {className: '+=fixed' });\n\n\t} else if (cardSize === 'bigCard') {\n\n\t\tTweenMax.set('.BigCard', {className : '+=fixed'});\n\t\t\n\t} else alert('you dummy');\n\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}", "remove() {\n if (!this.value) {\n this.value = this.min || 0;\n }\n const step = this.ctrl_key ? 100 : this.shift_key ? 10 : this.step || 1;\n this.value -= step;\n if (this.value < this.min) {\n this.value = this.min || 0;\n }\n this.setValue(this.value);\n }", "function lowerScore() {\n if ((score.scorecard().score) > 0) {\n score.decrement(500);\n swal({\n title: \"Whoops!\",\n text: \"You just lost 500 points by slacking on your movie watching. Don't worry, you can still <a href=\\\"movie.php\\\">make it up to yourself</a>.\",\n type: 'warning',\n html: true\n });\n $('#total_points').html(score.scorecard().score);\n }\n}", "set min(value) {\n Helper.UpdateInputAttribute(this, 'minlength', value);\n }", "function minChange(k,min){\n if (min==1){\n $(`#${k}`).toggleClass('blink');\n $(`#${k}`).text('ARR');\n } \n }", "minValueUpdated() {\n this.showFlyout(this.flyoutStatus.error, this.i18n.minValueUpdatedStatus, true);\n }", "get min() {\n\t\treturn this.__min;\n\t}", "gainCard(card) {\n this.cards.push(card);\n this.out = false;\n if (this.numCards < 2) {\n ++this.numCards;\n }\n }", "function lockCards() {\n cardOpen[0].setAttribute('class', 'card match');\n cardOpen[1].setAttribute('class', 'card match');\n cardOpen = [];\n moves();\n stars();\n cardsEventListener();\n}", "function 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}", "getMin() {\n return this.min;\n }", "function freezeRandomCard(){\n returnUnguessedCards();\n let randomValue = ungessedCards[0][Math.floor(Math.random() * ungessedCards[0].length)];\n $(randomValue).attr('src','images/frozen-card-back.png');\n $(randomValue).toggleClass('frozen');\n setTimeout(function(){\n if ($(randomValue).hasClass('frozen')) {\n $(randomValue).attr('src','images/card-back.png');\n $(randomValue).toggleClass('frozen');\n }\n }, 10000);\n}", "minamp(val) {\n this._minamp = val;\n return this;\n }", "exchangeGainCard(card) {\n this.cards.push(card);\n ++this.numCards;\n }", "set minimumWidth(value) { }", "function updateScore(card,activePlayer){\n if(card === 'A'){\n if(activePlayer.score + blackjackGame.cardValue[card][1] <= 21){\n activePlayer.score += blackjackGame.cardValue[card][1];\n }else{\n activePlayer.score += blackjackGame.cardValue[card][0];\n }\n }else {\n activePlayer.score += blackjackGame.cardValue[card];\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 lockCard() {\n\tif (listOfOpenCards.length === 2){\n\t\tlistOfOpenCards.map(x => x.className = 'card match');\n\t\tlistOfOpenCards = [];\n\t}\n}", "getMin() {\n return this.min;\n }", "function autoSort(cards) {\n var steps = [];\n var toInsert = 0;\n var currentMin = Number.MAX_VALUE;\n var minIndex = Number.MAX_VALUE;\n\n var length = cards.length;\n for (var i = 0; i < length; i++) {\n // Find the minimum\n for (var j = toInsert; j < length; j++) {\n steps.push('consider:'+j);\n if (cards[j] < currentMin) {\n if (minIndex != Number.MAX_VALUE) {\n steps.push('unmarkMin:'+minIndex)\n }\n steps.push('markMin:'+j);\n currentMin = cards[j];\n minIndex = j;\n }\n steps.push('unconsider:'+j);\n }\n\n // Move min to correct place\n steps.push('move:'+minIndex+';to;'+toInsert);\n steps.push('markSorted:'+toInsert);\n cards.move(minIndex, toInsert);\n toInsert++;\n currentMin = Number.MAX_VALUE;\n minIndex = Number.MAX_VALUE;\n }\n return steps;\n}", "insertCard(newCardModel, targetCardModel, dockPosition) {\n //adjust sizes\n let halfWidth = (targetCardModel.width / 2);\n Ember.set(targetCardModel,'width',Math.ceil(halfWidth));\n // set the card width/height based on above calculations\n Ember.set(newCardModel, 'width', Math.floor(halfWidth));\n const cards = this.get('model.cards');\n // where to insert?\n // default to the begining (left)\n let pos = 0;\n if (targetCardModel) {\n // if inserting before, use target card's current index\n // otherwise (inserting after) use the next index\n pos = cards.indexOf(targetCardModel);\n if(dockPosition === 'card-right'){\n pos++;\n }\n }\n cards.insertAt(pos, newCardModel);\n }", "function modelMin(newValue) {\n if(scope.getterSetter) {\n return arguments.length ? scope.modelMin(newValue) : scope.modelMin();\n } else {\n return arguments.length ? (scope.modelMin = newValue) : scope.modelMin;\n }\n }", "selectCard(state, action) {\n const deck = state.currentDeck;\n const currentlySelected = state.currentlySelected; // Latest selection\n const newCard = action.payload.model; // Current selection\n const stackIndex = action.payload.stackIndex; // Current selection's belonging stack.\n\n state.hint.cards = initialState.hint.cards; // Reset hint info.\n\n // If selected card is unavailable, current selection will be tracked.\n if(currentlySelected.cards.length === 0) {\n const cardIndex = deck[stackIndex].cards.findIndex(c => c.id === newCard.id);\n\n const sequentialCards = deck[stackIndex].cards\n .map((card, i) => (i >= cardIndex) ? card : null)\n .filter(card => card);\n\n if(sequentialCards.length > 1) {\n currentlySelected.cards = sequentialCards.map((c,i,arr) => {\n const nextItem = arr[i + 1];\n const currentItem = arr[i];\n const previousItem = arr[i-1];\n if(nextItem) {\n return (nextItem.priority - currentItem.priority === 1) ? currentItem : null;\n } else if(previousItem) {\n return (currentItem.priority - previousItem.priority === 1) ? currentItem : null;\n }\n }).filter(c => c);\n } else {\n currentlySelected.cards.push(sequentialCards[0]);\n }\n //currentlySelected.stackIndex = (state.currentlySelected !== currentlySelected) ? stackIndex : null;\n // State mutation\n currentlySelected.stackIndex = stackIndex;\n state.currentlySelected = currentlySelected;\n state.currentDeck = deck;\n return state;\n } else {\n const firstCard = currentlySelected.cards[0];\n // Validating whether if selected card's priority is higher.\n // If it is, then start replacing the previously selected cards into new stack.\n if(firstCard.priority - newCard.priority === 1) {\n currentlySelected.cards.forEach(c => {\n deck[stackIndex].cards.push(c);\n state.currentScore += 20;\n });\n const cardIndexToDelete = deck[currentlySelected.stackIndex].cards.findIndex(c => currentlySelected.cards[0].id === c.id);\n deck[currentlySelected.stackIndex].cards.splice(cardIndexToDelete, deck[currentlySelected.stackIndex].cards.length);\n }\n // State mutation\n state.currentDeck = deck;\n state.currentlySelected = {stackIndex: null, cards: []};\n state.currentDeck.map(s => {\n if(s.cards.length > 0)\n s.cards[s.cards.length - 1].active = true\n });\n return state;\n }\n }", "function activateFreezePowerUp(unit, value, total){\n if(total % 10 === 0){\n freezeRandomCard();\n }\n}", "function lockCard () {\n matchedCounter++;\n\n for (let card of currCards) {\n card.className = 'card match';\n }\n\n currCards.pop();\n currCards.pop();\n\n if (matchedCounter == 8) {\n clearInterval(timerId);\n result = document.getElementsByClassName('result').item(0);\n starCounter = document.getElementsByClassName('fa fa-star').length;\n result.innerHTML = `In ${minutes} minutes : ${seconds} seconds, with ${moveCounter} Moves and ${starCounter} Stars.`;\n complete.style.display = 'block';\n }\n}", "function buyMans() {\r\n if(player.gold.num >= player.mansion.price && player.influence >= player.mansion.infMin) {\r\n player.mansion.num++;\r\n player.gold.num -= player.mansion.price;\r\n player.influence += player.mansion.influence;\r\n player.mansion.income = player.mansion.num * player.mansion.gain;\r\n gameLog('Are ye looking to settle down now, Cap\\'n?');\r\n } else {\r\n gameLog('It be a sign, Cap\\'n.');\r\n };\r\n player.mansion.price = Math.floor(25525 * Math.pow(1.09, player.mansion.num));\r\n document.getElementById('mansCost').innerHTML = player.mansion.price;\r\n document.getElementById('mansNum').innerHTML = player.mansion.num;\r\n document.getElementById('mansGain').innerHTML = player.mansion.income;\r\n document.getElementById('mansInf').innerHTML = player.mansion.influence;\r\n document.getElementById('gold').innerHTML = player.gold.num;\r\n document.getElementById('influence').innerHTML = player.influence;\r\n}", "function calculateMinimumMoves() {\n\n}", "min(min) {\n this.checkSearchType();\n if (!this.options.block) {\n this.options.block = {};\n }\n this.options.block.min = min;\n return this;\n }", "function adjustedRating(card) {\n \n // apply some variance to card evaluation\n let rating = normalRandom(card.rating, bot.variance);\n\n // bias to preferred color in early picks\n if (bot.color_preference) {\n if (pick_number <= bot.color_preference.picks &&\n card.colors.indexOf(bot.color_preference.color) !== -1) {\n rating += 1.0;\n }\n }\n\n // return adjusted rating\n return rating;\n }", "get min() {\n return this.getMin();\n }", "setMin() {\n this.setState({\n startIndex: 0\n })\n // check end index\n if (this.state.validEndIndex) {\n if (this.state.endIndex > 0+helpers.constants.SWEEP_MAX_INDEX) {\n this.setState({endIndex: 0+helpers.constants.SWEEP_MAX_INDEX})\n }\n }\n }", "adjustScore(inAmount) {\n\n this.score = this.score + inAmount;\n if (this.score < 0) {\n this.score = 0;\n }\n $$(\"score\").setHTML(`Score: ${this.score}`);\n\n }", "function increaseMinMax() {\n min -= 10;\n max += 10;\n }", "function setMinesLeft() {\n var minesLeftElemt = document.getElementById(\"minesLeft\")\n var minesMarked = board.cells.filter(function(cell) {\n return cell.isMarked\n }).length\n console.log(mineAmount - minesMarked)\n minesLeftElemt.innerHTML = mineAmount - minesMarked\n}", "function alterScoreCard(){\n var scoreplacement = document.getElementById('scoreCounter');\n if (counter == 10) {\n scoreplacement.style.left = `${scoreplacement.offsetLeft - 10}px`;\n } else if (counter == 100) {\n scoreplacement.style.left = `${scoreplacement.offsetLeft - 10}px`;\n }\n}", "min() {}", "set sx(value) {\n this._sx = Math.min( Math.max(0, value), mapwidth - kontra.canvas.width );\n }", "_checkX() {\n\n if (this.x < this.minX) {\n this.x = this.minX;\n this._updatePosition();\n }\n\n if (this.x > 0) {\n this.x = 0;\n this._updatePosition();\n }\n }", "function newFront(event){\n setCard({...card,front:event.target.value});\n }", "_updateLowestPriority(node) {\n let lowest = this.lowestPriority;\n if (!lowest) this.lowestPriority = node;\n else if (node.priority >= lowest.priority) this.lowestPriority = node;\n }", "function increaseValueOnWin() {\n if (inputAsNumber() === randomNumber) {\n min = min - 10;\n max = max + 10;\n randomNumber = generateRandomNumber();\n updateMinMaxText();\n }\n }", "set beforeSpacing(value) {\n if (value === this.beforeSpacingIn) {\n return;\n }\n this.beforeSpacingIn = value;\n this.notifyPropertyChanged('beforeSpacing');\n }", "function min() {\n memory = document.getElementById(\"display\").value;\n document.getElementById(\"display\").value = \"\";\n teken = \"-\";\n}", "function plusmin() {\n let inputNumber = document.getElementById(\"display\").value;\n inputNumber = inputNumber - (inputNumber * 2);\n document.getElementById(\"display\").value = inputNumber;\n}", "regenerateMana(amountToRegenerate){\n\n //Determine maximum\n let maxToRegen = this.props.stats_current.mana - this.props.mana_points;\n\n //If trying to regenerate more than maximum, only regen up to maximum\n let appliedAmountToRegenerate = ((amountToRegenerate > maxToRegen) ? maxToRegen : amountToRegenerate);\n\n this.incrementProperty('mana_points', appliedAmountToRegenerate)\n }", "grow() {\n // grow by reducing the size by a set amount\n this.size = this.size + this.growRate;\n // Check if we're larger than the max size\n if (this.size > this.maxSize) {\n // If so, we're done for the night\n this.on = false\n }\n }", "function majMin(elem){\n if(elem.id == \"maj\"){\n isMaj = true;\n }else{\n isMaj = false;\n }\n randomTPain();\n keyText(keyID, isMaj);\n}", "function updateScore(card, activePlayer) {\r\n if (card === 'A') {\r\n if ((activePlayer['score'] + BJGame['cardsMap'][card][1]) <= 21) {\r\n activePlayer['score'] += BJGame['cardsMap'][card][1];\r\n } else {\r\n activePlayer['score'] += BJGame['cardsMap'][card][0];\r\n }\r\n } else {\r\n activePlayer['score'] += BJGame['cardsMap'][card];\r\n }\r\n}", "increase() {\n //console.log('max:'+this.field.max+' value:'+ this.field.value)\n\n //check if the quantity increase is legal variable in template is {{ page.product.calculatedMaxPurchase }}\n if (parseInt(this.field.value) + this.step <= this.max ) {\n console.log('increase if true');\n this.field.value = parseInt(this.field.value) + this.step;\n }\n }", "makeFull() {\n this.setValue(this._maxValue);\n }", "function setRating() {\n // make sure rating doesn't go below 1 star\n if (mismatches > 7) return;\n\n // decrease rating every 3 mismatches\n if ( (mismatches % 3) === 0 ) {\n rating--;\n ratingLabel.removeChild(ratingLabel.lastElementChild);\n }\n}", "actualizar(){ \n\n this.sellIn--;\n if(this.sellIn < 0){\n this.quality -= 4 \n } else {\n this.quality-=2\n }\n if(this.quality > 50){\n this.quality = 50\n }\n }", "addQuantity() {\n if (this.state.quantity + 1 <= this.state.max) {\n this.setState({quantity: this.state.quantity + 1});\n } else {\n ToastAndroid.show(\n 'You have reached the maximum limit of qty!',\n ToastAndroid.SHORT,\n );\n }\n }", "get minNumber() {\n return 0\n }", "increaseScore() {\n if (this.startCombo < 2) {\n this.startScore = this.startScore + this.addScore;\n } else if (this.startCombo === 2) {\n this.startScore += this.addScore * 2;\n this.startHP += 10;\n } else if (this.startCombo > 2) {\n this.startScore += this.addScore * 3;\n this.startHP += 10;\n }\n }", "deleteMin() {\r\n this.root = this.animateDeleteMinHelper(this.root);\r\n }", "function allocateSeat() {\n let votesTotal = parties.reduce((total, party) => total + party.votes, 0);\n parties = parties.sort((a, b) => b.votesCalculated - a.votesCalculated);\n if (parties[0].votes / votesTotal < threshold) {\n parties[0].votesCalculated = 0;\n allocateSeat();\n }\n parties[0].mpsGranted++;\n parties[0].votesCalculated = parties[0].votes / (parties[0].mpsGranted+1);\n}", "function selectCard (card) {\n humanPlayer.hand.tradeIns[card] = !humanPlayer.hand.tradeIns[card];\n \n if (humanPlayer.hand.tradeIns[card]) {\n dullCard(HUMAN_PLAYER, card);\n } else {\n fillCard(HUMAN_PLAYER, card);\n }\n}", "setMin() {\n this.setState({\n startIndex: 0\n })\n }", "lowerBet() {\n if (Math.round((this.betValue - 0.1) * 10) / 10 < 0.1) {\n } else {\n this.setBet(Math.round((this.betValue - 0.1) * 10) / 10);\n }\n }", "function setSmall(){\n setCheckedA(true);\n setCheckedB(false);\n setCheckedC(false);\n }", "get minIndex() {\n return Number(this.getAttribute(\"min\"));\n }", "addCardsByScore() { \n const score = this.getTotal();\n if (score.strong/score.total >= 0.7) {\n this.addNewCards(score.total);\n }\n }", "function lockMatch() {\n debug(\"lockMatch\");\n cardListOpen[0].setAttribute(\"class\", \"card match\");\n cardListOpen[1].setAttribute(\"class\", \"card match\");\n\n cardListOpen.forEach(function(i) {\n cardListMatch.push(i);\n })\n cardListOpen.splice(0, 50);\n checkWinCondition();\n }", "function lowerScore() {\r\n\tscore -= 1;\r\n}", "set minWidth(value) {}" ]
[ "0.6762539", "0.6391446", "0.6310163", "0.5955062", "0.594887", "0.5933817", "0.57989806", "0.5765526", "0.5754966", "0.5736904", "0.57338846", "0.5725054", "0.5714888", "0.56963027", "0.56401217", "0.56140196", "0.56140196", "0.56140196", "0.56140196", "0.56140196", "0.56140196", "0.5524803", "0.54849315", "0.541646", "0.5414785", "0.5414785", "0.54133344", "0.5398396", "0.53867763", "0.53816617", "0.53695565", "0.5355408", "0.5350487", "0.5324527", "0.53113955", "0.5291709", "0.5263577", "0.52524704", "0.5231897", "0.52283376", "0.5217433", "0.52106434", "0.51948863", "0.5183215", "0.5176642", "0.5160376", "0.5148869", "0.5136665", "0.5131613", "0.51291496", "0.5128908", "0.51211274", "0.51167166", "0.510517", "0.50891626", "0.5082321", "0.50724924", "0.5071053", "0.50674474", "0.5063474", "0.50610435", "0.5060754", "0.5049911", "0.5045989", "0.5045005", "0.50372255", "0.503418", "0.50340533", "0.503056", "0.5027607", "0.50197184", "0.5019334", "0.50023466", "0.4999977", "0.49980044", "0.49927068", "0.49900734", "0.4986193", "0.49801975", "0.49746627", "0.49699697", "0.4968733", "0.49601507", "0.49558875", "0.4955503", "0.49485004", "0.494387", "0.49387354", "0.4935009", "0.49349976", "0.49346524", "0.49269345", "0.49259365", "0.49200246", "0.49161646", "0.4916032", "0.49083906", "0.4896848", "0.48953736", "0.48921758" ]
0.68334275
0
Unmark a card as the minimum.
function unmarkMin(globals, params, q) { animToQueue(q, '#' + globals.cardArray[params].num, {top:'0px'}, "unmin", globals, params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "remove() {\n if (!this.value) {\n this.value = this.min || 0;\n }\n const step = this.ctrl_key ? 100 : this.shift_key ? 10 : this.step || 1;\n this.value -= step;\n if (this.value < this.min) {\n this.value = this.min || 0;\n }\n this.setValue(this.value);\n }", "static minimize(card) {\n\t\t//Move the element to the inactive card box\n\t\tdocument.getElementById(\"inactivecards\").appendChild(card);\n\t\t//Set the attribute\n\t\tcard.setAttribute(\"cardvisible\",\"false\");\n\t\t//Get the card icon\n\t\tvar cardicon = CardManager.getCardIcon(card.getAttribute(\"cardname\"));\n\t\t//Show the icon\n\t\tcardicon.style.display = \"inline-block\";\n\t\t//Save the card state\n\t\tCardManager.saveState();\n\t}", "function decreaseSupply() {\n shiftSupply([-1, 1]);\n }", "function markMin(globals, params, q) {\n animToQueue(q, '#' + globals.cardArray[params].num,\n {top:globals.SELECT_MOVE}, \"min\", globals, params);\n}", "function clearMinValues() {\n storage.unset(/min/)\n}", "function decreaseMin () {\n newMin = getMinimum()-10;\n min = newMin;\n return min;\n }", "removeNewMark() {\n this.card.removeChild(this.newPill);\n }", "async UnsetCard({ commit }) {\n commit(\"UNSET_CURRENT_CARD\");\n commit(\"UNSET_CURRENT_CARD_DETAIL\");\n commit(\"UNSET_SELECTED_CARD\");\n commit(\"UNSET_SELECTED_CARD_DETAIL\");\n }", "reset() {\r\n\t\tlet me = this;\r\n\t\tif (me.up > 50 && me.down >= me.up) {\r\n\t\t\tme.up = 0;\r\n\t\t\tme.down = 0;\r\n\t\t}\r\n\t}", "removeMin() {\r\n\t\tthis.remove(this.heap[0]);\r\n\t}", "removeCard() { this.df = null; }", "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 }", "function uncoverCard() {\n\t// to store id of clicked card\n\tlet clickedCard = this.id;\n\tdocument.getElementById(clickedCard).classList.add(\"card-rotate\");\n}", "fear() {\n\t\tthis.mentalScore--;\n\t\tif (this.mentalScore < 0) {\n\t\t\tthis.mentalScore = 0;\n\t\t}\n\t}", "markOff(){\n this.room.unmarkPosition(this.positionX, this.positionY);\n }", "reduceArmor(amount) {\n this._armor -= amount;\n if(this._armor <= 0) {\n console.log(this.toString()+' ran out of armor and expired');\n if (this._contained != null) {\n this.place.placeContained(this._contained);\n } else {\n this.place = undefined;\n }\n }\n }", "set min(value) {\n this.changeAttribute('min', value);\n }", "function removeOpenCards() {\n cardOpen = [];\n\n}", "hide() {\n this.card.style.transform = \"rotateY(0deg)\";\n this.editing = false;\n }", "function removeTookCards() {\n\tif (cardsmatched < 7){\n\t\n\t\tcardsmatched++;\n\t\t$(\".card-removed\").remove();\n\t}else{\n\t\t$(\".card-removed\").remove();\n\t\tuiCards.hide();\n\t\tuiGamerestart.hide();\n\t\tuiGameInfo.hide();\n\t\tuiLogo.hide();\n\t\tuiComplete.show();\n\t\tvar gamecomplete = document.getElementById(\"gameComplete\").getElementsByClassName(\"button\");\n\t\t\t//default select first card\n\t\t$(gamecomplete).addClass(\"active\");\n\t\ttagelementcount=3;\n\t\tclearTimeout(scoreTimeout);\n\t}\t\n}", "clearFromMark() {\r\n if (mark !== null) {\r\n stack.splice(mark);\r\n mark = null;\r\n }\r\n }", "_killCard(card) {\n const index = this.cards.getChildIndex(card);\n this.cards.removeChild(card);\n this.map[index].empty = true;\n }", "function resetBoard() {\n $(\".card\").attr(\"class\",\"card\");\n $(\".card\").removeAttr(\"style\")\n $(\".moves\").text(0);\n $(\".stars li i\").attr(\"class\",\"fa fa-star\");\n $(\".container\").removeAttr(\"style\");\n}", "function allowClick() {\r\n $(\".card\").removeClass(\"notouch\");\r\n}", "minusHP() {\n if (this.startHP > 0) {\n this.startHP -= 5;\n }\n }", "function deselectCard(cardElem) {\n cardElem.classList.remove(FLIP);\n\n // Update aria label to face down\n cardElem.setAttribute('aria-label', FACE_DOWN);\n }", "function unFlipCards() {\n clearCardInPlay();\n freezePlay = true;\n setTimeout(() => {\n cardOne.classList.remove(\"flip\");\n cardTwo.classList.remove(\"flip\");\n clearDeck();\n }, 1700);\n }", "drawCard() {\n let drawnCard = super.drawCard();\n this._decks.forEach(deck => deck.removeCard(drawnCard));\n return drawnCard;\n }", "function unflipCards (){\n lockBoard = true;\n\n setTimeout(() => {\n firstCard.classList.remove (\"flip\");\n secondCard.classList.remove (\"flip\");\n\n resetBoard();\n }, 1200);\n }", "function unflipCards() {\n lockBoard = true;\n setTimeout(() => {\n firstCard.classList.remove('flip');\n secondCard.classList.remove('flip');\n resetBoard();\n }, 1500);\n\n }", "restoreCards(){\n this._cards = this.buildCardSet();\n }", "function resetQuestionValueToMin(questionValue) {\n if (questionValue < 0) {\n questionValue = 0;\n }\n return questionValue;\n}", "function selectCard (card) {\n humanPlayer.hand.tradeIns[card] = !humanPlayer.hand.tradeIns[card];\n \n if (humanPlayer.hand.tradeIns[card]) {\n dullCard(HUMAN_PLAYER, card);\n } else {\n fillCard(HUMAN_PLAYER, card);\n }\n}", "function untapCards(previousCard, currentCard) {\n turnedCards.pop();\n $(previousCard.dom).toggleClass(\"not-match shake-card\");\n $(currentCard.dom).toggleClass(\"not-match shake-card\");\n\n setTimeout(function () {\n $(previousCard.dom).toggleClass(\"open not-match shake-card\");\n $(currentCard.dom).toggleClass(\"open not-match shake-card\");\n }, 500);\n}", "nextCardinDeck(){\n const mainDeck = Store.getMainDeck(),\n discardDeck = Store.getDiscardDeck(),\n currentCard = mainDeck.cards[ui.findDisplayedCard(mainDeck)];\n if (mainDeck.cards.length > 1){ \n mainDeck.cards.splice(ui.findDisplayedCard(mainDeck), 1);\n discardDeck.cards.unshift(currentCard);\n Store.addDeckToStorage('mainDeck', mainDeck);\n Store.addDeckToStorage('discardDeck', discardDeck);\n ui.dealCard();\n } else {\n ui.UIMessages('No More Cards...', 'red','.message');\n }\n}", "function unflipCards() {\n lockBoard = true;\n setTimeout(() => {\n firstCard.classList.remove('flip');\n secondCard.classList.remove('flip');\n resetBoard();\n }, 1000);\n }", "loseCard(card) {\n this.numCards -= 1;\n if (this.numCards <= 0) {\n this.out = true;\n this.cards.pop();\n } else {\n if (this.cards[0] === card) {\n this.cards.shift();\n } else if (this.cards[1] === card) {\n this.cards.pop();\n }\n }\n }", "function unflipCards() {\n lockBoard = true;\n\n setTimeout(() => {\n firstCard.classList.remove('flip');\n secondCard.classList.remove('flip');\n\n resetBoard();\n\n }, 1500);\n }", "deleteMin() {\r\n this.root = this.animateDeleteMinHelper(this.root);\r\n }", "card(){\n back.classList.remove('display');\n card1.classList.remove('display');\n }", "function resetHeld(){\n\t\tvar heldCtx = holdCanvas[0].getContext(\"2d\");\n\t\t_firstCardHold = _secondCardHold = _thirdCardHold = _fourthCardHold = _fifthCardHold = false;\n\t\t$(\".held\").removeClass(\"held\");\n\t\theldCtx.clearRect(0,0,holdCanvas.width(),holdCanvas.height());\n\t}", "function deleteMin(h) { \n if (h.left == null || h.left == undefined)\n return null;\n\n if (!isRed(h.left) && !isRed(h.left.left))\n h = moveRedLeft(h);\n\n h.left = deleteMin(h.left);\n return balance(h);\n }", "function unflipCards() {\n\tsetTimeout(() => {\n\n\t\tcount = 0;\n\t\tfirstCard.classList.remove('flip');\n\t\tsecondCard.classList.remove('flip');\n\t\tresetCards();\n\n\t}, 1300);\n}", "function setClosed(){\n\t\t\t\t\tcards.each(function(index){\n\t\t\t\t\t\t $(this).css(\"top\" , index * 2)\n\t\t\t\t\t\t \t\t.css(\"width\" , (cardWidth - index * 1)+\"%\")\n\t\t\t\t\t\t \t\t.css(\"margin-left\" , (index * .5) +\"%\");\n\n\t\t\t\t\t\tif( settings.explicitHeight === true ){\n\t\t\t\t\t\t\t\tcard.css(\"height\" , $(this).outerHeight() + 10 );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif( settings.stackHeight ){\n\t\t\t\t\t\t\t$(this).css(\"top\" , index * settings.stackHeight )\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tcard.removeClass(\"active\");\n\t\t\t\t}", "function resetCard(cardElem) {\n deselectCard(cardElem);\n cardElem.classList.remove(MATCH);\n }", "removeCard(card) {\n this._decks.forEach(deck => deck.removeCard(card));\n return super.removeCard(card);\n }", "function removeLowest(arr) {\n let lowest = arr.reduce( function(acc, curr) {\n return curr.fScore < acc.fScore ? curr : acc;\n }, { fScore: Infinity });\n\n arr.splice( arr.indexOf(lowest), 1);\n\n return lowest;\n }", "function unflipCards() {\n lockBoard = true;\n setTimeout(() => {\n firstCard.classList.remove('flip');\n secondCard.classList.remove('flip');\n\n resetBoard();\n }, 1500);\n}", "dropCard(card){\n if (card > this.hand.length-1){\n console.log(\"ERROR: Card is not in Deck array!\");\n } else {\n this.hand.splice(card, 1);\n }\n return;\n }", "function freezeRandomCard(){\n returnUnguessedCards();\n let randomValue = ungessedCards[0][Math.floor(Math.random() * ungessedCards[0].length)];\n $(randomValue).attr('src','images/frozen-card-back.png');\n $(randomValue).toggleClass('frozen');\n setTimeout(function(){\n if ($(randomValue).hasClass('frozen')) {\n $(randomValue).attr('src','images/card-back.png');\n $(randomValue).toggleClass('frozen');\n }\n }, 10000);\n}", "function unmatched() {\n\topenedCards[0].children[0].classList.remove(\"front\");\n\topenedCards[0].children[1].classList.add(\"back\");\n\n\topenedCards.shift();\n}", "function unFlipCards() {\n boardLock = true;\n setTimeout(() => {\n firstCard.classList.remove('flip')\n secondCard.classList.remove('flip')\n\n resetBoard();\n }, 800);\n}", "function decreaseFornScale() {\n\tvar f= fornSelected;\n\t\n\tif (f==null)\n\t\treturn 0;\n\t\n\tvar scale= f.currSize.width/f.currSize.height;\n\t\n\tf.currSize.width -= (2*scale);\n\tf.currSize.height -= 2;\n\t\n\tif ((f.currSize.width >= f.minSize.width) && (f.currSize.height >= f.minSize.height)) {\n\t\tfornSelected.m= fornSelected.m.translate((1*scale),1);\n\t}\n\telse {\n\t\tf.currSize.width += (2*scale);\n\t\tf.currSize.height += 2;\n\t}\n\t\n\tinvalidated= true;\n}", "decrementAvailability() {\n this.slotsAvailability--;\n }", "resetInvincibility() {\n this.currentInvincibility = 0;\n }", "function removeFreeKitFromCustomer() {\n var Transaction = require('dw/system/Transaction');\n if (customer && customer.authenticated && customer.profile) {\n Transaction.wrap(function () {\n customer.profile.custom.freeMaternityEligible = false;\n });\n }\n}", "function removeOpenCards() {\n openCard = [];\n}", "function selectedCardDisappears() {\n $(this).parent().empty();\n }", "effacer() {\n\n this.isSigned = false;\n this.ctx.clearRect(0, 0, this.carte.signElt.width, this.carte.signElt.height);\n\n }", "function removeCard() {\n $(this).closest(\".card\")\n .slideToggle(\"fast\", function () {\n this.remove();\n });\n spinGlyphicon($(\"#add-card-btn\").find(\"span\"), true);\n }", "function reset_cards(){\n\t//hide all cards faces\n\t$('.card').removeClass('open');\n\t//stack all cards\n\tstack_cards(0.2);\n\t//close all cards\n\tclose_all_cards();\n\t//remove any rotation\n\tanimate_card(0);\n}", "function resetBoard() {\n [hasFlippedCard, lockBoard] = [false, false];\n firstCard = null\n secondCard = null\n}", "function minusPoint(playerCardClicked) {\n\tconst lastPointAdded = playerCardClicked.querySelector('span:last-child');\n\tplayerCardClicked.removeChild(lastPointAdded);\n}", "function disable() {\n firstCard.removeEventListener(\"click\", flipCard);\n secondCard.removeEventListener(\"click\", flipCard);\n matches++;\n match.innerHTML = `${matches}`;\n remains--;\n remaining.innerHTML = `${remains}`;\n\n reset();\n}", "__decrement() {\n const { step, min } = this.values;\n const newValue = this.currentValue - step;\n if (newValue >= min || min === Infinity) {\n this.value = newValue;\n this.__toggleSpinnerButtonsState();\n }\n }", "function matchNegative(){\n\tlet removedElement = cardList.pop();\n\tremovedElement.classList.remove(\"open\");\n\tremovedElement.classList.remove(\"show\");\n\tremovedElement = cardList.pop();\n\tremovedElement.classList.remove(\"show\");\n\tremovedElement.classList.remove(\"open\");\n}", "function clean(isCpu, ind) {\n\tvar arr=ac(isCpu);\n\tarr[ind].blockActivated=0;\n\tarr[ind].chosenBlocker=-1;\n\n\tif (arr.length>=MAX_ACTIVE)\n\t\tarr[ind].hp = Math.max(arr[ind].hp - 5, 0);\n\n\tif (arr.length>1) {\n\t\tvar sameGame = true;\n\t\tvar fastestSpeed=0;\n\t\tvar game = arr[ind].originalgame;\n\t\tfor (var i=0;i<arr.length;i++) {\n\t\t\tif (arr[i].speed>fastestSpeed)\n\t\t\t\tfastestSpeed=arr[i].speed;\n\t\t\tif (arr[i].originalgame != game)\n\t\t\t\tsameGame=false;\n\t\t}\n\t\tif (sameGame) {\n\t\t\tconsole.log(\"Same Game Boost!\");\n\t\t\tfor (var k=0;k<arr.length;k++)\n\t\t\t\tarr[k].speed = fastestSpeed;\n\t\t}\n\t}\n\n}", "function removeOpenCards() {\n openCards = [];\n}", "function resetBoard(){\n\tfor(var i = 0; i < cards.length; i++){\n\tcardElement.removeAttribute('data-card', cards[i]);\n\t}\n}", "function getCard() {\n var min = Math.ceil(0)\n var max = Math.floor(deck.length - 1)\n var index = Math.floor(Math.random() * (max - min)) + min;\n var newCard = deck[index]\n deck.splice(index, 1)\n return newCard\n}", "function unflipCards() {\n lockBoard = true;\n setTimeout(() => {\n firstCard.classList.remove('flip');\n secondCard.classList.remove('flip');\n// There is a 60 second delay to see flipping animation\n resetBoard();\n }, 60);\n}", "clearActiveCard() {\n\t\tthis.activeCard = null;\n\t}", "function unflipCards(){\n lockBoard = true;\n setTimeout(()=>{\n firstCard.classList.remove(\"flip\");\n secondCard.classList.remove(\"flip\");\n resetBoard();\n},500)\n}", "function min() {\n memory = document.getElementById(\"display\").value;\n document.getElementById(\"display\").value = \"\";\n teken = \"-\";\n}", "function setRating() {\n // make sure rating doesn't go below 1 star\n if (mismatches > 7) return;\n\n // decrease rating every 3 mismatches\n if ( (mismatches % 3) === 0 ) {\n rating--;\n ratingLabel.removeChild(ratingLabel.lastElementChild);\n }\n}", "min() {\n const { value, operation } = this.state;\n if (operation === 0) {\n this.setState({\n num1: Number(value),\n operation: 2,\n });\n this.clear();\n }\n }", "function resetRemoveAdd() {\n document.querySelectorAll('.ans').forEach(e => e.remove())\n score = 0 * 1\n document.querySelector('.score .score-display').innerText = score\n document.querySelector('.check').style.opacity = 1\n document.querySelectorAll('.ans').forEach(e => e.remove())\n}", "function removeOpenCards() {\n openCards = [];\n}", "closeMark(mark) {\n this.marks = mark.removeFromSet(this.marks)\n }", "hit() {\r\n Player.changeScore(-2);\r\n this.remove();\r\n }", "function unFlipCard(card) {\n setTimeout(function(){\n card.classList.remove(\"flipped\")\n card.style.backgroundColor = \"black\"\n gameLock = false\n }, 750)\n}", "function freezeFrBoard() {\n setTimeout(() => {\n if (frCardInPlay >= 1) {\n $(\".game-card-fr\").off(\"click\", playGame);\n }\n }, 100);\n }", "function onRemoveFiveClicked(){\n\t\tif(poker._bet > 0 && draw == 0){\n\t\t\tif(!cardsFliped)\n\t\t\t\tflipCards();\n\t\t\tresetHeld();\n\t\t\tpoker._bet -= +5;\n\t\t\tpoker._cash += +5;\n\t\t\t\n\t\t}\n\t\tbet.html(poker._bet);\n\t\tcash.html(poker._cash);\n\t}", "removeSize() {\n this.size = 0;\n }", "function fullReset() {\n reset();\n score.DROITE = 0;\n score.GAUCHE = 0;\n }", "removeCard()\n\t{\n\t\tif (this.numCards >= 1)\n\t\t{\n\t\t\tthis.numCards--;\n\t\t\tconst card = this.cards[this.numCards];\n\t\t\tthis.cards[this.numCards] = null;\n\t\t\treturn card;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcerr(\"no card to remove\");\n\t\t}\n\t}", "function unflipCards() {\n lockBoard = true;\n\n setTimeout(() => {\n firstCard.classList.remove('flip');\n secondCard.classList.remove('flip');\n\n resetBoard();\n }, 1000); // timer voor de kaarten om terug te switchen\n\n beurt();\n}", "set min(value) {\n Helper.UpdateInputAttribute(this, 'min', value);\n }", "cardNotmatch(card1, card2) {\n this.busy = true;\n setTimeout(() => {\n card1.classList.remove('visible');\n card2.classList.remove('visible');\n this.busy = false;\n }, 1000);\n }", "removeMax() {\r\n\t\tthis.remove(this.heap[0]);\r\n\t}", "resetIfOver(minCount, minPosition) {\n if (minCount === this.durationInMins && minPosition === 0) {\n this.frameCount = 0;\n this.activeVisitors = [];\n this.waitingVisitors = this.data.slice();\n }\n }", "function unflipCards() {\r\n lockBoard = true;\r\n\r\n setTimeout(() => {\r\n firstCard.classList.remove(\"flip\");\r\n secondCard.classList.remove(\"flip\");\r\n\r\n resetBoard();\r\n }, 1500);\r\n}", "resetViewedItemMinimumRestrictedModifiers(state) {\n state.viewedItemMinimumRestrictedModifiers = [];\n }", "function reset() {\n var currentScore = myScore.getScore();\n $hole.off();\n $fieldCard.off();\n for (var i = 0; i < $(\".fieldCard\").length; i++) {\n myScore.removeFromScore();\n }\n myCookie.create(\"score\", myScore.value, 100);\n init();\n myScore.setFromCookie();\n updateUI();\n $hole.show();\n}", "function resetCard() {\n deleteActiveMarker();\n $('.card-spinner').addClass('show').removeClass('hide');\n $('.card-body').addClass('invisible');\n $('.gm-style').find('.card-cc').remove();\n $('#search-searchboxinput').val('');\n $('.card-body [class^=\"data-\"], .data-fatalities, .data-injured, .data-location, .data-date').text(' ');\n $('.card-mental-health-sources, .card-news-sources, .card-carousel, .card-victim-list, .card-tags').html(' ');\n}", "function minManhattan(array) {\n let minVal = Number.POSITIVE_INFINITY;\n let index = null;\n for( let i = 0; i < array.length; i++){\n if(array[i].manhattan < minVal) {\n index = i;\n minVal = array[i].manhattan;\n }\n }\n return array.splice(index,1)[0];\n }", "resetCastle(){\n this.health = this.maxHealth;\n }", "unflipCards() {\n this.lockBoard = true;\n\n setTimeout(() => {\n this.firstCard.classList.remove('flip');\n this.secondCard.classList.remove('flip');\n\n this.resetBoard();\n }, 1500);\n }", "function reset() {\n [hasFlipped, lockBoard] = [false, false];\n [firstCard, secondCard] = [null, null];\n}", "removeStoredMark(mark) {\n return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));\n }" ]
[ "0.5794074", "0.57848006", "0.56940156", "0.56817675", "0.5626896", "0.560562", "0.55201274", "0.54891515", "0.5468478", "0.5459153", "0.53400993", "0.5333994", "0.5292736", "0.52908754", "0.5239382", "0.51999056", "0.51772475", "0.5173613", "0.5171734", "0.51701933", "0.5157415", "0.51375574", "0.5120611", "0.51179695", "0.51095307", "0.5106713", "0.51049733", "0.5086984", "0.50860727", "0.50811124", "0.5074367", "0.50727767", "0.50676954", "0.5067247", "0.50641936", "0.50577253", "0.5055061", "0.505478", "0.5047679", "0.5040649", "0.5015029", "0.50080734", "0.50036323", "0.50013596", "0.4991566", "0.49812475", "0.4976058", "0.49693123", "0.49548745", "0.49478704", "0.49437627", "0.49375883", "0.493134", "0.4917982", "0.49177623", "0.49153706", "0.49096644", "0.48990738", "0.4896361", "0.48921275", "0.48906115", "0.48839593", "0.488391", "0.48831636", "0.48830044", "0.48740393", "0.48706543", "0.48705107", "0.48649293", "0.48627934", "0.48623094", "0.48535067", "0.4843805", "0.4841594", "0.4841228", "0.4840067", "0.48373517", "0.48364562", "0.4828987", "0.48276362", "0.48265383", "0.48241952", "0.48221415", "0.48160604", "0.48154652", "0.48138633", "0.48100257", "0.48075986", "0.48044991", "0.4804036", "0.4801148", "0.4800861", "0.47968474", "0.47962937", "0.4790377", "0.47877848", "0.47842142", "0.47784328", "0.47764224", "0.4773664" ]
0.70508796
0
Mark a card as sorted.
function markSorted(globals, params, q) { animToQueue(q, '#' + globals.cards[params].num, {top:'0px'}, "sort", globals, params); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sortTheCard() {\n this.sort = this.cards.sort((currentCard, nextCard) => currentCard.value - nextCard.value);\n }", "function setSorted(globals, id) {\n var cards = globals.cards;\n cards[id].sorted = true;\n cards[id].flipped = false;\n globals.totFlip--;\n $('#' + id).css({\n backgroundImage:'url(' + globals.cards[id].sortedBack + ')'\n })\n}", "let isSort;\n for (let i=0; i<cards.length; i++) {\n const card = cards[i];\n const cardOld = cardsOld[i];\n if (card.id !== cardOld.id) {\n isSort = true;\n break;\n } else {\n if (!shallowEqual(card, cardOld)) {\n // its a card update\n isSort = false;\n break;\n }\n }\n }", "function sortCardList() {\r\n const sortedArray = sort(cardListArray);\r\n console.log(\"sorted --\", sortedArray);\r\n\r\n for (let i = 0; i < sortedArray.length; i++) {\r\n container.appendChild(sortedArray[i]);\r\n }\r\n }", "set sortingOrder(value) {}", "function bubbleSetSorted(){\n addStep(\"Node \" + (bubbleIndex + 1) + \" is now sorted.\");\n if(bubbleIsSorted){\n bubbleEarlyEnd();\n return;\n }\n setClass(nodes[bubbleIndex], 2, \"Sorted\"); //set node to sorted color\n setClass(nodes[bubbleIndex - 1], 2, \"Default\"); //set previous node to default\n bubbleEndStep++;\n bubbleLimit--;\n}", "function sortCards() {\n clearCards();\n for (i = 0; i < 9; i++) {\n createCard(i);\n }\n}", "function sortingDscend() { \n setSearchData(null)\n let sorted = studentData.sort(function(a, b){\n return a.id - b.id;\n })\n\n setSearchData(sorted)\n // console.log(sorted, typeof(sorted))\n }", "function kartenSortieren() {\n hand.sort(sortByvalue);\n hand.sort(sortBybild);\n handkarten();\n}", "function onSort() {\n\tvar items = {};\n\titems[ this.options.sortIdKey ] = this.sorTable.sortId;\n\titems[ this.options.sortAscKey ] = this.sorTable.sortAsc;\n\tchrome.storage.local.set( items );\n}", "Sort() {\n\n }", "function autoSort(cards) {\n var steps = [];\n var toInsert = 0;\n var currentMin = Number.MAX_VALUE;\n var minIndex = Number.MAX_VALUE;\n\n var length = cards.length;\n for (var i = 0; i < length; i++) {\n // Find the minimum\n for (var j = toInsert; j < length; j++) {\n steps.push('consider:'+j);\n if (cards[j] < currentMin) {\n if (minIndex != Number.MAX_VALUE) {\n steps.push('unmarkMin:'+minIndex)\n }\n steps.push('markMin:'+j);\n currentMin = cards[j];\n minIndex = j;\n }\n steps.push('unconsider:'+j);\n }\n\n // Move min to correct place\n steps.push('move:'+minIndex+';to;'+toInsert);\n steps.push('markSorted:'+toInsert);\n cards.move(minIndex, toInsert);\n toInsert++;\n currentMin = Number.MAX_VALUE;\n minIndex = Number.MAX_VALUE;\n }\n return steps;\n}", "function sortingAscend() {\n setSearchData(null)\n let sorted = studentData.sort(function(a, b){\n return b.id - a.id;\n })\n\n setStudentData(sorted)\n console.log(sorted, typeof(sorted))\n }", "_sortedByChanged(sorted) {\n const headerColumns = this.shadowRoot.querySelectorAll('.th');\n this._resetOldSorting();\n headerColumns.forEach((el) => {\n if (el.getAttribute('sortable') === sorted) {\n el.setAttribute('sorted', '');\n this.set('sortDirection', 'ASC');\n }\n });\n }", "function Sort() {}", "function ShellSortCardIndex(iCardIndexList, iCompareMethod)\r\r\n{\r\r\n DebugLn(\"ShellSortCardIndex\");\r\r\n var sortIncrement = 3\r\r\n while (sortIncrement > 0)\r\r\n {\r\r\n var iiCard = 0;\r\r\n for (iiCard = sortIncrement; iiCard < iCardIndexList.length; iiCard++)\r\r\n {\r\r\n var jjCard = iiCard;\r\r\n var tempCardNum = iCardIndexList[iiCard];\r\r\n while (jjCard >= sortIncrement && \r\r\n iCompareMethod(iCardIndexList[jjCard - sortIncrement], tempCardNum) > 0)\r\r\n {\r\r\n var delta = jjCard - sortIncrement;\r\r\n iCardIndexList[jjCard] = iCardIndexList[delta];\r\r\n jjCard = delta;\r\r\n }\r\r\n iCardIndexList[jjCard] = tempCardNum;\r\r\n }\r\r\n if (sortIncrement == 1)\r\r\n {\r\r\n sortIncrement = 0;\r\r\n }\r\r\n else\r\r\n {\r\r\n sortIncrement = Math.floor(sortIncrement / 2);\r\r\n if (sortIncrement == 0)\r\r\n sortIncrement = 1;\r\r\n }\r\r\n }\r\r\n}", "function magic() {\n const sortCards = cards;\n sortCards.length = 0;\n // Create an array with objects containing the value and the suit of each card\n for (let x = 0; x < suits.length; x += 1) {\n for (let i = 1; i <= 13; i += 1) {\n const cardObject = {\n value: i,\n suit: suits[x],\n };\n sortCards.push(cardObject);\n }\n }\n\n // For each dataObject, replace the previous card and append it to the DOM\n sortCards.forEach((card, i) => {\n const positionFromLeft = i * 30;\n const sortedCards = document.createElement('div');\n sortedCards.setAttribute('data-value', card.value);\n sortedCards.classList.add('card', `${card.suit}-${card.value}`);\n sortedCards.style.left = `${positionFromLeft}px`;\n cardsWrapper.replaceChild(sortedCards, cardsWrapper.children[i]);\n });\n}", "async function sort() {\r\n await sortBooks();\r\n // document.getElementById(\"sortButton\").style.display = \"none\";\r\n // document.getElementById(\"pauseButton\").style.display = \"inline\";\r\n // document.getElementById(\"resetButton\").style.display = \"inline\";\r\n // eventId = window.requestAnimationFrame(draw);\r\n // isSorting = true;\r\n }", "sorted(x) {\n super.sorted(0, x);\n }", "sort() {\n if (this.sortOrder === 'asc') {\n this.set('sortOrder', 'desc');\n\n } else if (this.sortOrder === '') {\n this.set('sortOrder', 'asc');\n\n } else {\n this.set('sortOrder', '');\n\n }\n }", "changeSorting() {\n this.currentlySelectedOrder =\n (this.currentlySelectedColumn === this.columnName) ? !this.currentlySelectedOrder : false;\n this.currentlySelectedColumn = this.columnName;\n }", "setSort(sort) {\n this.setState({\n sort\n });\n }", "set overrideSorting(value) {}", "function _sortDeck () {\n deck.sort ( (a, b) => {\n let cardA = getCardById(a);\n let cardB = getCardById(b);\n if (cardA[\"cost\"] > cardB[\"cost\"]) {\n return 1;\n }\n else if (cardA[\"cost\"] < cardB[\"cost\"]) {\n return -1;\n }\n else {\n return cardA[\"name\"] > cardB[\"name\"];\n }\n });\n}", "function sortCards(arr) {\r\n arr.sort(function(a,b){\r\n // If both cards have the same suit\r\n if (suits.indexOf(a.suit) == suits.indexOf(b.suit)) {\r\n // If Card A has a lower value than Card B\r\n // Return Card A, else return Card B\r\n if (values.indexOf(a.value) < values.indexOf(b.value)) {\r\n return -1;\r\n }\r\n else {\r\n return 1;\r\n }\r\n }\r\n\r\n // Else if Card A has a lower suit than Card B\r\n // Return Card A, else return Card B\r\n else if (suits.indexOf(a.suit) < suits.indexOf(b.suit)) {\r\n return -1;\r\n }\r\n else {\r\n return 1;\r\n }\r\n });\r\n}", "function sortActive(item, index) {\n //console.log(\"im sort\" + item);\n putAtPosition(item, index);\n changeColorofBar(item + 1, true);\n key2++;\n}", "resetSortState() {\n this.props.dispatch(couponsActions.toggleSort(false, 4, 'Recommended'));\n this.props.dispatch(couponsActions.setSortResults([]));\n }", "function sortCards(dataArray) {\n var sortId = $(\".sort-dropdown .dropdown-inner li.active\").attr(\"id\");\n if (sortId == \"latest\") {\n dataArray.sort(custom_sort_date);\n dataArray.reverse();\n } else if (sortId == \"oldest\") {\n dataArray.sort(custom_sort_date);\n } else if (sortId == \"viewed\") {\n dataArray.sort(custom_sort_view);\n dataArray.reverse();\n } else if (sortId == \"liked\") {\n dataArray.sort(custom_sort_like);\n dataArray.reverse();\n }\n generateVideoListItems(dataArray);\n }", "sort(){\n\n }", "function BubbleSortCardIndex(iCardIndexList, iCompareMethod)\r\r\n{\r\r\n DebugLn(\"BubbleSortCardIndex\");\r\r\n \r\r\n var iiCard = 0;\r\r\n for (iiCard = 0; iiCard < iCardIndexList.length - 1; iiCard++)\r\r\n {\r\r\n var jjCard = 0;\r\r\n for (jjCard = iiCard + 1; jjCard < iCardIndexList.length; jjCard++)\r\r\n {\r\r\n if (iCompareMethod(iCardIndexList[jjCard], iCardIndexList[iiCard]) < 0)\r\r\n {\r\r\n var temp = iCardIndexList[iiCard];\r\r\n iCardIndexList[iiCard] = iCardIndexList[jjCard];\r\r\n iCardIndexList[jjCard] = temp;\r\r\n }\r\r\n }\r\r\n }\r\r\n}", "function setSort(x) { //these 3 functions are connected to the event of the buttons\n sortby = x;\n updateDoctorsList(); //they then invoke updatedoctorslist, that is meant to access the doctors on the server with the current criteria, the fetch..\n}", "function sortByCreationDate() {\n let nodes = document.querySelectorAll('.bookCard')\n nodes.forEach((node) => {\n node.style.order = 'initial'\n })\n}", "shuffleCards() {\n this.cards.forEach(card => {\n let randomPos = Math.floor(Math.random() * 12);\n card.style.order = randomPos;\n });\n }", "function changeSort(columnName) {\n for (let item of sortList) {\n\n if (item.name === columnName) {\n\n /* Set new sort */\n if (item.sort === undefined) {\n item.sort = true;\n } else {\n item.sort = !item.sort;\n }\n\n if (item.sort) {\n item.element.innerText = item.name + \" ▼\";\n } else {\n item.element.innerText = item.name + \" ▲\";\n }\n\n } else {\n /* Reset sort in all another field */\n item.sort = undefined;\n item.element.innerText = item.name + \" ▼▲\";\n }\n }\n\n filter();\n}", "function sortMe() {\n var ss = SpreadsheetApp.getActiveSpreadsheet(); \n var cList = ss.getSheetByName('Card List');\n var range = cList.getRange(2,1,cList.getMaxRows()-1,cList.getMaxColumns());\n // sort by sort and name\n range.sort([findColumn('Sort')+1,findColumn('Name')+1]);\n}", "function resort(){\n if(scope.sorting && scope.sorting.obj){\n var sortKey = scope.sorting.obj.field;\n sorter(sortKey,scope.sorting.direction);\n }\n }", "function resort(){\n if(scope.sorting && scope.sorting.obj){\n var sortKey = scope.sorting.obj.field;\n sorter(sortKey,scope.sorting.direction);\n }\n }", "function shuffle(cards) {\n cards.forEach(card => {\n let randomize = Math.floor(Math.random() * 10);\n card.style.order = randomize;\n });\n}", "function sortCards(unsorted)\n{\n function cardSort(a,b)\n {\n return (cardWeight(a)-cardWeight(b))*-1\n }\n return unsorted.sort(cardSort);\n}", "get sort() { return this._sort; }", "get sort() { return this._sort; }", "get sort() { return this._sort; }", "autoSortAndSave() {\n console.log('sorting')\n this.articles = this.articles.sort(function(a, b) {\n if (a.hits < b.hits) {return -1}\n else if (a.hits > b.hits ) {return 1}\n else {return 0}\n })\n if (this.save) {\n localStorage.setItem('articles', this.articles)\n }\n }", "cardsShuffle() {\n for(let i = this.cardsArray.length - 1; i > 0; i--) {\n let randomInt = Math.floor(Math.random() * (i + 1));\n this.cardsArray[randomInt].style.order = i;\n this.cardsArray[i].style.order = randomInt;\n }\n }", "hit(deck) {\n let incomingCard = deck.removeAndFetchTopMostCard();\n this.addCard(incomingCard);\n }", "function sortByAuthor() {\n let nodes = document.querySelectorAll('.bookCard')\n let authors = []\n nodes.forEach(node => authors.push(library[node.dataset.index].author))\n authors.sort()\n\n let order\n nodes.forEach((node) => {\n console.log(node)\n order = authors.findIndex(x => x === library[node.dataset.index].author)\n node.style.order = order\n })\n}", "sortBy() {\n // YOUR CODE HERE\n }", "function sortNumberBoard(){\n this.clearBoards()\n boardItems.sort();\n screenView()\n}", "onSorted(){\n if(this.column.sortable){\n this.column.sort = NextSortDirection(this.sortType, this.column.sort);\n\n this.onSort({\n column: this.column\n });\n }\n }", "function sort_hand(hand_info) {\n\tfor(let i = 1; i < hand_size; i++) {\n\t\tlet key = hand_info.hand[i];\n\t\tlet j = i - 1;\n\t\twhile(j >= 0 && hand_info.hand[j].rank < key.rank) {\n\n\t\t\thand_info.hand[j+1] = hand_info.hand[j];\n\t\t\tj--;\n\t\t}\n\t\thand_info.hand[j+1] = key;\n\t}\n}", "sort(sortable) {\n if (this.active != sortable.id) {\n this.active = sortable.id;\n this.direction = sortable.start ? sortable.start : this.start;\n }\n else {\n this.direction = this.getNextSortDirection(sortable);\n }\n this.sortChange.emit({ active: this.active, direction: this.direction });\n }", "sort(sortable) {\n if (this.active != sortable.id) {\n this.active = sortable.id;\n this.direction = sortable.start ? sortable.start : this.start;\n }\n else {\n this.direction = this.getNextSortDirection(sortable);\n }\n this.sortChange.emit({ active: this.active, direction: this.direction });\n }", "function place(card, slot) {\n slots[slot].unshift(card);\n}", "function onSortBy(sortBy) {\n setSort(sortBy);\n renderBooks();\n}", "function shuffle() {\n cards.forEach(card => {\n let randomPos = Math.floor(Math.random() * 12); \n card.style.order = randomPos; \n });\n}", "function shuffle() {\n cards.forEach(card=> {\n let randomPos = Math.floor(Math.random() * 16);\n card.style.order = randomPos;\n })\n}", "shufflePack() {\n for (let i = this.cardsArray.length - 1; i > 0; i--) {\n let randomIndex = Math.floor(Math.random() * (i + 1));\n this.cardsArray[randomIndex].style.order = i;\n this.cardsArray[i].style.order = randomIndex;\n }\n }", "_insertionSort() {\n let arr = this.curList.listItems;\n\n for (let i = 1; i < arr.length; i++) {\n let tempObj = arr[i];\n let tempValue = arr[i].sortingOrder;\n let j = i - 1;\n\n while (j >= 0 && tempValue < arr[j].sortingOrder) {\n arr[j + 1] = arr[j];\n j--;\n }\n arr[j + 1] = tempObj;\n }\n\n // Set sorted listItems arr to curList & alter curList in listCollection\n this.curList.listItems = arr;\n this.listCollection[this._findObjectAlgo()] = this.curList;\n\n this._setLocalStorage();\n }", "onChange(setTo) {\n\t\tthis.props.sortBy(setTo);\n\t}", "function RandomSortCardIndex(iCardIndexList)\r\r\n{\r\r\n DebugLn(\"RandomSortCardIndex\");\r\r\n \r\r\n var iiCard = 0;\r\r\n var topCard = iCardIndexList.length - 1;\r\r\n for (iiCard = 0; iiCard < topCard; iiCard++)\r\r\n {\r\r\n var numRemainingCards = iCardIndexList.length - iiCard;\r\r\n var iiSwap = Math.floor(numRemainingCards * Math.random()) + iiCard;\r\r\n if (iiSwap > topCard) \r\r\n iiSwap = topCard;\r\r\n if (iiSwap != iiCard)\r\r\n {\r\r\n var temp = iCardIndexList[iiCard];\r\r\n iCardIndexList[iiCard] = iCardIndexList[iiSwap];\r\r\n iCardIndexList[iiSwap] = temp;\r\r\n }\r\r\n }\r\r\n}", "function selectionSetSorted(){\n setClass(nodes[selectionSmallest], 2, \"Default\");\n setClass(nodes[selectionCurrent], 2, \"Sorted\"); //sets the current node to \"sorted\" color\n addStep(\"Current Node \" + (selectionCurrent + 1) + \" is now sorted.\");\n sortedSwitchStep++;\n}", "function shuffle(){\n Array.from(cards).forEach(card => {\n let randomPos = 0;\n randomPos = Math.floor(Math.random() * 20); \n card.style.order = randomPos;\n });\n}", "sort() {\n let time = 0;\n this.toggleSortButton(time);\n\n switch (this.state.currSelection) {\n case MERGESORT:\n time = this.mergeSort();\n break;\n case QUICKSORT:\n time = this.quickSort();\n break;\n case HEAPSORT:\n time = this.heapSort();\n break;\n case BUBBLESORT:\n time = this.bubbleSort();\n break;\n default:\n break;\n }\n\n this.toggleSortButton(time);\n }", "function SortDistributionsByRank(){\n\tdistros.sort(Sort);\n\tvar lastPlace = 1;\n\tfor (var i = 1; i < distros.length;i++){\n\t\tdistros[i].Place = 1;\n\t\tif (distros[i].ChoosedBy == distros[i-1].ChoosedBy)\n\t\t\tdistros[i].Place = lastPlace;\n\t\telse\n\t\t\tdistros[i].Place = ++lastPlace;\n\t}\n}", "function sortAscendDescend(e) {\n\tcardsList.innerHTML = ''; // clear the container for the new filtered cards\n\tif (e.target.value == 'ascending') {\n\t\tlet newArrAscend = dataArr.sort((a, b) => (a.name > b.name ? 1 : -1));\n\t\trenderCardList(newArrAscend);\n\t\tbtnLoadMore.style.display = 'none';\n\t} else if (e.target.value == 'descending') {\n\t\tlet newArrDescend = dataArr.sort((a, b) => (a.name < b.name ? 1 : -1));\n\t\trenderCardList(newArrDescend);\n\t\tbtnLoadMore.style.display = 'none';\n\t};\n}", "function shuffleCards(){\n\n cards.forEach(card => {\n let randomPos = Math.floor(Math.random()*18);\n card.style.order = randomPos;\n });\n}", "sort() {\n\t}", "sort() {\n\t}", "sortDonation(rev) {\n console.log(this.allBoxes);\n this.allBoxes = this.allBoxes.sort(compare);\n function compare(a, b) {\n let val;\n rev ? val = 1 : val = -1; \n let nameA = a.dataset.fundsNeeded;\n let nameB = b.dataset.fundsNeeded;\n return val * (nameA - nameB);\n }\n this.allBoxes.forEach(function(el, i) {el.style.order = i});\n }", "exchangeGainCard(card) {\n this.cards.push(card);\n ++this.numCards;\n }", "sort(key) {\n //used JavaScript sort method\n const sortedContacts = this.state.contacts.sort((contactA, contactB) => {\n return contactA[key] >= contactB[key] ? 1 : -1;\n });\n this.setState({ contacts: sortedContacts, reset: true })\n }", "function sort () {\n index++;\n predicate = ng.isFunction(getter(scope)) ? getter(scope) : attr.stSort;\n if (index % 3 === 0 && attr.stSkipNatural === undefined) {\n //manual reset\n index = 0;\n ctrl.tableState().sort = {};\n ctrl.tableState().pagination.start = 0;\n ctrl.pipe();\n } else {\n ctrl.sortBy(predicate, index % 2 === 0);\n }\n }", "function onSortChanged() {\n\n //Update the style values\n Object.keys($scope.sort)\n .forEach(updateValue);\n\n function updateValue(name) {\n var val = $scope.sort[name],\n field,\n desc;\n switch (val) {\n case true:\n field = name;\n desc = '';\n $scope.style.sort[name] = iconDown;\n break;\n case false:\n field = name;\n field += ' desc';\n $scope.style.sort[name] = iconUp;\n break;\n default:\n $scope.style.sort[name] = '';\n break;\n }\n\n if (field) {\n $scope.sortValue = field;\n }\n }\n }", "function sortComplete(){\n isSorting = false\n updateMenu()\n}", "function _setSort(obj) {\n return exports.PREFIX.set + ':' + _arraySort.call(this, Array.from(obj));\n}", "function sortChanged(){\n\tconst url2 = url+`&q=${name.val()}&t=${type.val()}&color=${color.val()}&s=${sort.val()}`;\n\tloadData(url2, displayData);\n}", "function rearrange (d, i) {\n\t\t// reset all the color to un-click\n\t\td3.selectAll(\"#sortBoxID\" + clickedSortByBox)\n\t\t\t.attr(\"fill\", whiteBackgroundColor)\n\t\t\t.style(\"opacity\", opacityUnclickSortBy);\n\n\t\t// update the sort button index\n\t\tclickedSortByBox = i;\n\n\t\t// fill color on the clicked box\n\t\td3.select(\"#sortBoxID\" + clickedSortByBox)\n\t\t\t.attr(\"fill\", clickedColor)\n\t\t\t.style(\"opacity\", opacityClickSortBy);\n\n\t\tvar sortBy = d.name;\n\t\t\n\t\tif (currSort === sortBy) {\n\t\t\t// it's the same, no need to resort\n\t\t\treturn;\n\t\t} \n\t\tcurrSort = sortBy;\n\t\t// sort the data\n\t\tif (sortBy === \"Sec ID\"){\n\t\t\t// right now, only secID is sorted in ascending order\n\t\t\tsortData(sectionData, d.sort, \"asec\");\n\t\t} else {\n\t\t\tsortData(sectionData, d.sort);\n\t\t}\n\t\t// redraw everything starting from the first layer\n\t\tfirstLayer();\n\t}", "function shuffle() {\n cards.forEach(card => {\n let randomPos = Math.floor(Math.random() * 12);\n card.style.order = randomPos;\n });\n}", "function sortDeckList() {\n\t// body...\n\n\tdeck_list.list = deck_list.list.sort( function(a, b) {\n\t\t\treturn parseFloat(a.mana) - parseFloat(b.mana);\n\t\t}\n\t);\n}", "function shuffle() {\n cards.forEach((card) => {\n let randomPos = Math.floor(Math.random() * 7);\n card.style.order = randomPos;\n });\n}", "sort () {\r\n this._data.sort((a, b) => a.sortOrder !== b.sortOrder ? b.sortOrder - a.sortOrder : a.value.localeCompare(b.value))\r\n }", "gainCard(card) {\n this.cards.push(card);\n this.out = false;\n if (this.numCards < 2) {\n ++this.numCards;\n }\n }", "function canBeSorted() {\n return true;\n }", "flipCard(card) {\n if (this.canFlipCard(card)) {\n this.totalClicks++;\n this.moveTicker.innerText = this.totalClicks;\n card.classList.add('visible');\n if (this.cardToCheck) {\n this.checkForCardMatch(card);\n } else {\n this.cardToCheck = card;\n };\n }\n }", "function shuffleCards() {\n cards.forEach(card => {\n let randomCard = Math.floor(Math.random()*18);\n card.style.order = randomCard;\n });\n}", "sort() {\n for (let c = 0; c < this._unsorted.length; c++) {\n const el = this._unsorted[c];\n\n // element may not even be a LitXR Web Component, it could be\n // a normal div, button, etc - therefore recursion may be needed to find its surface\n const surface = el.surface ? el.surface : LitXR.findSurface(el);\n\n // can't depend on surface existing due to timing issues when the component is first starting up, so defer processing\n if (!surface) { return; } // TODO: don't return, manage the unsorted list better\n\n if (this._sorted.has(surface)) {\n this._sorted.get(surface).push(el);\n } else {\n this._sorted.set( surface, [el]);\n }\n }\n this._unsorted = [];\n }", "function sortByScore()\n {\n newsItems.sort(function(a,b) {return a.points<b.points});\n console.log(newsItems);\n\n addNewsListItems();\n\n }", "function sortSelectCallback() {\n let sortType = $(this).val();\n setStatus(\"sortType\", sortType);\n\n console.log(\"sort clicked\");\n\n //TODO: Can we do this without referencing sg namespace?\n sg.cardContainer.sortCards(orderCodes[sortType]);\n }", "function handleSortButton() {\n let list = document.getElementById('stocksDiv')\n let items = document.querySelectorAll('#stocksDiv li')\n let checkButton = $(this).attr('data-sort')\n let sorted = [...items].sort(function (a, b) {\n if (checkButton === \"sortDown\") {\n return b.getAttribute('rating') - a.getAttribute('rating');\n }\n return a.getAttribute('rating') - b.getAttribute('rating');\n })\n list.innerHTML = ''\n for (let li of sorted) {\n list.appendChild(li)\n }\n}", "function handleDragDrop(globals, sortClass, legalMove, chainSort) {\n var space = globals.SPACE;\n var pad = globals.PADDING;\n var draggable_sibling;\n\tvar startIndex, endindex;\n\t\n $(sortClass).sortable({\n tolerance: 'pointer',\n axis: 'x',\n start: function (event, ui) {\n\t\t\tstartIndex = $(ui.item).index();\n draggable_sibling = $(ui.item).prev();\n }, \n stop: function (event, ui) {\n\t\t\tendIndex = $(ui.item).index();\n var cardIndex = parseInt($(ui.item).attr('id'));\n if (legalMove(globals, ui, startIndex, endIndex)) {\n // Stats\n incrementOps(globals);\n\n // Move cards\n spacifyCards(globals);\n\t\t\t\t\n\t\t\t\tvar movedCard = globals.cardArray[startIndex];\n\t\t\t\tif (endIndex > startIndex) {\n\t\t\t\t\tfor (var i = startIndex; i < endIndex; i++) {\n\t\t\t\t\t\tglobals.cardArray[i] = globals.cardArray[i+1];\n\t\t\t\t\t\tif (globals.cardArray[i].value == globals.pivot_value){\n\t\t\t\t\t\t\tglobals.pivot_pos = i;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tglobals.cardArray[endIndex] = movedCard;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tfor (var i = startIndex; i > endIndex; i--) {\n\t\t\t\t\t\tglobals.cardArray[i] = globals.cardArray[i-1];\n\t\t\t\t\t\tif (globals.cardArray[i].value == globals.pivot_value){\n\t\t\t\t\t\t\tglobals.pivot_pos = i;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t\tglobals.cardArray[endIndex] = movedCard;\n\t\t\t\t}\n\n\t\t\t\t// Extra call to chainsort, allows us to sort cards that get swapped into place\n\t\t\t\t// Added the check as a bug fix for https://trello.com/c/hFZl4hab\n\t\t\t\t// still working as we expected for swapping.\n\t\t\t\tif (chainSort(globals)){setSorted(globals, globals.pivot_pos);};\n\n\t\t\t}\n // Not legal - return to previous position\n else {\n $(ui.item).insertAfter(draggable_sibling);\n $(ui.item).css({\n 'top': '0px'\n });\n }\n\n // Handle sortedness as a result of the drag / drop\n // setSorted(globals, cardIndex);\n // chainSort(globals, cardIndex);\n\n }\n });\n}", "function initCardShuffle() {\n // Shuffle cards, then reset their states and move them in the shuffled order. \n [...memoryGrid.querySelectorAll('.card')]\n\n .sort(function () {\n return 0.5 - Math.random();\n })\n .forEach(function (elem) {\n\n resetCard(elem);\n\n memoryGrid.appendChild(elem);\n });\n }", "shuffleCards(cardArray) {\n for (let i = cardArray.length - 1; i > 0; i--) {\n let randIndex = Math.floor(Math.random() * (i + 1));\n cardArray[randIndex].style.order = i;\n cardArray[i].style.order = randIndex;\n }\n }", "handleSort() {\n this.state.sort === true\n ? this.setState({ sort: false })\n : this.setState({ sort: true });\n }", "function setSort(objName) {\n vm.predicate = objName;\n vm.reverse = !vm.reverse;\n }", "set cachedSortingLayerValue(value) {}", "function shuffle() {\n cards.forEach(card => {\n let randomCards = Math.floor(Math.random() * 12);\n card.style.order = randomCards;\n });\n}", "function fcnSortCardsCmd(SortCmd) {\n \n switch (SortCmd) {\n case 'Staple' : fcnSortDeckStaple(); break;\n case 'Type / Card' : fcnSortDeckTypeName(); break;\n case 'Type / Color' : fcnSortDeckTypeColor(); break;\n case 'Color' : fcnSortDeckColor(); break;\n case 'Card Name' : fcnSortDeckCardName(); break;\n case 'Category' : fcnSortDeckCategory(); break;\n case 'Notes' : fcnSortDeckNotes(); break;\n }\n}", "function list_set_sort(col)\n {\n if (settings.sort_col != col) {\n settings.sort_col = col;\n $('#notessortmenu a').removeClass('selected').filter('.by-' + col).addClass('selected');\n rcmail.save_pref({ name: 'kolab_notes_sort_col', value: col });\n\n // re-sort table in DOM\n $(noteslist.tbody).children().sortElements(function(la, lb){\n var a_id = String(la.id).replace(/^rcmrow/, ''),\n b_id = String(lb.id).replace(/^rcmrow/, ''),\n a = notesdata[a_id],\n b = notesdata[b_id];\n\n if (!a || !b) {\n return 0;\n }\n else if (settings.sort_col == 'title') {\n return String(a.title).toLowerCase() > String(b.title).toLowerCase() ? 1 : -1;\n }\n else {\n return b.changed_ - a.changed_;\n }\n });\n }\n }", "resetSorting() {\n this.sortings = [];\n }", "visualizeSelectionSort() {\n console.log(\"Selection Sort\");\n const array = this.state.array;\n array.forEach((element) => {\n element.visited = false; // if already sorted and clicked the sort function again... we just need to reset the visited flags\n });\n\n for (let i = 0; i < BAR_COUNT - 1; i++) {\n let minPos = i;\n for (let j = i + 1; j < BAR_COUNT; j++) {\n setTimeout(() => {\n if (array[minPos].number > array[j].number) {\n minPos = j;\n }\n let key = array[minPos];\n while (minPos > i) {\n array[minPos] = array[minPos - 1];\n minPos--;\n }\n array[i] = key;\n array[i].visited = true;\n this.setState({array:array,sorted:i === BAR_COUNT - 2 && j === BAR_COUNT - 1});\n }, i * SORTING_SPEED);\n }\n }\n }" ]
[ "0.70687985", "0.6549775", "0.62567806", "0.6168512", "0.6131611", "0.59777063", "0.58453494", "0.5823961", "0.57884926", "0.5781722", "0.57808983", "0.57802534", "0.5776661", "0.5752555", "0.5728674", "0.5721736", "0.56574416", "0.5646556", "0.5619388", "0.5619064", "0.5616602", "0.5607104", "0.56019264", "0.5590857", "0.5587588", "0.5586429", "0.557", "0.5545176", "0.5543108", "0.5542165", "0.55369455", "0.55309665", "0.5528787", "0.55193645", "0.5504093", "0.54908276", "0.54908276", "0.5485668", "0.5483089", "0.54740125", "0.54740125", "0.54740125", "0.5468687", "0.5461164", "0.5453489", "0.5449191", "0.5439053", "0.5436611", "0.5422941", "0.5419925", "0.54156345", "0.54156345", "0.54125583", "0.54065776", "0.54062253", "0.5403903", "0.53896767", "0.5386667", "0.5385451", "0.5385294", "0.53763026", "0.53754205", "0.5373018", "0.5370968", "0.5370127", "0.53688", "0.5367686", "0.5367686", "0.5363706", "0.5361724", "0.53547233", "0.5353907", "0.5345902", "0.53360033", "0.5333822", "0.53222543", "0.5319726", "0.53182805", "0.53168476", "0.53160274", "0.53076416", "0.5306942", "0.5281731", "0.52737117", "0.526959", "0.5269269", "0.5268686", "0.5263168", "0.52580446", "0.5257547", "0.525293", "0.5247434", "0.5243871", "0.52408934", "0.5235896", "0.52317196", "0.5230547", "0.52284586", "0.52284324", "0.5226549" ]
0.6925067
1
The player of the game State==0 means, that it is not their turn State==1 means, that it is their turn
constructor (color,human){ this.color = color; this.human = human; this.stones_hand = 9; this.stones_atall = 9; this.action = 'put'; if (this.color == 'black'){ this.state = 0; }else{ this.state = 1; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isMyTurn() {\n return playerId == turn;\n}", "isTheseusTurn()\n\t{\n\t\tif(this.props.ctx.currentPlayer==='0'){\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\treturn false;\n\t}", "function PendingPlayerState() { }", "winnerIs(state){\n return state.players[0]['isXWin'] ? state.players[0]['playerX'] : state.players[0]['playerO']\n }", "function getState() {\r\n return playerState_;\r\n }", "function playerToggle() {\n\n if (playerOne) {\n console.log(\"Player One's turn.\")\n playerOneScore += 1\n // diceRoll()\n playerOne = false;\n console.log(`P1 score is: ${playerOneScore}`)\n\n }\n else if (!playerOne) {\n console.log(\"Player Two's turn\")\n playerOne = true;\n playerTwoScore += 1\n // diceRoll()\n console.log(`P2 score is: ${playerOneScore}`)\n }\n}", "function whosTurn() {\n turnCounter++;\n if(turnCounter % 2 === 0){\n player1 = true\n player2 = false\n } else {\n player1 = false\n player2 = true\n }\n console.log(turnCounter);\n}", "function takeTurn()\r\n {\r\n player1 = !player1;\r\n\r\n if(currentPlayer() == 1)\r\n {\r\n $(\".turn\").html(\"<p>It is <span class=X>Player1</span>'s turn.</p>\");\r\n }\r\n else\r\n {\r\n $(\".turn\").html(\"<p>It is <span class=O>Player2</span>'s turn.</p>\");\r\n }\r\n }", "function gameOver(){\n state = 2;\n}", "function playerTurn() {\n if (player === 1) {\n player = 2;\n }else {\n player = 1;\n }\n}", "function player(){\n return ( turn & 1 ) ? \"O\" : \"X\";\n}", "currentPlayer(state) {\n return state.players[0]['isXTurn'] ? state.players[0]['playerX'] : state.players[0]['playerO']\n }", "function checkTurn() {\n\n if (actingPlayer === turnOf && alreadyTakenTurn === true) {\n cycleTurn();\n } else if (actingPlayer === turnOf && alreadyTakenTurn === false) {\n alreadyTakenTurn = true;\n }\n}", "switchPlayersTurn(){\n if (this.currPlayerTurn === 1)\n this.playerTurn = 2;\n else\n this.playerTurn = 1;\n }", "waitingState(){\n\n // If there are more than 1 player (DummyPlayer doesnt count) and the game isn't started or starting\n\n if(this.playerPool.activePlayers.length >2){\n\n this.gameState = STATE_COUNT_DOWN;\n console.log(\"Game starting.\");\n let game = this;\n this.gameStartTime = new Date().getTime();\n setTimeout(function(){\n game.lastTroopIncTime = new Date().getTime();\n game.gameState = STATE_RUNNING;\n game.gameSocket.emit('startGame');\n }, TIME_TILL_START, game);\n }\n }", "function playerTurn(){\n\tif (playerCounter%2 === 0) {\n\t\treturn \"player1\";\n\t} else return \"player2\";\n}", "function getGameState() {\n\t\treturn gameOngoing;\n\t}", "function checkGameStatus() {\r\n\tnumTurns++; //count turns\r\n\t\r\n\t//check for tie\r\n\tif (numTurns == 9) {\r\n\t\tgameStatus = \"Tie Game\";\r\n\t}//numTurns\r\n\t\r\n\t//check window\r\n\tif (checkWin()) {\r\n\t\tgameStatus = currentPlayer + \" wins!\";\r\n\t}//check wins\r\n\r\n\t//switch current player\r\n\tcurrentPlayer = (currentPlayer == \"X\" ? \"O\" : \"X\" );\r\n}//checkGameStatus", "switchTurn() {\n if (!this.extraTurn) {\n this.playerOne.isTurn = !this.playerOne.isTurn;\n this.playerTwo.isTurn = !this.playerTwo.isTurn;\n }\n else {this.extraTurn = false;}\n }", "function takeTurns() {\n self.gameBoard.turn++;\n if (self.gameBoard.turn % 2 === 0) {\n return \"o\";\n }\n else {\n return \"x\";\n }\n\n }", "isGameStarted() {\n return this.gameState === GAME_STARTED;\n }", "function checkGameStatus(){\r\n\tnumTurns++; //count turn\r\n\t\r\n\tif (checkWin()) {\r\n\t\tgameStatus = currentPlayer + \" Wins\";\r\n\t\tconsole.log(\"Game status: \" + gameStatus);\r\n\t}else if (numTurns == 9) {\r\n\t\tgameStatus = \"TIE\";\r\n\t\tconsole.log(\"Game status: \" + gameStatus);\r\n\t}\r\n\t\r\n\tcurrentPlayer = (currentPlayer == \"X\" ? \"O\" : \"X\");\r\n\t\r\n\tif (gameStatus != \"\"){\r\n\t\tshowLightBox(\"Game is Over: \", gameStatus);\r\n\t\tconsole.log(\"Game is Over: \" + gameStatus);\r\n\t}\r\n} // checkGameStatus", "playerStateChanged(playerCurrentState) {\n // console.log('player current update state', playerCurrentState)\n }", "check_GameOver() {\n if (this.model.winner == 0) {\n if (this.currentPlayerBot == 0) {\n this.scene.undo_play = false;\n this.state = 'WAIT_UNDO';\n }\n else\n this.state = 'CHANGE_PLAYER';\n }\n else{\n this.state = 'GAME_OVER';\n this.scene.showGameMovie = false;\n this.view.incWinsPlayer(this.model.winner);\n }\n }", "function playerOneMadeChoice() {\n console.log(\"this is the player 1 choice: \", player1.choice);\n player1.choice ? true : false;\n }", "gameInStartState() {\n return this.gameState === LOBBY || this.gameState > SHOWDOWN;\n }", "function nextTurn() {\r\n if (turnX === true) {\r\n turnX = false;\r\n turnO = true;\r\n $(\"#currentPlayer\").text(\"Current player: O\");\r\n } else if (turnO === true) {\r\n turnO = false;\r\n turnX = true;\r\n $(\"#currentPlayer\").text(\"Current player: X\");\r\n }\r\n }", "function myTurn() {\n return playerInfo.playingAs == getLongColor(board.turn());\n }", "function findWinner() {\n if (computerScore >= 121) {\n state = \"computerWon\";\n gameSequence();\n return true;\n } else if (playerScore >= 121) {\n state = \"playerWon\";\n gameSequence();\n return true;\n } else {\n return false;\n }\n\n}", "onEnteringState(stateName) {\n switch (stateName) {\n case 'playerTurn':\n break;\n default:\n break;\n }\n }", "function whos_turn()\n{\n\tconsole.log(\"who's turn run\");\n\tif (player_index == 0){\n\t\t$(\".Xplayer\").addClass(\"playerTurn\");\n\t\t$(\".Oplayer\").removeClass(\"playerTurn\");\n\t}\n\telse {\n\t\t$(\".Xplayer\").removeClass(\"playerTurn\");\n\t\t$(\".Oplayer\").addClass(\"playerTurn\");\n\t}\n}", "updateTurnStatus(bigIndexX, bigIndexY, littleIndexX, littleIndexY)\n {\n if (game.vsAi) {\n console.log(\"updateTurnStatus: single player AI\");\n if(game.isOver(bigIndexX, bigIndexY, littleIndexX, littleIndexY)) {\n if(game.isDraw) {\n game.displayWinner()\n }\n\n game.waiting = true\n }\n else {\n game.switchTurn(bigIndexX, bigIndexY, littleIndexX, littleIndexY);\n game.waiting = true;\n console.log(game.board);\n\n var aiMoveCoords = []\n aiMoveCoords = game.aiMakesMove(littleIndexX, littleIndexY);\n game.switchTurn(aiMoveCoords[0], aiMoveCoords[1], aiMoveCoords[2], aiMoveCoords[3]);\n game.waiting = false;\n\n }\n }\n else if(game.singleplayer)\n {\n //if single player, check if game ended right after placing a piece\n if(game.isOver(bigIndexX, bigIndexY, littleIndexX, littleIndexY))\n {\n if(game.isDraw) {\n game.displayWinner()\n }\n game.waiting = true\n }\n else\n game.switchTurn(bigIndexX, bigIndexY, littleIndexX, littleIndexY)\n }\n //if multiplayer, set waiting to true so that you can't place two pieces in one turn\n else\n {\n //send updated board to the server so the opponent's board is updated too\n var data = {board:game.board, bx:bigIndexX, by:bigIndexY, lx: littleIndexX, ly: littleIndexY, id:game.id};\n Client.sendClick(data);\n }\n\n //for debugging\n game.printBoard();\n }", "function nextTurn(){\n\tchangeDiscard();\n\tplayerTurnIs();\n}", "winCheck() {\n if (this.state.A1 === this.state.A2 && this.state.A2 === this.state.A3) {\n this.updateState(this.state.A2)\n } else if (this.state.B1 === this.state.B2 && this.state.B3 === this.state.B2) {\n this.updateState(this.state.B2)\n } else if (this.state.C1 === this.state.C2 && this.state.C3 === this.state.C2) {\n this.updateState(this.state.C2)\n } else if (this.state.A1 === this.state.B2 && this.state.C3 === this.state.B2) {\n this.updateState(this.state.B2)\n } else if (this.state.C1 === this.state.B2 && this.state.A3 === this.state.B2) {\n this.updateState(this.state.B2)\n } else if (this.state.A1 === this.state.B1 && this.state.C1 === this.state.B1) {\n this.updateState(this.state.B1)\n } else if (this.state.A2 === this.state.B2 && this.state.C2 === this.state.B2) {\n this.updateState(this.state.B2)\n } else if (this.state.A3 === this.state.B3 && this.state.C3 === this.state.B3) {\n this.updateState(this.state.B3)\n } else if ((this.state.availCells.length <= 1) && (this.state.winner === '')) {\n this.updateState('draw')\n } else {this.nextTurn()}\n }", "function moveOnToNextPlayer(gamestate) {\n gamestate.currentPlayer = -gamestate.currentPlayer\n gamestate.computerIsThinking = !gamestate.computerIsThinking\n}", "function checkWinOrLose() {\n if (squares.length === 0) {\n state = `win`;\n console.log(\"win\");\n } else if (balls.length === 0) {\n state = `lose`;\n }\n}", "function StartTurn()\n{\n\tisTurning = true;\n}", "function computerWillPlay(){\n\tconsole.log(\"turn count before computer plays:\", turn);\n\tvar computerNeedsToPlay = true;\t// TO DO - clean up logic. I'm using this sometimes but not always.\n\n\t// DECIDE WHAT TILE TO PLAY ON\n\n\t// first play by computer, only two choices\n\tif (turn === 1){\n\t\t// if user went in center, computer goes in lower left corner\n\t\t// TO DO - randomize where computer goes to make game more realistic\n\t\tif (userTiles[0] === 4){\n\t\t\tdecision = tile6;\n\t\t} else {\n\t\t\t// if user went anywhere except center, computer goes in center\n\t\t\tdecision = tile4;\n\t\t}\n\t}\n\n\t// block user if user is about to win\n\t\t// TO DO - add more of these for when user goes in center\n\t\t\t// these options are only for when computer goes in center first\n\t\t// TO DO - more efficient way to check if user has played two \n\t\t\t// out of any three squares that make a win\n\t\t\t// and to go in third square to block\n\tif (turn > 2 && computerNeedsToPlay){\n\t\t// openTiles[2] !== null is to not mark this tile if it has already been marked\n\t\tif ( (openTiles[2] !== null && userTiles[0] === 0 && userTiles[1] === 1) ||\n\t\t\t (openTiles[2] !== null && userTiles[0] === 1 && userTiles[1] === 0) ||\n\t\t\t (openTiles[2] !== null && userTiles[0] === 5 && userTiles[1] === 8) ||\n\t\t\t (openTiles[2] !== null && userTiles[0] === 8 && userTiles[1] === 5) ){\n\t\t\t\tdecision = tile2;\n\t\t}\n\t\tif ( (openTiles[0] !== null && userTiles[0] === 1 && userTiles[1] === 2) ||\n\t\t\t (openTiles[0] !== null && userTiles[0] === 2 && userTiles[1] === 1) ||\n\t\t\t (openTiles[0] !== null && userTiles[0] === 6 && userTiles[1] === 3) ||\n\t\t\t (openTiles[0] !== null && userTiles[0] === 3 && userTiles[1] === 6) ){\n\t\t\t\tdecision = tile0;\n\t\t}\n\t\tif ( (openTiles[6] !== null && userTiles[0] === 0 && userTiles[1] === 3) ||\n\t\t\t (openTiles[6] !== null && userTiles[0] === 3 && userTiles[1] === 0) ||\n\t\t\t (openTiles[6] !== null && userTiles[0] === 7 && userTiles[1] === 8) ||\n\t\t\t (openTiles[6] !== null && userTiles[0] === 8 && userTiles[1] === 7) ){\n\t\t\t\tdecision = tile6;\n\t\t}\n\t\tif ( (openTiles[8] !== null && userTiles[0] === 2 && userTiles[1] === 5) ||\n\t\t\t (openTiles[8] !== null && userTiles[0] === 5 && userTiles[1] === 2) ||\n\t\t\t (openTiles[8] !== null && userTiles[0] === 6 && userTiles[1] === 7) ||\n\t\t\t (openTiles[8] !== null && userTiles[0] === 7 && userTiles[1] === 6) ){\n\t\t\t\tdecision = tile8;\n\t\t}\n\t\tif ( (openTiles[1] !== null && userTiles[0] === 0 && userTiles[1] === 2) ||\n\t\t\t (openTiles[1] !== null && userTiles[0] === 2 && userTiles[1] === 0) ){\n\t\t\t\tdecision = tile1;\n\t\t}\n\t\tif ( (openTiles[3] !== null && userTiles[0] === 0 && userTiles[1] === 6) ||\n\t\t\t (openTiles[3] !== null && userTiles[0] === 6 && userTiles[1] === 0) ){\n\t\t\t\tdecision = tile3;\n\t\t}\n\t\tif ( (openTiles[5] !== null && userTiles[0] === 2 && userTiles[1] === 8) ||\n\t\t\t (openTiles[5] !== null && userTiles[0] === 8 && userTiles[1] === 2) ){\n\t\t\t\tdecision = tile5;\n\t\t}\n\t\tif ( (openTiles[7] !== null && userTiles[0] === 6 && userTiles[1] === 8) ||\n\t\t\t (openTiles[7] !== null && userTiles[0] === 8 && userTiles[1] === 6) ){\n\t\t\t\tdecision = tile7;\n\t\t}\n\n\t\tcomputerNeedsToPlay = false;\n\t}\n\n\n\t// second play by computer\n\t// TO DO - logic for this and previous set of ruls is conflicting, this does not get run\n\tif (turn === 3 && computerNeedsToPlay){\n\t\t// if computer went in center\n\t\tif (computerTiles[0] === 4){\n\t\t\t// and user has played opposite corners\n\t\t\tif ( (userTiles[0] === 0 && userTiles[1] === 8 ) || \n\t\t\t\t (userTiles[0] === 8 && userTiles[1] === 0 ) ||\n\t\t\t\t (userTiles[0] === 2 && userTiles[1] === 6 ) ||\n\t\t\t\t (userTiles[0] === 6 && userTiles[1] === 2 ) \n\t\t\t\t ){\n\t\t\t\t\t// computer can go in any middle/edge, so let's choose top center\n\t\t\t\t\t// TO DO - choose middle/edge adjacent to where user just played\n\t\t\t\t\t decision = tile1;\n\t\t\t}\n\t\t\t// and user has gone in a spot adjacent to the opposite corner from their first move\n\t\t\t// (other middle/edge cases should be caught by previous logic for user having two in a row)\n\t\t\telse {\n\t\t\t\t// computer should go in the 'other' edge adjacent to expected opposite corner\n\t\t\t\tif ( (userTiles[0] === 0 && userTiles[1] === 5) ||\n\t\t\t\t\t (userTiles[0] === 2 && userTiles[1] === 3) ){\n\t\t\t\t\t\tdecision = tile7;\n\t\t\t\t}\n\t\t\t\telse if ( (userTiles[0] === 0 && userTiles[1] === 7) ||\n\t\t\t\t\t (userTiles[0] === 6 && userTiles[1] === 1) ){\n\t\t\t\t\t\tdecision = tile5;\n\t\t\t\t}\n\t\t\t\telse if ( (userTiles[0] === 2 && userTiles[1] === 7) ||\n\t\t\t\t\t (userTiles[0] === 8 && userTiles[1] === 1)) {\n\t\t\t\t\t\tdecision = tile3;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t// if ( (userTiles[0] === 6 && userTiles[1] === 5) ||\n\t\t\t\t\t // (userTiles[0] === 8 && userTiles[1] === 3) ){\n\t\t\t\t\t\tdecision = tile1;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\n\t\t} \n\t\t// if computer went in lower left corner\n\t\t// else { \n\t\t\t// TO DO - add logic for if user went in center on first turn\n\t\t// }\n\n\t}\n\n\t// TO DO - look to see if computer has two in a row with the option to win\n\tif (turn > 4){\n\t\tif (computerTiles[0] === 4 && computerTiles[1] === 0){\n\t\t\tdecision = tile8;\n\t\t}\n\t\tif (computerTiles[0] === 4 && computerTiles[1] === 2){\n\t\t\tdecision = tile6;\n\t\t}\n\t\tif (computerTiles[0] === 4 && computerTiles[1] === 8){\n\t\t\tdecision = tile0;\n\t\t}\n\t\tif (computerTiles[0] === 4 && computerTiles[1] === 6){\n\t\t\tdecision = tile2;\n\t\t}\n\n\t}\n\n\n\n\t// ONCE DECISION HAS BEEN MADE,\n\t// MAKE CHANGES TO BOARD\n\tdecision.removeEventListener(\"click\", removeClickListener, false);\n\tdecision.classList.add(\"played\");\n\tdecision.innerHTML = \"c\";\n\n\tcurrentTileNumber = parseInt(decision.id.slice(-1), 10);\n\tcomputerTiles.push(currentTileNumber);\n\topenTiles[currentTileNumber] = null;\n\tconsole.log(\"computerTiles: \", computerTiles);\n\tconsole.log(\"openTiles: \", openTiles);\n\n\t// last thing computer does is update turn play\n\tturn += 1;\n\tconsole.log(\"turn count after computer plays:\", turn);\n}", "isGameOpen() {\n return this.gameState === GAME_OPEN;\n }", "function turnFee() {\n if (actingPlayer === turnOf) {\n return 0;\n } else {\n return 1;\n }\n}", "checkIfPlayersTurn (playerId) {\n return playerId === this.currentTurn\n }", "function whoIsActive() { // Player.js (179) if (move)\n if (player1Active) {\n activePlayer = 2;\n notActivePlayer = 1;\n setActivePlayer(player2, player1, powerDiv2); // Info.js (21) Set attributes to the active player to use them by replacing weapon\n setActiveBoard(notActivePlayer, activePlayer); //Info.js (27) Add a class for a playerDiv of the active player to display current information about game flow\n displayMessageOnBoard(activePlayer); // Info.js (32) Display random message on active player's div\n } else {\n activePlayer = 1; \n notActivePlayer = 2;\n setActivePlayer(player1, player2, powerDiv1);\n setActiveBoard(notActivePlayer, activePlayer,);\n displayMessageOnBoard(activePlayer);\n }\n\n}", "function turnPasses() {\n \"use strict\";\n var state = checkState(getBoardCells(board));\n if (state === 'win') {\n end('O wins!');\n } else if (state === 'loss') {\n end('X wins!');\n } else if (state === 'tie') {\n end('Tie');\n }\n}", "function playTurn (index) {\n if(grid[index] || isGameOver()) {\n return false\n } else {\n console.log(\"player: \" + player)\n grid[index] = player\n if (player === 1) player = 2\n else player = 1\n console.log(\"grid: \" + grid.join(\" \"))\n return true\n }\n}", "opponent() {\n return this.players[1 - this.turn]\n }", "function playTurn (index) {\n console.log('entered');\n if (grid[index] || isGameOver()){\n return false\n } else {\n grid[index] = player\n if (player === 1) player = 2\n else player = 1\n return true\n}\n}", "prepareNextState() {\n this.gameOrchestrator.changeState(new CheckGameOverState(this.gameOrchestrator));\n }", "function gameStatus() {\n var curPlayer;\n \n if (game.currentPlayer == 'user') {\n curPlayer = game.user;\n } else if (game.currentPlayer == 'computer') {\n curPlayer = game.computer;\n }\n \n switch (true) {\n case $('#first').html() === curPlayer && $('#second').html() === curPlayer &&\n $('#third').html() === curPlayer:\n show('#first', '#second', '#third');\n break;\n case $('#fourth').html() === curPlayer && $('#fifth').html() === curPlayer &&\n $('#sixth').html() === curPlayer:\n show('#fourth', '#fifth', '#sixth');\n break;\n case $('#seventh').html() === curPlayer && $('#eight').html() === curPlayer &&\n $('#nineth').html() === curPlayer:\n show('#seventh', '#eight', '#nineth');\n break;\n case $('#first').html() === curPlayer && $('#fourth').html() === curPlayer &&\n $('#seventh').html() === curPlayer:\n show('#first', '#fourth', '#seventh');\n break;\n case $('#second').html() === curPlayer && $('#fifth').html() === curPlayer &&\n $('#eight').html() === curPlayer:\n show('#second', '#fifth', '#eight');\n break;\n case $('#third').html() === curPlayer && $('#sixth').html() === curPlayer &&\n $('#nineth').html() === curPlayer:\n show('#third', '#sixth', '#nineth');\n break;\n case $('#first').html() === curPlayer && $('#fifth').html() === curPlayer &&\n $('#nineth').html() === curPlayer:\n show('#first', '#fifth', '#nineth');\n break;\n case $('#third').html() === curPlayer && $('#fifth').html() === curPlayer &&\n $('#seventh').html() === curPlayer:\n show('#third', '#fifth', '#seventh');\n break;\n default:\n draw();\n }\n }", "function whoseTurn() {\n if (playerTurn % 2 !== 0) {\n $('h1').html('Player 1, Your turn. Choose a target!');\n if ($(this).hasClass('f1')) {\n if ($(this).hasClass('ship')) {\n //hitShip();\n //playerOneScore += 1;\n //$('.first').html(playerOneScore);\n checkWinner();\n whoseTurn();\n }\n else {\n whoseTurn();\n }\n }\n else {\n whoseTurn();\n }\n }\n else {\n //(playerTurn % 2 === 0)\n $('h1').html('Player 2, Your turn. Choose a target!');\n if ($(this).hasClass('f2')) {\n if ($(this).hasClass('ship')) {\n //hitShip();\n //playerTwoScore += 1;\n //$('.second').html(playerTwoScore);\n checkWinner();\n whoseTurn();\n }\n else {\n whoseTurn();\n }\n }\n else {\n whoseTurn();\n }\n }\n //}\n}", "checkForWin() {\n if (this.numMafia <= 0) { this.gameState = TOWN_WIN; }\n if (this.getInnocentPlayerCount() <= 0) { this.gameState = MAFIA_WIN; }\n }", "function conclusionConditions() {\n //If you score 6 points, you win\n if (bubblePoints >= 6) {\n state = `poppinChampion`;\n }\n //If your lives reaches 0, game over\n if (lives <= 0) {\n state = `bubblePoppinBaby`;\n }\n}", "isGameOver() {\n return this.gameState === GAME_OVER;\n }", "function checkState() {\n if (state === `simulation`) {\n simulation();\n } else if (state === `win`) {\n win();\n } else if (state === `lose`) {\n lose();\n }\n}", "function currentTurn(t) {\r\n return state(t, t.currentTurn);\r\n }", "function takeTurn () {}", "function switchTurn() {\n\tif (!gameOver) {\n\t\tif (activePlayer == player1) {\n\t\t\tactivePlayer = player2;\n\t\t} else {\n\t\t\tdecideWinner();\n\t\t}\n\t}\n}", "alternateTurns() {\n this.turn = (this.turn === 'X' ? 'O' : 'X');\n }", "function doTurn(element){\n updateState(element);\n turn++;\n if(checkWinner()){\n saveGame();\n clearGame();\n }else if(turn === 9){\n setMessage(\"Tie game.\")\n saveGame();\n clearGame();\n }\n}", "function whichStateLeft() {\n if (gamesHex == 0 && gamesDia == 0 && gamesSqu == 0){\n state0Left();\n }\n else if (gamesHex == 0 && gamesDia == 0 && gamesSqu >= 1){\n state1Left();\n }\n else if (gamesHex == 0 && gamesDia >= 1 && gamesSqu == 0){\n state2Left();\n }\n else if (gamesHex == 0 && gamesDia >= 1 && gamesSqu >= 1){\n state3Left();\n }\n else if (gamesHex >= 1 && gamesDia == 0 && gamesSqu == 0){\n state4Left();\n }\n else if (gamesHex >= 1 && gamesDia == 0 && gamesSqu >= 1){\n state5Left();\n }\n else if (gamesHex >= 1 && gamesDia >= 1 && gamesSqu == 0){\n state6Left();\n }\n else if (gamesHex >= 1 && gamesDia >= 1 && gamesSqu >= 1){\n state7Left();\n }\n }", "function turnChange() {\n if (turnTracker === 1) {\n playerOneName[0].classList.remove(\"active\");\n playerTwoName[0].classList.add(\"active\");\n turnTracker = 2;\n }\n else {\n playerTwoName[0].classList.remove(\"active\");\n playerOneName[0].classList.add(\"active\");\n turnTracker = 1;\n }\n}", "function UserFirst() {\n if (!gameOver && !oneOption) {\n oneOption = true;\n computer = \"O\";\n user = \"X\";\n canPlay = true;\n currentState.whichPlayerPlayed = userWinValue;\n setMessage(\"You are X's\");\n }\n}", "function setChoosingStateOn() {\n\t\tplayerIsChoosing = true;\n\t}", "constructor(name) {\n this.name = name\n this._started = false\n\n // Index of whose turn it is.\n // The human at the controls is always 0 here.\n // We just start off with it not being our turn so that the UI\n // will be disabled - when we actually start the game it may or\n // may not be our turn.\n this.turn = 1\n\n this.players = [new PlayerState(this.name, true),\n new PlayerState(\"waiting for opponent...\", false)]\n\n // The name of the winner\n this.winner = null\n }", "turn () {\n return this.chessGame.getTurn()\n }", "function determineGameStatus() {\n var player1 = [];\n var player2 = [];\n\n for(var index = 0;index < arrayMatrix.length;index++) {\n //console.log(index, arrayMatrix[index]);\n if (arrayMatrix[index] === \"player1\") {\n player1.push(index);\n }\n if (arrayMatrix[index] === \"player2\") {\n player2.push(index);\n }\n }\n ///console.log(\"player1\",player1);\n //console.log(\"player2\",player2);\n // console.log('arraymatrix',arrayMatrix);\n // console.log('player1',player1);\n // console.log('player2',player2);\n\n var isWinner = isPlayerWinner(player1);\n if (isWinner !== -1) {\n //we have a winner...\n return {winner:\"player1\", selections:isWinner}\n }\n else {\n isWinner = isPlayerWinner(player2);\n if (isWinner !== -1){\n return {winner:\"player2\", selections:isWinner}\n }\n else {\n return -1;\n }\n }\n //console.log(isWinner);\n}", "hasGameEnded() {\n const { gameState } = this.state;\n const gameEnded = gameState.every((tileState) => {\n return tileState.status === -1;\n });\n if (gameEnded) {\n alert('You won! You can play again by clicking on the Restart Game button.');\n }\n }", "function trackGameState() {\n var gameID = Session.get('gameID');\n var playerID = Session.get('playerID');\n\n if (!gameID || !playerID) {\n return;\n }\n\n var game = Games.findOne(gameID);\n var player = Players.findOne(playerID);\n\n if (!game || !player) {\n Session.set('gameID', null);\n Session.set('playerID', null);\n Session.set('currentView', 'startMenu');\n return;\n }\n\n if (game.state === 'waitingForPlayers') {\n Session.set('currentView', 'lobby');\n } else if (game.state === 'selectingRoles') {\n Session.set('currentView', 'rolesMenu');\n } else if (game.state === 'nightTime') {\n Session.set('currentView', 'nightView');\n } else if (game.state === 'dayTime') {\n Session.set('currentView', 'dayView');\n }\n // game.state can also be finishedVoting and voting\n}", "joinGame( state, position ){\n this.joinedGame = (state) ? true : false;\n this.turnOrder = position;\n this.playerDB.update(this.props());\n }", "function whosTurnIsIt(turn, player) {\n \tturn.html(\"It's your turn Player \" + player + \"!\");\n\t if (player == 1) {\n\t \t$('#turn').css(\"background\", \"#181914\").css(\"color\", \"white\");\n\t } else {\n\t \t$('#turn').css(\"background\", \"#A61723\").css(\"color\", \"white\");\n\t }\n }", "function playRound(){\n computerSelection = computerSelectionPhase();\n playerSelection = playerSelectionPhase();\n if (playerSelection === computerSelection){\n console.log(\"You have tied a bow... wait I mean tied with the computer\");\n return 3;\n }\n else if (computerSelection === winningMap[playerSelection]){\n console.log(\"Why couldn't you just let your computer win for once? sigh\");\n return 1;\n }\n console.log(\"Shameful of you to lose... actually nevermind, you tried your best, that's all that matters :)\");\n return 2;\n}", "function player() {\n return turn % 2 == 0 ? \"X\" : \"O\"\n}", "winner(winState) { \r\n for (let i in winState.spaces) {\r\n $(\"#\"+ winState.spaces[i]).addClass(\"winTile\");\r\n }\r\n $(\"#resultBox\").show()\r\n $(\"#resultBox\").html(\"Player \" +this.curPlayer +\" wins\");\r\n $(\".tile\").prop(\"disabled\", true);\r\n this.gameOver = true; //Stops AI going if player won\r\n }", "function setTurn() {\r\n\t\t// We generate a number between 1 or two\r\n\t\tvar random = Math.floor((Math.random() * 2) + 1);\r\n\t\t//Set the winner to zero so we know the game hasn't started yet\r\n\t\twinner = 0;\r\n\t\t// check if the random number is one\r\n\t\tif (random === 1) {\r\n\t\t\t//then we give the turn to player 2\r\n\t\t\tturn = player2Name;\r\n\t\t\t// we send a message telling the players who will start first by invoking the function msg\r\n\t\t\tmsg(player2Name + \"'s turn now!\");\r\n\r\n\t\t} else {\r\n\r\n\t\t\tturn = player1Name;\r\n\t\t\tmsg(player1Name + \"'s turn now!\");\r\n\r\n\t\t}\r\n\t}", "function changeTurn(){\n\tif(activePlayer + 1 >= players.length){\n\t\tactivePlayer = 0;\n\t} else {\n\t\tactivePlayer++;\n\t}\n}", "checkWin() {\n // If computer or player 2 wins\n if (this.score1 >= 50) {\n // Clear the interval\n clearInterval(this.timeInterval);\n // Change the page state to the winning state\n this.changeState('win');\n // If multiplyer is not being played then computer wins\n if (!this.multiplayer) {\n // Display computer won\n this.winner.textContent = 'Computer Wins!';\n\n // Else player 2 wins\n } else {\n // Display player 2 won\n this.winner.textContent = 'Player 2 Wins!';\n }\n\n // If computer or player 2 wins\n } else if (this.score2 >= 50) {\n // Clear the interval\n clearInterval(this.timeInterval);\n // Change the page state to the winning state\n this.changeState('win');\n // Display player 1 won\n this.winner.textContent = 'Player 1 Wins!';\n }\n }", "function GameState() {\n this.boardSize = 4;\n this.board = [];\n this.active = false;\n this.winningSet = []; // This is because I'm not adding 8 different checkWinCon functions. It's a clumsy solution, but whatever.\n\n // Resets the board, or blanks it.\n this.resetBoard = function() {\n this.board = [];\n for (let i = 0; i < 16; i++)\n this.board.push(\"\")\n };\n\n // Returns 'X' for X won, 'O' for you get it, or '' for no win.\n this.getWinner = function() {\n var r = \"\"; // The return char\n var t = \"\"; // Used for finding t-t-t, a squence of 3 inside the game board.\n for (let x = 0; x < this.boardSize; x++) {\n for (let y = 0; y < this.boardSize; y++) {\n if (this.board[this.coord(x,y)] === \"\")\n continue;\n t = this.board[this.coord(x,y)];\n\n // Check right\n if ((x+2) < this.boardSize) {\n if (t === this.board[this.coord(x+1,y)] && t === this.board[this.coord(x+2,y)]) {\n r = t;\n this.winningSet = [this.coord(x,y), this.coord(x+1,y), this.coord(x+2,y)];\n break;\n }\n }\n\n // Check down\n if ((y+2) < this.boardSize) {\n if (t === this.board[this.coord(x,y+1)] && t === this.board[this.coord(x,y+2)]) {\n r = t;\n this.winningSet = [this.coord(x,y), this.coord(x,y+1), this.coord(x,y+2)];\n break;\n }\n }\n\n // Check down-right\n if ((x+2) < this.boardSize & (y+2) < this.boardSize) {\n if (t === this.board[this.coord(x+1,y+1)] && t === this.board[this.coord(x+2,y+2)]) {\n r = t;\n this.winningSet = [this.coord(x,y), this.coord(x+1,y+1), this.coord(x+2,y+2)];\n break;\n }\n }\n\n // Check up-right\n if ((x+2) < this.boardSize & (y-2) >= 0) {\n if (t === this.board[this.coord(x+1,y-1)] && t === this.board[this.coord(x+2,y-2)]) {\n r = t;\n this.winningSet = [this.coord(x,y), this.coord(x+1,y-1), this.coord(x+2,y-2)];\n break;\n }\n }\n }\n\n if (r != \"\") {\n break;\n }\n }\n\n return r;\n };\n\n // Returns true if the entire board is full.\n this.isBoardFull = function() {\n var r = true;\n for (let i = 0; i < this.board.length; i++) {\n if (this.board[i] == \"\") {\n r = false;\n break;\n }\n }\n return r;\n };\n\n // Returns the value of a cell: 'X', 'O' or ''\n this.getCellVal = function(n) {\n // If n is out of bounds, I'm just gonna let the thing raise its own exception\n return this.board[n];\n };\n\n // Converts a coordinate pair into a linear value for accessing the board.\n this.coord = function(x, y) {\n return (y*this.boardSize + x);\n };\n\n // Sets the value of a cell (must be empty)\n // player must be either 'X' or 'O'\n this.setCellVal = function(player, n) {\n if (player != \"X\" && player != \"O\")\n this.board[-4]; // Sure would be a shame if something happened to this little boy, here...\n\n this.board[n] = player;\n };\n}", "function whosTurn() {\n var player = players[turns % players.length];\n io.emit('message', player.username + \"'s turn.\");\n io.emit('disable new game button');\n io.emit('disable draw buttons');\n io.emit('hide drawTotal button');\n io.to(player.id).emit('enable draw buttons');\n io.to(player.id).emit('notify');\n if (lastCardDrawX && drawTotal > 4) {\n io.to(player.id).emit('show drawTotal button', drawTotal);\n }\n}", "changePlayer(nbBox, idPlayer) {\n const { playerIsPlaying, tabResult } = this.state;\n if (playerIsPlaying) {\n this.setState(\n {\n player: 'Joueur Bleu',\n txtPlayer: ' txtPlayerBlue',\n playerIsPlaying: false,\n color: 'blue',\n index: 0,\n tabResult: [\n ...tabResult.slice(0, nbBox),\n idPlayer,\n ...tabResult.slice(nbBox + 1),\n ],\n },\n () => this.checkWinner(nbBox)\n );\n } else {\n this.setState(\n {\n player: 'Joueur Rouge',\n txtPlayer: ' txtPlayerRed',\n playerIsPlaying: true,\n color: 'red',\n index: 1,\n tabResult: [\n ...tabResult.slice(0, nbBox),\n idPlayer,\n ...tabResult.slice(nbBox + 1),\n ],\n },\n () => this.checkWinner(nbBox)\n );\n }\n }", "async win (){\n if(this.state.turn){\n await this.setState({winner: this.state.player1Name});\n this.updateMineFieldChange();\n //Alert who has won and suggestion of restarting the game\n if(window.confirm(this.state.player1Name + ' has won the game, do you wish to restart it?')){\n }\n }\n else{\n await this.setState({winner: this.state.player2Name});\n this.updateMineFieldChange();\n //Alert who has won and suggestion of restarting the game\n if(window.confirm(this.state.player2Name + ' has won the game, do you wish to restart it?')){\n }\n }\n return;\n }", "status(){\n if(this.facedown.length <= 0){\n inProgress = false;\n console.log(\"GAME OVER\");\n }\n }", "function swapPlayer(){\r\n circleTurn = !circleTurn;\r\n}", "function allPlayersJoined() {\n const lobbyState = GameLobby.countAllPLayers(); // fetch array\n for(let i =0; i < lobbyState.length; i++){\n if(lobbyState[i] === false) {\n return { alljoined : false, hasnotgamestarted : lobbyState }\n }\n }\n return { alljoined : true, hasnotgamestarted : null }\n}", "loseTurn(){\n this.playerTurn = (this.playerTurn % 2) + 1;\n this.scene.rotateCamera();\n this.previousBishops = ['LostTurn'];\n this.activeBishop = null;\n }", "function GameState(tablero, turn, modo, difi, config) {\n this.tableroGS = tablero;\n this.turnoJugador = turn;\n this.puntaje = tablero.getScore();\n this.posiblesJugadas = tablero.getPosiblesJugadas(turn);\n this.modoJuego = modo;\n this.dificultad = difi;\n this.config = config;\n this.uids = [config['player1uid'], config['player2uid']];\n console.log(\"ASD\" + this.uids);\n // si no hay posibles jugadas, game over... si no, se continua jugando...\n if (this.posiblesJugadas.length > 0) {\n this.gameStatus = 1;\n }\n else {\n console.log('No hay jugadas posibles... C mamo!');\n this.gameStatus = 2;\n this.turnoJugador = null;\n // se determina cual jugador es el ganador\n if (this.puntaje[0] > this.puntaje[1]) {\n this.winner = 1;\n }\n else if (this.puntaje[0] < this.puntaje[1]) {\n this.winner = 2;\n }\n else {\n this.winner = 3;\n }\n }\n }", "function CheckStateChange() {// decision tree to see if we need to change states\n\tif (currentState != enemyStates.start) {// to make sure we don't change state during the start state, check it\n\t\t// if playerLocation.Count > 1 then we need to follow waypoint\n\t\t// if playerLocation.Count = 1 then we need to follow player\n\t\tif (playerLocation.Count > 1) {// path to player is the number of waypoints to the player, and if there is more than one, we need to follow the waypoints\n\t\t\t//currentState = enemyStates.run; // run after the waypoint\n\t\t} else {// path to player is the number of waypoints to the player, and if there is one, we're at the closest waypoint to the player\n\t\t\t// test if we are close enough to the player to say we saw them\n\t\t\tvar distanceToPlayer = Vector3.Distance(transform.position,playerTransform.position); // see how far we are from the player\n\t\t\tif (distanceToPlayer < sawPlayerDistance) {// Are we close enough to run after the player?\n\t\t\t\tif (distanceToPlayer < attackDistance) { // Are we close enough to attack the player?\n\t\t\t\t\tif(distanceToPlayer < hitDistance){// Are we close enough to hit the player?\n\t\t\t\t\t// hit the player, let game know and die\n\t\t\t\t\t\tNotificationCenter.DefaultCenter().PostNotification(this,\"EnemyDead\"); // tell other objects that we died to attack the player\n\t\t\t\t\t\tDie();// and we explode (die)\n\t\t\t\t\t} else { // if we are NOT close enough to hit the player\n\t\t\t\t\tcurrentState = enemyStates.attack;// ATTACK\n\t\t\t\t\t}// end HIT else\n\t\t\t\t} else {// if we are NOT close enough to attack the player\n\t\t\t\tcurrentState = enemyStates.sawPlayer;// GET HIM\n\t\t\t\t} // end ATTACK else\n\t\t\t}// end saw player IF\n\t\t}// end player location count IF\n\t}// end start state check IF\n}// end CheckStateChange function", "function gameStatus(player, opponent, board) {\n // games status\n if (checkWin(player, board)) {\n return \"win\";\n } else if (checkWin(opponent, board)) {\n return \"lost\"\n } else if (checkDraw(board)) {\n return \"draw\"\n } else {\n return \"\";\n }\n}", "function advancePlayerInTurn() {\r\n if (playerInTurn < players.length -1) {\r\n playerInTurn ++;\r\n }\r\n else {\r\n playerInTurn = 0;\r\n }\r\n}", "nextPhaseBtnState (phase) {\n if (\n THIS.view.currentPlayer.name == THIS.currentUserName &&\n THIS.currentPhase != phase\n ) {\n THIS.btnState = true\n THIS.currentPhase = phase\n } else {\n THIS.btnState = false\n }\n }", "stateManager() {\n switch (this.state) {\n case 0:\n this.findPlayer(this.scene.player);\n break;\n\n case 1:\n this.attackPlayer(this.scene.player);\n break;\n }\n }", "function initGame()\n{\n\tturn = 0;\n\tgame_started = 0;\n player = 0;\n}", "onNewMove(i) {\n if (this.state.status[i] != null || this.state.winner) {\n return false;\n }\n const newStatus = [...this.state.status];\n const currentPlayer = this.state.nextPlayer === 'X' ? 'X' : 'O';\n const nextPlayer = this.state.nextPlayer === 'X' ? 'O' : 'X';\n newStatus[i] = currentPlayer;\n this.setState(\n {\n status: newStatus,\n nextPlayer: nextPlayer\n },\n () => {\n // using callback to make sure checkIfWin and computerMove are execuated after state update\n if(!this.checkIfWin(this.state.status) && currentPlayer!== \"O\") {\n this.onNewMove(this.computerMove(this.state.status, \"X\", 2)[0]);\n }else if(this.checkIfWin(this.state.status)){\n this.setState({winner: currentPlayer});\n }\n }\n );\n }", "function change_turn(){\r\n\r\n if(turn == 1){\r\n turn = 2;\r\n }\r\n else{\r\n turn = 1;\r\n }\r\n\r\n}", "function playerTurn() {\n enableExitButton();\n playerSequence = [];\n status.html(\"Your turn to play...\");\n if (hard.is(\":checked\")) {\n timer();\n colorsClicked = false; // Timer stops once the value is true.\n }\n colorsButton.on(\"click\", function() {\n colorsClicked = true; // Timer stops.\n playSound($(\"#\" + this.id), $(\"#\" + this.id + \"Sound\")[0]);\n playerSequence.push(this.id);\n gameStatus(); // Checks user input and update game accordingly\n });\n }", "function GameState() {\n}", "function adjustTurn(){\n if(playerTurn === scores.player1){\n playerTurn = scores.player2;\n }else{\n playerTurn = scores.player1;\n };\n if(playerTurn === scores.player1){\n message.innerHTML = `Player 1, it's your turn!`\n }\n if(playerTurn === scores.player2){\n message.innerHTML = `Player 2, it's your turn!`\n };\n}", "function checkPlayerState ({ id, handSums, done }) {\n if (!state.isRoundActive) return ;\n savePlayerSums({ id, handSums })\n if (!done) {\n if (playerHasSoft21(id, handSums)) {\n return playerStands({ sum: 21, id })\n } \n if (handSums.soft <= 7) return playerActive({ sum: handSums.soft, id })\n if (handSums.soft <= 11) return playerActive({ sum: handSums.hard, id })\n if (handSums.soft <= 21) return playerActive({ sum: handSums.soft, id })\n playerBust({ sum: handSums.soft, id })\n } else if (isTurn(id)) {\n playerStands({\n sum: handSums.hard <= 21 ? handSums.hard : handSums.soft,\n id\n })\n }\n }", "function resetGameState() {\n\t\tgameOngoing = true;\n\t\tcurrentPlayer = player1;\n\t}", "switchTurn() \n { \n\n if (this.checkWinner(this.currentPlayer) && this.currentPlayer == \"X\")\n {\n this.playerName = \"Player One\";\n document.getElementById('message').style.color = \"green\";\n this.setMessage(\"Well done \" + this.playerName + \", you are the winner.\")\n this.winner = this.currentPlayer;\n this.winner = this.playerName;\n } \n\n else if (this.checkWinner(this.currentPlayer) && this.currentPlayer == \"O\")\n {\n this.playerName = \"Player Two\";\n document.getElementById('message').style.color = \"green\";\n this.setMessage(\"Well done \" + this.playerName + \", you are the winner.\");\n this.winner = this.currentPlayer;\n this.winner = this.playerName;\n }\n\n else if (this.currentPlayer == this.playerOne && this.counter < 9) \n {\n this.currentPlayer = this.playerTwo;\n this.setMessage(\"It's \" + this.currentPlayer + \" move next.\");\n this.counter += 1; \n } \n\n else \n {\n this.currentPlayer = this.playerOne;\n this.setMessage(\"It's \" + this.currentPlayer + \" move next.\")\n this.counter += 1;\n }\n \n // Checks to see if the game is a draw\n this.checkDraw();\n }", "switchPlayer() {\n for(let i=0; i<this.playerBoards.length; ++i){\n this.updateCurrentPlayer()\n if (!this.playerBoards[this.currentPlayer].isGameComplete()){\n this.gameComplete = false;\n return;\n } \n } \n this.gameComplete = true \n }", "changeGame(event) {\n this.setState({ checkMe: !this.state.checkMe });\n }", "switchTurn() {\n\t\tif (this.turn == Const.TEAM.B) {\n\t\t\tthis.turn = Const.TEAM.W;\n\t\t}\n\t\telse {\n\t\t\tthis.turn = Const.TEAM.B;\n\t\t}\n\t}" ]
[ "0.71079755", "0.7041642", "0.6997196", "0.69796646", "0.69137615", "0.6905623", "0.689016", "0.68303704", "0.6801006", "0.6777729", "0.67727983", "0.67529804", "0.6744343", "0.66951376", "0.66811556", "0.6665887", "0.6665565", "0.66640234", "0.6644138", "0.6623281", "0.66158247", "0.66115415", "0.6604488", "0.6589345", "0.6561541", "0.65473586", "0.6539046", "0.652417", "0.6520561", "0.6496391", "0.6480139", "0.6474449", "0.6454082", "0.6446861", "0.6431221", "0.6430199", "0.6427077", "0.6424556", "0.64233613", "0.6422847", "0.6420645", "0.64176613", "0.6412613", "0.6399981", "0.6399857", "0.6391823", "0.6383205", "0.63755345", "0.63622665", "0.63436526", "0.63415545", "0.63408834", "0.633966", "0.6318635", "0.6309829", "0.6302928", "0.6301255", "0.6299473", "0.6298903", "0.62958485", "0.62835544", "0.6278268", "0.6276136", "0.62754303", "0.6273908", "0.6265166", "0.62651235", "0.6264736", "0.62591213", "0.6257814", "0.62570965", "0.62570024", "0.6253656", "0.6251978", "0.6249445", "0.6248089", "0.62440926", "0.62404597", "0.6236861", "0.6236695", "0.6230874", "0.6229665", "0.62295395", "0.62290126", "0.6220409", "0.62166846", "0.62160164", "0.62105244", "0.6206579", "0.61977094", "0.6191747", "0.619072", "0.6189655", "0.61818975", "0.61802053", "0.6177462", "0.6175625", "0.6175435", "0.61745244", "0.61742437", "0.6165955" ]
0.0
-1
this is the variable that we will use to save the index of the position, where we took the stone away
function create_rows(stones){ /*Input: The array of the stones Output: An array that consists out of the rows of the field. */ var rows = [[stones[0],stones[1],stones[2]], [stones[0],stones[7],stones[6]],[stones[2],stones[3],stones[4]],[stones[6],stones[5],stones[4]],[stones[8],stones[15],stones[14]], [stones[8],stones[9],stones[10]],[stones[10],stones[11],stones[12]],[stones[14],stones[13],stones[12]],[stones[16],stones[23],stones[22]], [stones[16],stones[17],stones[18]],[stones[18],stones[19],stones[20]],[stones[22],stones[21],stones[20]],[stones[7],stones[15],stones[23]], [stones[1],stones[9],stones[17]],[stones[19],stones[11],stones[3]],[stones[21],stones[13],stones[5]]]; return rows; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function test() {\n var result = pos({})\n\n line = current.line\n column = current.column\n value = subvalue + value\n\n return result.position\n }", "function snakePosition() {\n\tfor (var i = 0; i < rry.length; i++) {\n\t\tfor (var j = 0; j < rry[i].length; j++) {\n\t\t\tif (rry[i][j] === 1) {\n\t\t\t\t\n\t\t\t\tvar position = {\n\t\t\t\t\trow: rry[i],\n\t\t\t\t\tindex: j\n\t\t\t\t};\n\t\t\t\treturn position;\n\t\t\t}\n\t\t};\n\t};\n}", "pos(index) {\n var idx = this.search.findLeft(index)\n if(idx+1<this.rows.length && this.rows[idx+1]==index)\n return [idx+1,0]\n return [idx, index-this.rows[idx]]\n }", "function test() {\n var result = pos({});\n\n line = current.line;\n column = current.column;\n value = subvalue + value;\n\n return result.position;\n }", "function test() {\n var result = pos({});\n\n line = current.line;\n column = current.column;\n value = subvalue + value;\n\n return result.position;\n }", "function test() {\n var result = pos({});\n\n line = current.line;\n column = current.column;\n value = subvalue + value;\n\n return result.position;\n }", "function test() {\n var result = pos({});\n\n line = current.line;\n column = current.column;\n value = subvalue + value;\n\n return result.position;\n }", "function test() {\n var result = pos({});\n\n line = current.line;\n column = current.column;\n value = subvalue + value;\n\n return result.position;\n }", "function positionActuelle(n) { afficher(index = n); }", "location(index) {\n var idx = this.search.findLeft(index)\n if(idx+1<this.rows.length && this.rows[idx+1]==index) return [idx+1,0]\n return [idx, index-this.rows[idx]]\n }", "getPosition(absState) {\n return absState % (this._w + 1);\n }", "getNewPosition() {\r\n this.newPosition = this.positionRandom();\r\n // Cree une fonction qui test avec marge les nouvelle position des bombs\r\n // Transformer et juste tester si une element avec une position similaire est deja sur la map \r\n return this.newPosition;\r\n }", "function getIndexPos() {\n // var range = 96;\n var d = new Date();\n var currentHour = d.getHours(); //get time in hours\n return currentHour * 4 + 1;\n }", "function getPositionIndex(e){\n\t\t\n\t\tvar totCells = cells.length,\n\t\t\ttotRows = Math.ceil(totCells / args.columns),\n\t\t\tcol = args.columns-1,\n\t\t\trow = totRows-1,\n\t\t\theightMult = (args.cellHeight + (2 * args.rowPadding)),\n\t\t\twidthMult = (args.cellWidth + (2 * args.columnPadding));\n\t\t\n\t\t//get the new row\n\t\tfor(var i = 0; i < totRows; i++){\n\t\t\tif(e.top < (i * heightMult) + (heightMult / 2)){\n\t\t\t\trow = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\t\t\t\n\t\t//get the new column\n\t\tfor(var i = 0; i < args.columns; i++){\n\t\t\tif(e.left < (i * widthMult)+(widthMult/2)){\n\t\t\t\tcol = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tvar dPositionIndex = ((1*row)*args.columns)+col;\n\t\t\n\t\t//check to see if the index is out of bounds and just set it to the last cell\n\t\t//probably a better way to handle this\n\t\tif(dPositionIndex >= totCells){\n\t\t\tdPositionIndex = totCells-1;\n\t\t}\n\t\treturn \tdPositionIndex;\t\n\t}", "function getPosition(letra){\n let position = abd.indexOf(letra);\n return position;\n}", "processPos(npos) {\n\t\tvar tpos = this.checkPos(npos);\n\t\tif(tpos.x < 0) {\n\t\t\ttpos = this.checkPos(this.pos);\n\t\t\tif(tpos.x < 0) {\n\t\t\t\tlet used = {};\n\t\t\t\tlet p = 0;\n\t\t\t\tlet queue = [];\n\t\t\t\tlet pos = this.pos.div(CellSize).round();\n\t\t\t\tused[pos.x + pos.y * mapSize.x] = true;\n\t\t\t\tqueue.push(pos);\n\t\t\t\tlet shift = [new Vector2(-1, 0), new Vector2(1, 0), new Vector2(0, -1), new Vector2(0, 1)];\n\t\t\t\tlet answ = this.pos;\n\t\t\t\twhile(p < queue.length) {\n\t\t\t\t\tlet cur = queue[p];\n\t\t\t\t\tif(this.isGood(cur)) {\n\t\t\t\t\t\tansw = cur;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tp++;\n\t\t\t\t\tfor(let i = 0; i < 4; i++) {\n\t\t\t\t\t\tlet tmp = cur.add(shift[i]);\n\t\t\t\t\t\tlet id = tmp.x + tmp.y * mapSize.x;\n\t\t\t\t\t\tif(!used[id] && this.map.checkCoords(tmp.x, tmp.y)) {\n\t\t\t\t\t\t\tused[id] = true;\n\t\t\t\t\t\t\tqueue.push(tmp);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn answ.mul(CellSize);\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn this.pos;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\treturn tpos;\n\t\t}\n\t}", "function rePosition(){\r\n piece.pos.y = 0; // this and next line puts the next piece at the top centered\r\n piece.pos.x = ( (arena[0].length / 2) | 0) - ( (piece.matrix[0].length / 2) | 0);\r\n }", "function getPosX(nIndex){\n\treturn 30+(90 * nIndex);\n}", "getPosition(out) {\n return Vec3.copy(out || new Vec3(), Vec3.ZERO);\n }", "function getNewPositionForFood(){\n // get all the xs and ys from snake body\n let xArr = yArr = [], xy;\n $.each(snake, function(index, value){\n if($.inArray(value.x, xArr) != -1){\n xArr.push(value.x);\n }\n if($.inArray(value.y, yArr) == -1) {\n yArr.push(value.y);\n }\n });\n xy = getEmptyXY(xArr, yArr);\n return xy;\n }", "function redips_row(std){\n\treturn std.hall_position.substring(1) - 1;//Horizontal offset -1\n}", "function getRealPosition( index ) {\n var stage = app.getDrawStage();\n return { 'x': stage.offset().x + index.x / stage.scale().x,\n 'y': stage.offset().y + index.y / stage.scale().y };\n }", "get_top_index() {\n for (let i = this.gamespot.length - 1; i >= 0; i--) {\n if (this.gamespot[i] !== 0) {\n return i;\n }\n }\n return -1;\n }", "function bestspot(){\r\n \treturn minimax(origBoard,aiplayer).index ;\r\n }", "function checkPosition(){\n if (i > (data.omicron.length - 1)) {\n i = 0;\n } else if (i < 0) {\n i = (data.omicron.length - 1);\n }\n }", "function posToIndex(pos) {\n var row = pos[0];\n var col = pos[1];\n return (row * 4) + col;\n}", "function bestSpot() {\n return minimax(origBoard, com).index;\n}", "function getSpaceIndex(posX,posY){\n\t \t\tvar remX = Math.floor((posX - Math.floor(0.5*start))/stepW);\n\t \t\tvar remY = Math.floor((posY - Math.floor(0.5*start))/stepH);\n\n\t \t\tvar index = COLS*remX + remY;\n\t \t\treturn index;\n\t \t}", "_deletPosition() {\n\n this.forEach((_, rowIndex) => {\n _.forEach((block, colIndex) => {\n\n /**\n * checks if there's a block on the piece, \n * because if not cheked, it might delete a block of another piece\n */\n if (block === 0) return;\n\n let absPos = this._getAbsolutePosition(rowIndex, colIndex);\n\n this.board[absPos.row][absPos.col] = 0;\n\n });\n });\n }", "function palmPosition(hand, index) {\n if (!isLocked) {\n lateralTracking(hand.palmPosition[0]);\n }\n // console.log(hand);\n }", "function _setPosition() {\n this.arrayPositions = [];\n this.arrayPositions.int = [];\n for (var i = 0; i < this.length; i++) {\n var position = (this.length - 2 * i) * this.size / (4 * this.length);\n this.arrayPositions.int[i] = position;\n var angle = (this.length - 2 * i) * Math.PI / (2 * this.length);\n this.arrayPositions[position] = i;\n }\n var int = this.arrayPositions.int[0] - this.arrayPositions.int[1];\n\n function Populizing(extremity, i) {\n if (extremity === 0) extremity = 0.1;\n var sign = Math.sign(extremity);\n console.log(sign, int);\n var inc;\n i == 0 ? inc = -1 : inc = 1;\n while (Math.abs(extremity) < this.size) {\n extremity += sign * int;\n i += inc;\n if (i == this.length && inc == 1) i = 0;\n if (i == -1 && inc == -1) i = this.length - 1;\n this.arrayPositions[extremity] = i;\n }\n }\n Populizing.call(this, this.arrayPositions.int[this.arrayPositions.int.length - 1], this.arrayPositions.int.length - 1);\n Populizing.call(this, this.arrayPositions.int[0], 0);\n }", "get position() {\n return this.chunkPosition + this.i;\n }", "returnToLastPos() {\n if (this.previousPos) {\n this.x = this.previousPos.x\n this.y = this.previousPos.y\n }\n }", "function getClozePosition(fullText, cloze){\n\t\tvar start = fullText.indexOf(cloze);\n\t\tconsole.log(\"\\nstart: \", start);\n\t}", "function bestSpot(){\r\n return minimax(origBoard, aiPlayer).index;\r\n}", "getPosition() {\n return this._lastPosition;\n }", "nodePosition() {\n if (this.tempPos.next == null) {\n return -1; // last pos\n } else if (this.tempPos.prev == null) {\n return 1; // first pos\n } else {\n return 0; // middle pos\n }\n }", "function bestSpot() {\n return minimax(origBoard, aiPlayer).index;\n}", "rtnStartPos() {\n this.x = this.plyrSrtPosX;\n this.y = this.plyrSrtPosY;\n}", "getPosition() {\n\t\t\tconst {overrides} = this.impl;\n\t\t\tif (overrides !== undefined) {\n\t\t\t\treturn overrides.getPosition(this);\n\t\t\t}\n\n\t\t\tconst index = this.getIndex();\n\t\t\tconst cached = this.indexTracker.cachedPositions.get(index.valueOf());\n\t\t\tif (cached !== undefined) {\n\t\t\t\treturn cached;\n\t\t\t}\n\n\t\t\tconst pos = {\n\t\t\t\tline: this.currLine,\n\t\t\t\tcolumn: this.currColumn,\n\t\t\t};\n\t\t\tthis.indexTracker.setPositionIndex(pos, index);\n\t\t\treturn pos;\n\t\t}", "function bestSpot() {\r\n return minimax(origBoard, aiPlayer).index;\r\n}", "function storePreviuosCoordinates(currentWorm)\r\n{\r\n\tfor(var i = histotyDotsSaved; i > 0; i--)\r\n\t{\r\n\t\tcurrentWorm.previousX[i] = currentWorm.previousX[i-1];\r\n\t\tcurrentWorm.previousY[i] = currentWorm.previousY[i-1];\r\n\t}\r\n\tcurrentWorm.previousX[0] = currentWorm.x;\r\n\tcurrentWorm.previousY[0] = currentWorm.y;\r\n\t\r\n}", "function bestSpot() {\n\treturn minimax(origBoard, aiPlayer).index;\n}", "remove_top() {\n for (let i = this.gamespot.length - 1; i >= 0; i--) {\n if (this.gamespot[i] !== 0) {\n this.gamespot[i] = 0;\n return i;\n }\n }\n }", "function getLastWorkPos() {\r\n\tlast_work_pos = {x:pos.x,y:pos.y};\r\n\tfor(var i=Tasks.tasks.length-1; i >= 0; i--) {\r\n\t\tif(Tasks.tasks[i].type == 'way') {\r\n\t\t\tlast_work_pos={x:Tasks.tasks[i].data_obj.to_x,y:Tasks.tasks[i].data_obj.to_y};\r\n\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\treturn last_work_pos;\r\n}", "getPointFromPin (arrayData) {\n const indexOfPart = arrayData[0]\n const indexOfPin = arrayData[1]\n console.log(indexOfPart, indexOfPin)\n let pin\n if (indexOfPart === -1) {\n if (indexOfPin > this.componentPins.need.length) {\n pin = this.componentPins.pass[(indexOfPin - this.componentPins.need.length - 1)]\n }\n else{\n pin = this.componentPins.need[indexOfPin - 1]\n }\n }\n else {\n for (let i = 0; i < this.scene.meshes.length; i++) {\n if (this.scene.meshes[i].metadata) {\n if (parseInt(this.scene.meshes[i].metadata.indexPin) === indexOfPin && parseInt(this.scene.meshes[i].metadata.indexPart) === indexOfPart) {\n pin = this.scene.meshes[i]\n break\n }\n }\n }\n }\n console.log(pin)\n if (pin) {\n return pin.getAbsolutePosition().clone()\n }\n else {\n return BABYLON.Vector3.Zero()\n }\n }", "findIndex(pos, side, end, startAt = 0) {\n let arr = end ? this.to : this.from;\n for (let lo = startAt, hi = arr.length;;) {\n if (lo == hi)\n return lo;\n let mid = (lo + hi) >> 1;\n let diff = arr[mid] - pos || (end ? this.value[mid].endSide : this.value[mid].startSide) - side;\n if (mid == lo)\n return diff >= 0 ? lo : hi;\n if (diff >= 0)\n hi = mid;\n else\n lo = mid + 1;\n }\n }", "left(pos) { return this.d*(pos-1)+2; }", "function GetPath() : int {\n\t\tnumberOfHops = 0; \n\t\tvar ToMovePos : int; \n\t\tvar i : int = 0;\n\t\tfor(var a : int = 0; a < ClosedNodes.Length; a++){ \n\t\t\tif (ClosedNodes[a] != 0){ \n\t\t\t\ti++; \n\t\t\t\t//Debug.Log(parent_Closed[a]+\" \"+ClosedNodes[a]);\n\t\t\t\t } }\n\t\tvar match_name = targetLeaf;\n\t\tfor(var b : int = (i-1); b >= 0 ; b--){\n\t\t\tif (ClosedNodes[b] == match_name){\n\t\t\t\tnumberOfHops++;\n\t\t\t\t//Debug.Log(parent_Closed[b]);\n\t\t\t\tmatch_name = parent_Closed[b];\n\t\t\t\tif (match_name == frogLeaf ){\n\t\t\t\t\tToMovePos = ClosedNodes[b];\n\t\t\t\t\tb = -20;\n\t\t\t\t\t//Debug.Log(\"ToMovePos \"+ToMovePos);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn ToMovePos;\n\t}", "function getStartingPosition() {\r\n \r\n var positionFound = false;\r\n var startPosition = {};\r\n var i;\r\n while(!positionFound) {\r\n i = getRandNum(4);\r\n \r\n if(grid[0][i].status == \"X\") {\r\n continue;\r\n } else {\r\n \r\n startPosition = [0,grid[0][i].y,grid[0][i].status];\r\n positionFound = true;\r\n }\r\n }\r\n return startPosition; \r\n}", "function markerPos(){\n\tvar pos = 0;\n\tfor(var i = 0, len = markers[1].length; i < len; i++) {\n if (markers[1][i] === markerSelected){\n \tpos = i+1;\n }\n\t}\n\treturn pos;\n}", "function currentPosition(positionArray) {\n var size=positionArray.length;\n return size-1;\n}", "get position() { return this._position; }", "get position() { return this._position; }", "locate( index ) {\n if( index < this.start ) index = this.start\n else if(index>this.end) index = this.end\n this.pos = index\n return this.current()\n }", "FetchNodeIndex(position)\n {\n return position.x + (position.y * grid.resolution);\n }", "function FindSpawn(index){\n\tif(!index.search){\n\t\tlet a=Math.floor(Math.random()*sX);\n\t\tlet b=Math.floor(Math.random()*sY);\n\t\tif(grid[a][b]==0){\n\t\t\tindex.x=a;\n\t\t\tindex.y=b;\n\t\t\tindex.search=true;\n\t\t}\n\t}\n}", "findIndex(pos, round = -1) {\n if (pos == 0)\n return retIndex(0, pos);\n if (pos == this.size)\n return retIndex(this.content.length, pos);\n if (pos > this.size || pos < 0)\n throw new RangeError(`Position ${pos} outside of fragment (${this})`);\n for (let i = 0, curPos = 0; ; i++) {\n let cur = this.child(i), end = curPos + cur.nodeSize;\n if (end >= pos) {\n if (end == pos || round > 0)\n return retIndex(i + 1, end);\n return retIndex(i, curPos);\n }\n curPos = end;\n }\n }", "findIndex(x, z) {\n // mostly copied from DynamicTerrain source\n let mapSizeX = Math.abs(this.terrain.mapData[(this.xSize - 1) * 3] - this.terrain.mapData[0]);\n let mapSizeZ = Math.abs(this.terrain.mapData[(this.zSize - 1) * this.xSize* 3 + 2] - this.terrain.mapData[2]);\n \n let x0 = this.terrain.mapData[0];\n let z0 = this.terrain.mapData[2];\n\n // reset x and z in the map space so they are between 0 and the map size\n x = x - Math.floor((x - x0) / mapSizeX) * mapSizeX;\n z = z - Math.floor((z - z0) / mapSizeZ) * mapSizeZ;\n\n let col1 = Math.floor((x - x0) * this.xSize / mapSizeX);\n let row1 = Math.floor((z - z0) * this.zSize / mapSizeZ);\n //let col2 = (col1 + 1) % this.xSize;\n //let row2 = (row1 + 1) % this.zSize;\n\n // so idx is x, idx + 1 is y, +2 is z\n let idx = 3 * (row1 * this.xSize + col1);\n return idx;\n }", "function getStarIndex(that){\n\tlet starIndex = that.index();\n\tstarIndex++\n\tstarIndex = parseInt(starIndex)\n\treturn starIndex\n}", "function posToIndex(x, y) {\r\n\treturn x + (y * 32);\r\n}", "isLost(posAux){\n if(this.position.column > this.grid.columns || this.position.column < 0 || this.position.row > this.grid.rows || this.position.row < 0){\n let coordinates = {row: this.position.row, column: this.position.column};\n if (!this.grid.scent.includes(JSON.stringify(coordinates))) {\n this.grid.scent.push(JSON.stringify(coordinates));\n this.lost = true;\n }\n this.position = posAux;\n }\n }", "function checker() {\n if (position >= size) {\n position = 0;\n }\n else if (position < 0) {\n position = size - 1;\n }\n //console.log(position);\n }", "function swap(){\n //console.log(grid);\n var tem=grid[boxIndx];\n grid[grid.indexOf(16)]=tem;\n grid[boxIndx]=16;\n boxNum=grid.indexOf(\"\");\n console.log(grid.indexOf(boxNum))\n fillGrid();\n moveNumbs++;\n move.innerText=`move:${moveNumbs}`;\n}", "function GetLastPosition(index) {\n\n if(index == 0) {\n return 0;\n } else {\n index--;\n if (Sequence[\"Steps\"][index+1][\"Type\"] == 1) {\n return Sequence[\"Steps\"][index+1][\"Params\"][\"Position\"];\n } else {\n return GetLastPosition(index);\n }\n }\n\n}", "calcPositionNumber (pieceId) {\n return this.state.arrangement.indexOf(pieceId)\n }", "sPos (x, y) {\n\t\treturn y * this.w + x;\n\t}", "function location(pos){\n return dimension * + Math.floor(-pos[2]) + Math.floor(pos[0]);\n}", "getFirstIndex() {\n // index of the top item\n return (this.maxIndex - Math.floor(this.index)) % this.maxIndex; \n }", "createPosition () {\n\t\treturn {\n\t\t\tstart: {\n\t\t\t\tline: this.line,\n\t\t\t\tcolumn: this.col\n\t\t\t},\n\t\t\tsource: this.source,\n\t\t\trange: [ this.pos ]\n\t\t};\n\t}", "function find_pt(item, index) {\n if (xpos === item[0]) {\n if (map_hex_hgt === item[1] - 35) {\n hex_point = index;\n }\n }\n }", "function detectNextBlock_DownLeft (x,y,h,w)\n {\n var mapCoordY = (y + h)/ h;\n var mapCoordX = (x) / w;\n \n mapCoordX = Math.floor(mapCoordX);\n mapCoordY = Math.floor(mapCoordY);\n \n //Frage\n //var stoneBool = (Crafty.e('Stone') == map_comp[mapCoordY-1][mapCoordX-1]);\n //console.log(\"Is Stone: \" + stoneBool);\n return map[mapCoordY-1][mapCoordX-1];\n }", "function processCurrentposition(data) {\n var pos = parseInt(data);\n setPosition(pos);\n}", "function pos_actuelle()\n {\n\treturn (joueurs[joueur_actuel].position);\n }", "findNewPieceIndex(){\n\t\tlet maxIndex = ALL_PIECE_AND_LEN.length/2;\n\t\treturn Math.floor(Math.random() * (maxIndex));\n\t}", "function getSnapPoint() {\n // Store each difference between current position and each snap point.\n var currentDiff;\n\n // Store the current best difference.\n var minimumDiff;\n\n // Best snap position.\n var snapIndex;\n\n // Loop through each snap location\n // and work out which is closest to the current position.\n var i = 0;\n for(; i < snapPoints.length; i++) {\n // Calculate the difference.\n currentDiff = Math.abs(positionX - snapPoints[i]);\n \n // Works out if this difference is the closest yet.\n if(minimumDiff === undefined || currentDiff < minimumDiff) {\n minimumDiff = currentDiff;\n snapIndex = i;\n }\n }\n return snapIndex;\n }", "function damePosicion () {\n return miMarcador[0].getPosition()\n }", "function setPiecesStartPosition() {\n piecesArr.forEach((piece) => {\n setPieceLocation(\n `${piece.position.i},${piece.position.j}`,\n piece.name,\n piece.icon,\n piece.type\n );\n });\n}", "getPosition(type) {\n if (type === 'begin') type = this.begp;\n else if (type === 'end') type = this.endp;\n const beginPointRow = this.maze.findIndex((row) => row.includes(type));\n const row = this.maze[beginPointRow];\n const beginPointCol = row.findIndex((col) => col == type);\n return [beginPointRow, beginPointCol];\n }", "function indexToPos(index) {\n if (index < 4) {\n return [0, index];\n } else if (index < 8) {\n return [1, index - 4];\n } else if (index < 12) {\n return [2, index - 8];\n } else {\n return [3, index - 12];\n }\n}", "function imageIndexOf(x,y) {\n return x+(y+2)*(maxX+3)+topImages+3; } // This is the simplified version", "coordinateToIndex(x, y) {\n return y * this.width + x;\n }", "function ConnectedPosition() { }", "function square_get_pos(i){\n\treturn settings.square_width * i;\n}", "function getPreviousLocationIndex() {\n return currentLocation + 1 == managerData[currentManager].locations.length ? null : currentLocation + 1;\n }", "function getNextLocationIndex() {\n return currentLocation - 1 < 0 ? null : currentLocation - 1;\n }", "getStartingPosition(){\n return [this.x,this.y];\n }", "function getPosition() {\n return n.attr(\"T\")\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}", "getLastIndex() {\n return (this.maxIndex - Math.floor(this.index) - 1) % this.maxIndex;\n }", "at(index) {}", "get position() {\n\t\treturn this.state.sourcePosition;\n\t}", "get targetPosition() {}", "function penLoc(n) {\n\treturn Math.round(n * (penSize / 2 - 0.5) + -1 * (-n - 1));\n}", "function getPosition(offset, size) {\n return Math.round(-1 * offset + Math.random() * (size + 2 * offset));\n }", "function findNeighboring (thing, i , j) {\n var coords = {};\n\n if (A.world[i-1]) {\n // the row above exists....\n if (A.world[i-1][j-1] && A.world[i-1][j-1] === thing) { coords.row = i - 1; coords.col = j - 1; };\n if (A.world[i-1][j] === thing) { coords.row = i - 1; coords.col = j; };\n if (A.world[i-1][j+1] && A.world[i-1][j+1] === thing) { coords.row = i - 1; coords.col = j + 1; };\n }\n if (A.world[i][j-1] && A.world[i][j-1] === thing) { coords.row = i; coords.col = j - 1; }; // the 'current' row\n if (A.world[i][j+1] && A.world[i][j+1] === thing) { coords.row = i; coords.col = j + 1; };\n if (A.world[i+1]) {\n // the row below exists...\n if (A.world[i+1][j-1] && A.world[i+1][j-1] === thing) { coords.row = i + 1; coords.col = j - 1; };\n if (A.world[i+1][j] === thing) { coords.row = i + 1; coords.col = j; };\n if (A.world[i+1][j+1] && A.world[i+1][j+1] === thing) { coords.row = i + 1; coords.col = j + 1; };\n }\n return coords;\n}", "function getOffset() {\n\t\t\tif (!vm.current) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\t//console.log(vm.getRank(vm.current));\n\t\t\treturn (vm.getRank(vm.current) - 2) * 17;\n\t\t}", "function guessSnakesNextPosition(snake) {\n let head = snake.body[0];\n let seg1 = snake.body[1];\n\n let dx = head.x - seg1.x;\n let dy = head.y - seg1.y;\n\n return { x: head.x + dx, y: head.y + dy }\n }", "traverseToIndex() { }", "function getFinalPosition(){\n let result = whoWonTheBattle[PlayerMove][ComputerMove];\n TheWinner(result);\n }", "resetPosition() {\n // 505 is width, 101 is one block, so 202 will be center\n this.x = 202;\n // 606 is height, 171 is one block, so 435 will be center, but we need to be be off a bit,\n // so it will be 435 - 45px\n this.y = 390;\n }" ]
[ "0.6527147", "0.65192896", "0.6507408", "0.6378171", "0.6378171", "0.6378171", "0.6378171", "0.6378171", "0.6332293", "0.6331541", "0.6311694", "0.6304309", "0.6291482", "0.6243825", "0.62395793", "0.62318027", "0.6228142", "0.62141657", "0.6209569", "0.6193158", "0.61496377", "0.6130162", "0.61281353", "0.61229426", "0.61203086", "0.60687995", "0.60638595", "0.6049034", "0.6031592", "0.6026825", "0.6026147", "0.6011684", "0.5998656", "0.5987306", "0.59731096", "0.59555453", "0.5936816", "0.5930375", "0.5928911", "0.5918782", "0.5914177", "0.59094834", "0.5899876", "0.58960277", "0.589436", "0.588516", "0.58802587", "0.58792436", "0.58751035", "0.58724195", "0.58716667", "0.5857411", "0.5857136", "0.5857136", "0.58544403", "0.58413464", "0.58399826", "0.58352816", "0.58336776", "0.5830369", "0.5826437", "0.58246523", "0.5816374", "0.58085185", "0.5789646", "0.5786912", "0.5771608", "0.57680064", "0.5766989", "0.57654166", "0.5764327", "0.5751961", "0.574706", "0.57431203", "0.5740361", "0.5736033", "0.57357085", "0.57294464", "0.5721417", "0.57171243", "0.5716334", "0.57120126", "0.56972706", "0.56969345", "0.5681469", "0.5671266", "0.56631196", "0.5657084", "0.56525934", "0.56475574", "0.56452096", "0.5644237", "0.5640409", "0.56370705", "0.56326103", "0.56278515", "0.56244344", "0.5623506", "0.56203586", "0.56183946", "0.56166595" ]
0.0
-1
The AI methods for the minmaxalgorithms
function convert_to_array(ar){ // Convert one of these weird 'deepcopy' array-objects into a proper array var test = Array(); var checker = true; var index = 0; while(checker){ if((typeof(ar[index])=='string')||(typeof ar[index]=='object')){ test.push(ar[index]) index++; }else{ checker = false; } } return test; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function minmax(newBoard,player) {\n var availSpots = emptySpots(newBoard);\n if(checkWinner(newBoard,huPLayer)) return {score:-10};\n else if (checkWinner(newBoard,aiPlayer)) return{score:+10};\n else if (availSpots.length === 0 ) return {score:0};\n //an arrar to collect all the objects\n var moves = [];\n //loop through avail spots\n for(var i in availSpots){\n var move ={};\n move.index = newBoard[availSpots[i]];\n //set the emptty spot to the current player\n newBoard[availSpots[i]] = player;\n //collect the score resulted from calling minmax on the opponent of the player\n if(player == aiPlayer){\n var result = minmax(newBoard, huPLayer);\n move.score = result.score;\n }\n else{\n var result = minmax(newBoard, aiPlayer);\n move.score = result.score;\n }\n\n //reset the spot to empty\n newBoard[availSpots[i]] = move.index\n //push the objest to the array\n moves.push(move);\n }\n //if it is the computers's turn loop over the moves and chose the move with highest score\n var bestMove;\n if(player === aiPlayer){\n var bestScore = -10000;\n for(var i = 0; i < moves.length; i++){\n\n if(moves[i].score > bestScore){\n bestScore = moves[i].score;\n bestMove = i;\n }\n }\n }\n else{\n // else loop over the moves and choose the move with the lowest score\n var bestScore = 10000;\n for(var i = 0; i < moves.length; i++){\n if(moves[i].score < bestScore){\n bestScore = moves[i].score;\n bestMove = i;\n }\n }\n }\n // return the chosen move (object) from the moves array\n return moves[bestMove];\n }", "max() {}", "testMinMax(wert1, wert2){\r\n let index;\r\n //console.log(wert1, wert2);\r\n // Testen, ob es eine Nummer ist\r\n if(!isNaN(Number(wert1)) && !isNaN(Number(wert2)) ){\r\n wert1 = Number(wert1);\r\n wert2 = Number(wert2);\r\n if(wert1 < this.min[0] ) this.min[0] = wert1;\r\n if(wert2 < this.min[1] ) this.min[1] = wert2;\r\n if(wert1 > this.max[0] ) this.max[0] = wert1;\r\n if(wert2 > this.max[1] ) this.max[1] = wert2;\r\n }\r\n // testen, ob es ein Array ist\r\n else if(Array.isArray(wert1) && Array.isArray(wert2)){\r\n // testen, ob die Elemente der Arrays nummern sind\r\n if(wert1.length <= wert2.length){\r\n for(index in wert1){\r\n if(!isNaN(Number(wert1[index]))\r\n && !isNaN(Number(wert2[index])) ){\r\n wert1[index] = Number(wert1[index]);\r\n wert2[index] = Number(wert2[index]);\r\n if(wert1[index] < this.min[0] ) this.min[0] = wert1[index];\r\n if(wert2[index] < this.min[1] ) this.min[1] = wert2[index];\r\n if(wert1[index] > this.max[0] ) this.max[0] = wert1[index];\r\n if(wert2[index] > this.max[1] ) this.max[1] = wert2[index];\r\n }\r\n }\r\n } else {\r\n for(index in wert1){\r\n if(!isNaN(Number(wert1[index]))\r\n && !isNaN(Number(wert2[index])) ){\r\n wert1[index] = Number(wert1[index]);\r\n wert2[index] = Number(wert2[index]);\r\n if(wert1[index] < this.min[0] ) this.min[0] = wert1[index];\r\n if(wert2[index] < this.min[1] ) this.min[1] = wert2[index];\r\n if(wert1[index] > this.max[0] ) this.max[0] = wert1[index];\r\n if(wert2[index] > this.max[1] ) this.max[1] = wert2[index];\r\n }\r\n }\r\n }\r\n }\r\n else{\r\n console.log(\"In testMinMax gibt es Probleme: x: \", wert1, \" | y:\", wert2);\r\n }\r\n }", "function minMaxLayers(layers) {\n var layer;\nfunction minMaxObj1(w) {\n const length = Object.keys(w).length;\n for (let i = 1; i < length; i += 2) {\n minmax[0] = minmax[0] ? Math.max(w[i], minmax[0]) : w[i];\n minmax[1] = minmax[1] ? Math.min(w[i], minmax[1]) : w[i];\n }\n}\n\nfunction minMaxObj2(w) {\n const length = Object.keys(w).length;\n for (let i = 0; i < length; i++) {\n // (w[i] - min) / (max - min);\n w[i] = (w[i] - minmax[1]) / (minmax[0] - minmax[1]);\n }\n}\n\n const minmax = [undefined, undefined];\n if (layers) {\n let i;\n for (i = 0; i < layers.length; i++) {\n layer = layers[i];\n\n if (\"filters\" in layer) {\n layer.filters.forEach(filter => {\n minMaxObj1(filter.w);\n });\n }\n if (\"biases\" in layer) minMaxObj1(layer.biases.w);\n }\n for (i = 0; i < layers.length; i++) {\n layer = layers[i];\n\n if (\"filters\" in layer) {\n layer.filters.forEach(filter => {\n minMaxObj2(filter.w, minmax);\n });\n }\n if (\"biases\" in layer) minMaxObj2(layer.biases.w);\n }\n console.log(\"minMax\", minmax);\n }\n return JSON.parse(JSON.stringify(layers));\n}", "function MinMaxAttackMultiplierStrategy( minValue, maxValue ) {\n\tthis.log = log.getLogger( this.constructor.name );\n\tthis.log.setLevel( log.levels.SILENT );\n\n\tthis.execute = function( plays ) {\n\t\tplays.forEach( (function( play ) {\n if ( typeof play.endAttackMultiplier === 'undefined' ) throw new Error( this.constructor.name + '.execute(play) play.endAttackMultiplier undefined' );\n\n\t\t\tif ( play.endAttackMultiplier > this._maxValue ) {\n\t\t\t\tplay.endAttackMultiplier = this._maxValue;\n\t\t\t} else if ( play.endAttackMultiplier < this._minValue ) {\n\t\t\t\tplay.endAttackMultiplier = this._minValue;\n\t\t\t}\n\t\t}).bind( this ));\n\t}\n\n\tthis._minValue = minValue;\n\tthis._maxValue = maxValue;\n}", "function minimax_decision(arr){\r\n console.log('------------------MINIMAX Started-------------------------');\r\n \r\n ///initializing value\r\n var maxval=-1000; \r\n var actionrow=-1;\r\n var actioncol=-1;\r\n \r\n for(var r=0;r<3;r++){\r\n for(var c=0;c<3;c++){\r\n ///if the cell is empty then you can play otherwise ignore\r\n if(arr[r][c]=='-'){\r\n ///applying the action\r\n arr[r][c]='O';\r\n var calcmin=min_value(arr);\r\n console.log(arr);\r\n console.log(calcmin);\r\n \r\n /// unapplying the action to apply the new action in the next loop\r\n arr[r][c]='-';\r\n \r\n if(calcmin>maxval){\r\n maxval=calcmin;\r\n actionrow=r;\r\n actioncol=c;\r\n }\r\n }\r\n }\r\n }\r\n console.log('------------------MINIMAX Ended-------------------------');\r\n return [maxval, actionrow, actioncol];\r\n}", "minMax(squares, depth, isMax, AI, player) {\r\n //Copy my state\r\n const status = this.calculateWinner(squares);\r\n\r\n //The termination conditions for recursive minimax function\r\n if (status) {\r\n if (status === player) {\r\n return -10;\r\n } else {\r\n return +10;\r\n }\r\n } else {\r\n if (this.checkArrayFull()) return 0;\r\n }\r\n\r\n //define variable for storing data\r\n var value;\r\n\r\n //Maximize node\r\n if (isMax) {\r\n var maxVal = -11;\r\n for (let i = 0; i < 9; i++) {\r\n if (squares[i] === null) {\r\n squares[i] = AI;\r\n value = this.minMax(squares, depth + 1, !isMax, AI, player);\r\n squares[i] = null;\r\n if (value > maxVal) {\r\n maxVal = value;\r\n }\r\n }\r\n }\r\n return maxVal;\r\n }\r\n //Minimize node\r\n else {\r\n var minVal = 11;\r\n for (let i = 0; i < 9; i++) {\r\n if (squares[i] === null) {\r\n squares[i] = player;\r\n value = this.minMax(squares, depth + 1, !isMax, AI, player);\r\n squares[i] = null;\r\n if (value < minVal) {\r\n minVal = value;\r\n }\r\n }\r\n }\r\n return minVal;\r\n }\r\n }", "function CNCXPagMinMax()\n{\n}", "function minimaxWithAlphaBetaPruningAgentControl() {\n\t\n\t\t//alert(\"In minimaxWithAlphaBetaPruningAgentControl\");\n\t\t\n\t\tvar startTime = new Date();\n\t\t\n\t\tvar movesChecked = 0;\n\t\t\n\t\tvar oldValue;\n\t\t\n\t\tvar newValue;\n\t\t\n\t\tvar alpha = -Infinity;\n\t\t\n\t\tvar beta = Infinity;\n\t\t\n\t\tvar rootGameState = new gameStateObject(gameBoard, calculateRootGameBoardScore(gameBoard));\n\t\t\n\t\tvar legalMoves = rootGameState.getLegalMoves();\n\t\t\n\t\t// DEBUG CODE - Start\n\t\t/*\t\t\n\t\tvar tempString = \"\";\n\t\t\n\t\tfor (var y = 0; y < legalMoves.length; y++) {\n\t\t\n\t\t\ttempString = tempString + legalMoves[y] + \" \";\n\t\t}\n\t\t\n\t\talert(\"Root legal moves are \" + tempString);\n\t\t*/\n\t\t// DEBUG CODE - End\n\t\t\n\t\tvar bestMove = 100;\n\t\t\n\t\tvar tiedMoves = [];\n\t\t\n\t\tvar highestScoringTiedMove = 100;\n\t\t\n\t\tvar highestScoringTiedMoveValue = 0;\n\t\t\n\t\tif (activePlayer.character == \"X\") { \n\t\t\t\n\t\t\t//alert(\"Running minimax for player 1; will return max value after running minimax\");\n\t\t\t\n\t\t\toldValue = -Infinity;\n\t\t\t\n\t\t\tfor (var i = 0; i < legalMoves.length; i++) {\n\t\t\t\n\t\t\t\tnewValue = value(rootGameState.createSuccessorState(\"X\", legalMoves[i]), getOppositePlayerCharacter(\"X\"), alpha, beta);\n\t\t\t\t\n\t\t\t\tif (newValue > oldValue) {\n\t\t\t\t\n\t\t\t\t\toldValue = newValue;\n\t\t\t\t\t\n\t\t\t\t\tbestMove = legalMoves[i];\n\t\t\t\t\t\n\t\t\t\t\ttiedMoves.length = 0;\n\t\t\t\t\t\t\n\t\t\t\t\ttiedMoves[0] = legalMoves[i];\n\t\t\t\t\t\n\t\t\t\t\tif (oldValue > beta) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\talpha = Math.max(alpha, oldValue);\n\t\t\t\t}\n\t\t\t\telse if (newValue == oldValue) {\n\t\t\t\t\t\n\t\t\t\t\ttiedMoves[tiedMoves.length] = legalMoves[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse { // activePlayer.character == \"O\" \n\t\t\t\n\t\t\t//alert(\"Running minimax for player 2; will return min value after running minimax\");\n\t\t\n\t\t\toldValue = Infinity;\n\t\t\t\n\t\t\tfor (var i = 0; i < legalMoves.length; i++) {\n\t\t\t\n\t\t\t\tnewValue = value(rootGameState.createSuccessorState(\"O\", legalMoves[i]), getOppositePlayerCharacter(\"O\"), alpha, beta);\n\t\t\t\t\n\t\t\t\tif (newValue < oldValue) {\n\t\t\t\t\n\t\t\t\t\toldValue = newValue;\n\t\t\t\t\t\n\t\t\t\t\tbestMove = legalMoves[i];\n\t\t\t\t\t\n\t\t\t\t\ttiedMoves.length = 0;\n\t\t\t\t\t\t\n\t\t\t\t\ttiedMoves[0] = legalMoves[i];\n\t\t\t\t\t\n\t\t\t\t\tif (oldValue < alpha) {\n\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tbeta = Math.min(beta, oldValue);\n\t\t\t\t}\n\t\t\t\telse if (newValue == oldValue) {\n\t\t\t\t\t\n\t\t\t\t\ttiedMoves[tiedMoves.length] = legalMoves[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//alert(\"Square \" + bestMove + \" was selected with a score of \" + oldValue);\n\t\t\n\t\tif (tiedMoves.length > 0) {\n\t\t\n\t\t\t//alert(\"Tied moves found\");\n\t\t\t\n\t\t\tbestMove = tiedMoves[0];\n\t\t\t\n\t\t\tvar tempValue = 0;\n\t\t\t\n\t\t\tfor (var g = 0; g < tiedMoves.length; g++) {\n\t\t\t\n\t\t\t\tmovesChecked++;\n\t\t\t\n\t\t\t\ttempValue = getSquareValue(gameBoard, parseInt(tiedMoves[g]), activePlayer.character);\n\t\t\t\t\n\t\t\t\t//alert(\"Square \" + tiedMoves[g] + \" has a reflex value of \" + tempValue);\n\t\t\t\n\t\t\t\tif (tempValue > highestScoringTiedMoveValue) {\n\t\t\t\t\n\t\t\t\t\thighestScoringTiedMoveValue = tempValue;\n\t\t\t\t\t\n\t\t\t\t\thighestScoringTiedMove = tiedMoves[g];\n\t\t\t\t\t\n\t\t\t\t\tbestMove = highestScoringTiedMove;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//alert(\"Square \" + bestMove + \" (\" + highestScoringTiedMove + \") has the highest reflex value\");\n\t\t}\n\t\t\n\t\tvar endTime = new Date();\n\t\t\n\t\tvar timeElapsed = ((endTime - startTime) / 1000);\n\t\t\n\t\tif (activePlayer.character == \"X\") {\n\t\t\t\n\t\t\t$(\"#player1TimeTaken\").val(Number(timeElapsed).toFixed(timeDecimalPoints) + \" seconds\");\n\t\t\t$(\"#player1NodesChecked\").val(movesChecked);\n\t\t}\n\t\telse {\n\t\t\t\n\t\t\t$(\"#player2TimeTaken\").val(Number(timeElapsed).toFixed(timeDecimalPoints) + \" seconds\");\n\t\t\t$(\"#player2NodesChecked\").val(movesChecked);\n\t\t}\n\t\t\n\t\tgameBoard[bestMove].setAsEmpty(false);\n\t\t\t\t\n\t\tgameBoard[bestMove].setInnerText(activePlayer.character);\n\t\t\n\t\t//alert(bestMove + \"0 \" + getSquareHtmlID(parseInt(bestMove)) + \" \" + activePlayer.character + \" \" + gameBoard[bestMove].getInnerText());\n\t\t\n\t\t$(getSquareHtmlID(parseInt(bestMove))).html(gameBoard[bestMove].getInnerText());\n\t\t\t\n\t\tcontinueTurn();\n\t\t\n\t\tfunction value(gameStateObj, playerCharacter, alpha, beta) {\n\t\t\n\t\t\tmovesChecked++;\n\t\t\t\n\t\t\tif (gameStateObj.player1Wins() || gameStateObj.player2Wins()) {\n\t\t\t\t\n\t\t\t\treturn gameStateObj.score;\n\t\t\t}\n\t\t\t\n\t\t\tif (playerCharacter == \"X\") {\n\t\t\t\n\t\t\t\treturn maxValue(gameStateObj, playerCharacter, alpha, beta);\n\t\t\t}\n\t\t\telse { // playerCharacter == \"O\"\n\t\t\t\t\n\t\t\t\treturn minValue(gameStateObj, playerCharacter, alpha, beta);\n\t\t\t}\n\t\t};\n\t\t\n\t\tfunction minValue(gameStateObj, playerCharacter, alpha, beta) {\n\t\t\t\n\t\t\tvar v = Infinity;\n\t\t\t\n\t\t\tvar possibleMoves = gameStateObj.getLegalMoves();\n\t\t\t\n\t\t\tfor (var i = 0; i < possibleMoves.length; i++) {\n\t\t\t\t\n\t\t\t\tv = Math.min(v, value(gameStateObj.createSuccessorState(playerCharacter, possibleMoves[i]), getOppositePlayerCharacter(playerCharacter), alpha, beta));\n\t\t\t\n\t\t\t\tif (v < alpha) {\n\t\t\t\t\n\t\t\t\t\treturn v;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tbeta = Math.min(beta, v);\n\t\t\t}\n\t\t\t\n\t\t\treturn v;\n\t\t};\n\t\t\n\t\tfunction maxValue(gameStateObj, playerCharacter, alpha, beta) {\n\t\t\t\n\t\t\tvar v = -Infinity;\n\t\t\t\n\t\t\tvar possibleMoves = gameStateObj.getLegalMoves();\n\t\t\t\n\t\t\tfor (var i = 0; i < possibleMoves.length; i++) {\n\t\t\t\t\n\t\t\t\tv = Math.max(v, value(gameStateObj.createSuccessorState(playerCharacter, possibleMoves[i]), getOppositePlayerCharacter(playerCharacter), alpha, beta));\n\t\t\t\n\t\t\t\tif (v > beta) {\n\t\t\t\t\n\t\t\t\t\treturn v;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\talpha = Math.max(alpha, v);\n\t\t\t}\n\t\t\t\n\t\t\treturn v;\n\t\t};\n\t}", "min() {}", "function minMaxProduct(array){\n // your code here...\n}", "function minimax(currBoard , player){\n\n if ( checkWinner(AIChar) ){\n return {score: 1};\n }\n else if(checkWinner (humanChar) ){\n return { score: -1};\n }\n else if(noMorePlay()){\n return { score: 0};\n }\n\n if(player === AIChar){ // maximizing player\n\n let maxEval = {score: -Infinity};\n let bestMove = maxEval;\n\n for(let index = 0; index < currBoard.length; index++){\n\n\n if(typeof currBoard[index] === 'number'){\n\n let currindex = currBoard[index];\n\n currBoard[index] = AIChar;\n bestMove = minimax(currBoard , humanChar);\n \n if(bestMove.score > maxEval.score){\n maxEval.index = currindex;\n maxEval.score = bestMove.score;\n }\n currBoard[index] = currindex;\n \n }\n }\n\n return maxEval;\n }\n else{\n\n let maxEval = { score: Infinity, index: -1 };\n let bestMove = maxEval;\n\n for (let index = 0; index < currBoard.length; index++) {\n\n if (typeof currBoard[index] === 'number') {\n\n let currindex = currBoard[index];\n\n currBoard[index] = humanChar;\n bestMove = minimax(currBoard, AIChar);\n \n\n if (bestMove.score < maxEval.score) {\n maxEval.index = currindex;\n maxEval.score = bestMove.score;\n }\n\n currBoard[index] = currindex;\n \n }\n }\n\n return maxEval;\n }\n\n}", "function evaluateIA1(flagMinMax, plays){\n\tvar minmax = [0,n*n];\n\tvar index = [-1,-1];\n\tfor (var i = 0; i < plays.length; i++) {\n\t\tvar value = calculateScoreBoard(plays[i])[turn];\n\t\tif (minmax[0] < value){\n\t\t\tindex[0] = i;\n\t\t\tminmax[0] = value;\n\t\t}\n\t\tif (minmax[1] > value){\n\t\t\tindex[1] = i;\n\t\t\tminmax[1] = value;\n\t\t}\n\t}\n\tvar flag = index[flagMinMax];\n\tfor (i=0; i<n; i++){\n\t\tfor (j=0; j<n; j++){\n\t\t\tif (plays[flag][i][j]==equivalent(turn) && (pieces[i][j]==\"e\"))\n\t\t\t\treturn [i,j,minmax[flagMinMax]];\n\t\t}\n\t}\n\treturn -1;\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}", "think() {\n var max = 0;\n var maxIndex = 0;\n //get the output of the neural network\n this.decision = this.brain.feedForward(this.vision);\n\n for (var i = 0; i < this.decision.length; i++) {\n if (this.decision[i] > max) {\n max = this.decision[i];\n maxIndex = i;\n }\n }\n\n if (this.decision[0] > 0.5) {\n this.moveright();\n }\n\n if (this.decision[1] > 0.5) {\n this.jump();\n }\n }", "function minimax(board, player)\r\n{\r\n // returns indexes that are empty of the board sent as parameter\r\n // NOTE that this is NOT always the current state of the game\r\n var possibleMoves = emptySquares(board); \r\n \r\n // checks if player won, then returns positive value because human player is the maximizer\r\n if(checkWin(board, huPlayer))\r\n {\r\n return [10,null];\r\n }\r\n // checks if AI won\r\n else if(checkWin(board, aiPlayer))\r\n {\r\n return [-10,null];\r\n }\r\n // checks if tie\r\n else if(possibleMoves.length === 0)\r\n {\r\n return [0,null];\r\n }\r\n\r\n if(player === huPlayer) // maximizer\r\n {\r\n var bestValue = -10000; // worst case for maximizer\r\n var bestMove; // index of best move\r\n var value; // value of the move\r\n\r\n // go through all possible moves from the board state\r\n for(var i = 0; i < possibleMoves.length; i++)\r\n {\r\n board[possibleMoves[i]] = huPlayer; // change board state\r\n value = minimax(board, aiPlayer)[0]; // recursively evaluate board\r\n // if that value is better than bestValue\r\n // replace bestValue with that value\r\n // and saves the move\r\n if(value > bestValue) // greater than sign because it's maximizer's turn\r\n {\r\n bestValue = value;\r\n bestMove = possibleMoves[i];\r\n }\r\n // go back to original game state\r\n board[possibleMoves[i]] = possibleMoves[i];\r\n }\r\n // returns best value and the move\r\n return [bestValue, bestMove];\r\n }\r\n else // minimizer\r\n {\r\n var bestValue = 10000; // worst case for minimizer\r\n var bestMove; // index of best move\r\n var value; // value of move\r\n\r\n // go through all possible moves from the board state\r\n for(var i = 0; i < possibleMoves.length; i++)\r\n {\r\n board[possibleMoves[i]] = aiPlayer; // change board state\r\n value = minimax(board, huPlayer)[0]; // recursively evaluate board\r\n // if that value is better than bestValue\r\n // replace bestValue with that value\r\n // and saves the move\r\n if(value < bestValue) // is a less than sign because it's minimizer's turn\r\n {\r\n bestValue = value;\r\n bestMove = possibleMoves[i];\r\n }\r\n // undo move to preserve original game state\r\n board[possibleMoves[i]] = possibleMoves[i];\r\n }\r\n // returns best value and the move\r\n return [bestValue, bestMove];\r\n }\r\n}", "function calculateMinimumMoves() {\n\n}", "function expectimaxAgentControl() {\n\t\n\t\t//alert(\"In expectimaxAgentControl\");\n\t\t\n\t\tvar startTime = new Date();\n\t\t\n\t\tvar movesChecked = 0;\n\t\t\n\t\tvar oldValue;\n\t\t\n\t\tvar newValue;\n\t\t\n\t\tvar rootGameState = new gameStateObject(gameBoard, calculateRootGameBoardScore(gameBoard));\n\t\t\n\t\tvar legalMoves = rootGameState.getLegalMoves();\n\t\t\n\t\t// DEBUG CODE - Start\n\t\t/*\t\t\n\t\tvar tempString = \"\";\n\t\t\n\t\tfor (var y = 0; y < legalMoves.length; y++) {\n\t\t\n\t\t\ttempString = tempString + legalMoves[y] + \" \";\n\t\t}\n\t\t\n\t\talert(\"Root legal moves are \" + tempString);\n\t\t*/\n\t\t// DEBUG CODE - End\n\t\t\n\t\tvar bestMove = 100;\n\t\t\n\t\tvar tiedMoves = [];\n\t\t\n\t\tvar highestScoringTiedMove = 100;\n\t\t\n\t\tvar highestScoringTiedMoveValue = 0;\n\t\t\n\t\tif (activePlayer.character == \"X\") { \n\t\t\t\n\t\t\t//alert(\"Running minimax for player 1; will return max value after running minimax\");\n\t\t\t\n\t\t\toldValue = -Infinity;\n\t\t\t\n\t\t\tfor (var i = 0; i < legalMoves.length; i++) {\n\t\t\t\n\t\t\t\tnewValue = valueX(rootGameState.createSuccessorState(\"X\", legalMoves[i]), getOppositePlayerCharacter(\"X\"));\n\t\t\t\t\n\t\t\t\tif (newValue > oldValue) {\n\t\t\t\t\n\t\t\t\t\toldValue = newValue;\n\t\t\t\t\t\n\t\t\t\t\tbestMove = legalMoves[i];\n\t\t\t\t\t\n\t\t\t\t\ttiedMoves.length = 0;\n\t\t\t\t\t\t\n\t\t\t\t\ttiedMoves[0] = legalMoves[i];\n\t\t\t\t}\n\t\t\t\telse if (newValue == oldValue) {\n\t\t\t\t\t\n\t\t\t\t\ttiedMoves[tiedMoves.length] = legalMoves[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse { // activePlayer.character == \"O\" \n\t\t\t\n\t\t\t//alert(\"Running minimax for player 2; will return min value after running minimax\");\n\t\t\n\t\t\toldValue = Infinity;\n\t\t\t\n\t\t\tfor (var i = 0; i < legalMoves.length; i++) {\n\t\t\t\n\t\t\t\tnewValue = valueO(rootGameState.createSuccessorState(\"O\", legalMoves[i]), getOppositePlayerCharacter(\"O\"));\n\t\t\t\t\n\t\t\t\tif (newValue < oldValue) {\n\t\t\t\t\n\t\t\t\t\toldValue = newValue;\n\t\t\t\t\t\n\t\t\t\t\tbestMove = legalMoves[i];\n\t\t\t\t\t\n\t\t\t\t\ttiedMoves.length = 0;\n\t\t\t\t\t\t\n\t\t\t\t\ttiedMoves[0] = legalMoves[i];\n\t\t\t\t}\n\t\t\t\telse if (newValue == oldValue) {\n\t\t\t\t\t\n\t\t\t\t\ttiedMoves[tiedMoves.length] = legalMoves[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//alert(\"Square \" + bestMove + \" was selected with a score of \" + oldValue);\n\t\t\n\t\tif (tiedMoves.length > 0) {\n\t\t\n\t\t\t//alert(\"Tied moves found\");\n\t\t\t\n\t\t\tbestMove = tiedMoves[0];\n\t\t\t\n\t\t\tvar tempValue = 0;\n\t\t\t\n\t\t\tfor (var g = 0; g < tiedMoves.length; g++) {\n\t\t\t\n\t\t\t\tmovesChecked++;\n\t\t\t\n\t\t\t\ttempValue = getSquareValue(gameBoard, parseInt(tiedMoves[g]), activePlayer.character);\n\t\t\t\t\n\t\t\t\t//alert(\"Square \" + tiedMoves[g] + \" has a reflex value of \" + tempValue);\n\t\t\t\n\t\t\t\tif (tempValue > highestScoringTiedMoveValue) {\n\t\t\t\t\n\t\t\t\t\thighestScoringTiedMoveValue = tempValue;\n\t\t\t\t\t\n\t\t\t\t\thighestScoringTiedMove = tiedMoves[g];\n\t\t\t\t\t\n\t\t\t\t\tbestMove = highestScoringTiedMove;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//alert(\"Square \" + bestMove + \" (\" + highestScoringTiedMove + \") has the highest reflex value\");\n\t\t}\n\t\t\n\t\tvar endTime = new Date();\n\t\t\n\t\tvar timeElapsed = ((endTime - startTime) / 1000);\n\t\t\n\t\tif (activePlayer.character == \"X\") {\n\t\t\t\n\t\t\t$(\"#player1TimeTaken\").val(Number(timeElapsed).toFixed(timeDecimalPoints) + \" seconds\");\n\t\t\t$(\"#player1NodesChecked\").val(movesChecked);\n\t\t}\n\t\telse {\n\t\t\t\n\t\t\t$(\"#player2TimeTaken\").val(Number(timeElapsed).toFixed(timeDecimalPoints) + \" seconds\");\n\t\t\t$(\"#player2NodesChecked\").val(movesChecked);\n\t\t}\n\t\t\n\t\tgameBoard[bestMove].setAsEmpty(false);\n\t\t\t\t\n\t\tgameBoard[bestMove].setInnerText(activePlayer.character);\n\t\t\n\t\t//alert(bestMove + \"0 \" + getSquareHtmlID(parseInt(bestMove)) + \" \" + activePlayer.character + \" \" + gameBoard[bestMove].getInnerText());\n\t\t\n\t\t$(getSquareHtmlID(parseInt(bestMove))).html(gameBoard[bestMove].getInnerText());\n\t\t\t\n\t\tcontinueTurn();\n\t\t\n\t\tfunction valueX(gameStateObj, playerCharacter) {\n\t\t\n\t\t\tmovesChecked++;\n\t\t\t\n\t\t\tif (gameStateObj.player1Wins() || gameStateObj.player2Wins()) {\n\t\t\t\t\n\t\t\t\treturn gameStateObj.score;\n\t\t\t}\n\t\t\t\n\t\t\tif (playerCharacter == \"X\") {\n\t\t\t\n\t\t\t\treturn maxValue(gameStateObj, playerCharacter);\n\t\t\t}\n\t\t\telse { // playerCharacter == \"O\"\n\t\t\t\t\n\t\t\t\treturn expValueX(gameStateObj, playerCharacter);\n\t\t\t}\n\t\t};\n\t\t\n\t\tfunction valueO(gameStateObj, playerCharacter) {\n\t\t\n\t\t\tmovesChecked++;\n\t\t\t\n\t\t\tif (gameStateObj.player1Wins() || gameStateObj.player2Wins()) {\n\t\t\t\t\n\t\t\t\treturn gameStateObj.score;\n\t\t\t}\n\t\t\t\n\t\t\tif (playerCharacter == \"X\") {\n\t\t\t\n\t\t\t\treturn expValueO(gameStateObj, playerCharacter);\n\t\t\t}\n\t\t\telse { // playerCharacter == \"O\"\n\t\t\t\t\n\t\t\t\treturn minValue(gameStateObj, playerCharacter);\n\t\t\t}\n\t\t};\n\t\t\n\t\tfunction minValue(gameStateObj, playerCharacter) {\n\t\t\t\n\t\t\tvar v = Infinity;\n\t\t\t\n\t\t\tvar possibleMoves = gameStateObj.getLegalMoves();\n\t\t\t\n\t\t\tfor (var i = 0; i < possibleMoves.length; i++) {\n\t\t\t\t\n\t\t\t\tv = Math.min(v, valueO(gameStateObj.createSuccessorState(playerCharacter, possibleMoves[i]), getOppositePlayerCharacter(playerCharacter)));\n\t\t\t}\n\t\t\t\n\t\t\treturn v;\n\t\t};\n\t\t\n\t\tfunction maxValue(gameStateObj, playerCharacter) {\n\t\t\t\n\t\t\tvar v = -Infinity;\n\t\t\t\n\t\t\tvar possibleMoves = gameStateObj.getLegalMoves();\n\t\t\t\n\t\t\tfor (var i = 0; i < possibleMoves.length; i++) {\n\t\t\t\t\n\t\t\t\tv = Math.max(v, valueX(gameStateObj.createSuccessorState(playerCharacter, possibleMoves[i]), getOppositePlayerCharacter(playerCharacter)));\n\t\t\t}\n\t\t\t\n\t\t\treturn v;\n\t\t};\n\t\t\n\t\tfunction expValueX(gameStateObj, playerCharacter) {\n\t\t\t\n\t\t\tvar v = 0;\n\t\t\t\n\t\t\tvar possibleMoves = gameStateObj.getLegalMoves();\n\t\t\t\n\t\t\tfor (var i = 0; i < possibleMoves.length; i++) {\n\t\t\t\n\t\t\t\tprobability = (1.0 / possibleMoves.length); // Read Note Below\n\t\t\t\t\n\t\t\t\t/* \n\t\t\t\t\n\t\t\t\tNote: \n\t\t\t\t\n\t\t\t\tSometimes the probability is different for each move; here the prob treated the same, for ease of programming \n\t\t\t\tand in anticipation of running against a random computer agent. So in this application the probability could be\n\t\t\t\tcomputed just once outside of the for loop instead of for each iteration of the loop. It's just computed here \n\t\t\t\tas a reminding that in cases where expectimax is not running against a random agent, probability must be computed \n\t\t\t\tseparately for every move.\n\t\t\t\t\n\t\t\t\t*/\n\t\t\t\t\n\t\t\t\tv = probability * valueX(gameStateObj.createSuccessorState(playerCharacter, possibleMoves[i]), getOppositePlayerCharacter(playerCharacter));\n\t\t\t}\n\t\t\t\n\t\t\treturn v;\n\t\t};\n\t\t\n\t\tfunction expValueO(gameStateObj, playerCharacter) {\n\t\t\t\n\t\t\tvar v = 0;\n\t\t\t\n\t\t\tvar possibleMoves = gameStateObj.getLegalMoves();\n\t\t\t\n\t\t\tfor (var i = 0; i < possibleMoves.length; i++) {\n\t\t\t\n\t\t\t\tprobability = (1.0 / possibleMoves.length); // Read Note Below\n\t\t\t\t\n\t\t\t\t/* \n\t\t\t\t\n\t\t\t\tNote: \n\t\t\t\t\n\t\t\t\tSometimes the probability is different for each move; here the prob treated the same, for ease of programming \n\t\t\t\tand in anticipation of running against a random computer agent. So in this application the probability could be\n\t\t\t\tcomputed just once outside of the for loop instead of for each iteration of the loop. It's just computed here \n\t\t\t\tas a reminding that in cases where expectimax is not running against a random agent, probability must be computed \n\t\t\t\tseparately for every move.\n\t\t\t\t\n\t\t\t\t*/\n\t\t\t\t\n\t\t\t\tv = probability * valueO(gameStateObj.createSuccessorState(playerCharacter, possibleMoves[i]), getOppositePlayerCharacter(playerCharacter));\n\t\t\t}\n\t\t\t\n\t\t\treturn v;\n\t\t};\n\t}", "function calculate_minmax(data) {\n\n bound = [];\n bound.max = Math.max.apply(Math, data);\n bound.min = Math.min.apply(Math, data);\n return bound;\n\n}", "naturalSelection() {\n this.matingPool = [];\n\n let maxFitness = 0;\n for (let i = 0; i < this.population.length; i++) {\n if (this.population[i].fitness > maxFitness) {\n maxFitness = this.population[i].fitness;\n }\n }\n\n for (let i = 0; i < this.population.length; i++) {\n // Scalling zero to max fitness in zero to one range\n let fitness = map(this.population[i].fitness, 0, maxFitness, 0, 1);\n let n = floor(fitness * 100);\n for (let j = 0; j < n; j++) {\n this.matingPool.push(this.population[i]);\n }\n }\n }", "function miniMaxAlgorithm(currentBoard, depth, alpha, beta, isMax){\n if(depth === difficultyDepth){\n return [evaluateBoard(currentBoard)];\n }\n\n var whitePieces = [], \n blackPieces = [];\n\n for(let i = 0; i < 8; i++){\n for(let j = 0; j < 8; j++){\n if(currentBoard[i][j] === null)\n continue;\n \n if(currentBoard[i][j].color === ColorsEnum.BLACK)\n blackPieces.push(currentBoard[i][j]);\n else\n whitePieces.push(currentBoard[i][j]);\n }\n }\n let bestMove = isMax? [alpha, null] : [beta, null];\n\n if(isMax){\n // pieces\n for(let i = 0; i < blackPieces.length; i++){\n let pieceMoves = blackPieces[i].getValidMoves(currentBoard);\n // move of each piece\n for(let j = 0; j < pieceMoves.length; j++){\n let move = pieceMoves[j];\n if(!checkMoveValidity(currentBoard, move))\n continue;\n \n blackPieces[i].movePiece(move, currentBoard);\n \n let retVal = miniMaxAlgorithm(currentBoard, depth + 1, alpha, beta, !isMax); \n\n if(retVal[0] > alpha){\n alpha = retVal[0];\n bestMove = [alpha, move];\n }\n if(alpha >= beta){\n blackPieces[i].undoMove(move, currentBoard);\n return bestMove;\n }\n //alpha = Math.max(alpha, retVal[0]);\n\n blackPieces[i].undoMove(move, currentBoard);\n }\n }\n }\n else{\n for(let i = 0; i < whitePieces.length; i++){\n let pieceMoves = whitePieces[i].getValidMoves(currentBoard);\n // move of each piece\n for(let j = 0; j < pieceMoves.length; j++){\n let move = pieceMoves[j];\n if(!checkMoveValidity(currentBoard, move))\n continue;\n \n whitePieces[i].movePiece(move, currentBoard);\n\n let retVal = miniMaxAlgorithm(currentBoard, depth + 1, alpha, beta, !isMax);\n\n // check for pruning\n if(retVal[0] < bestMove[0]){\n beta = retVal[0];\n bestMove = [beta, move];\n }\n if(alpha >= beta){\n whitePieces[i].undoMove(move, currentBoard);\n return bestMove;\n }\n //beta = Math.min(beta, retVal[0]);\n\n whitePieces[i].undoMove(move, currentBoard);\n }\n\n }\n }\n\n // console.log(bestMove);\n // console.log('');\n return bestMove;\n}", "getRange(name) {\n //push new item mimicing new purchase \n var key = name\n var keyObj = {[key]: 1}\n\n\n //train data\n for (let i = 0; i < this.items.length; i++) {\n this.trainingData.push({\n input: this.items[i],\n output: this.range[i]\n })\n }\n\n\n //set up neural net\n const net = new brain.NeuralNetwork({ hiddenLayers: [3]});\n\n\n //train data\n const stats = net.train(this.trainingData)\n //console.log(stats)\n \n \n // Store all ranges of a specific category in \"allRange\" object\n var allRange = net.run({\n keyObj\n })\n //console.log(allRange)\n\n \n // Store the key with the maximum value in \"answer\"\n var answer = Object.keys(allRange).reduce((a, b) => allRange[a] > allRange[b] ? a : b)\n //console.log(answer)\n\n return answer\n\n }", "regularization() {\n const system_optimal = this.systemOptimal;\n\n var search_area = [];\n search_area.push(system_optimal);\n var i = system_optimal[0];\n var j = system_optimal[1];\n if (i - 1 > -1) {\n search_area.push([i-1,j]);\n }\n if (i + 1 < this.featureSize) {\n search_area.push([i+1,j]);\n }\n if (j - 1 > -1) {\n search_area.push([i,j-1]);\n }\n if (j + 1 < this.featureSize) {\n search_area.push([i,j+1]);\n }\n if (i - 1 > -1 && j - 1 > -1) {\n search_area.push([i-1,j-1]);\n }\n if (i + 1 < this.featureSize && j + 1 < this.featureSize) {\n search_area.push([i + 1, j+1]);\n }\n if (i - 1 > -1 && j + 1 < this.featureSize) {\n search_area.push([i - 1, j+1]);\n }\n if (i + 1 < this.featureSize && j - 1 > -1) {\n search_area.push([i + 1, j - 1]);\n }\n return search_area;\n }", "calculateRange() {\n if (!this.grid || !this.grid[0]) {\n return\n }\n let rows = this.grid.length\n let cols = this.grid[0].length\n // const vectors = [];\n let min\n let max\n // @from: https://stackoverflow.com/questions/13544476/how-to-find-max-and-min-in-array-using-minimum-comparisons\n for (let j = 0; j < rows; j++) {\n for (let i = 0; i < cols; i++) {\n let vec = this.grid[j][i]\n if (vec !== null) {\n let val = vec.m || vec.magnitude()\n // vectors.push();\n if (min === undefined) {\n min = val\n } else if (max === undefined) {\n max = val\n // update min max\n // 1. Pick 2 elements(a, b), compare them. (say a > b)\n min = Math.min(min, max)\n max = Math.max(min, max)\n } else {\n // 2. Update min by comparing (min, b)\n // 3. Update max by comparing (max, a)\n min = Math.min(val, min)\n max = Math.max(val, max)\n }\n }\n }\n }\n return [min, max]\n }", "function evaluateIA2(flagMinMax, plays){\n\tvar minmax = [0,calculateMaxBoardValue()];\n\tvar index = [-1,-1];\n\tfor (var i=0; i<plays.length; i++){\n\t\tvar value = calculateDistanceFromEdges(plays[i]);\n\t\tif (minmax[0] < value){\n\t\t\tindex[0] = i;\n\t\t\tminmax[0] = value;\n\t\t}\n\t\tif (minmax[1] > value){\n\t\t\tindex[1] = i;\n\t\t\tminmax[1] = value;\n\t\t}\n\t}\n\tvar flag = index[flagMinMax];\n\tfor (i=0; i<n; i++){\n\t\tfor (j=0; j<n; j++){\n\t\t\tif (plays[flag][i][j]==equivalent(turn) && (pieces[i][j]==\"e\"))\n\t\t\t\treturn [i,j,minmax[flagMinMax]];\n\t\t}\n\t}\n\n\treturn -1;\n}", "function getMaxMin(Layer, energy, moisture, content, potential, year){\n max = 0\n min = 99999999\n// As thermochemical facilities do not have a tag but are listed as dry we need to do the step below\nif (energy == '_dry'){\n moisture = '_dry'\n energy = ''\n }\n\n Layer.forEach(function(feature){\n type = feature.getProperty(\"Type\");\n if (type == 'crop'){\n if (moisture == ''){\n res_val = getTotalBiomass(feature, energy, '_dry', content, potential, year);\n cull_val = getTotalBiomass(feature, energy, '_wet', content, potential, year);\n biomass_val = res_val + cull_val\n }\n else {\n biomass_val = getTotalBiomass(feature, energy, moisture, content, potential, year);\n }\n }\n else {\n biomass_val = getTotalBiomass(feature, energy, moisture, content, potential, year);\n }\n if (biomass_val>max){\n max=biomass_val\n }\n if (biomass_val<min){\n min=biomass_val\n }\n })\n return ([max, min])\n }", "function sol1(array) {\n\tlet minMax = []\n\tarray.forEach((ar,i)=>{\n\t\tlet arr1 = [...arr]\n\t\tarr1.splice(i, 1)\n\t\tminMax.push(arr1.reduce((acc,v)=> {\n\t\t\treturn acc + v\n\t\t}))\n\t\t\n\t})\n\tlet min = Math.min.apply(null, minMax)\n\tlet max = Math.max.apply(null, minMax)\n\tconsole.log({min:min, max:max, minMaxxArr: minMax})\n}", "function min_max_bigtraders() {\n min = Number.MAX_SAFE_INTEGER;\n max = 0;\n\n big_traders.forEach(function(ISO) {\n stories_data[current_story]\n .filter(x => x.PartnerISO == ISO)\n .map(x => parseInt(x.Value))\n .forEach(function(value) {\n if (value > max) {\n max = value;\n }\n if (value < min) {\n min = value;\n }\n })\n })\n return [min, max];\n}", "function minimaxAgentControl() {\n\t\t\n\t\t//alert(\"In minimaxAgentControl\");\n\t\t\n\t\tvar startTime = new Date();\n\t\t\n\t\tvar movesChecked = 0;\n\t\t\n\t\tvar oldValue;\n\t\t\n\t\tvar newValue;\n\t\t\n\t\tvar rootGameState = new gameStateObject(gameBoard, calculateRootGameBoardScore(gameBoard));\n\t\t\n\t\tvar legalMoves = rootGameState.getLegalMoves();\n\t\t\n\t\t// DEBUG CODE - Start\n\t\t/*\t\t\n\t\tvar tempString = \"\";\n\t\t\n\t\tfor (var y = 0; y < legalMoves.length; y++) {\n\t\t\n\t\t\ttempString = tempString + legalMoves[y] + \" \";\n\t\t}\n\t\t\n\t\talert(\"Root legal moves are \" + tempString);\n\t\t*/\n\t\t// DEBUG CODE - End\n\t\t\n\t\tvar bestMove = 100;\n\t\t\n\t\tvar tiedMoves = [];\n\t\t\n\t\tvar highestScoringTiedMove = 100;\n\t\t\n\t\tvar highestScoringTiedMoveValue = 0;\n\t\t\n\t\tif (activePlayer.character == \"X\") { \n\t\t\t\n\t\t\t//alert(\"Running minimax for player 1; will return max value after running minimax\");\n\t\t\t\n\t\t\toldValue = -Infinity;\n\t\t\t\n\t\t\tfor (var i = 0; i < legalMoves.length; i++) {\n\t\t\t\n\t\t\t\tnewValue = value(rootGameState.createSuccessorState(\"X\", legalMoves[i]), getOppositePlayerCharacter(\"X\"));\n\t\t\t\t\n\t\t\t\tif (newValue > oldValue) {\n\t\t\t\t\t\n\t\t\t\t\toldValue = newValue;\n\t\t\t\t\t\n\t\t\t\t\tbestMove = legalMoves[i];\n\t\t\t\t\t\n\t\t\t\t\ttiedMoves.length = 0;\n\t\t\t\t\t\t\n\t\t\t\t\ttiedMoves[0] = legalMoves[i];\n\t\t\t\t}\n\t\t\t\telse if (newValue == oldValue) {\n\t\t\t\t\t\n\t\t\t\t\ttiedMoves[tiedMoves.length] = legalMoves[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse { // activePlayer.character == \"O\" \n\t\t\t\n\t\t\t//alert(\"Running minimax for player 2; will return min value after running minimax\");\n\t\t\n\t\t\toldValue = Infinity;\n\t\t\t\n\t\t\tfor (var i = 0; i < legalMoves.length; i++) {\n\t\t\t\n\t\t\t\tnewValue = value(rootGameState.createSuccessorState(\"O\", legalMoves[i]), getOppositePlayerCharacter(\"O\"));\n\t\t\t\t\n\t\t\t\tif (newValue < oldValue) {\n\t\t\t\t\t\n\t\t\t\t\toldValue = newValue;\n\t\t\t\t\t\n\t\t\t\t\tbestMove = legalMoves[i];\n\t\t\t\t\t\n\t\t\t\t\ttiedMoves.length = 0;\n\t\t\t\t\t\t\n\t\t\t\t\ttiedMoves[0] = legalMoves[i];\n\t\t\t\t}\n\t\t\t\telse if (newValue == oldValue) {\n\t\t\t\t\t\n\t\t\t\t\ttiedMoves[tiedMoves.length] = legalMoves[i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//alert(\"Square \" + bestMove + \" was selected with a score of \" + oldValue);\n\t\t\n\t\tif (tiedMoves.length > 0) {\n\t\t\n\t\t\t//alert(\"Tied moves found\");\n\t\t\t\n\t\t\tbestMove = tiedMoves[0];\n\t\t\t\n\t\t\tvar tempValue = 0;\n\t\t\t\n\t\t\tfor (var g = 0; g < tiedMoves.length; g++) {\n\t\t\t\n\t\t\t\tmovesChecked++;\n\t\t\t\n\t\t\t\ttempValue = getSquareValue(gameBoard, parseInt(tiedMoves[g]), activePlayer.character);\n\t\t\t\t\n\t\t\t\t//alert(\"Square \" + tiedMoves[g] + \" has a reflex value of \" + tempValue);\n\t\t\t\n\t\t\t\tif (tempValue > highestScoringTiedMoveValue) {\n\t\t\t\t\n\t\t\t\t\thighestScoringTiedMoveValue = tempValue;\n\t\t\t\t\t\n\t\t\t\t\thighestScoringTiedMove = tiedMoves[g];\n\t\t\t\t\t\n\t\t\t\t\tbestMove = highestScoringTiedMove;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t//alert(\"Square \" + bestMove + \" (\" + highestScoringTiedMove + \") has the highest reflex value\");\n\t\t}\n\t\t\n\t\tvar endTime = new Date();\n\t\t\n\t\tvar timeElapsed = ((endTime - startTime) / 1000);\n\t\t\n\t\tif (activePlayer.character == \"X\") {\n\t\t\t\n\t\t\t$(\"#player1TimeTaken\").val(Number(timeElapsed).toFixed(timeDecimalPoints) + \" seconds\");\n\t\t\t$(\"#player1NodesChecked\").val(movesChecked);\n\t\t}\n\t\telse {\n\t\t\t\n\t\t\t$(\"#player2TimeTaken\").val(Number(timeElapsed).toFixed(timeDecimalPoints) + \" seconds\");\n\t\t\t$(\"#player2NodesChecked\").val(movesChecked);\n\t\t}\n\t\t\n\t\tgameBoard[bestMove].setAsEmpty(false);\n\t\t\t\t\n\t\tgameBoard[bestMove].setInnerText(activePlayer.character);\n\t\t\n\t\t//alert(bestMove + \"0 \" + getSquareHtmlID(parseInt(bestMove)) + \" \" + activePlayer.character + \" \" + gameBoard[bestMove].getInnerText());\n\t\t\n\t\t$(getSquareHtmlID(parseInt(bestMove))).html(gameBoard[bestMove].getInnerText());\n\t\t\t\n\t\tcontinueTurn();\n\t\t\n\t\tfunction value(gameStateObj, playerCharacter) {\n\t\t\n\t\t\tmovesChecked++;\n\t\t\t\n\t\t\tif (gameStateObj.player1Wins() || gameStateObj.player2Wins()) {\n\t\t\t\t\n\t\t\t\treturn gameStateObj.score;\n\t\t\t}\n\t\t\t\n\t\t\tif (playerCharacter == \"X\") {\n\t\t\t\n\t\t\t\treturn maxValue(gameStateObj, playerCharacter);\n\t\t\t}\n\t\t\telse { // playerCharacter == \"O\"\n\t\t\t\t\n\t\t\t\treturn minValue(gameStateObj, playerCharacter);\n\t\t\t}\n\t\t};\n\t\t\n\t\tfunction minValue(gameStateObj, playerCharacter) {\n\t\t\t\n\t\t\tvar v = Infinity;\n\t\t\t\n\t\t\tvar possibleMoves = gameStateObj.getLegalMoves();\n\t\t\t\n\t\t\tfor (var i = 0; i < possibleMoves.length; i++) {\n\t\t\t\t\n\t\t\t\tv = Math.min(v, value(gameStateObj.createSuccessorState(playerCharacter, possibleMoves[i]), getOppositePlayerCharacter(playerCharacter)));\n\t\t\t}\n\t\t\t\n\t\t\treturn v;\n\t\t};\n\t\t\n\t\tfunction maxValue(gameStateObj, playerCharacter) {\n\t\t\t\n\t\t\tvar v = -Infinity;\n\t\t\t\n\t\t\tvar possibleMoves = gameStateObj.getLegalMoves();\n\t\t\t\n\t\t\tfor (var i = 0; i < possibleMoves.length; i++) {\n\t\t\t\t\n\t\t\t\tv = Math.max(v, value(gameStateObj.createSuccessorState(playerCharacter, possibleMoves[i]), getOppositePlayerCharacter(playerCharacter)));\n\t\t\t}\n\t\t\t\n\t\t\treturn v;\n\t\t};\n\t}", "_minMaxSearch(searchFromNode,depth,maximizingPlayer,currentPlayer)\n {\n if (depth == 0 || this._isTerminal(searchFromNode.board,currentPlayer))\n {\n searchFromNode.score = this._evaluate(searchFromNode.board,currentPlayer) * (maximizingPlayer ? 1 : -1);\n return searchFromNode;\n }\n \n if (maximizingPlayer)\n {\n var maxSubnode = {score:Number.NEGATIVE_INFINITY}\n this._childBoardsOf(searchFromNode.board,currentPlayer).forEach(searchNode => {\n let childNode = this._minMaxSearch(searchNode,depth-1,!maximizingPlayer,currentPlayer == 1 ? 2 : 1);\n if (childNode.score > maxSubnode.score)\n {\n childNode.cellToMove = searchNode.cell;\n maxSubnode = childNode\n }\n });\n return maxSubnode;\n }\n else //it's a minimizing player\n {\n var minSubnode = { score : Number.POSITIVE_INFINITY };\n this._childBoardsOf(searchFromNode.board,currentPlayer).forEach(searchNode => {\n let childNode = this._minMaxSearch(searchNode,depth-1,!maximizingPlayer,currentPlayer == 1 ? 2 : 1);\n if (childNode.score < minSubnode.score)\n {\n childNode.cellToMove = searchNode.cell;\n minSubnode = childNode\n }\n })\n return minSubnode;\n }\n\n }", "function minimaxValue(state) { ... }", "naturalSelection() {\n\n this.matingPool = [];\n \n // get the maximum fitess\n let maxFit = 0;\n for (let i = 0; i < this.population.length; i++) {\n if(this.population[i].fitness > maxFit) {\n maxFit = this.population[i].fitness;\n }\n }\n\n // fill the mating pool\n for (let i = 0; i < this.population.length; i++) {\n // normalize fitness\n let fitness = map(this.population[i].fitness, 0, maxFit, 0, 1);\n // fill the mating pool depending\n // on the fitness of each member of the\n // population.\n // fintess = 1 -> 100 clones in the mating pool\n let n = floor(fitness * 100);\n for (let j = 0; j < n; j++) {\n this.matingPool.push(this.population[i]);\n }\n }\n\n }", "function solve(a) {\n let min = 1, max = 1;\n for (let x of a) {\n let cur = [];\n for (let y of x) cur.push(y * min), cur.push(y * max);\n min = Math.min(...cur);\n max = Math.max(...cur);\n }\n return max;\n }", "evaluate() {\n let b = this.population.reduce((acc, val) => {\n if (val.fitness >= acc.fitness) return val;\n else return acc;\n }, this.population[0]);\n \n this.best = b.genes.join(\"\")\n\n if(b.genes.join(\"\") == this.target) {\n this.done = true;\n } else {\n this.time = (Date.now() - this.timeStart)/1000;\n }\n }", "function minimax(node, player, ply, initialNode){\n\tlet children = new Array(0);\n\tlet heuristicValues = new Array(0);\n\tlet options = new Array(0);\n\n\tif(ply != 0){\n\t\tchildren = getChildren(node);\n\t\tfor(let i = 0; i < children.length; i++){\n\t\t\tif(player == MIN){\n\t\t\t\theuristicValues.push(minimax(children[i], MAX, ply - 1, false));\n\t\t\t}else{\n\t\t\t\theuristicValues.push(minimax(children[i], MIN, ply - 1, false));\n\t\t\t}\n\t\t}\n\t\tif(initialNode){\n\t\t\tconsole.log(\"Offered to initialNode:\");\n\t\t}\n\t\tif(player == MIN){\n\t\t\tconsole.log(\"Offered to MIN node (level\", ply, \"): \", heuristicValues);\n\t\t}else{\n\t\t\tconsole.log(\"Offered to MAX: node (level\", ply, \"): \", heuristicValues);\n\t\t}\n\t\tif(initialNode){\n\t\t\t//Get the index of the node with the Larger or Smaller value\n\t\t\t//depending on the current player\n\t\t\tif(player == MIN){\n\t\t\t\t//Get the index of the node with the Smaller heuristic value\n\t\t\t\t//Getting the Smaller value\n\t\t\t\tlet min = heuristicValues.reduce(function(previousVal, currentVal, index, array) {\n\t\t\t\t\t//previousVal is the last returned value\n\t\t\t\t\tif(currentVal < previousVal){\n\t\t\t\t\t\treturn currentVal;\n\t\t\t\t\t}else{\n\t\t\t\t\t\treturn previousVal;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t//Search for all the nodes that share the same heuristic value,\n\t\t\t\t//if there are more than one, and return them\n\t\t\t\tfor(let index = 0; index < heuristicValues.length; index++){\n\t\t\t\t\tif(heuristicValues[index] == min){\n\t\t\t\t\t\toptions.push(children[index]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.log(\"Chosen: \", min);\n\t\t\t\treturn options;\n\t\t\t}else{\n\t\t\t\t//Get the index of the node with the Larger heuristic value\n\t\t\t\t//Getting the Larger value\n\t\t\t\tlet max = heuristicValues.reduce(function(previousVal, currentVal, index, array) {\n\t\t\t\t\t//previousVal is the last returned value\n\t\t\t\t\tif(currentVal > previousVal){\n\t\t\t\t\t\treturn currentVal;\n\t\t\t\t\t}else{\n\t\t\t\t\t\treturn previousVal;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t//Search for all the nodes that share the same heuristic value,\n\t\t\t\t//if there are more than one, and return them\n\t\t\t\tfor(let index = 0; index < heuristicValues.length; index++){\n\t\t\t\t\tif(heuristicValues[index] == max){\n\t\t\t\t\t\toptions.push(children[index]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tconsole.log(\"Chosen: \", max);\n\t\t\t\treturn options;\n\t\t\t}\n\t\t}else{\n\t\t\t//Get the index of the node with the Larger or Smaller value\n\t\t\t//depending on the current player\n\t\t\tif(player == MIN){\n\t\t\t\t//Get the index of the node with the Smaller heuristic value\n\t\t\t\t//Getting the Smaller value\n\t\t\t\tlet min = heuristicValues.reduce(function(previousVal, currentVal, index, array) {\n\t\t\t\t\t//previousVal is the last returned value\n\t\t\t\t\tif(currentVal < previousVal){\n\t\t\t\t\t\treturn currentVal;\n\t\t\t\t\t}else{\n\t\t\t\t\t\treturn previousVal;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tconsole.log(\"Promoted: \", min);\n\t\t\t\treturn min;\n\t\t\t}else{\n\t\t\t\t//Get the index of the node with the Larger heuristic value\n\t\t\t\t//Getting the Larger value\n\t\t\t\tlet max = heuristicValues.reduce(function(previousVal, currentVal, index, array) {\n\t\t\t\t\t//previousVal is the last returned value\n\t\t\t\t\tif(currentVal > previousVal){\n\t\t\t\t\t\treturn currentVal;\n\t\t\t\t\t}else{\n\t\t\t\t\t\treturn previousVal;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tconsole.log(\"Promoted: \", max);\n\t\t\t\treturn max;\n\t\t\t}\n\t\t}\n\t}else{\n\t\treturn(heuristicValue(node));\n\t}\n}", "function findMinMax (x,y){\r\n var len = x.length\r\n if ( y === true ){\r\n return Math.max(...x)\r\n }else{\r\n return Math.min(...x)\r\n }\r\n }", "function minMax(depth, flagMinMax, board, possiblePlays){\n\tvar currentValue;\n\tif (depth>0){\n\t\tif (possiblePlays.length==0){\n\t\t\tvar pos = checkPos(board);\n\t\t\tvar value;\n\t\t\tif (flagMinMax == 0){\n\t\t\t\tvalue = 0;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tvalue = calculateMaxBoardValue();\n\t\t\t}\n\t\t\tcurrentValue = [pos[0],pos[1],value];\n\t\t}\n\t\telse{\n\t\t\tcurrentValue = evaluateIA2(flagMinMax,[possiblePlays[0]]);\n\t\t}\n\t\tvar index=0;\n\t\tvar board;\n\t\tfor (var i=0; i<possiblePlays.length; i++){\n\t\t\tboard = jQuery.extend(true,{}, possiblePlays[i]);\n\t\t\tnewValue = minMax(depth-1, (flagMinMax+1)%2, board, calculateValidPlays(board));\n\t\t\tif (flagMinMax==0){\n\t\t\t\tif (currentValue[2]<=newValue[2]){\n\t\t\t\t\tcurrentValue[2] = newValue[2];\n\t\t\t\t\tindex =i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (flagMinMax==1){\n\t\t\t\tif (currentValue[2]>=newValue[2]){\n\t\t\t\t\tcurrentValue[2] = newValue[2];\n\t\t\t\t\tindex=i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (possiblePlays.length!=0){\n\t\t\tfor (i=0; i<n; i++){\n\t\t\t\tfor (j=0; j<n; j++){\n\t\t\t\t\tif (possiblePlays[index][i][j]==equivalent(turn) && (pieces[i][j]==\"e\")){\n\t\t\t\t\t\tcurrentValue[0] = i;\n\t\t\t\t\t\tcurrentValue[1] = j;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\tif (possiblePlays.length==0){\n\t\t\tvar pos = checkPos(board);\n\t\t\tvar value;\n\t\t\tif (flagMinMax == 0){\n\t\t\t\tvalue = 0;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tvalue = calculateMaxBoardValue();\n\t\t\t}\n\t\t\tcurrentValue = [pos[0],pos[1],value];\n\t\t}\n\t\telse{\n\t\t\tvar currentValue = evaluateIA2(flagMinMax,possiblePlays);\n\t\t}\n\t}\n\treturn currentValue;\n}", "function solution(A) {\r\n // write your code in JavaScript (Node.js 8.9.4)\r\n\tlet positiveMaxNums0 = [-1, -1, -1];\r\n\tlet positiveMaxNums1 = [-1, -1, -1];\r\n\tlet negativeMaxNums0 = [-1, -1, -1];\r\n\tlet negativeMaxNums1 = [-1, -1, -1];\r\n\tA.forEach((item, i) => {\r\n\t\tif (item >= 0) {\r\n\t\t\tif (positiveMaxNums0[2] === -1 || A[positiveMaxNums0[2]] < item) {\r\n\t\t\t\tpositiveMaxNums0[0] = positiveMaxNums0[1];\r\n\t\t\t\tpositiveMaxNums0[1] = positiveMaxNums0[2];\t\t\t\r\n\t\t\t\tpositiveMaxNums0[2] = i;\r\n\t\t\t} else if (positiveMaxNums0[1] === -1 || A[positiveMaxNums0[1]] < item){\r\n\t\t\t\tpositiveMaxNums0[0] = positiveMaxNums0[1];\r\n\t\t\t\tpositiveMaxNums0[1] = i;\r\n\t\t\t} else if (positiveMaxNums0[0] === -1 || A[positiveMaxNums0[0]] < item) {\r\n\t\t\t\tpositiveMaxNums0[0] = i;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (positiveMaxNums1[0] === -1 || A[positiveMaxNums1[0]] > item) {\r\n\t\t\t\tpositiveMaxNums1[0] = i;\r\n\t\t\t} else if (positiveMaxNums1[1] === -1 || A[positiveMaxNums1[1]] > item){\r\n\t\t\t\tpositiveMaxNums1[1] = i;\r\n\t\t\t} else if (positiveMaxNums1[2] === -1 || A[positiveMaxNums1[2]] > item) {\r\n\t\t\t\tpositiveMaxNums1[2] = i;\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (negativeMaxNums0[2] === -1 || A[negativeMaxNums0[2]] > item) {\r\n\t\t\t\tnegativeMaxNums0[0] = negativeMaxNums0[1];\r\n\t\t\t\tnegativeMaxNums0[1] = negativeMaxNums0[2];\r\n\t\t\t\tnegativeMaxNums0[2] = i;\r\n\t\t\t} else if (negativeMaxNums0[1] === -1 || A[negativeMaxNums0[1]] > item) {\r\n\t\t\t\tnegativeMaxNums0[0] = negativeMaxNums0[1];\r\n\t\t\t\tnegativeMaxNums0[1] = i;\r\n\t\t\t} else if (negativeMaxNums0[0] === -1 || A[negativeMaxNums0[0]] > item) {\r\n\t\t\t\tnegativeMaxNums0[0] = i;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (negativeMaxNums1[2] === -1 || A[negativeMaxNums1[2]] < item) {\r\n\t\t\t\tnegativeMaxNums1[0] = negativeMaxNums1[1];\r\n\t\t\t\tnegativeMaxNums1[1] = negativeMaxNums1[2];\t\r\n\t\t\t\tnegativeMaxNums1[2] = i;\r\n\t\t\t} else if (negativeMaxNums1[1] === -1 || A[negativeMaxNums1[1]] < item) {\r\n\t\t\t\tnegativeMaxNums1[0] = negativeMaxNums1[1];\r\n\t\t\t\tnegativeMaxNums1[1] = i;\r\n\t\t\t} else if (negativeMaxNums1[0] === -1 || A[negativeMaxNums1[0]] < item) {\r\n\t\t\t\tnegativeMaxNums1[0] = i;\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\t\r\n\tconst num1 = positiveMaxNums0.filter((item) => item !== -1).length;\r\n\tconst num2 = negativeMaxNums0.filter((item) => item !== -1).length;\r\n\t\r\n\tif (num1 === 0) {\r\n\t\treturn A[negativeMaxNums1[0]] * A[negativeMaxNums1[1]] * A[negativeMaxNums1[2]];\r\n\t} else if (num2 === 0) {\r\n\t\treturn A[positiveMaxNums0[0]] * A[positiveMaxNums0[1]] * A[positiveMaxNums0[2]];\r\n\t} else if (num1 === 1) {\r\n\t\treturn A[positiveMaxNums0[2]] * A[negativeMaxNums0[2]] * A[negativeMaxNums0[1]];\r\n\t} else if (num1 === 2) {\r\n\t\tif (num2 === 1) {\r\n\t\t\treturn A[negativeMaxNums1[2]] * A[positiveMaxNums1[0]] * A[positiveMaxNums1[1]];\r\n\t\t} else {\r\n\t\t\treturn A[positiveMaxNums0[2]] * A[negativeMaxNums0[1]] * A[negativeMaxNums0[2]];\r\n\t\t}\t\t\r\n\t} else if (num1 === 3) {\r\n\t\tconst multiple1 = A[positiveMaxNums0[0]] * A[positiveMaxNums0[1]] * A[positiveMaxNums0[2]];\r\n\t\tif (num2 === 1) {\r\n\t\t\treturn multiple1;\r\n\t\t} else {\r\n\t\t\tconst multiple2 = A[positiveMaxNums0[2]] * A[negativeMaxNums0[1]] * A[negativeMaxNums0[2]];\r\n\t\t\treturn multiple1 > multiple2 ? multiple1 : multiple2;\r\n\t\t}\r\n\t}\r\n}", "function min(array) {\n //Write your code here\n}", "function minimax(board, depth, isMax) { // isMax is true when player goes second; false when player goes first\n var score = evaluate();\n var best = 0;\n console.log('score: ' + score);\n //If maximizer has won the game return their evaluated score\n if (score == 10) {\n return score;\n }\n // If minimizer has won the game return their evaluated score\n if (score == -10) {\n return score;\n } \n // If there are no moves left and no winner; tie\n if (!isMovesLeft()) {\n return 0;\n }\n // Execute if this is maximizer's move\n if (isMax) {\n best = -1000; \n board.forEach(function(i, row) {\n i.forEach(function(j, col) {\n if (board[row][col] == '_') {\n // Make the move\n board[row][col] = player;\n // Call minimax recursively and choose the max value\n best = Math.max(best, minimax(board, depth+1, !isMax));\n \n // Undo move\n board[row][col] = '_';\n }\n })\n })\n return best;\n }\n // Execute if minimizer's move\n // AI will always be minimizer because player will always go first\n else if (!isMax) {\n best = 1000;\n board.forEach(function(i, row) {\n i.forEach(function(j, col) {\n if (board[row][col] == '_') {\n // Make the move\n board[row][col] = opponent;\n // Call minimax recursively and choose the max value\n best = Math.min(best, minimax(board, depth+1, !isMax));\n // Undo move\n board[row][col] = '_';\n }\n })\n })\n return best;\n }\n}", "minimo(arr = []) {\r\n Array.prototype.min = function () {\r\n return Math.min.apply(null, this);\r\n };\r\n return arr.min();\r\n }", "function computeScore(userchoices){\n minIndex = 0; //reset value of minIndex each time function is called.\n var mathArray = []; //create array of absolute value \"scores\"\n var comparisonArray = []; // create array for individual array score calculation\n for (var x = 0; x < tableArray.length; x++) {\n for (var o = 0; o < 9; o++) {\n var score = Math.abs(userchoices[o] - tableArray[x].answers[o]);\n comparisonArray[o] = score; \n }\n (function myFunction() {//calculates score of individual array\n mathArray[x] = comparisonArray.reduce(getSum);\n })();\n }\n indexOfMin(mathArray);\n winner = tableArray[minIndex];\n console.log(winner);\n return winner;\n }", "function maxMin(n) {\n //-------------MAXIE-------------------\n let arr = [];\n let split = n\n .toString()\n .split(\"\")\n .map((string) => Number(string));\n let i = 0;\n let j = i + 1;\n let index = 0;\n while (i < split.length) {\n j = i + 1;\n let max = 0;\n while (j <= split.length) {\n if (split[j] > max) {\n max = split[j];\n index = j;\n }\n j++;\n }\n //console.log(split[i], max);\n if (split[i] < max) {\n let temp = split[i];\n split[i] = split[index];\n split[index] = temp;\n arr.push(Number(split.join(\"\")));\n break;\n }\n i++;\n }\n if (arr.length === 0) arr.push(Number(split.join(\"\")));\n //------------MINNIE-----------------------------\n split = n\n .toString()\n .split(\"\")\n .map((string) => Number(string));\n i = 0;\n j = i + 1;\n index = 0;\n while (i < split.length) {\n j = i + 1;\n let min = Infinity;\n while (j <= split.length) {\n if (split[j] < min) {\n min = split[j];\n index = j;\n }\n j++;\n }\n //console.log(split[i], max);\n if (split[i] > min) {\n if (i === 0 && min === 0) {\n i++;\n } else {\n let temp = split[i];\n split[i] = split[index];\n split[index] = temp;\n console.log(split);\n arr.push(Number(split.join(\"\")));\n break;\n }\n }\n }\n if (arr.length === 0) arr.push(Number(split.join(\"\")));\n return arr;\n}", "function minValue(testBoard, minPlayer, maxPlayer) {\n if (testWinner(testBoard, maxPlayer)) {\n return 1;\n } else if (testWinner(testBoard, minPlayer)) {\n return -1;\n } else if (testWinner(testBoard, 0)) { // check for a tie\n return 0;\n } else {\n let bestMove = 10;\n for (let i = 0; i < testBoard.length; i++) {\n const newBoard = testMove(testBoard, i, minPlayer);\n if (newBoard) {\n const predictedMove = maxValue(newBoard, minPlayer, maxPlayer);\n if (predictedMove < bestMove) {\n bestMove = predictedMove;\n }\n }\n }\n return bestMove;\n }\n}", "function thinkInSolutions(){\r\n let targetElement = document.getElementById(\"max\");\r\n \r\n if (targetElement && targetElement.value) {\r\n let population = new Population(collection.length, collection.length * 4);\r\n population.calcFitness(collection);\r\n population.evaluate(parseInt(targetElement.value, 10));\r\n\r\n\r\n for (let i = 0; i < collection.length * 4; i++) { \r\n population.createNextGeneration(20, collection);\r\n population.calcFitness(collection);\r\n population.evaluate(parseInt(targetElement.value, 10));\r\n }\r\n\r\n let bestOnes = population.getBestSolutions();\r\n\r\n \r\n // A moment for verfication. To see all solutions generated.\r\n // This moment only one solution is shown visible (by the yellow color).\r\n // Logs all found solutions in console. \r\n bestOnes.forEach(lid => {\r\n let collectedItems = [];\r\n for (let i = 0; i < lid.length; i++) {\r\n if (lid[i] == \"1\") {\r\n collectedItems.push(collection[i]);\r\n }\r\n }\r\n console.log(collectedItems);\r\n });\r\n console.log(\"-----\");\r\n\r\n let blocks = document.getElementsByClassName(\"block\");\r\n\r\n // Clear the yellow ones.\r\n for (let i = 0; i < blocks.length; i++) {\r\n blocks[i].style.backgroundColor = \"white\";;\r\n }\r\n\r\n // Paint the blocks containing a part of the solutions yellow.\r\n if (bestOnes.length > 0) {\r\n for (let i = 0; i < bestOnes[0].length; i++) {\r\n if (bestOnes[0][i] == \"1\") {\r\n blocks[i].style.backgroundColor = \"yellow\";\r\n }\r\n }\r\n } else {\r\n console.log(\"No solutions available!\");\r\n }\r\n } else {\r\n alert(\"Please, insert a max value! (Yes, it is necessary).\");\r\n }\r\n }", "function maxAndMinNumberFromArray(arr) {\n /* >>>>>>>>>>>>>> It only Covers the First Part <<<<<<<<<<<<<<< */\n // find max\n// let max = arr[0];\n// for (let i = 1; i < arr.length; i++) {\n// if (max < arr[i]) {\n// // means next element is max not current so replace it\n// max = arr[i];\n// }\n// }\n// // find min\n// let min = arr[0];\n// for (let i = 1; i < arr.length; i++) {\n// if (min > arr[i]) {\n// // means next element is minimun, not current so replace it\n// min = arr[i];\n// }\n// }\n\n /* >>>>>>>>>>>>>> This Solution Covers the both part <<<<<<<<<<<<<<< */\n\n /* suppose first two elements of array is min and max \n then we can start from 2nd index of array to compare\n */\n\n let min, max;\n if (arr[0] < arr[1]) {\n min = arr[0];\n max = arr[1];\n } else {\n min = arr[1];\n max = arr[0];\n }\n\n for (let i = 2; i < arr.length; i++) {\n if (min > arr[i]) {\n /* means next element is minimun, not current so replace it */\n min = arr[i];\n } else if (max < arr[i]) {\n /* means next element is max not current so replace it */\n max = arr[i];\n }\n }\n\n return `max is : ${max} & min is : ${min}`;\n}", "minimax(newBoard, player) {\n\n if ((newBoard.length) == 9) {\n var move = {};\n var availSpots = game.emptyIndexies(newBoard);\n move.index = availSpots[Math.floor(Math.random()*availSpots.length)]\n move.score = 0;\n return move\n }\n\n var availSpots = game.emptyIndexies(newBoard);\n\n if (game.gameIsWon(newBoard, human)) {\n return {score: -10};\n }\n else if (game.gameIsWon(newBoard, ai)) {\n return {score: 10};\n }\n else if (availSpots.length == 0) {\n return {score: 0};\n }\n\n var moves = []; //Collects all the objects\n\n for (var i=0; i<availSpots.length; i++) {\n\n //Create an object for each and store the index of that spot\n var move = {};\n move.index = newBoard[availSpots[i]];\n\n newBoard[availSpots[i]] = player; //Set the empty spot to the current player\n\n if (player == ai) {\n var result = game.minimax(newBoard, human);\n move.score = result.score;\n }\n else {\n var result = game.minimax(newBoard, ai);\n move.score = result.score;\n }\n\n newBoard[availSpots[i]] = move.index; //Reset the spot to empty\n\n moves.push(move); //Push the spot to empty\n }\n\n\n //If it's the ai's turn, loop over the moves and choose the one with the highest score\n var bestMove;\n\n if (player == ai) {\n var bestScore = -10000;\n\n for (var i=0; i<moves.length; i++) {\n if (moves[i].score > bestScore) {\n bestScore = moves[i].score;\n bestMove = i;\n }\n }\n }\n //Else it's the player's turn, so we loop over the moves and chosoe the one with the lowest score\n else {\n var bestScore = 10000;\n\n for (var i=0; i<moves.length; i++) {\n if (moves[i].score < bestScore) {\n bestScore = moves[i].score;\n bestMove = i;\n }\n }\n }\n\n //Return the chosen move(object) from the moves array\n return moves[bestMove];\n }", "min(evals) {\n let min = Infinity;\n let move = null;\n for (let i = 0; i < evals.length; i++) {\n if (evals[i].eval < min) {\n min = evals[i].eval;\n move = evals[i];\n } // Añadir cambio de movimiento por uno equivalente\n }\n return move;\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 }", "peekMax() {\n\n }", "function increaseMinMax() {\n min -= 10;\n max += 10;\n }", "function maxValue(testBoard, minPlayer, maxPlayer) {\n if (testWinner(testBoard, maxPlayer)) {\n return 1;\n } else if(testWinner(testBoard, minPlayer)) {\n return -1;\n } else if (testWinner(testBoard, 0)) { // check for a tie\n return 0;\n } else {\n let bestMove = -10;\n for(let i = 0; i < testBoard.length; i++) {\n const newBoard = testMove(testBoard, i, maxPlayer);\n if (newBoard) {\n const predictedMove = minValue(newBoard, minPlayer, maxPlayer);\n if (predictedMove > bestMove) {\n bestMove = predictedMove;\n }\n }\n }\n return bestMove;\n }\n}", "function minMaxProblem() {\n var sums = [];\n for (var i = 0; i < ar.length; i++) {\n var exc = i;\n var sum = 0;\n for (var j = 0; j < ar.length; j++) {\n if (j !== exc) {\n sum += ar[j];\n }\n }\n sums.push(sum);\n }\n console.log(sums);\n var max = sums[0];\n var min = sums[0];\n for (var i = 0; i < sums.length; i++) {\n max = Math.max(sums[i], max);\n min = Math.min(sums[i], min);\n }\n console.log(max);\n console.log(min);\n}", "function scoreSolution(solution) {\n\n}", "function minimax(board = [], maximizingPlayer){\n\tlet openSpots = board.filter(s => s!=\"o\" && s !=\"x\");\n\n\t//array to hold different move posibilitys\n\tlet moves = [];\n\n\t//check if game is over\n\tif(winCondition(board, player1)){\n\t\treturn {score: 10};\n\t} else if(winCondition(board, player2)){\n\t\treturn {score: -10};\n\t}else if (openSpots.length === 0){\n\t\treturn {score: 0};\n\t} \n\t\n\t//create copy of board and add move to index, then call minimax again\n\tfor (let i = 0; i < openSpots.length; i++){\n\t\t//object of move to hold score and index for move\n\t\tlet move = {};\n\t\n\t\tmove.index = board[openSpots[i]];\n\t\tboard[openSpots[i]] = maximizingPlayer.icon;\n\t\n\t\tif(maximizingPlayer == player1){\n\t\t\tmove.score = minimax(board, player2).score;\n\t\t} else {\n\t\t\tmove.score = minimax(board, player1).score;\n\t\t}\n\n\t\tboard[openSpots[i]] = move.index;\n\n\t\t//add the move to moves\n\t\tmoves.push(move);\n\n\t}\n\t\n\t//loop through every move, store the optimal score into bestMove, return beast move\n\tlet best = -100;\n\tlet bestMove;\n\n\tif(maximizingPlayer == player1){\n\t\t//if we are looking for best play for player one, take biggest score, otyherwise smallest\n\t\tfor(let i = 0; i< moves.length; i++){\n\t\t\tif(moves[i].score > best){\n\t\t\t\tbest = moves[i].score;\n\t\t\t\tbestMove = i;\n\t\t\t}\n\t\t} \n\t\n\t} else {\n\t\tbest = 100\n\t\t\tfor(let i = 0; i< moves.length; i++){\n\t\t\t\tif(moves[i].score < best){\n\t\t\t\t\tbest = moves[i].score;\n\t\t\t\t\tbestMove = i;\n\t\t\t\t}\n\t\t\t}\n\n\t}\n\t\n\treturn moves[bestMove];\n}", "function mathOperations(arr){\n let max = arr[0],min=arr[0]\n\n for(let i = 0;i<arr.length;i++){\n if(arr[i]>max){\n max = arr[i]\n }\n if(arr[i]<min){\n min = arr[i]\n }\n }\n\n console.log(\"MAX = \" + max)\n\n console.log(\"Min = \" + min)\n\n console.log(\"Range = \" + (max-min))\n}", "function miniMaxWithABPruning(depth, board, isMaximizingPlayer, alfa, beta)\n {\n runCountAB++; //increment the variable\n\n let k=0;// k is the number of empty cells of the board\n for (let i = 0; i < board.length; i++)\n {\n if (board[i] === '')\n k++; // counts number of empty cells of the board\n }\n if(k==board.length) //if no of empty cells of board is equal to the board length\n {\n var center_and_corners = [0, 2, 4, 6, 8]; //center and corner of board stored\n var first_choice = center_and_corners[Math.floor(Math.random() * center_and_corners.length)];// choose the first choice randomly\n return first_choice; //return the first choice of cell\n }\n\n //Checking base conditions\n if (checkForWinner(opponentMark, board, true)||depth==max_depth)\n {\n return 10 - depth;//heuristic value of node\n }\n else if (checkForWinner(playerMark, board, true)||depth==max_depth)\n {\n return -10 + depth;//heurisitc value of node\n }\n\n let bestValue, bestMove, player;\n if (isMaximizingPlayer)\n {\n bestValue = Number.NEGATIVE_INFINITY;//set best value to negative infinity\n // Opponent only uses this algorithm, so the maximizing player is opponent mark.\n player = opponentMark;\n }\n else\n {\n bestValue = Number.POSITIVE_INFINITY;//set best value to positive infinity\n player = playerMark;\n }\n for (let i = 0; i < board.length; i++)\n {\n if (board[i] === '')\n {\n board[i] = player; //whoevers turn it is.\n\n if (isMaximizingPlayer)\n {\n alfa = miniMaxWithABPruning(depth+1, board, !isMaximizingPlayer, alfa, beta);//call the function for next depth and next player\n board[i] = ''; // remove test move from actual board.\n\n if (bestValue < alfa)\n {\n bestValue = alfa;//update best value\n bestMove = i;//update best move\n }\n\n //This condition ignores subtrees which don't need to be explored\n if (alfa >= beta)\n {\n break; // Prune condition\n }\n\n }\n else\n {\n beta = miniMaxWithABPruning(depth+1, board, !isMaximizingPlayer, alfa, beta);//calls the function for next depth and next player\n board[i] = ''; // remove test move from actual board.\n if (bestValue > beta)\n {\n bestValue = beta;//update best value\n bestMove = i;//update best move\n }\n\n //This condition ignores subtrees which dont need to be explored\n if (alfa >= beta)\n {\n break; // Prune condition\n }\n }\n }\n }\n\n if (depth === 0)\n {\n if (isMaximizingPlayer && bestValue === Number.NEGATIVE_INFINITY || !isMaximizingPlayer && bestValue === Number.POSITIVE_INFINITY)\n {\n return board.indexOf('');\n // no good or bad moves, just choose first blank spot available.\n }\n return bestMove;\n }\n\n if (isMaximizingPlayer && bestValue === Number.NEGATIVE_INFINITY || !isMaximizingPlayer && bestValue === Number.POSITIVE_INFINITY)\n { //but not depth === 0\n return 0;\n }\n\n\n return bestValue;\n }", "function updateMinMax() {\n min = parseInt(minValueField.value);\n max = parseInt(maxValueField.value);\n}", "function calculateTagsParams(tags) {\n const params = {\n max: 0,\n min: 999999\n }\n // [VERY NEW] START LOOP for every tags\n for (let tag in tags) {\n\n //console.log(tag + ' is used ' + tags[tag] + ' times ');\n /* first option - standard if*/\n // [VERY NEW] set value for params.max as tags[tag] only if the value is higher than current\n if (tags[tag] > params.max) {\n params.max = tags[tag];\n //console.log('params.max:', params.max);\n }\n if (tags[tag] < params.min) {\n params.min = tags[tag];\n //console.log('params.min:', params.min);\n }\n //params.max = tags[tag];\n /* second option - short if */\n //params.max = tags[tag] > params.max ? tags[tag] : params.max;\n /* third option - math.max */\n //params.max = Math.max(tags[tag], params.max);\n }\n return params;\n }", "moveMrX_Easy(positions, turn) {\n // this is the second shot at improving the AI\n\n // generate the players' heat maps\n const heatMaps = []; // null for index 0\n for (let i = 1; i <= this.CONSTS.MAX_PLAYERS; i++) {\n heatMaps.push(this._generateDistanceArray(positions[i]));\n }\n\n // now compare the heatmaps and combine into one map by taking the lowest value for each\n const fHeatMap = [];\n for (let i = 0; i < 200; i++) {\n let thisNumber = 999;\n // in heatMaps array player 1 is at index 0\n for (let j = 0; j < this.CONSTS.MAX_PLAYERS; j++) {\n if (heatMaps[j][i] < thisNumber) {\n thisNumber = heatMaps[j][i];\n }\n }\n fHeatMap.push(thisNumber);\n }\n\n // ok so now we get into the AI\n\n // start by creating an array of all nodes around Mr X's node with a radius\n // this array should contain the NodeLocation and its current heatmap number\n\n // first get the raw locations in a radius around Mr. X:\n const NodeLocationArrayRelativeToMrX = this._getNodeLocationArrayRelativeToMrX(positions, 2);\n\n // add the heatmap sum to the array\n const NodeLocationArrayWithHeatmapSums = this._getNodeLocationArrayWithHeatmapSums(NodeLocationArrayRelativeToMrX);\n\n // add the heatmap value to the array as the third element and make the final array in which each element is an array with three integers:\n // LOCATION, HEATMAP SUM, and HEATMAP value\n // these are the three things we need to take a stab at some non-retarded AI\n const DataArray = [];\n\n for (let i = 0; i < NodeLocationArrayWithHeatmapSums.length; i++) {\n const thisArray = [];\n thisArray.push (NodeLocationArrayWithHeatmapSums[i][0]);\n thisArray.push (NodeLocationArrayWithHeatmapSums[i][1]);\n thisArray.push (fHeatMap[NodeLocationArrayWithHeatmapSums[i][0]]);\n DataArray.push(thisArray);\n }\n\n DataArray.sort(this._compareHeatmapSums);\n // DataArray now is complete for a 'radius' number of hops with ratings for heatmap and heatmapSum\n\n // AI decisions start now\n\n // SAFE AI:\n // Mr. X should first look for the location with the highest heatmapSum with a heatmap of 2 or greater (not potentially being insta-killed)\n // After that he should look for the location with the highest heatmapSum with a heatmap of 1\n // Then find the best path to that location (it may not be adjacent to Mr. X)\n\n // *** BUT THE DATAARRAY NEEDS A PASS ON IT FIRST:\n // If MrX wants to go 2 or 3 spaces away to a spot, he needs to make sure first that his NEXT MOVE isn't on a heatmap of 1 or less...\n // ...so do another pass on the DataArray and update the heatmap on any entry that isn't next to Mr. X\n\n for (let i = 0; i < DataArray.length; i++) {\n // look at each item and replace it's heatmap, which = DataArray[i][2]\n // remember that each element in DataArray has LOCATION, HEATMAP SUM, and HEATMAP value\n const firstLocationAndTransport = this._findStartingPointOnPathAndTransportation(positions[0],DataArray[i][0]);\n DataArray[i][2] = fHeatMap[firstLocationAndTransport[0]];\n }\n\n // OK, now search through the entries!\n let destinationLocation = this._findBestDestination(DataArray, 2);\n let boolDead = false;\n if (destinationLocation < 1) {\n destinationLocation = this._findBestDestination(DataArray, 1);\n if (destinationLocation < 1) {\n // MRX HAS NO MOVEZZZZZZZ IF THIS GETS HIT\n boolDead = true;\n }\n }\n\n // now you have the starting point, positions[0], and the destination, destinationLocation...\n // ...figure out where Mr X should move next!\n // loop through the heatmap for the Mr. X location and look at all the spots connected to it (heatmap value of 1)...\n // ...these are the only places he can move this turn!\n\n let firstLocationAndTransport = this._findStartingPointOnPathAndTransportation(positions[0],destinationLocation);\n // firstLocationAndTransport[0] = the location that Mr X should move to next!\n // firstLocationAndTransport[1] = the transportation that Mr X will use to get to that spot (0:taxi, 1: bus, etc.)\n\n\n return {\n position: firstLocationAndTransport[0],\n transportation: firstLocationAndTransport[1], /// ???\n isVisible: this.CONSTS.MRX_VISIBLE_TURNS.indexOf(turn) >= 0,\n dead: boolDead // nowhere to move\n };\n }", "function getYMax(values, ucl, goal) {\n \t \t\n \tvar i, value, max = ucl;\n \t\n \tif (goal !== undefined && goal > max) {\n \t\tmax = goal;\n \t}\n \t\n \tfor(i = 0; i < values.length; i++) {\n \t\tvalue = values[i];\n \t\tif (value > max) {\n \t\t\tmax = value;\n \t\t}\n \t}\n \t\n \treturn max;\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}", "c4minimax(board, stack, depth, max, lx, ly) {\n if (this.check(lx, ly, board) === 2 || depth === 0) {\n let temp1 = this.Board_Evaluation(board, \"🟡\");\n let temp1score =\n temp1.two + (temp1.three * 5) / 3 + temp1.four * 15;\n let temp2 = this.Board_Evaluation(board, \"🔴\");\n let temp2score =\n temp2.two + (temp2.three * 5) / 3 + temp2.four * 20;\n if (temp1.four > 0 || temp2.four > 0)\n console.log(temp1score - temp2score);\n\n return { score: temp1score - temp2score, move: 0 };\n }\n\n if (max) {\n let Best_Score = -Infinity;\n let Best_Move = 0;\n\n stack.forEach((col) => {\n if (stack[col] > -1) {\n board[stack[col]][col] = \"🟡\";\n stack[col] -= 1;\n let { score, move } = this.c4minimax(\n board,\n stack,\n depth - 1,\n false,\n col,\n stack[col] + 1\n );\n if (score > Best_Score) {\n Best_Score = score;\n Best_Move = col;\n }\n stack[col] += 1;\n board[stack[col]][col] = \"⚪\";\n }\n });\n\n return { score: Best_Score, move: Best_Move };\n } else {\n let Cbest_Score = Infinity;\n let Cbest_Move = 0;\n\n stack.forEach((col) => {\n if (stack[col] > -1) {\n board[stack[col]][col] = \"🔴\";\n stack[col] -= 1;\n let { score, move } = this.c4minimax(\n board,\n stack,\n depth - 1,\n true,\n col,\n stack[col] + 1\n );\n if (score < Cbest_Score) {\n Cbest_Score = score;\n Cbest_Move = col;\n }\n stack[col] += 1;\n board[stack[col]][col] = \"⚪\";\n }\n });\n\n return { score: Cbest_Score, move: Cbest_Move };\n }\n }", "maximize(legend_id) { return this.$sciris.maximize(this, legend_id) }", "getMax() {\n \n }", "function minMax(arr){\n const stack = new MinMaxStack()\n let command, int\n for(let i = 0, len = arr.length; i < len; i++){\n [command, int] = arr[i]\n switch(command){\n case '1':\n console.log('adding ', int)\n stack.push(int)\n break;\n case '2':\n console.log('removing ', stack.peak())\n stack.pull()\n break;\n case '3':\n console.log('max is: ', stack.currentMax())\n console.log('min is: ', stack.currentMin())\n break;\n default: \n console.log('Wrong command')\n }\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 motifSearch_MaxMin(\n threshold,\n collapsed_reaction_dict,\n expression_dict,\n stats_dict,\n stat_type,\n stat_value,\n inferred_dict,\n link_neighbors,\n path_mapper,\n degree_dict,\n blocklist,\n sample_indices) {\n let discovered_motifs = [];\n\n for (_idx in sample_indices) {\n let sample_motifs = new Set();\n\n for (let rxn in collapsed_reaction_dict) {\n let reaction = collapsed_reaction_dict[rxn];\n let comps = parseComponents(\n reaction,\n expression_dict,\n stats_dict,\n stat_type,\n stat_value,\n inferred_dict,\n link_neighbors,\n degree_dict,\n blocklist,\n _idx)\n let updated_source = comps[0];\n let updated_target = comps[1];\n let source_values = updated_source.map((i) => i[0]);\n let target_values = updated_target.map((i) => i[0]);\n let source_stats = updated_source.map((i) => i[1]);\n let target_stats = updated_target.map((i) => i[1]);\n \n if (updated_source.length > 0 && updated_target.length > 0) {\n let source_max = Math.max(...source_values);\n let target_min = Math.min(...target_values);\n if (Math.abs(source_max - target_min) >= threshold) {\n let source_index = source_values.indexOf(source_max);\n let target_index = target_values.indexOf(target_min);\n let p_source = source_stats[source_index];\n let p_target = target_stats[target_index];\n let reaction_copy = $.extend(true, {}, reaction);\n reaction_copy.p_values = {\n \"source\": p_source,\n \"target\": p_target,\n 'agg': aggregate_p_values([p_source, p_target])\n };\n reaction_copy.magnitude_change = Math.abs(source_max - target_min);\n sample_motifs.add(reaction_copy);\n }\n }\n }\n sample_motifs = [...sample_motifs];\n for (let m in sample_motifs) {\n sample_motifs[m]['pathways'] = path_mapper[sample_motifs[m]['id']]\n }\n discovered_motifs.push(sample_motifs);\n }\n return discovered_motifs;\n}", "function minAndMax(arr) {\n//declare max, min variables\n\tlet min = arr[0];\n let max = arr[0];\n let result = [1,2];\n let newArr = [];\n \n//for loop to iterate through given array\n for (let i = 0; i < arr.length; i++) {\n console.log(arr[i]);\n if (arr[i] < min) {\n min = arr[i];\n } else if (arr[i] > max) {\n max = arr[i];\n }\n \n } // end for loop\n result[0] = min;\n result[1] = max;\n return console.log(result);\n \n \n /*\n newArr.push(arr[i]);\n // console.log(newArr);\n if (arr[i] < arr[i + 1]) {\n min = arr[i];\n } else {\n \tmax = arr[i];\n }\n console.log(min);\n\t\t*/\n\n \n}", "function minimax(newBoard, player) {\n\n // List of available spots\n\tvar availSpots = emptySquares(newBoard);\n\n\tif (checkWin(newBoard, huPlayer)) {\n\t\treturn {score: -10};\n\t} else if (checkWin(newBoard, aiPlayer)) {\n\t\treturn {score: 10};\n\t} else if (availSpots.length === 0) {\n\t\treturn {score: 0};\n\t}\n\tvar moves = [];\n\n // For each available spot call minmax recursively to get the best possible score\n for (var i = 0; i < availSpots.length; i++) {\n\t\tvar move = {};\n\t\tmove.index = newBoard[availSpots[i]];\n\t\tnewBoard[availSpots[i]] = player;\n\n\t\tif (player == aiPlayer) {\n\t\t\tvar result = minimax(newBoard, huPlayer);\n\t\t\tmove.score = result.score;\n\t\t} else {\n\t\t\tvar result = minimax(newBoard, aiPlayer);\n\t\t\tmove.score = result.score;\n\t\t}\n\n\t\tnewBoard[availSpots[i]] = move.index;\n\n\t\tmoves.push(move);\n\t}\n\n\tvar bestMove;\n\tif(player === aiPlayer) {\n\t\tvar bestScore = -10000;\n\t\tfor(var i = 0; i < moves.length; i++) {\n\t\t\tif (moves[i].score > bestScore) {\n\t\t\t\tbestScore = moves[i].score;\n\t\t\t\tbestMove = i;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tvar bestScore = 10000;\n\t\tfor(var i = 0; i < moves.length; i++) {\n\t\t\tif (moves[i].score < bestScore) {\n\t\t\t\tbestScore = moves[i].score;\n\t\t\t\tbestMove = i;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn moves[bestMove];\n}", "function miniMaxSum(arr) {\n // Complete this function\n var min = arr.indexOf(Math.min(...arr));\n var max = arr.indexOf(Math.max(...arr));\n var small = 0;\n var big = 0;\n for(var i = 0; i < arr.length; i++){\n if (i !== max){\n small = small + arr[i]\n }\n if (i !== min){\n big = big + arr[i]\n }\n }\n console.log(small + ' ' + big)\n}", "function minimax(newBoard, player) {\n var availSpots = emptySquares();\n//if 0 takes a spot return is -10, X is 10, if no places left 0\n if (checkWin(newBoard, huPlayer)) {\n return {score: -10};\n } else if (checkWin(newBoard, aiPlayer)){\n return {score: 10};\n } else if (availSpots.length === 0){\n return {score: 0};\n }\n //this collects the score from the checkwin and resets the \"number of the square to a letter\"\n //this loops through all empty spots and collects each move and score.\n var moves = [];\n for (var i = 0; i < availSpots.length; i++) {\n var move = {};\n move.index = newBoard[availSpots[i]];\n newBoard[availSpots[i]] = player;\n//reset as to who is playing...ai or human and what is the score \"-10, 10 or 0\" meaning who played, what happened and does the board need resting?\n if (player == aiPlayer) {\n var result = minimax(newBoard, huPlayer);\n move.score = result.score;\n } \n else {\n var result = minimax(newBoard, aiPlayer);\n move.score = result.score;\n }\n\n newBoard[availSpots[i]] = move.index;\n\n moves.push(move);\n }\n//this helps the AI choose the best move or hightest score via its loop aray\n//also if there is move that is equal in score it only stores/scores the first move.\n var bestMove;\n if(player === aiPlayer) {\n var bestScore = -10000;\n for(var i = 0; i < moves.length; i++){\n if (moves[i].score > bestScore) {\n bestScore = moves[i].score;\n bestMove = i;\n }\n }\n } \n //enter the human playing and the AI reviewing the human players moves\n else {\n var bestScore = 10000;\n for(var i = 0; i < moves.length; i++){\n if (moves[i].score < bestScore) {\n bestScore = moves[i].score;\n bestMove = i;\n }\n } \n }\n\n return moves[bestMove];\n}", "evaluate(i, n, min, max) {\n var points = [];\n var binomial = this.binomial(n, i);\n\n for (var t = min; t <= max; t += 0.02) {\n var y = binomial * Math.pow(t, i) * Math.pow(1 - t, n - i);\n var point = new THREE.Vector3(t * 100, 0, -y * 100);\n points.push(point.add(this[s_origin]));\n }\n return points;\n }", "function negamax (player, opp, turn, alpha, beta, depth) { \t\t\t\t\n\t\tvar oppTurn = +(!turn);\t\t\n\t\t\t\t\t\t\n\t\t//Anchor\n\t\tif (depth >= MAX_DEPTH) { //Max depth - Score\n\t\t\t//There shouldn't be any terminal nodes, (since they'd be found in the expansion)\t\t\t\t\t\t\t\t\t\n\t\t\t//return BB_heuristicScoreSide(player, turn) - BB_heuristicScoreSide(opp, oppTurn);\t\t\t\t\t\t\n\t\t\treturn BB_heuristicScoreSide(player, turn);\t\t\t\t\t\t\n\t\t}\n\t\t\n\t\t//TODO: sort moves for greater glory?\n\t\t\n\t\t//EXPANSION\n\t\tbestMoveAtDepth[depth] = INVALID;\t\t\n\t\t\n\t\t//Loop through player kids\n\t\tvar playerKids = BB_getMoveBoards(player, opp, turn);\n\t\tvar allDests = playerKids[0];\n\t\tfor (var k = 1; k < playerKids.length; k+=2) { \n\t\t\tvar kid = playerKids[k];\n\t\t\tvar destPos = playerKids[k+1];\n\t\t\t\n\t\t\t//Win\n\t\t\tif (BB_isWin(kid, turn, destPos)) {\n\t\t\t\tbestMoveAtDepth[depth] = kid;\n\t\t\t\tbestScoreAtDepth[depth] = INFINITY;\n\t\t\t\treturn INFINITY;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\n\t\t//Loop through opponent kids - See if we need to block a win\n\t\tvar needToBlock = [0];\n\t\tvar oppKids = BB_getMoveBoards(opp, player, oppTurn);\t\t\t\n\t\tfor (var k = 1; k < oppKids.length; k+=2) { \n\t\t\tvar kid = oppKids[k];\n\t\t\tvar destPos = oppKids[k+1];\n\t\t\t\n\t\t\t//Opponent Win\n\t\t\tif (BB_isWin(kid, oppTurn, destPos)) {\n\t\t\t\t//See if we can block it\t\t\t\t\n\t\t\t\tif (allDests & kid) { \n\t\t\t\t\t//We can block it - but there might be multiple ways to block\n\t\t\t\t\tvar pinsInRange = (player & AVAIL_MOVES[destPos]);\n\t\t\t\t\twhile (pinsInRange) { //Bitscan loop\n\t\t\t\t\t\tvar minBit = pinsInRange & -pinsInRange; //Isolate least significant bit\n\t\t\t\t\t\tvar src = MASK_TO_POS[minBit>>>0];\n\t\t\t\t\t\tneedToBlock.push(BB_move(player, turn, src, destPos));\n\t\t\t\t\t\tneedToBlock.push(destPos);\n\t\t\t\t\t\tpinsInRange &= pinsInRange-1;\n\t\t\t\t\t}//end bitscan loop\t\t\t\t\t\n\t\t\t\t\tbreak; //There might be other losses, (and this is actually a terminal node), but this assumes that it'll be more efficient to ignore it\n\t\t\t\t}\n\t\t\t\telse return -INFINITY; //Loss\t\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t\t//Loop through available moves again to actually expand\t\t\n\t\tvar bestScore = -INFINITY;\t\t\n\t\tif (needToBlock.length > 1) playerKids = needToBlock; //If we are forced to block, then those are the only possible moves\t\t\n\n\t\tfor (var k = 1; k < playerKids.length; k+=2) { \n\t\t\tvar kid = playerKids[k];\n\t\t\tvar destPos = playerKids[k+1];\n\t\t\tvar newBB = [0,0];\n\t\t\tnewBB[turn] = kid;\n\t\t\tnewBB[oppTurn] = opp;\n\t\t\tvar uniqueId = BB_toUniqueId(newBB, oppTurn);\n\t\t\t\n\t\t\tvar recursedScore = recursedScore = negamax(opp, kid, oppTurn, -beta, -Math.max(alpha, bestScore), depth+1);\t\t\t\t\t\t\n\t\t\t\n\t\t\tvar currentScore = -recursedScore;\n\n\t\t\tif (currentScore > bestScore) { //Eeny, meeny, miny, moe...\n\t\t\t\tbestScore = currentScore;\n\t\t\t\tbestMoveAtDepth[depth] = kid;\t\n\t\t\t\tbestScoreAtDepth[depth] = currentScore;\t\t\t\t\n\t\t\t\tif (bestScore >= beta) return bestScore;//AB cut-off\n\t\t\t}\t\t\t\n\t\t\t\n\t\t}\t\t\n\t\t\n\t\treturn bestScore;\n\t}", "function findMinMax(...nums){//merge the element of the incoming list, we call is REST operator\r\n let curMax = nums[0];\r\n let curMin = nums[0];\r\n for(const num of nums){\r\n if (num > curMax){\r\n curMax = num;\r\n }\r\n if(num < curMin){\r\n curMin = num;\r\n }\r\n }\r\n return [curMin, curMax];\r\n}", "function miniMax(board, player){\n\n if(checkWin(board) === 1){\n return -10;\n } else if(checkWin(board) === 2){\n return 10;\n } else if(checkWin(board) === 3){\n return 0;\n }\n\n var move = [];\n var score = [];\n\n findMoves(board).forEach(function(value){\n board[value] = (player === 'computer') ? 2 : 1;\n score.push(miniMax(board, (player === 'computer') ? 'human' : 'computer'));\n move.push(value);\n board[value] = 0;\n });\n\n if(player === 'computer'){\n computerMove = move[score.indexOf(Math.max.apply(Math, score))];\n return Math.max.apply(Math, score);\n } else {\n computerMove = move[score.indexOf(Math.min.apply(Math, score))];\n return Math.min.apply(Math, score);\n }\n}", "function minimax(newboard,player){\r\n \tvar availspots=emptysquares();\r\n \tif(checkWin(newboard,huPlayer)){\r\n \t\treturn{score:-10};\r\n \t}else if(checkWin(newboard,aiplayer)){\r\n \t\treturn {score:10};\r\n \t}else if(availspots.length === 0){\r\n \t\treturn {score:0};\r\n \t}\r\n \t\r\n \tvar moves=[];\r\n \tfor(var i=0;i<availspots.length;i++){\r\n\r\n var mov={};\r\n mov.index=newboard[availspots[i]];\r\n newboard[availspots[i]]=player;\r\n\r\n if(player==aiplayer){\r\n var result=minimax(newboard,huPlayer);\r\n mov.score=result.score;\r\n\r\n }else{\r\n var result=minimax(newboard,aiplayer);\r\n mov.score=result.score;\r\n\r\n }\r\n newboard[availspots[i]]=mov.index;\r\n moves.push(mov);\r\n\r\n\r\n \t}\r\n \tvar bestmove;\r\n \tif(player === aiplayer){\r\n \t\tvar bestscore=-10000;\r\n \t\tfor(var j=0;j<moves.length;j++){\r\n \t\t\tif(moves[j].score>bestscore){\r\n \t\t\t\tbestscore=moves[j].score;\r\n \t\t\t\tbestmove=j;\r\n\r\n \t\t\t}\r\n \t\t\t}\r\n \t\t}else{\r\n \t\t\tvar bestscore=10000;\r\n \t\t\tfor(var j=0;j<moves.length;j++){\r\n \t\t\t\tif(moves[j].score<bestscore){\r\n \t\t\t\t\tbestscore=moves[j].score;\r\n \t\t\t\t\tbestmove=j;\r\n \t\t\t\t}\r\n \t\t\t}\r\n \t\t}\r\n\r\n return moves[bestmove];\r\n\r\n \t\t}", "function minimaxVal(state) {\n if (state.isTerminal()) {\n return Game.score(state);\n } else {\n var stateScore; //this stores the minimax value we will compute\n if (state.turn === 'X') \n stateScore = -1000; //initialize to a value smaller than any possible score\n else stateScore = 1000;\n var availablePositions = state.emptyCells();\n //enumerate next available states using the info from available positions\n var availableNextStates = availablePositions.map(function(pos) {\n var action = new AIAction(pos);\n var nextState = action.applyTo(state);\n return nextState;\n });\n //calculate the minimax value for all available next states and evaluate the current state's value\n availableNextStates.forEach(function(nextState) {\n if (state.turn === 'X') {\n //X wants to maximize---> update stateScore iff nextScore is larger\n if(nextScore > stateScore) {\n stateScore = nextScore;\n }else {\n //O wants to maximize---> update stateScore iff nextScore is smaller\n if (nextScore < stateScore) {\n stateScore = nextScore;\n }\n }\n }\n }); \n //backup the minimax value\n return stateScore; \n }\n}", "function mathYo(arr) {\n var max = 0\n arr.forEach(function(nani) {\n if (max < nani) {\n max = nani;\n }\n });\n return max;\n }", "function arrMaxMin(arr) {\n\tlet min = +Infinity, max = -Infinity;\n\tlet statmin=0, statmax=0;\n\tfor(let i=0; i < arr.length; i++) {\n\t\tif(arr[i] < min) {\n\t\t\tmin = arr[i];\n\t\t\tstatmin++;\n\t\t}\n\t\tif(arr[i] > max) {\n\t\t\tmax = arr[i];\n\t\t\tstatmax++;\n\t\t}\n\t}\n\tconsole.log(max, min);\n}", "function miniMaxSum(arr) {\n let newArr = [...arr].sort()\n let sum = 0;\n for (let i = 0; i < newArr.length; i++) {\n sum += newArr[i]\n }\n let minValue = sum - newArr[newArr.length - 1]\n let maxValue = sum - newArr[0]\n console.log(minValue, maxValue)\n }", "function findMaxAndMin(array) {\n var i;\n var maxElement = 0;\n var minElement = 0;\n for (i = 0; i < array.length; i++) {\n if (array[i] > maxElement && typeof array[i] == 'number') {\n maxElement = array[i]\n }\n if (array[i] < minElement && typeof array[i] == 'number') {\n minElement = array[i]\n\n\n }\n result = [minElement, maxElement];\n\n }\n return result;\n\n}", "Asmin(){\n return 0.0018*this.b*this.h\n }", "evaluate() {\n let worldrecord = -1;\n let index = 0;\n for (let i = 0; i < this.population.length; i++) {\n if (this.population[i].fitness > worldrecord) {\n index = i;\n worldrecord = this.population[i].fitness;\n }\n }\n \n this.best = this.population[index].getPhrase();\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 bestspot(){\r\n \treturn minimax(origBoard,aiplayer).index ;\r\n }", "function minMax(arr) {\r\n\tvar minMax =[Math.min(...arr), Math.max(...arr)]\r\n\treturn minMax;\r\n}", "function assignMinMax(inputID) {\r\n if (Object.keys(minmaxjson).length == 0) {\r\n json = minmaxjson;\r\n if (json[inputID] != undefined) {\r\n // if this inputID is present in minmaxjson, then check if dependencies are met and call minmax validation:\r\n\r\n // minmaxjson.readingInput_SWE02690_1_10_c_25.sort(function(b,a){return Object.keys(a[\"dep\"]).length - Object.keys(b[\"dep\"]).length})\r\n\r\n // the below sorts the dependency json in descending order of dependency variables:\r\n let sorteddependencyarray = json[inputID].sort(function (b, a) { return Object.keys(a[\"dep\"]).length - Object.keys(b[\"dep\"]).length });\r\n let dependencySatisfied = false;\r\n for (let item of sorteddependencyarray) {\r\n if (!dependencySatisfied) {\r\n dependencySatisfied = isDependencySatisfied(item.dep);\r\n if (dependencySatisfied) {\r\n let p = item.range;\r\n if (p.emin == '') { p.emin = \"9999999999\"; }\r\n if (p.emax == '') { p.emax = \"9999999999\"; }\r\n if (p.wmin == '') { p.wmin = \"9999999999\"; }\r\n if (p.wmax == '') { p.wmax = \"9999999999\"; }\r\n $('#' + inputID).off(\"blur\").on(\"blur\", function () { validateErrorWarningRange(inputID, parseInt(p.wmin), parseInt(p.wmax), parseInt(p.emin), parseInt(p.emax)) }\r\n ).trigger(\"blur\");\r\n\r\n //$('#'+inputID).removeAttr(\"onblur\").attr(\"onblur\",validateErrorWarningRange(inputID,p.wmin,p.wmax,p.emin,p.emax));\r\n\r\n }\r\n }\r\n }\r\n\r\n if (!dependencySatisfied) {\r\n assignDefaultMinMax(inputID)\r\n }\r\n }\r\n }\r\n}", "function findMinAndMax(array) {\n var minValue = array[0];\n var maxValue = array[0];\n var = i;\n\n for (i = 1; i < array.length; i++) {\n currentElement = array[i];\n\n if (currentElement < minValue) {\n minValue = currentElement;\n\n }\n\n if (currentElement > maxValue) {\n maxValue = currentValue;\n\n }\n\n //i=1:minValue = 3, maxValue = 7\n } //i=2:minValue = 2, maxValue = 7\n //i=3:minValue = 1, maxValue = 7\n //i=4:minValue = 1 maxValue = 8\n //i=5:minValue = 1 maxValue = 8\n\n}", "function minimax(turno, estado, maximizando, profundidad, maxprof, movimiento){ //debo retornar [fila,columna,heuristica]\n if(profundidad==maxprof){\n // CALCULAR HEURISTICA \n return [movimiento[0], movimiento[1], movimiento[2]]; //si ya no hay sucesores \n } \n var movimientosposibles = getMovimientosPosibles(turno, estado); // elementos [fila, columna, piezascomibles] \n \n var estadoshijos = [];\n for(mov of movimientosposibles){\n var nuevoestado = ejecutarEstado(turno, estado, mov);\n estadoshijos.push([nuevoestado, mov, 0]); // cada hijo guarda [nuevoestado | movimiento que ejecuta 1 | heuristica(no calculada)]\n // 0 1 2\n }\n if(estadoshijos.length==0){\n // CALCULAR HEURISTICA \n return [movimiento[0], movimiento[1], movimiento[2]]; //si ya no hay sucesores \n }else{\n //una vez generados los hijos mandarlos a generar sus hijos\n //console.log(estadoshijos)\n var mejorheuristic = 0\n var mejormov = []\n var flag = true\n var nextTurn = turno=='0'? '1' : '0'\n for(hijo of estadoshijos){\n \n var result = minimax(nextTurn, hijo[0], !maximizando, profundidad+1, maxprof, hijo[1])\n hijo[2] = result[2] //Le coloco la heuristica resultante \n //console.log(hijo);\n if(flag){\n mejorheuristic = hijo[2] //solo la primera vez que entra al ciclo para empezar a comparar \n mejormov = hijo[1]\n flag = !flag\n }\n if(maximizando){\n if(hijo[2]>mejorheuristic){\n mejorheuristic = hijo[2];\n mejormov = hijo[1];\n\n }\n }else{//minimizando\n if(hijo[2]<mejorheuristic){\n mejorheuristic = hijo[2];\n mejormov = hijo[1];\n }\n }\n }\n return [mejormov[1][0], mejormov[1][1], mejorheuristic] \n }\n}", "function maxM(x_in) {\r\n var y = 0; \r\n var lt=x_in.length;\r\n var xmin = x_in[0][0];\r\n for (igo = 0; igo < lt; igo++) {\r\n for (jgo = 0; jgo < lt; jgo ++) {\r\n if (x_in[igo][jgo] > xmin) {\r\n xmin = x_in[igo][jgo];\r\n }\r\n }\r\n }\r\n y = xmin;\r\n return y;\r\n}", "function min1(array1){\n\n return Min.max(...array1);\n \n }", "function motifSearch_MinMax(\n threshold,\n collapsed_reaction_dict,\n expression_dict,\n stats_dict,\n stat_type,\n stat_value,\n inferred_dict,\n link_neighbors,\n path_mapper,\n degree_dict,\n blocklist,\n sample_indices) {\n let discovered_motifs = [];\n\n for (_idx in sample_indices) {\n let sample_motifs = new Set();\n\n for (let rxn in collapsed_reaction_dict) {\n let reaction = collapsed_reaction_dict[rxn];\n let comps = parseComponents(\n reaction,\n expression_dict,\n stats_dict,\n stat_type,\n stat_value,\n inferred_dict,\n link_neighbors,\n degree_dict,\n blocklist,\n _idx)\n let updated_source = comps[0];\n let updated_target = comps[1];\n let source_values = updated_source.map((i) => i[0]);\n let target_values = updated_target.map((i) => i[0]);\n let source_stats = updated_source.map((i) => i[1]);\n let target_stats = updated_target.map((i) => i[1]);\n\n if (updated_source.length > 0 && updated_target.length > 0) {\n let source_min = Math.min(...source_values);\n let target_max = Math.max(...target_values);\n\n if (Math.abs(source_min - target_max) >= threshold) {\n let source_index = source_values.indexOf(source_min);\n let target_index = target_values.indexOf(target_max);\n let p_source = source_stats[source_index];\n let p_target = target_stats[target_index];\n let reaction_copy = $.extend(true, {}, reaction);\n reaction_copy.p_values = {\n \"source\": p_source,\n \"target\": p_target,\n 'agg': aggregate_p_values([p_source, p_target])\n };\n reaction_copy.magnitude_change = Math.abs(source_min - target_max);\n sample_motifs.add(reaction_copy);\n }\n }\n }\n sample_motifs = [...sample_motifs];\n for (let m in sample_motifs) {\n sample_motifs[m]['pathways'] = path_mapper[sample_motifs[m]['id']]\n }\n discovered_motifs.push(sample_motifs);\n }\n return discovered_motifs;\n}", "function calculateStepAI(){\r\n\tvar cur_score = getScore(OPPONENT);\r\n\t\r\n\tvar best_score = cur_score;\r\n var best_step = null;\r\n\tfor (var i = 0; i<field_height; i++)\r\n\t\tfor (var j = 0; j<field_width; j++){\r\n\t\t\tif (game_field[i][j] == OPPONENT){\r\n\t\t\t\tvar step_res = bestStepForSpot(j, i);\r\n\t\t\t\tvar d_score = step_res[1];\r\n\t\t\t\tif (step_res[0] == null) continue;\r\n\t\t\t\tif (cur_score + d_score >= best_score){\r\n\t\t\t\t\tbest_score = cur_score + d_score; \r\n\t\t\t\t\tbest_step = [j, i, step_res[0]];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\r\n\treturn best_step;\r\n}", "function minAndMax(arr){\n var min = arr[0]\n var max = arr[0]\n arr.forEach( function(el){\n if (el > max) {\n max = el\n }\n if (el < min) {\n\t\t\tmin = el\n }\n })\n \n // console.log([min,max])\n return [min,max]\n}", "function PrintMaxMinAverageArrayVals(arr){\n}", "function minMaxProduct(array){\n var min = array[0];\n var max = array[0];\n for (var i = 0; i < array.length; i++) {\n if (min > array[i]) {\n min = array[i];\n }\n else if (max < array[i]) {\n max = array[i];\n }\n }\n return min * max;\n}", "function maxP(a){\n if(a.length<2){\n \t//fast fail, invalid scenario...\n \tconsole.log(\"invalide array scenario, needs at least 2 values present\");\n \treturn -1;\n }\n //greedy concept, keeping the best solution so far and throwing the rest away\n //allows you to only have to loop through the array once.\n let min=a[0]\n let max=a[1]\n let profit=max-min\n for(let i=1; i<a.length; i++){\n //if (min > a[i] && profit < max - a[i]){\n if (a[i] < min && (max - a[i])/*<-new profit*/ > profit){\n min=a[i] //reset min\n max=a[i+1] //shift max over\n }\n //if (max < a[i+1]){\n if (a[i+1] > max){\n max = a[i+1]\n }\n if (max-min > profit){\n profit=max-min\n }\n }\n return profit\n}", "function resetMinMax() {\n minPermintaan = 1000;\n maxPermintaan = 5000;\n minPersediaan = 100;\n maxPersediaan = 600;\n }", "function steeringBehaviourLowestCost(agent) {\r\n\r\n\t//Do nothing if the agent isn't moving\r\n\tif (agent.velocity.magnitude() == 0) {\r\n\t\treturn zeroVector;\r\n\t}\r\n\tvar floor = agent.floor(); //Coordinate of the top left square centre out of the 4\r\n\tvar x = floor.x;\r\n\tvar y = floor.y;\r\n\r\n\t//Find our 4 closest neighbours and get their distance value\r\n\tvar f00 = Number.MAX_VALUE;\r\n\tvar f01 = Number.MAX_VALUE;\r\n\tvar f10 = Number.MAX_VALUE;\r\n\tvar f11 = Number.MAX_VALUE;\r\n\r\n\tif (isValid(x, y)) {\r\n\t\tf00 = grid[x][y].distance;\r\n\t};\r\n\tif (isValid(x, y + 1)) {\r\n\t\tf01 = grid[x][y + 1].distance;\r\n\t}\r\n\tif (isValid(x + 1, y)) {\r\n\t\tf10 = grid[x +1][y].distance; \r\n\t}\r\n\tif (isValid(x + 1, y + 1)) {\r\n\t\tf11 = grid[x + 1][y + 1].distance;\r\n\t}\r\n\r\n\t//Find the position(s) of the lowest, there may be multiple\r\n\tvar minVal = Math.min(f00, f01, f10, f11);\r\n\tvar minCoord = [];\r\n\r\n\tif (f00 == minVal) {\r\n\t\tminCoord.push(floor.plus(new Vector(0, 0)));\r\n\t}\r\n\tif (f01 == minVal) {\r\n\t\tminCoord.push(floor.plus(new Vector(0, 1)));\r\n\t}\r\n\tif (f10 == minVal) {\r\n\t\tminCoord.push(floor.plus(new Vector(1, 0)));\r\n\t}\r\n\tif (f11 == minVal) {\r\n\t\tminCoord.push(floor.plus(new Vector(1, 1)));\r\n\t} \r\n\r\n\r\n\t//Tie-break by choosing the one we are most aligned with\r\n\tvar currentDirection = agent.velocity.norm();\r\n\tvar desiredDirection = zeroVector;\r\n\tminVal = Number.MAX_VALUE;\r\n\tfor (var i = 0; i < minCoord.length; i++) {\r\n\t\t//the direction to the coord from the agent\r\n\t\tvar directionTo = minCoord[i].minus(agent).norm();\r\n\t\t//the magnitude of difference from the current vector to direction of the coord from the agent\r\n\t\tvar magnitude = directionTo.minus(currentDirection).magnitude();\r\n\t\t//if it's the smallest magnitude, set it as the desiredDirection\r\n\t\tif (magnitude < minVal) {\r\n\t\t\tminVal = magnitude;\r\n\t\t\tdesiredDirection = directionTo;\r\n\t\t}\r\n\t}\r\n\r\n\t//Convert to a force\r\n\tvar force = desiredDirection.mul(agent.maxForce / agent.maxSpeed);\r\n\treturn force;\r\n}", "function minOverallAwkwardness(arr) {\n // Write your code here\n \n}" ]
[ "0.63859135", "0.6126756", "0.6118419", "0.6077942", "0.603213", "0.6015189", "0.599978", "0.596573", "0.59024864", "0.5892248", "0.5881318", "0.5816229", "0.5733382", "0.57171476", "0.56853294", "0.567694", "0.5657124", "0.56354284", "0.5612829", "0.56044406", "0.559295", "0.55920863", "0.557334", "0.55490786", "0.55445224", "0.5528205", "0.5497379", "0.54900736", "0.54880697", "0.54629016", "0.5462755", "0.5452546", "0.54443926", "0.5435815", "0.54205114", "0.5410317", "0.5410026", "0.5390869", "0.5388175", "0.53715026", "0.5363374", "0.53613466", "0.5355311", "0.53417724", "0.53356296", "0.5331124", "0.5330895", "0.5330758", "0.5327105", "0.5324221", "0.5311805", "0.5311228", "0.53100634", "0.5305278", "0.5304908", "0.53023183", "0.529489", "0.527895", "0.527204", "0.5261186", "0.52565116", "0.5244338", "0.52442414", "0.5241021", "0.523745", "0.5237383", "0.5233817", "0.5231551", "0.52267593", "0.5224942", "0.5219585", "0.5217726", "0.5212785", "0.5200705", "0.5200595", "0.51926184", "0.5180334", "0.5179528", "0.5172804", "0.5169669", "0.51684475", "0.5163228", "0.51620615", "0.5157563", "0.5148035", "0.5146832", "0.514299", "0.51425666", "0.51415986", "0.5135296", "0.5133119", "0.51292026", "0.51288295", "0.5126561", "0.5125414", "0.5125206", "0.5123694", "0.51199836", "0.51175445", "0.5112441", "0.5106495" ]
0.0
-1
Specify the functions for the random AI
function ai_random(stones,color,action){ /*Input: The stone array and the color of the player Output: The modified stone array*/ if (action=='put'){ var possible_fields = []; for (var i=0; i<stones.length;i++){ if(stones[i]=='¤'){ possible_fields.push(i); } } var index = Math.floor(Math.random() * possible_fields.length); stones[possible_fields[index]]=color; //return stones[possible_fields[index]]; } else if(action=='move'){ var possible_moves = []; var my_fields = []; //create array with indices of all my stones for (var i=0;i<stones.length;i++){ if (stones[i]==color){ my_fields.push(i) } } for (var j=0;j<my_fields.length;j++){ //generate array of each neighbour var nbs = generate_neighbours(my_fields[j]); for (var k = 0; k<nbs.length;k++){ //check whether the neighbouring field is free if(stones[nbs[k]]=='¤'){ var move = [my_fields[j],nbs[k]]; possible_moves.push(move); } } } var index = Math.floor(Math.random() * possible_moves.length); var rmove = possible_moves[index]; stones[rmove[0]] = '¤'; stones[rmove[1]] = color; //return(rmove); } else if(action=='jump'){ var possible_jumps = []; //create array with indices of all my stones for (var i=0;i<stones.length;i++){ if (stones[i]==color){ for(var j=0;j<stones.length;j++){ if(stones[j]=='¤'){ var move = [i,j]; possible_jumps.push(move); } } } } var index = Math.floor(Math.random() * possible_jumps.length); var rmove = possible_jumps[index]; stones[rmove[0]] = '¤'; stones[rmove[1]] = color; //return(rmove); } return stones; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gen_random(){\r\n\treturn 0.3\r\n}", "function randomValues() {\n anime({\n targets: '#dot, #dot2, #dot3, #dot4, #dot5, #dot6, #dot7, #dot8',\n translateX: function() {\n return anime.random(0, 20);\n },\n\n translateY: function() {\n return anime.random(0, 20);\n },\n\n easing: 'easeInOutQuad',\n duration: 2050,\n complete: randomValues\n });\n}", "function SeededRandom(){}", "function NistRandom() {\n this.method = this.ModMethod;\n\n}", "function attachFunctions (generator) {\n var getUInt32 = generator.getUInt32;\n\n /* Use _randInt32 if max < 2^32, _randInt53 otherwise. If max\n * is not specified, assume 2^32. */\n function _randInt (max) {\n if (max > 0xffffffff) // false for max=undefined|function\n return _randInt53(max);\n return _randInt32(max);\n }\n _randInt.defaultPrecision = 32;\n \n /* Use 53-bit precision. If max is not specified, assume 2^53. */\n function _randInt53 (max) {\n var r = getUInt32() + (getUInt32() >>> 11) * 0x100000000;\n if (typeof max === 'undefined')\n return r;\n return r % max;\n }\n _randInt53.defaultPrecision = 53;\n\n /* Use 32-bit precision. If max is not specified, assume 2^32. */\n function _randInt32 (max) {\n var r = getUInt32();\n if (typeof max === 'undefined')\n return r;\n return r % max;\n }\n _randInt32.defaultPrecision = 32;\n\n /* Use as little precision as is needed to generate a\n * completely uniform distribution from the PRNG to the target\n * range. Can be very slow to execute. If max is not\n * specified, assume 2^53. */\n function _randIntUniform (max) {\n if (typeof max === 'undefined')\n return _randInt53();\n if (max == 0)\n return 0;\n var log2 = 0;\n var mult = 1;\n while (mult < max) {\n log2 += 1;\n mult *= 2;\n }\n for (var r = max; r >= max; r = getRandBits(log2));\n return r;\n }\n\n /* Returns a random integer with precision 2^n, where n <= 53. */\n function getRandBits (n) {\n if (n === 0)\n return 0;\n function getBits32 () {\n var r = _randInt32();\n return r >>> (32 - n);\n }\n function getBits53 () {\n var r1 = _randInt32() >>> (53 - n);\n var r2 = _randInt32();\n return r2 + (r1 >>> 11) * 0x100000000;\n }\n if (n > 32)\n return getBits53();\n return getBits32();\n }\n\n function wrapWithPrecision (baseRandInt) {\n // Smallest float > 0 that we can uniformly generate with\n // the random generator's precision.\n var MIN_FLOAT = 1 / Math.pow(2, baseRandInt.defaultPrecision);\n\n /* Returns a random integer i, such that min <= i < max.\n *\n * If only one parameter is supplied, it is assumed to be max,\n * and min will be 0.\n *\n * If no parameters are supplied, min is assumed to be 0, and\n * max is assumed to be 2^53. I.e. bounded by largest\n * possible integer value. */\n function randInt (min, max, step) {\n if (typeof(min) == 'undefined')\n return baseRandInt();\n if (typeof(max) == 'undefined') {\n max = min;\n min = 0;\n }\n if (typeof step === 'undefined') {\n return min + baseRandInt(max - min);\n }\n var span = Math.ceil((max - min) / step);\n return min + baseRandInt(span) * step;\n }\n\n /* Returns a random element from the array arr. If arr is\n * empty, throws an exception. */\n function choice (arr) {\n if (!arr.length)\n throw \"arr not an array of length > 0\";\n return arr[baseRandInt(arr.length)];\n }\n\n /* Returns a shuffled copy of the array arr. For\n * algorithm details, see shuffleInplace. */\n function shuffle (arr) {\n var arrCopy = arr.slice();\n shuffleInplace(arrCopy);\n return arrCopy;\n }\n\n /* Shuffle the array arr in place. Uses the Fisher-Yates\n * shuffle, aka the Knuth shuffle. */\n function shuffleInplace (arr) {\n var j, tmp;\n for (var i = arr.length - 1; i > 0; i--) {\n j = baseRandInt(i + 1);\n tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n }\n\n /* Returns an array of length count, containing unique\n * elements chosen from the array population. Like a\n * raffle draw.\n *\n * Mathematically equivalent to\n * shuffle(population).slice(0, count), but more\n * efficient. Catches fire if count >\n * population.length. */\n function sample (population, count) {\n var arr = population.slice();\n var j, tmp, ln = arr.length;\n for (var i = ln - 1; i > (ln - count - 1); i--) {\n j = baseRandInt(i + 1);\n tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n return arr.slice(ln - count);\n }\n \n /* Returns a floating point number f such that 0.0 <= f < 1.0 */\n function random () {\n return MIN_FLOAT * baseRandInt();\n }\n\n /* Returns a floating point number f such that min <= f < max. */\n function uniform (min, max) {\n if (typeof min == 'undefined')\n min = 0;\n if (typeof max == 'undefined') {\n max = min;\n min = 0;\n }\n return min + (random() * (max - min));\n }\n\n /* The triangular distribution is typically used as a\n * subjective description of a population for which there\n * is only limited sample data, and especially in cases\n * where the relationship between variables is known but\n * data is scarce (possibly because of the high cost of\n * collection). It is based on a knowledge of the minimum\n * and maximum and an \"inspired guess\" as to the modal\n * value.\n *\n * http://en.wikipedia.org/wiki/Triangular_distribution */\n function triangular (min, max, mode) {\n if (typeof(min) == 'undefined')\n min = 0;\n if (typeof(max) == 'undefined') {\n max = min;\n min = 0;\n }\n if (typeof(mode) == 'undefined')\n mode = min + (max - min) / 2;\n var u = random();\n if (u < (mode - min) / (max - min)) {\n return min + Math.sqrt(u * (max - min) * (mode - min));\n } else {\n return max - Math.sqrt((1 - u) *\n (max - min) * (max - mode));\n }\n }\n\n return {\n 'randInt' : randInt,\n 'choice' : choice,\n 'shuffle' : shuffle,\n 'shuffleInplace': shuffleInplace,\n 'sample' : sample,\n 'random' : random,\n 'uniform' : uniform,\n 'triangular' : triangular,\n 'getRandBits' : getRandBits\n };\n }\n \n var fastFuns = wrapWithPrecision(_randInt, 0x100000000);\n var goodFuns = wrapWithPrecision(_randInt53, 0x20000000000000);\n var bestFuns = wrapWithPrecision(_randIntUniform, 0x20000000000000);\n fastFuns.good = goodFuns;\n fastFuns.best = bestFuns;\n fastFuns.getState = generator.getState;\n fastFuns.setState = generator.setState;\n return fastFuns;\n }", "function exprand(lambda){ return (- Math.log(Math.random()) / lambda); }", "mutation(rate) {\n function mutate(value) {\n if (Math.random() < rate) {\n return value + randomGaussian(0, 0.1);\n } else {\n return value;\n }\n }\n this.firstExtrinsicWeights.map(mutate);\n this.secondExtrinsicWeights.map(mutate);\n this.intrinsicWeights.map(mutate);\n }", "randomWeights(f) {\n\t\tif (!this.hasWeights) this.addWeights();\n\t\tlet fargs = [... arguments].slice(1);\n\t\tfor (let e = this.first(); e != 0; e = this.next(e)) {\n\t\t\tlet w = f(...fargs); this.weight(e, w);\n\t\t}\n\t}", "function consola (){\r\n bienvenida_random();\r\n ayuda();\r\n}", "static rand(min, max, ease) {\n if(max === undefined) {\n max = min;\n min = 0;\n }\n let random = Math.random();\n if(ease) {\n random = ease(Math.random(), 0, 1, 1);\n }\n return random * (max - min) + min;\n }", "function currentRollFunction() {\n return getRandomInt(1,7); \n}", "function generateShape(type, func){\n //here happens part of the magic!\n //do as many computations, API calls and database calls as you wish\n var theType = \"i am generating the following shape type: \" + type\n var randNumber = func()\n \n //function as an expression\n var shapeGenerator \n\n if (randNumber > .5) {\n //here depending on the 50% of possibilities, we decide the f's implementation\n shapeGenerator = function () {\n console.log(\"Implementation type I\")\n console.log(theType)\n console.log(randNumber)\n }\n } else {\n shapeGenerator = function () {\n console.log(\"Implementation type II\")\n console.log(randNumber)\n console.log(theType)\n }\n }\n return shapeGenerator\n}", "function randomEvent(){\n\tif(x2able && !powerX2 && !x2Show && random(100) < powerUpChance){\n\t\tx2Show = true;\n\t\treturn 1.0;\n\t}else if(slowable && !powerSlow && !slowShow && random(100) < powerUpChance){\n\t\tslowShow = true;\n\t\treturn 2.0;\n\t}else if(currentScore > bigThuTriggerScore && random(100) < bigThuChance){\n\t\treturn 3.0;\n\t}else if(currentScore > thuTypeTriggerScore && random(100) < venomThuChance){\n\t\treturn 4.0;\n\t}else if(currentScore > thuTypeTriggerScore && random(100) < cuteThuChance){\n\t\treturn 5.0;\n\t}else{\n\t\treturn 0.0;\n\t}\n}", "function newGame() {\n var randNumber = Math.floor(Math.random() * 120) + 1;\n var emerald;\n var ruby;\n var opal;\n var amethyst;\n }", "mutate(rate) {\n function mutate(val) {\n if(Math.random() < rate) {\n return val + randomGaussian(0, 0.1); //take the current value and add a random amount to it.\n } else {\n return val;\n }\n }\n\n this.weights_i_h = this.weights_i_h.map(mutate);\n this.bias_h1 = this.bias_h1.map(mutate);\n \n if(this.hn_2) {\n this.weights_h1_h2 = this.weights_h1_h2.map(mutate);\n this.bias_h2 = this.bias_h2.map(mutate);\n }\n \n this.weights_h_o = this.weights_h_o.map(mutate);\n this.bias_o = this.bias_o.map(mutate);\n }", "function randomizer() {\n target = Math.floor(Math.random() * 100) + 19;\n gem1rando = Math.floor(Math.random() * 13) + 2;\n gem2rando = Math.floor(Math.random() * 13) + 2;\n gem3rando = Math.floor(Math.random() * 13) + 2;\n gem4rando = Math.floor(Math.random() * 13) + 2;\n }", "step(obs) {\n super.step(obs)\n if (!obs.observation.available_actions) {\n console.warn('************ MISSING obs.observation.available_actions ***********')\n console.warn(obs.observation)\n }\n const function_id = randomChoice(obs.observation.available_actions)\n const args = []\n this.action_spec.functions[function_id].args.forEach((arg) => {\n args.push(arg.sizes.map((size) => { //eslint-disable-line\n return Math.floor(Math.random() * size)\n }))\n })\n return new actions.FunctionCall(function_id, args)\n }", "selectRand() {\n\t}", "function getAction() {\n return Math.floor(Math.random() * 6);\n} //function", "static train() {\n\t\t// Get random number from 1-5\t\t\n let randNum = Math.ceil(Math.random() * 5);\n let training = 0;\n let trainingMessage = \"\";\n\t\t\n\t\t// Made it so that if the random number is odd you get an ability point and a message for how you did that session. If the number is even you lose an ability point with a message explaining why.\n switch (randNum) {\n case 1:\n training = 1;\n trainingMessage = \"You had a nice steady learning experience\";\n break;\n case 2:\n training = -1;\n trainingMessage = \"You were distracted most of the day and had to refresh what you already know\";\n break;\n case 3:\n training = 2;\n trainingMessage = \"You had a great day you learned more than what you set out to accomplish\";\n break;\n case 4:\n training = -2;\n trainingMessage = \"You had a terrible day and just couldn't figure anything out and started questioning what you already know.\";\n break;\n case 5:\n training = 5;\n trainingMessage = \"You had an amazing day! You feel that you might just be a natural programmer\";\n break;\n default:\n training = 0;\n trainingMessage = \"I don't think it's possible for the code to get here but just in case Good Job you found a bug!\"\n break;\n }\n\n\t\t// I got bored with the simulator myself so I added this part in for a multiplier to your positive training. If you had a bad training session you penalty will not be multiplied.\n let finalScore = 0;\n if (training < 1) {\n finalScore = training;\n } else {\n let multiplierNum = Math.random();\n let multiplier = 1;\n if (multiplierNum < 0.3) {\n multiplier = 1;\n } else if (multiplierNum < 0.5) {\n multiplier = 1.5;\n } else if (multiplierNum < 0.7) {\n multiplier = 2;\n } else if (multiplierNum < .9) {\n multiplier = 2.5;\n } else {\n multiplier = 3; // Yes intentional 1/10th chance for 3x multiplier\n trainingMessage += \" Congrats you got a 3x multiplier too! Super smart looking!\"\n }\n\n\n finalScore = training * multiplier;\n }\n\n return [finalScore, trainingMessage];\n }", "function randomType(){\n return Math.random() > .5 ? \"mesh\" : \"keyword\"; \n}", "function random() {\n\t// This will read the file\n\tfs.readFile(\"random.txt\", \"utf8\", function(error, data) {\n\n\t\t// If the code experiences any errors it will log the error to the console.\n\t\tif (error) {\n\t\t\treturn console.log(error);\n\t\t};\n\n\t\t// split data by commas\n\t\tvar dataArr = data.split(\",\");\n\n\t\t// Save the arguments from the array\n\t\tvar textArg1 = dataArr[0];\n\t\tvar textArg2 = dataArr[1];\n\n\t\t// Check if there are quotations around the second argument\n\t\t// If so, then delete quotation marks.\n\t\t// This is done using character codes because the code in the \n\t\t// text file for \" is different from that typed in js\n\n\t\tif(textArg2.charCodeAt(0)===8221 && textArg2.charCodeAt(textArg2.length - 1) === 8221) \n\t\t{\n\t\t\ttextArg2 = textArg2.substr(1, textArg2.length - 2);\n\t\t};\n\n\t\t// Depending on argument1 call the relevant function\n\t\tswitch(textArg1) {\n\t\t\t// call the myTweets function\n\t\t\tcase \"my-tweets\":\n\t\t\t\t// run the my-tweets function\n\t\t\t\tmyTweets();\n\t\t\t\tbreak;\n\t\t\t// call the spotify function\n\t\t\tcase \"spotify-this-song\":\n\t\t\t\t// run the spotify function\n\t\t\t\tspotifySong(textArg2);\n\t\t\t\tbreak;\n\t\t\t// call the movies function\n\t\t\tcase \"movie-this\":\n\t\t\t\t// run the movies function\n\t\t\t\tmovieInfo(textArg2);\n\t\t\t\tbreak;\n\t\t};\n\t});\n}", "function allOps() {\n var rand1 = Math.round(100 * Math.random());\n var rand2 = Math.round(100 * Math.random());\n var rand3 = Math.round(100 * Math.random());\n var rand4 = Math.round(100 * Math.random());\n var expression = (rand1 + rand2) / rand3 * rand4;\n document.getElementById(\"math5\").innerHTML = \"Result: (\" + rand1 + \" + \" + rand2 + \") / \" + rand3 + \" * \" + rand4 + \" = \" + expression;\n}", "function generate(){\n\n // increase difficulty after it scored over 10 points\n if(variables.score > 10) {\n variables.max = Math.ceil(variables.score / 5) * 5\n }\n if(variables.score > 20){\n variables.min = Math.ceil(variables.score / 10) * 5\n }\n\n variables.leftNumber = getRandomNumber(variables.min, variables.max)\n variables.rightNumber = getRandomNumber(variables.min, variables.max)\n variables.result = getRandomBoolean()\n variables.score++\n refreshNumbers()\n}", "constructor() {\n this.amplitude = Math.random() * (10 - 2) + 2;\n this.checkSin = this.randomBool();\n this.choice = Math.round(Math.random() * (2 - 1)) + 1;\n this.direction1 = this.randomDirection();\n this.direction2 = this.randomDirection();\n // this.length = Math.ceil(Math.random() * 500);\n this.drawnLength = 0;\n this.length = Math.random() * 40;\n }", "function getBrandName(outputTags){\n //If user inputs certain method or brandname choose that and Otherwise run random methods\n\n //Random int between 0-9\n var index = Math.floor(Math.random() * 3);\n //console.log(index);\n var brandname;\n switch(index) {\n case 0:\n brandname = colorName(outputTags);\n break;\n case 1:\n brandname = randomJoin(outputTags);\n break;\n case 2:\n brandname = vowelName(outputTags);\n break;\n}\n return brandname;\n}", "function rand(){\n return Math.random()\n}", "function hp(gen) {\n if (gen === \"Ancient Dragon\") {\n return (Math.floor((Math.random() * 20)) + 81);\n } else if (gen === \"Prowler\") {\n return (Math.floor((Math.random() * 20)) + 50);\n } else {\n return (Math.floor((Math.random() * 20)) + 20);\n }\n}", "function Random(){\n // Load Chance\n var Chance = require('chance');\n var chance = new Chance();\n // Load hat\n var hat = require('hat');\n\n this.getChance = function(){\n return chance;\n };\n\n this.getHat = function(){\n return hat;\n }\n}", "getRandomPhrase() {\n const randomPhrase = this.phrases[Math.floor(Math.random() * this.phrases.length)];\n //return the function by calling the randomPhrase variable\n return randomPhrase;\n }", "function randomAttack() {\n let enemyAction = Math.floor(Math.random() * 3);\n showEnemyAction(enemyAction);\n if (enemyAction === 0 && myAction === 1) {\n\n attackVsFeint();\n } else if (enemyAction === 2 && myAction === 2 || enemyAction === 1 && myAction === 1 || enemyAction === 0 && myAction === 0) {\n tie();\n } else if (enemyAction === 0 && myAction === 2) {\n feintVsAttack();\n } else if (enemyAction === 1 && myAction === 0) {\n feintVsAttack();\n } else if (enemyAction === 1 && myAction === 2) {\n heroBlockSound.play();\n attackVsFeint();\n } else if (enemyAction === 2 && myAction === 0) {\n\n attackVsFeint();\n } else if (enemyAction === 2 && myAction === 1) {\n heroBlockSound.play();\n feintVsAttack()\n }\n\n console.log(enemyAction + ' enemy action');\n\n}", "function randomButtons() {\n randomBtn1 = Math.floor(Math.random() * 19 + 1);\n randomBtn2 = Math.floor(Math.random() * 19 + 1);\n randomBtn3 = Math.floor(Math.random() * 19 + 1);\n randomBtn4 = Math.floor(Math.random() * 19 + 1);\n randomBtn5 = Math.floor(Math.random() * 19 + 1);\n }", "function randomFlow(elem) {\n return function() {\n var delay = anime.random(0, 400);\n var duration = anime.random(3900, 8200);\n var fadeDuration = 425;\n var direction = randomNegative();\n anime.set(elem, {\n opacity: 0,\n translateX: 0,\n translateY: anime.random(3, 33),\n scaleX: anime.random(7,16),\n scaleY: anime.random(1,2),\n background: colours[anime.random(0, colours.length - 1)]\n })\n anime({\n targets: elem,\n keyframes: [\n {opacity: anime.random(45, 75) / 100, delay: delay, duration: fadeDuration},\n {opacity: 0, delay: duration - fadeDuration * 2, duration: fadeDuration}\n ],\n easing: 'linear'\n });\n anime({\n targets: elem,\n translateX: anime.random(Math.min(window.innerWidth / 3, 200),\n Math.min(window.innerWidth / 2, 300)) * direction,\n easing: 'linear',\n duration: duration,\n delay: delay,\n complete: randomFlow(elem)\n });\n }\n}", "generateSpeed(){\n return Math.floor(Math.random()*(250-225)+225);\n }", "function getAleatorio(){\n return Math.random();\n}", "_random() {\n return Math.rnd();\n }", "function randomize (){\n\tvar random = Math.floor(Math.random()*4);\n\treturn ligth(random);\n}", "randomBonus() {\n\t\tlet num = Math.floor(Math.random() * 20) + 1;\n\n\t\tthis.randomBonusNumber = num;\n\t}", "function chaosAI(tile)\n{\n\treturn Math.random();\n}", "function chooseOperator() {\n let operators = ['+', '-', '*', '/', '%'];\n //to select a random operator\n let index = Math.floor(Math.random() * (5 - 0) + 0);\n return operators[index];\n}", "function random() {\n return Math.random();\n}", "function randomizer() {\n return Math.floor((Math.randon() * 3) + 1)\n}", "function randomizer() {\n return Math.floor((Math.randon() * 3) + 1)\n}", "shouldAttack() {\n return Random.between(1, 4) === 1;\n }", "function randomFoe(level){ return randomSomthing(level, \"foe\"); }", "init() {\n this.thinking = Math.round(Math.random() * 100 + 1);\n }", "function mathGame(callback) {\n let selectedOperator = chooseOperator();\n let operands = generateRandomOperands();\n\n switch (selectedOperator) {\n case '+':\n result = roundToTwoDecPlace(operands.random1 + operands.random2);\n break;\n case '-':\n result = roundToTwoDecPlace(operands.random1 - operands.random2);\n break;\n case '*':\n result = roundToTwoDecPlace(operands.random1 * operands.random2);\n break;\n case '/':\n if (operands.random2 !== 0)\n result = roundToTwoDecPlace(operands.random1 / operands.random2);\n else\n result = NAN\n break;\n case '%':\n result = roundToTwoDecPlace(operands.random1 % operands.random2)\n }\n\n given = {\n operator: selectedOperator,\n number1: operands.random1,\n number2: operands.random2,\n givenResult: result\n };\n\n //execute a callback if there is\n if (arguments.length == 1)\n callback(given);\n}", "function factory (type, config, load, typed, math) {\n var matrix = load(require('../../type/matrix/function/matrix'));\n var array = require('../../utils/array');\n\n // seeded pseudo random number generator\n var rng = load(require('./seededRNG'));\n\n /**\n * Create a distribution object with a set of random functions for given\n * random distribution.\n *\n * Syntax:\n *\n * math.distribution(name)\n *\n * Examples:\n *\n * var normalDist = math.distribution('normal'); // create a normal distribution\n * normalDist.random(0, 10); // get a random value between 0 and 10\n *\n * See also:\n *\n * random, randomInt, pickRandom\n *\n * @param {string} name Name of a distribution. Choose from 'uniform', 'normal'.\n * @return {Object} Returns a distribution object containing functions:\n * `random([size] [, min] [, max])`,\n * `randomInt([min] [, max])`,\n * `pickRandom(array)`\n */\n function distribution(name) {\n if (!distributions.hasOwnProperty(name))\n throw new Error('Unknown distribution ' + name);\n\n var args = Array.prototype.slice.call(arguments, 1),\n distribution = distributions[name].apply(this, args);\n\n return (function(distribution) {\n\n // This is the public API for all distributions\n var randFunctions = {\n\n random: function(arg1, arg2, arg3) {\n var size, min, max;\n\n if (arguments.length > 3) {\n throw new ArgumentsError('random', arguments.length, 0, 3);\n } else if (arguments.length === 1) {\n // `random(max)` or `random(size)`\n if (isCollection(arg1)) {\n size = arg1;\n } else {\n max = arg1;\n }\n } else if (arguments.length === 2) {\n // `random(min, max)` or `random(size, max)`\n if (isCollection(arg1)) {\n size = arg1;\n max = arg2;\n } else {\n min = arg1;\n max = arg2;\n }\n } else {\n // `random(size, min, max)`\n size = arg1;\n min = arg2;\n max = arg3;\n }\n\n // TODO: validate type of size\n if ((min !== undefined && !isNumber(min)) || (max !== undefined && !isNumber(max))) {\n throw new TypeError('Invalid argument in function random');\n }\n\n if (max === undefined) max = 1;\n if (min === undefined) min = 0;\n if (size !== undefined) {\n var res = _randomDataForMatrix(size.valueOf(), min, max, _random);\n return type.isMatrix(size) ? matrix(res) : res;\n }\n return _random(min, max);\n },\n\n randomInt: typed({\n 'number | Array': function(arg) {\n var min = 0;\n\n if (isCollection(arg)) {\n var size = arg;\n var max = 1;\n var res = _randomDataForMatrix(size.valueOf(), min, max, _randomInt);\n return type.isMatrix(size) ? matrix(res) : res;\n } else {\n var max = arg;\n return _randomInt(min, max);\n }\n },\n 'number | Array, number': function(arg1, arg2) {\n if (isCollection(arg1)) {\n var size = arg1;\n var max = arg2;\n var min = 0;\n var res = _randomDataForMatrix(size.valueOf(), min, max, _randomInt);\n return type.isMatrix(size) ? matrix(res) : res;\n }\n else {\n var min = arg1;\n var max = arg2;\n return _randomInt(min, max);\n }\n },\n 'Array, number, number': function(size, min, max) {\n var res = _randomDataForMatrix(size.valueOf(), min, max, _randomInt);\n return (size && size.isMatrix === true) ? matrix(res) : res;\n }\n }),\n\n pickRandom: typed({\n 'Array': function(possibles) {\n return _pickRandom(possibles);\n },\n 'Array, number | Array': function(possibles, arg2) {\n var number, weights;\n\n if (Array.isArray(arg2)) {\n weights = arg2;\n } else if (isNumber(arg2)) {\n number = arg2;\n } else {\n throw new TypeError('Invalid argument in function pickRandom')\n }\n\n return _pickRandom(possibles, number, weights);\n },\n 'Array, number | Array, Array | number': function(possibles, arg2, arg3) {\n var number, weights;\n\n if (Array.isArray(arg2)) {\n weights = arg2;\n number = arg3;\n } else {\n weights = arg3;\n number = arg2;\n }\n\n if (!Array.isArray(weights) || !isNumber(number)) {\n throw new TypeError('Invalid argument in function pickRandom');\n }\n\n return _pickRandom(possibles, number, weights);\n }\n })\n }\n\n var _pickRandom = function(possibles, number, weights) {\n var single = (typeof number === 'undefined');\n\n if (single) {\n number = 1;\n }\n\n if (type.isMatrix(possibles)) {\n possibles = possibles.valueOf(); // get Array\n } else if (!Array.isArray(possibles)) {\n throw new TypeError('Unsupported type of value in function pickRandom');\n }\n\n if (array.size(possibles).length > 1) {\n throw new Error('Only one dimensional vectors supported');\n }\n\n if (typeof weights !== 'undefined') {\n if (weights.length != possibles.length) {\n throw new Error('Weights must have the same length as possibles');\n }\n\n var totalWeights = 0;\n\n for (var i = 0, len = weights.length; i < len; i++) {\n if (!isNumber(weights[i]) || weights[i] < 0) {\n throw new Error('Weights must be an array of positive numbers');\n }\n\n totalWeights += weights[i];\n }\n }\n\n var length = possibles.length;\n\n if (length == 0) {\n return [];\n } else if (number >= length) {\n return number > 1 ? possibles : possibles[0];\n }\n\n var result = [];\n var pick;\n\n while (result.length < number) {\n if (typeof weights === 'undefined') {\n pick = possibles[Math.floor(rng() * length)];\n } else {\n var randKey = rng() * totalWeights;\n\n for (var i = 0, len = possibles.length; i < len; i++) {\n randKey -= weights[i];\n\n if (randKey < 0) {\n pick = possibles[i];\n break;\n }\n }\n }\n\n if (result.indexOf(pick) == -1) {\n result.push(pick);\n }\n }\n\n return single ? result[0] : result;\n\n // TODO: add support for multi dimensional matrices\n }\n\n var _random = function(min, max) {\n return min + distribution() * (max - min);\n };\n\n var _randomInt = function(min, max) {\n return Math.floor(min + distribution() * (max - min));\n };\n\n // This is a function for generating a random matrix recursively.\n var _randomDataForMatrix = function(size, min, max, randFunc) {\n var data = [], length, i;\n size = size.slice(0);\n\n if (size.length > 1) {\n for (var i = 0, length = size.shift(); i < length; i++) {\n data.push(_randomDataForMatrix(size, min, max, randFunc));\n }\n } else {\n for (var i = 0, length = size.shift(); i < length; i++) {\n data.push(randFunc(min, max));\n }\n }\n\n return data;\n };\n\n return randFunctions;\n\n })(distribution);\n }\n\n // Each distribution is a function that takes no argument and when called returns\n // a number between 0 and 1.\n var distributions = {\n\n uniform: function() {\n return rng;\n },\n\n // Implementation of normal distribution using Box-Muller transform\n // ref : http://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform\n // We take : mean = 0.5, standard deviation = 1/6\n // so that 99.7% values are in [0, 1].\n normal: function() {\n return function() {\n var u1, u2,\n picked = -1;\n // We reject values outside of the interval [0, 1]\n // TODO: check if it is ok to do that?\n while (picked < 0 || picked > 1) {\n u1 = rng();\n u2 = rng();\n picked = 1/6 * Math.pow(-2 * Math.log(u1), 0.5) * Math.cos(2 * Math.PI * u2) + 0.5;\n }\n return picked;\n }\n }\n };\n\n distribution.toTex = undefined; // use default template\n\n return distribution;\n}", "function charaterGen(){\n luke.AP = 5;\n luke.HP = 100;\n obiwan.AP = 9;\n obiwan.HP = 120;\n maul.AP = 13;\n maul.HP = 150;\n sidious.AP = 17;\n sidious.HP = 180;\n}", "function genChoiceFn()\n{\n assert (\n arguments.length > 0 && arguments.length % 2 === 0,\n 'invalid argument count: ' + arguments.length\n );\n\n var numChoices = arguments.length / 2;\n\n var choices = [];\n var weights = [];\n var weightSum = 0;\n\n for (var i = 0; i < numChoices; ++i)\n {\n var choice = arguments[2*i];\n var weight = arguments[2*i + 1];\n\n choices.push(choice);\n weights.push(weight);\n\n weightSum += weight;\n }\n\n assert (\n weightSum > 0,\n 'weight sum must be positive'\n );\n\n var limits = [];\n var limitSum = 0;\n\n for (var i = 0; i < weights.length; ++i)\n {\n var normWeight = weights[i] / weightSum;\n\n limitSum += normWeight;\n\n limits[i] = limitSum;\n }\n\n function choiceFn()\n {\n var r = Math.random();\n\n for (var i = 0; i < numChoices; ++i)\n {\n if (r < limits[i])\n return choices[i];\n }\n\n return choices[numChoices-1];\n }\n\n return choiceFn;\n}", "function getRandomNumber () {}", "function random(a, b) {\n const alpha = Math.random();\n return a * (1.0 - alpha) + b * alpha;\n }", "fitnessFunction(score,method)\n {\n if(method ==1)\n {\n score = pow(score,2);\n if(score ==0) score = 0.1;\n return score;\n }\n\n }", "function rand(){\n return Math.random()-0.5;\n }", "randomise() {\n for(let i = 0; i < this.numOutputs; i++)\n {\n\t this.updateOutput(i, Math.random());\n }\n }", "function randomOperator(operator) {\n if (operator == 0) {\n return \"+\";\n } else if (operator == 1) {\n return \"-\";\n } else if (operator == 2) {\n return \"x\";\n }\n}", "function random(fr, ft) {\n Math.floor(Math.random(fr, ft))\n}", "function random() {\n\n fs.readFile('./random.txt', 'utf8', function (err, data) {\n if (err) {\n return console.log(err);\n }\n else {\n console.log(data);\n\n //Converts data in text file into array\n var arr = data.split(\",\");\n var value = arr[1];\n // If command name at index[0] matches the string, invoke the function\n if (arr[0] === \"movie-this\") {\n myMovie(value);\n }\n else if (arr[0] === \"spotify-this-song\") {\n mySpotify(value);\n }\n else if (arr[0] === \"concert-this\") {\n myBand(value);\n }\n }\n });\n}", "rando() {\n randomNum = Math.floor(Math.random() * 20);\n }", "function Ruleta(){\n\tRuleta.prototype.tirar = function(){\n\t\t\treturn Math.floor((Math.random() * _numCasilleros));\n\t}\n}", "function init() {\n generateRandomMeal();\n}", "function tofrandom() {\n\t\tlet result = [];\n\t\tlet rnd1 = 0; // Used for setting 1st turn-on\n\t\tlet rnd2 = 0; // Used for setting 2nd turn-on\n\t\tlet rnd3 = 0; // Used for setting turn-off\n\t\tlet to1img = 'Null.png'; // Relative path for 1st turn-on\n\t\tlet to1alt = ''; // Alt text for 1st turn-on\n\t\tlet to2img = 'Null.png'; // Relative path for 2nd turn-on\n\t\tlet to2alt = ''; // Alt text for 2nd turn-on\n\t\tlet toffimg = 'Null.png'; // Relative path for turn-off\n\t\tlet toffalt = ''; // Alt text for turn-off\n\n\t\t// If AL is false, don't include witches\n\t\tif ($('#al').prop('checked') === false) {\n\t\t\t// If BV and FT are false, don't include new turn-ons\n\t\t\tif ($('#bv').prop('checked') === false && $('#ft').prop('checked') === false) {\n\t\t\t\tresult = random(1, 19, 3, false);\n\t\t\t\trnd1 = result[0];\n\t\t\t\trnd2 = result[1];\n\t\t\t\trnd3 = result[2];\n\t\t\t} else {\n\t\t\t\tresult = random(1, 33, 3, false);\n\t\t\t\trnd1 = result[0];\n\t\t\t\trnd2 = result[1];\n\t\t\t\trnd3 = result[2];\n\t\t\t}\n\t\t} else {\n\t\t\tresult = random(1, 34, 3, false);\n\t\t\trnd1 = result[0];\n\t\t\trnd2 = result[1];\n\t\t\trnd3 = result[2];\n\t\t}\n\n\t\t// Check against randomly generated numbers and set image etc. to corresponding variables\n\t\tif (rnd1 === 1) {\n\t\t\tto1img = 'turnon1.png';\n\t\t\tto1alt = 'Cologne';\n\t\t} else if (rnd2 === 1) {\n\t\t\tto2img = \"turnon1.png\";\n\t\t\tto2alt = \"Cologne\";\n\t\t} else if (rnd3 === 1) {\n\t\t\ttoffimg = \"turnoff1.png\";\n\t\t\ttoffalt = \"Cologne\";\n\t\t}\n\n\t\tif (rnd1 === 2) {\n\t\t\tto1img = 'turnon2.png';\n\t\t\tto1alt = 'Stink';\n\t\t} else if (rnd2 === 2) {\n\t\t\tto2img = \"turnon2.png\";\n\t\t\tto2alt = \"Stink\";\n\t\t} else if (rnd3 === 2) {\n\t\t\ttoffimg = \"turnoff2.png\";\n\t\t\ttoffalt = \"Stink\";\n\t\t}\n\n\t\tif (rnd1 === 3) {\n\t\t\tto1img = 'turnon3.png';\n\t\t\tto1alt = 'Fat';\n\t\t} else if (rnd2 === 3) {\n\t\t\tto2img = \"turnon3.png\";\n\t\t\tto2alt = \"Fat\";\n\t\t} else if (rnd3 === 3) {\n\t\t\ttoffimg = \"turnoff3.png\";\n\t\t\ttoffalt = \"Fat\";\n\t\t}\n\n\t\tif (rnd1 === 4) {\n\t\t\tto1img = 'turnon4.png';\n\t\t\tto1alt = 'Fit';\n\t\t} else if (rnd2 === 4) {\n\t\t\tto2img = \"turnon4.png\";\n\t\t\tto2alt = \"Fit\";\n\t\t} else if (rnd3 === 4) {\n\t\t\ttoffimg = \"turnoff4.png\";\n\t\t\ttoffalt = \"Fit\";\n\t\t}\n\n\t\tif (rnd1 === 5) {\n\t\t\tto1img = 'turnon5.png';\n\t\t\tto1alt = 'Grey hair';\n\t\t} else if (rnd2 === 5) {\n\t\t\tto2img = \"turnon5.png\";\n\t\t\tto2alt = \"Grey hair\";\n\t\t} else if (rnd3 === 5) {\n\t\t\ttoffimg = \"turnoff5.png\";\n\t\t\ttoffalt = \"Grey hair\";\n\t\t}\n\n\t\tif (rnd1 === 6) {\n\t\t\tto1img = 'turnon6.png';\n\t\t\tto1alt = 'Formal wear';\n\t\t} else if (rnd2 === 6) {\n\t\t\tto2img = \"turnon6.png\";\n\t\t\tto2alt = \"Formal wear\";\n\t\t} else if (rnd3 === 6) {\n\t\t\ttoffimg = \"turnoff6.png\";\n\t\t\ttoffalt = \"Formal wear\";\n\t\t}\n\n\n\t\tif (rnd1 === 7) {\n\t\t\tto1img = 'turnon7.png';\n\t\t\tto1alt = 'Swimwear';\n\t\t} else if (rnd2 === 7) {\n\t\t\tto2img = \"turnon7.png\";\n\t\t\tto2alt = \"Swimwear\";\n\t\t} else if (rnd3 === 7) {\n\t\t\ttoffimg = \"turnoff7.png\";\n\t\t\ttoffalt = \"Swimwear\";\n\t\t}\n\n\t\tif (rnd1 === 8) {\n\t\t\tto1img = 'turnon8.png';\n\t\t\tto1alt = 'Underwear';\n\t\t} else if (rnd2 === 8) {\n\t\t\tto2img = \"turnon8.png\";\n\t\t\tto2alt = \"Underwear\";\n\t\t} else if (rnd3 === 8) {\n\t\t\ttoffimg = \"turnoff8.png\";\n\t\t\ttoffalt = \"Underwear\";\n\t\t}\n\n\t\tif (rnd1 === 9) {\n\t\t\tto1img = 'turnon9.png';\n\t\t\tto1alt = 'Vampirism';\n\t\t} else if (rnd2 === 9) {\n\t\t\tto2img = \"turnon9.png\";\n\t\t\tto2alt = \"Vampirism\";\n\t\t} else if (rnd3 === 9) {\n\t\t\ttoffimg = \"turnoff9.png\";\n\t\t\ttoffalt = \"Vampirism\";\n\t\t}\n\n\t\tif (rnd1 === 10) {\n\t\t\tto1img = 'turnon10.png';\n\t\t\tto1alt = 'Facial hair';\n\t\t} else if (rnd2 === 10) {\n\t\t\tto2img = \"turnon10.png\";\n\t\t\tto2alt = \"Facial hair\";\n\t\t} else if (rnd3 === 10) {\n\t\t\ttoffimg = \"turnoff10.png\";\n\t\t\ttoffalt = \"Facial hair\";\n\t\t}\n\n\t\tif (rnd1 === 11) {\n\t\t\tto1img = 'turnon11.png';\n\t\t\tto1alt = 'Glasses';\n\t\t} else if (rnd2 === 11) {\n\t\t\tto2img = \"turnon11.png\";\n\t\t\tto2alt = \"Glasses\";\n\t\t} else if (rnd3 === 11) {\n\t\t\ttoffimg = \"turnoff11.png\";\n\t\t\ttoffalt = \"Glasses\";\n\t\t}\n\n\t\tif (rnd1 === 12) {\n\t\t\tto1img = 'turnon12.png';\n\t\t\tto1alt = 'Makeup';\n\t\t} else if (rnd2 === 12) {\n\t\t\tto2img = \"turnon12.png\";\n\t\t\tto2alt = \"Makeup\";\n\t\t} else if (rnd3 === 12) {\n\t\t\ttoffimg = \"turnoff12.png\";\n\t\t\ttoffalt = \"Makeup\";\n\t\t}\n\n\t\tif (rnd1 === 13) {\n\t\t\tto1img = 'turnon13.png';\n\t\t\tto1alt = 'Face paint';\n\t\t} else if (rnd2 === 13) {\n\t\t\tto2img = \"turnon13.png\";\n\t\t\tto2alt = \"Face paint\";\n\t\t} else if (rnd3 === 13) {\n\t\t\ttoffimg = \"turnoff13.png\";\n\t\t\ttoffalt = \"Face paint\";\n\t\t}\n\n\t\tif (rnd1 === 14) {\n\t\t\tto1img = 'turnon14.png';\n\t\t\tto1alt = 'Hats';\n\t\t} else if (rnd2 === 14) {\n\t\t\tto2img = \"turnon14.png\";\n\t\t\tto2alt = \"Hats\";\n\t\t} else if (rnd3 === 14) {\n\t\t\ttoffimg = \"turnoff14.png\";\n\t\t\ttoffalt = \"Hats\";\n\t\t}\n\n\t\tif (rnd1 === 15) {\n\t\t\tto1img = 'turnon15.png';\n\t\t\tto1alt = 'Blond hair';\n\t\t} else if (rnd2 === 15) {\n\t\t\tto2img = \"turnon15.png\";\n\t\t\tto2alt = \"Blond hair\";\n\t\t} else if (rnd3 === 15) {\n\t\t\ttoffimg = \"turnoff15.png\";\n\t\t\ttoffalt = \"Blond hair\";\n\t\t}\n\n\t\tif (rnd1 === 16) {\n\t\t\tto1img = 'turnon16.png';\n\t\t\tto1alt = 'Red hair';\n\t\t} else if (rnd2 === 16) {\n\t\t\tto2img = \"turnon16.png\";\n\t\t\tto2alt = \"Red hair\";\n\t\t} else if (rnd3 === 16) {\n\t\t\ttoffimg = \"turnoff16.png\";\n\t\t\ttoffalt = \"Red hair\";\n\t\t}\n\n\t\tif (rnd1 === 17) {\n\t\t\tto1img = 'turnon17.png';\n\t\t\tto1alt = 'Brown hair';\n\t\t} else if (rnd2 === 17) {\n\t\t\tto2img = \"turnon17.png\";\n\t\t\tto2alt = \"Brown hair\";\n\t\t} else if (rnd3 === 17) {\n\t\t\ttoffimg = \"turnoff17.png\";\n\t\t\ttoffalt = \"Brown hair\";\n\t\t}\n\n\t\tif (rnd1 === 18) {\n\t\t\tto1img = 'turnon18.png';\n\t\t\tto1alt = 'Black hair';\n\t\t} else if (rnd2 === 18) {\n\t\t\tto2img = \"turnon18.png\";\n\t\t\tto2alt = \"Black hair\";\n\t\t} else if (rnd3 === 18) {\n\t\t\ttoffimg = \"turnoff18.png\";\n\t\t\ttoffalt = \"Black hair\";\n\t\t}\n\n\t\tif (rnd1 === 19) {\n\t\t\tto1img = 'turnon19.png';\n\t\t\tto1alt = 'Custom hair';\n\t\t} else if (rnd2 === 19) {\n\t\t\tto2img = \"turnon19.png\";\n\t\t\tto2alt = \"Custom hair\";\n\t\t} else if (rnd3 === 19) {\n\t\t\ttoffimg = \"turnoff19.png\";\n\t\t\ttoffalt = \"Custom hair\";\n\t\t}\n\n\t\tif (rnd1 === 20) {\n\t\t\tto1img = 'turnon20.png';\n\t\t\tto1alt = 'Works Hard';\n\t\t} else if (rnd2 === 20) {\n\t\t\tto2img = \"turnon20.png\";\n\t\t\tto2alt = \"Works Hard\";\n\t\t} else if (rnd3 === 20) {\n\t\t\ttoffimg = \"turnoff20.png\";\n\t\t\ttoffalt = \"Works Hard\";\n\t\t}\n\n\t\tif (rnd1 === 21) {\n\t\t\tto1img = 'turnon21.png';\n\t\t\tto1alt = 'Unemployed';\n\t\t} else if (rnd2 === 21) {\n\t\t\tto2img = \"turnon21.png\";\n\t\t\tto2alt = \"Unemployed\";\n\t\t} else if (rnd3 === 21) {\n\t\t\ttoffimg = \"turnoff21.png\";\n\t\t\ttoffalt = \"Unemployed\";\n\t\t}\n\n\t\tif (rnd1 === 22) {\n\t\t\tto1img = 'turnon22.png';\n\t\t\tto1alt = 'Logical';\n\t\t} else if (rnd2 === 22) {\n\t\t\tto2img = \"turnon22.png\";\n\t\t\tto2alt = \"Logical\";\n\t\t} else if (rnd3 === 22) {\n\t\t\ttoffimg = \"turnoff22.png\";\n\t\t\ttoffalt = \"Logical\";\n\t\t}\n\n\t\tif (rnd1 === 23) {\n\t\t\tto1img = 'turnon23.png';\n\t\t\tto1alt = 'Charismatic';\n\t\t} else if (rnd2 === 23) {\n\t\t\tto2img = \"turnon22.png\";\n\t\t\tto2alt = \"Charismatic\";\n\t\t} else if (rnd3 === 23) {\n\t\t\ttoffimg = \"turnoff23.png\";\n\t\t\ttoffalt = \"Charismatic\";\n\t\t}\n\n\t\tif (rnd1 === 24) {\n\t\t\tto1img = 'turnon24.png';\n\t\t\tto1alt = 'Good Cook';\n\t\t} else if (rnd2 === 24) {\n\t\t\tto2img = \"turnon24.png\";\n\t\t\tto2alt = \"Good Cook\";\n\t\t} else if (rnd3 === 24) {\n\t\t\ttoffimg = \"turnoff24.png\";\n\t\t\ttoffalt = \"Good Cook\";\n\t\t}\n\n\t\tif (rnd1 === 25) {\n\t\t\tto1img = 'turnon25.png';\n\t\t\tto1alt = 'Mechanic';\n\t\t} else if (rnd2 === 25) {\n\t\t\tto2img = \"turnon25.png\";\n\t\t\tto2alt = \"Mechanic\";\n\t\t} else if (rnd3 === 25) {\n\t\t\ttoffimg = \"turnoff25.png\";\n\t\t\ttoffalt = \"Mechanic\";\n\t\t}\n\n\t\tif (rnd1 === 26) {\n\t\t\tto1img = 'turnon26.png';\n\t\t\tto1alt = 'Creative';\n\t\t} else if (rnd2 === 26) {\n\t\t\tto2img = \"turnon26.png\";\n\t\t\tto2alt = \"Creative\";\n\t\t} else if (rnd3 === 26) {\n\t\t\ttoffimg = \"turnoff26.png\";\n\t\t\ttoffalt = \"Creative\";\n\t\t}\n\n\t\tif (rnd1 === 27) {\n\t\t\tto1img = 'turnon27.png';\n\t\t\tto1alt = 'Athletic';\n\t\t} else if (rnd2 === 27) {\n\t\t\tto2img = \"turnon27.png\";\n\t\t\tto2alt = \"Athletic\";\n\t\t} else if (rnd3 === 27) {\n\t\t\ttoffimg = \"turnoff27.png\";\n\t\t\ttoffalt = \"Athletic\";\n\t\t}\n\n\t\tif (rnd1 === 28) {\n\t\t\tto1img = 'turnon28.png';\n\t\t\tto1alt = 'Good Cleaner';\n\t\t} else if (rnd2 === 28) {\n\t\t\tto2img = \"turnon28.png\";\n\t\t\tto2alt = \"Good Cleaner\";\n\t\t} else if (rnd3 === 28) {\n\t\t\ttoffimg = \"turnoff28.png\";\n\t\t\ttoffalt = \"Good Cleaner\";\n\t\t}\n\n\t\tif (rnd1 === 29) {\n\t\t\tto1img = 'turnon29.png';\n\t\t\tto1alt = 'Zombie';\n\t\t} else if (rnd2 === 29) {\n\t\t\tto2img = \"turnon29.png\";\n\t\t\tto2alt = \"Zombie\";\n\t\t} else if (rnd3 === 29) {\n\t\t\ttoffimg = \"turnoff29.png\";\n\t\t\ttoffalt = \"Zombie\";\n\t\t}\n\n\t\tif (rnd1 === 30) {\n\t\t\tto1img = 'turnon30.png';\n\t\t\tto1alt = 'Jewelry';\n\t\t} else if (rnd2 === 30) {\n\t\t\tto2img = \"turnon30.png\";\n\t\t\tto2alt = \"Jewelry\";\n\t\t} else if (rnd3 === 30) {\n\t\t\ttoffimg = \"turnoff30.png\";\n\t\t\ttoffalt = \"Jewelry\";\n\t\t}\n\n\t\tif (rnd1 === 31) {\n\t\t\tto1img = 'turnon31.png';\n\t\t\tto1alt = 'Servo';\n\t\t} else if (rnd2 === 31) {\n\t\t\tto2img = \"turnon31.png\";\n\t\t\tto2alt = \"Servo\";\n\t\t} else if (rnd3 === 31) {\n\t\t\ttoffimg = \"turnoff31.png\";\n\t\t\ttoffalt = \"Servo\";\n\t\t}\n\n\t\tif (rnd1 === 32) {\n\t\t\tto1img = 'turnon32.png';\n\t\t\tto1alt = 'Plant Sim';\n\t\t} else if (rnd2 === 32) {\n\t\t\tto2img = \"turnon32.png\";\n\t\t\tto2alt = \"Plant Sim\";\n\t\t} else if (rnd3 === 32) {\n\t\t\ttoffimg = \"turnoff32.png\";\n\t\t\ttoffalt = \"Plant Sim\";\n\t\t}\n\n\t\tif (rnd1 === 33) {\n\t\t\tto1img = 'turnon33.png';\n\t\t\tto1alt = 'Werewolf';\n\t\t} else if (rnd2 === 33) {\n\t\t\tto2img = \"turnon33.png\";\n\t\t\tto2alt = \"Werewolf\";\n\t\t} else if (rnd3 === 33) {\n\t\t\ttoffimg = \"turnoff33.png\";\n\t\t\ttoffalt = \"Werewolf\";\n\t\t}\n\n\t\tif (rnd1 === 34) {\n\t\t\tto1img = 'turnon34.png';\n\t\t\tto1alt = 'Witch';\n\t\t} else if (rnd2 === 34) {\n\t\t\tto2img = \"turnon34.png\";\n\t\t\tto2alt = \"Witch\";\n\t\t} else if (rnd3 === 34) {\n\t\t\ttoffimg = \"turnoff34.png\";\n\t\t\ttoffalt = \"Witch\";\n\t\t}\n\n\t\t// Once all checks are done, set the appropriate image and alt text\n\t\t$(\"#ton1\").attr(\"src\", s2path + to1img);\n\t\t$(\"#ton1\").attr(\"alt\", to1alt);\n\t\t$(\"#ton2\").attr(\"src\", s2path + to2img);\n\t\t$(\"#ton2\").attr(\"alt\", to2alt);\n\t\t$(\"#toff\").attr(\"src\", s2path + toffimg);\n\t\t$(\"#toff\").attr(\"alt\", toffalt);\n\t}", "function operator(){\r\n var x = Math.floor((Math.random()*4)+1);\r\n\r\n switch (x){\r\n case 1:\r\n return op=\"+\";\r\n case 2:\r\n return op = \"-\";\r\n case 3:\r\n return op = \"*\";\r\n case 4:\r\n return op = \"/\";\r\n }\r\n}", "function createRandomOperation() {\n newOperation = document.getElementById('new-op');\n \n randomBoolean = Math.random() >= 0.5;\n secondNumber = (randomBoolean?1:-1)*rngInRange(1,11);\n secondNumber = (randomBoolean?secondNumber:'('+secondNumber+')');\n\n newOperation.innerHTML = rngInRange(-50,51)+\" \"+randomOperator()+\" \"+secondNumber;\n}", "function training() {\n jessica();\n kp();\n john();\n }", "function Maths()\n{\n this.randomNumber;\n this.randomInt;\n\n/**\n * Returns a random number between min and max\n */\n this.randomNumber = function(min, max)\n {\n return Math.random() * (max - min) + min;\n }\n \n/**\n * Returns a random integer between min and max\n * Using Math.round() will give you a non-uniform distribution!\n */\n this.randomInt = function(min, max)\n {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n }\n\n}", "function generateTarget(){\n return Math.floor(Math.random()*10)\n \n}", "function random() {\n return Math.round(Math.random() * 20);\n}", "function obtenerAleatorio(){\n\treturn Math.random();\n}", "function myFunction(number) {\r\n return number * Math.random();\r\n}", "function randomA() {\n return Math.floor(5 + Math.random()*15);\n}", "function typeGen() {\n var rand = Math.random();\n if (rand <= .33) {\n return \"Ancient Dragon\";\n } else if (rand >= .66) {\n return \"Prowler\";\n } else {\n return \"Mighty Grunt\";\n }\n}", "function func1 (input){ //'Input' refers to func2 from below - line 118.\n return input(Math.floor(Math.random()*10));\n}", "function aleatorio (min,max)\r\n{\r\n var result;\r\n result = Math.floor(Math.random()*(max-min + 1))+min;\r\n return result; // Return result guarda el resultado en la funcion, podemos asignar la funcion auna variable,\r\n // de este modo se guardara el valor de result en la variable\r\n}", "function factory(type, config, load, typed, math) {\n var matrix = load(__webpack_require__(1));\n\n var array = __webpack_require__(2); // seeded pseudo random number generator\n\n\n var rng = load(__webpack_require__(293));\n /**\n * Create a distribution object with a set of random functions for given\n * random distribution.\n *\n * Syntax:\n *\n * math.distribution(name)\n *\n * Examples:\n *\n * const normalDist = math.distribution('normal') // create a normal distribution\n * normalDist.random(0, 10) // get a random value between 0 and 10\n *\n * See also:\n *\n * random, randomInt, pickRandom\n *\n * @param {string} name Name of a distribution. Choose from 'uniform', 'normal'.\n * @return {Object} Returns a distribution object containing functions:\n * `random([size] [, min] [, max])`,\n * `randomInt([min] [, max])`,\n * `pickRandom(array)`\n */\n\n function distribution(name) {\n if (!distributions.hasOwnProperty(name)) {\n throw new Error('Unknown distribution ' + name);\n }\n\n var args = Array.prototype.slice.call(arguments, 1);\n var distribution = distributions[name].apply(this, args);\n return function (distribution) {\n // This is the public API for all distributions\n var randFunctions = {\n random: function random(arg1, arg2, arg3) {\n var size, min, max;\n\n if (arguments.length > 3) {\n throw new ArgumentsError('random', arguments.length, 0, 3);\n } else if (arguments.length === 1) {\n // `random(max)` or `random(size)`\n if (isCollection(arg1)) {\n size = arg1;\n } else {\n max = arg1;\n }\n } else if (arguments.length === 2) {\n // `random(min, max)` or `random(size, max)`\n if (isCollection(arg1)) {\n size = arg1;\n max = arg2;\n } else {\n min = arg1;\n max = arg2;\n }\n } else {\n // `random(size, min, max)`\n size = arg1;\n min = arg2;\n max = arg3;\n } // TODO: validate type of size\n\n\n if (min !== undefined && !isNumber(min) || max !== undefined && !isNumber(max)) {\n throw new TypeError('Invalid argument in function random');\n }\n\n if (max === undefined) max = 1;\n if (min === undefined) min = 0;\n\n if (size !== undefined) {\n var res = _randomDataForMatrix(size.valueOf(), min, max, _random);\n\n return type.isMatrix(size) ? matrix(res) : res;\n }\n\n return _random(min, max);\n },\n randomInt: typed({\n 'number | Array': function numberArray(arg) {\n var min = 0;\n\n if (isCollection(arg)) {\n var size = arg;\n var max = 1;\n\n var res = _randomDataForMatrix(size.valueOf(), min, max, _randomInt);\n\n return type.isMatrix(size) ? matrix(res) : res;\n } else {\n var _max = arg;\n return _randomInt(min, _max);\n }\n },\n 'number | Array, number': function numberArrayNumber(arg1, arg2) {\n if (isCollection(arg1)) {\n var size = arg1;\n var max = arg2;\n var min = 0;\n\n var res = _randomDataForMatrix(size.valueOf(), min, max, _randomInt);\n\n return type.isMatrix(size) ? matrix(res) : res;\n } else {\n var _min = arg1;\n var _max2 = arg2;\n return _randomInt(_min, _max2);\n }\n },\n 'Array, number, number': function ArrayNumberNumber(size, min, max) {\n var res = _randomDataForMatrix(size.valueOf(), min, max, _randomInt);\n\n return size && size.isMatrix === true ? matrix(res) : res;\n }\n }),\n pickRandom: typed({\n 'Array': function Array(possibles) {\n return _pickRandom(possibles);\n },\n 'Array, number | Array': function ArrayNumberArray(possibles, arg2) {\n var number, weights;\n\n if (Array.isArray(arg2)) {\n weights = arg2;\n } else if (isNumber(arg2)) {\n number = arg2;\n } else {\n throw new TypeError('Invalid argument in function pickRandom');\n }\n\n return _pickRandom(possibles, number, weights);\n },\n 'Array, number | Array, Array | number': function ArrayNumberArrayArrayNumber(possibles, arg2, arg3) {\n var number, weights;\n\n if (Array.isArray(arg2)) {\n weights = arg2;\n number = arg3;\n } else {\n weights = arg3;\n number = arg2;\n }\n\n if (!Array.isArray(weights) || !isNumber(number)) {\n throw new TypeError('Invalid argument in function pickRandom');\n }\n\n return _pickRandom(possibles, number, weights);\n }\n })\n };\n\n function _pickRandom(possibles, number, weights) {\n var single = typeof number === 'undefined';\n\n if (single) {\n number = 1;\n }\n\n if (type.isMatrix(possibles)) {\n possibles = possibles.valueOf(); // get Array\n } else if (!Array.isArray(possibles)) {\n throw new TypeError('Unsupported type of value in function pickRandom');\n }\n\n if (array.size(possibles).length > 1) {\n throw new Error('Only one dimensional vectors supported');\n }\n\n var totalWeights = 0;\n\n if (typeof weights !== 'undefined') {\n if (weights.length !== possibles.length) {\n throw new Error('Weights must have the same length as possibles');\n }\n\n for (var i = 0, len = weights.length; i < len; i++) {\n if (!isNumber(weights[i]) || weights[i] < 0) {\n throw new Error('Weights must be an array of positive numbers');\n }\n\n totalWeights += weights[i];\n }\n }\n\n var length = possibles.length;\n\n if (length === 0) {\n return [];\n } else if (number >= length) {\n return number > 1 ? possibles : possibles[0];\n }\n\n var result = [];\n var pick;\n\n while (result.length < number) {\n if (typeof weights === 'undefined') {\n pick = possibles[Math.floor(rng() * length)];\n } else {\n var randKey = rng() * totalWeights;\n\n for (var _i = 0, _len = possibles.length; _i < _len; _i++) {\n randKey -= weights[_i];\n\n if (randKey < 0) {\n pick = possibles[_i];\n break;\n }\n }\n }\n\n if (result.indexOf(pick) === -1) {\n result.push(pick);\n }\n }\n\n return single ? result[0] : result; // TODO: add support for multi dimensional matrices\n }\n\n function _random(min, max) {\n return min + distribution() * (max - min);\n }\n\n function _randomInt(min, max) {\n return Math.floor(min + distribution() * (max - min));\n } // This is a function for generating a random matrix recursively.\n\n\n function _randomDataForMatrix(size, min, max, randFunc) {\n var data = [];\n size = size.slice(0);\n\n if (size.length > 1) {\n for (var i = 0, length = size.shift(); i < length; i++) {\n data.push(_randomDataForMatrix(size, min, max, randFunc));\n }\n } else {\n for (var _i2 = 0, _length = size.shift(); _i2 < _length; _i2++) {\n data.push(randFunc(min, max));\n }\n }\n\n return data;\n }\n\n return randFunctions;\n }(distribution);\n } // Each distribution is a function that takes no argument and when called returns\n // a number between 0 and 1.\n\n\n var distributions = {\n uniform: function uniform() {\n return rng;\n },\n // Implementation of normal distribution using Box-Muller transform\n // ref : http://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform\n // We take : mean = 0.5, standard deviation = 1/6\n // so that 99.7% values are in [0, 1].\n normal: function normal() {\n return function () {\n var u1;\n var u2;\n var picked = -1; // We reject values outside of the interval [0, 1]\n // TODO: check if it is ok to do that?\n\n while (picked < 0 || picked > 1) {\n u1 = rng();\n u2 = rng();\n picked = 1 / 6 * Math.pow(-2 * Math.log(u1), 0.5) * Math.cos(2 * Math.PI * u2) + 0.5;\n }\n\n return picked;\n };\n }\n };\n distribution.toTex = undefined; // use default template\n\n return distribution;\n}", "function set_random_state() {\n min = Math.ceil(1);\n max = Math.floor(50);\n return Math.floor(Math.random() * (max - min + 1)) + min;\n \n }", "function heal() {\n // Do something...\n}", "function myFunction(randInput){\n console.log(randInput);\n}", "function startRandomGame() {\n\n}", "static async random() {\n let t = new NeuroTrader();\n await t.mutate(1, 1); // randomize it\n return t;\n }", "function randomShift(mode){\r\n\tvar randNum = 0;\r\n\t\r\n\trandNum = Math.random();\r\n\t\r\n\t//binary mode: output = 0 or 1\r\n\tif (mode == \"binary\"){\r\n\t\tif (randNum < 0.50){\r\n\t\t\trandNum = 0;\r\n\t\t} else randNum = 1;\r\n\t}\r\n\t\r\n\t//ternary mode: output = -1 or 0 or 1\r\n\tif (mode == \"ternary\"){\r\n\t\tif (randNum < 0.33) {\r\n\t\t\trandNum = -1;\r\n\t\t} else if (randNum < 0.66) {\r\n\t\t\trandNum = 0;\r\n\t\t} else randNum = 1;\r\n\t}\r\n\treturn randNum;\r\n\t\r\n}", "function doWhatItSays() {\n\tfs.readFile('random.txt', 'utf8' , function(err, data) {\n\t\tif(err) throw err;\n\t\tconsole.log(data);\n\n\t\tvar dataArr = data.split(',');\n\n\t\tfunctionName = dataArr[0].trim();\n\t\tfunctionParameters = dataArr[1].trim();\n\n\n\n\t// re-use switch for search parameters\n\t \n\tswitch (functionName) {\n\t\tcase 'my-tweets':\n\t \t showTweets();\n \t break;\n\t \tcase 'spotify-this-song': \n\t \t mySpotify(functionParameters);\n\t\t break;\n\t \tcase 'movie-this':\n\t \t movieThis(functionParameters);\n\t \t break;\n\t \tcase 'do-what-it-says':\n\t \t doWhatItSays();\n\t\t break;\n\t \tdefault:\n\t \t console.log(\"Invalid Command. Please try again!\");\n\t\t}\n\t});\n\n\n}", "function distribution() {}", "function aleatorio(min ,maxi){\n var resultado;\n resultado = Math.floor(Math.random() * (maxi - min + 1)) + min;\n return resultado;\n}", "function factory (type, config, load, typed, math) {\n var matrix = load(__webpack_require__(0));\n var array = __webpack_require__(3);\n\n // seeded pseudo random number generator\n var rng = load(__webpack_require__(661));\n\n /**\n * Create a distribution object with a set of random functions for given\n * random distribution.\n *\n * Syntax:\n *\n * math.distribution(name)\n *\n * Examples:\n *\n * var normalDist = math.distribution('normal'); // create a normal distribution\n * normalDist.random(0, 10); // get a random value between 0 and 10\n *\n * See also:\n *\n * random, randomInt, pickRandom\n *\n * @param {string} name Name of a distribution. Choose from 'uniform', 'normal'.\n * @return {Object} Returns a distribution object containing functions:\n * `random([size] [, min] [, max])`,\n * `randomInt([min] [, max])`,\n * `pickRandom(array)`\n */\n function distribution(name) {\n if (!distributions.hasOwnProperty(name))\n throw new Error('Unknown distribution ' + name);\n\n var args = Array.prototype.slice.call(arguments, 1),\n distribution = distributions[name].apply(this, args);\n\n return (function(distribution) {\n\n // This is the public API for all distributions\n var randFunctions = {\n\n random: function(arg1, arg2, arg3) {\n var size, min, max;\n\n if (arguments.length > 3) {\n throw new ArgumentsError('random', arguments.length, 0, 3);\n } else if (arguments.length === 1) {\n // `random(max)` or `random(size)`\n if (isCollection(arg1)) {\n size = arg1;\n } else {\n max = arg1;\n }\n } else if (arguments.length === 2) {\n // `random(min, max)` or `random(size, max)`\n if (isCollection(arg1)) {\n size = arg1;\n max = arg2;\n } else {\n min = arg1;\n max = arg2;\n }\n } else {\n // `random(size, min, max)`\n size = arg1;\n min = arg2;\n max = arg3;\n }\n\n // TODO: validate type of size\n if ((min !== undefined && !isNumber(min)) || (max !== undefined && !isNumber(max))) {\n throw new TypeError('Invalid argument in function random');\n }\n\n if (max === undefined) max = 1;\n if (min === undefined) min = 0;\n if (size !== undefined) {\n var res = _randomDataForMatrix(size.valueOf(), min, max, _random);\n return type.isMatrix(size) ? matrix(res) : res;\n }\n return _random(min, max);\n },\n\n randomInt: typed({\n 'number | Array': function(arg) {\n var min = 0;\n\n if (isCollection(arg)) {\n var size = arg;\n var max = 1;\n var res = _randomDataForMatrix(size.valueOf(), min, max, _randomInt);\n return type.isMatrix(size) ? matrix(res) : res;\n } else {\n var max = arg;\n return _randomInt(min, max);\n }\n },\n 'number | Array, number': function(arg1, arg2) {\n if (isCollection(arg1)) {\n var size = arg1;\n var max = arg2;\n var min = 0;\n var res = _randomDataForMatrix(size.valueOf(), min, max, _randomInt);\n return type.isMatrix(size) ? matrix(res) : res;\n }\n else {\n var min = arg1;\n var max = arg2;\n return _randomInt(min, max);\n }\n },\n 'Array, number, number': function(size, min, max) {\n var res = _randomDataForMatrix(size.valueOf(), min, max, _randomInt);\n return (size && size.isMatrix === true) ? matrix(res) : res;\n }\n }),\n\n pickRandom: typed({\n 'Array': function(possibles) {\n return _pickRandom(possibles);\n },\n 'Array, number | Array': function(possibles, arg2) {\n var number, weights;\n\n if (Array.isArray(arg2)) {\n weights = arg2;\n } else if (isNumber(arg2)) {\n number = arg2;\n } else {\n throw new TypeError('Invalid argument in function pickRandom')\n }\n\n return _pickRandom(possibles, number, weights);\n },\n 'Array, number | Array, Array | number': function(possibles, arg2, arg3) {\n var number, weights;\n\n if (Array.isArray(arg2)) {\n weights = arg2;\n number = arg3;\n } else {\n weights = arg3;\n number = arg2;\n }\n\n if (!Array.isArray(weights) || !isNumber(number)) {\n throw new TypeError('Invalid argument in function pickRandom');\n }\n\n return _pickRandom(possibles, number, weights);\n }\n })\n }\n\n var _pickRandom = function(possibles, number, weights) {\n var single = (typeof number === 'undefined');\n\n if (single) {\n number = 1;\n }\n\n if (type.isMatrix(possibles)) {\n possibles = possibles.valueOf(); // get Array\n } else if (!Array.isArray(possibles)) {\n throw new TypeError('Unsupported type of value in function pickRandom');\n }\n\n if (array.size(possibles).length > 1) {\n throw new Error('Only one dimensional vectors supported');\n }\n\n if (typeof weights !== 'undefined') {\n if (weights.length != possibles.length) {\n throw new Error('Weights must have the same length as possibles');\n }\n\n var totalWeights = 0;\n\n for (var i = 0, len = weights.length; i < len; i++) {\n if (!isNumber(weights[i]) || weights[i] < 0) {\n throw new Error('Weights must be an array of positive numbers');\n }\n\n totalWeights += weights[i];\n }\n }\n\n var length = possibles.length;\n\n if (length == 0) {\n return [];\n } else if (number >= length) {\n return number > 1 ? possibles : possibles[0];\n }\n\n var result = [];\n var pick;\n\n while (result.length < number) {\n if (typeof weights === 'undefined') {\n pick = possibles[Math.floor(rng() * length)];\n } else {\n var randKey = rng() * totalWeights;\n\n for (var i = 0, len = possibles.length; i < len; i++) {\n randKey -= weights[i];\n\n if (randKey < 0) {\n pick = possibles[i];\n break;\n }\n }\n }\n\n if (result.indexOf(pick) == -1) {\n result.push(pick);\n }\n }\n\n return single ? result[0] : result;\n\n // TODO: add support for multi dimensional matrices\n }\n\n var _random = function(min, max) {\n return min + distribution() * (max - min);\n };\n\n var _randomInt = function(min, max) {\n return Math.floor(min + distribution() * (max - min));\n };\n\n // This is a function for generating a random matrix recursively.\n var _randomDataForMatrix = function(size, min, max, randFunc) {\n var data = [], length, i;\n size = size.slice(0);\n\n if (size.length > 1) {\n for (var i = 0, length = size.shift(); i < length; i++) {\n data.push(_randomDataForMatrix(size, min, max, randFunc));\n }\n } else {\n for (var i = 0, length = size.shift(); i < length; i++) {\n data.push(randFunc(min, max));\n }\n }\n\n return data;\n };\n\n return randFunctions;\n\n })(distribution);\n }\n\n // Each distribution is a function that takes no argument and when called returns\n // a number between 0 and 1.\n var distributions = {\n\n uniform: function() {\n return rng;\n },\n\n // Implementation of normal distribution using Box-Muller transform\n // ref : http://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform\n // We take : mean = 0.5, standard deviation = 1/6\n // so that 99.7% values are in [0, 1].\n normal: function() {\n return function() {\n var u1, u2,\n picked = -1;\n // We reject values outside of the interval [0, 1]\n // TODO: check if it is ok to do that?\n while (picked < 0 || picked > 1) {\n u1 = rng();\n u2 = rng();\n picked = 1/6 * Math.pow(-2 * Math.log(u1), 0.5) * Math.cos(2 * Math.PI * u2) + 0.5;\n }\n return picked;\n }\n }\n };\n\n distribution.toTex = undefined; // use default template\n\n return distribution;\n}", "takeDecision(input) {\n return [(Math.random() - 0.5) / 2, (Math.random() - 0.5) / 2];\n }", "function randomizr(minNum,maxNum){\n\n //console.log(min); - do not use variable from the main code in your functions\n\n //in the function\n console.log(\"Inside the function\");\n\n //use parameters instead of the main code variables\n\n //Find a random number between 2 values\n //Math.random() * ( max value - min value) + min value\n var randomNumber = Math.round ( Math.random() *(maxNum-minNum)+ Number(minNum))\n //console.log(randomNumber); Do Not Use Console.Log inside of a function\n\n //use a return value instead\n return randomNumber;\n}", "function Mice () {\n}", "function random () {\n return MIN_FLOAT * baseRandInt();\n }", "function setTargetValue() {\n targetValue = Math.floor(Math.random() * 100) + 20;\n console.log(\"tv \" + targetValue);\n $(\"#target\").text(targetValue);\n alphaValue = Math.floor(Math.random() * 11) + 1;\n console.log(\"a \" + alphaValue);\n betaValue = Math.floor(Math.random() * 11) + 1;\n console.log(\"b \" + betaValue);\n gammaValue = Math.floor(Math.random() * 11) + 1;\n console.log(\"g \" + gammaValue);\n zappaValue = Math.floor(Math.random() * 11) + 1;\n console.log(\"z \" + zappaValue);\n}", "function LogicNodeRandom() {\n\t\tLogicNode.call(this);\n\t\tthis.wantsProcessCall = true;\n\t\tthis.logicInterface = LogicNodeRandom.logicInterface;\n\t\tthis.type = 'LogicNodeRandom';\n\t}", "function Start () {\n //health = 5;\n delayRotation = Random.Range(0,11);\n newRotation = Random.Range(-361,361);//calculer une angle aléatoire entre -361 et 361\n controller = GetComponent(\"CharacterController\");\n //script = GetComponent(\"AI\");//On recupère le scipt AI qui est un composant\n \n}", "function myFunction(number) {\n return number * Math.random();\n}", "function randomTaunt()\r\n{ \r\n\tif( getTP() > 1 ) { \r\n\t\tsay(randomCitation()); \r\n\t} \r\n}", "function Atan() {\r\n}", "function getRandom() {\n return Math.random();\n}", "function randomizeParameters() {\n CS.strokeS=randomRGBA();\n CS.fillS=randomRGBA();\n CS.lineW=Math.floor(Math.random()*9)+1;\n CS.brushSize=Math.floor(Math.random()*99)+1;\n updateControls();\n // canvas.dispatchEvent(new Event('mousemove')); // trigger updating in place of the brush on the preview layer\n //TODO trigger redraw \"in-place\" on new random event\n }", "awards() {\n return faker.random.number() % 5;\n }", "function randColor() {\n\n // Set random word\n\n\n // Set random word color\n\n\n }", "function morechickens(anyFunction){ console.log(\"Bock bock!\"); anyFunction(); }", "function randomNode() {\n \n}" ]
[ "0.60807693", "0.6039387", "0.59729785", "0.58664095", "0.5840664", "0.582137", "0.5806877", "0.573372", "0.5682601", "0.56586015", "0.5657882", "0.56531197", "0.5651629", "0.56497777", "0.5649004", "0.56451976", "0.5620432", "0.5607213", "0.56043446", "0.56015146", "0.55658925", "0.5562622", "0.55610734", "0.5526048", "0.54947436", "0.54919034", "0.54700506", "0.5461758", "0.5451458", "0.54414314", "0.54399014", "0.5421333", "0.54154974", "0.54110277", "0.5405263", "0.54040074", "0.5401022", "0.54008085", "0.53981745", "0.5396019", "0.5384882", "0.5383998", "0.5383998", "0.53734696", "0.5373159", "0.5371388", "0.5366439", "0.53625673", "0.53621525", "0.5355565", "0.53511757", "0.53452605", "0.53446025", "0.5341316", "0.53384477", "0.53373206", "0.533602", "0.5335892", "0.53315157", "0.5328776", "0.53229356", "0.5319274", "0.5317322", "0.53165483", "0.53157455", "0.5313342", "0.53082496", "0.5305321", "0.5294264", "0.5293063", "0.52930266", "0.5291357", "0.5285699", "0.5279715", "0.5276221", "0.5276005", "0.5271042", "0.5265863", "0.5258228", "0.525215", "0.52520806", "0.5252071", "0.52505237", "0.5247404", "0.5239344", "0.5235028", "0.5229029", "0.52254593", "0.5224416", "0.5221902", "0.5220177", "0.52190536", "0.5215881", "0.52148914", "0.5210279", "0.5209993", "0.5208232", "0.5204619", "0.51996505", "0.5198635", "0.51968974" ]
0.0
-1
This is the AI method that'll be called in the game js file with the possibility to specify the type of the AI
function ai_multi(stones,color,action,type){ if (type=='random'){ if (action=='take'){ return ai_take_random(stones,color); }else{ return ai_random(stones,color,action); } } if (type=='smart'){ if (action=='take'){ return where_mill; }else{ return minmax(stones,color,action,0); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function AI(){\r\n let best_choice=bestOption(game_board);\r\n game_board[Math.floor(best_choice/10)][best_choice%10]='o';\r\n document.getElementById(best_choice).classList.toggle('ring_active'); //display on the website\r\n checkEnd();\r\n }", "function handleAI(paddle1Pos, paddle2Pos, paddle1Height, paddle2Height){\r\n\r\n\tif(GAME.player1 == 'CPU'){\r\n\t\tartificialIntelligence(paddle1Pos,paddle1Height,1,GAME.frameCounter);\r\n\t}\r\n\tif(GAME.player2 == 'CPU'){\r\n\t\tartificialIntelligence(paddle2Pos,paddle2Height,2,GAME.frameCounter);\r\n\t}\r\n}", "function aiFunc(){\n if (playerTurn ==1){\n return\n }\n if (playerTurn == 0){\n if (ai ==1){\n pickSquare ()\n }\n if (ai==2){\n mediumAI ()\n }\n }\n}", "aiTurn(){\n if(this.state.gameOver && this.state.currentTurn === this.state.player_symbol){\n return;\n }\n\n //initialize a bot class and pass over the current board, the ai and player symbol as well as the difficulty\n var ai = new Bot(this.state.board, this.state.ai_symbol, this.state.player_symbol, this.state.bot_difficulty);\n //the ai chooses a move\n this.clickOnField(ai.aiMove());\n }", "onAIAnim(type) {\n if (type == 1) {\n this.monsterAnim.playAnimation('start', 1);\n setTimeout(() => {\n this.onAIAnim(3)\n }, 1000)\n } else if (type == 2)\n this.monsterAnim.playAnimation('fail', 1);\n else if (type == 3)\n this.monsterAnim.playAnimation('stay', -1);\n }", "constructor(name='(AI)'){\n /* Create a new AI object\n :param name: <string> AI's name, default='(AI)'\n */\n super(name);\n }", "setupAI(){\n this.AIBoard = this.makeAIBoard(this.options.numberOfShips);//I assume options.numberOfShips is 1-6 and not 1-21 for the number of cells\n this.lastHitShip = null;\n }", "aiMove() {\n if (DATA.difficultyMode === \"hard\") {\n return this.smartMove(DATA.boardCells, DATA.ai).index;\n } else if (DATA.difficultyMode === \"easy\") {\n return this.easyMove();\n } else {\n let toss = Math.random() * 2;\n if (toss > 1.2) {\n return this.easyMove();\n } else {\n return this.smartMove(DATA.boardCells, DATA.ai).index;\n }\n }\n\n }", "function aiPick() {\r\n aiChoice = Math.floor(Math.random() * 3); \r\n\r\n switch (aiChoice) {\r\n case 0:\r\n aiPokemon = \"water\"\r\n aiIng.setAttribute(\"src\", \"src/pic/s.jpg\");\r\n area.appendChild(aiIng);\r\n break;\r\n case 1:\r\n aiPokemon = \"fire\"\r\n aiIng.setAttribute(\"src\", \"src/pic/c.jpg\");\r\n area.appendChild(aiIng);\r\n break;\r\n case 2:\r\n aiPokemon = \"grass\";\r\n aiIng.setAttribute(\"src\", \"src/pic/b.jpg\");\r\n area.appendChild(aiIng);\r\n break;\r\n default:\r\n Error = \"no pokemon has been chosen\";\r\n }\r\n }", "function AI(identifier,automation)\r\n{\r\n\tconsole.log(identifier,automation)\r\n}", "function makeAIDecision () {\n detectCheat();\n /* determine the AI's decision */\n determineAIAction(players[currentTurn]);\n \n /* update a few hardcoded visuals */\n players[currentTurn].swapping = true;\n players[currentTurn].updateBehaviour(SWAP_CARDS);\n players[currentTurn].commitBehaviourUpdate();\n \n saveSingleTranscriptEntry(currentTurn);\n\n /* wait and implement AI action */\n var n = players[currentTurn].hand.tradeIns.countTrue();\n exchangeCards(currentTurn);\n timeoutID = window.setTimeout(reactToNewAICards,\n Math.max(GAME_DELAY, n ? (n - 1) * ANIM_DELAY + ANIM_TIME + GAME_DELAY / 4 : 0));\n}", "interact(obj, type) {\n if (obj.object.state !== 'idle') return; // Can only activate objects that are idle\n\n if ((obj.object.interactId === 'Water1' && type === 'water') || (CONFIG.DEBUG && obj.object.interactId === 'Water1' && type === 'click')) {\n obj.object.state = 'activated';\n\n this.eeEmit('scene-speech-helper-close');\n this.eeEmit('play-random-action-sound');\n\n obj.object.interactCallback(false);\n this.interactPlank();\n \n this._step++\n\n //this.endAnimation();\n }\n if ((obj.object.interactId === 'Rock' && type === 'wind') || (CONFIG.DEBUG && obj.object.interactId === 'Rock' && type === 'click')) {\n obj.object.state = 'activated';\n\n this.eeEmit('scene-speech-helper-close');\n this.eeEmit('play-random-action-sound');\n\n obj.object.interactCallback();\n this.interactPlank(true);\n this.objects.water.interactCallback(true);\n \n this._step++;\n\n //this.endAnimation();\n }\n if(this._step >= 2) this.endAnimation();\n }", "function Main()\n{\n StartGame();\n GA();\n\n console.log(\"END AI\");\n}", "aiGo() {\r\n let cloneState = new GameState(this.gameState.state);\r\n let aiMove = this.AI.aiMove(cloneState);\r\n this.gameState.makeMove(aiMove, this.curPlayer);\r\n this.updateBoard();\r\n this.curPlayer = 1;\r\n }", "function AI(playerToControl) {\n var ctl = playerToControl;\n var State = {\n WAITING: 0,\n FOLLOWING: 1,\n AIMING: 2\n }\n var currentState = State.FOLLOWING;\n //adding function to AI AimFire Aimining RadomAimFire\n function repeat(cb, cbFinal, interval, count) {\n var timeout = function () {\n repeat(cb, cbFinal, interval, count - 1);\n }\n if (count <= 0) {\n cbFinal();\n } else {\n cb();\n setTimeout(function () {\n repeat(cb, cbFinal, interval, count - 1);\n }, interval);\n }\n }\n\n function aimAndFire() {\n // We'll repeat the motion action 5 to 10 times\n // var numRepeats = Math.floor(5 + Math.random() * 5);\n // COMMENT OUT ABOVE ***************************************************************************************\n\n //function randomMove() {\n // if (Math.random() > .5) {\n // ctl.move(-distance);\n // } else {\n // ctl.move(distance);\n // }\n //}\n // COMMENT OUT ABOVE ***************************************************************************************\n\n function randomAimAndFire() {\n var d = Math.floor(Math.random() * 3 - 1);\n opponent.setAim(d);\n opponent.fire();\n\n // Finally, set the state to FOLLOWING\n currentState = State.FOLLOWING;\n }\n\n repeat(0, randomAimAndFire, 0, 0);\n // SET randomMove 0, internal 0, numRepeats 0 ***************************************************************\n }\n\n function moveTowardsBall() {\n if (ball.getPosition()[1] >= ctl.getPosition()[1] + ctl.getSize() / 2) {\n ctl.move(distance);\n } else {\n ctl.move(-distance);\n }\n setTimeout(function () {\n currentState = State.FOLLOWING;\n }, 100);\n // Change from 400 to 100 ***************************************************************************************\n }\n //Update AI function so it acts according to its state\n function update() {\n switch (currentState) {\n case State.FOLLOWING:\n if (ball.getOwner() === ctl) {\n currentState = State.AIMING;\n aimAndFire();\n } else {\n moveTowardsBall();\n currentState = State.WAITING;\n }\n case State.WAITING:\n break;\n case State.AIMING:\n break;\n }\n }\n\n return {\n update: update\n }\n}", "isAI(){\n\t\treturn !this.player.generated && this.player.isNPC() && this.player.team === Player.TEAM_PLAYER;\n\t}", "function Agent_init() {\n \"use strict\";\n // data for your AI can be initialised here\n var knowledgeBase = new Memory();\n\n // our top level/root behaviour\n var root = new Selector();\n\n // Create Actions\n var forward = new Forward(knowledgeBase); // go forward\n var right = new Right(knowledgeBase); // turn right\n var left = new Left(knowledgeBase); // turn left\n var bump = new Bump(knowledgeBase); // detect when hit a wall\n var use = new Use(knowledgeBase); // interacts with item\n var sense = new JediSense(knowledgeBase); // sense if there is danger directly in front\n var goNoGo = new NearDanger(knowledgeBase); // if safe from stormtroopers or caves\n var tingle = new Tingle(knowledgeBase); // returns object from jedi sense\n var interactable = new Interactable(knowledgeBase); // returns interactable object\n\n // Some sub-sequences -\n var seq1 = new Selector();\n var seq2 = new Sequence();\n var seq3 = new Sequence();\n var seq4 = new Sequence();\n var seq5 = new Sequence();\n var step4 = new Sequence();\n var rndTurn = new NDSelector(); // a non-deterministic sequence\n\n // Add actions to BT\n rndTurn.add_child(right);\n rndTurn.add_child(left);\n\n // third sequence - uses jedi sense and if nothing in front, move forward\n seq2.add_child(sense);\n seq2.add_child(tingle);\n seq2.add_child(forward);\n seq2.add_child(interactable);\n\n // first sequence - if hit wall, turn\n seq3.add_child(bump);\n seq3.add_child(rndTurn);\n\n seq1.add_child(seq3);\n seq1.add_child(seq4);\n\n // fourth sequence - interact with object then continue\n seq5.add_child(use);\n seq5.add_child(seq4);\n\n // second sequence - if there is no danger around, move forward\n seq4.add_child(goNoGo);\n seq4.add_child(forward);\n\n step4.add_child(seq1);\n\n root.add_child(step4);\n root.add_child(seq2);\n root.add_child(seq5);\n root.add_child(right);\n\n // Add BT root to object\n this.root = root;\n this.memory = knowledgeBase;\n}", "function takeANoviceMove(turn) {\n var available = game.currentState.emptyCells();\n //enumerate and calculate the score for each available actions to the ai player\n var availableActions = available.map(function(pos) {\n var action = new AIAction(pos);//create the action object\n //get next state by applying the action\n var next = action.applyTo(game.currentState);\n //calculate and set the action's minimax value;\n action.minimaxVal = minimaxVal(next);\n return action;\n });\n //sort the enumerated actions list by score\n //X maximizes ---> descend sort the actions to have the largest minimax at first\n if (turn === 'X') availableActions.sort(AIAction.DESCENDING);\n //else sort ascending\n else availableActions.sort(AIAction.ASCENDING);\n //take the optimal action 40% of the time\n var chosenAction;\n if (Math.random() * 100 <= 40) chosenAction = availableActions[0];\n //if there are two or more available actions, choose the 1st suboptimal\n else if(availableActions.length >= 2) chosenAction = availableActions[1];\n //choose the only available action\n else chosenAction = availableActions[0];\n var next = chosenAction.applyTo(game.currentState);\n ui.insertAt(chosenAction.movePosition, turn);\n //take the game to the next state\n game.advanceTo(next);\n}", "function runAI(ai = [.5, .5, .5, .5, .5, .5])\n{\n\tif (ai == \"none\")\n\t{\n\t\tnextTurn();\n\t\treturn;\n\t}\n\tselectedShip = \"s\" + turn;\n\tselected = false;\n\tvar finalMove = [];\n\tvar finalShip = [];\n\tvar finalValue = 0;\n\tvar ships = getTurnShips();\n\tif (ships.length == 0) { /*alert(\"no ships\");*/ nextTurn(); return; }\n\n\tfor (var i = 0; i < ships.length;i++)\n\t{\n\t\tvar moves = validMoves(ships[i]);\n\t\tfor (var j = 0; j < moves.length; j++)\n\t\t{\n\t\t\tvar currentValue = assignWeight(ships[i], moves[j],ai)\n\t\t\tif (currentValue > finalValue)\n\t\t\t{\n\t\t\t\tfinalValue = currentValue;\n\t\t\t\tfinalMove = moves[j];\n\t\t\t\tfinalShip = ships[i];\n\t\t\t}\n\t\t}\n\t}\n\t\n\tif (isMoveValid(finalShip, finalMove, true))//checks that a valid move exists\n\t{\n\t\tmoveShip(finalShip, finalMove);\n\t\tupdate(document.getElementById(\"tablehere\"));\n\t\tif (gameover == false) {\n\t\t\tsetTimeout(() => { runAI(); }, time);\n\t\t}\n\t}\n\telse\n\t{\n\t\tsetTimeout(() => { update(document.getElementById(\"tablehere\")); nextTurn(); }, 2*time);\n\t}\n\t\n}", "function aa_type (A,B,C){\r\n if(Tar == 1){UI.SetValue([\"Rage\", \"Anti Aim\", \"Directions\", \"At targets\"],A) }\r\n UI.SetValue([\"Config\",\"Cheat\",\"General\",\"Restrictions\"],0);\r\n UI.SetValue([\"Rage\",\"Anti Aim\",\"General\",\"Pitch mode\"],B);\r\n UI.SetValue([\"Rage\",\"Anti Aim\",\"Directions\",\"Yaw offset\"],C);\r\n}", "function createInitialArena(humanPlayers, AIs) {\n if (humanPlayers + AIs > 4){\n console.log(\"More than 4 players WTH!!!\");\n }\n \n \n var player1 = new Player({cx: 40*1, cy: 40*1, width: 36, height: 36,\n keyUp: 'W'.charCodeAt(0), \n keyDown: 'S'.charCodeAt(0), \n keyLeft: 'A'.charCodeAt(0), \n keyRight: 'D'.charCodeAt(0),\n keyPutBomb: ' '.charCodeAt(0),\n commandObject: keys\n });\n \n var player2 = new Player({cx: 40*13, cy: 40*1, width: 36, height: 36,\n keyUp: 'I'.charCodeAt(0), \n keyDown: 'K'.charCodeAt(0), \n keyLeft: 'J'.charCodeAt(0), \n keyRight: 'L'.charCodeAt(0),\n keyPutBomb: 'O'.charCodeAt(0),\n commandObject: keys \n });\n \n var player3 = new Player({cx: 40*1, cy: 40*13, width: 36, height: 36,\n keyUp: 38, // up arrow\n keyDown: 40, // down arrow\n keyLeft: 37, // left arrow\n keyRight: 39, // right arrow\n keyPutBomb: 13, // enter\n commandObject: keys \n });\n \n var player4 = new Player({cx: 40*13, cy: 40*13, width: 36, height: 36,\n keyUp: 38, // up arrow\n keyDown: 40, // down arrow\n keyLeft: 37, // left arrow\n keyRight: 39, // right arrow\n keyPutBomb: 13, // enter\n commandObject: keys \n });\n \n \n \n \n // Create AI players and command objects\n g_aiCommands.ai1 = {};\n var aiPlayer1 = new Player({cx: 40*1, cy: 40*1, width: 36, height: 36,\n keyUp: consts.CONTROLS.UP, keyDown: consts.CONTROLS.DOWN, \n keyLeft: consts.CONTROLS.LEFT, keyRight: consts.CONTROLS.RIGHT,\n keyPutBomb: consts.CONTROLS.PUT_BOMB,\n commandObject: g_aiCommands.ai1\n });\n \n g_aiCommands.ai2 = {};\n var aiPlayer2 = new Player({cx: 40*13, cy: 40*1, width: 36, height: 36,\n keyUp: consts.CONTROLS.UP, keyDown: consts.CONTROLS.DOWN, \n keyLeft: consts.CONTROLS.LEFT, keyRight: consts.CONTROLS.RIGHT,\n keyPutBomb: consts.CONTROLS.PUT_BOMB,\n commandObject: g_aiCommands.ai2\n });\n \n g_aiCommands.ai3 = {};\n var aiPlayer3 = new Player({cx: 40*1, cy: 40*13, width: 36, height: 36,\n keyUp: consts.CONTROLS.UP, keyDown: consts.CONTROLS.DOWN, \n keyLeft: consts.CONTROLS.LEFT, keyRight: consts.CONTROLS.RIGHT,\n keyPutBomb: consts.CONTROLS.PUT_BOMB,\n commandObject: g_aiCommands.ai3\n });\n \n g_aiCommands.ai4 = {};\n var aiPlayer4 = new Player({cx: 40*13, cy: 40*13, width: 36, height: 36,\n keyUp: consts.CONTROLS.UP, keyDown: consts.CONTROLS.DOWN, \n keyLeft: consts.CONTROLS.LEFT, keyRight: consts.CONTROLS.RIGHT,\n keyPutBomb: consts.CONTROLS.PUT_BOMB,\n commandObject: g_aiCommands.ai4\n });\n \n var players = []; //\n var ai1added = false;\n var ai2added = false;\n var ai3added = false;\n var ai4added = false;\n \n // Fill in slots 1, 4, 2 and 3 in that order\n // Determine slot 1\n if(humanPlayers > 0){\n players.push(player1);\n humanPlayers--;\n }else if(AIs > 0 ){\n players.push(aiPlayer1);\n AIs--;\n ai1added = true;\n }\n \n // Determine slot 4\n if(humanPlayers > 0){\n players.push(player4);\n humanPlayers--;\n }else if(AIs > 0 ){\n players.push(aiPlayer4);\n AIs--;\n ai4added = true;\n }\n \n // Determine slot 2\n if(humanPlayers > 0){\n players.push(player2);\n humanPlayers--;\n }else if(AIs > 0 ){\n players.push(aiPlayer2);\n AIs--;\n ai2added = true;\n }\n \n // Determine slot 3\n if(humanPlayers > 0){\n players.push(player3);\n humanPlayers--;\n }else if(AIs > 0 ){\n players.push(aiPlayer3);\n AIs--;\n ai3added = true;\n }\n \n \n // Initialize arena\n var arena = new Arena(players);\n \n // create Ais for ai players\n var p1Ai = new AI(arena, aiPlayer1, g_aiCommands.ai1);\n var p2Ai = new AI(arena, aiPlayer2, g_aiCommands.ai2);\n var p3Ai = new AI(arena, aiPlayer3, g_aiCommands.ai3);\n var p4Ai = new AI(arena, aiPlayer4, g_aiCommands.ai4);\n \n // add AIs to the entity manager\n if(ai1added){\n entityManager.addAi(p1Ai);\n }\n if(ai2added){\n entityManager.addAi(p2Ai);\n }\n if(ai3added){\n entityManager.addAi(p3Ai);\n }\n if(ai4added){\n entityManager.addAi(p4Ai);\n }\n \n // Set the newly created arena as the default arena\n entityManager.setDefaultArena(arena);\n \n}", "function makeAIMove(){\n let aiMove = calculateBestMove(game)\n game.move(aiMove)\n board.position(game.fen())\n updateStatus()\n}", "function playAlien() {\r\n \r\n}", "function randomAi(options){\n\n this.playerName = this.preferredName;\n\n if (options && options.playerName){\n this.playerName = options.playerName;\n }\n\n this.develop = false;\n\n this.preferredName = \"randomAI\";\n\n this.play = async function(hand, currentCard, play, draw){\n //return draw(this.playerName);\n\n if (!await tryPlay(hand, currentCard, play)){\n hand = await draw(this.playerName);\n }\n };\n\n var tryPlay = async function(hand, currentCard, play){\n //Return true if a card was played\n //Return false if we need to draw a card\n\n console.log(hand);\n console.log(currentCard);\n /*\n Play order:\n\n * Play the first eligable card in the hand\n - If it's a wild, choose a random color\n * Draw a card \n */\n\n for (var i = 0; i < hand.length; i++){\n var possibleCard = hand[i];\n\n //special case if the card up is wild\n //should only happen if the AI is first and the initial card is a wild\n if (currentCard.color === 'wild') {\n await play(possibleCard.color, possibleCard.value, this.playerName);\n return true;\n }\n \n if (possibleCard.color === 'wild'){\n var colors = ['red', 'blue', 'green', 'yellow'];\n var color = colors[Math.floor(Math.random() * colors.length)]; //Randomly choose a color \n\n await play(color, possibleCard.value, this.playerName);\n return true;\n }\n\n if (possibleCard.color === currentCard.color || possibleCard.value === currentCard.value){\n await play(possibleCard.color, possibleCard.value, this.playerName);\n return true;\n }\n }\n\n return false;\n };\n\n return this;\n}", "function Insomniac(position,game){\n return game.play({position,action:\"show\",players:[position]});\n}", "function init() {\n //go through menus\n menus = true;\n //choosing play style\n choosingStyle = true;\n //Display text and buttons\n AI.DecidePlayStyle();\n //load the board and interactable cubes\n LoadBoard();\n LoadInteractables();\n}", "function Awake() {\n\tvar whoami : String = gameObject.name;\n\tif (whoami == \"Hero\") {\n\t\tmyBehavior = new HeroBehavior(gameObject);\n\t} else if (whoami == \"Mob\") {\n\t\tmyBehavior = new MobBehavior(gameObject);\n\t} else if (whoami == \"Sidekick\") {\n\t\tmyBehavior = new SidekickBehavior(gameObject);\n\t} else {\n\t\tmyBehavior = new IBehavior(gameObject);\n\t\tprint(\"No known Behavior Implementation for \" + gameObject.name);\n\t}\n\t\n\tmyBehavior.dieSound = dieSound;\n\tmyBehavior.hurtSound = hurtSound;\n}", "function awardType() {\n switch (true) {\n case (scores < 10):\n trophy.addClass(\"transparent\");\n trophyType.html(\"Award\");\n break;\n case (scores < 25):\n trophy.addClass(\"bronze\");\n trophyType.html(\"Bronze\");\n break;\n case (scores < 50):\n trophy.addClass(\"silver\");\n trophyType.html(\"Silver\");\n break;\n case (scores < 75):\n trophy.addClass(\"gold\");\n trophyType.html(\"Gold\");\n break;\n case (scores < 100):\n trophy.addClass(\"platinum\");\n trophyType.html(\"Platinum\");\n break;\n case (scores >= 100):\n trophy.addClass(\"diamond\");\n trophyType.html(\"Diamond\");\n break;\n default:\n trophy.addClass(\"hide\");\n trophyType.html(\"Award\");\n }\n }", "function playAi(){\r\n\tvar data = {\r\n\t\t\"action\": \"recommend\",\r\n\t\t\"currentPlayer\": playerR.symbol,\r\n\t\t\"board\": {\r\n\t\t\t\"numCols\": NUM_COLS,\r\n\t\t\t\"numRows\": NUM_ROWS,\r\n\t\t\t\"rows\": board\r\n\t\t}\r\n\t};\r\n\r\n\tplayerIsWaiting = true;\r\n\tvar request = $.ajax({\r\n\t\turl: \"/game/play\",\r\n\t\tmethod: \"POST\",\r\n\t\tdata: JSON.stringify(data),\r\n\t\tdataType: \"json\"\r\n\t});\r\n\t\r\n\trequest.done(function(msg) {\r\n\t\tif(msg.exception != undefined){\r\n\t\t\t// Error\r\n\t\t\tif(msg.exception.code == \"COLUMN_FULL\" || msg.exception.code == \"OUT_OF_BOUNDS\"){\r\n\t\t\t\tplayerIsWaiting = false;\r\n\t\t\t}else{\r\n\t\t\t\talert(\"Could not play col '\" + col + \"' because: \" + msg.exception);\r\n\t\t\t}\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tboard = msg.board.rows;\r\n\t\tgameState = msg.gameState;\r\n\t\t// animate AI's play to row\r\n\t\tvar aiDiscTween = drawDisc(playerR, msg.recommendColumn, msg.recommendRow);\r\n\t\t// if AI won, animate opponent won and end game\r\n\t\tif (gameState == GAME_STATE.PLAYER_R_WON) {\r\n\t\t\tshowText(\"The bot won!\");\r\n\t\t} else if (gameState == GAME_STATE.DRAW){\r\n\t\t\tshowText(\"It's a draw!\");\r\n\t\t}\r\n\t\taiDiscTween.onComplete.add(function(){ playerIsWaiting = false; }, this);\r\n\t});\r\n\t\r\n\trequest.fail(function(jqXhr, textStatus) {\r\n\t\talert(\"Request failed: \" + jqXhr.responseText);\r\n\t\tplayerIsWaiting = false;\r\n\t});\r\n}", "function initializeGameType() {\r\n Math.seedrandom(seed);\r\n showTeamModulo = parseInt(variables['showTeamModulo']);\r\n if (showTeamModulo == -1) { \r\n var info = Math.floor(Math.random()*3);\r\n switch (info) {\r\n case 0:\r\n showTeamModulo = 0;\r\n break;\r\n case 1:\r\n showTeamModulo = 1;\r\n break;\r\n default:\r\n showTeamModulo = 3;\r\n break;\r\n }\r\n }\r\n \r\n var best = Math.floor(Math.random()*2);\r\n best = 1; // delme\r\n// alert('best:'+best);\r\n switch (best) {\r\n case 0:\r\n showBest = false;\r\n break;\r\n case 1:\r\n showBest = true;\r\n break;\r\n }\r\n \r\n if (showBest) {\r\n $(\"#prev_solution\").attr(\"value\",\"Load Best Solution\");\r\n $(\"#ii_prev_solution\").attr(\"value\",\"Load Best Solution\");\r\n }\r\n \r\n if (numPlayers < 2) { // delme\r\n forceBots = 2;\r\n }\r\n \r\n// botType = Math.floor(Math.random()*2);\r\n// botType = 0; // delme\r\n\r\n try {\r\n showScore = parseInt(variables['showScore']);\r\n if (isNaN(showScore)) {\r\n throw \"showScore not valid\" // throw error\r\n }\r\n if (showScore < 0) {\r\n showScore = Math.floor(Math.random*2); // 0 or 1\r\n } \r\n switch(showScore) {\r\n case 0:\r\n showScore = false;\r\n break;\r\n default:\r\n showScore = true;\r\n break;\r\n } \r\n } catch (err) {\r\n// alert(err);\r\n try {\r\n showScore = variables['showScore'].toLowerCase() == 'true';\r\n } catch (err2) {\r\n showScore = true;\r\n// alert(err2);\r\n }\r\n }\r\n \r\n try {\r\n showMap = parseInt(variables['showMap']);\r\n if (isNaN(showMap)) {\r\n throw \"showMap not valid\" // throw error\r\n }\r\n if (showMap < 0) {\r\n showMap = Math.floor(Math.random*2); // 0 or 1\r\n } \r\n switch(showMap) {\r\n case 0:\r\n showMap = false;\r\n break;\r\n default:\r\n showMap = true;\r\n break;\r\n } \r\n } catch (err) {\r\n// alert(err);\r\n try {\r\n showMap = variables['showMap'].toLowerCase() == 'true';\r\n } catch (err2) {\r\n showMap = true;\r\n// alert(err2);\r\n }\r\n }\r\n \r\n\r\n \r\n $(\".gameid\").append(botType);\r\n \r\n if (showBest) {\r\n $(\".gameid\").append(\"B\");\r\n } else {\r\n $(\".gameid\").append(\"L\"); \r\n }\r\n $(\".gameid\").append(showTeamModulo);\r\n// alert(showTeamModulo+\" \"+showBest);\r\n\r\n}", "function GameObject(TileNumX,TileNumY,type,imSrc){\n//object types are ENEMYSPAWN,PLAYERSPAWN,EXIT,BLOCK,DOOR\n//GATE,SWITCH. the type isnít for the object to know what to do, but for the\n//player avatar to know what to do in response.\nObjectType = type;\nimageSrc = imSrc;\nisActive = true;\n\nobjectImage = new Image();\n\n//The start function is called by init\nStart();\n}", "function startAI(){\n\tapp.playerTwo.move = function(){\n\t\tif (this.position.y > app.ball.position.y \n\t\t\t&& this.position.y > this.size.height / 2){\n\t\t\tthis.position.y -= 4;\n\t\t}\n\t\tif (this.position.y < app.ball.position.y\n\t\t\t&& this.position.y < app.canvas.height - (this.size.height / 2)){\n\t\t\tthis.position.y += 4;\n\t\t}\n\t}\n}", "function loadAction(name, type) {\n\tif(type == \"video\") {\n\t\tloadHSVideo(name);\n\t}\n\telse if(type == \"text\") {\n\t\tloadHSText(name);\n\t}\n}", "function LoadNext (type : int) {\n\tTime.timeScale = 1;\n\tswitch(type) {\n\tcase 0:\n\t\tLoadChallenge();\n\t\tbreak;\n\tcase 1:\n\t\tgameController.EndGame(false, true);\n\t\tbreak;\n\tcase 2:\n\t\tif(nextLoad == \"MainMenu\") {\n\t\t\tplayerData.characterDone = false;\n\t\t\tplayerData.viewing = false;\n\t\t\tplayerData.difficultyDone = false;\n\t\t}\n\t\tloadingScreen.Load(nextLoad, this.gameObject);\n\t\tbreak;\t\t\n\t}\n}", "function myUpdate () {\r\n //make sure that the time is based on when this script was first called\r\n //instead of when the game started\r\n \t\r\n\ttimeSinceLast += Time.deltaTime; // increment how long it's been since the last update\r\n\tif (timeSinceLast >= timeUntil) {\r\n\t\t// update the random next time to give choices\r\n\t\ttimeUntil = (Random.value * 3.0)+ (3.0*GameStateScript.delayAI/2);\r\n\t\t// above will give 2 seconds - 23 seconds, based on the difficulty level (faster for the harder game)\r\n\t\t\r\n\t\ttimeSinceLast = 0.0;\r\n \r\n //Give some # of choices to both AI and Player\t\r\n\t\tchoices_player = Mathf.Floor(Random.value * 3)+1; // Mathf.CeilToInt(Random.Range(0.1, 2.99));\r\n\t\tchoices_AI = Mathf.Floor(Random.value * 3)+1;\r\n\t\t//Debug.Log(\"Gave \"+choices_player+\" choices to human, and \"+choices_AI+\" to AI\");\r\n //Update GameState to reflect new choices\r\n \t//Update player choices:\r\n \tif ( choices_player == 1 ) { //player gets 1 choice\r\n \t\tupdatePlayerSlotGameState();\r\n \t} else if (choices_player == 2) { //player gets 2 chioces\r\n \t\tupdatePlayerSlotGameState();\r\n \t\tupdatePlayerSlotGameState();\r\n \t} else if (choices_player == 3) {//else choices_player == 3\r\n\t\t\tupdatePlayerSlotGameState();\r\n\t\t\tupdatePlayerSlotGameState();\r\n\t\t\tupdatePlayerSlotGameState();\r\n\t\t} else { // in case something happens, give one\r\n\t\t\tupdatePlayerSlotGameState();\r\n\t\t}\r\n \t\t \r\n //Update AI choices:\r\n \tif ( choices_AI == 1 ) { //AI gets 1 choice\r\n \t\tupdateAISlotGameState();\r\n \t} else if (choices_AI == 2) { //AI gets 2 chioces\r\n \t\tupdateAISlotGameState();\r\n \t\tupdateAISlotGameState();\r\n \t} else if (choices_AI == 3) { //else choices_ai == 0, do nothing\r\n\t\t\tupdateAISlotGameState();\r\n\t\t\tupdateAISlotGameState();\r\n\t\t\tupdateAISlotGameState();\r\n\t\t} else { // in case something happens\r\n\t\t\tupdateAISlotGameState();\r\n\t\t}\r\n \r\n //Update UI with given choices:\r\n //Will be handled by DisplaySlotChoices.js\r\n }//end timerTrigger if statement\t\r\n}", "function AI(_ref) {\n var bot = _ref.bot,\n enumerate = _ref.enumerate,\n visualize = _ref.visualize;\n\n if (!bot) {\n bot = MCTSBot;\n }\n\n return { bot: bot, enumerate: enumerate, visualize: visualize };\n}", "function clickAction(humanChoosen) {\n let humanAction = new PlayerAction(humanChoosen);\n let computerAction = new PlayerAction();\n let choiceOfHuman = humanAction.humanChoice();\n let choiceOfComputer = computerAction.computerChoiceLogic();\n let game = new GameLogic(choiceOfHuman, choiceOfComputer);\n let choosenStyle = new ChoiceMarker(choiceOfHuman, choiceOfComputer)\n console.log(`player choose ${humanChoosen}`);\n playerChooseHistory.push(humanChoosen);\n console.log(`player choice history ${playerChooseHistory}`);\n choosenStyle.playerEffect();\n choosenStyle.comEffect();\n game.playGame();\n}", "function PKAttackNextPlayer() {\n Orion.Ignore(self);\n var target = Orion.FindType(\"-1\", \"-1\", \"ground\", \"human|near|live|ignorefriends\", 18, \"gray|criminal|orange|red|innocent|blue\");\n if (target.length != 0) {\n Orion.Attack(target[0]);\n Orion.Ignore(target[0]);\n } else {\n Orion.IgnoreReset();\n Orion.Ignore(self);\n target = Orion.FindType(\"-1\", \"-1\", \"ground\", \"human|near|live|ignorefriends\", 18, \"gray|criminal|orange|red|innocent|blue\");\n if (target.length != 0) {\n Orion.Attack(target[0]);\n Orion.Ignore(target[0]);\n }\n }\n}", "function ControllerMode_01(_interfaceKO, _mode) {\n var self = this;\n\n var mode = _mode; // {blast4, classic}\n\n self.getMode = function () { return mode; }\n self.bombsOn = function () { return self.getMode() == 'blast4'; }\n self.fullRowOn = function () { return self.getMode() == 'blast4'; }\n\n var lastThrow = null; // { null, 'U (user)', 'C (computer)'}\n\n //To activate throwEffect set throwEffectIni to 'on'\n var THROW_EFFECT_INI = 'off'; // { on, off }\n var throwEffect = THROW_EFFECT_INI;\n\n //To start match in test mode set to true\n var TEST_ON = false;\n self.testOn = function() { return TEST_ON; }\n //To print log at console.\n var LOG_ON = false;\n self.logOn = function() { return LOG_ON; }\n\n\n var TEST_IA = null;\n //To test an specific IA set it in variable TEST_IA \n //TEST_IA = new IA2('classic', true);\n //TEST_IA = new IA2('blast4', true);\n var IA = null;\n\n self.getIA = function () { return IA; }\n\n self.setIA = function () {\n if (TEST_IA != null) {\n window.activeLog(true);\n IA = TEST_IA;\n window.log('play with forced IA ' + IA.getName());\n return;\n }\n\n var iaMatch = null;\n\n if (window.score.matches == 0) {\n // first match with IA2 in blast4 and classic mode.\n iaMatch = new IA2(self.getMode(), false);\n } else { // second match or over\n var randNumber = (Math.floor(Math.random() * 5));\n\n if (self.getMode() == 'blast4') {\n // if user score is equal or higher, IA2 High\n // if is lower, 40 % of times IA1, 60 % of times IA2 (mediumhigh false)\n iaMatch = (window.score.user >= window.score.computer)\n ? new IA2(self.getMode(), true)\n : randNumber <= 1 ? new IA1(self.getMode()) : new IA2(self.getMode(), false);\n } else { // mode classic\n //if user score is equal or higher. set MediumHigh parameter to true\n iaMatch = (window.score.user >= window.score.computer)\n ? new IA2(self.getMode(), true)\n : new IA2(self.getMode(), false); \n }\n }\n\n\n IA = iaMatch;\n window.log('play with IA ' + IA.getName());\n }\n\n\n //Method new match. Clear board and starts new match\n self.newMatch = function() {\n if (self.logOn()) {\n window.activeLog(true);\n }\n\n window.log('new match');\n self.setIA();\n self.lastThrow = null;\n _interfaceKO.board(board.newBoard());\n var dashboard = _interfaceKO.getDashboard();\n _interfaceKO.winner(null);\n\n\n if (self.testOn()) {\n self.throwEffect = 'off';\n window.activeLog(true);\n self.testStartPosition(dashboard);\n return;\n }\n\n if (self.getMode() == 'blast4') {\n self.throwEffect = 'off';\n self.setRandomItems(dashboard);\n } else {\n self.setClassicBoard(dashboard);\n\t }\n\n\n self.throwEffect = THROW_EFFECT_INI;\n if (self.getMode() == 'classic')\n\t self.throwEffect = 'off'; // { on, off }\n }\n\n\n self.userThrow = function (column) {\n if (self.lastThrow == 'U') return;\n self.lastThrow = 'U';\n\n var dashboard = _interfaceKO.getDashboard();\n var row = self.throw(column, \"O\");\n var bomb = self.bombsOn() && board.thereIsBomb(dashboard, column, row);\n\n var next = function () {\n var dashboard = _interfaceKO.getDashboard();\n \n var bombOrFullRow = self.fullRowOn() && (bomb || board.fullRow(dashboard, row));\n\n if (!bombOrFullRow && self.getIA().checkThrowWinner(dashboard, column, row, \"O\")) {\n dashboard[row].cols[column] = 'O' + 'W';\n _interfaceKO.board(dashboard);\n self.showYouWin();\n return;\n }\n\n if (self.fullRowOn()) {\n setTimeout(self.checkFullRow(dashboard, row), (300 + throwEffect ? (row * 80) : 0));\n }\n\n if (!board.checkItemsFree(dashboard)) {\n self.showDraw();\n return;\n }\n\n if (self.bombsOn()) {\n setTimeout(function () { self.checkBomb(dashboard, column, row); }, (300 + throwEffect ? (row * 80) : 0));\n }\n\n setTimeout(function () { self.computerThrow(); }, !bomb ? 800 : 1100);\n };\n\n setTimeout(function () { next(); }, !bomb ? (4 + throwEffect ? (row * 80) : 0) : 20);\n }\n\n\n //Method computerThrow. Called from userThrow\n self.computerThrow = function () {\n var dashboard = _interfaceKO.getDashboard();\n\n var computerThrow = self.getIA().nextComputerThrow(dashboard);\n var row = self.throw(computerThrow, \"X\");\n var bomb = self.bombsOn() && board.thereIsBomb(dashboard, computerThrow, row)\n\n var next = function () {\n dashboard = _interfaceKO.getDashboard();\n\n self.lastThrow = 'C';\n\n var bombOrFullRow = self.fullRowOn() && (bomb || board.fullRow(dashboard, row));\n\n if (!bombOrFullRow && self.getIA().checkThrowWinner(dashboard, computerThrow, row, \"X\")) {\n dashboard[row].cols[computerThrow] = 'X' + 'W';\n _interfaceKO.board(dashboard);\n self.showYouLose();\n return;\n }\n\n if (self.fullRowOn()) {\n setTimeout(self.checkFullRow(dashboard, row), (300 + throwEffect ? (row * 80) : 0));\n }\n\n if (!board.checkItemsFree(dashboard)) {\n self.showDraw();\n return;\n }\n\n if (self.bombsOn()) {\n setTimeout(function () { self.checkBomb(dashboard, computerThrow, row); }, (300 + throwEffect ? (row * 80) : 0));\n }\n }\n\n setTimeout(function () { next(); }, !bomb ? (400 + throwEffect ? (row * 80) : 0) : 20);\n };\n\n\n //Throw action. It sets the state of the dashboard, then KnockOut refresh DOM\n self.throw = function (column, ficha) {\n var dashboard = _interfaceKO.getDashboard();\n var row = board.getLastRowFree(dashboard, column);\n if (row < 0) return;\n var bomb = board.thereIsBomb(dashboard, column, row);\n\n if (self.throwEffect == 'on' && row>0) {\n self.throwMovement(column, ficha, row, 0);\n } else {\n dashboard[row].cols[column] = !bomb ? ficha : null;\n }\n\n _interfaceKO.board(dashboard);\n return row;\n };\n\n\n\n //TODO: Movement in mobile is very slow\n //Activate it only in computers\n //Also suggest a test with several smartphones.\n self.throwMovement = function (column, ficha, row, i) {\n var dashboard = _interfaceKO.getDashboard();\n var _idx = i;\n if (_idx <= row) {\n if (_idx > 0) {\n dashboard[_idx - 1].cols[column] = null;\n }\n\n var bomb = (_idx < row || _idx == 8) ? false\n : dashboard[_idx + 1].cols[column][0] == 'B';\n dashboard[_idx].cols[column] = ficha;\n\n _interfaceKO.board(dashboard);\n\n _idx = _idx + 1;\n }\n\n if (_idx > row) return row;\n\n setTimeout(function () { self.throwMovement(column, ficha, row, _idx); }, 75 - (_idx * 5));\n };\n\n\n\n self.checkBomb = function (dashboard, column, row) {\n if (board.thereIsBomb(dashboard, column, row)) {\n setTimeout(function () { self.bombExplodes(column, row); }, 50);\n return true;\n }\n\n return false;\n }\n\n\n self.bombExplodes = function (column, row) {\n var dashboard = _interfaceKO.getDashboard();\n dashboard[row].cols[column] = null;\n dashboard[row + 1].cols[column] = self.lastThrow == 'U' ? 'BEO' : 'BEX';\n\n\n _interfaceKO.board(dashboard);\n\n window.playAudio(window.audioBomb);\n setTimeout(function () { self.bombDestroys(column, row); }, 350);\n }\n\n\n self.bombDestroys = function (column, row) {\n var dashboard = _interfaceKO.getDashboard();\n dashboard[row + 1].cols[column] = null;\n\n _interfaceKO.board(dashboard);\n }\n\n\n self.checkFullRow = function (dashboard, row) {\n if (board.fullRow(dashboard, row)) {\n window.playAudio(window.audioFullRow);\n setTimeout(function () { self.rowInBlack(dashboard, row); }, 300);\n return true;\n }\n return false;\n }\n\n\n self.rowInBlack = function (dashboard, row) {\n for (var col = 0; col <= (dashboard.length - 1) ; col++) {\n dashboard[row].cols[col] = 'M';\n }\n\n self.throwNewRandomBomb(dashboard);\n _interfaceKO.board(dashboard);\n }\n\n self.throwNewRandomBomb = function (dashboard) {\n var randNumber = (Math.floor(Math.random() * dashboard[0].cols.length));\n //window.log('booomba en col ' + randNumber);\n var row = board.getLastRowFree(dashboard, randNumber);\n //window.log('booomba en row ' + row);\n if (row > 0) dashboard[row].cols[randNumber] = 'B';\n }\n\n\n self.setRandomItems = function (dashboard) {\n //avoid center\n var numBlocks = 0;\n while (numBlocks < 6) {\n var randNumber = (Math.floor(Math.random() * dashboard[0].cols.length));\n\n if (randNumber < 3 || randNumber > 5) {\n self.throw(randNumber, 'M');\n numBlocks = numBlocks + 1;\n }\n }\n\n for (var i = 1; i <= 3; i++) {\n var randNumber = (Math.floor(Math.random() * dashboard[0].cols.length));\n self.bombCol = randNumber;\n self.throw(randNumber, 'B');\n }\n }\n\n self.setClassicBoard = function (dashboard) \n {\n //Cols 0 and 8 locked\n for (var i = 0; i <= 8; i++) {\n self.throw(0, 'M');\n self.throw(8, 'M');\n };\n\n //3 rows locked\n for (i = 1; i <= 3; i++) {\n self.throw(1, 'M'); self.throw(2, 'M'); self.throw(3, 'M'); self.throw(4, 'M');\n self.throw(5, 'M'); self.throw(6, 'M'); self.throw(7, 'M');\n }\n }\n\n self.showYouWin = function () {\n $('#matchResult').attr('src', './img/youWin.png');\n window.playAudio(window.audioWin);\n gameControllerBase.increaseScore('U');\n _interfaceKO.winner(\"You Win!!\");\n self.showOutcomeSentence();\n self.endMatch();\n }\n\n self.showDraw = function () {\n _interfaceKO.winner(\"Draw\");\n self.endMatch();\n }\n\n self.showYouLose = function () {\n $('#matchResult').attr('src', './img/youLose2.png');\n window.playAudio(window.audioLose);\n _interfaceKO.winner(\"I Win\");\n\n gameControllerBase.increaseScore('C');\n self.showOutcomeSentence();\n self.endMatch();\n }\n\n self.showOutcomeSentence = function () {\n\n if (window.score.computer == 0 && window.score.user == 1) {\n $('#outcomeSentence').html(\"Let’s go! I dare you to win 4 matches in a row!\");\n return;\n }\n\n if (window.score.computer == 0 && window.score.user == 4) {\n $('#outcomeSentence').html(\"Excellent! You made it!\");\n return;\n }\n\n if (window.score.computer > window.score.user + 2) {\n $('#outcomeSentence').html(\"Have you tried kids mode?\");\n } else if (window.score.computer == window.score.user + 1 || window.score.computer == window.score.user + 2) {\n $('#outcomeSentence').html(\"I’ll make it easier for you so that you can do it.\");\n } else if (window.score.computer == window.score.user) {\n $('#outcomeSentence').html(\"We’re tied, this is getting exciting...\");\n } else if (window.score.computer == window.score.user - 1) {\n $('#outcomeSentence').html(\"Let’s go! Will you be able to stay ahead?\");\n } else if (window.score.computer < window.score.user) {\n $('#outcomeSentence').html(\"You’re so good! I’ll think a bit more and we’ll see whether you can beat me then\");\n }\n }\n\n self.endMatch = function () {\n setTimeout(function () {\n $('#playAgain').attr('style', 'display: inline-block;');\n $('#matchEndContainer').attr('style', 'display:inline-block');\n }, 600);\n }\n\n\n //To test IA or game in an sepecific scenario\n self.testStartPosition = function (dashboard) {\n self.setClassicBoard(dashboard);\n\n //Cover/No Cover GAP\n //self.throw(2, 'M'); self.throw(3, 'O'); self.throw(5, 'O'); self.throw(6, 'M');\n //return;\n\n //Cover diagonals\n //self.throw(1, 'O'); self.throw(2, 'X'); \n //self.throw(4, 'O'); self.throw(4, 'X'); self.throw(4, 'O'); self.throw(4, 'O');\n //return;\n\n //Cover diagonals\n //self.throw(2, 'X'); self.throw(2, 'O'); self.throw(2, 'X'); self.throw(2, 'O');\n //self.throw(4, 'O'); self.throw(4, 'X'); self.throw(4, 'O');\n //return;\n\n //Test WAIT the check.\n //self.throw(2, 'O'); self.throw(2, 'X');\n //self.throw(3, 'X'); self.throw(3, 'X');\n //self.throw(5, 'X'); self.throw(5, 'X');\n //return;\n\n //Test defense gap below\n //self.throw(2, 'M'); self.throw(3, 'M'); self.throw(4, 'M'); \n //self.throw(2, 'O'); \n //return;\n\n //Test defense gap patter right (offset 2)\n //self.throw(3, 'X'); self.throw(3, 'O');\n //self.throw(5, 'O'); self.throw(5, 'O');\n //return;\n\n //Test defense gap pattern Left (offset 2)\n //self.throw(4, 'X'); self.throw(4, 'O');\n //self.throw(6, 'O'); self.throw(6, 'O');\n //return;\n\n\n\n //Test Attack gap pattern right (offset 2)\n //self.throw(3, 'O'); self.throw(3, 'X');\n //self.throw(5, 'X'); self.throw(5, 'X');\n //return;\n\n\n //Test Attack gap Left (offset 2)\n //self.throw(4, 'O'); self.throw(4, 'X');\n //self.throw(6, 'X'); self.throw(6, 'X');\n //return;\n\n \n //Test eases check mate in col 4.\n //self.throw(2, 'O');\n //self.throw(3, 'X'); self.throw(3, 'X'); self.throw(3, 'O'); self.throw(3, 'X'); self.throw(3, 'X');\n //self.throw(4, 'O'); self.throw(4, 'O'); self.throw(4, 'X'); self.throw(4, 'O');\n //self.throw(5, 'X'); self.throw(5, 'O'); self.throw(5, 'O');\n\n\n\n //Test full row\n //self.throw(0, 'O'); self.throw(1, 'O'); self.throw(2, 'O');\n //self.throw(3, 'X'); self.throw(4, 'X'); self.throw(5, 'X');\n //self.throw(7, 'M'); self.throw(8, 'M');\n\n //self.throw(3, 'X'); self.throw(3, 'O'); self.throw(3, 'X'); self.throw(3, 'X'); self.throw(3, 'O');\n //self.throw(4, 'X'); self.throw(4, 'O');\n //self.throw(5, 'O'); self.throw(5, 'X'); self.throw(5, 'O'); self.throw(5, 'X'); self.throw(5, 'O'); \n //self.throw(6, 'O'); self.throw(6, 'O'); self.throw(6, 'O'); self.throw(6, 'X'); self.throw(6, 'O'); self.throw(6, 'O');\n //self.throw(7, 'M'); self.throw(7, 'M'); self.throw(7, 'M'); self.throw(7, 'M'); self.throw(7, 'M'); self.throw(7, 'M'); self.throw(7, 'O');\n\n //Test Attack GAPPattern\n //self.throw(0, 'M');\n //self.throw(2, 'M'); self.throw(2, 'X');\n //self.throw(3, 'M'); self.throw(3, 'X');\n\n //Test defende GAPPattern\n //self.throw(0, 'M'); \n //self.throw(2, 'M'); self.throw(2, 'O');\n //self.throw(3, 'M'); self.throw(3, 'O');\n\n //Test attack in diagonal\n //self.throw(0, 'X');\n //self.throw(1, 'M');\n //self.throw(2, 'M'); self.throw(2, 'M');\n //self.throw(3, 'M'); self.throw(3, 'M'); self.throw(3, 'M'); self.throw(3, 'X');\n\n //8. test Defense to avoid this situation: Called Pattern4\n // 00\n // 00\n //self.throw(2, 'O');\n //self.throw(2, 'O');\n //self.throw(3, 'O');\n //self.throw(4, 'X');\n\n //To test patter X..X\n //self.throw(0, 'X');\n //self.throw(3, 'X');\n }\n}", "updateAI(){\n\t\tthis.checkIfDangerous()\n\n\t\tif (!this.obstacle) {\n\t\t\tif (!this.hasTarget) {\n\t\t\t\tnutrientsArr.forEach ( nutrient => {\n\t\t\t\t\tconst dis = dist(nutrient.x, nutrient.y, this.x, this.y)\n\t\t\t\t\tif (dis < 100 && this.nutrient != nutrient) {\n\t\t\t\t\t\tthis.hasTarget = true\n\t\t\t\t\t\tthis.nutrient = nutrient\n\t\t\t\t\t\t// console.log(nutrient)\n\t\t\t\t\t}\n\t\t\t\t\t \n\t\t\t\t})\n\t\t\t\tthis.update({headingDegree: map(this.noiseOffset, 0, 1, -3.14, 3.14), fastMode: false})\n\t\t\t\tthis.noiseOffset++\n\t\t\t}\n\t\t\t\n\t\t\telse {\n\t\t\t\tconst dis = dist(this.nutrient.x, this.nutrient.y, this.x, this.y)\n\t\t\t\tif (dis <= 15 || this.aicountdown < 0) {\n\t\t\t\t\tthis.hasTarget = false\n\t\t\t\t\tthis.aicountdown = 50\n\t\t\t\t}\n\t\t\t\t// console.log(this.aicountdown)\n\t\t\t\tthis.aicountdown--\n\t\t\t\tthis.update(AIheadDegree(this.x, this.y, this.nutrient.x, this.nutrient.y, true))\t\n\t\t\t}\n\t\t} else {\n\t\t\tif (this.aicountdownTwo > 0) {\n\n\t\t\t\tconst {headingDegree, fastMode} = AIheadDegree(this.x, this.y, this.obstacle.x, this.obstacle.y)\n\t\t\t\t// console.log(headingDegree)\n\t\t\t\tthis.update({headingDegree: 0 - headingDegree, fastMode: true})\t\n\t\t\t} else {\n\t\t\t\tthis.aicountdownTwo = 30\n\t\t\t\tthis.obstacle = undefined\n\t\t\t}\n\t\t\tthis.aicountdownTwo--\n\t\t}\n\t}", "start() {\n this.aiwon = false;\n this.playerwon = false;\n this.aiDeck = this.shuffle(this.aiDeck);\n this.playerDeck = this.shuffle(this.playerDeck);\n this.startingHand(true);\n this.startingHand(false);\n this.playerMana = 100;\n this.aiMana = 100;\n if (Math.random() < 0.5) {\n this.first = 'player';\n this.playerturn = true;\n } else {\n this.first = 'ai';\n this.playerturn = false;\n }\n }", "function playerChoice(id){\n var choixJ = id.alt;\n console.log(choixJ);\n gameStart(choixJ);\n}", "function AI(player, persona, dg) {\n\t// global graph object\n var g = dg;\n\n ////////////\n // Fields //\n ////////////\n // player which has all the fields\n this.player = player;\n this.name = player.name;\n // Personality map of AI, e.g. priority: 'agressive'\n this.personality = _.object(traitsKey, persona);\n // get this AI's trait, e.g. priority -> [0,1,2,3]\n this.trait = trait;\n function trait(key) {\n return traitsMap[key][this.personality[key]];\n };\n\n // The attack-origin map and priority list\n // enumerate with sublists size = 3 x4 = 12\n this.priorityList = [];\n this.attOrgMap = {};\n\n /////////////\n // Methods //\n /////////////\n this.tradeIn = tradeIn;\n this.getArmies = getArmies;\n // place armies, with threshold step t = 5\n this.placeArmies = placeArmies;\n // count number of armies owned on map\n this.countArmy = countArmy;\n // count number of countries owned\n this.countCountries = countCountries;\n this.countContinents = countContinents;\n\n // The attack moves\n this.attack = attack;\n this.defend = defend;\n this.moveIn = moveIn;\n this.fortify = fortify;\n\n function fortify() {\n \t// console.log(\"fortify\");\n // find border node with lowest pressure\n // find none-border node with AM higher than it\n // if is neigh of it, then move in all but 1\n \n // borders sorted by pressure from lowest\n var coun = _.sortBy(this.player.countries, byPressure);\n var fortified = false;\n // call on coun till fortified one, or none\n for (var i = 0; i < coun.length; i++) {\n // fortify by moving troops from internal node with high pressure\n var found = hiPressNonBorderNeigh(coun[i], this.player);\n // console.log(\"to fortify node\", found);\n if (found != undefined) {\n \tthis.moveIn(found, coun[i]);\n \t// if move in once, done, break\n fortified = true;\n return 0;\n }\n };\n // after trying all, if none, then move anything to a highest pressure border node\n if (!fortified) {\n for (var i = 0; i < coun.length; i++) {\n // console.log(\"fortifying by accumulation\");\n var neighs = _.intersection(coun, g.nodes[coun[i]].adjList);\n var maxNeigh = _.last(neighs);\n if (maxNeigh != undefined) {\n this.moveIn(maxNeigh, coun[i]);\n fortified = true;\n return 0;\n };\n };\n };\n\n // helper: return an ideal hi pressure non-border neighbor that can transfer troop to border node[i]\n function hiPressNonBorderNeigh(i, plyr) {\n var nonBorderNeigh = _.difference(g.nodes[i].adjList, plyr.borders);\n // console.log(\"found neigh\", nonBorderNeigh);\n var neighPressDiff = _.map(nonBorderNeigh, function(k) {\n return g.nodes[k].pressure - g.nodes[i].pressure;\n });\n // the max pressure difference\n var max = _.max(neighPressDiff);\n if (max > 3) {\n \t// console.log(\"found big hike\");\n var mInd = _.findIndex(neighPressDiff, function(m) {\n return Math.floor(Math.abs(m-max))==0;\n });\n // console.log(\"to return\", mInd, nonBorderNeigh[mInd]);\n return nonBorderNeigh[mInd];\n };\n // else return undefine\n }\n // sort helper\n function byPressure(i) {\n return g.nodes[i].pressure;\n }\n };\n\n // move in: always move all but one\n function moveIn(org, tar) {\n \t// console.log(\"moveIn\");\n \t// failsafe\n if (g.nodes[tar].owner != this.name && g.nodes[tar].army != 0) {\n // console.log(\"moveIn error!\")\n };\n // console.log(\"before moveIn\", g.nodes[org].army, g.nodes[tar].army);\n // extract\n var num = g.nodes[org].army;\n // transfer\n g.nodes[tar].army = num - 1;\n g.nodes[org].army = 1;\n // console.log(\"after moveIn\", g.nodes[org].army, g.nodes[tar].army);\n // console.log(\"transferred all but one\", g.nodes[org].army, g.nodes[tar].army);\n };\n\n // defending when enemy rolls 'red' number of dice\n function defend(att) {\n \t// console.log(\"defend\");\n // object returned from attack()\n var org = att.origin;\n var tar = att.target;\n var red = att.roll;\n // to counter, always use max rolls possible\n var need = _.min([2, red]);\n var afford = _.min([need, g.nodes[tar].army]);\n // return white rolls\n return afford;\n };\n\n // attack based on priorityList and personality threshold. Called until return undefined.\n // Return attack request {origin, tar, roll} to dealer\n function attack() {\n \t// console.log(\"attack\");\n // extract personality\n var att = this.personality['attack'];\n var playername = this.player.name;\n\n // for each target, attack if source.army - target.army > threshold\n var prio = this.priorityList;\n var attOrg = this.attOrgMap;\n\n // return att request to dealer\n return strike(this.trait('attack'), playername);\n\n // helper: based on personality threshold, initiate attack by sending request to dealer\n function strike(threshold, playername) {\n if (prio.length == 0) {\n // console.log(\"priority list empty!\");\n };\n // target in prio list, loop\n for (var j = 0; j < prio.length; j++) {\n // att origin\n // i = node index at prio[j]\n var i = prio[j];\n var o = attOrg[i];\n // verify is enemy and origin is self,\n // origin must have at least 2 armies,\n // enemy is still attackable\n if (g.nodes[i].owner != playername &&\n g.nodes[o].owner == playername &&\n g.nodes[o].army >= 2 &&\n g.nodes[i].army > 0) {\n // console.log(\"attempt attack\");\n // check if army number >= threshold/2, so that can keep attacking after first time\n var diff = g.nodes[o].army - g.nodes[i].army;\n // loop until wanna attack, return\n if (diff >= threshold / 2) {\n // number of dice to roll\n var roll = _.min([3, diff]);\n return {\n origin: o,\n target: i,\n roll: roll\n }\n };\n };\n }\n };\n\n };\n\n // count number of continents owned\n function countContinents() {\n \treturn this.player.continents.length;\n }\n // count number of countries owned\n function countCountries() {\n \treturn this.player.countries.length;\n };\n\n // Count its army currently deployed\n function countArmy() {\n var sum = 0;\n _.each(this.player.countries, function(i) {\n sum += g.nodes[i].army;\n })\n return sum;\n };\n\n\n // place armies based on personality, balance pressures\n function placeArmies() {\n \t// console.log(\"placeArmies\");\n // the army counterpressure threshold\n var threshold = 4;\n // extract personality\n var placem = this.personality['placement'];\n\n // the pressures and priority list copied for use\n var press = this.player.pressures;\n var prio = this.priorityList;\n var attOrg = this.attOrgMap;\n\n // deplete armyreserve\n var stock = this.player.armyreserve;\n // console.log(\"army reserve\", stock, prio);\n // console.log(\"countries owned\", this.player.countries);\n // console.log(\"attackable\", this.player.attackable);\n this.player.armyreserve = 0;\n\n if (placem == 'cautious') {\n // balance all pri pressure >0 first,\n distribute(0);\n // then topup priority by half threshold\n while (stock > 0) {\n distribute(threshold / 2);\n };\n }\n // priority pressure >4 +=4 repeatedly\n else if (placem == 'tactical') {\n while (stock > 0) {\n distribute(threshold);\n };\n }\n // helper: distribute 'num' army by priorityList\n function distribute(t) {\n var t = Math.floor(t);\n _.each(prio, function(i) {\n // army needed\n var need = _.max([t + Math.ceil(-press[i]), t]);\n // affordable, either need or stock left\n var afford = _.min([need, stock]);\n // take out, give army to node\n stock -= afford;\n // add army to your attack origin of i\n var org = attOrg[i];\n g.nodes[org].army += afford;\n });\n };\n\n };\n\n // get armies from dealer(given). \n // Add to reserve for placement\n function getArmies(given) {\n this.player.armyreserve += given;\n return given;\n };\n\n // AI trade in cards based on personality, to call giveArmies from dealer\n function tradeIn() {\n \t// console.log(\"tradeIn\");\n // extract personality\n var att = this.personality['attack'];\n\n // the sets of card(indices) to trade in\n var tradeSets = [];\n\n // Rule: if hand has 5 or more cards, must trade\n if (this.player.cards.length > 4) {\n tradeSets.push(findTradeable(this.player));\n }\n // Personality:\n // if is rusher, always trade in all cards\n if (att == 'rusher') {\n var nextSet = findTradeable(this.player);\n // trade till can't\n while (nextSet != undefined) {\n tradeSets.push(nextSet);\n nextSet = findTradeable(this.player);\n }\n }\n // if is carry, trade in all only if region big\n else if (att == 'carry') {\n // use big force when has big region\n if (this.player.regions[0].length > 5) {\n var nextSet = findTradeable(this.player);\n // trade till can't\n while (nextSet != undefined) {\n tradeSets.push(nextSet);\n nextSet = findTradeable(this.player);\n }\n }\n }\n\n // helper: find tradeable set in player's hand\n function findTradeable(player) {\n \t// console.log(\"findTradeable\");\n // hand = indices of cards\n var hand = player.cards;\n var setToTrade = undefined;\n // if have 3 cards n more,\n if (hand.length > 2) {\n // enum subset\n var subset = cmb.combination(hand, 3);\n // loop till found tradeable set\n while (s = subset.next()) {\n var sum = 0;\n _.each(s, function(c) {\n sum += deck[c].picture;\n });\n // 1. same pictures, sum%3 = 0\n // 2. diff pictures, sum%3 = 0\n // 3. any 2 pics w/ 1 wild, sum < 0\n if (sum < 0 || sum % 3 == 0) {\n // found, break and trade it\n setToTrade = s;\n break;\n }\n }\n }\n // update hand\n player.cards = _.difference(hand, setToTrade);\n return setToTrade;\n };\n\n // convert one set (ind arr) to cards arr\n function toCards(setToTrade) {\n return _.map(setToTrade, function(i) {\n return deck[i];\n });\n }\n // Finally, convert all tradeSets to cards\n var tradeSetsAsCards = _.map(tradeSets, toCards);\n return tradeSetsAsCards;\n };\n\n }", "function setAlgorithm(type){\n \n pathfindingStatus = status.ACTIVE;\n \n document.getElementById('PauseButton').disabled = false;\n document.getElementById('StopButton').disabled = false;\n \n if(velocity === velocityEnum.SLOW)\n frameRate(20); // Slow\n else if(velocity === velocityEnum.VERYSLOW)\n frameRate(8); // Very slow\n else\n frameRate(60); // Average (Default)\n \n \n \n \n \n if(type === 'A*_1'){\n // A* (Manhattan)\n currentHeuristicFunc = heuristicEnum.MANHATTAN;\n algorithmInProgress = 'Shortest';\n \n aStarInit();\n currentPathfinding = function(){\n return aStarStep();\n };\n \n }else if(type === 'A*_2'){\n // A* (Euclidean)\n currentHeuristicFunc = heuristicEnum.EUCLIDEAN;\n algorithmInProgress = 'Shortest';\n \n aStarInit();\n currentPathfinding = function(){\n return aStarStep();\n };\n \n }else if(type === 'A*_3'){\n // A* (Chebychev)\n currentHeuristicFunc = heuristicEnum.CHEBYCHEV;\n algorithmInProgress = 'Shortest';\n \n aStarInit();\n currentPathfinding = function(){\n return aStarStep();\n }; \n \n }else if(type === 'Dijkstra'){\n // Dijkstra (A* without heuristic)\n currentHeuristicFunc = heuristicEnum.NONE;\n algorithmInProgress = 'Shortest';\n \n aStarInit();\n currentPathfinding = function(){\n return aStarStep();\n };\n \n }else if(type === 'BFS'){\n // BFS (traversal)\n currentHeuristicFunc = heuristicEnum.NONE;\n algorithmInProgress = 'Traversal';\n \n bfsInit();\n currentPathfinding = function(){\n return bfsStep();\n };\n \n }else if(type === 'DFS'){\n // DFS (traversal)\n currentHeuristicFunc = heuristicEnum.NONE;\n algorithmInProgress = 'Traversal';\n \n dfsInit();\n currentPathfinding = function(){\n return dfsStep();\n };\n }\n}", "function AttackNextPlayer() {\n Orion.Ignore(self);\n var target = Orion.FindType(\"-1\", \"-1\", \"ground\", \"human|near|live|ignorefriends\", 18, \"gray|criminal|orange|red\");\n if (target.length != 0) {\n Orion.Attack(target[0]);\n Orion.Ignore(target[0]);\n } else {\n Orion.IgnoreReset();\n Orion.Ignore(self);\n target = Orion.FindType(\"-1\", \"-1\", \"ground\", \"human|near|live|ignorefriends\", 18, \"gray|criminal|orange|red\");\n if (target.length != 0) {\n Orion.Attack(target[0]);\n Orion.Ignore(target[0]);\n }\n }\n}", "function ClassicGame(){}", "runTournament() {\n\n }", "ai_wander() {\n /*\n This will cause the AI to wander around the area.\n */\n const dirs = [ { x: 0, z: 1 }, { x: 1, z: 0 }, { x: 0, z: -1 }, { x: -1, z: 0 } ];\n let options = [ { x: 0, z: 0 } ];\n for(let d of dirs) {\n if(this.grid.can_move_to({x: this.loc.x + d.x, z: this.loc.z + d.z })) {\n options.push(d);\n }\n }\n\n let choice = options[Math.floor(Math.random() * options.length)];\n if(choice.x || choice.z) {\n this.grid.object_move(this, { x: this.loc.x + choice.x, y: this.loc.y, z: this.loc.z + choice.z });\n return true;\n }\n return false; //no action\n }", "function goToGame(type){\n screens[i].style.display = \"none\";\n i++;\n screens[i].style.display = \"block\";\n gameType = type\n if (gameType == \"recycle\"){\n recycleGame();\n } else if (gameType == \"compost\"){\n compostGame();\n }\n}", "function ai(a,b,c,d){this.type=a;this.name=b;this.Y=c;this.ba=d;this.hb=[];this.align=-1;this.Ga=!0}", "function computerTurnControl() {\n\t\t\n\t\t//alert(\"In computerTurnControl\");\n\t\t\n\t\tif (activePlayer.aIType == \"Random\") {\n\t\t\n\t\t\trandomAgentControl();\n\t\t}\n\t\telse if (activePlayer.aIType == \"Reflex\") {\n\t\t\n\t\t\treflexAgentControl();\n\t\t}\n\t\telse if (activePlayer.aIType == \"Minimax\") {\n\t\t\n\t\t\tminimaxAgentControl();\n\t\t}\n\t\telse if (activePlayer.aIType == \"Minimax w/ AB\") {\n\t\t\n\t\t\tminimaxWithAlphaBetaPruningAgentControl();\n\t\t}\n\t\telse { // activePlayer.aIType == \"Expectimax\"\n\t\t\n\t\t\texpectimaxAgentControl();\n\t\t}\n\t}", "aiUpdate(){\n ai.updateCurrentTargetList(player);\n }", "function chooseAIWeapon() {\n threeWeapons = document.querySelectorAll('.photos img');\n index = Math.floor(Math.random() * threeWeapons.length);\n randomChoice = threeWeapons[index].dataset.option;\n weapons.aiWeapon = randomChoice;\n}", "function loadGame(pos) {\n var gameType = activeArray[pos].type;\n $(\"#\" + gameType).fadeIn(250);\n switch(gameType) {\n case \"anagramGame\":\n loadAnagram();\n break;\n case \"mathGame\":\n $('#prob').text(activeArray[pos].data);\n break;\n case \"simonGame\":\n loadSimon();\n break;\n case \"ascendingNumber\":\n loadAscNum();\n break;\n }\n}", "function makeTheAnimalAndSpeak(ani) {\n // ani.speak(); \n ani.walk();\n}", "step(obs) {\n super.step(obs)\n if (obs.observation.available_actions.includes(FUNCTIONS.Attack_screen.id)) {\n const player_relative = obs.observation.feature_screen.player_relative\n const roaches = xy_locs(player_relative, _PLAYER_ENEMY)\n if (!roaches.length) {\n return FUNCTIONS.no_op()\n }\n //Find the roach with max y coord.\n const temp = []\n for (let i = 0; i < roaches.length; i++) {\n temp.push(roaches[i][1])\n }\n const target = roaches[numpy.argMax(temp).arraySync()]\n return FUNCTIONS.Attack_screen('now', target)\n }\n if (obs.observation.available_actions.includes(FUNCTIONS.select_army.id)) {\n return FUNCTIONS.select_army('select')\n }\n return FUNCTIONS.no_op()\n }", "function handleInput(coa) {\n\n // update random memory value\n nextRandom();\n\n // get player role\n var playerRole = getParticipantByRole(\"player\");\n\n // handle inputs\n var inputq = coa.realizations;\n for (var inputRealizationIndex in inputq) {\n var realization = inputq[inputRealizationIndex];\n\n // add to action queue\n _actionQueue.push({\n type: ActiveDialogConstants.ACTIVE_DIALOG_ACTION_OUTPUT,\n anima: realization.anima,\n text: realization.uttText,\n sound: realization.sound,\n speaker: playerRole\n });\n }\n\n // handle outputs\n if (coa.transitionIndex > -1) {\n handleTransitionInput(DATA.transitions[coa.transitionIndex])\n } else {\n handleRetInput( coa.retId, coa.retInputId );\n }\n\n\n // update course of action options\n getCOAs();\n\n\n // update objectives\n _objectives.forEach( function( o ) {\n o.pass = evalPostfix( o.condition );\n });\n\n var retVideo = coa.transitionIndex > -1 ? null : DATA.retq[coa.retId].inputq[coa.retInputId].video;\n\n var retVid = retVideo == null ? null :\n retVideo[ blockId ] ? retVideo[ blockId ] :\n retVideo[ 'b0000' ];\n\n}", "function toggleAI() {\n\t\tthisGame.p2AI = !thisGame.p2AI;\n\t\tconst aiStatus = document.getElementById(\"ai-status\");\n\t\tif (thisGame.p2AI) {\n\t\t\taiStatus.innerText = \"ENABLED\";\n\t\t\tthisGame.resetBoard();\n\t\t\tupdateBanner(\"P2 Computer Logic Enabled\");\n\t\t}\n\t\telse if (!thisGame.p2AI) {\n\t\t\taiStatus.innerText = \"DISABLED\"\n\t\t\tthisGame.resetBoard();\n\t\t\tupdateBanner(\"P2 Computer Logic Disabled\");\n\t\t}\n\t}", "play() {\n console.log(`WEEEEE I'm a ${this.type}`);\n }", "setType(type) {\n // set base stats\n this.setBase(enemystats.base)\n // and then add some more stats\n var e = enemystats[type]\n this.enemy.controlType = e.control\n while (e != null) {\n this.add(e)\n e = enemystats[e.parent]\n }\n // init guns too\n this.enemy.removeAllGuns()\n for (let g of this.guns) {\n this.enemy.addGun(g.set, g.stat, g.options)\n }\n }", "function C101_KinbakuClub_RopeGroup_LoadAmelia() {\n\tActorLoad(\"Amelia\", \"ClubRoom1\");\n}", "function aiMove(){\n if (game1.toprow.length + game1.midrow.length + game1.botrow.length === 9 && !game1.toprow.includes(undefined) && !game1.midrow.includes(undefined) && !game1.botrow.includes(undefined)){\n $(\"#ticTacTurn\").html(\"Draw\");\n game1.won = true;\n $(\"#endgame\").show();\n } else {\n const pos = [parseInt(Math.random() * 3 + 0), parseInt(Math.random() * 3 + 0)]\n switch (pos[0]){\n case 0:\n if (game1.toprow[pos[1]] === undefined){\n aiPlace(pos);\n } else {\n aiMove();\n }\n break;\n case 1:\n if (game1.midrow[pos[1]] === undefined){\n aiPlace(pos);\n } else {\n aiMove();\n } \n break;\n case 2:\n if (game1.botrow[pos[1]] === undefined){\n aiPlace(pos);\n } else {\n aiMove();\n } \n break;\n default:\n console.log(\"AI placement error!\");\n }\n }\n}", "function getAIMovement() {\n /**\n * In het geval de ai uit het scherm wil lopen, gaat hij nu aan de tegenovergestelde kant weer verder\n */\n ai_position_x += ai_movement_x;\n ai_position_y += ai_movement_y;\n\n //tilecount - 1, moet omdat hij anders aan de zijkant terecht komt\n if (ai_position_x < 0) {\n ai_position_x = tilecount_x - 1;\n }\n if (ai_position_x > tilecount_x - 1) {\n ai_position_x = 0;\n }\n if (ai_position_y < 0) {\n ai_position_y = tilecount_y - 1;\n }\n if (ai_position_y > tilecount_y - 1) {\n ai_position_y = 0;\n }\n }", "function narrator() {\n console.log('narrator');\n// Variable to interact with the player\n $('#question').show();\n $('#question').text('Do you want me to continue? yes or no? speak to me');\n\n// annyang\n var respond;\n if (annyang) {\n// if the player wants to continue\n let showMore = function() {\n storyTwo();\n }\n// if the player doesn't want to continue\n let showLess = function() {\n endGame();\n }\n// possible answers for the player to use\n let commands = {\n 'Yes':showMore,\n 'No' : showLess,\n }\n annyang.addCommands(commands);\n annyang.start();\n }\n}", "function avanti11() {\nvar ogg = new AgganciaController();\nogg.avanti();\n}", "function Oily(){\nSkinType = \"Oily\";\n}", "async function initAI() {\r\n const modelURL = URL + \"model.json\";\r\n const metadataURL = URL + \"metadata.json\";\r\n\r\n // load the model and metadata\r\n // Refer to tmImage.loadFromFiles() in the API to support files from a file picker\r\n // or files from your local hard drive\r\n // Note: the pose library adds \"tmImage\" object to your window (window.tmImage)\r\n model = await tmImage.load(modelURL, metadataURL);\r\n console.log(model);\r\n maxPredictions = model.getTotalClasses();\r\n}", "interact(item, player){\n if(this.isActive){\n if(item instanceof Weapon){\n this.attack.start(item, player);\n }else if(item instanceof Food){\n this.feed.start(item, player);\n }\n }else{\n globalSoundBoard.play('bonkOther');\n player.damage(5);\n }\n }", "function Animal(controller) {\n // animals interact with the world and move\n // controller: is the animal controlled by the computer, or the player?\n }", "function aiExplore() {\n var turnspeed = 0.05;\n \n // choose a random direction to travel from time to time\n if (this.ExploreTimer==undefined) this.ExploreTimer = 30;\n if (this.ExploreAngle==undefined) this.ExploreAngle = this.aimAngleRadians;\n\n this.ExploreTimer--;\n if (this.ExploreTimer<0) {\n if (DEBUGAI) console.log(\"aiExplore: time to change directions!\");\n this.ExploreAngle = randomAngleRadians();\n this.ExploreTimer = 20 + Math.random()*120;\n }\n\n // FIXME: doesn't necessarily choose the shortest direction to turn \n // (eg goes the long way around from 10 to 350)\n if (this.aimAngleRadians>this.ExploreAngle) this.aimAngleRadians -= turnspeed;\n if (this.aimAngleRadians<this.ExploreAngle) this.aimAngleRadians += turnspeed;\n\n validateRotation.call(this); // stay in 0..360 deg\n\n if(typeof this.prev_p == \"undefined\") this.prev_p = vec2(0, 0);\n this.prev_p = vec2(this.p.x, this.p.y);\n\n // move in the direction we are facing\n this.p.x += this.speed * Math.cos(this.aimAngleRadians);\n this.p.y += this.speed * Math.sin(this.aimAngleRadians);\n\n validatePosition.call(this); // collide with walls\n}", "function mainAiHandler(gm, actor) {\n var level = gm.getCurrentLevel();\n var player = gm.getPlayer();\n // update FOV\n // todo: need this every turn for each monster?\n updateFov(gm, actor);\n // change status\n var is_changed;\n is_changed = updateMonsterStatus(gm, actor);\n // find action\n // default event/action\n var ev = {\n actor: actor,\n eventType: Brew.BrewEventType.Wait,\n playerInitiated: false,\n endsTurn: true\n };\n if (actor.monster_status == Brew.MonsterStatus.Sleep) {\n // do nothing\n ;\n }\n else if (actor.monster_status == Brew.MonsterStatus.Wander) {\n // if we dont have a wander destination, get one\n if (!(actor.destination_xy)) {\n actor.destination_xy = getSafeLocation(gm, actor);\n actor.giveup = 0;\n }\n if (actor.location.compare(actor.destination_xy)) {\n // reached our destination, get a new one\n actor.destination_xy = getSafeLocation(gm, actor);\n actor.giveup = 0;\n }\n else {\n // haven't reached our destination yet\n if (actor.giveup > 4) {\n // waited too long, get a new one\n actor.destination_xy = getSafeLocation(gm, actor);\n actor.giveup = 0;\n console.log(actor.name + \" gives up\");\n }\n else {\n // keep our existing destination\n }\n }\n // go toward destination if possible\n var new_xy = getNextStepFromAStar(gm, actor, actor.destination_xy);\n if (!(new_xy)) {\n // couldn't pathfind, increase giveup count\n actor.giveup += 1;\n }\n else {\n // got a valid path\n ev.eventType = Brew.BrewEventType.Move;\n ev.eventData = {\n from_xy: actor.location.clone(),\n to_xy: new_xy\n };\n }\n }\n else if (actor.monster_status == Brew.MonsterStatus.Hunt) {\n var new_xy = void 0;\n // manage keeps distance / ranged mobs\n if (actor.hasFlag(Brew.Flag.KeepsDistance)) {\n var dist = Math.floor(Brew.Utils.dist2d(actor.location, player.location));\n if (dist < actor.attack_range) {\n // keep away \n new_xy = gm.pathmap_from_player.getUnblockedDownhillNeighbor(actor.location, gm.getCurrentLevel(), player);\n }\n else if (dist > actor.attack_range) {\n // move closer\n new_xy = gm.pathmap_to_player.getUnblockedDownhillNeighbor(actor.location, gm.getCurrentLevel(), player);\n }\n else {\n // range attack!\n var attackEvent = {\n actor: actor,\n eventType: Brew.BrewEventType.Attack,\n playerInitiated: false,\n endsTurn: true,\n eventData: {\n from_xy: actor.location.clone(),\n target: player,\n to_xy: player.location.clone(),\n isMelee: false\n }\n };\n attackEvent.targetingData = {\n action: Brew.BrewTargetingAction.RangedAttack,\n method: Brew.BrewTargetingMethod.StraightLine,\n destinationMustBeVisible: true,\n destinationMustHaveMob: true,\n destinationMustBeWalkable: true,\n from_xy: attackEvent.eventData.from_xy,\n to_xy: attackEvent.eventData.to_xy,\n pathBlockedByMobs: true\n };\n // check this attack first\n var rangeAttackCheck = Brew.Events.checkTargetingPath(gm, attackEvent);\n if (rangeAttackCheck.is_valid) {\n return attackEvent;\n }\n else {\n console.log(\"shot blocked!\");\n new_xy = gm.pathmap_to_player.getUnblockedDownhillNeighbor(actor.location, gm.getCurrentLevel(), player);\n }\n }\n }\n else {\n new_xy = gm.pathmap_to_player.getUnblockedDownhillNeighbor(actor.location, gm.getCurrentLevel(), player);\n }\n if (!(new_xy)) {\n // couldn't pathfind, increase giveup count\n actor.giveup += 1;\n }\n else if (new_xy.compare(player.location)) {\n // attack!\n ev.eventType = Brew.BrewEventType.Attack;\n ev.eventData = {\n from_xy: actor.location.clone(),\n target: player,\n to_xy: player.location.clone(),\n isMelee: true\n };\n }\n else {\n // got a valid path\n ev.eventType = Brew.BrewEventType.Move;\n ev.eventData = {\n from_xy: actor.location.clone(),\n to_xy: new_xy\n };\n }\n }\n else if (actor.monster_status == Brew.MonsterStatus.Escape) {\n // todo: escape\n }\n else {\n throw new Error(\"unknown monster status \" + actor.monster_status + \" for \" + actor.getID());\n }\n return ev;\n }", "function C007_LunchBreak_Natalie_Load() {\r\n\r\n // Load the scene parameters\r\n ActorLoad(\"Natalie\", \"ActorSelect\");\r\n LoadInteractions();\r\n C007_LunchBreak_Natalie_CalcParams();\r\n\r\n // If Natalie doesn't like the player and isn't subbie enough, she leaves and don't talk\r\n if ((ActorGetValue(ActorLove) <= -3) && (ActorGetValue(ActorSubmission) <= 2) && (C007_LunchBreak_Natalie_CurrentStage == 0)) {\r\n C007_LunchBreak_Natalie_CurrentStage = 5;\r\n C007_LunchBreak_ActorSelect_NatalieAvail = false;\r\n }\r\n\r\n // If we must put the previous text back\r\n if ((C007_LunchBreak_Natalie_IntroText != \"\") && (C007_LunchBreak_Natalie_CurrentStage > 0)) {\r\n OveridenIntroText = C007_LunchBreak_Natalie_IntroText;\r\n LeaveIcon = C007_LunchBreak_Natalie_LeaveIcon;\r\n }\r\n\r\n}", "_hitMe() {\n this._getPlayerCards()\n this._playerScoreLogic() \n }", "function gameStart (){\n //random country selection (the random function code/math is from stack overflow )\n let randomCountry = countriesAndCodes[Math.floor(Math.random() * countriesAndCodes.length)]\n //loop through array to select each country object\n countriesAndCodes.forEach(function (country){\n //display random country\n randomCountryElement.innerHTML = randomCountry.name\n //get alpha-2 from country object\n let alpha = randomCountry[\"alpha-2\"].toLowerCase()\n //add alpha-2 to url to connect to specific country in API\n url=`https://api.worldbank.org/v2/country/${alpha}?format=json`\n })\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 }", "aiEasyPickHandler(data) {\n this.aiEasyMoveFromX = Number(JSON.parse(data.target.response)[0]);\n this.aiEasyMoveFromY = Number(JSON.parse(data.target.response)[1]);\n this.aiEasyMoveToX = Number(JSON.parse(data.target.response)[2]);\n this.aiEasyMoveToY = Number(JSON.parse(data.target.response)[3]);\n\n this.checkValidPlay(this.aiEasyMoveFromY,this.aiEasyMoveFromX,this.aiEasyMoveToY,this.aiEasyMoveToX);\n }", "function RunAI(enemy) {\n\t//attack AI\n\tif (enemy.attackAI == 'calm') {\n\t\tif (enemy.weapon.type == 'charger' && menu == false) {\n\t\t\tif (enemy.charge < enemy.weapon.max_charge) {\n\t\t\t\tenemy.charge += 0.5;\n\t\t\t}\n\n\t\t\tenemy.cooldown -= 1;\n\t\t\t//console.log(enemy.cooldown);\n\n\t\t\tif ((enemy.direction == 'DOWN' && (X == enemy.pos.x || X == enemy.pos.x - 1) && Y >= enemy.pos.y) || (enemy.direction == 'LEFT' && (Y == enemy.pos.y || Y == enemy.pos.y - 1) && X <= enemy.pos.x) || (enemy.direction == 'UP' && (X == enemy.pos.x || enemy.pos.x + 1) && Y <= enemy.pos.y) || (enemy.direction == 'RIGHT' && (Y == enemy.pos.y || Y == enemy.pos.y + 1) && X >= enemy.pos.x)) {\n\t\t\t\tif (menu == false && textBox == undefined && enemy.weapon != undefined && enemy.cooldown <= 0) {\n\t\t\t\t\tlet xx = enemy.pos.x;\n\t\t\t\t\tlet yy = enemy.pos.y;\n\n\t\t\t\t\tlet x;\n\t\t\t\t\tlet y;\n\t\t\t\t\tif (enemy.direction == 'UP') {\n\t\t\t\t\t\tx = xx;\n\t\t\t\t\t\ty = yy - 2;\n\t\t\t\t\t} else if (enemy.direction == 'DOWN') {\n\t\t\t\t\t\tx = xx - 1;\n\t\t\t\t\t\ty = yy;\n\t\t\t\t\t} else if (enemy.direction == 'RIGHT') {\n\t\t\t\t\t\tx = xx + 1;\n\t\t\t\t\t\ty = yy;\n\t\t\t\t\t} else if (enemy.direction == 'LEFT') {\n\t\t\t\t\t\tx = xx - 2;\n\t\t\t\t\t\ty = yy - 1;\n\t\t\t\t\t}\n\n\t\t\t\t\tlet data = {\n\t\t\t\t\t\tdmg: enemy.charge + enemy.weapon.dmg,\n\t\t\t\t\t\tid: enemy.id,\n\t\t\t\t\t\tdirection: enemy.direction,\n\t\t\t\t\t\tpos: {\n\t\t\t\t\t\t\tx: x,\n\t\t\t\t\t\t\ty: y,\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttype: 'bullet',\n\t\t\t\t\t}\n\n\t\t\t\t\tentities.push(data);\n\t\t\t\t\t//socket.emit('attack', data);\n\t\t\t\t\tcharge = 0;\n\t\t\t\t\tenemy.cooldown = 100;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t//movement AI\n\tif (enemy.moveAI == 'stationary') {\n\t\tif (enemy.timer <= 0) {\n\t\t\tlet num = Random(4);\n\t\t\tif ((num == 0 && enemy.preset == undefined) || enemy.preset == 'LEFT') {\n\t\t\t\tenemy.direction = 'LEFT';\n\t\t\t\tenemy.timer = 100;\n\t\t\t\tif ((Y == enemy.pos.y || Y == enemy.pos.y - 1 || Y == enemy.pos.y + 1) && X <= enemy.pos.x) {\n\t\t\t\t\tenemy.preset = 'LEFT';\n\t\t\t\t} else {\n\t\t\t\t\tenemy.preset = undefined;\n\t\t\t\t}\n\n\t\t\t} else if ((num == 1 && enemy.preset == undefined) || enemy.preset == 'DOWN') {\n\t\t\t\tenemy.direction = 'DOWN';\n\t\t\t\tenemy.timer = 100;\n\t\t\t\tif ((X == enemy.pos.x || X == enemy.pos.x - 1 || X == enemy.pos.x + 1) && Y >= enemy.pos.y) {\n\t\t\t\t\tenemy.preset = 'DOWN';\n\t\t\t\t} else {\n\t\t\t\t\tenemy.preset = undefined;\n\t\t\t\t}\n\n\t\t\t} else if ((num == 2 && enemy.preset == undefined) || enemy.preset == 'RIGHT') {\n\t\t\t\tenemy.direction = 'RIGHT';\n\t\t\t\tenemy.timer = 100;\n\t\t\t\tif ((Y == enemy.pos.y || Y == enemy.pos.y - 1 || Y == enemy.pos.y + 1) && X >= enemy.pos.x) {\n\t\t\t\t\tenemy.preset = 'RIGHT';\n\t\t\t\t} else {\n\t\t\t\t\tenemy.preset = undefined;\n\t\t\t\t}\n\n\t\t\t} else if ((num == 3 && enemy.preset == undefined) || enemy.preset == 'UP') {\n\t\t\t\tenemy.direction = 'UP';\n\t\t\t\tenemy.timer = 100;\n\t\t\t\tif ((X == enemy.pos.x || X == enemy.pos.x - 1 || X == enemy.pos.x + 1) && Y <= enemy.pos.y) {\n\t\t\t\t\tenemy.preset = 'UP';\n\t\t\t\t} else {\n\t\t\t\t\tenemy.preset = undefined;\n\t\t\t\t}\n\n\t\t\t} else if (enemy.preset != undefined) {\n\t\t\t\tswitch (enemy.preset) {\n\t\t\t\t\tcase 'UP':\n\t\t\t\t\t\tenemy.direction = 'UP';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'DOWN':\n\t\t\t\t\t\tenemy.direction = 'DOWN';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'LEFT':\n\t\t\t\t\t\tenemy.direction = 'LEFT';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'RIGHT':\n\t\t\t\t\t\tenemy.direction = 'RIGHT';\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tenemy.preset = undefined;\n\t\t\t}\n\t\t\t//console.log(num);\n\t\t}\n\t\tenemy.timer -= 1;\n\t}\n\n\tif (enemy.moveAI == 'basic') {\n\t\tx = enemy.pos.x + 2;\n\t\ty = enemy.pos.y + 2;\n\n\t\tlet z = X;\n\t\tlet w = Y;\n\t\tconsole.log(`you: ${z}, ${w}`);\n\t\tconsole.log(`them: ${x}, ${y}`);\n\n\t\tif(x < z){\n\t\t\tif(y < w){\n\t\t\t\tif(y + 8 > x){\n\t\t\t\t\tenemy.direction = 'RIGHT';\n\t\t\t\t}else if(y < x){\n\t\t\t\t\tenemy.direction = 'DOWN';\n\t\t\t\t}\n\t\t\t}else if(y > w){\n\t\t\t\tif(y - 8 < x){\n\t\t\t\t\tenemy.direction = 'RIGHT';\n\t\t\t\t}else if(y > x){\n\t\t\t\t\tenemy.direction = 'UP';\n\t\t\t\t}\n\t\t\t}\n\t\t}else if(x > z){\n\t\t\tif(y < w){\n\t\t\t\tif(y > x){\n\t\t\t\t\tenemy.direction = 'LEFT';\n\t\t\t\t}else if(y < x){\n\t\t\t\t\tenemy.direction = 'DOWN';\n\t\t\t\t}\n\t\t\t}else if(y > w){\n\t\t\t\tif(y < x){\n\t\t\t\t\tenemy.direction = 'LEFT';\n\t\t\t\t}else if(y > x){\n\t\t\t\t\tenemy.direction = 'UP';\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "constructor() {\r\n /**\r\n * Entity to which AI is attached\r\n * @type {AutonomyEntity}\r\n */\r\n this.entity = null;\r\n }", "function startGame() {\n createAnsArray();\n playAnswer();\n }", "function game() {\n\n /**\n * De movement van de AI\n */\n if (!may_control) {\n getAIMovementKeys();\n }\n getAIMovement(); \n\n /**\n * Het updaten van de tekst op het scherm\n */\n var score = document.getElementById(\"score\");\n score.innerHTML = \"Jouw huidige score: \"+ this.score;\n\n var score_ai = document.getElementById(\"score_ai\");\n score_ai.innerHTML = \"Jouw tegenstander's score: \"+ this.score_ai;\n\n var event = document.getElementById(\"event\");\n\n event.innerHTML = \"Laatste gebeurtenis \"+ this.event+\" <br>\";\n \n /**\n * Het updaten van de speler positie wanneer deze uit het scherm gaat, net zoals\n * bij de ai\n */\n player_position_x += player_movement_x;\n player_position_y += player_movement_y;\n if (player_position_x < 0) {\n player_position_x = tilecount_x - 1;\n }\n if (player_position_x > tilecount_x - 1) {\n player_position_x = 0;\n }\n if (player_position_y < 0) {\n player_position_y = tilecount_y - 1;\n }\n if (player_position_y > tilecount_y - 1) {\n player_position_y = 0;\n }\n\n /**\n * Het scherm opvullen met een zwarte kleur canvas\n */\n canvas_2d.fillStyle = \"black\";\n canvas_2d.fillRect(0, 0, canvas.width, canvas.height);\n \n /**\n * Een loop van trail en vult deze met een rectangle, met de kleur die eerder is aangegeven\n */\n for (var i = 0; i < trail.length; i++) {\n canvas_2d.fillStyle = trail[i].col;\n canvas_2d.fillRect(trail[i].x * gridsize, trail[i].y * gridsize, gridsize - 2, gridsize - 2);\n \n /**\n * De tail resetten wanneer de speler op zijn eigen staart komt te staan, waardoor hij ook\n * al zijn punten verliest\n */\n if (trail[i].x == player_position_x && trail[i].y == player_position_y) {\n\n /**\n * Wanneer nog geen score bekend is, wordt gezegd dat je met de pijltjes toetsen kan\n * bewegen\n */\n if (this.score == 0) {\n this.event = \"Je kunt bewegen met de pijltjes toetsen!\";\n } else {\n this.event = \"Jij bent tegen jezelf aan gebotst, 100 punten weg!\";\n }\n\n /**\n * Je staart wordt gereset naar de default size\n */\n tail = tail_default_size;\n \n /**\n * Score wordt gereset naar 0\n */\n this.score = 0;\n } \n }\n \n\n /**\n * Zelfde bij de AI als bij de speler zelf\n */\n for (var i = 0; i < trail_ai.length; i++) {\n /**\n * Vullen van de rechthoek met een kleur\n */\n canvas_2d.fillStyle = trail_ai[i].col;\n canvas_2d.fillRect(trail_ai[i].x * gridsize, trail_ai[i].y * gridsize, gridsize - 2, gridsize - 2);\n \n /**\n * De tail resetten wanneer speler op zijn eigen staart komt\n */\n if (trail_ai[i].x == ai_position_x && trail_ai[i].y == ai_position_y) {\n tail_ai = tail_default_size_ai;\n \n if (may_control) {\n this.score_ai = 0;\n this.tail_ai = tail_default_size;\n }\n \n this.event = \"De AI/tegenstander botst tegen zichzelf aan\";\n }\n }\n \n /**\n * Laat de snake van de speler en de ai lopen, waardoor steeds nieuwe deeltjes in de array worden gezet\n */\n trail.push({ col: getRandomColor(true), x: player_position_x, y: player_position_y });\n\n trail_ai.push({ col: getRandomColor(false), x: ai_position_x, y: ai_position_y });\n \n /**\n * Laat de snake verkleinen bij het bewegen\n */\n while (trail.length > tail) {\n trail.shift();\n }\n\n /**\n * Laat de ai verkleinen bij het bewegen\n */\n while (trail_ai.length > tail_ai) {\n trail_ai.shift();\n }\n \n\n \n\n /**\n * Een loop van de apples die in het spelletje worden gemarkeerd als rood, bij het vangen van deze\n * punten, dan gaat de appel weg en krijg je dus 50 punten. de ai krijgt meer punten.\n * De staart wordt langer en er worden 3 nieuwe appels in het spel toegekend.\n */\n for (var b = 0; b < apple_positions.length; b++) {\n // console.log(apple_positions[b].x+\" \"+apple_positions[b].y);\n if (apple_positions[b].x == player_position_x && apple_positions[b].y == player_position_y) {\n tail++;\n \n /**\n * Het event zegt dat 50 punten zijn gevangen.\n */\n this.event = \"Jij hebt een appel gevangen, 50 punten!\";\n\n /**\n * Een score van 50 wordt toegekend aan de speler\n */\n this.score += 50;\n \n /**\n * De oude appel wordt niet verwijderd, maar wordt op een andere plek gezet\n */\n apple_positions[b].x = Math.floor(Math.random() * tilecount_x);\n apple_positions[b].y = Math.floor(Math.random() * tilecount_y);\n \n /**\n * 3 nieuwe appels komen in het spel terecht\n */\n apple_positions.push({x : getRandomXTile(), y : getRandomYTile()});\n apple_positions.push({x : getRandomXTile(), y : getRandomYTile()});\n apple_positions.push({x : getRandomXTile(), y : getRandomYTile()});\n\n } else if(apple_positions[b].x == ai_position_x && apple_positions[b].y == ai_position_y) {\n /**\n * idem dito.\n */\n \n this.event = \"De AI/tegenstander heeft een appel gevangen, 100 punten!\";\n\n tail_ai++;\n\n if (may_control) {\n this.score_ai += 50;\n } else {\n this.score_ai += 100;\n }\n\n apple_positions[b].x = Math.floor(Math.random() * tilecount_x);\n apple_positions[b].y = Math.floor(Math.random() * tilecount_y);\n \n apple_positions.push({x : getRandomXTile(), y : getRandomYTile()});\n } \n\n /**\n * Het vullen van de appels met een rode kleur\n */\n canvas_2d.fillStyle = \"red\";\n canvas_2d.fillRect(apple_positions[b].x * gridsize, apple_positions[b].y * gridsize, gridsize - 2, gridsize - 2);\n }\n \n /**\n * Botsen tegen elkaar, loopt en kijkt dan of in de trail de coords zijn\n * in de coords van de andere\n */\n for (var snake_one = 0; snake_one < trail.length; snake_one++) {\n for (var snake_two = 0; snake_two < trail_ai.length; snake_two++) {\n\n if (trail[snake_one].x == trail_ai[snake_two].x &&\n trail[snake_one].y == trail_ai[snake_two].y) {\n\n /**\n * Gaat nu checken wie de foute is\n * \n * Wanneer het hoofdje van de snake in de ander zijn trail is, dan is de snake met het hoofdje\n * die er in komt fout.\n * \n * Andersom idem dito.\n */\n for (var snake_one_head = 0; snake_one_head < trail.length; snake_one_head++) {\n for (var snake_two_head = 0; snake_two_head < trail_ai.length; snake_two_head++) {\n\n \n if (ai_position_x == trail[snake_one_head].x && ai_position_y == trail[snake_one_head].y) {\n //de ai is nu de foute\n \n this.tail_ai = tail_default_size;\n if (may_control) {\n if (this.score_ai - 500 > 0) {\n this.score_ai -= 500;\n } else {\n this.score_ai = 0;\n }\n }\n this.event = \"De tegenstander is tegen jou aan gebotst!\";\n // console.log(\"De tegenstander is tegen jou aan gebotst!\");\n } else if (player_position_x == trail_ai[snake_two_head].x && player_position_y == trail_ai[snake_two_head].y) {\n \n this.event = \"Jij bent tegen de tegenstander aangebotst! 500 punten weg!\";\n // console.log(\"Jij bent tegen de tegenstander aangebotst! 500 punten weg!\");\n \n // console.log(snake_one_head);\n this.tail = tail_default_size;\n \n if (this.score - 500 > 0) {\n this.score -= 500;\n } else {\n this.score = 0;\n }\n }\n \n }\n }\n }\n }\n } \n /**\n * De bonus punten die als paars worden aangeven, deze worden random in het spel toegevoegd en geven meer punten\n * dan normale appels, bij het ontvangen krijg je 100 score en word je staart iets langer met 3 blokjes, hierna wordt een nieuw bonus punt\n * en het oude gerelocated\n * \n * de ai heeft hetzelfde principe\n */\n for (var b = 0; b < bonus_points.length; b++) {\n // console.log(apple_positions[b].x+\" \"+apple_positions[b].y);\n if (bonus_points[b].x == player_position_x && bonus_points[b].y == player_position_y) {\n tail += 3;\n \n this.event = \"Jij hebt een ongelooflijke goede appel gevangen, 100 punten!\";\n\n this.score += 100;\n \n bonus_points[b].x = Math.floor(Math.random() * tilecount_x);\n bonus_points[b].y = Math.floor(Math.random() * tilecount_y);\n \n bonus_points.push({x : getRandomXTile(), y : getRandomYTile()});\n\n } else if(bonus_points[b].x == ai_position_x && bonus_points[b].y == ai_position_y) {\n tail_ai++;\n\n if (may_control) {\n this.score_ai += 100;\n } else {\n this.score_ai += 200;\n }\n\n this.event = \"De AI heeft een ongelooflijke goede appel gevangen, 200 punten!\";\n\n bonus_points[b].x = Math.floor(Math.random() * tilecount_x);\n bonus_points[b].y = Math.floor(Math.random() * tilecount_y);\n \n bonus_points.push({x : getRandomXTile(), y : getRandomYTile()});\n apple_positions.push({x : getRandomXTile(), y : getRandomYTile()});\n apple_positions.push({x : getRandomXTile(), y : getRandomYTile()});\n } \n canvas_2d.fillStyle = \"purple\";\n canvas_2d.fillRect(bonus_points[b].x * gridsize, bonus_points[b].y * gridsize, gridsize - 2, gridsize - 2);\n }\n \n /**\n * Het random aanmaken van de spikes, die punten daling geven en het aanmaken van de\n * bonus punten, die juist een punten toename geven\n */\n if (Math.floor(Math.random() * 20) == 0) {\n dead_spikes.push({x : getRandomXTile(), y : getRandomYTile()});\n }\n\n if (Math.floor(Math.random() * 100) == 0) {\n bonus_points.push({x : getRandomXTile(), y : getRandomYTile()});\n }\n \n /**\n * Een loop van de dead spikes, deze spikes geven een punten daling bij de speler, maar niet bij de ai\n * De kleur wordt hier aan geven van wit\n */\n for (var b = 0; b < dead_spikes.length; b++) { \n canvas_2d.fillStyle = \"white\";\n canvas_2d.fillRect(dead_spikes[b].x * gridsize, dead_spikes[b].y * gridsize, gridsize - 2, gridsize - 2);\n \n // console.log(apple_positions[b].x+\" \"+apple_positions[b].y);\n if (dead_spikes[b].x == player_position_x && dead_spikes[b].y == player_position_y) {\n trail.shift();\n \n this.event = \"Jij bent tegen een rotte appel gevallen, 250 punten weg!\";\n\n if (this.score - 250 >= 0) {\n this.score -= 250;\n } else if (this.score - 250 < 0) {\n this.score = 0;\n }\n delete dead_spikes[b].x, dead_spikes[b].y;\n \n // while (dead_spikes.length > 0) {\n // dead_spikes.pop();\n // }\n } else if(dead_spikes[b].x == ai_position_x && dead_spikes[b].y == ai_position_y) {\n trail_ai.shift();\n\n this.event = \"De AI is tegen een rotte appel gevallen!\";\n \n // if (this.score_ai - 100 >= 0) {\n // this.score_ai -= 100;\n // }\n\n if (may_control) {\n if (this.score_ai - 250 >= 0) {\n this.score_ai -= 250;\n }\n }\n\n delete dead_spikes[b].x, dead_spikes[b].y;\n }\n }\n }", "function Enemy(location, speed, level, typ, index) {\n\n // Waffe setzen und Groesse aendern\n switch(typ) {\n case \"BOSS1\":\n geometryB = fileLoader.get(\"BossCruiserV1\");\n textureB = fileLoader.get(\"Boss_Textures_Combined_V1\");\n enemyHP[index] = 30;\n\n break;\n case \"BOSS2\":\n geometryB = fileLoader.get(\"Boss_Mothership_TITAN\");\n textureB = fileLoader.get(\"Boss_Textures_Combined_V1\");\n enemyHP[index] = 50;\n\n break;\n case \"SMALL1\":\n geometryB = fileLoader.get(\"EnemyShipOne\");\n textureB = fileLoader.get(\"TextureEnemyShipOne\");\n enemyHP[index] = 10;\n break;\n case \"SMALL2\":\n geometryB = fileLoader.get(\"MiniEnemyShip\");\n textureB = fileLoader.get(\"MiniShipTex\");\n this.scale.set(20,20,20);\n enemyHP[index] = 10;\n break;\n default:\n geometryB = fileLoader.get(\"EnemyShipOne\");\n this.scale.set(20,20,20);\n enemyHP[index] = 10;\n }\n\n this.index = index;\n this.typ = typ;\n\n\n // Mesh setzen\n THREE.Mesh.call(this, geometryB,\n new THREE.MeshPhongMaterial({map: textureB}));\n\n this.scale.set(1,1,1);\n\n //MATH = MATHX();\n\n this.speed = speed;\n this.position.set(location.x,location.y,location.z);\n this.level = level;\n this.isAlive = true;\n this.onPlayerAttack = false;\n this.delta = 0;\n this.respawn = false;\n this.sinceLastShot = -3; // erste drei Sekunden nichts machen\n this.radius = maxShipSize;\n\n // Initialen Ausrichtungsvektor\n this.lookAt(ship.position);\n // .. und direction\n this.direction = ship.position.clone();\n this.direction.sub(this.position);\n this.direction.normalize();\n\n this.oldDir = this.direction.clone();\n\n // Spieler-Richtung\n this.playerDirection = new THREE.Vector3(0,0,0);\n this.oldPlayerLocation = ship.position.clone();\n this.oldPlayerDir = ship.position.clone();\n\n}", "function reactToNewAICards () {\n /* update behaviour */\n players[currentTurn].hand.determine();\n if (players[currentTurn].hand.strength == HIGH_CARD) {\n players[currentTurn].updateBehaviour([BAD_HAND, ANY_HAND]);\n } else if (players[currentTurn].hand.strength == PAIR) {\n players[currentTurn].updateBehaviour([OKAY_HAND, ANY_HAND]);\n } else {\n players[currentTurn].updateBehaviour([GOOD_HAND, ANY_HAND]);\n }\n \n players[currentTurn].commitBehaviourUpdate();\n \n players[currentTurn].swapping = false;\n \n saveSingleTranscriptEntry(currentTurn);\n\n /* wait and then advance the turn */\n timeoutID = window.setTimeout(advanceTurn, GAME_DELAY / 2);\n}", "function aiPlayer(level){\n if (level === game1.ai){\n game1.ai = 0;\n $(\"#easyAI\").css({'background-color':''});\n $(\"#hardAI\").css({'background-color':''});\n } else if (level === 1){\n game1.ai = 1;\n $(\"#easyAI\").css({'background-color':'#FFA340'});\n $(\"#hardAI\").css({'background-color':''});\n } else if (level === 2){\n game1.ai = 2;\n $(\"#hardAI\").css({'background-color':'#FFA340'});\n $(\"#easyAI\").css({'background-color':''});\n }\n}", "launchGame() {\n this.grid.generate()\n this.grid.generateWalls()\n this.grid.generateWeapon('axe', this.grid.giveRandomCase())\n this.grid.generateWeapon('pickaxe', this.grid.giveRandomCase())\n this.grid.generateWeapon('sword', this.grid.giveRandomCase())\n this.grid.generateWeapon('rod', this.grid.giveRandomCase())\n \n this.shears = new Weapon('shears', 10)\n this.sword = new Weapon('sword', 20)\n this.axe = new Weapon('axe', 30)\n this.pickaxe = new Weapon('pickaxe', 40)\n this.rod = new Weapon('rod', 50)\n\n var position_player1 = -1\n var position_player2 = -1\n\n do {\n position_player1 = this.grid.generatePlayer('1')\n this.player1.setPosition(position_player1)\n } while (position_player1 == -1)\n\n do {\n position_player2 = this.grid.generatePlayer('2')\n this.player2.setPosition(position_player2)\n } while (position_player2 == -1 || this.grid.isNextToPlayer(position_player2))\n\n this.game_status = $('#game_status')\n this.game_status.html('Recherche d\\'armes pour les deux joueurs...')\n }", "function advanceTalk(pic, text) //selects the avatar of who speaking and the dialogue that will be said.\n{\n\t//ai, \\'Hello, I am this ships onboard AI\\'\n\t\n\tif(advanceTalkCounter===1)\n\t{\n\t\tcharacterPic('ai');\n\t\ttextDisplay('Hello, I am this ships onboard AI');\n\t\tadvanceTalkCounter++;\n\t}\n\t\n\telse if(advanceTalkCounter===2)\n\t{\n\t\tcharacterPic(avatarPic);\n\t\ttextDisplay('How did i get here?');\n\t\tadvanceTalkCounter++;\n\t}\n\telse if(advanceTalkCounter===3)\n\t{\n\t\tcharacterPic('ai');\n\t\ttextDisplay('You were placed in stasis 300 years ago to perserve your body for your return to Earth');\n\t\tadvanceTalkCounter++;\n\t}\n\telse if(advanceTalkCounter===4)\n\t{\n\t\tcharacterPic('ai');\n\t\ttextDisplay('You were awoken when we reached the edge of the Milky Way.');\n\t\tadvanceTalkCounter++;\n\t}\n\telse if(advanceTalkCounter===5)\n\t{\n\t\tcharacterPic(avatarPic);\n\t\ttextDisplay('Why wasnt i awoken when we reached Earth?');\n\t\tadvanceTalkCounter++;\n\t}\n\telse if(advanceTalkCounter===6)\n\t{\n\t\tcharacterPic('ai');\n\t\ttextDisplay('Theres a problem with the ship, a hostile ship attacked us in the previous galaxy and a number of systems have been damaged.');\n\t\tadvanceTalkCounter++;\n\t}\n\telse if(advanceTalkCounter===7)\n\t{\n\t\tcharacterPic('ai');\n\t\ttextDisplay('You are going to need to beam down to a few planets to gather supplies to fix the ship.');\n\t\tadvanceTalkCounter++;\n\t}\n\telse if(advanceTalkCounter===8)\n\t{\n\t\tcharacterPic(avatarPic);\n\t\ttextDisplay('Gather parts, I don\\'t even remember what I\\'m doing on this ship');\n\t\tadvanceTalkCounter++;\n\t}\n\telse if(advanceTalkCounter===9)\n\t{\n\t\tcharacterPic('ai');\n\t\ttextDisplay('My access to that information is restricted, perhaps there is some data on one of the ships computer terminals');\n\t\tadvanceTalkCounter++;\n\t}\n\telse if(advanceTalkCounter===10)\n\t{\n\t\tcharacterPic('ai');\n\t\ttextDisplay('The ship has just arrived at Dakara. You will need to beam down and retrieve a new power core. The Dakarans will not part with one too easily, perhaps there is something you can find on the ship to trade with.');\n\t\tadvanceTalkCounter++;\n\t}\n\telse if(advanceTalkCounter===11)\n\t{\n\t\tcharacterPic(avatarPic);\n\t\ttextDisplay('On the planet how do I beam back up to the ship?');\n\t\tadvanceTalkCounter++;\n\t}\n\telse if(advanceTalkCounter===12)\n\t{\n\t\tcharacterPic('ai');\n\t\ttextDisplay('You will need to return to the location of where you where beamed down.');\n\t\tadvanceTalkCounter++;\n\t}\n\t\n\telse if(advanceTalkCounter===13)\n\t{\n\t\tcharacterPic('ai');\n\t\ttextDisplay('Good Luck');\n\t\tadvanceTalkCounter++;\n\t\tgameShip(); //start game on the ship\n\t\t\n\t}\n\t//number jump due to deleted dialogue\n\telse if(advanceTalkCounter===498)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\t//ship exploration dialogue\n\telse if(advanceTalkCounter===500)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('There is nothing of interest here');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===502)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('There is a computer in the center of the room, it\\'s files may be accessed.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===504)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Most of this computers files have been damaged the only ones i can access for you are about the ships journey');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===505)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('This ship was launched from earth 300 years ago with the goal of discovering inhabitable worlds outside our galaxy. This ship was one of many launched.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===506)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Each ship carried a crew of 500, Most were kept in stasis to carry out the mission when those awake passed away.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===507)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('For over 200 years the ships explored the galaxies around the Milky Way, by this time the crews of many ships were down to only 50 crew members in stasis.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===508)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('At this time we began to lose contact with the ships furthest out. For the next 50 years more and more ships dropped off the grid with no explanation.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===509)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Finally a ship got off a transmission before it dropped off, it warned of a great enemy whose technology far outpowered our own, and they seemed bent on total destruction.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===510)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Too far out to warn earth, our final five ships formed a convoy and headed toward earth.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===511)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('On the edge of the Pegasus Galaxy, they caught up to us. Two giant warships bearing down, we gave it all we could, we managed to destroy 1 but 4 of our ships were destroyed. In a desperate measure the remaining crew of this ship boarded fighters and commited a suicide run aganist the enemy');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===512)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('This ship was heavily damaged but they managed to destroy the enemy ship. You are the only crew member remaining, and without our long range communications you must get back to earth to warn them.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===514)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('There appears to be a crate of medicine in the corner. Perhaps this could be used as a trade with some locals.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\t\n\telse if(advanceTalkCounter===516)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('I can\\'t teleport off the ship from here. I need to be in the embarkation room.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===518)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('If I\\'m ready i can teleport to Dakara now.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===520)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('I suggest you explore the entire ship before you beam down to Dakara');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===521)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('This ship is very large, unfortunately you cant access most areas due to the damage.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===522)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Time is of the importance');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===523)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('I have nothing else to say currently');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\t//dakara dialogue\n\telse if(advanceTalkCounter===600)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Hello.... Anybody here?');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===601)\n\t{\n\t\tcharacterPic2('telc');\n\t\ttextDisplay2('Stop! Don\\'t come any closer, there is a great sickness here.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===602)\n\t{\n\t\tif(medicine===true)\n\t\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('I have medicine I\\'d be willing to trade.');\n\t\tadvanceTalkCounter++;\n\t\t}\n\t\telse\n\t\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Perhaps there is medicine on my ship.');\n\t\t}\n\t\t\n\t\t\n\t}\n\telse if(advanceTalkCounter===603)\n\t{\n\t\tcharacterPic2('telc');\n\t\ttextDisplay2('Trade for what?');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===604)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('I need a new power core for my ship, it was damaged in battle.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===605)\n\t{\n\t\tcharacterPic2('telc');\n\t\ttextDisplay2('The men in the ruins can help you. Tell them Tel\\'c sent you and that i approve the trade.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===606)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Thank you very much.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===607)\n\t{\n\t\tcharacterPic2('telc');\n\t\ttextDisplay2('If the enemy that attacked your ship is who think, it would be wise of you to talk to the priest in the temple.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===608)\n\t{\n\t\tcharacterPic2('telc');\n\t\ttextDisplay2('He has knowlege that may be interesting to you.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===609)\n\t{\n\t\tcharacterPic2('telc');\n\t\ttextDisplay2('Also you may want to seach around, we have lots of extra gold that people on other planets may be willing to trade for.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===612)\n\t{\n\t\tcharacterPic2('bratak');\n\t\ttextDisplay2('Hello. How can i help you?');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===613)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Tel\\'c told me you could tell me about the great enemy.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===614)\n\t{\n\t\tcharacterPic2('bratak');\n\t\ttextDisplay2('A long time ago the galaxies were ruled by a ferocious race called the Wraith. They dominated through fear, feasting on the populations of world for food.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===615)\n\t{\n\t\tcharacterPic2('bratak');\n\t\ttextDisplay2('They leave just enough of a worlds population alive to allow them to reproduce and move on to the next planet. Once the have attacked all the worlds they retreat back to outer galaxies and wait for the populations to get high enough again.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===616)\n\t{\n\t\tcharacterPic2('bratak');\n\t\ttextDisplay2('This cycle has gone on for thousands and thousands of years. But this is the first time the Wraith have ever made it to the Milky Way. There must not have enough food in the other galaxies to feed them');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===617)\n\t{\n\t\tcharacterPic2('bratak');\n\t\ttextDisplay2('If your planet can mount any sort of defense you should get back and warn them as soon as possible.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===618)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Thank you for everything.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===619)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===621)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('If I\\'m ready I can beam up to the ship');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===625)\n\t{\n\t\tcharacterPic2('daniel');\n\t\ttextDisplay2('Stop right there');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===626)\n\t{\n\t\tcharacterPic2('vala');\n\t\ttextDisplay2('Who are you?');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===627)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Whoah, don\\'t shoot! Teal\\'c told me I could come here to trade.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===628)\n\t{\n\t\tcharacterPic2('daniel2');\n\t\ttextDisplay2('What do you have to trade?');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===629)\n\t{\n\t\tcharacterPic2('vala');\n\t\ttextDisplay2('And for what?');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===630)\n\t{\n\t\tif(medicine===true)\n\t\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('I have medicine I\\'d be willing to trade.');\n\t\tadvanceTalkCounter++;\n\t\t}\n\t\telse\n\t\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Perhaps there is medicine on my ship.');\n\t\t}\n\t\t\n\t}\n\telse if(advanceTalkCounter===631)\n\t{\n\t\tcharacterPic2('vala');\n\t\ttextDisplay2('There is great sickness here, you couldn\\'t have come at a better time.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===632)\n\t{\n\t\tcharacterPic2('daniel2');\n\t\ttextDisplay2('These power cores are very valuble, you better have alot of medicine.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===633)\n\t{\n\t\tcharacterPic2('vala');\n\t\ttextDisplay2('Daniel cut it out, give him the power core, we need to get the medicine to the people.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===634)\n\t{\n\t\tcharacterPic2('daniel2');\n\t\ttextDisplay2('Here you go, thank you for the medicine.');\n\t\tadvanceTalkCounter++;\n\t\tpowerCore=true;\n\t\t\n\t}\n\telse if(advanceTalkCounter===635)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Thank you. I hope your people recover quickly.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===636)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===650)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('I already picked up the item from here');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===652)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('There appears to be a chest of gold here');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===690)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('I can\\'t teleport to the ship from here, i need to be in the village');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\t//transport back to ship and orilla dialogue\n\telse if(advanceTalkCounter===700)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Welcome back aboard, i see you have retrieved a new power core, bring it over to the console.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===701)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Next up on our part list is a new hyperdrive, the current one will probably only last for one more jump.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===702)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Luckily there is a planet that might be able to help that we should reach before the drive fails');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===703)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('I hope you found something on Dakara that you can use to trade with, because once we jump there is no coming back here.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===704)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('If you are ready to engage the hyperdrive go to the control room.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===705)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===707)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('If I\\'m ready i can teleport to Orilla now.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===710)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('The ship has arrived at Orilla. As I feared the hyperdrive has failed. If you can\\'t secure a new one, we\\'re not going anywhere.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===711)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('The indigenious population of Orilla are the Asgard, they are a highly advanced civilization.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===712)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('When you\\'re ready, beam down to the planet.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===714)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('You can\\'t engage the hyperdrive at this time.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===718)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('I can beam down to Orilla if I\\'m ready.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===720)\n\t{\n\t\tcharacterPic2('thor');\n\t\ttextDisplay2('Hello traveler, I am Thor of the Asgard. Welcome to Orilla');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===721)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('I need a new hyperdrive for my ship, I must get back to my planet to warn them of the coming Wraith attack.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===722)\n\t{\n\t\tcharacterPic2('thor');\n\t\ttextDisplay2('The wraith have never been a problem for us. As for the hyperdrive you must talk to the council about that.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===723)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Why have the Wraith never been a problem for you?');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===724)\n\t{\n\t\tcharacterPic2('thor');\n\t\ttextDisplay2('We are technologically superior to them. Past that I can\\'t tell you anymore, you would need to talk to the council.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===725)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Thank you, i will go to the council now.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\t\n\telse if(advanceTalkCounter===727)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Hello, I am a traveler who needs a new hyperdrive to reach my planet to warn them before the Wraith arrive.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===728)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('Yes, Thor told us you would be coming.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===729)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('So, are you willing to help?');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===730)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('That has not yet been decided.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===731)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Why not? I must warn my people!');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===732)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('The Asgard do not part with the technology lightly, our technological advantage is all that we have.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===731)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Why not? I must warn my people!');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===732)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('The Asgard do not part with the technology lightly, our technological advantage is all that we have.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===733)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Well while you think it over, can you tell me why you never worry about the Wraith?');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===734)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('The Asgard and the Wraith first met over 3 centuries ago. They outnumbered us 100 to 1. We tried to negotiate a truce, but all the wanted was war.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===735)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('In the inital years of the war things went very badly, our ships were more powerfull but the enemy numbers were too great.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===736)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('We had our fleet spread out trying to defend the galaxies from the Wraith.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===737)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('A single Asgard ship was a match for five Wraith ships. But because we tried defending so many planets we could only spare one to ships per planet.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===738)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('The wraith would send ten ships to every planet we defended. There was nothing we could do. We were losing ships and the war rapidly.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===739)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('We made the only decision we could, we fell back to our five core worlds. We developed advanced defense satelites and even more power ships.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===740)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('When the Wraith came for us, we were ready. The battle lasted months, at the end, we had destroyed over 1,000 wraith ships, and suffered no major casualties.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===741)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('The Wraith came again and again for over 100 years before deciding we weren\\'t worth it. We have lived free of fear from the wraith for over a century now.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===742)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('So you see, even if you could defend againist the first wave you never could never win. ');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===743)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Then help us, send ships and some satelites and help defend Earth! ');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===744)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('That is a decision the entire council must make, if we decide to help our ships will arrive at earth when they are needed. ');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===745)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('For now, you may purchase a hyperdrive from us. Go to the shipyard and talk to Loki, we will let him know your\\'e coming. ');\n\t\tadvanceTalkCounter++;\n\t\tcouncilApprove=true;\n\t\tcouncilTalk=true;\n\t}\n\telse if(advanceTalkCounter===746)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===748)\n\t{\n\t\tcharacterPic2('archon');\n\t\ttextDisplay2('We have not reached a decision yet.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===749)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===751)\n\t{\n\t\tcharacterPic2('loki');\n\t\ttextDisplay2('I can\\'t sell you a hyperdrive without the council\\'s approval.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===752)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===754)\n\t{\n\t\tcharacterPic2('loki');\n\t\ttextDisplay2('The council has approved the purchase of a new hyperdrive. You better have the gold to pay for it, otherwise you will be stranded here forever.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===755)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\tif((goldChest || goldChest2) === true)\n\t\t{\n\t\ttextDisplay2('Yes i have the money to pay for it');\n\t\tadvanceTalkCounter++;\n\t\t}\n\t\telse\n\t\t{\n\t\ttextDisplay2('Shit! Well I guess im trapped here, what\\'s good to eat?');\n\t\t}\n\t\t\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===756)\n\t{\n\t\tcharacterPic2('loki');\n\t\ttextDisplay2('Good here you go.');\n\t\tnewhyperdrive=true;\n\t\tif((goldChest && goldChest2)===true)\n\t\t{\n\t\t goldChest=false;\n\t\t}\n\t\telse if(goldChest === false && goldChest2===true)\n\t\t{\n\t\t goldChest2=false;\n\t\t}\n\t\telse if(goldChest === true && goldChest2===false)\n\t\t{\n\t\t goldChest=false;\n\t\t}\n\t\tadvanceTalkCounter++;\n\t\t\t\t\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===757)\n\t{\n\t\tcharacterPic2('loki');\n\t\ttextDisplay2('If you have any more gold, i could be sell you advanced Asgard Beam Weapons for your ship if you don\\'t tell anyone.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===758)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\tif((goldChest || goldChest2)===true)\n\t\t{\n\t\ttextDisplay2('I have more gold, please sell me the weapon system.');\n\t\tasgardWeapons=true;\n\t\t}\n\t\telse\n\t\t{\n\t\ttextDisplay2('Sorry, no more gold. Thanks for the offer though.');\n\t\t}\n\t\tadvanceTalkCounter++;\n\t\t\t\t\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===759)\n\t{\n\t\tcharacterPic2('loki');\n\t\tif(asgardWeapons===true)\n\t\t{\n\t\ttextDisplay2('Here you go.');\n\t\t}\n\t\telse\n\t\t{\n\t\ttextDisplay2('Oh well, have a good one.');\n\t\t}\n\t\tadvanceTalkCounter++;\n\t\t\t\t\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===760)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===790)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('I can\\'t beam to the ship from here, i need to be in the city.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\t//transport back to ship and abydos dialogue\n\telse if(advanceTalkCounter===800)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Welcome back aboard, i see you have retrieved a new hyperdrive, bring it over to the console.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===801)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('The air filtration system failed while you were dwon on Orilla, without a new one I fear you will not survive the journey to earth.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===802)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Luckily there is a planet nearby that should have what we need to repair it.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===803)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('These people are very simple, they will not have it to trade for, you will need to search for it yourself. Luckily you don\\'t need to find anything to trade with on Orilla.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===804)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('If you are ready to engage the hyperdrive go to the control room.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===805)\n\t{\n\t\tif(asgardWeapons===true)\n\t\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('I see you have also aquired some asgard weaponry, hopefully we won\\'t need it.');\n\t\t}\n\t\telse if(asgardWeapons===false)\n\t\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\t}\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===806)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\t\n\telse if(advanceTalkCounter===810)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('The ship has arrived at Abydos. The air in here is becoming quickly toxic. If you can\\'t secure what we need to repair the filtration system you will not survive.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===811)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('The indigenious population of Abydos are very simple people.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===812)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('When you\\'re ready, beam down to the planet.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===815)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Hello. Anybody here?');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===816)\n\t{\n\t\tcharacterPic2('shauri');\n\t\ttextDisplay2('Hello, I am Shauri. We have not had visotrs in quite some time');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===817)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('I need to find parts to fix my ships air filtration system. Can you help me?');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===818)\n\t{\n\t\tcharacterPic2('shauri');\n\t\ttextDisplay2('Honestly I\\'m not sure. We are a simple people, our technology is not that advanced. But many ships have crash landed here over the years, perhaps you can find what you need by searching around.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===819)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Thank you. Also, can you tell me anything about the Wraith?');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===820)\n\t{\n\t\tcharacterPic2('shauri');\n\t\ttextDisplay2('Wraith? I\\'ve never heard of them. Maybe you can ask Kasuf in the city, he is very wise and is always willing to trade information.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===821)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Thank you, I\\'ll be sure to talk to him.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===823)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Kasuf, are you here?.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===824)\n\t{\n\t\tcharacterPic2('kasuf');\n\t\ttextDisplay2('I am Kasuf, what can i do for you.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===825)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('I was wondering if you could tell me more about the Wraith?');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===826)\n\t{\n\t\tcharacterPic2('kasuf');\n\t\ttextDisplay2('No one has asked me about the Wraith in a very long time.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===827)\n\t{\n\t\tcharacterPic2('kasuf');\n\t\ttextDisplay2('If you bring me an artifact, I will tell you what I can.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===828)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\tif(artifact===true)\n\t\t{\n\t\t\ttextDisplay2('I found an artifact in the ruins, will this work?.');\n\t\t}\n\t\telse\n\t\t{\n\t\t\ttextDisplay2('I will go try and find one.');\n\t\t}\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===829)\n\t{\n\t\t\n\t\tif(artifact===true)\n\t\t{\n\t\t characterPic2('kasuf');\n\t\t textDisplay2('That will go great in my collection. I will tell you what I know.');\n\t\t advanceTalkCounter++;\n\t\t}\n\t\telse\n\t\t{\n\t\t characterPic2(avatarPic);\n\t\t textDisplay2('');\n\t\t}\n\t\t\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===830)\n\t{\n\t\tcharacterPic2('kasuf');\n\t\ttextDisplay2('The wraith have been the dominate force in the universe for as long as anyone can remember. They have never ventured this far into the universe before but i have heard pleantly of stories from those in other galaxies.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===831)\n\t{\n\t\tcharacterPic2('kasuf');\n\t\ttextDisplay2('When they reach a planet they bomb it from orbit destroying all military infrastructure. Then the begin to cull the population, bringing them up to their ships to feast on later.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===832)\n\t{\n\t\tcharacterPic2('kasuf');\n\t\ttextDisplay2('There numbers are so large that there are only rumors of those that can oppose them.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===833)\n\t{\n\t\tcharacterPic2('kasuf');\n\t\ttextDisplay2('If they never visited your planet before, perhaps if you destroy their ship before they can send a single to their fleet you may be able to stop anymore ships from coming..');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===834)\n\t{\n\t\tcharacterPic2('kasuf');\n\t\ttextDisplay2('I have heard stories of a few planets that managed to survive like this. Perhaps it can work for yuor planet as well.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===835)\n\t{\n\t\tcharacterPic2('kasuf');\n\t\ttextDisplay2('That\\'s all I have to say on the matter, I hope I have been of some help.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===836)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Thank you, you have been very helpful');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===837)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===839)\n\t{\n\t\tcharacterPic2('scara');\n\t\ttextDisplay2('Hello stranger, my name is Scara.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===840)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Hello, is there anything of interest here?');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===841)\n\t{\n\t\tcharacterPic2('scara');\n\t\ttextDisplay2('If you search around you could probably find an artifact or two.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===842)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Thank you');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===843)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\t\n\telse if(advanceTalkCounter===852)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('There appears to be the parts to fix the air filter.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===854)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('There appears to be an artifact here.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===890)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('I can\\'t beam to the ship from here, i need to be in the pyramid.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\t//return to ship and battle dialogue\n\telse if(advanceTalkCounter===900)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Welcome back aboard, i see you have retrieved the parts to fix the air filtration system.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===901)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('It\\'s a good thing too. The oxygen levels are dangeriously low, so go repair it.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===902)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Good, now that it is fixed, we can travel to earth. With even a little luck, we will reach earth to warn them before the Wraith arrive.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===903)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('When you are ready, go to the control room and engage the hyperdrive.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===904)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===906)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Wait. The sensors have detected another ship in orbit.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===907)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('It\\'s the Wraith! They opened fire, they\\'re targeting the hyperdrive, it\\'s offline, we can\\'t make the jump yet.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===908)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('They\\'ve stopped firing, we\\'re recieving a communication.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===909)\n\t{\n\t\tpicSwitcher('hiveShip');\n\t\tcharacterPic2('wraith');\n\t\ttextDisplay2('Prepare to die.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===910)\n\t{\n\t\tpicSwitcher('shipControlRoom');\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Quick, activate the weapons system.');\n\t\tadvanceTalkCounter++;\n\t\tbattle=true;\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===916)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('There is no need to activate the weapon system at this time.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===917)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\t\t\t\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===918)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Ship Health: '+shipHealth +' '+' '+' '+ ' You have selected to divert power to the shields. Ship health increased by 40.');\n\t\tadvanceTalkCounter=923;\n\t\t\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===920)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Weapon system engaged. Select weapon to engage.');\n\t\t\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===922)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Ship Health: '+shipHealth +' '+' '+' '+' You have selected to engage the: '+weaponSelect+'. Engaging now.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===923)\n\t{\n\t\tif(wraithHealth>0)\n\t\t{\n\t\t var randomnumber=Math.floor(Math.random()*11) \n\t\t if(randomnumber<=6) //adjust this number to increase/decrease difficulty of the battle. Higher the number the easier it will be\n\t\t {\n\t\t picSwitcher('hiveFiring');\n\t\t characterPic2('ai');\n\t\t textDisplay2('The wraith ship has fired again. Our ship has suffered 25 damage.');\n\t\t shipHealth-=25;\t\n\t\t advanceTalkCounter=920;\n\t\t weaponFired=false;\n\t\t gameOver();\n\t\t }\n\t\t else\n\t\t {\n\t\t picSwitcher('hiveRegenerating');\n\t\t characterPic2('ai');\n\t\t textDisplay2('The wraith ship is diverting power to hull regeneration, it\\'s health has gone up.');\n\t\t wraithHealth+=25;\t\n\t\t advanceTalkCounter=920;\n\t\t weaponFired=false;\n\t\t gameOver();\n\t\t }\n\t\t}\n\t\telse\n\t\t{\n\t\t advanceTalkCounter=930;\n\t\t advanceTalk();\n\t\t}\n\t}\n\telse if(advanceTalkCounter===925)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Cannot fire again yet. Click next to see what the Wraith do.');\n\t\tadvanceTalkCounter=923;\n\t\t\n\t}\n\telse if(advanceTalkCounter===930)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('The Wraith ship has been destroyed! The hyperdrive is back online, when your ready we can finally go to Earth.');\n\t\tadvanceTalkCounter++;\n\t\tbuttonWeaponSystem_ControlRoom.style.display='none'\n\t\tbuttonStart_ControlRoom.style.display='block'\n\t\t\n\t}\n\telse if(advanceTalkCounter===931)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('');\n\t\tadvanceTalkCounter++;\n\t\tbuttonWeaponSystem_ControlRoom.style.display='none'\n\t\tbuttonStart_ControlRoom.style.display='block'\n\t\t\n\t}\n\t\n\t//end game dialogue\n\telse if(advanceTalkCounter===935)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('The ship has arrived at earth, I will open a communication channel with them.');\n\t\tadvanceTalkCounter+=2;\n\t\tbuttonWeaponSystem_ControlRoom.style.display='none'\n\t\tbuttonStart_ControlRoom.style.display='none'\n\t\tpicSwitcher('earth');\n\t\t\n\t}\n\telse if(advanceTalkCounter===937)\n\t{\n\t\tcharacterPic2('hammond');\n\t\ttextDisplay2('Hello I am General Hammond, our sensors tell us that this is an Earth vessel from the exploaritory expedition. We would like to debrief your crew as soon as possible, are any more ships returning.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===938)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('General Hammond Sir, I am the only crew member left aboard this ship, and no other ships are coming, they have all been destroyed.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===939)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('They were destroyed by a powerful enemy called the Wraith. The Wraith are on their way here right now, you need to deploy any forces you have.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===940)\n\t{\n\t\tcharacterPic2('hammond');\n\t\ttextDisplay2('We only have a few ships left but we\\'ll put up one hell of a fight.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===941)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Good the Wraith will probably be here soon.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===942)\n\t{\n\t\tpicSwitcher('wraithFleet');\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('Our sensors have detected the Wraith fleet emerging from hyperspace.');\n\t\tadvanceTalkCounter+=2;\n\t\t\n\t}\n\telse if(advanceTalkCounter===944)\n\t{\n\t\tcharacterPic2('hammond');\n\t\ttextDisplay2('Our ships are ready for battle. Good luck everyone');\n\t\tpicSwitcher('earthFleet');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===945)\n\t{\n\t\t\n\t\tpicSwitcher('battle1');\n\t\tcharacterPic2('caldwell');\n\t\ttextDisplay2('Engaging hostile vessels. Firing missiles.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===946)\n\t{\n\t\t\n\t\tpicSwitcher('battle2');\n\t\tcharacterPic2('caldwell');\n\t\ttextDisplay2('Minimal effect. Switch to beam weapons.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===947)\n\t{\n\t\t\n\t\tpicSwitcher('battle3');\n\t\tcharacterPic2('ellis');\n\t\ttextDisplay2('Firing beam weapons, direct hit.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}else if(advanceTalkCounter===948)\n\t{\n\t\t\n\t\tpicSwitcher('battle4');\n\t\tcharacterPic2('ellis');\n\t\ttextDisplay2('That\\'s a kill!.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===949)\n\t{\n\t\t\n\t\tpicSwitcher('battle5');\n\t\tcharacterPic2('caldwell');\n\t\ttextDisplay2('Three hives firing on us. Shields are failing. We\\'re not going to make it!');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===950)\n\t{\n\t\tcharacterPic2('hammond');\n\t\ttextDisplay2('Their forces are too many, we\\'ve lost contact with half our fleet. Their ships are attacking the planet!');\n\t\tpicSwitcher('wraithEarth');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===951)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('I\\'m detecting another fleet entering orbit');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===952)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('It\\'s the Asgard');\n\t\tadvanceTalkCounter++;\n\t\tpicSwitcher('asgardFleet');\n\t\t\n\t}\n\telse if(advanceTalkCounter===953)\n\t{\n\t\tcharacterPic2('thor');\n\t\ttextDisplay2('Hello friend, the Asgard high council approved a mission to protect Earth.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===954)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Thor! It\\'s great to see you. I don\\'t think we would\\'ve lasted much longer.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\telse if(advanceTalkCounter===955)\n\t{\n\t\tcharacterPic2('thor');\n\t\ttextDisplay2('The enemy fleet is in full retreat, I seriously doubt they will return.');\n\t\tadvanceTalkCounter++;\n\t\tpicSwitcher('asgardMeeting');\n\t\t\n\t}\n\telse if(advanceTalkCounter===956)\n\t{\n\t\tcharacterPic2('thor');\n\t\ttextDisplay2('General Hammond, you owe the survival of your planet to...');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===957)\n\t{\n\t\tcharacterPic2('thor');\n\t\ttextDisplay2('I just realized I never got your name.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===958)\n\t{\n\t\tcharacterPic2('thor');\n\t\ttextDisplay2('What\\'s your name?');\n\t\tadvanceTalkCounter++;\n\t\tnameDiv.style.display='block'\n\t\tnameBox.style.display='block'\n\t\tnameButton.style.display='block'\n\t\tgetName();\t\t\n\t}\n else if(advanceTalkCounter===959)\n\t{\n\t\tcharacterPic2('thor');\n\t\ttextDisplay2('Well '+name+', thank you once again, I hope we see each other again.');\n\t\tadvanceTalkCounter++;\n\t\tnameDiv.style.display='none'\t\t\n\t}\n\telse if(advanceTalkCounter===960)\n\t{\n\t\tcharacterPic2('hammond');\n\t\ttextDisplay2(name+' you will be greatly rewarded.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===961)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Thank you sir, glad to have helped.');\n\t\tadvanceTalkCounter++;\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===962)\n\t{\n\t\tcharacterPic2(avatarPic);\n\t\ttextDisplay2('Congrationaltions you have won! Thanks for playing');\n\t\tpicSwitcher('victory');\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===980)\n\t{\n\t\tcharacterPic2('ai');\n\t\ttextDisplay2('That weapon system is not installed on the ship.');\n\t\t\n\t\t\t\t\n\t}\n\telse if(advanceTalkCounter===1000)\n\t{\n\t\tcharacterPic2('wraith');\n\t\ttextDisplay2('Your ship has been destroyed. You Lose. To try again, refresh the page.');\n\t\tadvanceTalkCounter++;\n\t\t\n\t}\n\t\n}", "function AIGamePlay(){\n\n let nextIndex = minimax(board , AIChar).index;\n\n if(nextIndex !== undefined){\n\n board[nextIndex] = AIChar;\n gameCell[nextIndex].innerHTML = AIChar;\n }\n \n}", "function BOT_agentSpeech() {\r\n\tswitch (BOT_theInterface) {\r\n \t\tcase \"STANDARD\":\tBOT_printStandardChar(); break;\r\n \t\tcase \"DEVELOPER\":\tBOT_printDevelopperChar(); break;\r\n \t\tcase \"DIVALITE\":\tBOT_printDivaliteChar(BOT_reqEmote, BOT_reqAnswerLong); break;\r\n\t\tdefault: \t\t\tBOT_printStandardChar();\r\n\t}\r\n}", "function builderAI(){\n\t// have empty spots\n\tif (getBuildingsByType(BUILDING_TYPE.EMPTY) == 0)\n\t\treturn;\n\t\n\tif (needForrests()){\n\t\tif (canBuild(BUILDING_TYPE.FORREST)){\n\t\t\tbuildBuilding(BUILDING_TYPE.FORREST, getOpenLand());\n\t\t\tconsole.log(\"Building forrest...\");\n\t\t}\n\t}\n\telse if (needHouses()){\n\t\tif (canBuild(BUILDING_TYPE.STONE_HOUSE)){\n\t\t\tbuildBuilding(BUILDING_TYPE.STONE_HOUSE, getOpenLand());\n\t\t\tconsole.log(\"Building stone house...\");\n\t\t} \n\t\telse if (canBuild(BUILDING_TYPE.WOODEN_HOUSE)) {\n\t\t\tbuildBuilding(BUILDING_TYPE.WOODEN_HOUSE, getOpenLand());\n\t\t\tconsole.log(\"Building wooden house...\");\n\t\t}\n\t}\n\telse if (needFarms()){\n\t\tif (canBuild(BUILDING_TYPE.FARM)){\n\t\t\tbuildBuilding(BUILDING_TYPE.FARM, getOpenLand());\n\t\t\tconsole.log(\"Building farm...\");\n\t\t} else {\n\t\t\tconsole.log(\"cannot build\");\n\t\t}\n\t}\n\telse if (needQuarries()){\n\t\tif (canBuild(BUILDING_TYPE.QUARRY)){\n\t\t\tbuildBuilding(BUILDING_TYPE.QUARRY, getOpenLand());\n\t\t\tconsole.log(\"Building quarries...\");\n\t\t}\n\t}\n}", "function Game_ActionResult() {\n this.initialize.apply(this, arguments);\n}", "function League() {}", "function theInterface(automata){\n automata.makeSet(\n {\n 'name': 'AutoBrowser'\n\n }, function(set){\n\n set.block.begins('init', function(){\n\n })\n\n set.block('visit', function(block){\n block.takes.url();\n block.outputs(automata.boolean);\n });\n\n set.block('collect', function(block){\n block.takes(\n automata\n .array\n .contains(automata.string)\n );\n });\n\n set.block('click', function(block){\n block.takes(automata.string)\n block.outputs(automata.boolean);\n });\n\n set.block('enter', function(block){\n /*\n * Here is an example of a block that can handle more than one type of input\n */\n block.takes( automata.tuple.matches( [automata.string, automata.string] );\n block.takes( automata.hash.maps(automata.string, automata.string));\n\n block.outputs(automata.boolean);\n });\n\n /*\n set.block('...',...)\n */\n\n });\n}", "function Start () {\n //health = 5;\n delayRotation = Random.Range(0,11);\n newRotation = Random.Range(-361,361);//calculer une angle aléatoire entre -361 et 361\n controller = GetComponent(\"CharacterController\");\n //script = GetComponent(\"AI\");//On recupère le scipt AI qui est un composant\n \n}", "function chaosAI(board) {\r\n // Currently, chaos AI is \"get order AI and do the opposite mark\"\r\n var chaosMove = orderAI(board, true);\r\n if (chaosMove && chaosMove.mark) {\r\n chaosMove.mark = notMark(chaosMove.mark);\r\n }\r\n return chaosMove;\r\n}", "function Beergame (opts) {\n }", "function takeAEasyMove(turn) {\n var available = game.currentState.emptyCells();\n var randomCell = available[Math.floor(Math.random() * available.length)];\n var action = new AIAction(randomCell);\n\n var next = action.applyTo(game.currentState);\n\n ui.insertAt(randomCell, turn);\n\n game.advanceTo(next);\n }", "function player() {}", "function AgentType(name, color, healthCategories, speed, health, drawFunction) {\n this.name = name;\n this.color = color;\n this.healthCategories = healthCategories || [];\n this.speed = speed || DEFAULT_SPEED;\n this.health = health || INITIAL_HEALTH;\n this.isHitable = false;\n this.canHit = false;\n this.drawFunction = drawFunction || function(){};\n}", "act(action) {\n\t\t// choose the type of square we are looking for(ex: if it's a carnivore's turn, it will look for herbivore type squares)\n\t\tvar preference;\n\t\tswitch(action) {\n\t\t\tcase \"move\":\n\t\t\t\tpreference = \" \";\n\t\t\t\tbreak;\n\t\t\tcase \"eatGrass\":\n\t\t\t\tpreference = \"|\";\n\t\t\t\tbreak;\n\t\t\tcase \"eatMeat\":\n\t\t\t\tpreference = \"o\";\n\t\t\t\tbreak;\n\t\t\tcase \"reproduce\":\n\t\t\t\tpreference = \" \";\n\t\t\t\tbreak;\n\t\t}\n\n\t\t//\tfilter the this.look() array to only the squares that match the current preference\n\t\tlet elementsAroundPreference = this.look().filter(curr => curr.type === preference);\n\t\tif (elementsAroundPreference.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\t\t\t\n\t\t//\trandom a square around\n\t\tconst randomSquarePreference = elementsAroundPreference[Math.floor(Math.random() * elementsAroundPreference.length)];\n\n\t\t// replace the targeted square with this object\n\t\tthis.grid.array[randomSquarePreference.index].type = this.type;\n\t\t\t\t\t\t\n\t\t//empty the old space if not in reproduce case\n\t\tif(action !== \"reproduce\") {\n\t\t\tthis.type = \" \";\n\t\t}\n\t}", "function addAttributes(e, type){\n switch (type){\n\n //Regular enemies\n case 'regular':\n \n e.hp = 2;\n e.speed = 3;\n e.reward = 10;\n e.color = 'black';\n e.r = 15;\n break;\n\n //Small enemies\n case 'small':\n e.hp = 1;\n e.speed = 2.5;\n e.reward = 5;\n e.color = 'red';\n e.r = 7;\n break;\n\n //Big enemies\n case 'big':\n e.hp = 5;\n e.speed = 0.5;\n e.reward = 20;\n e.color = 'green';\n e.r = 20;\n break;\n\n //Huge enemies\n case 'huge':\n e.hp = 10;\n e.speed = 1;\n e.reward = 10;\n e.color = 'blue';\n e.r = 30;\n break;\n }\n\n e.updateAttributes();\n}", "function startAI() {\n if (nameInput.value !== \"\") {\n changeName();\n addRemoveEL(1);\n }\n}" ]
[ "0.65789056", "0.637497", "0.6365794", "0.6363841", "0.62677985", "0.62266004", "0.6215718", "0.6137134", "0.61057854", "0.60712487", "0.6050705", "0.6031584", "0.6016021", "0.59890914", "0.5916784", "0.5911799", "0.5870207", "0.5855399", "0.58489895", "0.5804566", "0.57901186", "0.57592493", "0.5732658", "0.5731285", "0.57309693", "0.5680148", "0.5670686", "0.5664375", "0.56551963", "0.5653986", "0.5618979", "0.5617227", "0.56094563", "0.5607563", "0.5571491", "0.5568862", "0.55593187", "0.55560535", "0.55476016", "0.55463755", "0.5539209", "0.553611", "0.5534331", "0.5531629", "0.55201", "0.5513882", "0.55134934", "0.549158", "0.5485667", "0.5478746", "0.54783434", "0.5471984", "0.544929", "0.5440482", "0.54312927", "0.5428824", "0.5427106", "0.5424951", "0.54241246", "0.5421244", "0.5413474", "0.540781", "0.5396039", "0.53877556", "0.53806657", "0.5380086", "0.53679085", "0.536604", "0.5364179", "0.53635496", "0.5361374", "0.53464895", "0.5332012", "0.53234744", "0.5319155", "0.53167266", "0.5315144", "0.5312138", "0.53114694", "0.53091675", "0.52810097", "0.5274212", "0.5266301", "0.5262437", "0.5260445", "0.5260063", "0.5254603", "0.52530867", "0.52523685", "0.52489376", "0.5245404", "0.52408457", "0.52308494", "0.52260244", "0.52258563", "0.52242637", "0.5223272", "0.5222651", "0.522089", "0.52171206" ]
0.54133254
61
end the funcftion here a this is the graph of our layer / === ===tkharbi9 dial ayou === ===
function startRangingBeacons(){ // if(firstTime){ // $scope.loader=true; // } //alert(heatMap["B"][1].UUID); //alert(heatMap.length); // Request authorisation. t0=performance.now(); var t_beacon= []; var rssi_1218 =[]; var rssi_1219 =[]; var rssi_1221 =[]; var rssi_1222 =[]; var rssi_1211 =[]; var e = 0; //var deviceOreintation; // do{ // deviceOreintation=orientationDevice(function(hd){ return hd;}); // console.error('device orientation : '+deviceOreintation); // }while(deviceOreintation == undefined || deviceOreintation == 0) //orientationDevice(function(hd){ console.log(hd);}); //console.log('device orientation 1: '+deviceOreintation); /*orientationDevice(function(hd){ deviceOreintation=hd; console.log('device orientation 2: '+deviceOreintation); }); //console.log('device orientation 2: '+deviceOreintation); setTimeout(function(){},500); console.log('device orientation 3: '+deviceOreintation);*/ //$.when(navigator.compass.getCurrentHeading(onSuccess, onError)).then(heatos()); //var t0=performance.now(); navigator.compass.getCurrentHeading(onSuccess, onError); //var t1 = performance.now(); //console.log('performance time :'+(t1-t0)); //console.log('device orientation 3: '+deviceOreintation); //console.log('device orientation 3: '+deviceOreintation); //alert('biba '+biba); var heatMap = []; var der=''; //alert('device ortientation : '+deviceOreintation); // start 4 directions if(deviceOreintation>=105 && deviceOreintation<195){ heatMap = southHeatMap; //console.log("i m in south" +deviceOreintation); } if(deviceOreintation>=195 && deviceOreintation<285){ heatMap = westHeatMap; //console.log("i m in west" +deviceOreintation); } if((deviceOreintation>=285 && deviceOreintation<360) || (deviceOreintation>=0 && deviceOreintation<15)){ heatMap = northHeatMap; //console.log("i m in north" +deviceOreintation); } if(deviceOreintation>=15 && deviceOreintation<105){ heatMap = eastHeatMap; //console.log("i m in east" +deviceOreintation); } estimote.beacons.startRangingBeaconsInRegion( {}, // Empty region matches all beacons. function(beaconInfo) { $.each(beaconInfo.beacons, function(key, beacon){ var string_UUID = beacon.proximityUUID; var lengthUUID = string_UUID.length; var lastUUID = string_UUID.substr(lengthUUID - 4); if( lastUUID == '1218' ) rssi_1218.push(beacon.rssi); if( lastUUID == '1219' ) rssi_1219.push(beacon.rssi); if( lastUUID == '1221' ) rssi_1221.push(beacon.rssi); if( lastUUID == '1222' ) rssi_1222.push(beacon.rssi); if( lastUUID == '1211' ) rssi_1211.push(beacon.rssi); //t_beacon.push({ "uuid" :beacon.proximityUUID,"rssi" : beacon.rssi}); }); //t0=performance.now(); e++; //t1 = performance.now(); //console.log('performance time biba:'+(t1-t0)); if(e > 9){ //with the other algorithm /*if(rssi_1218.length>0){ var sum_1218 = rssi_1218.reduce(sum_array); var mean_1218 = sum_1218 / rssi_1218.length; var standat_1218 = standart_array(rssi_1218, mean_1218, sum_1218); var final_rssi_1218 = final_rssi(rssi_1218, mean_1218, standat_1218); t_beacon.push({"uuid":"b9407f30-f5f8-466e-aff9-25556b571218", "rssi": final_rssi_1218}); } if(rssi_1219.length>0){ var sum_1219 = rssi_1219.reduce(sum_array); var mean_1219 = sum_1219 / rssi_1219.length; var standat_1219 = standart_array(rssi_1219, mean_1219, sum_1219); var final_rssi_1219 = final_rssi(rssi_1219, mean_1219, standat_1219); t_beacon.push({"uuid":"b9407f30-f5f8-466e-aff9-25556b571219", "rssi": final_rssi_1219}); } if(rssi_1221.length>0){ var sum_1221 = rssi_1221.reduce(sum_array); var mean_1221 = sum_1221 / rssi_1221.length; var standat_1221 = standart_array(rssi_1221, mean_1221, sum_1221); var final_rssi_1221 = final_rssi(rssi_1221, mean_1221, standat_1221); t_beacon.push({"uuid":"b9407f30-f5f8-466e-aff9-25556b571221", "rssi": final_rssi_1221}); } if(rssi_1222.length>0){ var sum_1222 = rssi_1222.reduce(sum_array); var mean_1222 = sum_1222 / rssi_1222.length; var standat_1222 = standart_array(rssi_1222, mean_1222, sum_1222); var final_rssi_1222 = final_rssi(rssi_1222, mean_1222, standat_1222); t_beacon.push({"uuid":"b9407f30-f5f8-466e-aff9-25556b571222", "rssi": final_rssi_1222}); } if(rssi_1211.length>0){ var sum_1211 = rssi_1211.reduce(sum_array); var mean_1211 = sum_1211 / rssi_1211.length; var standat_1211 = standart_array(rssi_1211, mean_1211, sum_1211); var final_rssi_1211 = final_rssi(rssi_1211, mean_1211, standat_1211); t_beacon.push({"uuid":"b9407f30-f5f8-466e-aff9-25556b571211","rssi": final_rssi_1211}); }*/ // with kalman filter kalmanFilter(rssi_1218,t_beacon,"b9407f30-f5f8-466e-aff9-25556b571218"); kalmanFilter(rssi_1219,t_beacon,"b9407f30-f5f8-466e-aff9-25556b571219"); kalmanFilter(rssi_1221,t_beacon,"b9407f30-f5f8-466e-aff9-25556b571221"); kalmanFilter(rssi_1222,t_beacon,"b9407f30-f5f8-466e-aff9-25556b571222"); kalmanFilter(rssi_1211,t_beacon,"b9407f30-f5f8-466e-aff9-25556b571211"); for(var i;i<t_beacon.length;i++){ console.log('uuid : '+t_beacon[i].uuid+' rssi :'+t_beacon[i].rssi) } // algorithme of heatMap var errorTab; var min=Math.pow(10,20); var err=0; var Zonefinale; for(var i=0;i<heatMap.length;i++){ var error = 0; var zone = heatMap[i].zone; var gefunden = false; for(k=0;k<t_beacon.length;k++){ for(j=0;j<heatMap[i].listBeacons.length;j++){ if(t_beacon[k].uuid.toLowerCase() == heatMap[i].listBeacons[j].uuid.toLowerCase()){ gefunden=true; err = Math.pow(Math.abs(heatMap[i].listBeacons[j].rssi)-Math.abs(t_beacon[k].rssi),2); } } if(!gefunden){ err = Math.pow(t_beacon[k].rssi,2); } error += err; } console.log("Zone "+zone+" Error "+error); if(min>error){ min = error; Zonefinale = zone; } } console.log("min ="+min+" zone="+Zonefinale); //alert('zone: '+Zonefinale+', direction : '+der); var lengthZone = zones.length; for(i =0;i<lengthZone;i++){ if(zones[i].zone == Zonefinale){ pos_device = { "x": zones[i].x, "y": zones[i].y }; } } d3.select("#Device_position").transition().duration(800) .attr("visibility","visible") .attr("cx",pos_device.x) .attr("cy",pos_device.y ); d3.select("#Device_position_error").transition().duration(800) .attr("visibility","visible") .attr("cx",pos_device.x) .attr("cy",pos_device.y ); // d3.select("#directionOfPosition").transition().duration(800) // .attr("visibility","visible") // .attr("x",pos_device.x) // .attr("y",pos_device.y ); // end heat map lagorithm t_beacon =[]; rssi_1218 =[]; rssi_1219 =[]; rssi_1221 =[]; rssi_1222 =[]; rssi_1211 =[]; e = 0; //var t0=performance.now(); navigator.compass.getCurrentHeading(onSuccess, onError); //var t1 = performance.now(); //console.log('performance time 2 :'+(t1-t0)); t1=performance.now(); console.log(' performance time : '+(t1-t0)); if(firstTime){ firstTime = false; findWay(Zonefinale); $('.loader').hide(); //$scope.panel = 1; } } }, function(errorMessage) { alert('Ranging error: ' + errorMessage) }); }//End Of startRangingBeacons
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "layer (data) {\n return _layer.draw(data)\n }", "function draw() {\n clear();\n leg();\n}", "draw(data) {\n //clear the svg\n this.vis.selectAll(\"*\").remove();\n\n //our graph, represented through nodes and links\n let nodes = [];\n let links = [];\n\n //add our nodes\n //add the committee nodes\n let init_y = 0;\n Object.keys(data.committees || {}).forEach((key) => {\n nodes.push({id:\"c_\"+data.committees[key].id, name: data.committees[key].name, x: 300, fx: 300, y: init_y+=60});\n });\n\n //add the representative nodes\n init_y = 0;\n Object.keys(data.representatives || {}).forEach((key) => {\n nodes.push({id:\"r_\"+data.representatives[key].id, name: data.representatives[key].name,party:data.representatives[key].party, x:600, fx: 600, y: init_y+=60});\n });\n\n //add the bill nodes\n init_y = 0;\n Object.keys(data.bills || {}).forEach((key) => {\n nodes.push({id:\"b_\"+data.bills[key].bill_id, name: data.bills[key].name, bill:true, x: 900, fx: 900, y: init_y+=60});\n });\n\n //add our links\n //add the donation links between committees and representatives\n Object.keys(data.donations || {}).forEach((key) => {\n if(data.donations[key].source in data.committees && data.donations[key].destination in data.representatives){\n links.push({source:\"c_\"+data.donations[key].source, target: \"r_\"+data.donations[key].destination,thickness:data.donations[key].amount, status:data.donations[key].support == \"S\" ? 1 : 2});\n }\n });\n\n //add the vote links between representatives and bills\n Object.keys(data.votes || {}).forEach((key) => {\n if(data.votes[key].source in data.representatives && data.votes[key].destination in data.bills){\n links.push({source:\"r_\"+data.votes[key].source, target: \"b_\"+data.votes[key].destination, status:data.votes[key].position == \"Yes\" ? 1 : data.votes[key].position == \"No\" ? 2 : 3});\n }\n });\n\n //a scaling function that limits how think or thin edges can be in our graph\n let thicknessScale = d3.scaleLinear().domain([0,d3.max(data.donations,(d) => {return d.amount;})]).range([2, 20]);\n\n //function that calls our given context menu with the appropria parameters\n let contextMenu = (d) => {\n let event = d3.getEvent();\n event.preventDefault();\n this.nodeMenu(d, event);\n };\n\n //Create a force directed graph and define forces in it\n //Our graph is essentially a physics simulation between nodes and edges\n let force = d3.forceSimulation(nodes)\n .force(\"charge\", d3.forceManyBody().strength(250).distanceMax(300))\n .force('link', d3.forceLink(links).distance(0).strength(.1).id((d) => {return d.id;}))\n .force(\"collide\", d3.forceCollide().radius(30).iterations(2).strength(.7))\n .force(\"center\", d3.forceCenter())\n .force('Y', d3.forceY().y(0).strength(.001));\n //Draw the edges between the nodes\n let edges = this.vis.selectAll(\"line\")\n .data(links)\n .enter()\n .append(\"line\")\n .style(\"stroke-width\", (d) => { return thicknessScale(d.thickness); })\n .style(\"stroke\", (d) => {\n if(d.status == 1) {\n return \"Green\";\n } else if(d.status == 2) {\n return \"Purple\";\n }\n return \"White\";\n })\n .attr(\"marker-end\", \"url(#end)\");\n //Draw the nodes themselves\n let circles = this.vis.selectAll(\"circle\")\n .data(nodes)\n .enter()\n .append(\"circle\")\n .attr(\"r\", 20)\n .style(\"stroke\", \"black\")\n .style(\"fill\", (d) => {\n if(d.party == \"R\"){\n return d.color = \"#E64A19\"; //red\n } else if(d.party==\"D\"){\n return d.color = \"#1976D2\"; //blue\n } else {\n return d.color = \"#BCAAA4\"; //brown\n }\n })\n .on('contextmenu', contextMenu);\n //Draw text for all the nodes\n let texts = this.vis.selectAll(\"text\")\n .data(nodes)\n .enter()\n .append(\"text\")\n .attr(\"fill\", \"black\")\n .attr(\"font-family\", \"sans-serif\")\n .attr(\"font-size\", \"10px\")\n .html((d) => { return d.name; })\n .each((d, i, nodes) => { d.bbox = nodes[i].getBBox(); })\n .on('contextmenu', contextMenu);\n //Draw text background for all the nodes\n let textBGs = this.vis.selectAll(\"rect\")\n .data(nodes)\n .enter()\n .insert(\"rect\", \"text\")\n .attr(\"fill\", (d) => {return d.color;})\n .attr(\"width\", (d) => {return d.bbox.width+10})\n .attr(\"height\", (d) => {return d.bbox.height+10})\n .on('contextmenu', contextMenu);\n\n //For every tick in our simulation, we update the positions for all ui elements\n force.on(\"tick\", () => {\n edges.attr(\"x1\", (d) => { return d.source.x; })\n .attr(\"y1\", (d) => { return d.source.y; })\n .attr(\"x2\", (d) => { return d.target.x; })\n .attr(\"y2\", (d) => { return d.target.y; });\n circles.attr(\"cx\", (d) => { return d.x; })\n .attr(\"cy\", (d) => { return d.y; })\n texts.attr(\"transform\", (d) => { return \"translate(\" + (d.party || d.bill ? d.x : d.x-d.bbox.width) + \",\" + (d.y+(d.bbox.height/4)) + \")\"; });\n textBGs.attr(\"transform\", (d) => { return \"translate(\" + (d.party || d.bill ? d.x-5 : d.x-d.bbox.width-5) + \",\" + (d.y-(d.bbox.height*.5)-5) + \")\"; });\n }); // End tick func\n\n //zoom and pan our graph such that all elements are visible\n setTimeout(() => {this.zoomTo(this.vis)}, 500);\n }", "init(){\n\t\t// create arr for all layers\n\t\tlet layers =[];\n\t\tlet lang = this.lang.gn;\n\n\t\t// encoder\n\t\t// creating the ALGORITHM PANEL\n\t\tthis.algorithm = new ALGORITHM(this.encoderSteps(this.lang.alg, this.m, this.k),this.m, this.k, this.user);\n\t\t// setting the algorithm's schema to some position\n\t\tthis.algorithm.panel.setPos({ x:1100 , y: 50});\n\t\tlayers.push(this.algorithm.layer);\n\t\tthis.layer = this.applyEncoder();\n\t\t//this.layer.draw();\n\n\t\t// dragmove event for algorithm panel\n\t\tthis.algorithm.panel.on('dragmove', function(e){\n\t\t\tif(typeof componentsPos.alg !== 'undefined'){\n\t\t\t\tcomponentsPos.alg = this.position();\n\t\t\t}\n\t\t\telse console.log('componentsPos.alg is undefined');\n\t\t});\n\n\t\t// set timer max time\n\t\tmodel.stat.timer.setMaxTime({min:20});\n\t\t// starting the timer\n\t\tmodel.stat.timer.start();\n\n\t\t// mark the step setParam as pass\n\t\tthis.algorithm.increment();\n\n\t\tthis.simFinish=function(){\n\t\t\tmodel.ir.vals = [...model.ir.valsBack];\n\t\t\tlet html='';\n\t\t\thtml='<p><b>'+lang.modeEnc+'</b><\\p>';\n\t\t\thtml +='<p><b>'+lang.codeParam+':</b> m = '+this.m+', l<sub>0</sub> = '+this.t+', k = '+this.k+', n = '+this.n+'<\\p>';\n\t\t\thtml +='<p><b>'+lang.genPoly+': </b>P(x) = '+ $('#selGenPolyBtn').html() +'<\\p>';\n\t\t\tlet valStr='';\n\t\t\tvalStr = model.ir.vals.toString().replace(/,/g,'');\n\t\t\thtml+='<p><b>'+lang.infoBits+':</b> X = '+valStr+'<\\p>';\n\t\t\thtml+='<p><b>'+lang.cwBits+': </b>[X] = '+model.cr.vals.toString().replace(/,/g,'')+'<\\p>';\n\t\t\tthis.stat.timer.stop(); // stop the timer\n\t\t\thtml+='<p><b>'+lang.solveTime+': </b>'+this.stat.timer.val.text()+'<\\p>'\n\t\t\thtml+='<p><b>'+this.stat.error.label.text()+'</b>'+this.stat.error.val.text()+'<\\p>'\n\n\t\t\t// create simulation finish message\n\t\t\tlet finishDialog=$(\"<div id='finishDialog' title='' class='dialog'></div>\").appendTo($(\".modelDiv\"));\n\t\t\tfinishDialog.dialog({\n\t\t\t\tautoOpen : false, modal : false, show : \"blind\", hide : \"blind\",\n\t\t\t\tminHeight:100, minWidth:400, height: 'auto', width: 'auto',\n\t\t\t\tclose: function() {\n\t\t\t\t\t$(\"#finishDialog\").css({'color':'black'});\n\t\t\t\t}\n\t\t\t});\n\t\t\tfinishDialog.dialog('option','title', lang.finishMsg);\n\t\t\tfinishDialog.html(html);\n\t\t\t$('#finishDialog p').css({'margin':'1px'});\n\t\t\t$(\".ui-dialog-titlebar-close\").hide();\n\t\t\tfinishDialog.dialog('open');\n\n\t\t\t// check for task\n\t\t\ttasks.check(finishDialog);\n\t\t};\n\n\t\t// change container width according to total component width\n\t\tthis.width = this.en.width() + this.algorithm.panel.width() + 80;\n\t\tthis.height = this.en.y() + this.en.height();\n\n\t\tif(this.width > stage.width()) {\n\t\t\tstage.width(this.width);\n\t\t\t$(\".model\").width(this.width);\n\t\t\tthis.stat.rect.width(this.width - 40);\n\t\t}\n\t\tif(this.width > stage.height()) {\n\t\t\tstage.height(this.width);\n\t\t\t$(\".model\").height(this.width);\n\t\t}\n\n\t\tlayers.push(this.layer);\n\t\treturn layers;\n\t}", "draw () { //change name to generate?? also need to redo\n return null;\n }", "display(){\n\n push();\n // stylize this limb\n strokeWeight(1);\n stroke(45, 175);\n\n // vary fill values\n let redFill = cos(radians(frameCount/0.8));\n\n if(this.legOverlap) {\n this.greenFill = 30+cos(radians(frameCount*8 ))*25;\n redFill = 185+cos(radians(frameCount*3))*30;\n }\n else {\n this.greenFill = 200+cos(radians(frameCount*8 ))*45;\n redFill = 30+cos(radians(frameCount*3))*25;\n }\n\n // give arms and legs a different fill\n if(this.flip===1){\n if(this.xflip===1) fill(this.greenFill, redFill, 23);\n if(this.xflip===-1) fill(23, redFill, this.greenFill);\n }\n if(this.flip===-1) fill(redFill, 25, this.greenFill);\n\n // apply thigh rotation\n rotateZ(this.xflip*radians(this.thigh.angle2));\n rotateX(this.flip*this.thigh.angle - radians(dude.back.leanForward));\n rotateY(this.direction*PI - 2* this.xflip*dude.hipMove);\n translate(0, -this.thigh.length/2, 0);\n\n // draw thigh\n box(10, this.thigh.length, 10);\n\n // apply knee rotation\n translate(0, -this.thigh.length/2, 0)\n rotateX(this.knee.angle);\n // rotate this limb to match hip motion\n rotateZ(radians(-3*dude.hipMove));\n translate(0, this.thigh.length/2, 0);\n\n // draw knee\n box(10, this.thigh.length, 10);\n pop();\n }", "generateGraph(){\n const start=new Node(0)\n start.setNodeType(\"Start\")\n //const end = new Node(-5)\n\n const graph = new Graph(start)\n\n const map = this.state.electricMap\n //console.log(map)\n let dataLength = this.state.electricMap.length;\n let nodeArray=[]\n for(let i=0;i<dataLength;i++){\n let nodeData = map[i];\n //console.log(nodeData)\n let tempNode = new Node(nodeData.id)\n tempNode.setCurrentPower(nodeData.currentPower)\n tempNode.setNodeType(nodeData.type)\n tempNode.setBranch(nodeData.branch)\n tempNode.setCapacity(nodeData.capacity)\n tempNode.setIsTripped(nodeData.isTripped)\n tempNode.setFaultCurrent(nodeData.faultCurrent)\n tempNode.setSwitchType(nodeData.switchType)\n nodeArray.push(tempNode)\n }\n //nodeArray.push(end)\n graph.addVertertices(nodeArray)\n let allPrimarys = graph.findPrimary();\n for(let i=0;i<allPrimarys.length;i++){\n start.setAdjacent(allPrimarys[i],0)\n }\n //console.log(graph)\n\n let allVertices=graph.getVertices()\n for(let i=0;i<dataLength;i++){\n let nodeData = map[i]\n let nodeAdjacents = \"[\"+nodeData.adjecent+\"]\"\n let nodesJson = JSON.parse(nodeAdjacents)\n //console.log(nodesJson)\n let vertex = allVertices[i+1];\n for(let j=0;j<nodesJson.length;j++){\n let nodeID=nodesJson[j][0]\n let nodeWeight = Number(nodesJson[j][1])\n let nodeLength = Number(nodesJson[j][2])\n let nodeConductivity = Number(nodesJson[j][3])\n let node = graph.getVertex(nodeID)\n if(node!==undefined && nodeWeight!==NaN){\n if(nodeID!==-2){\n if(vertex.getNodeType()===\"Start\"){\n vertex.setAdjacent(node,0,0,0)\n }\n vertex.setAdjacent(node,nodeWeight,nodeLength,nodeConductivity)\n }\n\n //console.log(vertex.getNodeId()+\",\"+node.getNodeId())\n }\n\n }\n }\n this.setState({\n graph: graph\n })\n //console.log(graph,this.state.graph)\n }", "function drawLayer(layerID)\r\n {\r\n\t showStatePopups = false; // prevent regular popups\r\n\r\n\t var layer = curLayers[layerID]\r\n\t layer.visible = 1;\r\n\r\n var theSize = layer.size;\r\n var theColor = layer.color //\"#00214D\"\r\n var layerData = layer.data;\r\n\r\n var normalScaleString = \"\"+defaultScale+\" \"+defaultScale;\r\n var normalScaleStr = normalScaleString;\r\n\r\n layer.objSet = R.set();\r\n for (var i in layerData)\r\n {\r\n \t var u= layerData[i];\r\n\t\t if(typeof(u.name) == \"undefined\" || u.name == null || u.name == \"\" )\r\n\t\t\t break;\r\n\r\n\r\n \t var theHref = \"/jurisdictions/\" + u.pk;\r\n \t var attr = {href:theHref, fill:theColor, stroke: \"none\",opacity: .9, index: i, scale: normalScaleString };\r\n\t\t if(layerID == 'UASI' && u.tier == 1)\r\n\t\t\t attr.fill = \"#145A95\";\r\n\r\n\t\t var newx= u.coords.x * defaultScale;\r\n\t\t var newy= u.coords.y * defaultScale;\r\n\r\n\t\t if(u.isRegional == 1)\r\n\t\t {\r\n\t\t\t attr.fill = fcColors[u.regional];\r\n\t\t\t layer.objSet.push(R.text(newx+10, newy, u.name).attr({href:theHref, fill:layer.color, \"text-anchor\":\"start\" }));\r\n\t\t }\r\n\r\n\r\n\t\t u.obj = R.circle(newx, newy, theSize).attr(attr);\r\n\t\t u.obj.node.index=i;\r\n\r\n\t\t layer.objSet.push(u.obj);\r\n\r\n\t\t u.obj.mouseover(function(event)\r\n\t\t {\r\n\t\t var item = layerData[this.node.index];\r\n\t\t var x = 'pk'+ item.pk;\r\n\r\n\t\t if(layerID == 'UASI')\r\n\t\t {\r\n\t\t var budget = 12324;\r\n\t\t displayPopupWnd({box: item.obj.getBBox(), width:130, height:50, id:item.pk, x:item.coords.x, y:item.coords.y, textLines: [item.name, 'funding '+ budget] });\r\n\t\t }\r\n\t\t else if(item.isRegional != 1)\r\n\t\t {\r\n\t\t displayPopupWnd({box: item.obj.getBBox(), width:200, height:40, id:item.pk, x:item.coords.x, y:item.coords.y, textLines: [item.name] });\r\n\t\t }\r\n\t\t });\r\n\r\n\t \t u.obj.mouseout(function(event)\r\n\t \t {\r\n\t \t\t var item = layerData[this.node.index];\r\n\t \t\t removePopupWnd({id:item.pk});\r\n\t \t });\r\n } // end of for (var i in layerData)\r\n\r\n if(layerID == 'FUSIONCENTER')\r\n colorStates(layerID);\r\n\r\n }", "function setGraph() {\r\n\tchartBusyProc();\r\n\tvar lyrId = $(\"#chartLayer\").val();\r\n\t// console.log(lyrId);\r\n\tif (lyrId == 'x') {\r\n\t\tif (typeof chartFun == 'undefined') {\r\n\t\t\t// chartBusyDone();\r\n\t\t\tchartError('Selection required to display graph');\r\n\t\t}\r\n\t\teval(chartFun+'(\"'+ newUrl+'\")');\r\n\t} else { /// assuming wms layer\r\n\t\tvar lyr = map.getLayer(lyrId);\r\n\t\tif (typeof markers == 'undefined') {\r\n\t\t\t// chartBusyDone();\r\n\t\t\tchartError(\"A location on the map needs to be selected.\");\r\n\t\t} else {\r\n\t\t\tWMSFeatInfo(lyr);\r\n\t\t} \r\n\t}\r\n}", "function fl_outToDag ()\n\t\t{if(freez==\"false\"){\n\t\t\tconsole.log(\"hit\")\n\t\t\tthis.rimon.alpha=1\n\t\t\tthis.sufgania.alpha=1\n\t\t\tthis.selek.alpha=1\n\t\t\tthis.tamar.alpha=1\n\t\t\tthis.karpas.alpha=1\n\t\t\tthis.levivot.alpha=1\n\t\t\tthis.haroset.alpha=1\n\t\t\tthis.maza.alpha=1\n\t\t\tthis.hasa.alpha=1\n\t\t\tthis.beiza.alpha=1\n\t\t\tthis.hazeret.alpha=1\n\t\t\tthis.mamtak.alpha=1\n\t\t\tthis.gvina.alpha=1\n\t\t\tthis.oznei_aman.alpha=1\n\t\t\tthis.dvash.alpha=1\n\t\t\tthis.sumsum.alpha=1\n\t\t\tthis.perot.alpha=1\n\t\t\tthis.mishloah.alpha=1\n\t\t\tthis.of.alpha=1\n\t\t this.chanuka_btn.alpha=1\n\t\t this.tu_btn.alpha=1\n\t\t this.purim_btn.alpha=1\n\t\t this.pesach_btn.alpha=1\n\t\t this.shavuot_btn.alpha=1\n\t\t this.bible_btn.alpha=1\n\t\t\t\t\t this.arrow_btn.alpha=0\n\t\tthis.arrowAside_mc.alpha=0\n\t\tthis.gvina_explain.alpha=0\n\t\tthis.mishloah_explain.alpha=0\n\t\tthis.sufgania_explain.alpha=0\n\t\tthis.perot_explain.alpha=0\n\t\tthis.tapuah_explain.alpha=0\n\t\tthis.maza_explain.alpha=0\n\t\t}}", "function Graph_setup () { }", "function layer1(trans) {\n\tvar dataPath = \"./dataset/songs.json\";\n\n\tvar margin = 40,\n\t\toffset = 28,\n\t\twidth = 1024,\n\t\theight = 720;\n\t\tradius = 240,\n\t\tr = 600;\n\t\tcenter = {x:radius + margin, y:radius + margin},\n\t\tinTransLength = 1000,\n\t\toutTransLength = 1000,\n\t\tyear_apart = 15,\n\t\tminBubble = 7,\n\t\tmaxBubble = 30;\n\n\tvar svg,\n\t\tminYear, \n\t\tmin, \n\t\tmaxYear, \n\t\tmax, \n\t\tradiScale,\n\t\tcolor, \n\t\ttip, \n\t\tcir;\n\n\t// initialize variables\n\tfunction initVar(data) {\n\t\tmin = d3.min(data, function(d) { return d.year; });\n\t\tmax = d3.max(data, function(d) { return d.year; });\n\n\t\tminYear = new Date(min, 1, 1);\n\t\tmaxYear = new Date(max, 1, 1);\n\n\t\tcolor = d3.scale.sqrt()\n\t\t\t\t\t.domain([min, max])\n\t\t\t\t\t.range([circleFillRangeMin, circleFillRangeMax]);\n\n\t\tcir = d3.scale.linear()\n\t\t\t.domain(d3.extent(data, function(d) { return d.hotArr.length; }))\n\t\t\t.range([minBubble, maxBubble]);\n\n\t\tradiScale = d3.scale.linear()\n\t\t\t\t\t.domain([min, max])\n\t\t\t\t\t.range([0, radius]);\n\t}\n\n\t// Load the data\n\td3.json(dataPath,\n\t\t\tfunction(d) {\n\t\t\t\tvar data = d.map(function(d) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tpopularity: d.popularity,\n\t\t\t\t\t\thotArr:d.hotArr,\n\t\t\t\t\t\tpopArr:d.popArr,\n\t\t\t\t\t\thotness: d.hotness,\n\t\t\t\t\t\tyear: d.year\n\t\t\t\t \t\t};\n\t\t\t\t \t});\n\t\t\t\t// start drawing the visualization\n\t \t\t\tstart(data);\n\t\t\t});\n\n\t// the tool tip\n\ttip = d3.tip().attr('class', 'd3-tip')\n\t\t\t\t.offset([-10, 0]);\n\n\n\n\tsvg = d3.select(\"body\").append(\"svg\")\n\t\t \t.attr(\"width\", width)\n\t \t.attr(\"height\", height)\n\t \t\t.append(\"g\")\n\t \t\t.attr(\"transform\", \"translate(\" + (width - r) / 2 + \",\" + (height - r) / 2 + \")\")\n\t \t\t.call(tip);\n\t\n\tsvg.append(\"text\")\n\t\t.attr(\"id\", \"layer1_title\")\n\t\t.text(\"Artists grouped by hotness and familiarity per year\")\n\t\t.attr(\"transform\", \"translate(\" + (5 - (width - r) / 2) + \",\" + (-30) + \")\");\n\n\tsvg.attr(\"transform\", \"translate(\" + (width - r) / 2 + \",\" + (height - r) / 2 + \")\");\n\n\tfunction start(data){\n\t\t\td3.select(\"img\").remove();\n\t\t\tinitVar(data);\n\t\t\tdrawAxis();\n\t\t\tdrawLine();\n\t\t\tdrawYearScale();\n\t\t\tdrawLegend();\n\t\t\tbindData(data);\n\t\t}\n\n\t// 3 axises in total, left, right and bottom\n\tfunction drawAxis(){\n\t\tvar xLeft, xRight, xLeftAxis, xRightAxis, bottom;\n\n\t\txLeft = d3.time.scale()\n\t\t\t.domain([maxYear, minYear])\n\t\t\t.range([margin, radius + margin]);\n\n\t\txRight = d3.time.scale()\n\t\t\t.domain([minYear, maxYear])\n\t\t\t.range([radius + margin, 2*radius + margin]);\n\n\t\txLeftAxis = getAxis(xLeft);\n\t\txRightAxis = getAxis(xRight);\n\n\t\tsvg.append(\"line\")\n\t\t\t.attr(\"class\", \"bottom_xAxis\")\n\t\t\t.attr(\"x1\", margin)\n\t\t\t.attr(\"y1\", center.y + offset)\n\t\t\t.attr(\"x2\", margin + 2 * radius)\n\t\t\t.attr(\"y2\", center.y + offset)\n\t\t\t.attr(\"opacity\", 0)\n\t\t\t.transition()\n\t\t\t.duration(inTransLength)\n\t\t\t.attr(\"opacity\", 1);\n\t\t\n\t\tappendAxis(xLeftAxis, \"xLeft axis\");\n\t\tappendAxis(xRightAxis, \"xRight axis\");\n\t}\n\n\t// helper function to init axis\n\tfunction getAxis(axis){\n\t\treturn d3.svg.axis()\n\t\t \t\t.scale(axis)\n\t\t \t\t.tickPadding(3)\n\t\t \t\t.ticks(d3.time.years, year_apart);\n\t}\n\n\t// helper function to draw axis\n\tfunction appendAxis(axis, className){\n\t\tsvg.append(\"g\")\n\t \t.attr(\"class\", className)\n\t \t.attr(\"transform\", \"translate(0,\" + center.y + \")\")\n\t \t.call(axis)\n\t \t.attr(\"opacity\", 0)\n\t\t\t.transition()\n\t\t\t.duration(inTransLength)\n\t\t\t.attr(\"opacity\", 1);\n\t}\n\n\tfunction drawLine(data){\n\t\tvar line_offset = 25,\n\t\t\ttext_offset = 30,\n\t\t\ttext_x,\n\t\t\ttext_y,\n\t\t\trotate;\n\t\t// hotness line scale\n\t\tfor (var i = 1; i <= 9; i++) {\n\t\t\tsvg.append(\"line\")\n\t\t\t\t.attr(\"class\", \"line_scale\")\n\t\t\t\t.attr(\"id\", \"hot_line\" + i)\n\t\t\t\t.attr(\"x1\", center.x - (Math.cos(i*Math.PI/10) * (radius + line_offset)))\n\t\t\t\t.attr(\"y1\", center.y - (Math.sin(i*Math.PI/10) * (radius + line_offset)))\n\t\t\t\t.attr(\"x2\", center.x)\n\t\t\t\t.attr(\"y2\", center.y)\n\t\t\t\t.attr(\"opacity\", 0)\n\t\t\t\t.transition()\n\t\t\t\t.duration(inTransLength)\n\t\t\t\t.attr(\"opacity\", 1);\n\n\t\t\ttext_x = center.x - (Math.cos(i*Math.PI/10 - 0.02) * (radius + text_offset)),\n\t\t\ttext_y = center.y - (Math.sin(i*Math.PI/10 - 0.02) * (radius + text_offset)),\n\t\t\trotate = 180 - Math.atan2(text_x-center.x, text_y-center.y)/(Math.PI/180);\n\t\t\t\n\t\t\t// add the number\n\t\t\tputText(\"scale_number\", \"hot_number\" + i, text_x, text_y, rotate, i);\t\t\t\n\t\t}\n\t\t// draw the popularity line scale\n\t\tfor (var i = 11; i <= 19; i++){\n\t\t\tsvg.append(\"line\")\n\t\t\t\t.attr(\"class\", \"line_scale\")\n\t\t\t\t.attr(\"id\", \"pop_line\" + (i-10))\n\t\t\t\t.attr(\"x1\", center.x - (Math.cos(i*Math.PI/10) * (radius + line_offset)))\n\t\t\t\t.attr(\"y1\", center.y + offset - (Math.sin(i*Math.PI/10) * (radius + line_offset)))\n\t\t\t\t.attr(\"x2\", center.x)\n\t\t\t\t.attr(\"y2\", center.y + offset)\n\t\t\t\t.attr(\"opacity\", 0)\n\t\t\t\t.transition()\n\t\t\t\t\t.duration(inTransLength)\n\t\t\t\t\t.attr(\"opacity\", 1);\n\n\t\t\ttext_x = center.x - (Math.cos(i*Math.PI/10 - 0.02) * (radius + text_offset)),\n\t\t\ttext_y = center.y + offset - (Math.sin(i*Math.PI/10 - 0.02) * (radius + text_offset)),\n\t\t\trotate = 180 - Math.atan2(text_x-center.x, text_y-center.y)/(Math.PI/180);\n\t\t\t\n\t\t\t// add text\n\t\t\tputText(\"scale_number\", \"pop_number\" + (i-10), text_x, text_y, rotate, (i-10));\n\t\t}\n\n\t\ttext_x = center.x - radius - 30,\n\t\ttext_y = center.y + 10;\n\t\tputText(\"scale_number\", \"hot_number0\", text_x, text_y, 270, 0);\n\n\t\ttext_x = center.x + radius + 30,\n\t\ttext_y = center.y;\n\t\tputText(\"scale_number\", \"hot_number10\", text_x, text_y, 90, 1);\n\n\t\ttext_x = center.x - radius - 30,\n\t\ttext_y = center.y + offset;\n\t\tputText(\"scale_number\", \"pop_number10\", text_x, text_y, 270, 1);\n\n\t\ttext_x = center.x + radius + 30,\n\t\ttext_y = center.y + 20;\n\t\tputText(\"scale_number\", \"pop_number0\", text_x, text_y, 90, 0);\n\t}\n\n\t// helper function to put text\n\tfunction putText(className, idName, text_x, text_y, rotation, num){\n\t\t\tsvg.append(\"text\")\n\t\t\t\t.attr(\"id\", idName)\n\t\t\t\t.attr(\"class\", className)\n\t\t\t\t.attr(\"x\", text_x)\n\t\t\t\t.attr(\"y\", text_y)\n\t\t\t\t.text(num)\n\t\t\t\t.attr(\"transform\", \"rotate(\" + rotation + \" \" + text_x + \",\" + text_y + \")\")\n\t\t\t\t.attr(\"opacity\", 0)\n\t\t\t\t.transition()\n\t\t\t\t.duration(inTransLength)\n\t\t\t\t.attr(\"opacity\", 1);\n\t}\n\n\tfunction drawYearScale(data){\n\t\t// need to hard code the year\n\t\tvar arr = [1935, 1950, 1965, 1980, 1995, 2010];\n\t\tvar points = 50;\n\n\t\tvar up_angle = d3.scale.linear()\n\t\t .domain([0, points-1])\n\t\t .range([-Math.PI/2, Math.PI/2]);\n\n\t\tvar down_angle = d3.scale.linear()\n\t\t .domain([0, points-1])\n\t\t .range([Math.PI/2, 3*Math.PI/2]);\n\n\t\tfor (var i = 0; i < 6; i++){\n\t\t\tdrawYear(0, up_angle, arr, i, points);\n\t\t\tdrawYear(offset, down_angle, arr, i, points);\n\t\t}\n\t}\n\n\t// helper function to draw the year\n\tfunction drawYear(off, angle, arr, i, points){\n\t\tsvg.append(\"path\")\n\t\t\t.datum(d3.range(points))\n\t\t .attr(\"class\", \"year_scale\")\n\t\t .attr(\"d\", d3.svg.line.radial()\n\t\t \t\t\t\t.radius(radiScale(arr[i]))\n\t\t \t\t\t\t.angle(function(d, j) { return angle(j); }))\n\t\t .attr(\"transform\", \"translate(\" + center.x + \", \" + (center.y + off) + \")\")\n\t\t .attr(\"opacity\", 0)\n\t\t\t.transition()\n\t\t\t.duration(inTransLength)\n\t\t\t.attr(\"opacity\", 1);\n\t}\n\n\tfunction drawLegend(){\n\t\tvar grad = svg.append(\"defs\")\n\t\t\t.append(\"svg:linearGradient\")\n\t\t\t\t.attr(\"id\", \"grad1\")\n\t\t\t\t.attr(\"x1\", \"0%\")\n\t\t\t\t.attr(\"y1\", \"0%\")\n\t\t\t\t.attr(\"x2\", \"100%\")\n\t\t\t\t.attr(\"y2\", \"0%\");\n\n\t\tgrad.append(\"svg:stop\")\n\t\t\t.attr(\"offset\", \"0%\")\n\t\t\t.style(\"stop-color\", circleFillRangeMin)\n\t\t\t.style(\"stop-opacity\", \"1\");\n\t\t\n\t\tgrad.append(\"svg:stop\")\n\t\t\t.attr(\"offset\", \"100%\")\n\t\t\t.style(\"stop-color\", circleFillRangeMax)\n\t\t\t.style(\"stop-opacity\", \"1\");\n\n\t\tvar legend = svg.append(\"g\")\n\t\t//background\n\t\tlegend.append(\"rect\")\n\t\t\t.attr(\"width\", 145)\n\t\t\t.attr(\"height\", 75)\n\t\t\t.attr(\"fill\", legendBackground)\n\t\t\t.attr(\"stroke\", \"black\");\n\t\t\n\t\tdrawLegendText(legend, 7, 30, 11.5, \"Year\");\n\t\tdrawLegendText(legend, 7, 15, 11.5, \"Size: Num. Artist\");\n\t\n\t\tlegend.append(\"rect\")\n\t\t\t.attr(\"width\", 105)\n\t\t\t.attr(\"height\", 20)\n\t\t\t.attr(\"x\", 20)\n\t\t\t.attr(\"y\", 35)\n\t\t\t.attr(\"fill\", \"url(#grad1)\");\n\t\t\n\t\tdrawLegendText(legend, 20, 65, 10, min).attr(\"text-anchor\", \"middle\");\n\t\tdrawLegendText(legend, 125, 65, 10, max).attr(\"text-anchor\", \"middle\");\n\t\t\n\t\tlegend.attr(\"transform\", \"translate(\" + (5 - (width - r) / 2) + \",\" + (height - 185) + \")\")\n\t\t\t.attr(\"opacity\", 0)\n\t\t\t.transition()\n\t\t\t\t.duration(inTransLength)\n\t\t\t\t.attr(\"opacity\", 1);\n\t}\n\n\t// helper function to draw the legend text\n\tfunction drawLegendText(legend, x, y, size, text){\n\t\treturn legend.append(\"text\")\n\t\t\t\t\t.attr(\"x\", x)\n\t\t\t\t\t.attr(\"y\", y)\n\t\t\t\t\t.attr(\"font-size\", size)\n\t\t\t\t\t.style(\"fill\", legendTextColor)\n\t\t\t\t\t.text(text);\n\t}\n\n\tfunction bindData(data){\n\n\t\tsvg.selectAll(\"hotness\")\n\t\t\t.data(data)\n\t\t\t.enter()\n\t\t\t.append(\"circle\")\n\t\t\t.attr(\"id\", function(d, i) { return \"hotness\" + i; })\n\t\t\t.attr(\"class\", \"hotness\")\n\t\t\t.attr(\"cx\", function(d) { return transit(d, \"x\", \"hotness\"); })\n\t\t\t.attr(\"cy\", function(d) { return transit(d, \"y\", \"hotness\"); })\n\t\t\t.attr(\"r\", function(d) {\n\t\t\t\tif (trans) {\n\t\t\t\t\tif (d.year == trans.year && d.hotness == trans.hotness && d.popularity == trans.popularity) {\n\t\t\t\t\t\treturn 300;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn cir(d.hotArr.length);\n\t\t\t\t\t}\t\n\t\t\t\t} else {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.style(\"fill\", function(d) { return color(d.year); })\n\t\t\t.style(\"fill-opacity\", getOpacity)\n\t\t\t.on(\"mouseover\", mouseover)\n\t\t\t.on(\"mouseleave\", mouseleave)\n\t\t\t.on(\"click\", toSecLayer)\n\t\t\t.transition()\n\t\t\t.duration(outTransLength)\n\t\t\t.delay(delayTran)\n\t\t\t.attr(\"cx\", function(d) { return coord(d, \"x\", \"hotness\", radiScale(d.year)); })\n\t\t\t.attr(\"cy\", function(d) { return coord(d, \"y\", \"hotness\", radiScale(d.year)); })\n\t\t\t.style(\"fill-opacity\", 0.3)\n\t\t\t.attr(\"r\", function(d) { return cir(d.hotArr.length); });\n\n\t\tsvg.selectAll(\"popularity\")\n\t\t\t.data(data)\n\t\t\t.enter()\n\t\t\t.append(\"circle\")\n\t\t\t.attr(\"id\", function(d, i) { return \"pop\" + i; })\n\t\t\t.attr(\"class\", \"popularity\")\n\t\t\t.attr(\"cx\", function(d) { return transit(d, \"x\", \"pop\"); })\n\t\t\t.attr(\"cy\", function(d) { return transit(d, \"y\", \"pop\"); })\n\t\t\t.attr(\"r\", function(d) {\n\t\t\t\tif (trans) {\n\t\t\t\t\tif (d.year == trans.year && d.hotness == trans.hotness && d.popularity == trans.popularity) {\n\t\t\t\t\t\treturn 300;\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn cir(d.popArr.length);\n\t\t\t\t\t}\t\n\t\t\t\t} else {\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.style(\"fill\", function(d) { return color(d.year); })\n\t\t\t.style(\"fill-opacity\", getOpacity)\n\t\t\t.on(\"mouseover\", mouseover)\n\t\t\t.on(\"mouseleave\", mouseleave)\n\t\t\t.on(\"click\", toSecLayer)\n\t\t\t.transition()\n\t\t\t.duration(outTransLength)\n\t\t\t.delay(delayTran)\n\t\t\t.attr(\"cx\", function(d) { return coord(d, \"x\", \"pop\", radiScale(d.year)); })\n\t\t\t.attr(\"cy\", function(d) { return coord(d, \"y\", \"pop\", radiScale(d.year)); })\n\t\t\t.style(\"fill-opacity\", 0.3)\n\t\t\t.attr(\"r\", function(d) { return cir(d.popArr.length); });\n\t}\n\n\t// helper function to get the coordinate of x and y\n\tfunction transit(d, coor, className){\n\t\tif (trans) {\n\t\t\tif (d.year == trans.year && d.hotness == trans.hotness && d.popularity == trans.popularity) {\n\t\t\t\treturn 300;\n\t\t\t} else {\n\t\t\t\treturn coord(d, coor, className, radius*2);\n\t\t\t}\n\t\t} else {\n\t\t\treturn coord(d, coor, className, radiScale(d.year));\n\t\t}\n\t}\n\n\t// helper function to get fill opacity level\n\tfunction getOpacity(d){\n\t\tif (trans) {\n\t\t\tif (d.year == trans.year && d.hotness == trans.hotness && d.popularity == trans.popularity) {\n\t\t\t\treturn 1;\n\t\t\t} else {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t} else {\n\t\t\treturn 0.3;\n\t\t}\n\t}\n\n\t// helper function to get the delay time\n\tfunction delayTran(d){\n\t\tif (!trans || (trans && d.year == trans.year && d.hotness == trans.hotness && d.popularity == trans.popularity)) {\n\t\t\treturn 0;\n\t\t} else {\n\t\t\treturn outTransLength/2;\n\t\t}\n\t}\n\n\t// helper function to get the coordinate\n\tfunction coord(d, coordinate, type, year){\n\t\tvar len, val, array, sign, low;\n\t\tif (coordinate === \"x\") {\n\t\t\tarray = (type === \"hotness\") ? d.hotArr : d.popArr;\n\t\t\tsign = (type === \"hotness\") ? -1 : 1;\n\t\t\tlen = array.length == 0 ? 0 : array.length - 1;\n\t\t\tval = center.x + sign * (Math.cos(Math.PI * array[Math.round(Math.random()*(len - 0))]) * year);\n\t\t} else {\n\t\t\tif (type === \"hotness\"){\n\t\t\t\tarray = d.hotArr;\n\t\t\t\tsign = -1;\n\t\t\t\tlow = 0;\n\t\t\t} else {\n\t\t\t\tarray = d.popArr;\n\t\t\t\tsign = 1;\n\t\t\t\tlow = offset;\n\t\t\t}\n\t\t\tlen = array.length == 0 ? 0 : array.length - 1;\n\t\t\tval = center.y + low + sign * (Math.sin(Math.PI * array[Math.round(Math.random()*(len - 0))]) * year); \n\t\t}\n\t\treturn Math.round(val);\n\t}\n\n\tfunction mouseover(d, i){\n\t\tsvg.select(\"#pop\" + i)\n\t\t\t.style(\"fill\", \"black\")\n\t\t\t.style(\"fill-opacity\", 1);\t\t\t\n\t\t\n\t\tsvg.select(\"#hotness\" + i)\n\t\t\t.style(\"fill\", \"black\")\n\t\t\t.style(\"fill-opacity\", 1);\n\t\t\t\n\t\tvar coord = d3.mouse(this);\n\t\t\n\t\tif (coord[1] > center.y + 20) {\n\t\t\ttip.html(function(d) {\n\t\t\t\t\treturn \"<strong>Year:</strong> <span style='color:red'>\" + d.year + \"</span><br />\" + \n\t\t\t\t\t\"<strong>Familiarity:</strong> <span style='color:red'>\" + d.popularity + \"</span><br />\" +\n\t\t\t\t\t\"<strong>Hotness:</strong> <span style='color:red'>\" + d.hotness + \"</span><br />\" + \n\t\t\t\t\t\"<strong>Num. Artist:</strong> <span style='color:red'>\" + d.popArr.length + \"</span>\";\n\t\t\t\t});\t\t\n\t\t} else {\n\t\t\ttip.html(function(d) {\n\t\t\t\t\treturn \"<strong>Year:</strong> <span style='color:red'>\" + d.year + \"</span><br />\" + \n\t\t\t\t\t\"<strong>Hotness:</strong> <span style='color:red'>\" + d.hotness + \"</span><br />\" + \n\t\t\t\t\t\"<strong>Familiarity:</strong> <span style='color:red'>\" + d.popularity + \"</span><br />\" +\n\t\t\t\t\t\"<strong>Num. Artist:</strong> <span style='color:red'>\" + d.hotArr.length + \"</span>\"; \n\t\t\t\t});\n\t\t}\n\t\tchangeFontSize(d.popularity, d.hotness, \"40px\");\n\t\ttip.show(d);\n\t\t\n\t}\n\n\tfunction mouseleave(d, i){\n\t\tsvg.select(\"#pop\" + i)\n\t\t\t.style(\"fill-opacity\", 0.3)\n\t\t\t.style(\"fill\", function(d) { return color(d.year); });\n\n\t\tsvg.select(\"#hotness\" + i)\n\t\t\t.style(\"fill-opacity\", 0.3)\n\t\t\t.style(\"fill\", function(d) { return color(d.year); });\n\n\t\tchangeFontSize(d.popularity, d.hotness, \"20px\");\n\t\ttip.hide(d);\n\t}\n\n\tfunction changeFontSize(pop, hot, fontSize){\n\t\tsvg.select(\"#pop_number\" + pop)\n\t\t\t\t.style(\"font-size\", fontSize);\n\t\tsvg.select(\"#hot_number\" + hot)\n\t\t\t\t.style(\"font-size\", fontSize);\n\n\t\tif (pop == 10) {\n\t\t\tsvg.select(\"#hot_number\" + 0)\n\t\t\t\t.style(\"font-size\", fontSize);\n\t\t}\n\n\t\tif (hot == 10) {\n\t\t\tsvg.select(\"#pop_number\" + 0)\n\t\t\t\t.style(\"font-size\", fontSize);\n\t\t}\n\t}\n\n\tfunction toSecLayer(d, i){\n\t //remove events immediately\n\t svg.selectAll(\"circle\")\n\t \t.on(\"mouseover\", null)\n\t\t\t.on(\"mouseleave\", null)\n\t\t\t.on(\"click\", null)\n\t\t\n\t\t//shrink all other circles\n\t\tsvg.selectAll(\"circle\").filter(function(d, i) {\n\t\t\treturn d != this;\n\t\t}).transition()\n\t\t\t.duration(inTransLength)\n\t\t\t.attr(\"r\", 0);\n\t\t\n\t\t//fade all labels and axis\n\t\tsvg.selectAll(\"text\")\n\t\t\t.transition()\n\t\t\t\t.duration(inTransLength)\n\t\t\t\t.style(\"opacity\", 0);\n\t\tsvg.selectAll(\"line\")\n\t\t\t.transition()\n\t\t\t\t.duration(inTransLength)\n\t\t\t\t.style(\"opacity\", 0);\n\t\tsvg.selectAll(\"path\")\n\t\t\t.transition()\n\t\t\t\t.duration(inTransLength)\n\t\t\t\t.style(\"opacity\", 0);\n\t\tsvg.selectAll(\"g\")\n\t\t\t.transition()\n\t\t\t\t.duration(inTransLength)\n\t\t\t\t.style(\"opacity\", 0);\n\t\t\n\t\t//make clicked circle fill screen and transition to layer root bubble fill color\n\t d3.select(this).transition()\n\t \t.duration(inTransLength)\n\t \t.attr(\"r\", 300)\n\t \t.attr(\"cx\", 300)\n\t \t.attr(\"cy\", 300)\n\t \t.style(\"fill\", rootCircleFill)\n\t \t.each(\"end\", function() {\n\t \t\ttip.hide(d);\n\t\t\t\td3.select(\"div\").remove();\n\t\t\t\td3.select(\"svg\").remove();\n\t\t\t\tlayer2(d.year, d.hotness, d.popularity);\n\t \t});\t\n\t} \n}", "function draw() {\n\tnodesVis = new vis.DataSet(nodes);\n\tedgesVis = new vis.DataSet(edges);\n\tvar data = {\n\t nodes: nodesVis,\n\t edges: edgesVis\n\t};\n network = new vis.Network(container, data, options);\n \n //动画稳定后的处理事件\n\tvar stabilizedTimer;\n\tnetwork.on(\"stabilized\", function (params) { // 会调用两次?\n\t\texportNetworkPosition(network);\n\t\twindow.clearTimeout(stabilizedTimer);\n\t\tstabilizedTimer = setTimeout(function(){\n\t\t\toptions.physics.enabled = false; // 关闭物理系统\n\t\t\tnetwork.setOptions(options);\n\t\t\tnetwork.fit({animation:true});\n\t\t},100);\n\t});\n\n\t// 右键\n\tnetwork.on(\"oncontext\",function(params){});\n\n\t//选中节点\n\tnetwork.on(\"selectNode\", function (params) {\n\t\t\n\t\t\n\t});\n\n\t//单击节点\n\tnetwork.on(\"click\", function (params) {});\n\n\t//双击节点 隐藏或者显示子节点\n\tnetwork.on(\"doubleClick\", function (params) {\n\t\tif(params.nodes.length != 0){\n\t\t\toptions.physics.enabled = true;\n\t\t\tfor(var i in nodes){\n\t\t\t\tnodes[i].fixed = false\n\t\t\t\tif(nodes[i].id == params.nodes[0]){\n\t\t\t\t\tnodes[i].x=0;\n\t\t\t\t\tnodes[i].y=0;\n\t\t\t\t\tnodes[i].fixed=true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdraw();\n\t\t}\n\t\t\n\t});\n\n\t//拖动节点\n\tnetwork.on(\"dragging\", function (params) {//拖动进行中事件\n\t\tif (params.nodes.length != 0 ) {\n\t\t\tnodeMoveFun(params);\n\t\t}\n\t});\n\n\t//拖动结束后\n\tnetwork.on(\"dragEnd\", function (params) {\n\t\tif (params.nodes.length != 0 ) {\n\t\t\tvar arr = nodeMoveFun(params);\n\t\t\texportNetworkPosition(network,arr);\n\t\t}\n\t});\n\n\t// 缩放\n\tnetwork.on(\"zoom\", function (params) {});\n\tnetwork.on(\"hoverNode\",function(params){\n\t\t\n\t})\n\t\n}", "function draw(topo) \n\t{\n\t\tself.svg.append(\"path\")\n\t\t\t.datum(graticule)\n\t\t\t.attr(\"class\", \"graticule\")\n\t\t\t.attr(\"fill\", \"none\")\n\t\t\t.attr(\"d\", path)\t\t\t\n\t\t\t.on(\"mousemove\", function(d,i) {\n\t\t\t\tvar posMouse = d3.mouse(this);\n\t\t\t\tvar posX = posMouse[0];\n\t\t\t\tvar posY = posMouse[1];\n\t\t\t\tmousemove();\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t})\t\t\t\t\n\t\t\t;\n\t\t\t\t\n\t\t\n\t\t\t\n\t\t\t\n/*\n\t\tg.append(\"path\")\n\t\t\t.datum({type: \"LineString\", coordinates: [[-180, 0], [-90, 0], [0, 0], [90, 0], [180, 0]]})\n\t\t\t.attr(\"class\", \"equator\")\n\t\t\t.attr(\"d\", path);\n*/\n\t\tvar country = g.selectAll(\".country\").data(topo);\n\n\t\tcountry.enter().insert(\"path\")\n\t\t\t//.attr(\"class\", \"country \")\n\t\t\t.attr(\"class\", function(d,i) {\n\t\t\tvar countryname = d.properties.name;\n\t\t\tcountryname = countryname.replace(/ /g, \"_\");\n\t\t\tcountryname = countryname.replace(/\\,/g, \"_\");\n\t\t\tcountryname = countryname.replace(/\\./g, \"_\");\n\t\t\t\treturn \"country \"+countryname;\n\t\t\t \t}\n\t\t\t\t)\n\t\t\t.attr(\"d\", path)\n\t\t\t.attr(\"id\", function(d,i) { return d.id; })\n\t\t\t.attr(\"title\", function(d,i) { return d.properties.name; })\n\t\t\t//.style(\"fill\", function(d, i) { return d.properties.color; })\n\n\t\t\t.on(\"click\", function(d,i) { \n\t\t\t\t//console.log(\"click=\"+d.properties.name); \t\t\t\n\t\t\t\t}\n\t\t\t\t)\n\t\t\t//.style(\"fill\", function(d,i) { return color(d.id); })\n\t\t\t;\n\n\t\t//offsets for tooltips\n\t\t//var offsetL = document.getElementById('container_graph').offsetLeft+20;\n\t\t//var offsetT = document.getElementById('container_graph').offsetTop+10;\n\t\tvar offsetL = document.getElementById(self.parentSelect.replace(\"#\",'')).offsetLeft+20;\n\t\tvar offsetT = document.getElementById(self.parentSelect.replace(\"#\",'')).offsetTop+10;\n\t\t\n\n\t\t//tooltips\n\t\tcountry\n\t\t\t.on(\"mousemove\", function(d,i) {\n\t\t\t\t//console.log(d.properties.name);\n\t\t\t\t\n\t\t\t\td3.select(this).style(\"fill\", \"RED\");\n\t\t\t\t\n\t\t\t\tvar mouse = d3.mouse(self.svg.node()).map( function(d) { return parseInt(d); } );\n\t\t\t\t\n\t\t\t\ttooltip.style(\"opacity\",1.0).html(d.properties.name);\n\t\t\t\t//tooltip.style(\"opacity\",1.0).html(\"textTooltip\");\n\t\t\t\t\n\t\t\t\t/*\n\t\t\t\ttooltip.classed(\"opacity\", 1.0)\n\t\t\t\t\t.attr(\"style\", \"left:\"+(mouse[0]+offsetL)+\"px;top:\"+(mouse[1]+offsetT)+\"px\")\n\t\t\t\t\t.html(d.properties.name);\n\t\t\t\t*/\n\t\t\t})\n\t\t\t.on(\"mouseout\", function(d,i) {\t\n\t\t\t\td3.select(this).style(\"fill\", \"Black\");\t\t\t\n\t\t\t\ttooltip.style(\"opacity\",0.0);\n \t\t})\n \t\t//.style(\"fill\", function(d,i) { return color(d.id); })\n \t\t; \n\n\n\t\t//EXAMPLE: adding some capitals from external CSV file\n\t\td3.csv(\"/app/modules/visualization/json/country-capitals.csv\", function(err, capitals) {\n\t\t\tcapitals.forEach(function(i){\n\t\t\t\taddpoint(i.CapitalLongitude, i.CapitalLatitude, i.CapitalName );\n\t\t\t});\n\n\t\t});\n\n\t}", "applyEncoder(){\n\t\t// creating the LAYER\n\t\tlet layer = new Konva.Layer();\n\t\t// get the selected language\n\t\tlet lang = this.lang.gn;\n\n\t\t// creating the INFORMATION REGISTER //////////////////////////////////////////////\n\t\tlet ir = new REGISTER({\n\t\t\tid: 'ir',\n\t\t\tname: lang.irLabel,\n\t\t\tbitsNum: this.m,\n\t\t\tshiftHoverTxt: lang.shiftHover,\n\t\t\tflipHoverTxt: lang.flipHover,\n\t\t\trandHoverTxt: lang.randHover,\n\t\t\trandBtnLabel: lang.randBitsLabel,\n\t\t\tflipBtnLabel: lang.flipBtnLabel,\n\t\t\tbit: {name: 'IR Bit', hover: lang.regBitHover, enabled: true},\n\t\t});\n\t\tlayer.add(ir);\n\t\tir.dragmove(false);\n\t\tir.S.visible(false);\n\n\t\t// creating the CODEWORD REGISTER ////////////////////////////////////////////////\n\t\tlet cr = new REGISTER({\n\t\t\tid: 'cw',\n\t\t\tname: lang.crLabel,\n\t\t\tbitsNum: this.n,\n\t\t\tbit : {name: 'CR Bit', enabled: false},\n\t\t\tshiftHoverTxt: lang.shiftHover,\n\t\t\tflipHoverTxt: lang.flipHover,\n\t\t\trandHoverTxt: lang.randHover,\n\t\t\trandBtnLabel: lang.randBitsLabel,\n\t\t\tflipBtnLabel: lang.flipBtnLabel,\n\t\t});\n\t\tlayer.add(cr);\n\t\tcr.empty();\n\t\tcr.dragmove(false);\n\t\tcr.writeBtn.visible(false);\n\n\t\t// creating the LFSR ENCODER //////////////////////////////////////////////\n\t\tlet en = new LFSR({\n\t\t\t\tname: lang.ccLFSRLabel,\n\t\t\t\tbitsNum: this.k,\n\t\t\t\txorIds: this.xorIds,\n\t\t\t\tpoly: 'P(x)='+this.genPoly.txt.toLowerCase(),\n\t\t\t\tsHover: lang.sHover,\n\t\t\t\tfHover: lang.fHover,\n\t\t\t\tsw: {hoverTxt: lang.swHover},\n\t\t\t\txor:{hoverTxt:lang.xorHover,\n\t\t\t\t\tfbHover:lang.fbHover}\n\t\t}, ir, cr, this.algorithm, this.stat);\n\t\ten.position({x:20, y:40});\n\t\tlayer.add(en);\n\t\ten.dragmove(false);\n\t\ten.fb.txtFb.text(lang.fbLabel);\n\n\t\t// creating the INFORMATION REGISTER //////////////////////////////////////////////\n\t\tlet pos={};\n\t\tpos.x = en.rect.absolutePosition().x;\n\t\tpos.y = en.rect.absolutePosition().y + en.rect.height() + 40;\n\n\t\tir.position(pos);\n\t\tir.inBit = function(){return '';};\n\t\t// IR 'Bit' click event\n\t\tir.bits.forEach(bit =>{\n\t\t\tbit.on('click touchstart', function(){\n\t\t\t\tlet check = model.algorithm.validStep('setBits');\n\t\t\t\tif (check === true) {\n\t\t\t\t\tbit.setBit();\n\t\t\t\t\tif(ir.areAllBitsSetted()) model.algorithm.markCurrStep('past');\n\t\t\t\t\telse model.algorithm.markCurrStep('curr');\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tbit.hover.show('e', check);\n\t\t\t\t\t//model.stat.error.add(check+' ('+model.algorithm.getCurrStep().description+')');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t\t// IR 'F' click event\n\t\tir.F.on('click touchstart', function(){\n\t\t\tlet currStep = model.algorithm.getCurrStep().name;\n\t\t\tif (currStep === 'setBits'){\n\t\t\t\tlet check;\n\t\t\t\tir.bits.forEach(bit => {\n\t\t\t\t\tif (bit.txt.text() === '') return check = 'emptyBit';\n\t\t\t\t});\n\t\t\t\tif (check === 'emptyBit'){\n\t\t\t\t\tthis.hover.show('e', lang.setAllBit);\n\t\t\t\t\t//model.stat.error.add(lang.setAllBit);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tmodel.algorithm.increment(); // enable flipIR\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet check = model.algorithm.validStep('flipIR');\n\t\t\tif (check === true) {\n\t\t\t\tir.valsBack = [...ir.vals]; // backup the register's values\n\t\t\t\tir.flip();\n\t\t\t\tconsole.log(model.algorithm.getCurrStep().description);\n\t\t\t\tmodel.algorithm.increment(); // enabling the next step\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.hover.show('e', check);\n\t\t\t\tmodel.stat.error.add(check);\n\t\t\t\treturn;\n\t\t\t}\n\t\t});\n\n\t\t// IR 'Random' click event\n\t\tir.rand.on('click touchstart', function(){\n\t\t\tlet check = model.algorithm.validStep('setBits');\n\t\t\tif (check === true) {\n\t\t\t\tmodel.algorithm.markCurrStep('curr');\n\t\t\t\tir.randGen();\n\t\t\t\t//this.fill('red');\n\t\t\t\tconsole.log(model.algorithm.getCurrStep().description);\n\t\t\t}\n\t\t\telse{\n\t\t\t\t//ir.info.show('e', check);\n\t\t\t\tthis.hover.show('e', check);\n\t\t\t\tmodel.stat.error.add(check);\n\t\t\t\treturn;\n\t\t\t}\n\t\t});\n\t\t// IR '>>>' click event\n\t\t// ir.S.on('click touchstart', function(){\n\t\t// \tlet check = model.algorithm.validStep('shiftIR');\n\t\t// \tif (check === true) {\n\t\t// \t\tir.shiftR('', '', 2);\n\t\t// \t\tconsole.log(model.algorithm.getCurrStep().description);\n\t\t// \t\tmodel.algorithm.increment(); // enable set1SW or set2SW\n\t\t// \t}\n\t\t// \telse {\n\t\t// \t\t//ir.info.show('e', check);\n\t\t// \t\tthis.hover.show('e', check);\n\t\t// \t\tmodel.stat.error.add(check);\n\t\t// \t\treturn;\n\t\t// \t}\n\t\t// });\n\n\t\t// codeword register position set\n\t\tcr.position({x: en.x()+en.width() + 40, y: en.soket('abs').connO.y - cr.rect.height()/2});\n\n\t\t// connection between IR and Encoder\n\t\tir.connectTo(en.soket('abs').connI);\n\n\t\t// connection between Encoder and CR\n\t\tcr.connectFrom(en.soket('abs').connO);\n\n\t\t// cr.inBit = function(){\n\t\t// \treturn en.sw2.pos === 1 ? ir.vals[ir.vals.length - 1]: en.vals[en.vals.length - 1];\n\t\t// };\n\n\t\t// CR '>>>' click event\n\t\tcr.S.on('click touchstart', function(){\n\t\t\t// check SW's position if current step is 'set2SW'\n\t\t\tlet currStep = model.algorithm.getCurrStep();\n\t\t\tif(currStep.name === 'set2SW') {\n\t\t\t\tif (model.en.sw1.pos !== 0){\n\t\t\t\t\tthis.hover.show('e', lang.wrongSw);\n\t\t\t\t\tmodel.stat.error.add(lang.wrongSw);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (model.en.sw2.pos !== 2){\n\t\t\t\t\tthis.hover.show('e', lang.wrongSw);\n\t\t\t\t\tmodel.stat.error.add(lang.lang.wrongSw);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tmodel.algorithm.increment(); // enable shiftEN (shiftParity)\n\t\t\t}\n\n\t\t\tlet check = model.algorithm.validStep('shiftCR');\n\t\t\tif (check === true){\n\t\t\t\tlet endFunc = function(){ir.shiftR('', '', 2);};\n\t\t\t\tif(model.en.sw2.pos === 1) cr.shiftR(ir.bits[ir.bits.length -1], ir.vals[ir.vals.length -1], 1, function(){ir.shiftR('', '', 2);});\n\t\t\t\telse if(model.en.sw2.pos === 2) cr.shiftR(en.bits[en.bits.length -1], en.vals[en.vals.length -1], 1, function(){en.shiftR(2);});\n\t\t\t\tconsole.log(model.algorithm.getCurrStep().description);\n\t\t\t\tmodel.algorithm.increment(); // enable shiftIR\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//cr.info.show('e', check);\n\t\t\t\tthis.hover.show('e', check);\n\t\t\t\tmodel.stat.error.add(check);\n\t\t\t\treturn;\n\t\t\t}\n\t\t});\n\t\t// CR 'R' click event\n\t\tcr.F.on('click touchstart', function(){\n\t\t\tlet check = model.algorithm.validStep('flipCR');\n\t\t\tif (check === true){\n\t\t\t\tcr.flip();\n\t\t\t\tconsole.log(model.algorithm.getCurrStep().description);\n\t\t\t\tmodel.algorithm.increment(); // last operation\n\t\t\t\tmodel.finish();\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//cr.info.show('e', check);\n\t\t\t\tthis.hover.show('e', check);\n\t\t\t\tmodel.stat.error.add(check);\n\t\t\t\treturn;\n\t\t\t}\n\t\t});\n\n\t\tlet gr = new Konva.Group();\n\t\tgr.draggable(true);\n\t\tgr.add(ir,cr,en);\n\t\tlayer.add(gr);\n\n\t\tthis.en = en;\n\t\tthis.ir = ir;\n\t\tthis.cr = cr;\n\n\t\treturn layer;\n\n\t}", "addToChangeLayers(){\n let _to = this.props.toVersion.key;\n //attribute change in protected areas layers\n this.addLayer({id: window.LYR_TO_CHANGED_ATTRIBUTE, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"fill-color\": \"rgba(99,148,69,0.4)\", \"fill-outline-color\": \"rgba(99,148,69,0.8)\"}, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n //geometry change in protected areas layers - to\n this.addLayer({id: window.LYR_TO_GEOMETRY_POINT_TO_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_POINT_TO_POLYGON_LINE, sourceId: window.SRC_TO_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY_LINE, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_POINT_COUNT_CHANGED_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_POINT_COUNT_CHANGED_POLYGON_LINE, sourceId: window.SRC_TO_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY_LINE, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_SHIFTED_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_GEOMETRY_SHIFTED_POLYGON_LINE, sourceId: window.SRC_TO_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_TO_CHANGED_GEOMETRY_LINE, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n //added protected areas layers\n this.addLayer({id: window.LYR_TO_NEW_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"fill-color\": \"rgba(63,127,191,0.2)\", \"fill-outline-color\": \"rgba(63,127,191,0.6)\"}, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_NEW_POINT, sourceId: window.SRC_TO_POINTS, type: \"circle\", sourceLayer: \"wdpa_\" + _to + \"_points\", layout: {visibility: \"visible\"}, paint: {\"circle-radius\": CIRCLE_RADIUS_STOPS, \"circle-color\": \"rgb(63,127,191)\", \"circle-opacity\": 0.6}, filter:INITIAL_FILTER, beforeID: window.LYR_TO_SELECTED_POLYGON});\n \n }", "function bugGraph(ctx, x, y, colour, opacity){\n //middle point x = 5, y = 20\n\n //head\n var left = (x - 5);\n var right = (x + 5);\n var up = (y - 20);\n var down = (y + 20)\n\n var p1y = (y + 12.5);\n var p2y = (y + 5);\n var transY = (y + 15);\n\n var h1y = (y - 2.5);\n var h2y = (y - 10);\n\n var legWidth = 2.5;\n var legHeight = 1.5;\n\n var legX1 = left + 0.5;\n var legX2 = x + 2.5;\n\n ctx.fillStyle = colour;\n\n var head = new Path2D(); \n head.moveTo(x, transY);\n head.bezierCurveTo(left, p1y, left, p2y, x, y);\n head.bezierCurveTo(right, p2y, right, p1y,\n x, transY);\n\n //leftAntennae\n var leftAntennae1 = new Path2D();\n leftAntennae1.moveTo(left,down);\n leftAntennae1.lineTo(left, (y + 17.5));\n leftAntennae1.lineTo((x - 2.5), down);\n\n var leftAntennae2 = new Path2D();\n leftAntennae2.moveTo(left, (down - 0.5));\n leftAntennae2.lineTo((left + 0.5), down);\n leftAntennae2.lineTo((x + 0.5), (y + 10));\n leftAntennae2.lineTo(x, (y + 9.5));\n\n //rightAntennae\n var rightAntennae1 = new Path2D();\n rightAntennae1.moveTo(right, down);\n rightAntennae1.lineTo(right, (y + 17.5));\n rightAntennae1.lineTo((x + 2.5), down);\n\n var rightAntennae2 = new Path2D();\n rightAntennae2.moveTo((right - 0.5), down);\n rightAntennae2.lineTo(right, (down - 0.5));\n rightAntennae2.lineTo(x, (y + 9.5));\n rightAntennae2.lineTo((x - 0.5), (y + 10));\n\n //bugBody\n var bugBody = new Path2D();\n bugBody.moveTo(x, p2y);\n bugBody.bezierCurveTo(left, h1y, left, h2y,\n x, up);\n bugBody.bezierCurveTo(right, h2y, right, h1y,\n x, p2y);\n\n ctx.globalAlpha = opacity;\n //front left foot\n ctx.fillRect(legX1, (y + 6.5), legWidth, legHeight);\n //front right foot\n ctx.fillRect(legX2, (y + 6.5), legWidth, legHeight);\n //middle left foot\n ctx.fillRect(legX1, (y - 1.5), legWidth, legHeight);\n //middle right foot\n ctx.fillRect(legX2, (y - 1.5), legWidth, legHeight); \n //back left foot\n ctx.fillRect(legX1, h2y, legWidth, legHeight);\n //back right foot\n ctx.fillRect(legX2, h2y, legWidth, legHeight);\n\n ctx.fill(head);\n ctx.fill(leftAntennae1);\n ctx.fill(leftAntennae2);\n ctx.fill(rightAntennae1);\n ctx.fill(rightAntennae2);\n ctx.fill(bugBody);\n ctx.restore();\n}", "function generateIdeaData()\n{\n createGraph();\n \n}", "function draw(topo) {\n\n svg.append(\"path\")\n .datum(graticule)\n .attr(\"class\", \"graticule\")\n .attr(\"d\", path);\n\n\n g.append(\"path\")\n .datum({type: \"LineString\", coordinates: [[-180, 0], [-90, 0], [0, 0], [90, 0], [180, 0]]})\n .attr(\"class\", \"equator\")\n .attr(\"d\", path);\n\n draw_countries();\n\n //charles_de_gaulle\n //frankfurt_main\n //tansonnhat_intl\n\n layer_route = g.append(\"g\").attr(\"id\", \"layer_route\").attr(\"visibility\", \"hidden\");\n\n layer_airport.push(g.append(\"g\").attr(\"id\", \"layer_airport_0\").attr(\"visibility\", \"hidden\"));\n layer_airport.push(g.append(\"g\").attr(\"id\", \"layer_airport_1\").attr(\"visibility\", \"hidden\")); \n layer_airport.push(g.append(\"g\").attr(\"id\", \"layer_airport_2\").attr(\"visibility\", \"hidden\"));\n layer_airport.push(g.append(\"g\").attr(\"id\", \"layer_airport_3\").attr(\"visibility\", \"hidden\"));\n layer_airport.push(g.append(\"g\").attr(\"id\", \"layer_airport_4\").attr(\"visibility\", \"visible\"));\n\n //swap\n var temp = layer_airport[0];\n layer_airport[0] = layer_airport[2];\n layer_airport[2] = temp;\n\n infoColorMeaning = d3.select(\"#container_map\").append(\"div\").attr(\"class\", \"cssinfo hidden\");\n\n var offsetL = document.getElementById(\"container_map\").offsetLeft + 20;\n var offsetT = document.getElementById(\"container_map\").offsetTop + 20;\n\n infoColorMeaning.classed(\"hidden\", false)\n .attr(\"style\", \"left:\" + offsetL + \"px;top:\" + offsetT + \"px\")\n .html(\"\");\n}", "function updateMap() {\n\t\t\tid = trail_select.value;\n\t\t\tconsole.log(id);\n\t\t\tvar newlayer = layer.getLayer(id);\n\t\t\tnewlayer.removeFrom(map);\n\t\t\tnewlayer.setStyle({\n\t\t\t\t\tweight: 5,\n\t\t\t\t\tcolor: '#00ff00',\n\t\t\t\t\topacity: 1.0\n\t\t\t});\n\t\t\tnewlayer.addTo(map)\n\t\t\tvar prevlayer = layer.getLayer(previd);\n\t\t\tif (previd !== id) {\n\t\t\t\tprevlayer.setStyle({\n\t\t\t\t\tcolor: '#ff7800',\n\t\t\t\t\topacity: 1.0,\n\t\t\t\t\tweight: (prevlayer.feature.properties.annual*0.17)**4\n\t\t\t\t});\n\t\t\t\tprevlayer.addTo(map);\n\t\t\t\tprevid = id;\n\t\t\t}\n\t\t}", "function fi(){this.X=L(\"g\",{},null);this.gg=L(\"path\",{\"class\":\"blocklyPathDark\",transform:\"translate(1, 1)\"},this.X);this.Bc=L(\"path\",{\"class\":\"blocklyPath\"},this.X);this.hg=L(\"path\",{\"class\":\"blocklyPathLight\"},this.X);this.Bc.ub=this;Rh(this.Bc);ji(this)}", "function getl () {\r\n\r\n \r\nvar linksx = [];\r\nvar index, diffx;\r\n \r\nfor (var x = 0; x < nodesg.length; ++x) {\r\n(blocks[x] == undefined) ? blocks[x] = 0 : {};\r\n};\r\nfor (var j = 0; j < nodesg.length; ++j) {\r\nbestbl = Math.max.apply(null, blocks);\r\ndiffx = blocks[j] - bestbl;\r\nind = blocks.indexOf(bestbl);\r\n\r\n\r\n(blocks[j] == 0) ? nodesg[j].color = 'Red' :\r\n(diffx < -100) ? nodesg[j].color = 'OrangeRed' :\r\n(diffx < -10) ? nodesg[j].color = 'DarkOrange' : \r\n(diffx < -3) ? nodesg[j].color = 'Yellow' : \r\n(diffx <= 0) ? nodesg[j].color = 'Lime' : {}\r\n \r\n try {\r\n\r\n for (var k of peersx[j]) { \r\n index = ips.indexOf(k.address);\r\n if (~index) {\r\n if (blocks[index] == 0) continue //detect unreachable nodes\r\n linksx.push({\r\n source : nodesg[j].id,\r\n target : nodesg[index].id\r\n })\r\n } \r\n }\r\n } catch(e) {continue} \r\n };\r\n\r\n timerun(ind); // run timer\r\n runbest();\r\n\r\n // draw graph\r\n const gData = {\r\n nodes: nodesg,\r\n links: linksx\r\n };\r\n \r\n const elem = document.getElementById('dg');\r\n const Graph = ForceGraph3D()\r\n // { controlType: 'orbit' }\r\n (elem)\r\n .graphData(gData)\r\n .width(850)\r\n .height(500)\r\n .backgroundColor('#212A3F')\r\n .nodeLabel('id')\r\n .nodeResolution(16)\r\n .linkWidth(1)\r\n .linkDirectionalParticles(10)\r\n .onNodeHover(node => elem.style.cursor = node ? 'pointer' : null)\r\n .onNodeClick(node => {\r\n // Aim at node from outside it\r\n const distance = 40;\r\n const distRatio = 1 + distance/Math.hypot(node.x, node.y, node.z);\r\n Graph.cameraPosition(\r\n { x: node.x * distRatio, y: node.y * distRatio, z: node.z * distRatio }, // new position\r\n node, // lookAt ({ x, y, z })\r\n 3000 // ms transition duration\r\n );\r\n });\r\n\r\n}", "function initLayer() {\n addSourceLineAndLayer('line');\n addSourcePointAndLayer('tl_point');\n addSourcePointAndLayer('tr_point');\n addSourcePointAndLayer('bl_point');\n addSourcePointAndLayer('br_point');\n addSourcePointAndLayer('t_point');\n addSourcePointAndLayer('r_point');\n addSourcePointAndLayer('l_point');\n addSourcePointAndLayer('b_point');\n }", "function mainLegend() {\n\t\t\t// var ldata = data.filter(function(i) {return REGIONS[i.name].selected});\n\t\t\tldata = data;\n\t\t\tLegend(ldata, null,\n\t\t\t\tfunction(i){\n\t\t\t\t\tprovinceHoverIn(shapes.selectAll(\".circle\")[0][i]);\n\t\t\t\t}, function(i) {\n\t\t\t\t\tprovinceHoverOut(shapes.selectAll(\".circle\")[0][i]);\n\t\t\t\t}, function(i) {\n\t\t\t\t\tprovinceClick(shapes.selectAll(\".circle\")[0][i]);\n\t\t\t\t});\t\n\t\t}", "function addIntermediateInfo(m_i,m_j,m_k,dp)\n{ textSize(18);\n let rectfill = [30, 31, 43];\n let textfill = [250, 250, 185];\n noStroke();\n fill(rectfill);\n rect(705,510,541,258);\n let node1 = new Node(804,678,40,m_i);\n let node2 = new Node(950,561,40,m_k);\n let node3 = new Node(1096,678,40,m_j);\n\n let Edge1 = new Edge(node1,node2,false,dp[m_i][m_k]);\n let Edge2 = new Edge(node2,node3,false,dp[m_k][m_j]);\n let Edge3 = new Edge(node1,node3,false,dp[m_i][m_j]);\n\n Edge1.drawLine();\n Edge2.drawLine();\n Edge3.drawLine();\n \n node1.m_draw();\n node2.m_draw();\n node3.m_draw();\n\n let p_txt = null; \n p_txt = dp[m_i][m_k] + '+'+ dp[m_k][m_j] + '<' + dp[m_i][m_j] + '?';\n textSize(18);\n noStroke();\n fill(255);\n text(p_txt,920,720);\n\n}", "function finalDraw() {\n\t Shapes.drawAll(gd);\n\t Images.draw(gd);\n\t Plotly.Annotations.drawAll(gd);\n\t Legend.draw(gd);\n\t RangeSlider.draw(gd);\n\t RangeSelector.draw(gd);\n\t }", "function back(){\n fill(color(0, 139, 139));\n circle(300,200,100);\n line(300,300,300,0);\n line(300,300,300,450);\n}", "function drawTrunk(){\n centerTree();\n penRGB(142,41,12,0.75);\n penDown();\n penWidth(10);\n moveForward(15);\n turnLeft(180);\n moveForward(30);\n drawLeaves();\n penUp();\n}", "function drawLeaves(){\n layerLeaves(5);\n layerLeaves(4);\n layerLeaves(3);\n layerLeaves(2);\n layerLeaves(1);\n penUp();\n}", "function drawNetwork(w){\n\t fill(255, 255, 255);\n strokeWeight(1);\n stroke(100);\n for (var layer=0; layer<nodesPerLayer.length; layer+=1){\n for (var node=0; node<nodesPerLayer[layer]; node+=1){\n if (nodesPerLayer.length>layer+1){\n for (var nextLayerNode=0; nextLayerNode<nodesPerLayer[layer+1]; nextLayerNode +=1){\n drawWire(layer,node,layer+1,nextLayerNode,w);\n }\n }\n drawNode(layer,node);\n }\n }\n}", "function btn_nc(){\n\n isGroundOverlay = true;\n\n function boluo_A_nc(){\n //kml <label>\n var offset = 0.00026;\n var ggn = 23.130875645889883-offset;\n var ggs = 23.121166927809885-offset;\n var gge = 114.20237471986587;\n var ggw = 114.19187761906588;\n\n //ABCD Point\n var enP = new BMap.Point(gge,ggn);\n var wsP = new BMap.Point(ggw,ggs);\n\n var points = [enP,wsP];\n\n translateCallback = function (data){\n if(data.status === 0) {\n var BenP = data.points[0];\n var BwsP = data.points[1];\n\n groundOverlayOptions = {\n opacity: 0.8,\n displayOnMinLevel: 10,\n displayOnMaxLevel: 20\n }\n\n // 初始化GroundOverlay\n var groundOverlay = new BMap.GroundOverlay(new BMap.Bounds(BwsP, BenP), groundOverlayOptions);\n\n // 设置GroundOverlay的图片地址\n groundOverlay.setImageURL('/assets/demo/soshineseeA/boluo_A_nc_s.jpg');\n // 添加GroundOverlay\n map.clearOverlays();\n map.addOverlay(groundOverlay);\n\n }\n };\n\n var convertor = new BMap.Convertor();\n convertor.translate(points, 1, 5, translateCallback);\n }\n\n\n\n\n function boluo_B_nc(){\n //kml <label>\n\n var ggn = 23.15029308;\n var ggs = 23.0948146;\n var gge = 114.2508615;\n var ggw = 114.17088341;\n\n //ABCD Point\n var enP = new BMap.Point(gge,ggn);\n var wsP = new BMap.Point(ggw,ggs);\n\n var points = [enP,wsP];\n\n translateCallback = function (data){\n if(data.status === 0) {\n var BenP = data.points[0];\n var BwsP = data.points[1];\n\n groundOverlayOptions = {\n opacity: 0.9,\n displayOnMinLevel: 10,\n displayOnMaxLevel: 20\n }\n\n // 初始化GroundOverlay\n var groundOverlay = new BMap.GroundOverlay(new BMap.Bounds(BwsP, BenP), groundOverlayOptions);\n\n // 设置GroundOverlay的图片地址\n groundOverlay.setImageURL('/assets/demo/soshineseeHuge/DOM-50cmGSD_ok_s.jpg');\n // 添加GroundOverlay\n map.clearOverlays();\n\n map.addOverlay(groundOverlay);\n\n }\n };\n\n var convertor = new BMap.Convertor();\n convertor.translate(points, 1, 5, translateCallback);\n }\n\n if (currentblock == 1){\n boluo_A_nc();\n }\n else if(currentblock == 2){\n boluo_B_nc();\n }\n else{\n alert(\"本地块无NC图像\");\n }\n\n\n}", "function poly(best) {\n directionsService = new google.maps.DirectionsService();\n directionsDisplay = new google.maps.DirectionsRenderer();\n directionsDisplay.setMap(map);\n var waypts = [];\n if (travelType == \"GR\") {\n for (var i = 1; i < best.length-1; i++) {\n waypts.push({\n location: nodes[best[i]],\n stopover: true\n });\n }\n // Pridedamas marsrutas i zemelapi\n var request = {\n origin: nodes[0],\n destination: nodes[0],\n waypoints: waypts,\n travelMode: 'DRIVING',\n };\n directionsService.route(request, function (response, status) {\n if (status == google.maps.DirectionsStatus.OK) {\n directionsDisplay.setDirections(response);\n }\n clearMapMarkers();\n });\n }\n else if (travelType == \"NGR\") {\n for (var i = 1; i < best.length-1; i++) {\n waypts.push({\n location: nodes[best[i]],\n stopover: true\n });\n }\n // Pridedamas marsrutas i zemelapi\n var request = {\n origin: nodes[0],\n destination: nodes[nodes.length - 1],\n waypoints: waypts,\n travelMode: 'DRIVING',\n };\n directionsService.route(request, function (response, status) {\n if (status == google.maps.DirectionsStatus.OK) {\n directionsDisplay.setDirections(response);\n }\n clearMapMarkers();\n });\n }\n best.shift();\n best.splice(best.length - 1, 1);\n }", "function fndrawGraph() {\r\n setOptionValue();\r\n\t\t\t\tlayout = new Layout(\"line\", options);\r\n//\t\t\t\talert(\"called.........fngraph............\");\r\n\t\t\t\tvar atempDataPopulation;\r\n\t\t\t\tvar atempPopulationlefive;\r\n\t\t\t\tvar atemparrPopulationbetFive;\r\n\t\t\t\tvar atemparrpopulationlabovefifteen; \r\n\t\t\t\t\r\n\t\t\t\tatempDataPopulation=arrDataPopulation;\r\n\t\t\t\tvar populationlen = atempDataPopulation.length; \r\n\t\t\t\t\r\n\t\t\t\t//arrPopulationleFive.push(populationlefive);\r\n\t\t\t\tatempPopulationlefive=arrPopulationleFive;\r\n\t\t\t\t\r\n\t\t\t\t//arrPopulationlbetFive.push(populationlbetfive);\r\n\t\t\t\tatemparrPopulationbetFive=arrPopulationlbetFive;\r\n\t\t\t\t\r\n\t\t\t\t//arrpopulationlabovefifteen.push(populationlabovefifteen);\r\n\t\t\t\tatemparrpopulationlabovefifteen=arrpopulationlabovefifteen;\r\n\t\t\t\t\r\n\t\t\t\t// Total Population \r\n\t\t\t\tvar tpBeforeInstruction=\"layout.addDataset('Totalpopulation',[\";\r\n\t\t\t\tvar tpInstruction=\"\";\r\n\t\t\t\t\r\n\r\n\t\t\t\t// less then five population \r\n\t\t\t\tvar tpltfiveBeforeInstruction=\"layout.addDataset('Populationltfive',[\";\r\n\t\t\t\tvar tpltfiveInstruction=\"\";\r\n\t\t\t\tvar populationltfivelen = atempPopulationlefive.length;\r\n\r\n \t\t\t\t// less then five to fourteen population \r\n\t\t\t\tvar tpbftofourtBeforeInstruction=\"layout.addDataset('PopulationAge5to14',[\";\r\n\t\t\t\tvar tpbftofourtInstruction=\"\";\r\n\t\t\t\tvar populationbetFivelen = atemparrPopulationbetFive.length;\r\n\t\t\t\t\r\n\t\t\t\t// above then fifteen population \r\n\t\t\t\tvar tpabfifteenBeforeInstruction=\"layout.addDataset('PopulationAge15plus',[\";\r\n\t\t\t\tvar tpabfifteenInstruction=\"\";\r\n\t\t\t\tvar populationabfifteenlen = atemparrpopulationlabovefifteen.length;\r\n\r\n\r\n\t\t\t\t// creating diffrent Dataset according Data \r\n\t\t\t\t\r\n\t\t\t\tfor (var i=0; i<populationlen; i++ )\r\n\t\t\t\t\t{\r\n\t\t\t\t\ttpInstruction=tpInstruction+ \"[\"+i+\", \"+atempDataPopulation[i]+\"]\";\t\r\n\t\t\t\t\ttpltfiveInstruction=tpltfiveInstruction+ \"[\"+i+\", \"+atempPopulationlefive[i]+\"]\";\t\r\n\t\t\t\t\ttpbftofourtInstruction=tpbftofourtInstruction+ \"[\"+i+\", \"+atemparrPopulationbetFive[i]+\"]\";\t\r\n\t\t\t\t\ttpabfifteenInstruction=tpabfifteenInstruction+ \"[\"+i+\", \"+atemparrpopulationlabovefifteen[i]+\"]\";\t\r\n\t\t\t\t\tif (i!=populationlen-1)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\ttpInstruction=tpInstruction + \",\";\r\n\t\t\t\t\t\ttpltfiveInstruction=tpltfiveInstruction + \",\";\r\n\t\t\t\t\t\ttpbftofourtInstruction=tpbftofourtInstruction + \",\";\r\n\t\t\t\t\t\ttpabfifteenInstruction=tpabfifteenInstruction + \",\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\ttpInstruction=tpBeforeInstruction+tpInstruction +\"])\";\r\n\t\t\t\t\ttpltfiveInstruction=tpltfiveBeforeInstruction+tpltfiveInstruction+\"])\";\r\n\t\t\t\t\ttpbftofourtInstruction=tpbftofourtBeforeInstruction+tpbftofourtInstruction+\"])\";\r\n\t\t\t\t\ttpabfifteenInstruction=tpabfifteenBeforeInstruction+tpabfifteenInstruction+\"])\";\r\n\t\t\t\t\teval(tpInstruction);\r\n\t\t\t\t\teval(tpltfiveInstruction);\r\n\t\t\t\t\teval(tpbftofourtInstruction);\r\n\t\t\t\t\teval(tpabfifteenInstruction);\r\n\t\t\t\t\r\n\t\t\t\tlayout.evaluate();\r\n\t\t\t\t\t\r\n\t\t\t\tvar strTemp='';\r\n\t\t\t\tcanvas = MochiKit.DOM.getElement(\"graph\");\r\n\t\t\t\tplotter = new PlotKit.SweetCanvasRenderer(canvas, layout, options);\r\n\t\t\t\tplotter.render();\r\n\t\t}", "function addLayer(layer){\n\n //Initialize a bunch of variables\n layer.loadError = false;\n\tvar id = layer.legendDivID;\n layer.id = id;\n var queryID = id + '-'+layer.ID;\n\tvar containerID = id + '-container-'+layer.ID;\n\tvar opacityID = id + '-opacity-'+layer.ID;\n\tvar visibleID = id + '-visible-'+layer.ID;\n\tvar spanID = id + '-span-'+layer.ID;\n\tvar visibleLabelID = visibleID + '-label-'+layer.ID;\n\tvar spinnerID = id + '-spinner-'+layer.ID;\n var selectionID = id + '-selection-list-'+layer.ID;\n\tvar checked = '';\n layerObj[id] = layer;\n layer.wasJittered = false;\n layer.loading = false;\n layer.refreshNumber = refreshNumber;\n\tif(layer.visible){checked = 'checked'}\n \n if(layer.viz.isTimeLapse){\n // console.log(timeLapseObj[layer.viz.timeLapseID]);\n timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.push(id);\n timeLapseObj[layer.viz.timeLapseID].sliders.push(opacityID);\n timeLapseObj[layer.viz.timeLapseID].layerVisibleIDs.push(visibleID);\n\n }\n\n //Set up layer control container\n\t$('#'+ layer.whichLayerList).prepend(`<li id = '${containerID}'class = 'layer-container' rel=\"txtTooltip\" data-toggle=\"tooltip\" title= '${layer.helpBoxMessage}'>\n\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t <div id=\"${opacityID}\" class = 'simple-layer-opacity-range'></div>\n\t\t\t\t\t\t\t\t <input id=\"${visibleID}\" type=\"checkbox\" ${checked} />\n\t\t\t\t\t\t\t\t <label class = 'layer-checkbox' id=\"${visibleLabelID}\" style = 'margin-bottom:0px;display:none;' for=\"${visibleID}\"></label>\n\t\t\t\t\t\t\t\t <i id = \"${spinnerID}\" class=\"fa fa-spinner fa-spin layer-spinner\" rel=\"txtTooltip\" data-toggle=\"tooltip\" title='Waiting for layer service from Google Earth Engine'></i>\n\t\t\t\t\t\t\t\t <i id = \"${spinnerID}2\" style = 'display:none;' class=\"fa fa-cog fa-spin layer-spinner\" rel=\"txtTooltip\" data-toggle=\"tooltip\" title='Waiting for map tiles from Google Earth Engine'></i>\n\t\t\t\t\t\t\t\t <i id = \"${spinnerID}3\" style = 'display:none;' class=\"fa fa-cog fa-spin layer-spinner\" rel=\"txtTooltip\" data-toggle=\"tooltip\" title='Waiting for map tiles from Google Earth Engine'></i>\n \n\t\t\t\t\t\t\t\t <span id = '${spanID}' class = 'layer-span'>${layer.name}</span>\n\t\t\t\t\t\t\t\t </li>`);\n //Set up opacity slider\n\t$(\"#\"+opacityID).slider({\n min: 0,\n max: 100,\n step: 1,\n value: layer.opacity*100,\n \tslide: function(e,ui){\n \t\tlayer.opacity = ui.value/100;\n \t\t// console.log(layer.opacity);\n \t\t if(layer.layerType !== 'geeVector' && layer.layerType !== 'geoJSONVector'){\n layer.layer.setOpacity(layer.opacity);\n \n \n }else{\n \t var style = layer.layer.getStyle();\n \t style.strokeOpacity = layer.opacity;\n \t style.fillOpacity = layer.opacity/layer.viz.opacityRatio;\n \t layer.layer.setStyle(style);\n \t if(layer.visible){layer.range}\n }\n if(layer.visible){\n \tlayer.rangeOpacity = layer.opacity;\n } \n layerObj[id].visible = layer.visible;\n layerObj[id].opacity = layer.opacity;\n \t\tsetRangeSliderThumbOpacity();\n \t\t}\n\t})\n\tfunction setRangeSliderThumbOpacity(){\n\t\t$('#'+opacityID).css(\"background-color\", 'rgba(55, 46, 44,'+layer.rangeOpacity+')')\n\t}\n //Progress bar controller\n\tfunction updateProgress(){\n\t\tvar pct = layer.percent;\n if(pct === 100 && (layer.layerType === 'geeImage' || layer.layerType === 'geeVectorImage' || layer.layerType === 'geeImageCollection')){jitterZoom()}\n\t\t$('#'+containerID).css('background',`-webkit-linear-gradient(left, #FFF, #FFF ${pct}%, transparent ${pct}%, transparent 100%)`)\n\t}\n\t//Function for zooming to object\n\tfunction zoomFunction(){\n\n\t\tif(layer.layerType === 'geeVector' ){\n\t\t\tcenterObject(layer.item)\n\t\t}else if(layer.layerType === 'geoJSONVector'){\n\t\t\t// centerObject(ee.FeatureCollection(layer.item.features.map(function(t){return ee.Feature(t).dissolve(100,ee.Projection('EPSG:4326'))})).geometry().bounds())\n\t\t\t// synchronousCenterObject(layer.item.features[0].geometry)\n\t\t}else{\n \n\t\t\tif(layer.item.args !== undefined && layer.item.args.value !== null && layer.item.args.value !== undefined){\n\t\t\t\tsynchronousCenterObject(layer.item.args.value)\n\t\t\t}\n else if(layer.item.args !== undefined &&layer.item.args.featureCollection !== undefined &&layer.item.args.featureCollection.args !== undefined && layer.item.args.featureCollection.args.value !== undefined && layer.item.args.featureCollection.args.value !== undefined){\n synchronousCenterObject(layer.item.args.featureCollection.args.value);\n };\n\t\t}\n\t}\n //Try to handle load failures\n function loadFailure(failure){\n layer.loadError = true;\n console.log('GEE Tile Service request failed for '+layer.name);\n console.log(containerID)\n $('#'+containerID).css('background','red');\n $('#'+containerID).attr('title','Layer failed to load. Error message: \"'+failure + '\"')\n // getGEEMapService();\n }\n //Function to handle turning off of different types of layers\n function turnOff(){\n ga('send', 'event', 'layer-off', layer.layerType,layer.name);\n if(layer.layerType === 'dynamicMapService'){\n layer.layer.setMap(null);\n layer.visible = false;\n layer.percent = 0;\n layer.rangeOpacity = 0;\n setRangeSliderThumbOpacity();\n updateProgress();\n $('#'+layer.legendDivID).hide();\n } else if(layer.layerType !== 'geeVector' && layer.layerType !== 'geoJSONVector'){\n layer.visible = false;\n layer.map.overlayMapTypes.setAt(layer.layerId,null);\n layer.percent = 0;\n updateProgress();\n $('#'+layer.legendDivID).hide();\n layer.rangeOpacity = 0;\n if(layer.layerType !== 'tileMapService' && layer.layerType !== 'dynamicMapService' && layer.canQuery){\n queryObj[queryID].visible = layer.visible;\n }\n }else{\n layer.visible = false;\n \n layer.percent = 0;\n updateProgress();\n $('#'+layer.legendDivID).hide();\n layer.layer.setMap(null);\n layer.rangeOpacity = 0;\n $('#' + spinnerID+'2').hide();\n // geeTileLayersDownloading = 0;\n // updateGEETileLayersLoading();\n if(layer.layerType === 'geeVector' && layer.canQuery){\n queryObj[queryID].visible = layer.visible;\n }\n \n }\n layer.loading = false;\n updateGEETileLayersDownloading();\n \n $('#'+spinnerID + '2').hide();\n $('#'+spinnerID + '3').hide();\n vizToggleCleanup();\n }\n //Function to handle turning on different layer types\n function turnOn(){\n ga('send', 'event', 'layer-on', layer.layerType,layer.name);\n if(!layer.viz.isTimeLapse){\n turnOffTimeLapseCheckboxes();\n }\n if(layer.layerType === 'dynamicMapService'){\n layer.layer.setMap(map);\n layer.visible = true;\n layer.percent = 100;\n layer.rangeOpacity = layer.opacity;\n setRangeSliderThumbOpacity();\n updateProgress();\n $('#'+layer.legendDivID).show();\n } else if(layer.layerType !== 'geeVector' && layer.layerType !== 'geoJSONVector'){\n layer.visible = true;\n layer.map.overlayMapTypes.setAt(layer.layerId,layer.layer);\n $('#'+layer.legendDivID).show();\n layer.rangeOpacity = layer.opacity;\n if(layer.isTileMapService){layer.percent = 100;updateProgress();}\n layer.layer.setOpacity(layer.opacity); \n if(layer.layerType !== 'tileMapService' && layer.layerType !== 'dynamicMapService' && layer.canQuery){\n queryObj[queryID].visible = layer.visible;\n }\n }else{\n\n layer.visible = true;\n layer.percent = 100;\n updateProgress();\n $('#'+layer.legendDivID).show();\n layer.layer.setMap(layer.map);\n layer.rangeOpacity = layer.opacity;\n if(layer.layerType === 'geeVector' && layer.canQuery){\n queryObj[queryID].visible = layer.visible;\n }\n }\n vizToggleCleanup();\n }\n //Some functions to keep layers tidy\n function vizToggleCleanup(){\n setRangeSliderThumbOpacity();\n layerObj[id].visible = layer.visible;\n layerObj[id].opacity = layer.opacity;\n }\n\tfunction checkFunction(){\n if(!layer.loadError){\n if(layer.visible){\n turnOff();\n }else{turnOn()} \n }\n \n\t}\n function turnOffAll(){ \n if(layer.visible){\n $('#'+visibleID).click();\n }\n }\n function turnOnAll(){\n if(!layer.visible){\n $('#'+visibleID).click();\n }\n }\n\t$(\"#\"+ opacityID).val(layer.opacity * 100);\n\n //Handle double clicking\n\tvar prevent = false;\n\tvar delay = 200;\n\t$('#'+ spanID).click(function(){\n\t\tsetTimeout(function(){\n\t\t\tif(!prevent){\n\t\t\t\t$('#'+visibleID).click();\n\t\t\t}\n\t\t},delay)\n\t\t\n\t});\n $('#'+ spinnerID + '2').click(function(){$('#'+visibleID).click();});\n //Try to zoom to layer if double clicked\n\t$('#'+ spanID).dblclick(function(){\n zoomFunction();\n\t\t\tprevent = true;\n\t\t\tzoomFunction();\n\t\t\tif(!layer.visible){$('#'+visibleID).click();}\n\t\t\tsetTimeout(function(){prevent = false},delay)\n\t\t})\n\n\t//If checkbox is toggled\n\t$('#'+visibleID).change( function() {checkFunction();});\n \n\n\tlayerObj[id].visible = layer.visible;\n layerObj[id].opacity = layer.opacity;\n\t\n //Handle different scenarios where all layers need turned off or on\n if(!layer.viz.isTimeLapse){\n $('.layer-checkbox').on('turnOffAll',function(){turnOffAll()});\n }\n if(layer.layerType === 'geeVector' || layer.layerType === 'geeVectorImage' || layer.layerType === 'geoJSONVector'){\n $('#'+visibleLabelID).addClass('vector-layer-checkbox');\n $('.vector-layer-checkbox').on('turnOffAll',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAll',function(){turnOnAll()});\n $('.vector-layer-checkbox').on('turnOffAllVectors',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAllVectors',function(){turnOnAll()});\n\n if(layer.viz.isUploadedLayer){\n $('#'+visibleLabelID).addClass('uploaded-layer-checkbox');\n selectionTracker.uploadedLayerIndices.push(layer.layerId)\n $('.vector-layer-checkbox').on('turnOffAllUploadedLayers',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAllUploadedLayers',function(){turnOnAll()});\n }\n }\n\n //Handle different object types\n\tif(layer.layerType === 'geeImage' || layer.layerType === 'geeVectorImage' || layer.layerType === 'geeImageCollection'){\n //Handle image colletions\n if(layer.layerType === 'geeImageCollection'){\n // layer.item = ee.ImageCollection(layer.item);\n layer.imageCollection = layer.item;\n\n if(layer.viz.reducer === null || layer.viz.reducer === undefined){\n layer.viz.reducer = ee.Reducer.lastNonNull();\n }\n var bandNames = ee.Image(layer.item.first()).bandNames();\n layer.item = ee.ImageCollection(layer.item).reduce(layer.viz.reducer).rename(bandNames).copyProperties(layer.imageCollection.first());\n \n //Handle vectors\n } else if(layer.layerType === 'geeVectorImage' || layer.layerType === 'geeVector'){\n\n if(layer.viz.isSelectLayer){\n \n selectedFeaturesJSON[layer.name] = {'layerName':layer.name,'filterList':[],'geoJSON':new google.maps.Data(),'id':layer.id,'rawGeoJSON':{},'selection':ee.FeatureCollection([])}\n // selectedFeaturesJSON[layer.name].geoJSON.setMap(layer.map);\n\n // layer.infoWindow = getInfoWindow(infoWindowXOffset);\n // infoWindowXOffset += 30;\n // selectedFeaturesJSON[layer.name].geoJSON.setStyle({strokeColor:invertColor(layer.viz.strokeColor)});\n // layer.queryVector = layer.item; \n $('#'+visibleLabelID).addClass('select-layer-checkbox');\n $('.vector-layer-checkbox').on('turnOffAllSelectLayers',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAllSelectLayers',function(){turnOnAll()});\n $('.vector-layer-checkbox').on('turnOffAll',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAll',function(){turnOnAll()});\n }\n layer.queryItem = layer.item;\n if(layer.layerType === 'geeVectorImage'){\n layer.item = ee.Image().paint(layer.item,null,layer.viz.strokeWeight);\n layer.viz.palette = layer.viz.strokeColor;\n }\n //Add functionality for select layers to be clicked and selected\n if(layer.viz.isSelectLayer){\n var name;\n layer.queryItem.first().propertyNames().evaluate(function(propertyNames,failure){\n if(failure !== undefined){showMessage('Error',failure)}\n else{\n propertyNames.map(function(p){\n if(p.toLowerCase().indexOf('name') !== -1){name = p}\n })\n if(name === undefined){name = 'system:index'}\n }\n selectedFeaturesJSON[layer.name].fieldName = name\n selectedFeaturesJSON[layer.name].eeObject = layer.queryItem.select([name],['name'])\n })\n \n }\n if(layer.viz.isSelectedLayer){\n $('#'+visibleLabelID).addClass('selected-layer-checkbox');\n $('.vector-layer-checkbox').on('turnOffAllSelectLayers',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAllSelectLayers',function(){turnOnAll()});\n $('.vector-layer-checkbox').on('turnOffAllSelectedLayers',function(){turnOffAll()});\n $('.vector-layer-checkbox').on('turnOnAllSelectedLayers',function(){turnOnAll()});\n selectionTracker.seletedFeatureLayerIndices.push(layer.layerId)\n }\n \n // // selectedFeaturesJSON[layer.name].geoJSON.addListener('click',function(event){\n // // console.log(event);\n // // var name = event.feature.j.selectionTrackingName;\n // // delete selectedFeaturesJSON[layer.name].rawGeoJSON[name]\n // // selectedFeaturesJSON[layer.name].geoJSON.remove(event.feature);\n // // updateSelectedAreasNameList();\n // // updateSelectedAreaArea();\n\n // // });\n // var name;\n // layer.queryItem.first().propertyNames().evaluate(function(propertyNames,failure){\n // if(failure !== undefined){showMessage('Error',failure)}\n // else{\n // propertyNames.map(function(p){\n // if(p.toLowerCase().indexOf('name') !== -1){name = p}\n // })\n // if(name === undefined){name = 'system:index'}\n // }\n \n // })\n // printEE(propertyNames);\n // // map.addListener('click',function(event){\n // // // console.log(layer.name);console.log(event);\n // // if(layer.currentGEERunID === geeRunID){\n \n // // if(layer.visible && toolFunctions.area.selectInteractive.state){\n // // $('#'+spinnerID + '3').show();\n // // $('#select-features-list-spinner').show();\n // // // layer.queryGeoJSON.forEach(function(f){layer.queryGeoJSON.remove(f)});\n\n // // var features = layer.queryItem.filterBounds(ee.Geometry.Point([event.latLng.lng(),event.latLng.lat()]));\n // // selectedFeaturesJSON[layer.name].eeFeatureCollection =selectedFeaturesJSON[layer.name].eeFeatureCollection.merge(features);\n // // var propertyNames = selectedFeaturesJSON[layer.name].eeFeatureCollection.first().propertyNames();\n // // printEE(propertyNames);\n // // // features.evaluate(function(values,failure){\n // // // if(failure !== undefined){showMessage('Error',failure);}\n // // // else{\n // // // console.log\n // // // }\n // // // var features = values.features;\n // // // var dummyNameI = 1;\n // // // features.map(function(f){\n // // // var name;\n // // // // selectedFeatures.features.push(f);\n // // // Object.keys(f.properties).map(function(p){\n // // // if(p.toLowerCase().indexOf('name') !== -1){name = f.properties[p]}\n // // // })\n // // // if(name === undefined){name = dummyNameI.toString();dummyNameI++;}\n // // // // console.log(name)\n // // // if(name !== undefined){\n // // // }\n // // // if(getSelectedAreasNameList(false).indexOf(name) !== -1){\n // // // name += '-'+selectionUNID.toString();\n // // // selectionUNID++;\n // // // }\n // // // f.properties.selectionTrackingName = name\n \n\n // // // selectedFeaturesJSON[layer.name].geoJSON.addGeoJson(f);\n // // // selectedFeaturesJSON[layer.name].rawGeoJSON[name]= f;\n // // // });\n // // // updateSelectedAreasNameList(); \n \n // // // $('#'+spinnerID + '3').hide();\n // // // $('#select-features-list-spinner').hide();\n // // // updateSelectedAreaArea();\n // // // })\n // // }\n // // }\n \n // // })\n // } \n };\n //Add layer to query object if it can be queried\n if(layer.canQuery){\n queryObj[queryID] = {'visible':layer.visible,'queryItem':layer.queryItem,'queryDict':layer.viz.queryDict,'type':layer.layerType,'name':layer.name}; \n }\n\t\tincrementOutstandingGEERequests();\n\n\t\t//Handle creating GEE map services\n\t\tfunction getGEEMapServiceCallback(eeLayer){\n decrementOutstandingGEERequests();\n $('#' + spinnerID).hide();\n if(layer.viz.isTimeLapse){\n timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs = timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.filter(timeLapseLayerID => timeLapseLayerID !== id)\n var prop = parseInt((1-timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.length /timeLapseObj[layer.viz.timeLapseID].nFrames)*100);\n // $('#'+layer.viz.timeLapseID+'-loading-progress').css('width', prop+'%').attr('aria-valuenow', prop).html(prop+'% frames loaded'); \n $('#'+layer.viz.timeLapseID+ '-collapse-label').css('background',`-webkit-linear-gradient(left, #FFF, #FFF ${prop}%, transparent ${prop}%, transparent 100%)`)\n \n // $('#'+layer.viz.timeLapseID+'-loading-count').html(`${timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.length}/${timeLapseObj[layer.viz.timeLapseID].nFrames} layers to load`)\n if(timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.length === 0){\n $('#'+layer.viz.timeLapseID+'-loading-spinner').hide();\n $('#'+layer.viz.timeLapseID+'-year-label').hide();\n // $('#'+layer.viz.timeLapseID+'-loading-progress-container').hide();\n $('#'+layer.viz.timeLapseID+ '-collapse-label').css('background',`-webkit-linear-gradient(left, #FFF, #FFF ${0}%, transparent ${0}%, transparent 100%)`)\n \n // $('#'+layer.viz.timeLapseID+'-icon-bar').show();\n // $('#'+layer.viz.timeLapseID+'-time-lapse-layer-range-container').show();\n $('#'+layer.viz.timeLapseID+'-toggle-checkbox-label').show();\n \n \n timeLapseObj[layer.viz.timeLapseID].isReady = true;\n };\n }\n $('#' + visibleLabelID).show();\n \n if(layer.currentGEERunID === geeRunID){\n if(eeLayer === undefined){\n loadFailure();\n }\n else{\n //Set up GEE map service\n var MAPID = eeLayer.mapid;\n var TOKEN = eeLayer.token;\n layer.highWaterMark = 0;\n var tileIncremented = false;\n var eeTileSource = new ee.layers.EarthEngineTileSource(eeLayer);\n // console.log(eeTileSource)\n layer.layer = new ee.layers.ImageOverlay(eeTileSource)\n var overlay = layer.layer;\n //Set up callback to keep track of tile downloading\n layer.layer.addTileCallback(function(event){\n\n event.count = event.loadingTileCount;\n if(event.count > layer.highWaterMark){\n layer.highWaterMark = event.count;\n }\n\n layer.percent = 100-((event.count / layer.highWaterMark) * 100);\n if(event.count ===0 && layer.highWaterMark !== 0){layer.highWaterMark = 0}\n\n if(layer.percent !== 100){\n layer.loading = true;\n $('#' + spinnerID+'2').show();\n if(!tileIncremented){\n incrementGEETileLayersLoading();\n tileIncremented = true;\n if(layer.viz.isTimeLapse){\n timeLapseObj[layer.viz.timeLapseID].loadingTilesLayerIDs.push(id);\n\n }\n }\n }else{\n layer.loading = false;\n $('#' + spinnerID+'2').hide();\n decrementGEETileLayersLoading();\n if(layer.viz.isTimeLapse){\n timeLapseObj[layer.viz.timeLapseID].loadingTilesLayerIDs = timeLapseObj[layer.viz.timeLapseID].loadingTilesLayerIDs.filter(timeLapseLayerID => timeLapseLayerID !== id)\n \n }\n tileIncremented = false;\n }\n //Handle the setup of layers within a time lapse\n if(layer.viz.isTimeLapse){\n var loadingTimelapseLayers = Object.values(layerObj).filter(function(v){return v.loading && v.viz.isTimeLapse && v.whichLayerList === layer.whichLayerList});\n var loadingTimelapseLayersYears = loadingTimelapseLayers.map(function(f){return [f.viz.year,f.percent].join(':')}).join(', ');\n var notLoadingTimelapseLayers = Object.values(layerObj).filter(function(v){return !v.loading && v.viz.isTimeLapse && v.whichLayerList === layer.whichLayerList});\n var notLoadingTimelapseLayersYears = notLoadingTimelapseLayers.map(function(f){return [f.viz.year,f.percent].join(':')}).join(', ');\n $('#'+layer.viz.timeLapseID + '-message-div').html('Loading:<br>'+loadingTimelapseLayersYears+'<hr>Not Loading:<br>'+notLoadingTimelapseLayersYears);\n var propTiles = parseInt((1-(timeLapseObj[layer.viz.timeLapseID].loadingTilesLayerIDs.length/timeLapseObj[layer.viz.timeLapseID].nFrames))*100);\n // $('#'+layer.viz.timeLapseID+'-loading-progress').css('width', propTiles+'%').attr('aria-valuenow', propTiles).html(propTiles+'% tiles loaded');\n $('#'+layer.viz.timeLapseID+ '-loading-gear').show();\n \n $('#'+layer.viz.timeLapseID+ '-collapse-label').css('background',`-webkit-linear-gradient(90deg, #FFF, #FFF ${propTiles}%, transparent ${propTiles}%, transparent 100%)`)\n if(propTiles < 100){\n // console.log(propTiles)\n // if(timeLapseObj[layer.viz.timeLapseID] === 'play'){\n // pauseButtonFunction(); \n // }\n }else{\n $('#'+layer.viz.timeLapseID+ '-loading-gear').hide();\n }\n }\n\n // var loadingLayers = Object.values(layerObj).filter(function(v){return v.loading});\n // console.log(loadingLayers);\n updateProgress();\n // console.log(event.count);\n // console.log(inst.highWaterMark);\n // console.log(event.count / inst.highWaterMark);\n // console.log(layer.percent)\n });\n if(layer.visible){\n layer.map.overlayMapTypes.setAt(layer.layerId, layer.layer);\n $('#'+layer.legendDivID).show();\n layer.rangeOpacity = layer.opacity; \n \n layer.layer.setOpacity(layer.opacity); \n }else{\n $('#'+layer.legendDivID).hide();\n layer.rangeOpacity = 0;\n \n }\n setRangeSliderThumbOpacity(); \n }\n \n }\n }\n function updateTimeLapseLoadingProgress(){\n var loadingTimelapseLayers = Object.values(layerObj).filter(function(v){return v.loading && v.viz.isTimeLapse && v.whichLayerList === layer.whichLayerList}).length;\n var notLoadingTimelapseLayers = Object.values(layerObj).filter(function(v){return !v.loading && v.viz.isTimeLapse && v.whichLayerList === layer.whichLayerList}).length;\n var total = loadingTimelapseLayers+notLoadingTimelapseLayers\n var propTiles = (1-(loadingTimelapseLayers/timeLapseObj[layer.viz.timeLapseID].nFrames))*100\n \n $('#'+layer.viz.timeLapseID+ '-collapse-label').css('background',`-webkit-linear-gradient(0deg, #FFF, #FFF ${propTiles}%, transparent ${propTiles}%, transparent 100%)`)\n if(propTiles < 100){\n $('#'+layer.viz.timeLapseID+ '-loading-gear').show();\n // console.log(propTiles)\n // if(timeLapseObj[layer.viz.timeLapseID] === 'play'){\n // pauseButtonFunction(); \n // }\n }else{\n $('#'+layer.viz.timeLapseID+ '-loading-gear').hide();\n }\n }\n //Handle alternative GEE tile service format\n function geeAltService(eeLayer,failure){\n decrementOutstandingGEERequests();\n $('#' + spinnerID).hide();\n if(layer.viz.isTimeLapse){\n timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs = timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.filter(timeLapseLayerID => timeLapseLayerID !== id)\n var prop = parseInt((1-timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.length /timeLapseObj[layer.viz.timeLapseID].nFrames)*100);\n // $('#'+layer.viz.timeLapseID+'-loading-progress').css('width', prop+'%').attr('aria-valuenow', prop).html(prop+'% frames loaded'); \n $('#'+layer.viz.timeLapseID+ '-collapse-label').css('background',`-webkit-linear-gradient(left, #FFF, #FFF ${prop}%, transparent ${prop}%, transparent 100%)`)\n \n // $('#'+layer.viz.timeLapseID+'-loading-count').html(`${timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.length}/${timeLapseObj[layer.viz.timeLapseID].nFrames} layers to load`)\n if(timeLapseObj[layer.viz.timeLapseID].loadingLayerIDs.length === 0){\n $('#'+layer.viz.timeLapseID+'-loading-spinner').hide();\n $('#'+layer.viz.timeLapseID+'-year-label').hide();\n // $('#'+layer.viz.timeLapseID+'-loading-progress-container').hide();\n $('#'+layer.viz.timeLapseID+ '-collapse-label').css('background',`-webkit-linear-gradient(left, #FFF, #FFF ${0}%, transparent ${0}%, transparent 100%)`)\n \n // $('#'+layer.viz.timeLapseID+'-icon-bar').show();\n // $('#'+layer.viz.timeLapseID+'-time-lapse-layer-range-container').show();\n $('#'+layer.viz.timeLapseID+'-toggle-checkbox-label').show();\n \n \n timeLapseObj[layer.viz.timeLapseID].isReady = true;\n };\n }\n $('#' + visibleLabelID).show();\n \n if(layer.currentGEERunID === geeRunID){\n if(eeLayer === undefined || failure !== undefined){\n loadFailure(failure);\n }\n else{\n const tilesUrl = eeLayer.urlFormat;\n \n var getTileUrlFun = function(coord, zoom) {\n var t = [coord,zoom];\n \n \n let url = tilesUrl\n .replace('{x}', coord.x)\n .replace('{y}', coord.y)\n .replace('{z}', zoom);\n if(!layer.loading){\n layer.loading = true;\n layer.percent = 10;\n $('#' + spinnerID+'2').show();\n updateGEETileLayersDownloading();\n updateProgress();\n if(layer.viz.isTimeLapse){\n updateTimeLapseLoadingProgress(); \n }\n }\n \n return url\n }\n layer.layer = new google.maps.ImageMapType({\n getTileUrl:getTileUrlFun\n })\n\n layer.layer.addListener('tilesloaded',function(){\n layer.percent = 100;\n layer.loading = false;\n \n \n $('#' + spinnerID+'2').hide();\n updateGEETileLayersDownloading();\n updateProgress();\n if(layer.viz.isTimeLapse){\n updateTimeLapseLoadingProgress(); \n }\n })\n \n \n if(layer.visible){\n layer.map.overlayMapTypes.setAt(layer.layerId, layer.layer);\n layer.rangeOpacity = layer.opacity; \n layer.layer.setOpacity(layer.opacity);\n $('#'+layer.legendDivID).show();\n }else{layer.rangeOpacity = 0;}\n $('#' + spinnerID).hide();\n $('#' + visibleLabelID).show();\n\n setRangeSliderThumbOpacity();\n }\n }\n }\n //Asynchronous wrapper function to get GEE map service\n layer.mapServiceTryNumber = 0;\n function getGEEMapService(){\n // layer.item.getMap(layer.viz,function(eeLayer){getGEEMapServiceCallback(eeLayer)});\n \n //Handle embeded visualization params if available\n var vizKeys = Object.keys(layer.viz);\n var possibleVizKeys = ['bands','min','max','gain','bias','gamma','palette'];\n var vizFound = false;\n possibleVizKeys.map(function(k){\n var i = vizKeys.indexOf(k) > -1;\n if(i){vizFound = true}\n });\n \n if(vizFound == false){layer.usedViz = {}}\n else{layer.usedViz = layer.viz}\n // console.log(layer.usedViz);\n ee.Image(layer.item).getMap(layer.usedViz,function(eeLayer,failure){\n if(eeLayer === undefined && layer.mapServiceTryNumber <=1){\n queryObj[queryID].queryItem = layer.item;\n layer.item = layer.item.visualize();\n getGEEMapService();\n }else{\n geeAltService(eeLayer,failure);\n } \n });\n\n // layer.item.getMap(layer.viz,function(eeLayer){\n // console.log(eeLayer)\n // console.log(ee.data.getTileUrl(eeLayer))\n // })\n layer.mapServiceTryNumber++;\n };\n getGEEMapService();\n\n //Handle different vector formats\n\t}else if(layer.layerType === 'geeVector' || layer.layerType === 'geoJSONVector'){\n if(layer.canQuery){\n queryObj[queryID] = {'visible':layer.visible,'queryItem':layer.queryItem,'queryDict':layer.viz.queryDict,'type':layer.layerType,'name':layer.name}; \n }\n\t\tincrementOutstandingGEERequests();\n //Handle adding geoJSON to map\n\t\tfunction addGeoJsonToMap(v){\n\t\t\t$('#' + spinnerID).hide();\n\t\t\t$('#' + visibleLabelID).show();\n\n\t\t\tif(layer.currentGEERunID === geeRunID){\n if(v === undefined){loadFailure()}\n\t\t\t\tlayer.layer = new google.maps.Data();\n // layer.viz.icon = {\n // path: google.maps.SymbolPath.BACKWARD_CLOSED_ARROW,\n // scale: 5,\n // strokeWeight:2,\n // strokeColor:\"#B40404\"\n // }\n\t\t layer.layer.setStyle(layer.viz);\n\t\t \n\t\t \tlayer.layer.addGeoJson(v);\n if(layer.viz.clickQuery){\n map.addListener('click',function(){\n infowindow.setMap(null);\n })\n layer.layer.addListener('click', function(event) {\n console.log(event);\n infowindow.setPosition(event.latLng);\n var infoContent = `<table class=\"table table-hover bg-white\">\n <tbody>`\n var info = event.feature.h;\n Object.keys(info).map(function(name){\n var value = info[name];\n infoContent +=`<tr><th>${name}</th><td>${value}</td></tr>`;\n });\n infoContent +=`</tbody></table>`;\n infowindow.setContent(infoContent);\n infowindow.open(map);\n }) \n }\n\t\t \tfeatureObj[layer.name] = layer.layer\n\t\t \t// console.log(this.viz);\n\t\t \n\t\t \tif(layer.visible){\n\t\t \tlayer.layer.setMap(layer.map);\n\t\t \tlayer.rangeOpacity = layer.viz.strokeOpacity;\n\t\t \tlayer.percent = 100;\n\t\t \tupdateProgress();\n\t\t \t$('#'+layer.legendDivID).show();\n\t\t \t}else{\n\t\t \tlayer.rangeOpacity = 0;\n\t\t \tlayer.percent = 0;\n\t\t \t$('#'+layer.legendDivID).hide();\n\t\t \t\t}\n\t\t \tsetRangeSliderThumbOpacity();\n\t\t \t}\n \t\t}\n \t\tif(layer.layerType === 'geeVector'){\n decrementOutstandingGEERequests();\n \t\t\tlayer.item.evaluate(function(v){addGeoJsonToMap(v)})\n \t\t}else{decrementOutstandingGEERequests();addGeoJsonToMap(layer.item)}\n\t//Handle non GEE tile services\t\n\t}else if(layer.layerType === 'tileMapService'){\n\t\tlayer.layer = new google.maps.ImageMapType({\n getTileUrl: layer.item,\n tileSize: new google.maps.Size(256, 256),\n // tileSize: new google.maps.Size($('#map').width(),$('#map').height()),\n maxZoom: 15\n \n })\n\t\tif(layer.visible){\n \t\n \tlayer.map.overlayMapTypes.setAt(layer.layerId, layer.layer);\n \tlayer.rangeOpacity = layer.opacity; \n \tlayer.layer.setOpacity(layer.opacity); \n }else{layer.rangeOpacity = 0;}\n $('#' + spinnerID).hide();\n\t\t\t$('#' + visibleLabelID).show();\n\t\t\tsetRangeSliderThumbOpacity();\n \n\t//Handle dynamic map services\n\t}else if(layer.layerType === 'dynamicMapService'){\n\t\tfunction groundOverlayWrapper(){\n\t if(map.getZoom() > layer.item[1].minZoom){\n\t return getGroundOverlay(layer.item[1].baseURL,layer.item[1].minZoom)\n\t }\n\t else{\n\t return getGroundOverlay(layer.item[0].baseURL,layer.item[0].minZoom)\n\t }\n\t };\n\t function updateGroundOverlay(){\n if(layer.layer !== null && layer.layer !== undefined){\n layer.layer.setMap(null);\n }\n \n layer.layer =groundOverlayWrapper();\n if(layer.visible){\n \tlayer.layer.setMap(map);\n \tlayer.percent = 100;\n\t\t\t\t\tupdateProgress();\n \tgroundOverlayOn = true\n \t\t$('#'+layer.legendDivID).show();\n \tlayer.layer.setOpacity(layer.opacity);\n \tlayer.rangeOpacity = layer.opacity;\n \t\n }else{layer.rangeOpacity = 0};\n setRangeSliderThumbOpacity(); \n\n };\n updateGroundOverlay();\n // if(layer.visible){layer.opacity = 1}\n // else{this.opacity = 0}\n google.maps.event.addListener(map,'zoom_changed',function(){updateGroundOverlay()});\n\n google.maps.event.addListener(map,'dragend',function(){updateGroundOverlay()});\n $('#' + spinnerID).hide();\n\t\t\t$('#' + visibleLabelID).show();\n\t\t\tsetRangeSliderThumbOpacity();\n\t}\n}", "display(){\n noStroke();\n fill(this.color);\n this.shape(this.x, this.y, this.size, this.size);\n for(var i=0; i<this.history.length; i++){\n var pos = this.history[i];\n this.shape(pos.x, pos.y, 8, 8);\n }\n }", "drawCurrentState(){\n reset();\n drawPolygonLines(this.hull, \"red\"); \n drawLine(this.currentVertex, this.nextVertex, \"green\");\n drawLine(this.currentVertex,this.points[this.index]);\n for(let i=0;i<this.points.length;i++){\n this.points[i].draw();\n }\n\n for(let i=0;i<this.hull.length;i++){\n this.hull[i].draw(5,\"red\");\n }\n }", "function zi(){this.ma=v(\"g\",{},null);this.Vh=v(\"path\",{\"class\":\"blocklyPathDark\",transform:\"translate(1, 1)\"},this.ma);this.gd=v(\"path\",{\"class\":\"blocklyPath\"},this.ma);this.Wh=v(\"path\",{\"class\":\"blocklyPathLight\"},this.ma);this.gd.gc=this;ki(this.gd);Ei(this)}", "finishChannel() {\n if (this.currentChannelID) {\n this.wayPoints.push(this.lastPoint);\n let feat = Registry.currentLayer.getFeature(this.currentChannelID);\n feat.updateParameter(\"end\", this.lastPoint);\n // feat.updateParameter(\"wayPoints\", this.wayPoints);\n feat.updateParameter(\"segments\", this.generateSegments());\n //Save the connection object\n let rawparams = feat.getParams();\n let values = {};\n for (let key in rawparams) {\n values[key] = rawparams[key].getValue();\n }\n let definition = Registry.featureSet.getDefinition(\"Connection\");\n let params = new Params(values, definition.unique, definition.heritable);\n if (this.__currentConnectionObject === null || this.__currentConnectionObject === undefined) {\n let connection = new Connection(\"Connection\", params, Registry.currentDevice.generateNewName(\"CHANNEL\"), \"CHANNEL\");\n connection.routed = true;\n connection.addFeatureID(feat.getID());\n connection.addWayPoints(this.wayPoints);\n feat.referenceID = connection.getID();\n this.__addConnectionTargets(connection);\n Registry.currentDevice.addConnection(connection);\n } else {\n // console.error(\"Implement conneciton tool to update existing connection\");\n // TODO: Update the connection with more sinks and paths and what not\n this.__currentConnectionObject.addFeatureID(feat.getID());\n feat.referenceID = this.__currentConnectionObject.getID();\n this.__currentConnectionObject.addWayPoints(this.wayPoints);\n feat.referenceID = this.__currentConnectionObject.getID();\n this.__addConnectionTargets(this.__currentConnectionObject);\n }\n\n this.currentChannelID = null;\n this.wayPoints = [];\n this.source = null;\n this.sinks = [];\n this.__currentConnectionObject = null;\n Registry.viewManager.saveDeviceState();\n } else {\n console.error(\"Something is wrong here, unable to finish the connection\");\n }\n\n Registry.viewManager.saveDeviceState();\n }", "function removelayer() {\n jsonLayers.clearLayers();\n\n // Clears the control Layers\n if (group) {\n group.forEach(function (entry) {\n controlLayers.removeLayer(entry);\n })\n };\n\n $(\"#jsonlegendelem\").empty();\n $(\"#jsonlegenddiv\").hide();\n $(\"#jsonlegendbtndiv\").hide();\n $('#jsonpopuptext').val(\"\");\n $('#jsonbild').val(\"\");\n $('#jsonname').val(\"\");\n // JSNLog\n logger.info(\"JsonLayers removed, legend hidden\");\n}", "function findWay(source){\n\n \n \n var id_room = $('#room').val().split(\" \").join(\"\").toLowerCase();\n id_room = zimmerNameId[id_room];\n \n graph = new Graph(map);\n var shortWay = [];\n shortWay = graph.findShortestPath(zonesNameId[source],id_room);\n console.log(\"the short way to the destination : \\n\"+shortWay);\n var len = shortWay.length;\n // the points of each noud which will be drawed\n var points =[];\n\n for(i=0;i<len;i++){\n var key = shortWay[i];\n if(mapCoordnidates[key]){\n object = {\"x\":mapCoordnidates[key].x, \"y\":mapCoordnidates[key].y};\n points.push(object);\n }\n }\n /*for(i=0;i<points.length;i++){\n\n console.log(\"points of the line : \\n\"+points[i].x+' '+points[i].y);\n }*/\n\n // draw the line of the points until the destination\n d3.select(\"#theWay\").attr(\"visibility\",\"hidden\");\n\n // hide the distination to draw it again\n // d3.select(\"#destination\").attr(\"visibility\",\"hidden\");\n\n var lineFunction = d3.svg.line()\n .x(function(d) { return d.x; })\n .y(function(d) { return d.y; })\n .interpolate(\"linear\");\n // the arrow of the end\n var defs = d3.select(\"#svg8\").append(\"svg:defs\");\n\n /* here to generate the marker shape and assign it the \"arrow\" id */\n defs.append(\"svg:marker\")\n .attr(\"id\", \"arrow\")\n .attr(\"viewBox\", \"0 0 10 10\")\n .attr(\"refX\", 1)\n .attr(\"refY\", 5)\n .attr(\"markerWidth\", 6)\n .attr(\"markerHeight\", 6)\n .attr(\"orient\", \"auto\")\n .attr('fill','#3498db')\n .append('svg:path')\n .attr('d', \"M 0 0 L 10 5 L 0 10 z\");\n\n d3.select(\"#theWay\").attr(\"d\", lineFunction(points))\n .attr(\"id\",\"theWay\")\n .attr(\"stroke\", \"#3498db\")\n .attr(\"stroke-width\", 2)\n .attr(\"fill\", \"none\")\n .attr(\"visibility\",\"visible\")\n .attr('marker-end', 'url(#arrow)');\n // draw the destination\n // d3.select(\"#\"+id_room)\n // .style(\"fill\",\"#d35400\")\n // .attr(\"r\",3)\n // .attr('id','destination')\n // .attr(\"visibility\",\"visible\");\n }// end finWay", "function firstLayer(){\n\t\tif (isFirst) {\n\t\t\t // Load the data\n\t\t\td3.json(\"./data/layer1.json\",\n\t\t\t\t\tfunction(d) {\n\t\t\t\t\t\tsectionData = d.map(function(d) {\n\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\tsecID : d.secID,\n\t\t\t\t\t\t\t\tmatchNum : d.matchingBills,\n\t\t\t\t\t\t\t\tdate : new Date(d.minDate*1000),\n\t\t\t\t\t\t\t\tparty : d.party,\n\t\t\t\t\t\t\t\thr200 : d.HR200,\n\t\t\t\t\t\t\t\ts200 : d.S200,\n\t\t\t\t\t\t\t\thr100 : d.HR100,\n\t\t\t\t\t\t\t\ts100 : d.S100\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// start drawing the visualization\n\t\t\t \t\t\tcontrolFlow_1();\n\t\t\t\t\t});\n\t\t} else {\n\t\t\t// need to clean up\n\t\t\tcleanFirstLayer();\n\t\t\tcleanWindow1Layer();\n\t\t\tcontrolFlow_1();\n\t\t}\n\n\t\tfunction controlFlow_1(){\n\t\t\trowHeight = firstLayerHeight/sectionData.length;\n\t\t\t// sort by secID\n\t\t\tif (isFirst) {\n\t\t\t\tsortData(sectionData, \"secID\", \"asec\");\n\t\t\t} \n\t\t\t\n\t\t\tdraw_1(rowHeight);\n\t\t\t// direct to second layer\n\t\t\ttoSecondLayer();\n\t\t}\n\n\t\tfunction draw_1(rowHeight){\n\n\t\t\t//the central axis\n \t\t\tsvg.append(\"rect\")\n \t\t\t\t.attr(\"id\", \"firstLayerAxis\")\n \t\t\t\t.attr(\"width\", axisWidth)\n\t\t\t\t.attr(\"height\", rowHeight * sectionData.length)\n\t\t\t\t.attr(\"x\", rowMax)\n\t\t\t\t.attr(\"y\", 0)\n\t\t\t\t.attr(\"fill\", firstLayerCentralAxis);\n \t\t\t\n \t\t\t// the republican row (right hand side)\n \t\t\tsvg.selectAll(\"repRow_1\")\n\t\t\t\t.data(sectionData)\n\t\t\t\t.enter()\n\t\t\t\t.append(\"rect\")\n\t\t\t\t.attr(\"id\", function(d, i) { return \"repRow_1Id\" + i; })\n\t\t\t\t.attr(\"class\", \"repRow_1\")\n\t\t\t\t.attr(\"width\", function(d) { return Math.min(d[\"s200\"] + d[\"hr200\"], maxMatchNum) * rowMax / maxMatchNum; })\n\t\t\t\t.attr(\"height\", rowHeight)\n\t\t\t\t.attr(\"x\", function(d, i) { return rowMax + axisWidth; })\n\t\t\t\t.attr(\"y\", function(d, i) { return i*rowHeight; })\n\t\t\t\t.attr(\"fill\", republicanColor);\n\t\t\t\t\n\t\t\t// the democratic row (left hand side)\n\t\t\tsvg.selectAll(\"demRow_1\")\n\t\t\t\t.data(sectionData)\n\t\t\t\t.enter()\n\t\t\t\t.append(\"rect\")\n\t\t\t\t.attr(\"id\", function(d, i) { return \"demRow_1Id\" + i; })\n\t\t\t\t.attr(\"class\", \"demRow_1\")\n\t\t\t\t.attr(\"width\", function(d) { return Math.min(d[\"s100\"] + d[\"hr100\"], maxMatchNum) * rowMax / maxMatchNum; })\n\t\t\t\t.attr(\"height\", rowHeight)\n\t\t\t\t.attr(\"x\", function(d, i) { return rowMax - (Math.min(d[\"s100\"] + d[\"hr100\"], maxMatchNum) * rowMax / maxMatchNum); })\n\t\t\t\t.attr(\"y\", function(d, i) { return i*rowHeight; })\n\t\t\t\t.attr(\"fill\", democraticColor);\n\t\t}\n\n\t\t/*\n\t\t * Initialize the second layer\n\t\t */\n\t\tfunction toSecondLayer(){\n\t\t\tsecondLayer(sectionData);\n\t\t}\n\n\t\t// end of the first layer\n\t}", "function display() {\n //wrapEdges();\n background(225,200,255);\n textSize(12);\n textStyle(NORMAL);\n\n if (showarrows) {\n textSize(20);\n strokeWeight(0);\n fill(255,255,255);\n text(\"\",0.8*width,0.8*height+75);\n/*\n fill(0,0,255);\n text(\"Force\",0.8*width,0.8*height+50);\n fill(204,0,204);\n text(\"Acceleration\",0.8*width,0.8*height+75);\n*/\n }\n\n strokeWeight(10);\n var tri_width=7;\n if (showarrows) {\n var x_line=5;\n var y_line=5;\n var line_len=100;\n drawLine(x_line,y_line,x_line,y_line+line_len);\n drawLine(x_line,y_line,x_line+line_len,y_line);\n fill(0);\n drawTriangle(x_line-tri_width/2,y_line+line_len,x_line+tri_width/2,y_line+line_len,x_line,y_line+line_len+10);\n drawTriangle(x_line+line_len,y_line-tri_width/2,x_line+line_len,y_line+tri_width/2,x_line+line_len+10,y_line);\n strokeWeight(0);\n drawText(\"+x\",x_line+line_len+15,y_line);\n drawText(\"+y\",x_line,y_line+line_len+15);\n }\n\n drawLine(0,0,0,height); \n drawLine(0,height,width,height);\n drawLine(width,height,width,0);\n \n \n \n if (iterations%2 == 1) { \n append(xhistory,x);\n append(yhistory,y);\n }\n\n iterations += 1; \n \n if (keyIsPressed) {\n isrunning = true; \n }\n \n MaxLength = 0;\n \tif (xhistory.length > MaxLength) {\n xhistory = subset(xhistory,xhistory.length-MaxLength,xhistory.length);\n yhistory = subset(yhistory,yhistory.length-MaxLength,yhistory.length); \n } \n \n noFill(0); //If more text is written elsewhere make sure the default is black\n stroke(0); // If more lines are drawn elsewhere make sure the default is black\n strokeWeight();\n\t /*\n\t\ttextSize(20);\n\t strokeWeight(1);\n\t\tdrawText(\"Click this screen first!\",0.35*width,0.8*height);\n\t\tdrawText(\"then move the arrow keys!\",0.32*width,0.75*height);\n */\n}", "updateLayer(state) {\n return;\n }", "drawConnections (ctx) {\n let now = LiteGraph.getTime();\n\n //draw connections\n ctx.lineWidth = this.d_connections_width;\n\n ctx.fillStyle = \"#AAA\";\n ctx.strokeStyle = \"#AAA\";\n ctx.globalAlpha = this.d_editor_alpha;\n //for every node\n for (let n = 0, l = this.d_graph.d_nodes.length; n < l; ++n) {\n let node = this.d_graph.d_nodes[n];\n //for every input (we render just inputs because it is easier as every slot can only have one input)\n if (node.inputs && node.inputs.length)\n for (let i = 0; i < node.inputs.length; ++i) {\n let input = node.inputs[i];\n if (!input || input.link == null)\n continue;\n let link_id = input.link;\n let link = this.d_graph.d_links[link_id];\n if (!link)\n continue;\n\n let start_node = this.d_graph.getNodeById(link.origin_id);\n if (start_node == null) continue;\n let start_node_slot = link.origin_slot;\n let start_node_slotpos = null;\n\n if (start_node_slot == -1)\n start_node_slotpos = [start_node.pos[0] + 10, start_node.pos[1] + 10];\n else\n start_node_slotpos = start_node.getConnectionPos(false, start_node_slot);\n\n let color = LGraphCanvas.link_type_colors[node.inputs[i].type] || this.d_efault_link_color;\n\n this.d_renderLink(ctx, start_node_slotpos, node.getConnectionPos(true, i), color);\n\n if (link && link._last_time && now - link._last_time < 1000) {\n let f = 2.0 - (now - link._last_time) * 0.002;\n let color = \"rgba(255,255,255, \" + f.toFixed(2) + \")\";\n this.d_renderLink(ctx, start_node_slotpos, node.getConnectionPos(true, i), color, true, f);\n }\n }\n }\n ctx.globalAlpha = 1;\n }", "function graph_load () {\n $(\".power-graph-footer\").show();\n var interval = 1800;\n var intervalms = interval * 1000;\n view.start = Math.ceil(view.start / intervalms) * intervalms;\n view.end = Math.ceil(view.end / intervalms) * intervalms;\n\n if (feeds[\"use_kwh\"] != undefined && feeds[\"solar_kwh\"] != undefined) solarpv_mode = true;\n var import_kwh = feed.getdata(feeds[\"import_kwh\"].id, view.start, view.end, interval, 0, 0);\n\n var use_kwh = [];\n if (solarpv_mode) use_kwh = feed.getdata(feeds[\"use_kwh\"].id, view.start, view.end, interval, 0, 0);\n var solar_kwh = [];\n if (solarpv_mode) solar_kwh = feed.getdata(feeds[\"solar_kwh\"].id, view.start, view.end, interval, 0, 0);\n data = {};\n\n data[\"agile\"] = []\n data[\"outgoing\"] = []\n if (config.app.region != undefined && regions_import[config.app.region.value] != undefined) {\n //Add 30 minutes to each reading to get a stepped graph\n agile = feed.getdataremote(regions_import[config.app.region.value], view.start, view.end, interval);\n for (var z in agile) {\n data[\"agile\"].push(agile[z]);\n data[\"agile\"].push([agile[z][0] + (intervalms - 1), agile[z][1]]);\n }\n\n outgoing = feed.getdataremote(regions_outgoing[config.app.region.value], view.start, view.end, interval);\n for (var z in outgoing) {\n data[\"outgoing\"].push(outgoing[z]);\n data[\"outgoing\"].push([outgoing[z][0] + (intervalms - 1), outgoing[z][1]]);\n }\n }\n // Invert export tariff\n for (var z in data[\"outgoing\"]) data[\"outgoing\"][z][1] *= -1;\n\n\n data[\"use\"] = [];\n data[\"import\"] = [];\n data[\"import_cost\"] = [];\n data[\"export\"] = [];\n data[\"export_cost\"] = [];\n data[\"solar_used\"] = []\n data[\"solar_used_cost\"] = [];\n\n var total_cost_import = 0\n var total_kwh_import = 0\n var total_cost_export = 0\n var total_kwh_export = 0\n var total_cost_solar_used = 0\n var total_kwh_solar_used = 0\n\n this_halfhour_index = -1;\n // Add last half hour\n var this_halfhour = Math.floor((new Date()).getTime() / 1800000) * 1800000\n for (var z = 1; z < import_kwh.length; z++) {\n if (import_kwh[z][0] == this_halfhour) {\n import_kwh[z + 1] = [this_halfhour + 1800000, feeds[\"import_kwh\"].value]\n this_halfhour_index = z\n if (solarpv_mode) {\n use_kwh[z + 1] = [this_halfhour + 1800000, feeds[\"use_kwh\"].value]\n solar_kwh[z + 1] = [this_halfhour + 1800000, feeds[\"solar_kwh\"].value]\n }\n break;\n }\n }\n\n if (import_kwh.length > 1) {\n for (var z = 1; z < import_kwh.length; z++) {\n let time = import_kwh[z - 1][0];\n\n if (solarpv_mode) {\n // ----------------------------------------------------\n // Solar PV agile outgoing\n // ----------------------------------------------------\n // calculate half hour kwh\n let kwh_use = 0;\n let kwh_import = 0;\n let kwh_solar = 0;\n\n if (use_kwh[z] != undefined && use_kwh[z - 1] != undefined) kwh_use = (use_kwh[z][1] - use_kwh[z - 1][1]);\n if (import_kwh[z] != undefined && import_kwh[z - 1] != undefined) kwh_import = (import_kwh[z][1] - import_kwh[z - 1][1]);\n if (solar_kwh[z] != undefined && solar_kwh[z - 1] != undefined) kwh_solar = (solar_kwh[z][1] - solar_kwh[z - 1][1]);\n\n // limits\n if (kwh_use < 0.0) kwh_use = 0.0;\n if (kwh_import < 0.0) kwh_import = 0.0;\n if (kwh_solar < 0.0) kwh_solar = 0.0;\n\n // calc export & self consumption\n let kwh_solar_used = kwh_use - kwh_import;\n let kwh_export = kwh_solar - kwh_solar_used;\n\n // half hourly datasets for graph\n data[\"use\"].push([time, kwh_use]);\n data[\"import\"].push([time, kwh_import]);\n data[\"export\"].push([time, kwh_export * -1]);\n data[\"solar_used\"].push([time, kwh_solar_used]);\n\n // energy totals\n total_kwh_import += kwh_import\n total_kwh_export += kwh_export\n total_kwh_solar_used += kwh_solar_used\n\n // costs\n let cost_import = data.agile[2 * (z - 1)][1] * 0.01;\n let cost_export = data.outgoing[2 * (z - 1)][1] * 0.01 * -1;\n\n // half hourly datasets for graph\n data[\"import_cost\"].push([time, kwh_import * cost_import]);\n data[\"export_cost\"].push([time, kwh_export * cost_export * -1]);\n data[\"solar_used_cost\"].push([time, kwh_solar_used * cost_import]);\n\n // cost totals\n total_cost_import += kwh_import * cost_import\n total_cost_export += kwh_export * cost_export\n total_cost_solar_used += kwh_solar_used * cost_import\n } else {\n // ----------------------------------------------------\n // Import mode only\n // ----------------------------------------------------\n let kwh_import = 0;\n if (import_kwh[z] != undefined && import_kwh[z - 1] != undefined) kwh_import = (import_kwh[z][1] - import_kwh[z - 1][1]);\n if (kwh_import < 0.0) kwh_import = 0.0;\n data[\"import\"].push([time, kwh_import]);\n total_kwh_import += kwh_import\n let cost_import = data.agile[2 * (z - 1)][1] * 0.01;\n data[\"import_cost\"].push([time, kwh_import * cost_import]);\n total_cost_import += kwh_import * cost_import\n }\n }\n }\n\n var unit_cost_import = (total_cost_import / total_kwh_import);\n\n var out = \"\";\n out += \"<tr>\";\n out += \"<td>Import</td>\";\n out += \"<td>\" + total_kwh_import.toFixed(1) + \" kWh</td>\";\n out += \"<td>£\" + total_cost_import.toFixed(2) + \"</td>\";\n out += \"<td>\" + (unit_cost_import * 100 * 1.05).toFixed(1) + \"p/kWh (inc VAT)</td>\";\n out += \"</tr>\";\n\n if (solarpv_mode) {\n var unit_cost_export = (total_cost_export / total_kwh_export);\n out += \"<tr>\";\n out += \"<td>Export</td>\";\n out += \"<td>\" + total_kwh_export.toFixed(1) + \" kWh</td>\";\n out += \"<td>£\" + total_cost_export.toFixed(2) + \"</td>\";\n out += \"<td>\" + (unit_cost_export * 100 * 1.05).toFixed(1) + \"p/kWh (inc VAT)</td>\";\n out += \"</tr>\";\n\n var unit_cost_solar_used = (total_cost_solar_used / total_kwh_solar_used);\n out += \"<tr>\";\n out += \"<td>Solar self consumption</td>\";\n out += \"<td>\" + total_kwh_solar_used.toFixed(1) + \" kWh</td>\";\n out += \"<td>£\" + total_cost_solar_used.toFixed(2) + \"</td>\";\n out += \"<td>\" + (unit_cost_solar_used * 100 * 1.05).toFixed(1) + \"p/kWh (inc VAT)</td>\";\n out += \"</tr>\";\n\n var unit_cost_solar_combined = ((total_cost_solar_used + total_cost_export) / (total_kwh_solar_used + total_kwh_export));\n out += \"<tr>\";\n out += \"<td>Solar + Export</td>\";\n out += \"<td>\" + (total_kwh_solar_used + total_kwh_export).toFixed(1) + \" kWh</td>\";\n out += \"<td>£\" + (total_cost_solar_used + total_cost_export).toFixed(2) + \"</td>\";\n out += \"<td>\" + (unit_cost_solar_combined * 100 * 1.05).toFixed(1) + \"p/kWh (inc VAT)</td>\";\n out += \"</tr>\";\n }\n\n $(\"#octopus_totals\").html(out);\n}", "infor(j,avg,data){\r\n\r\n\r\n if(button == \"d\"){ \r\n count17 = 0;\r\n count18 = 0;\r\n\r\n alpha18 = 50;\r\n alpha17 = 50;\r\n\r\n if(y17[j]<y18[j]){ //17年小于18年\r\n fill(255); \r\n var r_ = map(windowWidth,0,2000,0,4);\r\n var offset = map(y18[j]-y17[j],0,100,0,r_); \r\n beginShape();\r\n vertex(this.x,y17[j]);\r\n vertex(this.x-offset,y18[j]);\r\n vertex(this.x+offset,y18[j]);\r\n endShape(CLOSE);\r\n arc(this.x,y18[j],offset*2,offset*2,PI*2,PI*3);\r\n }else{//18年小于17年\r\n fill(255);\r\n var r_ = map(windowWidth,0,2000,0,4);\r\n var offset = map(y18[j]-y17[j],0,100,0,r_); \r\n beginShape();\r\n vertex(this.x,y17[j]);\r\n vertex(this.x-offset,y18[j]);\r\n vertex(this.x+offset,y18[j]);\r\n endShape(CLOSE);\r\n arc(this.x,y18[j],offset*2,offset*2,PI,PI*2);\r\n }\r\n } \r\n\r\n if(button == \"b\"){ \r\n alpha17 = 255; \r\n alpha18 =50;\r\n this.tX = map(int((temp17[j]+52)), 1, 50, left, right);\r\n }else if(button == \"c\"){ \r\n alpha18 = 255; \r\n alpha17 = 50; \r\n this.tX = map(int((temp18[j]+52)), 1, 50, left, right);\r\n }else if(button == \"a\"){ \r\n this.tX = map(int(j+1), 1, 50, left, right);\r\n if(count17%2==1 && count18%2 == 0){ \r\n alpha18 = 50;\r\n alpha17 = 255;\r\n }else if(count18%2==1 && count17%2 == 0){ \r\n alpha18 = 255; \r\n alpha17 = 50; \r\n }else if(count18%2==1 && count17%2==1){\r\n alpha18 = 255;\r\n alpha17 = 255;\r\n }else if(count18%2==0 && count17%2==0){\r\n alpha18 = 50;\r\n alpha17 = 50;\r\n }\r\n\r\n if(j==1){\r\n policies();\r\n }\r\n }\r\n\r\n if(dist(mouseX,mouseY,this.x,this.y)<10){\r\n fill(255);\r\n textSize(15);\r\n text(nfc(avg[j],2),this.x,this.y);\r\n }\r\n}", "function jarvis(evt) {\r\n\t\t\tvar i,j;\r\n\t\t\t\r\n\t\t\tvar maxx, maxy, start, used, next, cover, s, edge, begin;\r\n\t\t\tvar dur1=0.5;\r\n\t\t\tused = new Array;\r\n\t\t\tcover = new Array;\r\n\t\t\tedge = new Array;\r\n\t\t\tbegin = ((new Date()).valueOf() - time0)/1000 + 1; \t\t\t// The time of the begining of Al.\r\n\t\t\r\n\t\tfor ( i=0 ; i<nodes.length ; i++ ) used[i]=0;\t\r\n\t\t\t\r\n\t\tif ( geomet==false ) {\r\n\t\t\t alert(\"First Change the Enviromet to Geometric\");\r\n\t\t\t return;\r\n\t\t}\r\n\t\tif ( nodes.length<1 )\t \r\n\t\t\t alert(\"There should be altest one point\");\r\n\t\t\t\t\t \r\n\t\t// Finds the point that is down and rigth\r\n\t\tmaxx=0; maxy=0;\r\n\t\tfor ( i=0 ; i<nodes.length ; i++ )\t{\r\n\t\t\t\tif ( parseInt(nodes[i].gi.getAttribute(\"cy\"))>maxy )\t\t\t{\r\n\t\t\t\t\t start = i;\r\n\t\t\t\t\t maxy = parseInt(nodes[i].gi.getAttribute(\"cy\"));\r\n\t\t\t\t\t maxx = parseInt(nodes[i].gi.getAttribute(\"cx\"));\r\n\t\t\t\t} else if ( parseInt(nodes[i].gi.getAttribute(\"cy\"))==maxy && parseInt(nodes[i].gi.getAttribute(\"cx\"))>maxx )\t{\r\n\t\t\t\t\t start = i;\r\n\t\t\t\t\t maxx = parseInt(nodes[i].gi.getAttribute(\"cx\"));\r\n\t\t\t\t}\r\n\t\t}\r\n\t\tnodes[start].gi.setAttribute(\"fill\",\"blue\");\r\n\t\t\r\n\t\tnext=-1;\r\n\t\tused[start] = 1;\r\n\t\tcover.push(start);\r\n\t\tdo {\r\n\t\t\t next = -1;\r\n\t\t\t for ( i=0 ; i<nodes.length ; i++ )\t{\r\n \t\t\t \t\t if ( next==-1 && used[i]==0 ) {\r\n\t\t\t\t\t \t\tnext = i;\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t }\r\n\t\t\t }\r\n\t\t\t i++;\r\n\t\t\t anm_color(nodes[next].gi,\"fill\",\"black\",\"blue\",begin,dur1,1);\r\n\t\t\t begin+=dur1;\r\n\t\t\t line = doc.createElement(\"line\");\r\n\t\t\t line.setAttribute(\"x1\",nodes[cover[cover.length-1]].gi.getAttribute(\"cx\").toString(10));\r\n line.setAttribute(\"y1\",nodes[cover[cover.length-1]].gi.getAttribute(\"cy\").toString(10));\r\n line.setAttribute(\"x2\",nodes[next].gi.getAttribute(\"cx\").toString(10));\r\n line.setAttribute(\"y2\",nodes[next].gi.getAttribute(\"cy\").toString(10));\r\n line.setAttribute(\"stroke\",ETREE);\r\n line.setAttribute(\"stroke-width\",\"6\");\r\n line.setAttribute(\"fill\",\"none\");\r\n line.setAttribute(\"opacity\",0);\r\n objects.push(line);\r\n edge.push(line);\r\n doc.getElementById(\"anim_nodes\").appendChild(line);\r\n\t\t\t anm_opacity(line,0,1,begin,dur1,1);\r\n\t\t\t begin+=dur1;\r\n\t\t\t \r\n\t\t\t for ( ; i<nodes.length ; i++ ) {\r\n\t\t\t \t\t if ( used[i]==0 ) {\r\n\t\t\t\t\t \r\n\t\t\t\t\t \t\t line = doc.createElement(\"line\");\r\n \t\t\t line.setAttribute(\"x1\",nodes[next].gi.getAttribute(\"cx\").toString(10));\r\n line.setAttribute(\"y1\",nodes[next].gi.getAttribute(\"cy\").toString(10));\r\n line.setAttribute(\"x2\",nodes[i].gi.getAttribute(\"cx\").toString(10));\r\n line.setAttribute(\"y2\",nodes[i].gi.getAttribute(\"cy\").toString(10));\r\n line.setAttribute(\"stroke\",ETREE);\r\n line.setAttribute(\"stroke-width\",\"2\");\r\n line.setAttribute(\"fill\",\"none\");\r\n line.setAttribute(\"opacity\",0);\r\n objects.push(line);\r\n edge.push(line);\r\n doc.getElementById(\"anim_nodes\").appendChild(line);\r\n \t\t\t anm_opacity(line,0,1,begin,dur1,1);\r\n\t\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t line = doc.createElement(\"line\");\r\n \t\t\t line.setAttribute(\"x1\",nodes[cover[cover.length-1]].gi.getAttribute(\"cx\").toString(10));\r\n line.setAttribute(\"y1\",nodes[cover[cover.length-1]].gi.getAttribute(\"cy\").toString(10));\r\n line.setAttribute(\"x2\",nodes[i].gi.getAttribute(\"cx\").toString(10));\r\n line.setAttribute(\"y2\",nodes[i].gi.getAttribute(\"cy\").toString(10));\r\n line.setAttribute(\"stroke\",ETREE);\r\n line.setAttribute(\"stroke-width\",\"2\");\r\n line.setAttribute(\"fill\",\"none\");\r\n line.setAttribute(\"opacity\",0);\r\n objects.push(line);\r\n edge.push(line);\r\n doc.getElementById(\"anim_nodes\").appendChild(line);\r\n \t\t\t anm_opacity(line,0,1,begin,dur1,1);\t\t\t\t\t\t \r\n\t\t\t\t\t\t\t \r\n \t\t\t begin+=dur1;\r\n\t\t\t\t\t\t\t \r\n \t\t\t \t\t if ( Os(cover[cover.length-1],next,i)>0 ) {\r\n\t\t\t\t\t\t\t\t\tanm_color(nodes[next].gi,\"fill\",\"black\",\"red\",begin,dur1,1);\r\n \t\t\t\t\t \t\tnext = i;\r\n\t\t\t\t\t\t\t\t\tanm_color(nodes[next].gi,\"fill\",\"black\",\"blue\",begin,dur1,1);\r\n\t\t\t\t\t\t\t\t\tbegin+=dur1;\r\n\t\t\t\t\t\t\t\t\tanm_opacity(edge[edge.length-2],1,0,begin,dur1,1);\r\n\t\t\t\t\t\t\t\t\tanm_opacity(edge[edge.length-3],1,0,begin,dur1,1);\r\n\t\t\t\t\t\t\t\t\tanimate(edge[edge.length-1],\"XML\",\"stroke-width\",2,6,begin,dur1,1);\r\n\t\t\t\t\t\t\t\t\tbegin+=dur1;\r\n\t\t\t\t\t\t\t\t\tedge[edge.length-3] = edge[edge.length-1];\r\n\t\t\t\t\t\t\t\t\tedge.pop(); edge.pop();\r\n\t\t\t\t\t\t\t\t\t\r\n \t\t\t\t\t } else {\r\n \t\t\t\t\t \t anm_opacity(edge[edge.length-1],1,0,begin,dur1,1);\r\n\t\t\t\t\t\t\t\t\tanm_opacity(edge[edge.length-2],1,0,begin,dur1,1);\r\n\t\t\t\t\t\t\t\t\tbegin+=dur1;\r\n\t\t\t\t\t\t\t\t\tedge.pop(); edge.pop();\r\n\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 if ( next!=-1 && next!=start ) {\r\n\t\t\t \t\tcover.push(next);\r\n\t\t\t\t\tused[next] = 1;\r\n\t\t\t\t\tused[start] = 0;\r\n\t\t\t }\r\n\t\t}while( next!=-1 && next!=start );\r\n\t\t\r\n\t\t\r\n\t\t// Output the index of the nodes in the Hull\r\n\t\ts = cover[0].toString(10);\r\n\t\tfor ( i=1 ; i<cover.length ; i++ ) {\r\n\t\t\t\ts=s+\", \"+cover[i].toString(10);\r\n\t\t}\r\n\t\tbar(s);\r\n}", "draw() {\n\t\tthis.newPosition()\n\t\tthis.hoverCalc()\n\n\n\t\t// this.drawWaves()\n\n\t\tthis.applyCircleStyle()\n\n\n\t\tthis.ly.circle( this.x, this.y, 2 * this.r * this.scale )\n\n\t\tthis.applyTextStyle()\n\t\tthis.ly.text( this.label, this.x, this.y )\n\n\n\n\t}", "_changeLayer(layer) {\n //console.log(\"Layer is changed to layer\", layer, this);\n }", "function ready(error, s,e,n,v) {\n\td3.select(\".bkgd\").on(\"click\",function() {repos(n,e,s);});\n\td3.select(\"#geo\").on(\"change\",function() {\n\t\tgeoCheck=!geoCheck;\n\t\treinit(geoCheck,n,e,s)\n\t})\n\t\n\tv=v.values.map(function(d) {return d.value;})\n\tv=d3.nest().key(function(d) {return d.edge}).rollup(function(d) {var record=d[0];record.edges=[];return record}).map(v);\n\n\ts.forEach(function(d) {\n\t\t//pos2.push(projection([+s.lon,+s.lat]));\n\t\tvar geo=projection([+d.lon,+d.lat]);\n\t\td.projx=d3.scale.linear().domain([0,7500]).range([0,800])(d.ratpx);\n\t\td.projy=d3.scale.linear().domain([0,7500]).range([0,800])(d.ratpy);\n\t\td.ratpx=d.projx;d.ratpy=d.projy;\n\t\td.geox=geo[0],d.geoy=geo[1];\n\t\t\n\t\td.ox=d.projx,d.oy=d.projy;\n\t})\n\t\n\tvar totalT=d3.sum(s,function(d) {return d.trafic;})\n\n\tedgesStart=d3.nest().key(function(d) {return d.start;}).map(e);\n\t\n\te.forEach(function(e,i) {\n\t\te.id=i;\n\t\te.start=+e.start;\n\t\te.end=+e.end;\n\t\tif (e.edgeVote) {\n\t\t\te.length=+(v[e.edgeVote].value)*3; // value is between 0 and 100 and corresponds to times between 0 and 5 minutes. \n\t\t\tif (e.type!==\"exit\") {e.length=e.length+120;} // when entering a station or switching lines you have to wait for a train, so 2 minutes are added on average.\n\t\t\tv[e.edgeVote].edges.push(e.id);\n\t\t} else {\n\t\t\te.length=+e.length;\n\t\t}\n\t\te.s1=n[e.start].station;\n\t\te.s2=n[e.end].station;\n\t\tvar t1=+s[e.s1].trafic/edgesStart[s[e.s1].main].length;\n\t\tvar t2=+s[e.s2].trafic/edgesStart[s[e.s2].main].length;\n\t\t//console.log(s[e.s1].main,edgesStart[s[e.s1].main].length)\n\t\te.share=(t1+t2)/totalT;\n\t})\n\n\treticulate(e,s);\n\n\tstations=s;\t\n\tnodes=n;\t\n\tedges=e;\n\tvotes=v;\n\n\tedgesStart=d3.nest().key(function(d) {return d.start;}).map(e);\n\tedgesEnd=d3.nest().key(function(d) {return d.end;}).map(e);\n\n\tedgesC=e.filter(function(d) {if([\"entrance\",\"exit\",\"correspondance\"].indexOf(d.type)===-1) {\n\t\td.color=ratpColors[lineColors[d.type]];return true}})\n\t\n\tdist=calcDist(n,edgesStart,s);\n\n\tvar g3 = staCircleLayer.selectAll(\"circle\").data(stations).enter()\n\t\n\tg3\n\t\t.append(\"circle\").attr(\"class\",\"staCircles\")\n\t\t.style({fill:function(d,i) {return timeScale(dist[i].avg);},stroke:\"black\"})\n\t\t.attr(\"cx\", function(d, i) { return d.projx; })\n\t\t.attr(\"cy\", function(d, i) { return d.projy; })\n\t\t.attr(\"r\",function(d,i) {return d.corr*2+3;/*traScale(stations[i].trafic)*/} )\n\t\t.append(\"title\").text(function(d) {return d.name;});\n\tg3.append(\"text\").attr(\"class\",\"staLabels\")\n\t\t.style({visibility:\"hidden\"})\n\t\t.attr({x:function(d) {return d.projx+5;},y:function(d) {return d.projy-5;},id:function(d,i) {return \"l\"+i;}})\n\t\t.text(function(d) {return d.name;})\n\n\td3.selectAll(\".staCircles\")\n\t\t.on(\"click\",function(d) {repos(n,e,s,v,d,dist);})\n\t\t\n\tcellSta.selectAll(\"path\").data(edgesC).enter().append(\"path\").classed(\"lignes\",1)\n\t\t.attr(\"d\",function(d) {return d.path;})\n\t\t.style({\"stroke-width\":function(d) {return edgeScale(d.share);}, \"stroke\":function(d) {return d.color;}})\n\n\tvar legend0=legend.append(\"g\").attr({id:\"legend0\",transform:\"translate(670,0)\"});\n\tvar onecolor=colors[d3.keys(colors)[Math.floor(Math.random()*d3.keys(colors).length)]]\n\tlegend0.selectAll(\"circle\").data([[130,\"white\"],[150,\"yellow\"],[170,\"red\"]]).enter()\n\t\t.append(\"circle\")\n\t\t.attr({cx:function(d) {return d[0]},cy:20,r:5})\n\t\t.style({\"fill\":function(d) {return d[1];},\"stroke\":\"black\"})\n\tlegend0.selectAll(\"path\").data([[125,5],[145,3],[165,1]]).enter()\n\t\t.append(\"path\")\n\t\t.attr({d:function(d) {return \"M\"+d[0]+\",40h10\"}})\n\t\t.style({\"stroke-width\":function(d) {return d[1]},\"stroke\":colors[d3.keys(colors)[Math.floor(Math.random()*d3.keys(colors).length)]]})\n\t\t\n\tlegend0.append(\"text\").attr({y:25}).text(\"station\").style(\"font-weight\",\"bold\");\n\tlegend0.append(\"text\").attr({y:25,x:60}).text(\"centrale\")\n\tlegend0.append(\"text\").attr({y:25,x:190}).text(\"éloignée\")\n\tlegend0.append(\"text\").attr({y:45}).text(\"ligne\").style(\"font-weight\",\"bold\");\n\tlegend0.append(\"text\").attr({y:45,x:60}).text(\"chargée\")\n\tlegend0.append(\"text\").attr({y:45,x:190}).text(\"peu fréquentée\")\n\t\n\n\tvar legend1=legend.append(\"g\").attr({id:\"legend1\",transform:\"translate(740,0)\"}).style(\"opacity\",0);\n\tlegend1.append(\"text\").attr({y:25}).text(\"Un anneau = 5 minutes de trajet\")\n\n\n\n\tif(location.hash) {\n\t\trepos(n,e,s,v,s[location.hash.slice(1)],dist)\n\t}\n}", "function myGraph(selector) {\n\n/*\nThe vector of nodes is nodes. Each node is an object \nwhich has an id, type, screen coordinates x, y, and velocities vx, vy, a links vector and an age. \n*/\n\n// Adds a node. age is from a global variable\n this.addNode = function (id, type, x, y) {\n nodes.push({\"id\": id, \"type\": type, x: x, y: y, vx:0, vy:0, links:[], \"age\":age});\n return nodes[nodes.length-1];\n };\n\n// removes nodes based on id\n this.removeNode = function (id) {\n var n = findNode(id);\n while (n.links.length > 0) {\n removeLinkIndex(links.indexOf(n.links[0]));\n }\n nodes.splice(findNodeIndex(id), 1);\n };\n\n\n// removes links based in index\n var removeLinkIndex = function(i) {\n var slinks = links[i].source.links;\n slinks.splice(slinks.indexOf(links[i]), 1);\n var tlinks = links[i].target.links;\n tlinks.splice(tlinks.indexOf(links[i]), 1);\n links.splice(i, 1);\n }\n\n// removes link based on source and target\n this.removeLink = function (source, target) {\n for (var i = 0; i < links.length; i++) {\n if (links[i].source.id == source && links[i].target.id == target) {\n removeLinkIndex(i);\n break;\n }\n }\n };\n\n\n// removes all links\n this.removeAllLinks = function () {\n links.splice(0, links.length);\n update();\n };\n\n// removes all nodes and all affected links\n this.removeAllNodes = function () {\n nodes.splice(0, nodes.length);\n links.splice(0, links.length);\n newNodeIndex = 0;\n update();\n };\n\n/*\nEach link has a source and a target. It also has a value (to be used for graphical purposes) and an age \n(from a global variable).\n*/\n this.addLink = function (source, target, value) {\n var nsource = findNode(source);\n var ntarget = findNode(target);\n var newLink = {\"source\": nsource, \"target\": ntarget, \"value\": value, \"age\":age};\n nsource.links.push(newLink);\n ntarget.links.push(newLink);\n links.push(newLink);\n };\n\n\n// finds node based on id\n this.findNode = function (id) {\n for (var i in nodes) {\n if (nodes[i][\"id\"] === id) return nodes[i];\n }\n ;\n };\n\n// finds the age of a link between nodes with id id1 and id2\n this.findLinkAge = function (id1,id2) {\n for (var i in links) {\n if ((links[i].source == id1 && links[i].target == id2) || (links[i].source == id2 && links[i].target == id1) ) return links[i].age;\n }\n };\n\n// finds the node index of a node with id \n var findNodeIndex = function (id) {\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].id == id) {\n return i;\n }\n }\n\n };\n\n\n// finds linked nodes\n this.getLinked = function (node) {\n return node.links.map(function(e) {\n return (e.source === node ? e.target : e.source);\n });\n }\n \n\n// graphical use\n this.screenToWorldPoint = function(x,y) {\n var svgEl = svg.node();\n var pt = svgEl.createSVGPoint();\n pt.x = x;\n pt.y = y;\n pt = pt.matrixTransform(vis.node().getCTM().inverse());\n return pt;\n }\n\n// set up the D3 visualisation in the specified element\n\n var color = d3.scaleOrdinal()\n .domain(graphNodes)\n .range(graphNodesColors);\n\n\n var svg = d3.select(selector)\n .append(\"svg:svg\")\n .attr(\"width\", w)\n .attr(\"height\", h)\n .attr(\"id\", \"svg\")\n .attr(\"pointer-events\", \"all\")\n .attr(\"viewBox\", \"0 0 \" + w + \" \" + h)\n .attr(\"preserveAspectRatio\", \"xMinYMin meet\") \n .on(\"click\",backClick)\n\n\n \n var vis = svg.append('svg:g');\n\n// defines a force simulation\n var force = d3.forceSimulation();\n\n this.nodes = force.nodes()\n this.links = [];\n\n d3.select(\"input[id='gravRange']\")\n .on(\"input\", inputted);\n\n// triggers the search for rewrite patterns\n this.update = function () {\n // Update transform list\n findAllTransforms();\n \n // Update graph\n var link = vis.selectAll(\"line\")\n .data(links, function (d) {\n return d.source.id + \"-\" + d.target.id;\n });\n\n// adds a link representation as a line, the value is used for stroke width\n var linkEnter = link.enter()\n .append(\"line\")\n .style(\"stroke-opacity\",0).style(\"fill-opacity\",0)\n .attr(\"id\", function (d) {\n return d.source.id + \"-\" + d.target.id;\n })\n .attr(\"stroke-width\", function (d) {\n return d.value / 10;\n })\n .transition()\n// .delay(0.2)\n .duration(2)\n .style(\"stroke-opacity\",1).style(\"fill-opacity\",1)\n .attr(\"class\", \"link\")\n //link.append(\"title\")\n // .text(function (d) {\n // return d.value;\n // });\n link.exit().remove();\n\n link = link.merge(linkEnter)\n\n var node = vis.selectAll(\"g.node\")\n .data(nodes, function (d) {\n return d.id;\n });\n\n var nodeEnter = node.enter().append(\"g\")\n .attr(\"class\", \"node\")\n\n// adds a node representation as a circle\n nodeEnter.append(\"svg:circle\")\n .style(\"stroke-opacity\",0).style(\"fill-opacity\",0)\n .transition()\n// .delay(0.2)\n .duration(1)\n .style(\"stroke-opacity\",1).style(\"fill-opacity\",1)\n .attr(\"r\", function(d) {\n if (d.type == \"in\" || d.type == \"out\" || d.type == \"middle\") {\n return 4;\n } else {\n return 8;\n }\n })\n .attr(\"id\", function (d) {\n return \"Node;\" + d.id;\n })\n .attr(\"class\", \"nodeStrokeClass\")\n .attr(\"fill\", function(d) {\n// added metabolism colors \n if (metabo == 0) { \n return color(d.type);\n } else {\n return whiteCol;\n }\n })\n\n node.exit().remove();\n \n node = node.merge(nodeEnter)\n .on(\"click\",nodeClick)\n .on(\"mouseenter\",nodeHover)\n .call(d3.drag()\n .on(\"start\", dragstarted)\n .on(\"drag\", dragged)\n .on(\"end\", dragended)\n );\n\n// mouse drag behaviour\n function dragstarted(d) {\n if (!d3.event.active) force.alphaTarget(0.1).restart();\n d.fx = d.x;\n d.fy = d.y;\n }\n \n function dragged(d) {\n d.fx = d3.event.x;\n d.fy = d3.event.y;\n }\n \n function dragended(d) {\n if (!d3.event.active) force.alphaTarget(0);\n d.fx = null;\n d.fy = null;\n }\n\n\n// takes the value of gravity from the gravity slider\n function gravForce() {\n var gravi = (document.getElementById(\"gravRange\").value) / 1000;\n return gravi;\n }\n \n// keeps node objects on top of edges\n $(\".nodeStrokeClass\").each(function( index ) {\n var gnode = this.parentNode;\n gnode.parentNode.appendChild(gnode);\n });\n\n\n// zoom behaviour\n d3.zoom().on(\"zoom\", function zoom_actions(){\n vis.attr(\"transform\", d3.event.transform)\n })(svg)\n\n// Restart the force layout.\n force\n .alpha(forceAlpha)\n .alphaDecay(forceAlphaDecay)\n .velocityDecay(forceVelocityDecay)\n .force(\"charge_force\", d3.forceManyBody().strength(chargeForceStrength))\n .force(\"center_x\", d3.forceX(w / 2).strength(gravForce))\n .force(\"center_y\", d3.forceY(h / 2).strength(gravForce))\n .force(\"links\", d3.forceLink(links).id(function (d) { return d.id; }).distance(function(d) {\n if (d.value == 1) {\n return 2;\n } else {\n return 1;\n }\n }).strength(forceStrength))\n .on(\"tick\", function () {\n\n node.attr(\"transform\", function (d) {\n return \"translate(\" + d.x + \",\" + d.y + \")\";\n });\n\n link.attr(\"x1\", function (d) {\n return d.source.x;\n })\n .attr(\"y1\", function (d) {\n return d.source.y;\n })\n .attr(\"x2\", function (d) {\n return d.target.x;\n })\n .attr(\"y2\", function (d) {\n return d.target.y;\n });\n })\n .restart();\n\n// end function update()\n };\n\nfunction inputted() {\n force.alphaTarget(1);\n force.restart();\n update();\n}\n\n// Make it all go\n update();\n\n// end function myGraph\n}", "shapeTerrain() {\r\n // MP2: Implement this function!\r\n }", "function graphPlotting(scope) {\n\tdataplotArray.length = 0;\n\tXnCalculation(copy_number_int, cycle_number_int, amplification_eff_int);\n\tchart.render();\n\tchain_reaction_stage.update();\n}", "function drawCanvas() {\n //Clear everything\n clearCanvas([ctx_edges, ctx_nodes, ctx_hover]); //Draw the edges between the categories and the threats\n\n ctx_edges.lineWidth = 3;\n drawEdgesConcepts(); //Draw the edges between the categories and the ICH elements\n\n drawEdgesElements(); //Draw threat categories\n\n ctx_nodes.textBaseline = 'middle';\n ctx_nodes.textAlign = 'center';\n ctx_nodes.font = 'normal normal 400 24px ' + font_family;\n threats.forEach(function (d) {\n drawCategories(ctx_nodes, d);\n }); //Draw the other concepts around the top outside\n\n ctx_nodes.textBaseline = 'middle';\n ctx_nodes.font = 'normal normal 300 19px ' + font_family;\n concepts.forEach(function (d) {\n drawConcepts(ctx_nodes, d);\n }); //Draw the ICH elements around the bottom outside\n\n elements.forEach(function (d) {\n drawElements(ctx_nodes, d);\n }); //Show the title\n\n if (mouse_hover_active) {\n if (hover_type === 'element') showElementTitle(ctx_nodes, 'nodes', current_hover.label);else showElementTitle(ctx_nodes, 'nodes', null, ICH_num); //Show threat concept title when hovered over top threat\n\n if (hover_type === 'concept') showConceptTitle(ctx_nodes, current_hover);\n if (hover_type === 'category') showCategoryRing(ctx_nodes, current_hover, 1);\n } else if (click_active) {\n if (hover_type === 'element') showElementTitle(ctx_nodes, current_click.label, 'nodes');else if (hover_type === 'concept') showConceptTitle(ctx_nodes, current_click);\n } else {\n showElementTitle(ctx_nodes, 'nodes', null, ICH_num_all);\n } //else\n\n } //function drawCanvas", "function drawCanvas() {\n //Clear everything\n clearCanvas([ctx_edges, ctx_nodes, ctx_hover]); //Draw the edges between the categories and the threats\n\n ctx_edges.lineWidth = 3;\n drawEdgesConcepts(); //Draw the edges between the categories and the ICH elements\n\n drawEdgesElements(); //Draw threat categories\n\n ctx_nodes.textBaseline = 'middle';\n ctx_nodes.textAlign = 'center';\n ctx_nodes.font = 'normal normal 400 24px ' + font_family;\n threats.forEach(function (d) {\n drawCategories(ctx_nodes, d);\n }); //Draw the other concepts around the top outside\n\n ctx_nodes.textBaseline = 'middle';\n ctx_nodes.font = 'normal normal 300 19px ' + font_family;\n concepts.forEach(function (d) {\n drawConcepts(ctx_nodes, d);\n }); //Draw the ICH elements around the bottom outside\n\n elements.forEach(function (d) {\n drawElements(ctx_nodes, d);\n }); //Show the title\n\n if (mouse_hover_active) {\n if (hover_type === 'element') showElementTitle(ctx_nodes, 'nodes', current_hover.label);else showElementTitle(ctx_nodes, 'nodes', null, ICH_num); //Show threat concept title when hovered over top threat\n\n if (hover_type === 'concept') showConceptTitle(ctx_nodes, current_hover);\n if (hover_type === 'category') showCategoryRing(ctx_nodes, current_hover, 1);\n } else if (click_active) {\n if (hover_type === 'element') showElementTitle(ctx_nodes, current_click.label, 'nodes');else if (hover_type === 'concept') showConceptTitle(ctx_nodes, current_click);\n } else {\n showElementTitle(ctx_nodes, 'nodes', null, ICH_num_all);\n } //else\n\n } //function drawCanvas", "function paint_graph(arr) {\r\n ctx.lineWidth = 1;\r\n\r\n if (markarea == true) {\r\n markDraw();\r\n } else if (moveit == true) {\r\n moveDraw();\r\n } else if (reshape == true) {\r\n boundariesDraw();\r\n } else if (doreshape == true) {\r\n reshapeDraw();\r\n }\r\n\r\n graphDraw();\r\n}", "function draw(){\n\t\t// Needed to comply with Tool Delegate design pattern\n\t}", "updateLayer() {\n /* This layer is always reloaded */\n return;\n }", "dibujar_p() {\n push();\n stroke('black');\n strokeWeight(3);\n translate(this.posx-((this._shape[0].length*this.longitud)/2),this.posy-((this._shape.length*this.longitud)/2));\n for (var i = 0; i < this._shape.length; i++) {\n for (var j = 0; j < this._shape[i].length; j++) {\n if (this._shape[i][j] != 0) {\n fill(this._shape[i][j]);\n rect(j * this.longitud, i * this.longitud, this.longitud, this.longitud);\n }\n } \n }\n pop();\n}", "function dnObj() {\n\t\t\t\tvar selectOb = canvas.getActiveObject();\n\t\t\t\tcanvas.sendBackwards(selectOb).renderAll();\n\n\t\t}", "function updateTopBubbles(current_state){\n var this_chart = chart[current_state]\n \n //clear the past blocks from the svg\n this_chart.selectAll(\".top-node\"+current_state).remove();\n this_chart.selectAll(\".top_bubble\"+current_state).remove();\n \n //append a light gray rectangle that groups the possible states together\n this_chart.append(\"rect\")\n .attr(\"class\",\"grouping-rect\")\n .attr(\"x\",-1*margin.left)\n .attr(\"y\",-0.5*margin.top)\n .attr(\"width\",chart_width+margin.left+margin.right)\n .attr(\"height\",margin.top+chart_height/12+10)\n .attr(\"fill\",\"#e4e4e4\")\n .attr(\"rx\",40);\n\n //setup the data needed to draw the blocks\n var points = model.get_current_state_array();\n var pointdict = model.get_current_state();\n var newpoints =[];\n var numpoints = points.length;\n \n for(var i in pointdict){\n newpoints.push([i,points[i]])\n }\n \n //create nodes for each possible state of the bag\n var node = this_chart.selectAll(\".top-node\"+current_state)\n .data(newpoints)\n .enter().append(\"g\")\n .attr(\"class\", \"top-node\"+current_state)\n .attr(\"y\", function(d,i,j) {return chart_height/20; })\n .on(\"mouseover\", function(d,i){\n var index = i;\n $(\".line\"+index).attr(\"class\", \"selected-line line\"+index);\n $(\"path.line-graph\").attr(\"id\", \"faded-line\")\n $(\".arrow\"+current_state).attr(\"id\", \"faded-arrow\")\n $(\".arrow\"+current_state+\".this-arrow\"+index).attr(\"id\", \"selected-arrow\");\n $(\"[id=faded-arrow]\").attr(\"marker-end\",\"\");\n })\n .on(\"mouseout\", function(d,i){\n $(\".selected-line\").attr(\"class\", \"line-graph line\"+i);\n $(\"#selected-arrow\").attr(\"id\",\"\");\n $(\"[id=faded-arrow]\").attr(\"id\",\"\")\n $(\"[id=faded-line]\").attr(\"id\",\"\")\n $(\".arrow\"+current_state).attr(\"marker-end\",\"url(#arrowhead)\")\n });\n \n //appends blocks to the nodes\n for(var a =0; a < numpoints-1; a++){\n node.append(\"rect\")\n .attr(\"class\", \"top_bubble\"+current_state)\n .attr(\"x\", function(d,i){return -8+(chart_width)*(i/(points.length-1))+a*((d[1]*(chart_height/12)+10)/(numpoints-1))})\n .attr(\"width\", function(d){return (d[1]*(chart_height/12)+10)/(numpoints-1)})\n .attr(\"height\", function(d){return d[1]*(chart_height/12)+10})\n .style(\"fill\",function(d,i){if(a<i){return \"red\"} else {return \"white\"}})\n .style(\"stroke\",\"black\")\n //.attr(\"y\", function(d,i,j) {return chart_height/100; })\n //.style(\"fill-opacity\",function(d){return d[1];});\n }\n\n updateTopLabels(current_state);\n }", "function showInfo(layer) {\n if (layer.id == \"info_pipe\"){\n //For default layer pipeline\n document.getElementById(\"inf_title\").innerHTML = \"tuberia\";\n document.getElementById(\"inf_id\").innerHTML = \"Layer ID: tfm:tuebria\";\n document.getElementById(\"inf_abs\").innerHTML = \"Abstract: Red de aguas\";\n document.getElementById(\"inf_cp\").innerHTML = \"Contact Person: Claudius Ptolomaeus\";\n document.getElementById(\"inf_org\").innerHTML = \"Organization: The ancient geographes INC\";\n document.getElementById(\"inf_email\").innerHTML = \"Email: [email protected]\";\n document.getElementById(\"inf_phone\").innerHTML = \"Telephone: \";\n document.getElementById(\"inf_ac\").innerHTML = \"Access Constraints: NONE\";\n document.getElementById(\"inf_wms\").innerHTML = \"WMS: http://localhost:8080/geoserver/wms?service=wms&version=1.3.0&request=GetCapabilities\";\n document.getElementById(\"inf_legend\").innerHTML = \"Legend:<br><img src='http://localhost:8080/geoserver/tfm/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&STRICT=false&style=Diametros'>\";\n return;\n }\n if (layer.id == \"info_comm\"){\n //For default layer comments\n document.getElementById(\"inf_title\").innerHTML = \"comments\";\n document.getElementById(\"inf_id\").innerHTML = \"Layer ID: tfm:comments\";\n document.getElementById(\"inf_abs\").innerHTML = \"Abstract: Comments of the interest points\";\n document.getElementById(\"inf_cp\").innerHTML = \"Contact Person: Claudius Ptolomaeus\";\n document.getElementById(\"inf_org\").innerHTML = \"Organization: The ancient geographes INC\";\n document.getElementById(\"inf_email\").innerHTML = \"Email: [email protected]\";\n document.getElementById(\"inf_phone\").innerHTML = \"Telephone: \";\n document.getElementById(\"inf_ac\").innerHTML = \"Access Constraints: NONE\";\n document.getElementById(\"inf_wms\").innerHTML = \"WMS: http://localhost:8080/geoserver/wms?service=wms&version=1.3.0&request=GetCapabilities\";\n document.getElementById(\"inf_legend\").innerHTML = \"Legend:<br><img src='http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=tfm:comments'> Comment\";\n return;\n }\n //The position in the array info, is the same of the layer id,\n //because is ordered it is only necessary fill the data\n document.getElementById(\"inf_title\").innerHTML = info[layer.id][0];\n document.getElementById(\"inf_id\").innerHTML = \"Layer ID: \"+info[layer.id][1];\n document.getElementById(\"inf_abs\").innerHTML = \"Abstract: \"+info[layer.id][2];\n document.getElementById(\"inf_cp\").innerHTML = \"Contact Person: \"+info[layer.id][3];\n document.getElementById(\"inf_org\").innerHTML = \"Organization: \"+info[layer.id][4];\n document.getElementById(\"inf_email\").innerHTML = \"Email: \"+info[layer.id][5];\n document.getElementById(\"inf_phone\").innerHTML = \"Telephone: \"+info[layer.id][6];\n document.getElementById(\"inf_ac\").innerHTML = \"Access Constraints: \"+info[layer.id][7];\n document.getElementById(\"inf_wms\").innerHTML = \"WMS: \"+info[layer.id][8];\n document.getElementById(\"inf_legend\").innerHTML = \"Legend:<br><img style='max-width:100%' src='\"+info[layer.id][9]+\"'>\";\n}", "function setLayer(tmpLinkData, tmpE){\n\t\t//layer is set from bottem to top, one layer per loop. The anchors are layer 0.\n\t\t//change evalutes how many node's layer has set in one loop, if no node's layer is set, change is 0. It means all node's layer is set properly\n\t\tvar change = anchorData.length;\n\t\tvar baseLayer = new ArrayList();\n\t\tanchorData.forEach(function(d){\n\t\t\tbaseLayer.add(d.id);\n\t\t});\n\n\t\t//for (var j = 0; j < 5; j++){\n\t\tvar prevChange = -1;\n\t\tvar numChances = 0;\n\t\twhile (change > 0){\n\t\t\t//tmpLayerMap is a set of nodes that change their layer in this loop, they will be considered as the base layer for next iteration.\n\t\t\t//the base layer of first iteration is anchors, their layer is 0.\n\t\t\t//console.log(\"baseLayer: \");\n\t\t\t//baseLayer.print();\n\t\t\tvar nextLayer = new ArrayList();\n\n\t\t\tif(prevChange == change) {\n\t\t\t\tnumChances++;\n\t\t\t} else {\n\t\t\t\tnumChances = 0;\n\t\t\t}\n\t\t\tprevChange = change;\n\t\t\tchange = 0;\n\n\t\t\tif(numChances > 10) {\n\t\t\t\tconsole.log(\"In a loop to many time, just breaking out\");\n\t\t\t\tmaxLayer -= 9;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t//parse all edges\n\t\t\ttmpLinkData.forEach(function(d){\n\t\t\t\tvar src = d.source;\n\t\t\t\tvar tgt = d.target;\n\t\t\t\t//flag to check if one link need to be evaluated. It is used to avoid infinity loop of cycle.\n\t\t\t\t//when target id is in the base layer, the source will be set will layer = target's layer + 1, if this edge dose not comprise a cycle, the third edge of above example.\n\t\t\t\tif (baseLayer.contains(tgt)){\n\t\t\t\t\tvar e = src + \" \" + tgt;\n\t\t\t\t\tvar flag = true;\n\t\t\t\t\tcycleSet.forEach(function(cycleInstance){\n\t\t\t\t\t\tif (cycleInstance.contains(e)){\n\t\t\t\t\t\t\t//when the edge set has only one edge, this edge will comprise a cycle based on the tree we build befor, the tree consists of all edge we evaluated before\n\t\t\t\t\t\t\tif (cycleInstance.size > 1){\n\t\t\t\t\t\t\t\t//remove the edge from edge set.\n\t\t\t\t\t\t\t\tcycleInstance.removeByValue(e);\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tflag = false;\n\t\t\t\t\t\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\t//set the source node's layer, and record the source node id for next iteration\n\t\t\t\t\tif (flag){\n\t\t\t\t\t\tnodesData[src].layer = nodesData[tgt].layer + 1;\n\t\t\t\t\t\tif (!nextLayer.contains(src)){\n\t\t\t\t\t\t\tnextLayer.add(src);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tchange++;\n\t\t\t\t\t\t//console.log(\"id: \" + src + \" layer: \" + nodesData[src].layer);\t\t\n\t\t\t\t\t}\t\t\n\t\t\t\t}\n\t\t\t});\n\t\t\tbaseLayer = nextLayer;\n\t\t\t//maxLayer is the max layer value we set.\n\t\t\tmaxLayer++;\n\t\t\t//console.log(\"change: \" + change);\t\t\t\n\t\t}\n\t\tmaxLayer--;\t\n\t\t/*\n\t\tnodesData.forEach(function(d, i){\n\t\t\tconsole.log(i + \" \" + d.layer);\n\t\t})\n\t\t*/\n\n\t\t//store the node id in the sequence of layer\n\t\t//xPos is the x position for nodes in the unit of column's width\n\t\tlayerMap = d3.range(maxLayer + 1)\n\t\t\t.map(function(d){\n\t\t\t\treturn [];\n\t\t\t});\n\t\tnodesData.forEach(function(d){\n\t\t\tif (d.layer != undefined){\n\t\t\t\tif (!d.unAssigned){\n\t\t\t\t\tif(d.layer > maxLayer)\n\t\t\t\t\t\td.layer = maxLayer;\n\t\t\t\t\tlayerMap[d.layer].push(d.id);\n\t\t\t\t}\t\t\t\t\n\t\t\t}\t\t\n\t\t});\n\n\t\t//set xpos of nodes, check whether a node is a outside nodes;\n\t\tvar offset = Math.max(xOffset - leftPanelWidth,0);\n\t\tlayerMap.forEach(function(d, i){\n\t\t\tif (i > 0){\n\t\t\t\td.forEach(function(e){\n\t\t\t\t\tvar tmp = [];\n\t\t\t\t\tnodesChildren[e].forEach(function(f){\n\t\t\t\t\t\tif (!nodesData[f].outside.isOutside){\n\t\t\t\t\t\t\ttmp.push(nodesData[f].xpos);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\t\n\t\t\t\t\tif (tmp.length == 0){\n\t\t\t\t\t\tnodesData[e].outside.isOutside = true;\n\t\t\t\t\t\tnodesData[e].xpos = -1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnodesData[e].xpos = (d3.min(tmp) + d3.max(tmp)) / 2;\n\t\t\t\t\t}\n\t\t\t\t}); \n\t\t\t} else {\n\t\t\t\td.forEach(function(e){\n\t\t\t\t\tvar tmpX = nodesData[e].xpos;\t\n\t\t\t\t\tif (tmpX - nodeRadius > offset && tmpX + nodeRadius < offset + windowWidth){\n\t\t\t\t\t\tnodesData[e].outside.isOutside = false;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnodesData[e].outside.isOutside = true;\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t});\n\n\n\t\t//for node that has no layer, set it as outside node\t\n\t\tnodesData.forEach(function(d){\n\t\t\tif (d.layer == undefined){\n\t\t\t\td.outside.isOutside = true;\n\t\t\t\td.noLayer = true;\n\t\t\t\td.layer = -1;\n\t\t\t\td.xpos = -1;\n\t\t\t}\t\n\t\t});\n\n\n\t\t//set the edge link\n\t\ttmpE.forEach(function(d, i){\n\t\t\tvar srcIndex = nodesData.length * 2 + edgeIdMap[d.source] * 2 + 1;\n\t\t\ttextData[srcIndex].layer = (nodesData[textData[srcIndex].node.src].layer + nodesData[textData[srcIndex].node.tgt].layer) / 2;\n\n\t\t\tvar edge = {};\n\t\t\tedge.source = textData[srcIndex];\n\t\t\tedge.target = idMap[d.target];\n\t\t\tedge.id = linksData.length;\n\t\t\tedge.linkType = d.linkType;\n\t\t\tedge.type = \"edgeLink\";\n\t\t\tedge.node = {};\n\t\t\tedge.node.original = d;\n\t\t\tlinksData.push(edge);\n\n\t\t\tvar node = {};\n\t\t\tnode.src = edge.source;\n\t\t\tnode.tgt = edge.target;\n\t\t\tnode.original = d;\n\t\t\ttextData.push({\n\t\t\t\tnode : node,\n\t\t\t\ttype : \"edgeLinkCircle\",\n\t\t\t\tcontent : d.label\n\t\t\t});\n\t\t\ttextData.push({\n\t\t\t\tnode : node,\n\t\t\t\ttype : \"edgeLinkLabel\",\n\t\t\t\tcontent : d.label,\n\t\t\t\tnodeId : d.id\n\t\t\t});\n\n\t\t\ttextLinksData.push({\n\t\t\t\tsource : textData.length - 2,\n\t\t\t\ttarget : textData.length - 1,\n\t\t\t\tedgeId : d.id\n\t\t\t});\n\t\t});\n\t}", "function manageGraph() {\n updateKeys();\n\n if ($(objectGraph + \" svg\").length > 0) {\n updateGraph();\n } else {\n addGraph();\n updateGraph();\n arrangeLabels();\n }\n\n}", "function amphibianlayeron(){\n\n$(\"#species_richness_scale\").show();\n\nfor (i=0; i <= 600; i++){\n\nif (countrieslayer._layers[i]){\nvar country = countrieslayer._layers[i];\ncountry.setStyle(grey);\n\n}\n}\n\nfor (var polygon in amphibianszones._layers) {\nmap.addLayer(amphibianszones._layers[polygon]);\namphibianszones._layers[polygon].setStyle(none);\nfor (var inner in amphibianszones._layers[polygon]._layers){\nif(inner && amphibianszones._layers[polygon].feature.id){\nif(amphibianszones._layers[polygon].feature.id >= 150){\namphibianszones._layers[polygon].setStyle(one);\n}\nelse if(amphibianszones._layers[polygon].feature.id >= 140){\namphibianszones._layers[polygon].setStyle(two);\n}\nelse if(amphibianszones._layers[polygon].feature.id >= 120){\namphibianszones._layers[polygon].setStyle(three);\n}\nelse if(amphibianszones._layers[polygon].feature.id >= 100){\namphibianszones._layers[polygon].setStyle(four);\n}\nelse if(amphibianszones._layers[polygon].feature.id >= 80){\namphibianszones._layers[polygon].setStyle(five);\n}\nelse if(amphibianszones._layers[polygon].feature.id >= 60){\namphibianszones._layers[polygon].setStyle(six);\n}\nelse if(amphibianszones._layers[polygon].feature.id >= 40){\namphibianszones._layers[polygon].setStyle(seven);\n}\n}\n}\n} \n}", "function onFrame(e){\n\tvar layer = project.activeLayer.children;\n\t//a.feed[i] will be referred to as 'x' in the Equation Breakdowns below\n\tswitch(activeIndex){\n\t\tcase 0:\n\t\t\tupdateFeed(layer.length, 4);\n\t\t\tfor(var i = 0; i < layer.length; i++){\n\t\t\t\tlayer[i].size.height = 3 + c.height * (a.feed[i]/150);\n\t\t\t\t/* Equation Breakdown:\n\t\t\t\t\t\t3 -> minimum bar height when x equals 0\n\t\t\t\t\t\tc.height -> height of canvas, to prevent overflow\n\t\t\t\t\t\tx/150 -> returns x as a percentage of 150 */\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tupdateFeed(layer.length, 5);\n\t\t\tvar viewportOrientation = (c.width/c.height >= 1 ? c.height : c.width);\n\t\t\tfor(var i = 0; i < layer.length; i++){\n\t\t\t\tlayer[i].radius = ((a.feed[i]/96) + Math.pow(0.5, i)) * (0.125 - 0.024*i) * viewportOrientation + (3*i);\n\t\t\t\t/* Equation Breakdown:\n\t\t\t\t\t\tx/96 -> returns a number in range [0, 2.66)\n\t\t\t\t\t\tMath.pow(0.5, i) -> minimum value modifier to reduce liklihood of ring collision\n\t\t\t\t\t\t0.125 - 0.024*i -> ensures that each successive ring gets smaller; the radius on the rings will be [0.5%, 50%]\n\t\t\t\t\t\t3*i -> minimum ring size */\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tupdateFeed(layer[0].segments.length, 6);\n\t\t\tvar viewportOrientation = (c.width/c.height >= 1 ? c.height : c.width);\n\t\t\tvar meanFeed = 0;\n\t\t\tfor(var i in a.feed){ meanFeed += a.feed[i]; }\n\t\t\tmeanFeed /= a.feed.length;\n\n\t\t\tfor(var i = 0; i < layer[0].segments.length; i++){\n\t\t\t\tvar hypotneuse = ( Math.pow(-1, i) * Math.pow(a.feed[i], 2) * Math.log(a.feed[i]+1) / 3600000 + meanFeed/550 ) * viewportOrientation + 30;\n\t\t\t\t/* Equation Breakdown:\n\t\t\t\t\t\tMath.pow(-1, i) -> alternates between high and low points\n\t\t\t\t\t\tMath.pow(x, 2)/(16*10*4096) -> dampens the amplitude to reduce sharp peaks between high and low points; limits range to [0, 0.1)\n\t\t\t\t\t\tMath.log(x+1)/log(255) -> significantly raises the amplitude of x[i] when below 100 to decrease the liklihood of a large arc\n\t\t\t\t\t\tmeanFeed/550 -> grows and shrinks entire blob; range approx. [0, 0.45)\n\t\t\t\t\t\t30 -> minimum hypotneuse length of prevent point from falling into center of view */\n\t\t\t\tlayer[0].segments[i].point.x = view.center.x - hypotneuse * Math.cos(i * 0.39269915 + e.count/400);\n\t\t\t\tlayer[0].segments[i].point.y = view.center.y - hypotneuse * Math.sin(i * 0.39269915 + e.count/400);\n\t\t\t\t/*\t22.5deg -> 0.39269915rad\n\t\t\t\t\t\te.count/300 -> rotates blob by ~0.14 degrees per frame */\n\t\t\t}\n\t\t\tlayer[0].smooth();\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tupdateFeed(layer[0].segments.length-1, 9);\n\t\t\tfor(var i = 1; i < layer[0].segments.length-1; i++){\n\t\t\t\tlayer[0].segments[i].point.y = view.center.y - (Math.pow(-1, i) * ((Math.sin(a.feed[i]/20)+1)/15 * c.height + 2));\n\t\t\t\t/* Equation Breakdown:\n\t\t\t\t\t\tview.center.y -> vertically aligns all points\n\t\t\t\t\t\tMath.pow(-1, i) -> alternates between high and low points\n\t\t\t\t\t\t(Math.sin(x/20)+1) -> sin(x/20) used to make wave patterns more unpredictable, but the period increased 20x to preserve a visual pattern; we add 1 to make the range [0, 2]\n\t\t\t\t\t\tMath.sin(...)/15 -> limits range to (.366, .634) of view height\n\t\t\t\t\t\t... + 2 -> prevents flatlining of wave*/\n\t\t\t}\n\t\t\tlayer[0].smooth();\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tupdateFeed(layer[0].segments.length-1, 5);\n\t\t\tfor(var i = 1; i < layer[0].segments.length-1; i++){\n\t\t\t\tlayer[0].segments[i].point.y = view.center.y - ((Math.sin(a.feed[i]/20)/10 * c.height));\n\t\t\t\t/* Equation Breakdown:\n\t\t\t\t\t\tview.center.y -> vertically aligns all points\n\t\t\t\t\t\tMath.sin(x/20) -> sin(x/20) used to make wave patterns more unpredictable, but the period increased 20x to preserve a visual pattern\n\t\t\t\t\t\tMath.sin(...)/10 -> limits range to [.4, .6] of view height; a larger range creates unpleasant artifacts on monitors with low refresh rates*/\n\t\t\t}\n\t\t\tlayer[0].smooth();\n\t\t\tbreak;\n\t}\n}", "function draw(name,first,last){\n \n //cutting data according to selected indizes\n var dataY= scope.data.value.slice(first,last);\n var dataX= scope.data.time.slice(first,last);\n\n var line = new RGraph.Line({\n id: name,\n data: dataY, \n options: {\n backgroundGridVlines: false,\n backgroundGridBorder: false,\n colors: ['red'],\n linewidth: 2,\n gutterLeft: 60,\n gutterRight: 60,\n gutterTop: 50,\n gutterBottom: 80,\n labels: dataX,\n noxaxis: true,\n units: {\n post: '$'\n },\n shadow: false,\n textSize: 10,\n textColor: '#999',\n textAngle: 90,\n tickmarks: function (obj, data, value, index, x, y, color, prevX, prevY){\n var co = obj.context; \n RGraph.path(co, ['b', 'a', x, y, 3, 0, RGraph.TWOPI, false,'c','f', '#a00']);\n }\n }\n }).trace2({frames: 60}).on('beforedraw', function (obj){\n RGraph.clear(obj.canvas, 'white');\n });\n\n // custom tooltip with less decimal places\n var tooltip = dataY.map(function(current,i,array){\n return 'Cost: '+ array[i].toFixed(2).toString()+'$';\n });\n\n line.set('tooltips', tooltip);\n\n }", "function plotFunction(functionText,functionDerivativeText,xbasis,ybasis,start,end,stepSize){\n var shapeLayer = app.project.activeItem.layers.addShape();\n var path = shapeLayer.content.addProperty(\"ADBE Vector Shape - Group\");\n var length = Math.floor((((end-start)*xbasis)/stepSize)+2);\n var k = (100/stepSize) * 3;\n var approx = 10000;\n var vertices=[];\n var inTangents=[];\n var outTangents=[];\n var shape = new Shape();\n var generator = new Function(\"x\",\"return \"+functionText+\";\");\n var generatorDeriv = new Function(\"x\",\"return \"+functionDerivativeText+\";\");\n\n for(var i =0;i<length;i++){\n x = ((stepSize * i) + start* xbasis);\n y = (-ybasis) * Math.round(approx*generator(((stepSize * i) + start* xbasis)/xbasis))/approx;\n y0 = (ybasis/k) * Math.round(approx*generatorDeriv(((stepSize * i) + start* xbasis)/xbasis))/approx;\n vertices.push([x,y]);\n inTangents.push([-100/k,y0]);\n outTangents.push([100/k,-y0]);\n }\n\n shape.vertices=vertices;\n shape.inTangents = inTangents;\n shape.outTangents = outTangents;\n shape.closed=false;\n\n path.path.setValue(shape);\n addStroke(shapeLayer,5);\n shapeLayer.name = functionText;\n shapeLayer.comment = functionText;\n shapeLayer.effect.addProperty(\"xAxis\");\n\n return shapeLayer;\n }", "loadDrawing(){\n submitCanvas(this.sendToNeuralNet);\n }", "getCartesianPlane(){ \n //origem do plano fica a 6% da origem do gráfico\n // O(0.06*h , 0.94h)\n \n //desenha ponto na origem\n\n noStroke()\n //ellipse(this.origin.x,this.origin.y,0.035*this.height,0.035*this.height)\n //fill(255)\n \n\n //desenha eixos do plano\n \n let arrowLength = 0.02*this.height \n stroke(255)\n strokeWeight(4)\n\n //desenha eixo y\n line(this.origin.x, this.origin.y, this.origin.x, 0.05*this.height)\n //desenha flecha à esquerda do eixo Y\n line(this.origin.x, 0.05*this.height, this.origin.x-(arrowLength)*cos(PI/3), 0.05*this.height+(arrowLength)*sin(PI/3))\n //desenha flecha à direita do eixo y\n line(this.origin.x, 0.05*this.height, this.origin.x+(arrowLength)*cos(PI/3), 0.05*this.height+(arrowLength)*sin(PI/3))\n \n //desenha eixo x\n line(this.origin.x, this.origin.y, 0.95*this.width, this.origin.y)\n //desenha flecha abaixo do eixo x\n line(0.95*this.width,this.origin.y, 0.95*this.width-(arrowLength*cos(-PI/6)) , this.origin.y-(arrowLength*sin(-PI/6)))\n //desenha flecha acima do eixo y\n line(0.95*this.width,this.origin.y, 0.95*this.width-(arrowLength*cos(-PI/6)) , this.origin.y+(arrowLength*sin(-PI/6)))\n \n }", "function getLayerSelected() {\n layerSelected = document.getElementById(\"layerSelected\").value;\n levels = new Array(),\n tileXY = new Array(),\n geomLayers = new Array(),\n linkInfoLayers = new Array();\n mapObjects.removeAll();\n if(linkDataInfoBubble !== undefined){linkDataInfoBubble.close();}\n}", "bubblemaker(x,y,w,h,r,g,b){\r\nfill(115)\r\nrect(275*r, 190,370, 185)\r\n\r\nfill(130, 44, 188,255/r)\r\nrect(277/r, 195*r,365/r, 180*r)\r\ntext(\"huffer :\"+encoded,380, 650,620,40)\r\n\r\nfill(220)\r\ntext(sata.name,x,y,w,h)\r\nfill(0)\r\n text(inp.value(),355/r, 255,256)\r\n \r\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 drawingRankingGraph(id){\n d3.select(\"#rankingSvg\").remove();\n var stateRanking = new rankingVis(\"ranking\",stateName);\n}", "function init() {\n\n\t//Kartassa käytettävät muuttujat\n\tvar map, view, overviewMapControl, wfs_layer; //lipas\n\n\t//Paikannuksessa kaytettavat muuttujat\n\tvar geolocation, accuracyFeature, accuracyBuffer, coordinates;\n\t\n\t//Kohteen valitsemisen muuttujat\n\tvar selectInteraction, selectedFeatures\n\n\t//pgRouting kaytettavat muuttujat\n\tvar transform, params, extent, r_padding, coord;\n\tvar startPoint, destPoint, vectorlayer;\n\n\t//Nappi-muuttujat\n\tvar trackButton = document.getElementById('track');\n\tvar new_start_pointButton = document.getElementById('new_start');\n\tvar navigateButton = document.getElementById('navigate');\n\tvar clearButton = document.getElementById('clear'); \n\n\t//innerHTML containerit\n\tvar tarkkuus_info = document.getElementById('tarkkuus');\n\tvar feature_info = document.getElementById('information');\n\tvar error_info = document.getElementById('information');\n\n\n\t//Asettaa nakyman Helsingin keskustaan\n\tview = new ol.View({\n\t center: [2779257.6943, 8439166.6796],\n\t zoom: 12,\n\t minZoom: 11,\n\t maxZoom: 16\n\t});\n\n\t//Kustomoidaan pikkukartta\n\toverviewMapControl = new ol.control.OverviewMap({\n \t// see in overviewmap-custom.html to see the custom CSS used\n \t className: 'ol-overviewmap ol-custom-overviewmap',\n \t layers: [\n \t new ol.layer.Tile({\n \t source: new ol.source.OSM({\n \t'url': 'http://{a-c}.tile.opencyclemap.org/cycle/{z}/{x}/{y}.png'\n \t })\n \t })\n \t ],\n \t collapseLabel: '\\u00BB',\n \t label: '\\u00AB',\n \t collapsed: false\n\t});\n\n\n\tmap = new ol.Map({\n\t renderer: \"canvas\",\n\t controls: ol.control.defaults({\n\t attribution: false\n\t }).extend([\n\t overviewMapControl\n\t ]),\n\t interactions: ol.interaction.defaults().extend([\n\t new ol.interaction.DragRotateAndZoom()\n\t ]),\n\t layers: [\n\t new ol.layer.Tile({\n\t source: new ol.source.OSM()\n\t })],\n\t target: \"map\",\n\t view: view \n\t});\n\n\tmap.addControl(new ol.control.Zoom());\n\n\n\t//WFS-layerin muotoilu\n\twfs_layer = new ol.layer.Vector({\n \t source: vectorSource,\n \t style: new ol.style.Style({\n\t image: new ol.style.Circle({\n\t radius: 6,\n\t fill: new ol.style.Fill({color: 'rgba(57,155,221,1)'}),\n\t stroke: new ol.style.Stroke({color: 'rgba(31,119,180,1)', width: 2})\n \t })\n \t })\n\t});\n\n\tmap.addLayer(wfs_layer);\n\n\n\t//Aloitus- ja lopetuskohteet ja niiden muotoilut\n\tstartPoint = new ol.Feature();\n\tstartPoint.setStyle(new ol.style.Style({\n\t image: new ol.style.Circle({\n\t radius: 6,\n\t fill: new ol.style.Fill({\n\t color: '#FF0000'\n\t }),\n\t stroke: new ol.style.Stroke({\n\t color: '#000000',\n\t width: 2\n\t })\n\t })\n\t}));\n\n\tdestPoint = new ol.Feature();\n\tdestPoint.setStyle(new ol.style.Style({\n\t image: new ol.style.Circle({\n\t radius: 6,\n\t fill: new ol.style.Fill({\n\t color: '#FF0000'\n\t }),\n\t stroke: new ol.style.Stroke({\n\t color: '#000000',\n\t width: 2\n\t })\n\t })\n\t}));\n\n\t//Vektorilayeri aloitus- ja lopetuskohteille\n\tvectorLayer = new ol.layer.Vector({\n \t source: new ol.source.Vector({\n \t \tfeatures: [startPoint, destPoint]\n \t })\n\t});\n\n\tmap.addLayer(vectorLayer);\n\n\n\t//Geolocation, asettaa samalla reitinhaun aloitussijainnin\n\tgeolocation = new ol.Geolocation({\n\t trackingOptions: {\n\t enableHighAccuracy: true\n\t },\n \t projection: view.getProjection(),\n\t tracking: true\n\t});\t\n\n\t//Asettaa tarkkuusalueen\n\taccuracyFeature = new ol.Feature();\n\taccuracyBuffer = new ol.layer.Vector({\n\t map: map,\n\t source: new ol.source.Vector({\n\t features: [accuracyFeature]\n\t })\n\t});\n\n\tmap.addLayer(accuracyBuffer); \n\t\n\n\t//Tata funktiota kutsutaan aina, kun kayttaja painaa paikanna nappia\n\ttrackButton.addEventListener('click',function(event) {\n \n\t //Hakee kayttajan sijainnin ja asettaa siihen aloituspisteen\n\t coordinates = geolocation.getPosition();\n\t startPoint.setGeometry(new ol.geom.Point(coordinates));\n\t\n\t //Muuttaa oletuszoomin- ja paikan\n\t view.setZoom(14);\n\t view.setCenter(coordinates);\n\n\t //Tarkkuusbufferi asetetaan kartalle\n \t accuracyFeature.setGeometry(geolocation.getAccuracyGeometry());\n\n\t //Tarkkuuden ilmoittaminen\n\t tarkkuus_info.innerHTML = '';\n\t tarkkuus_info.innerHTML = 'GIS Software Development Course / Paikannustarkkuus: ' + Math.round(geolocation.getAccuracy()) + 'm';\n \t});\t\n\n\t\n\t//Handle geolocation error \n\tgeolocation.on('error', function(error) {\n \t error_info.innerHTML = error.message;\n \t error_info.style.display = '';\n\t});\n\t\n\n\t// valittujen kohteiden muotoilu\n\tselectedstyle = new ol.style.Style({\n\t image: new ol.style.Circle({\n\t radius: 8,\n\t fill: new ol.style.Fill({\n\t color: 'rgba(57,155,221,1)'\n\t }),\n\t stroke: new ol.style.Stroke({\n\t color: '#000000',\n\t width: 2\n\t })\n\t })\n\t}); \n\n\t//Mahdollistaa layerin kohteiden valitsemisen\n\tselectInteraction = new ol.interaction.Select({\n layers: function(layer) {\n return layer.get('selectable') == true;\n },\n style: [selectedstyle]\n \t});\n\n\tmap.getInteractions().extend([selectInteraction]);\n\twfs_layer.set('selectable',true); \n\t\n\n\t//Vain valittujen kohteiden funktio koordinaattien ja tietojen saamiseen\n\tselectedFeatures = selectInteraction.getFeatures();\t\n\tselectedFeatures.on('add', function(event) {\n\t\n\t //Klikatusta kohteesta muodostetaan muuttuja\n\t feature = event.target.item(0)\t\n\n\t //Otetaan muuttujaksi kohteen koordinaatit\n\t geometry = feature.getGeometry();\n\t coord = geometry.getCoordinates();\t \n\n\t //Muuttaa urlin alun, jos se alkaa www., koska muuten linkit eivat toimi\n\t url = feature.get('www');\n\n\t if (url != null) {\n\t if (url.charAt(0) == 'w') {\n\t new_url = 'http://' + url\n\t }\n\t else { \n\t new_url = url\n\t }\n\t }\n\t else {\n\t new_url = ''\n\t }\n\n\t url_name = new_url\n\n\t if (url_name.length > 35) {\n\t url_name = url_name.substring(0, 35);\n\t url_name = url_name + \"...\"\n\t }\n\n\t feature_info.innerHTML = '';\n\t feature_info.innerHTML += feature.get('tyyppi_nimi_fi') + ': ' + feature.get('nimi_fi') + '<br>' + '<a href=\"' + new_url + '\" ' + 'target=\"_blank\">' + url_name + '</a>' + '<br><br>';\n\n\t});\n\n\t//Palauttaa kohteiden tiedon defaultiksi, kun kayttaja klikkaa muutakuin kohdetta\n\tmap.on('click', function() {\n\t selectedFeatures.clear();\n\t feature_info.innerHTML = 'Klikkaa liikuntakohdetta nähdäksesi sen tiedot';\n\t});\n\t\n\n\n\t//Lisaa aloitussijainti, jos omaa sijaintia ei voida kayttaa\n\tnew_start_pointButton.addEventListener('click', function(event) {\n\n\t //Otetaan paikannustarkkuus luku pois \n\t tarkkuus_info.innerHTML = 'GIS Software Development Course';\n\n\t //Poista aloituspiste ja tarkkuusbufferi\n\t startPoint.setGeometry(null);\n\t accuracyFeature.setGeometry(null);\n\n\t //Aseta uusi aloituspiste kayttajan maaraamana\n\t map.once('click', function(event) {\n\t startPoint.setGeometry(new ol.geom.Point(event.coordinate));\n\t });\n\t});\n\n\n\n\t//pgRoutingin parametrit\n\tparams = {\n \t LAYERS: 'pgrouting:pgrouting',\n \t FORMAT: 'image/png'\n\t};\n\n\t//Transform coordinates from EPSG:3857 to EPSG:4326.\n\ttransform = ol.proj.getTransform('EPSG:3857', 'EPSG:4326');\n\n\n\n\t//Mahdollistaa reitin laskun silloin, kun kayttaja on paattanyt kohteen\t\n\tnavigateButton.addEventListener('click', function(event) {\n\n\t //Tarkistaa onko reitti jo olemassa ja poistaa sen \n\t if (typeof result !== 'undefined') {\t\n\t map.removeLayer(result);\n\t } \n\n\t //Pyytaa kayttajaa valitsemaan kohteen, jos se puuttuu\n\t if (typeof coord == 'undefined') {\n\t alert(\"Valitse kohde!\");\n\t }\n\n\t //Pyytaa kayttajalta aloitussijaintia, jos se puuttuu\n\t if (startPoint.getGeometry() == null) {\n\t alert(\"Aseta aloitussijainti ensin!\");\n\t destPoint.setGeometry(null);\n\t }\n\t \n\t //Asettaa loppupisteen vain featureen\n \t else { \n \t destPoint.setGeometry(new ol.geom.Point(coord));\n\n\t // Transform from EPSG:3857 to EPSG:4326\n \t var startCoord = transform(startPoint.getGeometry().getCoordinates());\n \t var destCoord = transform(destPoint.getGeometry().getCoordinates());\n \t var viewparams = [\n \t 'x1:' + startCoord[0], 'y1:' + startCoord[1],\n \t 'x2:' + destCoord[0], 'y2:' + destCoord[1]\n \t ];\n \n\t //Lahettaa parametrit palvelimelle, joka laskee reitin \n \t params.viewparams = viewparams.join(';');\n \t result = new ol.layer.Image({\n \t source: new ol.source.ImageWMS({\n url: 'http://130.233.249.20:8080/geoserver/pgrouting/wms',\n params: params\n \t })\n \t });\n\n\t map.addLayer(result);\n\n\t //Muuttaa nakyman reitin mukaisesti\n\t start = startPoint.getGeometry().getCoordinates();\n\t end = destPoint.getGeometry().getCoordinates();\n\t new_x = ((start[0] + end[0]) / 2)\n\t new_y = ((start[1] + end[1]) / 2)\n\t view.setCenter([new_x, new_y]);\n\t \n\t //Zoomaa nakyman aloituspaikan ja kohteen mukaan\n\t if (start[0] < end[0]) { \n\t\tminx = start[0] \n\t\tmaxx = end[0]}\n\t else {\n\t\tminx = end[0]\n\t\tmaxx = start[0]}\n\t\n \t if (start[1] < end[1]) {\n\t\tminy = start[1]\n\t\tmaxy = end[1]}\n\t else {\n\t\tminy = end[1]\n\t\tmaxy = start[1]}\n\n\t r_padding = [50, 325, 150, 50];\n\t extent = [minx, miny, maxx, maxy];\n\t map.getView().fit(extent, map.getSize(), {\n\t\tpadding: r_padding,\n\t\tconstrainResolution: false\n\t\t});\n\t \n\t }\n\t});\n\n\t//Poistaa kartalle lisatyn reitin\n \tclearButton.addEventListener('click', function(event) {\n \t destPoint.setGeometry(null);\n \t map.removeLayer(result);\n\t});\n\n}", "drawTree() {\r\n fuenfteAufgabe.crc2.beginPath();\r\n fuenfteAufgabe.crc2.moveTo(this.x, this.y);\r\n fuenfteAufgabe.crc2.lineTo(this.x + 30, this.y - 60);\r\n fuenfteAufgabe.crc2.lineTo(this.x + 60, this.y);\r\n fuenfteAufgabe.crc2.strokeStyle = this.color;\r\n fuenfteAufgabe.crc2.stroke();\r\n fuenfteAufgabe.crc2.fillStyle = this.color;\r\n fuenfteAufgabe.crc2.fill();\r\n }", "function newdefnode(nodeid, type){\n var name\n var index\n\n for (i = 0; i < maploc.length; i++) {\n if (maploc[i].node == nodeid) {\n name = maploc[i].name\n index = i\n }\n }\n\n var figure = new draw2d.shape.basic.Circle({height: 20, width:20});\n figure.add(new draw2d.shape.basic.Label({text:name, stroke:0}), new draw2d.layout.locator.BottomLocator())\n var rawcolor = new draw2d.util.Color(\"#231F21\")\n figure.resetPorts();\n figure.setBackgroundColor(rawcolor);\n figure.setColor(rawcolor.darker());\n figure.setDraggable(false);\n\n //maploc[index].nodetypeform = \"\"\n maploc[index].nodetypecount = -1\n maploc[index].record = []\n maploc[index].data = []\n\n if (type == 'farm') {\n newcolor = new draw2d.util.Color(\"#efd915\")\n maploc[index].record = [{type: 0},{type: 2},{type:1}]\n maploc[index].data = [{prod: raw1.userData.name, amount: 150000, price: 0},{},{prod: fin1.userData.name, amount: 450000, price: 100}]\n maploc[index].nodetypecount = 3\n figure.setBackgroundColor(newcolor);\n figure.setColor(new draw2d.util.Color(\"#0051dd\").darker());\n }\n if (type == 'site') {\n newcolor = new draw2d.util.Color(\"#00ffea\")\n maploc[index].record = [{type: 3},{type: 3},{type: 1}]\n maploc[index].data = [{tech: tech1.userData.name, cap:200000},{tech: tech2.userData.name, cap:200000},{prod: fin1.userData.name, amount: 450000, price: 100}]\n maploc[index].nodetypecount = 3\n figure.setBackgroundColor(newcolor);\n figure.setColor(newcolor.darker());\n }\n if (type == 'tech') {\n newcolor = new draw2d.util.Color(\"#0051dd\")\n maploc[index].record = [{type: 2},{type: 1}]\n maploc[index].data = [{},{prod: fin1.userData.name, amount: 450000, price: 100}]\n maploc[index].nodetypecount = 2\n figure.setBackgroundColor(newcolor);\n figure.setColor(newcolor.darker());\n }\n if (type == 'land') {\n newcolor = new draw2d.util.Color(\"#70AE47\")\n maploc[index].record = [{type: 1},{type: 1},{type: 1},{type: 1},{type: 1},{type: 1}]\n maploc[index].data = [{prod: raw1.userData.name, amount: 450000, price: 0},{prod: int1.userData.name, amount: 450000, price: 0},{prod: fin2.userData.name, amount: 450000, price: 0},{prod: fin3.userData.name, amount: 450000, price: 0},{prod: fin4.userData.name, amount: 450000, price: 0},{prod: fin5.userData.name, amount: 450000, price: 0}]\n maploc[index].nodetypecount = 5\n figure.setBackgroundColor(newcolor);\n figure.setColor(newcolor.darker());\n }\n if (type == 'colc') {\n newcolor = new draw2d.util.Color(\"#ff0000\")\n maploc[index].record = [{type: 1},{type: 1}]\n maploc[index].data = [{prod: fin2.userData.name, amount: 450000, price: 5},{prod: fin4.userData.name, amount: 450000, price: 5},]\n maploc[index].nodetypecount = 2\n figure.setBackgroundColor(newcolor);\n figure.setColor(newcolor.darker());\n }\n\n // add more and more types\n\n\n figure.on(\"dblclick\", function(emitter, event) {\n var infoform = \"\"\n for (var j = 0; j < maploc[index].record.length; j++) {\n infoform = infoform + nodeinfoform(maploc[index].record[j].type, maploc[index].node, j)\n }\n var node_info_alert = alertify.confirm(infoform).set('title', \"Specify Node Information\").set('labels', {ok:'Ok', cancel:'Cancel'}).set('closable',false)\n\n if (maploc[index].data.length > 0) {\n for (var j = 0; j < maploc[index].data.length; j++) {\n\n if (maploc[index].record[j].type == 0 ) {\n document.getElementById('nodeinfo1_' + nodeid +'_' + j).innerHTML = \"Please specify supply information of \" + maploc[index].data[j].prod\n $(\"#nodeinfo2_\" + nodeid +'_' + j).val(String(maploc[index].data[j].amount))\n $(\"#nodeinfo3_\" + nodeid +'_' + j).val(String(maploc[index].data[j].price))\n }\n if (maploc[index].record[j].type == 1) {\n document.getElementById('nodeinfo1_' + nodeid +'_' + j).innerHTML = \"Please specify demand information of \" + maploc[index].data[j].prod\n $(\"#nodeinfo2_\" + nodeid +'_' + j).val(String(maploc[index].data[j].amount))\n $(\"#nodeinfo3_\" + nodeid +'_' + j).val(String(maploc[index].data[j].price))\n }\n if (maploc[index].record[j].type == 3){\n document.getElementById('nodeinfo1_' + nodeid +'_' + j).innerHTML = \"Please specify supply information of \" + maploc[index].data[j].tech\n $(\"#nodeinfo2_\" + nodeid +'_' + j).val(String(maploc[index].data[j].cap))\n }\n }\n }\n node_info_alert.set('onok', function(closeEvent){\n for (var j = 0; j < maploc[index].record.length; j++) {\n savenodeinfo(maploc[index].node, j) // save information of the node\n }\n for (var j = 0; j < maploc[index].record.length; j++) {\n if (maploc[index].record[j].type == 0) {\n sup_table_push(maploc[index].node, j)\n }\n if (maploc[index].record[j].type == 1) {\n dem_table_push(maploc[index].node, j)\n }\n if (maploc[index].record[j].type == 3) {\n sit_table_push(maploc[index].node, j)\n }\n }\n })\n })\n return figure\n }", "function branch(len) {\n line(0, 0, 0, -len);\n translate(0, -len);\n if (len > 4) {\n push();\n stroke(255-inData2);\n rotate(angle);\n branch(len * 0.69);\n pop();\n push();\n rotate(-angle);\n branch(len * 0.69);\n pop();\n }\n}", "function displayThematicLayer(NfaWorld){\r\n gMain.append(\"g\")\r\n .selectAll(\".countries\")\r\n // Get all the countries and display them:\r\n .data(topojson.feature(NfaWorld, NfaWorld.objects.Countries).features)\r\n .enter()\r\n .append(\"path\")\r\n // Choose the color of each country based on its Ecological Footprint value:\r\n .attr(\"fill\", function(d) {\r\n return color(d.properties.TotFtprntCons); })\r\n .attr(\"class\", \"country\")\r\n .attr(\"d\", path);\r\n}", "static draw(cfg, h, ls) {\n\n ls.d.forEach((item, j) => {\n\n let dFcn = h.configGen(this.point(), cfg, ls, item);\n let c = {\n d:dFcn(item),\n data:item,\n cfg:cfg,\n layerState:ls,\n target:'path',\n };\n\n let rv = h.configElement(c);\n let x = ls.sa.x(item) + (cfg.jitter?h.getDrawWidth(ls.sa.x(),Math.random()*cfg.jitter):0);\n rv.e.setAttribute('transform', `translate(${x} ${ls.sa.y(item)})`);\n\n // let type;\n // sym.forEach((s, i) => { // create composite symbols\n //\n // if (d3[`symbol${s}`])\n // type = d3[`symbol${s}`]; // from d3\n // else {\n // type = extra[s]; // extra from above\n // }\n //\n // var symbolGenerator = d3.symbol()\n // .type(type)\n // .size(ls.sa.size(item)**2);\n //\n // let id = `${ls.g.id}-${cfg.id}-${j}`\n // let attr = {\n // 'id':id,\n // \"d\":symbolGenerator(),\n // \"transform\":`translate(${x} ${y})`,\n // \"fill\":ls.sa.color(item),\n // ...h.parseCfgFill(ls.sa, item),\n // ...h.parseCfgStroke(ls.sa, item, cfg.stroke)\n // };\n //\n // h.eventRegister(id, ls.g.id, cfg.ev, {popup:{attr:attr, idx:j, title:cfg.title, data:ls.d}});\n // h.createElement(attr, 'path', ls.g);\n // });\n\n });\n }", "function drawLineUpperLayer(st, en) {\n upperLayerContext.beginPath();\n upperLayerContext.moveTo(st.x, st.y);\n upperLayerContext.lineTo(en.x, en.y);\n upperLayerContext.stroke();\n}", "function nextLayer() {\n if (layers.length) {\n var l = layers.shift();\n l[1].name = l[0];\n l[1].key = 'key';\n l[1].chunks = 50;\n l[1].done = nextLayer;\n me.map.addLayer(l[1].src, l[1]);\n } else {\n proceed();\n }\n }", "drawGraphic() {\n //get the width of the canvas and save it on a local variable\n var width = view.width;\n //get the height of the canvas and save it on a local variable\n var height = view.height;\n //define a local variable for containing the current abscissa of drawing point. Initialize it to 0.\n var x=0;\n //define a local variable for containing the current ordinate of drawing point. Initialize it to half the height of the canvas.\n var y=height/2;\n //move the drawing point to the initial position and start filling the graphic with green color\n this.moveTo(x, y).beginFill(\"green\");\n //for every hole object in the holes array\n for (var holeObject of this.holes) {\n //set the abscissa to the leftmargin of the hole\n x=holeObject.leftMargin;\n this.lineTo(x,y);\n //move the point to the left bottom of the hole\n y+=holeObject.hole.depth;\n this.lineTo(x,y);\n //move the point to the right bottom of the hole\n x+=holeObject.hole.width;\n this.lineTo(x,y);\n //move the point to the right top of the hole\n y-=holeObject.hole.depth;\n this.lineTo(x,y);\n }\n //set tha absissa to the end of the ground\n x=width;\n this.lineTo(x,y);\n //draw a line to close the right part of the ground\n y=height;\n this.lineTo(x,y);\n //draw a line to close the bottom part of the ground\n x=0;\n this.lineTo(x,y);\n //draw a line to close the left part of the ground\n y=height/2;\n this.lineTo(x,y);\n //close the drawn path and complete the filling\n this.closePath().endFill();\n //return this for method chaining\n return this;\n }", "draw(){\n noStroke();\n if(this.getHover() || this.getSelected()){\n fill(BLUE_5); //needs a constant\n }\n else{\n fill(this.col);\n }\n \n push();\n beginShape(); //CCW\n vertex(this.getX() - (this.w)/2.0, this.getY() + (this.h)/2.0); //top left\n vertex(this.getX() - (this.w)/2.0, this.getY() - (this.h)/2.0);\n vertex(this.getX() + (this.w)/2.0, this.getY() - (this.h)/2.0);\n vertex(this.getX() + (this.w)/2.0, this.getY() + (this.h)/2.0);\n\n endShape(CLOSE);\n pop();\n }", "function LGraphMap2D()\r\n\t{\r\n\t\tthis.addInput(\"x\",\"number\");\r\n\t\tthis.addInput(\"y\",\"number\");\r\n\t\tthis.addOutput(\"[]\",\"array\");\r\n\t\tthis.addOutput(\"obj\",\"object\");\r\n\t\tthis.addOutput(\"img\",\"image\");\r\n\t\tthis.addProperty(\"circular\",false);\r\n\t\tthis.points = [];\r\n\t\tthis.weights = [];\r\n\t\tthis.weights_obj = {};\r\n\t\tthis.current_pos = new Float32Array([0.5,0.5]);\r\n\t\tthis.size = [200,200];\r\n\t\tthis.dragging = false;\r\n\t\tthis.show_names = true;\r\n\t\tthis.circle_center = [0,0];\r\n\t\tthis.circle_radius = 1;\r\n\t\tthis.margin = 20;\r\n\t\tthis._values_changed = true;\r\n\t\tthis._visualize_weights = false;\r\n\t\tthis._version = 0;\r\n\t\tthis._selected_point = null;\r\n\t}", "function drawEdgesElements() {\n // ctx_edges.globalCompositeOperation = \"multiply\" - makes it all tooooo slow\n edges_elements.forEach(d => {\n let stroke = color_threat_scale(d.target.id);\n ctx_edges.strokeStyle = chroma(stroke)\n .alpha(d.opacity)\n .css();\n ctx_edges.beginPath();\n line(d.line_data);\n ctx_edges.stroke();\n }); //forEach\n // ctx_edges.globalCompositeOperation = \"source-over\"\n } //function drawEdgesElements", "function addNodeAndLink(e, obj) {\n adorn = obj.part;\n if (adorn === null) return;\n e.handled = true;\n diagram = adorn.diagram;\n\t diagram.startTransaction(\"Add State\");\n\t\t// get the node data for which the user clicked the button\n\t\t fromNode = adorn.adornedPart;\n\t\t fromData = fromNode.data;\n\t if( !(diagram instanceof go.Palette))\n\t {\n\n\n\t\t// create a new \"State\" data object, positioned off to the right of the adorned Node\n\t\t type= document.getElementById('defaultPattern').value;\n\t\tif (type!=\"\")\n\t\t{\n\t\t\t minInd=50;\n\t\t\t minIdx=-1;\n\t\t for ( i=0; i<=NodeArray.length-1;i++)\n\t\t\t{\n\n\t\t\t\tindicator =NodeArray[i].text.indexOf(type.toLowerCase());\n\n\t\t\t\tif (indicator>=0)\n\t\t\t\t{\n\t\t\t\t\tif (indicator<=minInd)\n\t\t\t\t\t{\n\t\t\t\t\t\tminInd=indicator;\n\t\t\t\t\t\tminIdx=i;\n\t\t\t\t\t}\n\n\n\t\t\t\t}\n\t\t\t}\n\t\t\t toData;\n\t\t if (NodeArray[minIdx].category==\"pic\")\n\t\t\t\t\t{\n\t\t\t\t\t\ttoData= {category: NodeArray[minIdx].category,text: NodeArray[minIdx].text,img: NodeArray[minIdx].img};\n\n\t\t\t\t\t}\n\t\t\t\t\telse if(NodeArray[minIdx].category==\"Comment\")\n\t\t\t\t\t{\n\t\t\t\t\t\ttoData= {category: NodeArray[minIdx].category,text: NodeArray[minIdx].text};\n\n\t\t\t\t\t}\n\t\t }\n\t\t else\n\t\t {\n\t\t toData = {text: \"new\"}\n\n\t\t }\n\n\t\t p = fromNode.location;\n\t\t toData.loc = new go.Point(p.x,p.y+200); // the \"loc\" property is a string, not a Point object\n\t\t // add the new node data to the model\n\t\t model = diagram.model;\n\t\t model.addNodeData(toData);\n\t\t // create a link data from the old node data to the new node data\n\t\t linkdata = {};\n\t\t linkdata[model.linkFromKeyProperty] = model.getKeyForNodeData(fromData);\n\t\t linkdata[model.linkToKeyProperty] = model.getKeyForNodeData(toData);\n\t\t // and add the link data to the model\n\t\t model.addLinkData(linkdata);\n\t\t // select the new Node\n\t\t newnode = diagram.findNodeForData(toData);\n\t\t diagram.select(newnode);\n\t\t diagram.commitTransaction(\"Add State\");\n\n\t }\n\t else\n\t {\n\t\tmyDiagram.startTransaction(\"Add State\");\n\t\tfromNode.data.loc = new go.Point(maxx,maxy+400);\n\t\tmaxx=maxx+400;\n\t\tmyDiagram.model.addNodeData(fromNode.data);\n\t\tmyDiagram.commitTransaction(\"Add State\");\n\t }\n\n }", "function cg( canvas, adjm )\n\n//Creating a canvas node\n{function create_cno( x, y, label )\n\t{var C = new fabric.Circle( {\n strokeWidth: nsw,\n radius: nr,\n fill: nbc,\n stroke: nbc\n} );\nC.hasControls = C.hasBorders = false;\nC.setShadow( \"0px 0px 10px rgba( 0, 0, 0, 0.7 )\" );\nvar text = new fabric.Text( label.toString( ), {\nfontSize: 20,\nfontFamily: \"Verdana, sans-serif\",\nfill: \"#fff\"\n} );\nvar cno = new fabric.Group( [ C, text ], {\nleft: x,\ntop: y,\n} );\ncno.hasControls = cno.hasBorders = false;\nreturn cno;\n}\n \n //Creating a canvas Edge\nfunction ccee( canvas, crd, label ) \n\t{var c_ee = new fabric.Line( crd, {\n fill: ebc,\n stroke: ebc,\n strokeWidth: 5,\n selectable: false,\n} );\nc_ee.setShadow( \"0px 0px 10px rgba( 0, 0, 0, 0.7 )\" );\n\t\tvar text = new fabric.Text( label.toString( ), {\n\t\tleft: ( crd[ 0 ] + crd[ 2 ] ) / 2,\ntop: ( crd[ 1 ] + crd[ 3 ] ) / 2,\n\t\tfontSize: 20,\n fontFamily: \"Verdana, sans-serif\",\n fill: \"#fff\",\n selectable: false\n} );\ntext.setShadow( \"0px 0px 5px rgba( 0, 0, 0, 0.9 )\" );\ncanvas.add( text );\nc_ee.edge_label = text;\nreturn c_ee;\n}\nwindow_height = window.innerHeight;\nwindow_width = window.innerWidth;\nnodes = [ ];\nfor ( i = 0; i < non; ++i )\n\t{ var nco = { x: random_float_in_range( ( nr * 2 ) + nsw, window_width - ( nr * 2 ) - nsw ),\n\t\t y: random_float_in_range( 70, window_height - ( nr * 2 ) - nsw ) };\n\t\tnodes.push( nco );\n\t\tvar cno = create_cno( nodes[ i ].x, nodes[ i ].y, i );\n\t\tcanvas.add( cno );\n\t\tcno.moveTo( 1 );\n\t\tnodes[ i ].cno = cno;\n\t\tnodes[ i ].c_ees = [ ];\n\t}\n\tfor ( row = 0; row < non; ++row )\n\t{for ( col = 0; col < non; ++col )\n\t\t{if ( adjm[ row ][ col ] != -1 )\n\t\t\t{var delx = nodess[ row ].x - nodes[ col ].x;\n\t\t\t\tvar dely = nodes[ row ].y - nodes[ col ].y;\n\t\t\t\tvar distance = Math.sqrt( ( delx * delx ) + ( dely * dely ) );\n\t\t\t\tadjm[ row ][ col ] = distance;\n\t\t\t\tvar distance = parseFloat( distance ).toFixed( 2 );\n\t\t\t var c_ee = ccee( canvas, [ nodes[ row ].x, nodes[ row ].y, nodes[ col ].x, nodes[ col ].y ], distance );\n\t\t\t \tcanvas.add( c_ee ); \n\t\t\t\tc_ee.moveTo( 0 );\n\t\t\t\tnodes[ row ].c_ees.push( [ c_ee, \"out\", col ] );\n\t\t\t\tnodes[ col ].c_ees.push( [ c_ee, \"in\", row ] );\n\t\t\t\t}\n\t\t\t}\n\t}\n\treturn nodes;\n}", "function OnSceneGUI() {\n var waypoints = path.editor_waypoints.Where(function(obj) obj != null).ToArray();\n\n if(waypoints.length > 0) {\n drawDisc(waypoints[:1], Color(0, 1, 0, 0.3));\n }\n\n if(waypoints.length > 1) {\n drawDisc(waypoints[-1:], Color(1, 0, 0, 0.3));\n }\n\n if(waypoints.length > 2) {\n drawDisc(waypoints[1:-1], Color(0, 0, 1, 0.3));\n }\n\n for(var w in waypoints) {\n if(path.editor_showHandles) {\n w.transform.position = Handles.PositionHandle(w.transform.position, Quaternion.identity);\n } else {\n w.transform.position = Handles.FreeMoveHandle(\n w.transform.position,\n Quaternion.identity,\n 1.5,\n Vector3(0,0,0),\n Handles.DrawRectangle\n );\n }\n\n if(GUI.changed) {\n EditorUtility.SetDirty(w);\n Repaint();\n OnInspectorGUI();\n }\n }\n\n Handles.color = Color(1,0,1,1);\n Handles.DrawPolyLine(waypoints.Select(function(w) w.transform.position).ToArray());\n\n }", "function drawAllBuses(){\n map.on(\"load\", function(){\n console.log(\"adding buses\");\n\n console.log(cta);\n map.addSource(\"Bus Routes\", {\n \"type\":\"geojson\",\n \"data\":cta});\n\n console.log(\"layer\");\n\n map.addLayer({\n \"id\": \"Bus Routes\",\n \"type\": \"line\",\n \"source\": \"Bus Routes\",\n \"layout\": {\n \"line-join\": \"round\",\n \"line-cap\": \"butt\"\n },\n \"paint\": {\n \"line-color\": \"#31a354\",\n \"line-width\": 4,\n \"line-opacity\": 0.4\n }\n });\n });\n}", "function transit(){\n\t\tlinks = links.data(linksData, function(d){\n\t\t\treturn d.edgeId;\n\t\t});\n\t\tlinks.enter()\n\t\t\t.append(\"path\")\n\t\t\t.attr(\"stroke\", \"#555\")\n\t\t\t.attr(\"stroke-width\", 1)\n\t\t\t//.attr(\"opacity\", 0.5)\n\t\t\t.attr(\"id\", function(d, i){\n\t\t\t\treturn d.source.id + \"link\" + d.target.id;\n\t\t\t})\n\t\t\t.attr(\"class\", function(d) {\n\t\t\t\tvar provClass = \"\"\n\t\t\t\tif(d.isProvenance)\n\t\t\t\t\tprovClass = \" provenanceLink\"\n\t\t\t\treturn \"link \" + d.linkType + \" \" + d.linkStatus + provClass;\n\t\t\t})\n\t\t\t.attr(\"fill\", \"none\");\n\t\tlinks.exit()\n\t\t\t.transition()\n\t\t\t.duration(transitionDisapearTime)\n\t\t\t.attr(\"opacity\", 0)\n\t\t\t.remove();\n\n\n\t\tlinkArrow = linkArrow.data(linksData, function(d){\n\t\t\treturn d.edgeId;\n\t\t});\n\t\tlinkArrow.enter()\n\t\t\t.append(\"polygon\")\n\t\t\t.attr(\"fill\", \"#555\")\n\t\tlinkArrow.exit()\n\t\t\t.transition()\n\t\t\t.duration(transitionDisapearTime)\n\t\t\t.attr(\"opacity\", 0)\n\t\t\t.remove();\n\t\t\t\n\t\tlabels = labels.data(textData, function(d){\n\t\t\treturn d.nodeId;\n\t\t});\n\t\tlabels.enter()\n\t\t\t.append(\"g\")\n\t\t\t.classed(\"label\", true)\n\t\t\t.attr(\"id\", function(d, i){\n\t\t\t\tif (d.type == \"nodeLabel\"){\n\t\t\t\t\treturn \"nodeLabelG\" + d.node.id;\n\t\t\t\t} else if (d.type == \"linkLabel\"){\n\t\t\t\t\treturn \"linkLabelG\" + d.node.src + \"-\" + d.node.tgt;\n\t\t\t\t} else if (d.type == \"edgeLinkLabel\"){\n\t\t\t\t\treturn \"edgeLinkLabelG\" + nodesData[d.node.tgt].id;\n\t\t\t\t}\n\t\t\t\treturn \"labelPartG\" + i;\n\t\t\t});\n\t\tlabels.exit()\n\t\t\t.transition()\n\t\t\t.duration(transitionDisapearTime)\n\t\t\t.attr(\"opacity\", 0)\n\t\t\t.remove();\n\n\t\t\n\t\tvar test = labels.append(\"circle\")\n\t\t\t.attr(\"r\", 0)\n\n\t\tlabelFrame = labels\n\t\t\t.append(\"g\")\n\t\t\t.attr(\"class\", function(d){\n\t\t\t\tif (d.type == \"nodeLabel\"){\n\t\t\t\t\treturn \"nodeLabel\";\n\t\t\t\t} else if (d.type == \"linkLabel\"){\n\t\t\t\t\treturn \"linkLabel\";\n\t\t\t\t} else if (d.type == \"edgeLinkLabel\"){\n\t\t\t\t\treturn \"edgeLinkLabel\";\n\t\t\t\t}\n\t\t\t\treturn \"unusedLable\";\n\t\t\t})\n\t\t\t.attr(\"id\", function(d, i){\n\t\t\t\tif (d.type == \"nodeLabel\"){\n\t\t\t\t\treturn \"nodeLabel\" + d.node.id;\n\t\t\t\t} else if (d.type == \"linkLabel\"){\n\t\t\t\t\treturn \"linkLabel\" + d.node.src + \"-\" + d.node.tgt;\n\t\t\t\t} else if (d.type == \"edgeLinkLabel\"){\n\t\t\t\t\treturn \"edgeLinkLabel\" + nodesData[d.node.tgt].id;\n\t\t\t\t}\n\t\t\t\treturn \"labelPart\" + i;\n\t\t\t})\n\t\t\t.attr(\"opacity\", 0);\n\t\t\t\n\t\tlabelText = labelFrame\n\t\t\t.filter(function(d, i){\n\t\t\t\treturn i % 2 == 1;\n\t\t\t})\n\t\t\t.append(\"text\")\n\t\t\t.text(function(d, i){\n\t\t\t\tif (d.type == \"nodeLabel\" && d.node.type == \"anchor\"){\n\t\t\t\t\treturn d.content;\n\t\t\t\t}\n\t\t\t\tif (d.content.length > 20){\n\t\t\t\t\td.alt = d.content.slice(0, 7) + \"...\" + d.content.slice(d.content.length - 10, d.content.length);\n\t\t\t\t\treturn d.alt;\n\t\t\t\t}\n\t\t\t\treturn d.content;\n\t\t\t})\n\t\t\t.attr(\"fill\", function(d){\n\t\t\t\tif (d.type == \"nodeLabel\"){\n\t\t\t\t\treturn \"white\";\n\t\t\t\t}\n\t\t\t\tif (d.type == \"linkLabel\" || d.type == \"edgeLinkLabel\"){\n\t\t\t\t\treturn \"black\";\n\t\t\t\t}\n\t\t\t\treturn \"none\";\n\t\t\t})\n\t\t\t.attr(\"font-weight\", function(d){\n\t\t\t\tif (d.type == \"nodeLabel\"){\n\t\t\t\t\treturn \"bold\";\n\t\t\t\t}\n\t\t\t\treturn \"normal\";\n\t\t\t})\n\t\t\t.attr(\"font-family\", \"Arial\")\n\t\t\t.attr(\"font-size\", 12)\n\t\t\t.attr(\"opacity\", 0.8)\n\t\t\t.attr(\"x\", function(d){\n\t\t\t\td.width = this.getBBox().width //+ textHeight / 3 * 2;\n\t\t\t\tif (d.type == \"nodeLabel\"){\n\t\t\t\t\td.node.labelWidth = d.width;\n\t\t\t\t}\n\t\t\t\treturn -(d.width / 2);\n\t\t\t})\n\t\t\t.attr(\"y\", -3);\n\n\t\tlabelBoard = labelFrame\n\t\t\t.filter(function(d, i){\n\t\t\t\treturn i % 2 == 1;\n\t\t\t})\n\t\t\t.append(\"path\")\t\n\t\t\t.attr(\"stroke-width\", 0)\n\t\t\t.attr(\"stroke\", function(d){\n\t\t\t\treturn \"red\";\n\t\t\t\tif (d.type == \"nodeLabel\"){\n\t\t\t\t\treturn \"#ddd\";\n\t\t\t\t} else if (d.type == \"linkLabel\"){\n\t\t\t\t\treturn \"#555\";\n\t\t\t\t}\n\t\t\t})\t\t\n\t\t\t.attr(\"id\", function(d){\n\t\t\t\tif (d.type == \"nodeLabel\"){\n\t\t\t\t\treturn \"nodeLabelBoard\" + d.node.id;\n\t\t\t\t} else if (d.type == \"linkLabel\"){\n\t\t\t\t\treturn \"linkLabelBoard\" + d.node.src + \"-\" + d.node.tgt;\n\t\t\t\t} else if (d.type == \"edgeLinkLabel\"){\n\t\t\t\t\treturn \"edgeLinkLabelBoard\" + nodesData[d.node.tgt].id;\n\t\t\t\t}\n\t\t\t})\t\n\t\t\t.attr(\"fill\", function(d){\n\t\t\t\tif (d.type == \"nodeLabel\"){\n\t\t\t\t\tif (d.node.isForcedByUser) return \"rgb(42,98,126)\";\n\t\t\t\t\tif (d.node.isTemporary) return \"#888\";\n\t\t\t\t\treturn \"#555\";\n\t\t\t\t}\n\t\t\t\tif (d.type == \"linkLabel\" || d.type == \"edgeLinkLabel\"){\n\t\t\t\t\treturn \"#ddd\";\n\t\t\t\t}\n\t\t\t\treturn \"none\";\n\t\t\t})\n\t\t\t.attr(\"d\", function(d){\n\t\t\t\tif (d.type != \"nodeLabel\" && d.type != \"linkLabel\" && d.type != \"edgeLinkLabel\"){\n\t\t\t\t\td.width = 0;\n\t\t\t\t\treturn \"\";\n\t\t\t\t}\n\t\t\t\tvar textWidth = d.width;\n\t\t\t\tvar dx = -textWidth / 2;\n\t\t\t\tvar dy = 0;\t\t\t\t\t\t\t\n\t\t\t\treturn \"M \" + dx + \" \" + dy + \" L \" + (dx + textWidth) + \" \" + dy + \" Q \" + (dx + textWidth + textHeight / 3) + \" \" + (dy - textHeight / 2) + \" \" + (dx + textWidth) + \" \" + (dy - textHeight) + \" L \" + dx + \" \" + (dy - textHeight) + \" Q \" + (dx - textHeight / 3) + \" \" + (dy - textHeight / 2) + \" \" + dx + \" \" + dy;\n\t\t\t});\n\t\t\t\n\t\tlabelBoard.moveToBack();\n\n\t\tlabelApproveBoard = labels\n\t\t\t.filter(function(d, i){\n\t\t\t\t//console.log(JSON.stringify(d));\n\t\t\t\treturn d.type == \"linkLabel\" && d.node.original.linkStatus == \"TemporaryLink\";\n\t\t\t})\n\t\t\t.append(\"rect\")\n\t\t\t.attr(\"fill\", \"transparent\")\n\t\t\t.classed(\"clickBoard\", true)\n\t\t\t.attr(\"r\", nodeRadius+1)\n\t\t\t.attr(\"opacity\", 1)\n\t\t\t.attr(\"stroke-width\", 2)\n\t\t\t.attr(\"stroke\", \"red\")\n\t\t\t.attr(\"width\", function(d){\n\t\t\t\treturn 8;\n\t\t\t})\n\t\t\t.attr(\"height\", function(d){\n\t\t\t\treturn 8;\n\t\t\t})\n\t\t\t.attr(\"x\", function(d){\n\t\t\t\tvar w = Math.ceil(this.parentNode.childNodes[1].getBBox().width);\n\t\t\t\treturn -4;\n\t\t\t})\n\t\t\t.attr(\"y\", function(d){\n\t\t\t\tvar h = Math.ceil(this.parentNode.childNodes[1].getBBox().height);\n\t\t\t\treturn -h+15;\n\t\t\t})\n\t\t\t.on(\"click\", function(d){\n\t\t\t\tif(linkApproveClickListener != null)\n\t\t\t\t\t\tlinkApproveClickListener(d.node.original, d3.event);\n\t\t\t});\n\n\t\tlabelClickBoard = labels\n\t\t\t.filter(function(d, i){\n\t\t\t\treturn (i % 2 == 1) && d.node.type != \"anchor\";\n\t\t\t})\n\t\t\t.append(\"rect\")\n\t\t\t.classed(\"clickBoard\", true)\n\t\t\t.attr(\"id\", function(d){\n\t\t\t\tif (d.type == \"nodeLabel\"){\n\t\t\t\t\treturn \"nodeLabelClickBoard\" + d.node.id;\n\t\t\t\t} else if (d.type == \"linkLabel\"){\n\t\t\t\t\treturn \"linkLabelClickBoard\" + d.node.src + \" \" + d.node.tgt;\n\t\t\t\t} else if (d.type == \"edgeLinkLabel\"){\n\t\t\t\t\treturn \"edgeLinkClickBoard\" + nodesData[d.node.tgt].id;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.attr(\"fill\", \"transparent\")\n\t\t\t.attr(\"width\", function(d){\n\t\t\t\tvar w = Math.ceil(this.parentNode.childNodes[1].getBBox().width);\n\t\t\t\treturn w;\n\t\t\t})\n\t\t\t.attr(\"height\", function(d){\n\t\t\t\tvar h = Math.ceil(this.parentNode.childNodes[1].getBBox().height);\n\t\t\t\treturn h;\n\t\t\t})\n\t\t\t.attr(\"x\", function(d){\n\t\t\t\tvar w = Math.ceil(this.parentNode.childNodes[1].getBBox().width);\n\t\t\t\treturn -w / 2;\n\t\t\t})\n\t\t\t.attr(\"y\", function(d){\n\t\t\t\tvar h = Math.ceil(this.parentNode.childNodes[1].getBBox().height);\n\t\t\t\treturn -h;\n\t\t\t})\n\t\t\t.on(\"click\", function(d){\n\t\t\t\tif (d.type == \"linkLabel\" || d.type == \"edgeLinkLabel\"){\n\t\t\t\t\tif(linkClickListener != null)\n\t\t\t\t\t\tlinkClickListener(d.node.original, d3.event);\n\t\t\t\t} else {\n\t\t\t\t\tif(nodeClickListener != null)\n\t\t\t\t\t\tnodeClickListener(d.node.original, d3.event);\n\t\t\t\t}\n\t\t\t\t//console.log(d.type);\n\t\t\t})\n\t\t\t.on(\"mouseover\", function(d){\t\t\t\t\n\t\t\t\tvar frameId = \"\";\n\t\t\t\tshowNodeHelp(worksheetId, d.node.original);\n\n\t\t\t\t//console.log(d.content);\n\t\t\t\tif (d.type == \"nodeLabel\"){\n\t\t\t\t\tframeId = \"#nodeLabelG\" + d.node.id;\n\t\t\t\t} else if (d.type == \"linkLabel\"){\n\t\t\t\t\tframeId = \"#linkLabelG\" + d.node.src + \"-\" + d.node.tgt;\n\t\t\t\t} else if (d.type == \"edgeLinkLabel\"){\n\t\t\t\t\tframeId = \"#edgeLinkLabelG\" + nodesData[d.node.tgt].id;\n\t\t\t\t}\n\t\t\t\tif (d.alt != undefined){\n\t\t\t\t\td3.select(frameId)\n\t\t\t\t\t\t.select(\"text\")\n\t\t\t\t\t\t.text(function(d){\n\t\t\t\t\t\t\treturn d.content;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.attr(\"x\", function(d){\n\t\t\t\t\t\t\td.width = this.getBBox().width\n\t\t\t\t\t\t\treturn -(d.width / 2);\n\t\t\t\t\t\t})\n\t\t\t\t\td3.select(frameId)\n\t\t\t\t\t\t.select(\"path\")\t\n\t\t\t\t\t\t.transition()\n\t\t\t\t\t\t.duration(500)\t\t\t\t\t\n\t\t\t\t\t\t.attr(\"d\", function(d){\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar textWidth = d.width;\n\t\t\t\t\t\t\tvar dx = -textWidth / 2;\n\t\t\t\t\t\t\tvar dy = 0;\n\t\t\t\t\t\t\treturn \"M \" + dx + \" \" + dy + \" L \" + (dx + textWidth) + \" \" + dy + \" Q \" + (dx + textWidth + textHeight / 3) + \" \" + (dy - textHeight / 2) + \" \" + (dx + textWidth) + \" \" + (dy - textHeight) + \" L \" + dx + \" \" + (dy - textHeight) + \" Q \" + (dx - textHeight / 3) + \" \" + (dy - textHeight / 2) + \" \" + dx + \" \" + dy;\n\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\td3.select(frameId)\n\t\t\t\t\t.select(\"path\")\n\t\t\t\t\t.attr(\"stroke-width\", 2);\n\t\t\t\td3.select(frameId)\n\t\t\t\t\t.moveToFront();\n\t\t\t})\n\t\t\t.on(\"mouseout\", function(d, i){\n\t\t\t\thideHelp();\n\n\t\t\t\tvar frameId = \"\";\n\t\t\t\tif (d.type == \"nodeLabel\"){\n\t\t\t\t\tframeId = \"#nodeLabelG\" + d.node.id;\n\t\t\t\t} else if (d.type == \"linkLabel\"){\n\t\t\t\t\tframeId = \"#linkLabelG\" + d.node.src + \"-\" + d.node.tgt;\n\t\t\t\t} else if (d.type == \"edgeLinkLabel\"){\n\t\t\t\t\tframeId = \"#edgeLinkLabelG\" + nodesData[d.node.tgt].id;\n\t\t\t\t}\n\t\t\t\tif (d.alt != undefined){\n\t\t\t\t\td3.select(frameId)\n\t\t\t\t\t\t.select(\"text\")\n\t\t\t\t\t\t.text(function(d){\n\t\t\t\t\t\t\treturn d.alt;\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.attr(\"x\", function(d){\n\t\t\t\t\t\t\td.width = this.getBBox().width\n\t\t\t\t\t\t\treturn -(d.width / 2);\n\t\t\t\t\t\t})\n\t\t\t\t\td3.select(frameId)\n\t\t\t\t\t\t.select(\"path\")\t\n\t\t\t\t\t\t.transition()\n\t\t\t\t\t\t.duration(200)\t\t\t\t\t\n\t\t\t\t\t\t.attr(\"d\", function(d){\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar textWidth = d.width;\n\t\t\t\t\t\t\tvar dx = -textWidth / 2;\n\t\t\t\t\t\t\tvar dy = 0;\n\t\t\t\t\t\t\treturn \"M \" + dx + \" \" + dy + \" L \" + (dx + textWidth) + \" \" + dy + \" Q \" + (dx + textWidth + textHeight / 3) + \" \" + (dy - textHeight / 2) + \" \" + (dx + textWidth) + \" \" + (dy - textHeight) + \" L \" + dx + \" \" + (dy - textHeight) + \" Q \" + (dx - textHeight / 3) + \" \" + (dy - textHeight / 2) + \" \" + dx + \" \" + dy;\n\t\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\td3.select(frameId)\n\t\t\t\t\t.select(\"path\")\n\t\t\t\t\t.attr(\"stroke-width\", 0);\n\t\t\t\td3.select(frameId)\n\t\t\t\t\t.moveToBack();\n\n\t\t\t});\n\n\n\t\t\t\n\t\tlabelLinks = labelLinks.data(textLinksData, function(d){\n\t\t\treturn d.edgeId;\n\t\t});\n\t\tlabelLinks.enter()\n\t\t\t.append(\"line\")\n\t\t\t.classed(\"labelLinks\", true)\n\t\t\t.attr(\"stroke-width\", 0);\n\t\tlabelLinks.exit()\n\t\t\t.transition()\n\t\t\t.duration(transitionDisapearTime)\n\t\t\t.attr(\"opacity\", 0)\n\t\t\t.remove();\n\n\n\t\t\n\t\t\t\n\n\t\tnodesData.forEach(function(d){\t\t\t\t\n\t\t\tif (d.noLayer){\t\t\t\t\t\n\t\t\t\td.position.x = -1;\n\t\t\t\td.position.y = -1;\n\t\t\t} else {\n\t\t\t\td.position.x = d.xpos;\n\t\t\t\td.position.y = height - nodeRadius - d.layer * unitLinkLength;\n\t\t\t}\t\n\t\t})\t\n\n\t\tnodes = nodes.data(nodesData, function(d){\n\t\t\treturn d.nodeId;\n\t\t});\n\n\t\tnodes.enter()\n\t\t\t.append(\"circle\")\n\t\t\t.classed(\"node\", true)\n\t\t\t.attr(\"r\", nodeRadius)\n\t\t\t.attr(\"opacity\", 0.7)\n\t\t\t.attr(\"fill\", \"red\")\n\t\t\t.attr(\"id\", function(d, i){\n\t\t\t\treturn \"node\" + d.id;\n\t\t\t})\n\t\t\t.call(drag)\n\t\t\t.on(\"click\", function(d){\n\t\t\t\tif(anchorClickListener != null && d.original.nodeType == \"ColumnNode\")\n\t\t\t\t\tanchorClickListener(d.original, d3.event);\n\t\t\t\tvar offset = Math.max(xOffset - leftPanelWidth,0);\n\t\t\t\tif (d.outside.isOutside && !d.noLayer){\t\t\t\t\t\n\t\t\t\t\tif (d.position.x < offset){\t\t\n\t\t\t\t\t\tvar destination = Math.max(0, d.position.x - windowWidth / 2);\n\t\t\t\t\t\tvar xPosition = offset;\n\t\t\t\t\t\tvar differ = Math.max(30, (xPosition - destination) / 200);\n\t\t\t\t\t\tvar interval = setInterval(function(){\n\t\t\t\t\t\t\txPosition -= differ;\n\t\t\t\t\t\t\tif (xPosition > destination){\n\t\t\t\t\t\t\t\t$(window).scrollLeft(xPosition);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tclearInterval(interval);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 10);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar destination = Math.min(width - windowWidth, d.position.x - windowWidth / 2);\n\t\t\t\t\t\tvar xPosition = offset;\n\t\t\t\t\t\tvar differ = Math.max(30, (destination - xPosition) / 200);\n\t\t\t\t\t\tvar interval = setInterval(function(){\n\t\t\t\t\t\t\txPosition += differ;\n\t\t\t\t\t\t\tif (xPosition < destination){\n\t\t\t\t\t\t\t\t$(window).scrollLeft(xPosition);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tclearInterval(interval);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 10);\n\t\t\t\t\t}\t\t\t\t\n\t\t\t\t}\n\t\t\t})\n\t\t\t.on(\"dblclick\", function(d) {\n\t \t\t\td3.select(this).classed(\"fixed\", d.fixed = false);\n\t \t\t\td.position.x = d.xpos;\n\t\t\t\td.position.y = height - nodeRadius - d.layer * unitLinkLength;\n\t\t\t})\n\t\t\t.on(\"mouseover\", function(d){\n\t\t\t\tif(anchorMouseListener != null && !d.isTemporary && !d.outside.isOutside)\n\t\t\t\t\tanchorMouseListener(d.original, d3.event);\n\t\t\t\td3.select(this)\n\t\t\t\t\t.transition()\n\t\t\t\t\t.duration(500)\n\t\t\t\t\t.attr(\"opacity\", 1)\n\t\t\t\t\t.attr(\"r\", nodeRadius * 1.5);\n\n\t\t\t\td3.select(\"#nodeLabel\" + d.id)\n\t\t\t\t\t.attr(\"opacity\", 1);\t\t\t\n\t\t\t\td.showLabel = true;\n\t\t\t\tif (d.parent){\n\t\t\t\t\td3.select(\"#nodeLabel\" + d.parent)\n\t\t\t\t\t\t.attr(\"opacity\", 1);\n\t\t\t\t\tnodesData[d.parent].showLabel = true;\n\t\t\t\t}\n\t\t\t\tif (nodesChildren[d.id] == undefined){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tnodesChildren[d.id].forEach(function(e){\n\t\t\t\t\tif (nodesData[e].degree >= 2){\n\t\t\t\t\t\td3.select(\"#nodeLabel\" + e)\n\t\t\t\t\t\t\t.attr(\"opacity\", 1);\n\t\t\t\t\t\tnodesData[e].showLabel = true;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tlabelForce.start();\n\t\t\t})\n\t\t\t.on(\"mouseout\", function(d){\n\t\t\t\td3.select(this)\n\t\t\t\t\t.transition()\n\t\t\t\t\t.duration(500)\n\t\t\t\t\t.attr(\"opacity\", 0.7)\n\t\t\t\t\t.attr(\"r\", nodeRadius)\n\n\t\t\t\tif (d.noLayer){\n\n\t\t\t\t} else if (d.outside.isOutside){\n\t\t\t\t\tif (d.degree < 3){\n\t\t\t\t\t\td3.select(\"#nodeLabel\" + d.id)\n\t\t\t\t\t\t\t.attr(\"opacity\", 0);\n\t\t\t\t\t\td.showLabel = false;\n\t\t\t\t\t}\n\t\t\t\t\tif (d.parent && nodesData[d.parent].degree < 3){\n\t\t\t\t\t\td3.select(\"#nodeLabel\" + d.parent)\n\t\t\t\t\t\t\t.attr(\"opacity\", 0);\n\t\t\t\t\t\td.showLabel = true;\n\t\t\t\t\t}\n\t\t\t\t\tif (nodesChildren[d.id] == undefined){\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tnodesChildren[d.id].forEach(function(e){\n\t\t\t\t\t\tif (nodesData[e].degree < 3){\n\t\t\t\t\t\t\td3.select(\"#nodeLabel\" + e)\n\t\t\t\t\t\t\t\t.attr(\"opacity\", 0);\n\t\t\t\t\t\t\tnodesData[e].showLabel = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else if (d.type == \"anchor\"){\n\t\t\t\t\td3.select(\"#nodeLabel\" + d.id)\n\t\t\t\t\t\t.attr(\"opacity\", 0);\n\t\t\t\t\td.showLabel = false;\n\t\t\t\t}\n\t\t\t});\n\t\tnodes.transition()\n\t\t\t.duration(500)\n\t\t\t.attr(\"r\", nodeRadius);\n\t\tnodes.exit()\n\t\t\t.transition()\n\t\t\t.duration(transitionDisapearTime)\n\t\t\t.attr(\"opacity\", 500)\n\t\t\t.remove();\n\t}", "function drawVisualization() {\n // Create and populate a data table.\n formArrayFromObj(satData);\n\n\n // specify options\n var options = {\n width: '600px',\n height: '600px',\n style: 'dot',\n showPerspective: true,\n showGrid: true,\n showShadow: false,\n keepAspectRatio: true,\n verticalRatio: 0.5,\n tooltip: getName\n };\n\n // Instantiate our graph object.\n var container = document.getElementById('myGraph');\n graph = new vis.Graph3d(container, data, options);\n\n}", "function draw() {\n \n}", "function graficar(conjunto,relacion,rel,conj) \n{\n\t//arreglo de los nodos y las arista o relacion de pares\n\tvar nodes_object = [];\n\tvar edges_object = [];\n\tfor(var i=0;i<conjunto.length;i++)\n\t{\n\t\tnodes_object.push({id: conjunto[i], label:conjunto[i]});\n\t}\n\tfor(var j=0;j<relacion.length;j++)\n\t{\n\t\tedges_object.push({from:relacion[j].izquierda, to: relacion[j].derecha, label:relacion[j].valor});\t\t\n\t}\n \n\t//grafica \n\tvar nodes = new vis.DataSet(nodes_object);\n var edges = new vis.DataSet(edges_object);\n\tcrearPopup(rel,conj);\n var container = ventanaGrafica.document.getElementById(\"visualization\");\n \tvar data = {nodes: nodes,edges: edges};\n var options = {};\n var network = new vis.Network(container, data, options);\n}", "function drawCanvas() {\n //Clear everything\n clearCanvas([ctx_edges, ctx_donuts, ctx_nodes, ctx_hover]); //Draw the lines in between the domain arcs and the ICH element arcs\n\n if (hover_type === 'element') drawLines(ctx_edges, 'element-domain', edges_element_domain_nest);else if (hover_type !== 'country') drawLines(ctx_edges, 'domain', edges_domain_nest);\n if (hover_type === 'element') drawLines(ctx_edges, 'element-country', edges_element_country_nest);else drawLines(ctx_edges, 'country', edges_country_nest); //Draw the domain arcs\n\n ctx_donuts.font = 'normal normal 400 16px ' + font_family;\n ctx_donuts.textBaseline = 'middle';\n ctx_donuts.textAlign = 'center';\n domain_arcs.forEach(function (d) {\n drawDomainDonutChart(ctx_donuts, d);\n }); //Draw the dots outside the domain arcs\n\n if (hover_type !== 'country') drawDomainDots(); //Draw the ICH element arcs\n\n drawElementDonutChart(); //Draw the dots outside the ICH element arcs\n\n drawElementArcDots(); //Draw the ICH elements\n\n ctx_nodes.lineWidth = element_stroke_width;\n elements.forEach(function (d) {\n drawElements(ctx_nodes, d);\n });\n ctx_nodes.lineWidth = 1; //Draw the regional area arcs\n\n drawCountryDonutChart(); //Draw the country diamonds around the outside\n\n ctx_nodes.textBaseline = 'middle';\n ctx_nodes.lineWidth = 2;\n ctx_nodes.font = 'normal normal 400 13.5px ' + font_family;\n countries.forEach(function (d) {\n drawCountries(ctx_nodes, d);\n }); //Draw the title in the center\n\n if (hover_type === 'element') drawInnerSection(ctx_nodes, current_hover);else if (hover_type === 'domain') drawDomainTitle(current_hover.data, ICH_num);else if (hover_type === 'country') drawCountryTitle(current_hover.label, ICH_num);else drawTitle(ICH_num_all);\n } //function drawCanvas", "function loadPumpStationlayer(pumpstationdata){\r\nvar pumpstationjson = JSON.parse(pumpstationdata);\r\nvar jproperties = pumpstationjson.features.map(function (el) { return el.properties; });\r\nvar i;\r\nif (pumpstationarray=[]){\r\nfor (i = 0; i < jproperties.length; i++) { \r\n\tpumpstationarray.push(Object.values(jproperties[i]));\r\n}}\r\nif (pumpstapumpinc =[]){\r\nfor (i = 0; i < pumpstationarray.length; i++) { \r\n\tpumpstapumpinc.push([pumpstationarray[i][1],pumpstationarray[i][2]]);\r\n}}\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\n\r\n\r\n// REMOVING PREVIOUS INFO BOX\r\nif (legend != undefined) {\r\nlegend.remove();\r\n}\r\npumpstationlayer=L.geoJson(pumpstationjson,{pointToLayer: pumpstadisplay,onEachFeature:onEachpumpstaFeature});\r\npumpstationlayer.addTo(mymap);\r\npumpstationlayer.bringToFront();\r\n// change the map zoom so that all the data is shown\r\nmymap.fitBounds(pumpstationlayer.getBounds());\r\nanychart.onDocumentReady(chartpumpsta);\r\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}", "drawFinish(){\n reset();\n drawPolygonLines(this.hull, \"red\", true);\n for(let i=0;i<this.points.length;i++){\n this.points[i].draw();\n }\n\n for(let i=0;i<this.hull.length;i++){\n this.hull[i].draw(5,\"red\");\n }\n }", "addToLayers(){\n try {\n let _to = this.props.toVersion.key;\n //add the sources\n let attribution = \"IUCN and UNEP-WCMC (\" + this.props.toVersion.year + \"), The World Database on Protected Areas (\" + this.props.toVersion.year + \") \" + this.props.toVersion.title + \", Cambridge, UK: UNEP-WCMC. Available at: <a href='http://www.protectedplanet.net'>www.protectedplanet.net</a>\";\n this.addSource({id: window.SRC_TO_POLYGONS, source: {type: \"vector\", attribution: attribution, tiles: [ window.TILES_PREFIX + \"wdpa_\" + _to + \"_polygons\" + window.TILES_SUFFIX]}});\n this.addSource({id: window.SRC_TO_POINTS, source: {type: \"vector\", tiles: [ window.TILES_PREFIX + \"wdpa_\" + _to + \"_points\" + window.TILES_SUFFIX]}});\n //no change protected areas layers\n this.addLayer({id: window.LYR_TO_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: { \"fill-color\": \"rgba(99,148,69,0.2)\", \"fill-outline-color\": \"rgba(99,148,69,0.3)\"}, beforeID: window.LYR_TO_SELECTED_POLYGON});\n this.addLayer({id: window.LYR_TO_POINT, sourceId: window.SRC_TO_POINTS, type: \"circle\", sourceLayer: \"wdpa_\" + _to + \"_points\", layout: {visibility: \"visible\"}, paint: {\"circle-radius\": CIRCLE_RADIUS_STOPS, \"circle-color\": \"rgb(99,148,69)\", \"circle-opacity\": 0.6}, beforeID: window.LYR_TO_SELECTED_POLYGON});\n //selection layers\n this.addLayer({id: window.LYR_TO_SELECTED_POLYGON, sourceId: window.SRC_TO_POLYGONS, type: \"fill\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_SELECTED_POLYGON, filter:INITIAL_FILTER});\n this.addLayer({id: window.LYR_TO_SELECTED_LINE, sourceId: window.SRC_TO_POLYGONS, type: \"line\", sourceLayer: \"wdpa_\" + _to + \"_polygons\", layout: {visibility: \"visible\"}, paint: P_SELECTED_LINE, filter:INITIAL_FILTER});\n this.addLayer({id: window.LYR_TO_SELECTED_POINT, sourceId: window.SRC_TO_POINTS, type: \"circle\", sourceLayer: \"wdpa_\" + _to + \"_points\", layout: {visibility: \"visible\"}, paint: P_SELECTED_POINT, filter:INITIAL_FILTER});\n //add the change layers if needed\n if (this.props.fromVersion.id !== this.props.toVersion.id) this.addToChangeLayers();\n } catch (e) {\n console.log(e);\n }\n }", "function nl() { return KIRI.newLayer(view) }", "function Navigate() {\n source_vector_draw_rdc.clear();\n source_vector_draw_etage.clear();\n drawPinStart();\n\n var porte_start = porteStartLocalisation;\n var porte_end = document.getElementById(\"endNavigation\").value;\n\n var collection_route = Route(porte_start, porte_end);\n collection_route.forEach(triple => { //start, end, layer\n Drawline(triple[0], triple[1], triple[2]);\n });\n}" ]
[ "0.63720614", "0.63054025", "0.60155", "0.60002244", "0.5979157", "0.5962448", "0.5900163", "0.58741266", "0.5856362", "0.5851411", "0.5830335", "0.58133125", "0.578028", "0.577274", "0.5767087", "0.57645446", "0.5762875", "0.57563996", "0.57557887", "0.5753289", "0.57512105", "0.57303154", "0.5722376", "0.5720064", "0.5711957", "0.57026964", "0.56961256", "0.5694711", "0.5693804", "0.5693538", "0.5692891", "0.56792986", "0.5673779", "0.56732774", "0.5673174", "0.56659406", "0.5662467", "0.5661962", "0.56522465", "0.5649449", "0.5647725", "0.56416726", "0.56390524", "0.563858", "0.5628326", "0.56216174", "0.5621562", "0.5620781", "0.5617737", "0.5611337", "0.56099087", "0.5608371", "0.56068015", "0.56036407", "0.56036407", "0.56027055", "0.5601314", "0.5596669", "0.5595341", "0.559319", "0.5589652", "0.5586151", "0.5578835", "0.5563882", "0.5558189", "0.5557136", "0.5555337", "0.5555147", "0.5544804", "0.55445737", "0.5541415", "0.5540862", "0.55350006", "0.5531057", "0.5527678", "0.55205077", "0.55204344", "0.55191755", "0.551675", "0.55077124", "0.55068344", "0.55049056", "0.55038613", "0.5503496", "0.55008566", "0.5499541", "0.54964304", "0.5496247", "0.5495905", "0.5494913", "0.5490114", "0.5482237", "0.5478682", "0.547586", "0.54754716", "0.54726684", "0.54693997", "0.54673153", "0.5466229", "0.5463668", "0.54611814" ]
0.0
-1
the function of map
function mapinos(obj) { var rObj = {}; rObj[obj.uuid] = obj.rssi; return rObj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function map() {\n\n}", "function map(a,f){\r\n let b=[], i;\r\n for (i in a){\r\n b.push(f(a[i]));\r\n }\r\n return b;\r\n}", "map(f) { // Maps a function over this type (just like arrays)\n return f(this._value);\n }", "function myMap(arr, fn) {\n const arrOutput = [];\n for(let i = 0; i < arr.length; i++) {\n arrOutput.push(fn(arr[i]));\n }\n return arrOutput;\n}", "function map(array, fn) {\n let mappedArray = [];\n array.forEach(element => {\n mappedArray.push(fn(element));\n });\n console.log(mappedArray);\n}", "function maps(x){\n return x.map((n) => n * 2);\n}", "map(id, source) {}", "map(f) {\n\treturn f(this.value);\n }", "function map(f, xs){\n var tmp = [];\n for (x in xs) tmp.push(f(xs[x]));\n return tmp;\n}", "function Map() {}", "function map(array, f) { \n var acc = []; \n each(array, function(element, i) { \n acc.push(f(element, i)); \n });\n return acc; \n }", "function map(fn) {\n return function(rf) { // <- buildArray for example\n // Hmm, we don't have the information yet to run the functionality of map, lets return a function to provide an interface for this\n return function(result, item) { // look another reducing function\n return rf(result, fn(item))\n }\n }\n}", "function mapWith(array, callback) {\n\n}", "function map(arr, fn) {\n return arr.map(fn);\n}", "function map(f, xs) {\n var tmp = []\n for (var i = 0; i < xs.length; i++) tmp.push(f(xs[i]))\n return tmp\n}", "function map(f) {\n return fa => map_(fa, f);\n}", "function map(an_array, a_function) {\n return a_function(an_array);\n }", "function map(array, callback) {\n\n}", "function map(f,a) {\n var result = [] // Create a new Array\n for (let i in a){ result[i] = f(a[i]) }\n return result;\n}", "['fantasy-land/map'](f) {\n return this.map(f);\n }", "function Function$prototype$map(f) {\n var functor = this;\n return function(x) { return f (functor (x)); };\n }", "function map(func, array){\n var r = [];\n for (var i=0; i<array.length; i++){\n\t r.push(func(array[i]));\n }\n return r;\n }", "function map(arr, func){\n let mapped = []\n for(let i=0; i < arr.length; i++ ){\n mapped.push(func(arr[i]))\n }\n return mapped;\n}", "function myMap(value,cbf) {\n let sum =[];\n for (let i = 0; i <num.length; i++) {\n sum.push(cbf(value[i]));\n \n }\n\n return sum;\n}", "function my_map ( func, arg_list)\n{\n\t result = [];\n\t for(var i = 0; i < arg_list.length; i++ )\n\t {\n\n\t\t result.push( func( arg_list[i] ) )\n\t }\n\n\t return result;\n}", "function map(list, fn) { // ⭐ Important function! ⭐\n let output = [];\n for (let i = 0, l = list.length; i < l; i += 1) {\n let mapped = fn(list[i]);\n output.push(mapped);\n }\n return output;\n}", "function Function$prototype$map(f) {\n var functor = this;\n return function(x) { return f(functor(x)); };\n }", "function map(arr, func)\n{\n\tvar resultSet = [];\n\tif (arr.length == 0) return resultSet;\n\tfor (var i = 0; i < arr.length; i++)\n\t{\n\t\tresultSet.push(func(arr[i], i, arr));\n\t}\n\treturn resultSet;\n}", "function myMap(array, callbackFnc){\n //WRITE CODE HERE\n // return array.map(callbackFnc); // this solution is off limits :)\n}", "function map(array, f){\n //declare acc as empty []\n var acc = [];\n //loop through array using each\n each(array, function(element, i){\n acc.push(f(element, i));\n });\n return acc;\n}", "function map(array, f){\n //create var for transformed array\n var transformed = [];\n //loop through the element\n each(array, function(element, index){\n //push the value from the parameter function (f) to transformed array\n transformed.push(f(element));\n });\n //return transformed array\n return transformed;\n}", "function map(arr, func) {\n let nwarr = []\n for (let ele of arr) {\n nwarr.push(func(ele))\n }\n return nwarr\n}", "function map(arr, fn){\n var ret = [];\n for (var i = 0; i < arr.length; ++i) {\n ret.push(fn(arr[i], i));\n }\n return ret;\n}", "map(fn) {\n // console.log(iter.next())\n let array = [];\n for (let [key, val] of this) {\n array.push(key);\n }\n return array.map(fn);\n }", "function map(arr, func) {\n var newArr = [];\n for (i = 0; i < arr.length; i++) {\n newArr.push(func(arr[i]));\n }\n return newArr;\n}", "function map(value, func) {\n if (isArray(value)) {\n var result = clone(value);\n\n for (var i = 0; i < result.length; ++i) {\n result[i] = func(result[i], i, result);\n }\n\n return result;\n }\n\n return func(value);\n} //", "function map(array, f) {\n var acc = [];\n each(array, function(element, i) {\n\n acc.push(f(element, i));\n });\n return acc;\n}", "function printArrayByMap(val){\n val.map(function(val){\n })\n return val;\n}", "function map(obj, iterator, context) { // 100\n\t\tvar results = [], i, j; // 101\n // 102\n\t\tif (!obj) return results; // 103\n // 104\n\t\t// Use native .map method if it exists: // 105\n\t\tif (nativeMap && obj.map === nativeMap) return obj.map(iterator, context); // 106\n // 107\n\t\t// Fallback for native .map: // 108\n\t\tfor (i = 0, j = obj.length; i < j; i++ ) { // 109\n\t\t\tresults[i] = iterator.call(context, obj[i], i, obj); // 110\n\t\t} // 111\n\t\treturn results; // 112\n\t} // 113", "function map(value, func) {\n if (isArray(value)) {\n var result = clone(value);\n for (var i = 0; i < result.length; ++i) {\n result[i] = func(result[i], i, result);\n }\n return result;\n }\n return func(value);\n}", "function map(value, func) {\n if (isArray(value)) {\n var result = clone(value);\n for (var i = 0; i < result.length; ++i) {\n result[i] = func(result[i], i, result);\n }\n return result;\n }\n return func(value);\n}", "function myMap(arr, cb) {\n // enter your code here\n}", "function mapCallback(num) {\n return num * num;\n}", "function map$4(f, param) {\n return /* Dual */[_1(f, param[0])];\n }", "function MapIterator() {}", "function map(array, func) {\n var acc = [];\n each(array, function(element) {\n acc.push(func(element));\n });\n return acc;\n}", "function map(arr, func) {\n\t\tvar newArr = []; \n\t\tfor (var i in arr) {\n\t\t\tif (arr.hasOwnProperty(i)) {\n\t\t\t\tnewArr[i] = func(arr[i]);\n\t\t\t}\n\t\t}\n\t\treturn newArr;\n\t}", "function safeMap(array, f) {\n var out = [], i;\n for(i = 0; i < array.length; i++) {\n out.push(f(array[i]));\n }\n return out;\n }", "function useMap(inputArr) {\n inputArr.map((obj) => {\n console.log(obj);\n });\n\n}", "function myMap2(array, callback){\n var tmp = [];\n array.forEach(function(element){\n tmp.push(callback(element));\n });\n return tmp;\n}", "function batmap(arr,mapFunc,otherArrsArray) {\n let narr = []\n otherArrsArray = transpose(otherArrsArray)\n for(var i=0;i<arr.length;i++){\n let value = arr[i]\n let func = mapFunc\n let oargs = otherArrsArray[i]\n let ele = func(value,...oargs)\n narr.push(ele)\n }\n return(narr)\n}", "function myMap(arr, fn) {\n var tasksNo = arr.length;\n var resultArray = [];\n for (var i =0; i < tasksNo; i++){\n // resultArray.push(fn(arr[i]));\n resultArray[i] = fn(arr[i]);\n }\n return resultArray;\n}", "function map(list, func) {\n var result_list = new Array();\n for (var i = 0; i < list.length; i++) {\n result_list.push(func(list[i]));\n }\n return result_list;\n}", "function map(a,b,c,d,e){return(a-b)/(c-b)*(e-d)+d}", "function mapping(f) {\n return function () {\n var rest = toArray(arguments);\n return function (x) {\n return map(function (v) {\n return f.apply(undefined, rest.unshift(v));\n }, unit(x));\n };\n };\n}", "function mapImproved(item, f) {\n\tif(!Array.isArray(item) && Array.isArray(Object.keys(item))){\n\t\t\t var acc = {};\n\t\t\t each(item, function(element, i) {\n\n\t\t\t acc[i]=f(element, i);\n\t\t\t });\n\t\t\t return acc;\n\t}else if(Array.isArray(item)){\n\t\t\t var acc = {};\n\t\t\t each(item, function(element, i) {\n\n\t\t\t acc[i]=f(element, i);\n\t\t\t });\n\t\t\t return acc;\n\t}\n\telse \"is not applicable\"\n}", "function maps(x){\n var doubledArr = x.map(function(x) {\n return x * 2});\n return doubledArr;\n}", "map(mapFn) {\n return map(mapFn, this);\n }", "map(mapFn) {\n return map(mapFn, this);\n }", "function map(f) {\n return self => map_(self, f);\n}", "map(callbackfn, thisArg) {\n return this.points.map(callbackfn, thisArg);\n }", "function maps(arr) {\n const doubled = arr.map(num => num * 2)\n return doubled\n}", "function map(array, f) {\n var result = [];\n array.forEach(function (element) {\n result.push(f(element));\n });\n return result;\n}", "function map (arr, func) {\n var newArr = []\n for (var i = 0; i < arr.length; i++) {\n newArr.push(func(arr[i]));\n };\n console.log(newArr);\n return newArr;\n}", "function mapArray() {\n return myArr.map(function(elem) {\n return elem * 2;\n })\n}", "mapVal(fn) {\n let val = this.values();\n return Array.from({\n length: this.size\n }, () => {\n let values = val.next();\n return fn(values.value);\n }).filter(item => item);\n }", "function map(iter, f) {\n var accum = [];\n forEach(iter, function(val) {accum.push(f(val));});\n return accum;\n}", "function map(array, fnc){\n const myNewArray=[]; \n for (let i=0; i< array.length; i++){\n const newNumber = fnc (array[i]);\n myNewArray.push(newNumber)\n } \n return(myNewArray)\n }", "function map(ary,each,done){var result=new Array(ary.length);var next=after(ary.length,done);var eachWithIndex=function eachWithIndex(i,el,cb){each(el,function(error,msg){result[i] = msg;cb(error,result);});};for(var i=0;i < ary.length;i++) {eachWithIndex(i,ary[i],next);}}", "function map (v) {\n return v + v\n }", "function map(fn, list) {\n\n return list\n ? cons(fn(head(list)), map(fn,tail(list)))\n : emptyList\n ;\n}", "function map(fn, list) {\n\n return list\n ? cons(fn(head(list)), map(fn,tail(list)))\n : emptyList\n ;\n}", "function map(fn, list) {\n\n return list\n ? cons(fn(head(list)), map(fn,tail(list)))\n : emptyList\n ;\n}", "function map(fn, list) {\n\n return list\n ? cons(fn(head(list)), map(fn,tail(list)))\n : emptyList\n ;\n}", "function map(fn, list) {\n\n return list\n ? cons(fn(head(list)), map(fn,tail(list)))\n : emptyList\n ;\n}", "function map(fn, list) {\n\n return list\n ? cons(fn(head(list)), map(fn,tail(list)))\n : emptyList\n ;\n}", "function map(fn, list) {\n\n return list\n ? cons(fn(head(list)), map(fn,tail(list)))\n : emptyList\n ;\n}", "function map(fn, list) {\n\n return list\n ? cons(fn(head(list)), map(fn,tail(list)))\n : emptyList\n ;\n}", "function map(fn, list) {\n\n return list\n ? cons(fn(head(list)), map(fn,tail(list)))\n : emptyList\n ;\n}", "function map(fn, list) {\n\n return list\n ? cons(fn(head(list)), map(fn,tail(list)))\n : emptyList\n ;\n}", "function map(fn, list) {\n\n return list\n ? cons(fn(head(list)), map(fn,tail(list)))\n : emptyList\n ;\n}", "function map(fn, list) {\n\n return list\n ? cons(fn(head(list)), map(fn,tail(list)))\n : emptyList\n ;\n}", "function map(fn, list) {\n\n return list\n ? cons(fn(head(list)), map(fn,tail(list)))\n : emptyList\n ;\n}", "map(fn) {\n return new Compose(this.$value.map(x => x.map(fn)));\n }", "function map(arr, transformFct) {\n console.log(transformFct);\n}", "function myMap(array, aFunction) {\n\tlet newArray = [];\n\tfor (let i=0; i < array.length; i++) {\n\t\tresult = anotherFn(array[i], i, array);\n\t\tnewArray.push(result);\n\t}\n\treturn newArray;\n}", "function myMap(arr, cb){\n var result = [];\n for (var i = 0; i < arr.length; i++) {\n result.push(cb(arr[i], i, arr));\n }\n return result;\n}", "function map(arr, func) {\n const searray = arr.lenght\n\n for (i = 0; i < arr.lenght; i++) {\n secarray[i] = func(arr[i])\n\n }\n return searray\n}", "function map (array, fn) {\n const newArray = []\n for (let item of array) {\n newArray.push(fn(item))\n }\n return newArray\n}", "map(func) {\n // Apply a function to every element of the matrix\n for (let i = 0; i < this.rows; i++) {\n for (let j = 0; j < this.cols; j++) {\n let val = this.data[i][j];\n this.data[i][j] = func(val);\n }\n }\n }", "function mapUpon(func) {\n return function (array) {\n return array.map(bind(func, this));\n };\n }", "function map(list, func) {\n\tvar result = [];\n\tfor (var i = 0; i < list.length; ++i) {\n\t\tresult[i] = func(list[i])\n\t};\n\treturn result;\n}", "function map (f, a) {\n\t var l = a.length\n\t var b = new Array(l)\n\t for (var i = 0; i < l; ++i) {\n\t b[i] = f(a[i])\n\t }\n\t return b\n\t}", "function mapExample(arr) {\n console.log(arr.map(item => {\n item += 1;\n return item\n }))\n}", "function sc_map(proc, l1) {\n if (l1 === undefined)\n\treturn null;\n // else\n var nbApplyArgs = arguments.length - 1;\n var applyArgs = new Array(nbApplyArgs);\n var revres = null;\n while (l1 !== null) {\n\tfor (var i = 0; i < nbApplyArgs; i++) {\n\t applyArgs[i] = arguments[i + 1].car;\n\t arguments[i + 1] = arguments[i + 1].cdr;\n\t}\n\trevres = sc_cons(proc.apply(null, applyArgs), revres);\n }\n return sc_reverseAppendBang(revres, null);\n}", "map(func) {\n for(let row = 0; row < this.rows; row++) {\n for(let col = 0; col < this.cols; col++) {\n const val = this.matrix[row][col];\n this.matrix[row][col] = func(val);\n }\n }\n }", "function map(f, xs) {\n return (is_empty_list(xs))\n ? []\n : pair(f(head(xs)), map(f, tail(xs)));\n}", "map(func) {\n this.data.forEach((rows, i) => rows.forEach((el, j) => this.data[i][j] = func(el, i, j)));\n return this;\n }", "function indexedMap(f, a)\n{\n\treturn indexedMap_(f, a, 0);\n}", "function indexedMap(f, a)\n{\n\treturn indexedMap_(f, a, 0);\n}", "function indexedMap(f, a)\n{\n\treturn indexedMap_(f, a, 0);\n}" ]
[ "0.7475109", "0.7391365", "0.71711797", "0.71386784", "0.7133224", "0.7102631", "0.7068042", "0.70589274", "0.70399463", "0.70327586", "0.7015865", "0.7010355", "0.6944262", "0.6940311", "0.6938932", "0.6916924", "0.6902142", "0.6896268", "0.6895891", "0.6895197", "0.68774104", "0.687487", "0.686225", "0.68515867", "0.6800104", "0.6798393", "0.6767481", "0.67628723", "0.67514706", "0.67495775", "0.6730432", "0.6723152", "0.67204887", "0.6715396", "0.67116314", "0.6695801", "0.6695383", "0.6693263", "0.6688333", "0.6681553", "0.6681553", "0.6678426", "0.66702616", "0.6669417", "0.66669786", "0.66401285", "0.6632727", "0.6619891", "0.66173947", "0.66097236", "0.66076374", "0.6602853", "0.6599347", "0.6593458", "0.65903294", "0.65872884", "0.6587208", "0.6585958", "0.6585958", "0.65773565", "0.6572356", "0.6554806", "0.6552787", "0.6520939", "0.6508936", "0.6500273", "0.6496119", "0.6495893", "0.64846414", "0.64841145", "0.6483065", "0.6483065", "0.6483065", "0.6483065", "0.6483065", "0.6483065", "0.6483065", "0.6483065", "0.6483065", "0.6483065", "0.6483065", "0.6483065", "0.6483065", "0.6478145", "0.6464473", "0.6464282", "0.645691", "0.6455133", "0.64521927", "0.64348215", "0.6430024", "0.6429349", "0.6421256", "0.64129364", "0.64099896", "0.6408171", "0.64059263", "0.6402533", "0.64014053", "0.64014053", "0.64014053" ]
0.0
-1
calculate the standart of some data
function standart_array(rssi_array, mean, sum){ var temp = 0; for(var i= 0;i<rssi_array.length;i++){ temp += Math.pow(rssi_array[i]-mean,2); } return Math.sqrt((1/sum)*temp); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "startData() { return {\n unlocked: true,\n points: new Decimal(0),\n best: new Decimal(0),\n\n }}", "startData() { return {\r\n unlocked: false,\r\n points: new Decimal(0),\r\n best: new Decimal(0),\r\n subspace: new Decimal(0),\r\n auto: false,\r\n first: 0,\r\n }}", "startData() { return {\r\n unlocked: false,\r\n points: new Decimal(0),\r\n best: new Decimal(0),\r\n total: new Decimal(0),\r\n energy: new Decimal(0),\r\n first: 0,\r\n }}", "startData() { return {\r\n unlocked: false,\r\n points: new Decimal(0),\r\n best: new Decimal(0),\r\n chall31bought: 0,\r\n first: 0,\r\n auto: false,\r\n }}", "startData() { return {\r\n unlocked: false,\r\n points: new Decimal(0),\r\n best: new Decimal(0),\r\n total: new Decimal(0),\r\n first: 0,\r\n auto: false,\r\n pseudoUpgs: [],\r\n }}", "startData() { return {\r\n unlocked: false,\r\n points: new Decimal(0),\r\n best: new Decimal(0),\r\n spent: new Decimal(0),\r\n first: 0,\r\n auto: false,\r\n autoBld: false,\r\n pseudoUpgs: [],\r\n }}", "function differentiate (data) {\n for (var i = 1; i < data.length - 1; i++) {\n data[i].yDeriv = ((data[i + 1].y - data[i - 1].y) / (data[i + 1].x - data[i - 1].x)) * 86400000 //multiply by number of milliseconds per day to get daily rate of change\n }\n data[data.length - 1].yDeriv = ((data[data.length - 1].y - data[data.length - 2].y) / (data[data.length - 1].x - data[data.length - 2].x)) * 86400000\n return data\n }", "function runningReduceInitial() {\n\t\t\treturn {\n\t\t\t\ttotal: 0,\n\t\t\t\tcount: 0,\n\t\t\t\t//average: 0,\n\t\t\t\ttype: 'runningTotal'\n\t\t\t};\n\t\t}", "async calculateTemp(){\n let data = await readCsvFile().fromFile(this.csvPath)\n for(let i=1; i<Object.keys(data).length; i++){\n let number = JSON.parse(data[i].field2.replace('*', '')) - JSON.parse(data[i].field3.replace('*', ''))\n number = Math.floor(number*100)/100\n this.globalArray.push(number) \n }\n this.minimumSpread = Math.min(...this.globalArray)\n let positionOfMinimumSpread = this.globalArray.indexOf(this.minimumSpread)\n this.month = data[positionOfMinimumSpread+1]['Monthly average temperature for Sydney 2019']\n this.meanMaximumTemperature = data[positionOfMinimumSpread+1].field2\n this.meanMinimumTemperature = data[positionOfMinimumSpread+1].field3\n return data[positionOfMinimumSpread+1]\n }", "startData() { return {\r\n unlocked: false,\r\n points: new Decimal(0),\r\n best: new Decimal(0),\r\n total: new Decimal(0),\r\n energy: new Decimal(0),\r\n time: new Decimal(0),\r\n auto: false,\r\n first: 0,\r\n pseudoUpgs: [],\r\n }}", "getMean() {\n // console.log(this.temperatures, this.sum, this.entries)\n return this.sum / this.entries;\n }", "function calcStats(data){\n //create empty array to store all data values\n var allValues = [];\n \n //loop through each state\n for(var state of data.features){\n //loop through each year\n for(var year = 2008; year <= 2018; year+=1){\n //get acres burned for current year\n var value = state.properties[String(year) + \" Acres Burned\"];\n //add value to array\n allValues.push(value);\n }\n }\n \n //get min, max, mean stats for our array\n //dataStats.max = Math.min(...allValues)\n //dataStats.max = Math.max(...allValues);\n\n //calculate mean\n var sum = allValues.reduce(function(a, b){return a+b;});\n //dataStats.mean = sum/ allValues.length;\n}", "startData() { return {\r\n unlocked: false,\r\n points: new Decimal(0),\r\n best: new Decimal(0),\r\n energy: new Decimal(0),\r\n first: 0,\r\n auto: false,\r\n pseudoUpgs: [],\r\n autoExt: false,\r\n }}", "function findMean(prevW){\r\n\tvar sum={\"temp\":0.0,\"humidity\":0.0,\"wind\":0.0,\"fog\":0.0,\"snow\":0.0,\"rain\":0.0,\"pressure\":0.0};\r\n\tvar meaners ={\"temp\":0.0,\"humidity\":0.0,\"wind\":0.0,\"fog\":0.0,\"snow\":0.0,\"rain\":0.0,\"pressure\":0.0};;\r\n\tvar daytoDayDiff = [];\r\n\tfor(var i=0; i<prevW.length-1; i++){\r\n\t\tdaytoDayDiff.push( {\"temp\":prevW[i].temp - prevW[i+1].temp,\"humidity\":prevW[i].humidity - prevW[i+1].humidity,\r\n\t\t\t\"wind\":prevW[i].wind - prevW[i+1].wind,\"fog\":prevW[i].fog - prevW[i+1].fog,\r\n\t\t\t\"snow\":prevW[i].snow - prevW[i+1].snow,\"rain\":prevW[i].rain - prevW[i+1].rain,\r\n\t\t\t\"pressure\":prevW[i].pressure - prevW[i+1].pressure\r\n\t\t});\r\n\t\tif(daytoDayDiff[i].temp) sum.temp += daytoDayDiff[i].temp;\r\n\t\tif(daytoDayDiff[i].humidity) sum.humidity += daytoDayDiff[i].humidity;\r\n\t\tif(daytoDayDiff[i].wind) sum.wind += daytoDayDiff[i].wind;\r\n\t\tif(daytoDayDiff[i].fog)\tsum.fog += daytoDayDiff[i].fog;\r\n\t\tif(daytoDayDiff[i].snow) sum.snow += daytoDayDiff[i].snow;\r\n\t\tif(daytoDayDiff[i].rain) sum.rain += daytoDayDiff[i].rain;\r\n\t\tif(daytoDayDiff[i].pressure) sum.pressure += daytoDayDiff[i].pressure;\r\n\t}\r\n\tfor(var key in sum)\r\n\t\tmeaners[key] = sum[key]/daytoDayDiff.length;\r\n\treturn meaners;\r\n}", "function t1(){\n return (1/3)*(dataArray[1][1]-dataArray[0][1])+(dataArray[2][1]-dataArray[1][1])+(dataArray[3][1]-dataArray[2][1]);\n }", "calcMinValue (state) {\n return d3.min(state, d => {\n let data = 0\n Object.entries(d).forEach(\n\t\t\t\t ([key, values]) => {\n\t\t\t \t\tObject.entries(values[0]).forEach(\n\t\t\t\t \t\t([key, value]) => {\n\t\t\t\t \t\t\tdata += value\n\t\t\t\t \t\t}\n\t\t\t\t \t)\n\t\t\t\t }\n )\n return (data)\n })\n }", "#getMinFeelsLikeNight(data) {\n\t\t//daily weather\n\t\tconst dailyData = data.daily;\n\t\t//array of night feels_like and night temperature amplitudes and date\n\t\tconst tempsArr = dailyData.map((item) => {\n\t\t\treturn {\n\t\t\t\tamplitude: item.temp.night - item.feels_like.night,\n\t\t\t\tdate: item.dt,\n\t\t\t};\n\t\t});\n\t\t//get object with min amplitude\n\t\tconst result = tempsArr.reduce(function (prev, curr) {\n\t\t\treturn prev.amplitude < curr.amplitude ? prev : curr;\n\t\t});\n\n\t\treturn result;\n\t}", "startData() { return {\n unlocked: false,\n\t\t points: new Decimal(0),\n }}", "startData() { return {\n unlocked: false,\n\t\t points: new Decimal(0),\n }}", "startData() { return {\n unlocked: false,\n\t\t points: new Decimal(0),\n }}", "startData() { return {\n unlocked: false,\n\t\t points: new Decimal(0),\n }}", "function computeBaseline(data) {\n\t var layerNum = data.length;\n\t var pointNum = data[0].length;\n\t var sums = [];\n\t var y0 = [];\n\t var max = 0;\n\t\n\t for (var i = 0; i < pointNum; ++i) {\n\t var temp = 0;\n\t\n\t for (var j = 0; j < layerNum; ++j) {\n\t temp += data[j][i][1];\n\t }\n\t\n\t if (temp > max) {\n\t max = temp;\n\t }\n\t\n\t sums.push(temp);\n\t }\n\t\n\t for (var k = 0; k < pointNum; ++k) {\n\t y0[k] = (max - sums[k]) / 2;\n\t }\n\t\n\t max = 0;\n\t\n\t for (var l = 0; l < pointNum; ++l) {\n\t var sum = sums[l] + y0[l];\n\t\n\t if (sum > max) {\n\t max = sum;\n\t }\n\t }\n\t\n\t return {\n\t y0: y0,\n\t max: max\n\t };\n\t }", "function determineMaxMinSeriesSum(data) {\n let mi = Infinity;\n let ma = 0;\n console.log('here -<<')\n console.log(data)\n for (let i = 0; i < data.dfrs.length ; i += 1){\n let t = data.dfrs[i].series_sum_each_arc_next - data.dfrs[i].series_sum_each_arc_prev;\n if (mi > t) {\n mi = t;\n } \n if (ma < t) {\n ma = t;\n }\n }\n console.log('here ->>')\n return [mi, 0, ma]\n}", "promedio(){\n let promedio = 0;\n let i =0;\n for(let x of this._data){\n i = i++;\n promedio = promedio + x;\n }\n return promedio/i;\n }", "function calculate(){}", "startData() { return {\n unlocked: true,\n\t\t points: new Decimal(0),\n }}", "computeTotals()\n {\n if (this.file.transactions.length == 0)\n return\n\n this.totalSpendings = this.file.transactions\n .map(x => Math.min(x.amount, 0))\n .reduce((acc, x) => acc + x)\n\n this.totalIncome = this.file.transactions\n .map(x => Math.max(x.amount, 0))\n .reduce((acc, x) => acc + x)\n }", "evaluateForecasts(){\n \tthis.forecast_data = {\n \t\tnumber_or_forecast:0,\n \t\tsuccess_rate:0\n \t};\n\n \tif(this.last_candles.length > 1){\n \t\tlet successes = 0;\n\n \t\tlet last_minute = null;\n\n \t\t//Se evalua hasta la penultima vela para saber si la ultima cumple el pronostico\n \t\tfor (var i = 0; i < (this.last_candles.length - 1); i++) {\n \t\t\tlet date_last_candle = new Date(this.last_candles[i].date);\n\n \t\t\t//las velas deben ser en minutos consecutivos\n \t\t\tif(last_minute == null || last_minute == (date_last_candle.getMinutes() - 1) || (last_minute == 59 && date_last_candle.getMinutes() == 0)){\n \t\t\t\tlast_minute = date_last_candle.getMinutes();\n\n\t \t\t\t//Si existe pronostico\n\t \t\t\tif(this.last_candles[i].forecast_for_next_candle == 1 || this.last_candles[i].forecast_for_next_candle == -1){\n\t \t\t\t\tthis.forecast_data.number_or_forecast++;\n\t \t\t\t\t//El pronostico se cumple\n\t \t\t\t\tif(this.last_candles[i].forecast_for_next_candle == this.last_candles[(i+1)].direction){\n\t \t\t\t\t\tsuccesses++;\n\t \t\t\t\t}\n\t \t\t\t}\n\t \t\t}else{\n\t \t\t\t//si las velas no van en minutos conseutivos los datos\n\t \t\t\t//de pronostico se dejan en 0\n\t \t\t\tthis.forecast_data = {\n\t\t\t \t\tnumber_or_forecast:0,\n\t\t\t \t\tsuccess_rate:0\n\t\t\t \t};\n\t\t\t \treturn false;\n\t \t\t}\n \t\t}\n\n \t\t//Se calcula el porcentaje de acierto\n \t\tthis.forecast_data.success_rate = successes > 0?((successes * 100)/this.forecast_data.number_or_forecast):0;\n \t\tthis.forecast_data.success_rate = parseFloat(parseFloat(this.forecast_data.success_rate).toFixed(2));\n \t}\n }", "function getStaticAverageValueTrendline(points) {\n var total = 0;\n for(var i = 0; i < points.length; i++) {\n total += Number(points[i]);\n }\n var avg = total / points.length;\n var trendline = [];\n for (var i = 0; i < points.length; i++) {\n trendline.push(avg);\n }\n return trendline;\n}", "finalData(hrData) {\r\n const scope = this;\r\n let totalOccupancy, counter;\r\n scope.tempData.occupancy = [];\r\n\r\n scope.tempData.forEach(v => {\r\n totalOccupancy = 0;\r\n counter = 0;\r\n hrData.forEach(d => {\r\n if((new Date(d.Time)).getHours() === v.time){\r\n v.occupancy.push(d.mean);\r\n totalOccupancy = totalOccupancy + d.mean;\r\n counter++;\r\n }\r\n });\r\n\r\n if(counter > 0)\r\n v.average = totalOccupancy / counter;\r\n else\r\n v.average = 0;\r\n });\r\n\r\n return scope.tempData;\r\n }", "function profitLossCalculator(data) {\n const result = [];\n\n for (const stock of data) {\n\n // If sector exists\n if (result.some(e => e.name === stock['sector'])) {\n for (let obj of result) {\n\n if (obj['name'] === stock['sector']) {\n obj['worthNew'] = obj['worthNew'] + stock['current_price'] * stock['n_holding']\n obj['worthOld'] = obj['worthOld'] + stock['buy_price'] * stock['n_holding']\n }\n }\n } else result.push({ \"name\": stock['sector'], \"worthNew\": stock['current_price'] * stock['n_holding'], 'worthOld': stock['buy_price'] * stock['n_holding'] })\n }\n\n for (let i = 0; i < result.length; i++) {\n result[i]['value'] = ((result[i]['worthNew'] - result[i]['worthOld']) / result[i]['worthOld']) * 100\n result[i]['current_total'] = result[i]['value']\n result[i]['ticker'] = result[i]['name']\n }\n const finalResult = result;\n\n console.log(\"Profit/Loss\", finalResult);\n setPortfolioStatistics_profitLoss(finalResult);\n }", "function t4(){\n return (dataArray[numPoints-1][1]-dataArray[0][1])/(numPoints-1);\n }", "function min_max_av(dates, datas){\n var avr = datas.reduce((cur,acc) => {return cur+acc})/datas.length;\n var min = datas[0];\n var max = datas[0];\n var maxIndex = 0;\n var minIndex = 0\n //find the min of the column and its index\n for(var i = 0; i < datas.length; i++){\n if(datas[i] < min){\n min = datas[i]\n minIndex = i;\n }\n }\n //find the max of the column and its index\n for(var i = 0; i < datas.length; i++){\n if(datas[i] > max){\n max = datas[i];\n maxIndex = i;\n }\n }\n return {average: avr, min: [min, dates[minIndex]], max: [max, dates[maxIndex]] }\n }", "getResult() {\n var nominator = 0;\n var denominator = 0;\n\n const criteriaList = [\n this.criteriaCloud,\n this.criteriaWind,\n this.criteriaHumidity,\n this.criteriaVisibility\n ]\n\n criteriaList.forEach((criteria) => {\n nominator += criteria.getScore() * criteria.weight;\n denominator += criteria.weight;\n });\n return Math.floor((nominator/denominator));\n }", "getDifficulty(){\n\n let reversals = this.staircase.getReversals();\n\n console.log(\"(getDifficulty): reversals: \",reversals);\n if(reversals.length == 0){\n return this.staircase.getCurrentVal();\n }\n\n let sum = 0;\n for(let i= 0;i<reversals.length;i++){\n sum+=reversals[i].val;\n }\n let mean = sum/reversals.length;\n\n\n mean = Math.floor(mean);\n\n console.log(\"(getDifficulty): mean: \",mean);\n\n return mean;\n }", "do_calculation( bunch_of_numerical_data)\n {\n var total = 0 ;\n bunch_of_numerical_data.forEach(element => {\n total += element\n });\n return total ;\n }", "function calcCurrent(data, year) {\n // for each country in our dataset:\n data.forEach(function(country) {\n\n // iterate over each of the indicators we want to find the latest\n // value for the year by finding the data point with that year\n indicators.forEach(function(indicator) {\n\n // create a new property called current that\n // will contain the values for the specific year\n // we are operating in.\n country.current = country.current || {};\n country.current[indicator] = null;\n\n // if the country has values for this indicator to begin with...\n if (country[indicator]) {\n country[indicator].forEach(function(datum) {\n if (datum.year === year) {\n country.current[indicator] = datum.value;\n }\n });\n }\n });\n });\n}", "function getStats(data) {\n\n // 5.1. Initialize stats object and counter and all statistics\n var stats = {};\n var n = 0;\n for(series in data[\"004\"].series) {\n stats[series] = {};\n stats[series].mean = 0;\n stats[series].sd = 0;\n stats[series].total = 0;\n stats[series].n = 0;\n stats[series].min = Infinity; // Set min to infinity for \"<\" check later\n stats[series].max = 0;\n stats[series].var = 0;\n stats[series].sd = 0;\n stats[series].meanByYear = {};\n stats[series].varByYear = {};\n }\n\n\n // 5.2. Get total and mean per series\n for(country in data) {\n for(series in data[country].series) {\n\n // Total and n for mean\n data[country].series[series].total = 0;\n data[country].series[series].n = 0;\n\n // Calculate total per series and per country per series\n // Also set minimum and maximum\n for(year in data[country].series[series].values) {\n if(!(isNaN(data[country].series[series].values[year]))) {\n\n // Per series\n stats[series].n+=1;\n stats[series].total += data[country].series[series].values[year];\n\n // Per country per series\n data[country].series[series].n += 1;\n data[country].series[series].total += data[country].series[series].values[year];\n\n // Get minimum and maximum\n if(data[country].series[series].values[year] > stats[series].max) stats[series].max = data[country].series[series].values[year];\n if(data[country].series[series].values[year] < stats[series].min) stats[series].min = data[country].series[series].values[year];\n }\n }\n\n // 5.3. Get mean per country per series\n data[country].series[series].mean = data[country].series[series].total/data[country].series[series].n;\n }\n }\n\n // 5.4. Calculate mean per series\n for(series in data[\"004\"].series) {\n stats[series].mean = stats[series].total / stats[series].n;\n\n // Reset counter\n stats[series].n = 0;\n }\n\n // Get variance and standart deviation per series\n for(country in data) {\n for(series in data[country].series) {\n n = 0;\n for(year in data[country].series[series].values) {\n var deviation = Math.abs(data[country].series[series].values[year] - stats[series].mean)\n if(!(isNaN(deviation))) {\n stats[series].var += deviation;\n // Get total variation\n if(!(data[country].series[series].var)) data[country].series[series].var = 0;\n data[country].series[series].var += deviation;\n n += 1;\n stats[series].n += 1;\n }\n }\n // 5.5. Calculate variance and standart deviation per country per series\n data[country].series[series].var /= n;\n data[country].series[series].sd = Math.sqrt(data[country].series[series].var);\n }\n }\n\n // 5.6. Calculate var and SD per series\n for(series in data[\"004\"].series) {\n stats[series].var /= stats[series].n;\n stats[series].sd = Math.sqrt(stats[series].var);\n }\n\n // Get mean per series per year\n n = {};\n for(country in data) {\n for(series in data[country].series) {\n for(year in data[country].series[series].values) {\n if(!(isNaN(data[country].series[series].values[year]))) {\n\n // Initialize counter variables\n if(!(n[series])) n[series] = {};\n if(!(n[series][year])) n[series][year] = 0;\n\n // Initialize meanByYear\n if(!(stats[series].meanByYear[year])) stats[series].meanByYear[year] = 0;\n n[series][year] += 1\n stats[series].meanByYear[year] += data[country].series[series].values[year];\n }\n }\n }\n }\n\n // 5.7. Get mean per series per year\n for(series in stats) {\n for(year in stats[series].meanByYear) {\n stats[series].meanByYear[year] /= n[series][year];\n }\n }\n\n // Get total deviation per series per year\n n = {};\n for(country in data) {\n for(series in data[country].series) {\n for(year in data[country].series[series].values) {\n if(!(isNaN(data[country].series[series].values[year]))) {\n if(!(n[series])) n[series] = {};\n if(!(n[series][year])) n[series][year] = 0;\n if(!(stats[series].varByYear[year])) stats[series].varByYear[year] = 0;\n n[series][year] += 1\n stats[series].varByYear[year] += Math.abs(data[country].series[series].values[year] - stats[series].meanByYear[year]);\n }\n }\n }\n }\n\n // 5.8. Get variance per series per year\n for(series in stats) {\n for(year in stats[series].varByYear) {\n stats[series].varByYear[year] /= n[series][year];\n }\n }\n\n\n // 5.9. Get z-scores per country per series (z = (x – mean) / var)\n // Get z-scores per series (z = (x – μ) / σ)\n for(country in data) {\n for(series in data[country].series) {\n for(year in data[country].series[series].values) {\n if(!(data[country].series[series].z)) {\n data[country].series[series].z = (data[country].series[series].mean - stats[series].mean)/stats[series].var;\n }\n if(!(data[country].series[series].zscores)) {\n data[country].series[series].zscores = {};\n }\n data[country].series[series].zscores[year] = (data[country].series[series].values[year] - stats[series].meanByYear[year])/stats[series].varByYear[year];\n }\n }\n }\n\n // Get z-scores for mean values\n for(series in stats) {\n var total = 0;\n var n = 0;\n for(year in stats[series].meanByYear) {\n if(!(stats[series].meanByYearZ)) stats[series].meanByYearZ = {};\n stats[series].meanByYearZ[year] = (stats[series].meanByYear[year] - stats[series].mean)/stats[series].var;\n total += stats[series].meanByYearZ[year];\n n += 1;\n }\n stats[series].meanZ = total/n;\n }\n\n // return stats GUIDE: go to main.js line 83\n return stats;\n}", "avg(){\n let t=data[0];\n var avg;\n var sum;\n for(x=0;x<t.length; x++){\n sum=sum+t[x];\n }//for\n avg=sum/t.length;\n return avg;\n }", "averageMin(minutes) {\r\n if (minutes <= 60) {\r\n if (60 % minutes != 0) {\r\n throw \"Average bin must be factor of 60\"\r\n } else if (!this.data) {\r\n throw \"No data, query first\"\r\n } else if (!this.data[0].createdAt) {\r\n throw \"Need to request created at time\"\r\n }\r\n // Trim data to closest multiple of 'minutes'\r\n var trimNumber = (minutes - ((new Date(this.data[0].createdAt)).getUTCMinutes() % minutes));\r\n this.data.splice(0, trimNumber);\r\n } else {\r\n //hourly or daily?\r\n }\r\n // For every set of 'minutes' ,average all the collums of values\r\n var formattedData = [];\r\n var divisor = 0;\r\n // Start at the exact multiple of the minute from the first instance\r\n var startDate = new Date(this.data[0].dataValues.createdAt);\r\n startDate.setUTCSeconds(0, 0);\r\n\r\n for (var line in this.data) {\r\n if (line == 0) {\r\n // And push that first line into the array\r\n formattedData.push(this.data[line]);\r\n } else if (line == this.data.length - 1) {\r\n // Last line average remaing data\r\n average(line);\r\n } else if ((new Date(this.data[line].dataValues.createdAt)).getTime() - startDate < 60000 * minutes) {\r\n // If the diffrence between the start and current is less than average time, sum, and increase divisor\r\n for (key in this.data[line].dataValues) {\r\n formattedData[formattedData.length - 1][key] += this.data[line].dataValues[key];\r\n }\r\n // Increase the divisor\r\n divisor++;\r\n } else {\r\n average(line)\r\n // The start time + time has been passed, push a new line onto the formateed data stack\r\n formattedData.push(this.data[line]);\r\n // Finally increse the start date to the new start date, incrementing it by minutes\r\n startDate.setTime(startDate.getTime() + 60000 * minutes);\r\n }\r\n function average(line) {\r\n // Else divide by divisor, and place new item into array\r\n for (key in formattedData[formattedData.length - 1].dataValues) {\r\n // Can not divide by 0\r\n formattedData[formattedData.length - 1].dataValues[key] /= divisor + 1;\r\n }\r\n // Set the createdAt field to start time\r\n formattedData[formattedData.length - 1].dataValues.createdAt = new Date(startDate);\r\n // Reset divisor\r\n divisor = 0;\r\n }\r\n }\r\n\r\n // var maxDate = new Date(this.data[0].dataValues.createdAt);\r\n // maxDate.setUTCSeconds(0, 0);\r\n // var numSummed = 0;\r\n // for (var line in this.data) {\r\n // if ((new Date(this.data[line].dataValues.createdAt)).getTime() >= maxDate.getTime()) {\r\n // // // Set the maxDate as the timestamp of the old data\r\n // // console.log(formattedData[formattedData.length - 1].createdAt) = maxDate;\r\n // // The max date has been passed, push a new line onto the formateed data stack\r\n // formattedData.push(this.data[line]);\r\n // // Increase the max date by the number of minutes to average\r\n // maxDate.setTime(maxDate.getTime() + 60000 * minutes);\r\n // // Reset the number of values summed (should be in minutes)\r\n // numSummed = 1;\r\n // } else {\r\n // for (key in this.data[line].dataValues) {\r\n // if (key != \"createdAt\") {\r\n // formattedData[formattedData.length - 1][key] += this.data[line].dataValues[key];\r\n // }\r\n // }\r\n // numSummed++;\r\n // }\r\n // }\r\n this.data = formattedData;\r\n return this\r\n }", "calculate() {\n if (this.store.length == 0) return 0;\n let intervals = [];\n let total = 0;\n for (var i = 1; i < this.store.length; i++) {\n let interval = this.store[i] - this.store[i - 1];\n if (isNaN(interval)) debugger;\n intervals.push(interval);\n total += interval;\n }\n\n if (this.store[0] < performance.now() - 5000) {\n // Haven't received any pulses for a while, reset\n this.store = [];\n return 0;\n }\n if (total == 0) return 0;\n return total / (this.store.length - 1);\n }", "calculateAverageDatset() {\n const averageDataset = {};\n if (this.props.rates.length > 0) {\n this.props.rates.forEach((dataPoint) => {\n this.state.filters.forEach((filter) => {\n averageDataset[filter] = averageDataset[filter] ?\n dataPoint[filter] + averageDataset[filter] : dataPoint[filter];\n });\n });\n this.state.filters.forEach((filter) => {\n averageDataset[filter] /= this.props.rates.length;\n });\n this.setState({averageDataset});\n }\n }", "function initialEstimate(){\n\t\t\t\t\n\t\t\t\t// Assign values to variables \"irr\" and \"irrNPV\" as a calculation starting point \n\t\t\t\tvar irr = costOfCapital;\n\t\t\t\tvar irrNPV = netPresentValue(costOfCapital, investmentTerm, initial);\n\n\t\t\t\t\n\t\t\t\t/** If irrNPV (equivalent to npv at this moment) is zero, \n\t\t\t\t* then that's the IRR that we want. \n\t\t\t\t* IRR = the interest rate for NPV being zero\n\t\t\t\t*/\n\t\t\t\tif(irrNPV === 0){\n\t\t\t\t\treturn Math.round(irr * 100) / 100;\n\t\t\t\t}else{\n\t\t\t\t\treturn irrCalc(irr, investmentTerm, irrNPV);\n\t\t\t\t}\n\n\t\t\t}", "function makeData() {\n\tlet v0 = randBetween(0, 5)\n\tv1 = randBetween(10, 30)\n\n\t// let v0 = 100\n\t// let v1 = 100\n\tlet accSnow = 0\n\n\tareaData = calendarDate.map((date, i) => {\n\t\t// v1 = Math.min(v1 + random([-1.7, 2]), 0)\n\t\t// let newSnow = 0\n\t\tif (i === 330) {\n\t\t\taccSnow = 0\n\t\t}\n\t\tif (i > 330) {\n\t\t\tlet newSnow = Math.random() * 10\n\t\t\taccSnow = accSnow + newSnow\n\t\t\tv1 = accSnow + newSnow\n\t\t}\n\t\tif (i === 0) {\n\t\t\tlet newSnow = Math.random() * 100\n\t\t\taccSnow = 140\n\t\t\tv1 = accSnow + newSnow\n\t\t}\n\t\tif (i < 70 && i != 0) {\n\t\t\tlet newSnow = Math.random() * 5\n\t\t\taccSnow = accSnow + newSnow\n\t\t\t// v1 = accSnow + newSnow\n\t\t\tv1 = i * (Math.random() * 20)\n\t\t\t// v1 = v1 + Math.random() * 25\n\t\t}\n\t\tif (i > 70 && i < 100) {\n\t\t\tlet newSnow = Math.random() * 19\n\t\t\taccSnow = accSnow - newSnow\n\t\t\tv1 = accSnow\n\t\t\t// v1 = i * (Math.random() * 20)\n\t\t\t// v1 = v1 + Math.random() * 25\n\t\t}\n\t\tif (i >= 100 && i < 330) {\n\t\t\tv1 = 0\n\t\t}\n\n\t\t// v1 = 500\n\t\t// v0 = 50\n\t\t// v0 = Math.min(Math.max(v0 + random([-1, 1]), 1), v1 - 5)\n\t\t// const obj = {\n\t\t// \tdate,\n\t\t// \tv1,\n\t\t// \tv0\n\t\t// };\n\t\tconst obj = {\n\t\t\t// date : Fri Dec 27 2019 00:00:00 GMT-0800,\n\t\t\tdate,\n\t\t\tv1,\n\t\t\tv0\n\t\t}\n\n\t\treturn obj\n\t})\n\t// console.log(\n\t// \t`areaData*********: `,\n\t// \t// areaData.map(d => console.log(`v1: `, d.v1))\n\t// \tareaData.filter(d => d.v1)\n\t// )\n}", "function computeBaseline(data) {\n var layerNum = data.length;\n var pointNum = data[0].length;\n var sums = [];\n var y0 = [];\n var max = 0;\n\n for (var i = 0; i < pointNum; ++i) {\n var temp = 0;\n\n for (var j = 0; j < layerNum; ++j) {\n temp += data[j][i][1];\n }\n\n if (temp > max) {\n max = temp;\n }\n\n sums.push(temp);\n }\n\n for (var k = 0; k < pointNum; ++k) {\n y0[k] = (max - sums[k]) / 2;\n }\n\n max = 0;\n\n for (var l = 0; l < pointNum; ++l) {\n var sum = sums[l] + y0[l];\n\n if (sum > max) {\n max = sum;\n }\n }\n\n return {\n y0: y0,\n max: max\n };\n}", "function BullishScore( data,period )\n{\n var tot = 0.0;\n for ( var x = period-1 ; x < data.length; x++ )\n {\n tot += data[x]['AboveEMA'] ;\n }\n \n \n return ( 100.0 * tot/( data.length - period ) ) ;\n}", "function calculate(t) {\n\n var len = t.buffer.length,\n averageVolume = 0,\n averageClose = 0,\n averageHigh = 0,\n averageLow = 0,\n maxVolume = 0,\n maxClose = 0,\n maxHigh = 0,\n maxLow = Number.MAX_VALUE;\n\n for (var i = 0; i < len; i++) {\n var current = t.buffer[i];\n var high = parseInt(current.high);\n var low = parseInt(current.low);\n var close = parseInt(current.close);\n var volume = parseInt(current.volume);\n\n if (volume > maxVolume) maxVolume = volume;\n if (close > maxClose) maxClose = close;\n if (high > maxHigh) maxHigh = high;\n if (low < maxLow) maxLow = low;\n\n averageVolume += volume;\n averageClose += close;\n averageHigh += high;\n averageLow += low;\n }\n\n // Calculate averages\n averageVolume = averageVolume / len;\n averageClose = averageClose / len;\n averageHigh = averageHigh / len;\n averageLow = averageLow / len;\n\n return {\n timestamp: t.buffer[len - 1].timestamp,\n symbol: t.stockStream.key,\n firstClose: t.buffer[0].close,\n lastClose: t.buffer[len - 1].close,\n firstDate: t.buffer[0].date,\n lastDate: t.buffer[len - 1].date,\n averageVolume: averageVolume,\n averageClose: averageClose,\n averageHigh: averageHigh,\n averageLow: averageLow,\n maxVolume: maxVolume,\n maxClose: maxClose,\n maxHigh: maxHigh,\n maxLow: maxLow\n };\n }", "function var2(data) {\r\n var sum = 0;\r\n\tmean_ = mean(data);\r\n\tfor (dt = 0; dt < data.length; dt++) {\r\n\t sum += Math.pow(data[dt]-mean_, 2);\r\n\t}\r\n\tvar S2 = sum/(data.length-1);\r\n\treturn S2;\r\n}", "totalDataPoint(data, stat) {\n let values = data.map(elem => {\n return elem[stat];\n });\n\n let total = this.calculateTotals(values);\n return total;\n }", "calculateStatistics() {\n let saleCount = 0;\n let amount = 0;\n let average = 0;\n let max = undefined;\n let min = undefined;\n let upperBound = 0;\n let lowerBound = 0;\n\n //Se calcula max, min y amount\n this.sales.forEach((sale) => {\n saleCount++;\n amount += sale.amount;\n\n if (typeof max === \"undefined\" && typeof min === \"undefined\") {\n max = sale;\n min = sale;\n } else {\n max = max.amount >= sale.amount ? max : sale;\n min = min.amount <= sale.amount ? min : sale;\n }\n });\n\n //Se calcula average y las cotas superior e inferior\n if (saleCount > 0) {\n average = amount / saleCount;\n this.sales.forEach((sale) => {\n if (sale.amount >= average) {\n upperBound++;\n } else {\n lowerBound++;\n }\n });\n\n //Se convierte en fracciones\n upperBound = upperBound / saleCount;\n lowerBound = lowerBound / saleCount;\n }\n\n //Se actualiza los parametros del objeto\n this.amount = amount;\n this.average = average;\n this.maxSale = max;\n this.minSale = min;\n this.upperBound = upperBound;\n this.lowerBound = lowerBound;\n }", "function getSimpleData(day, name, def){\n\t\t\tsimpleData[name] = JSON.parse(simpleDataDefault);\n\t\t\tday.map((ent)=>{\n\t\t\t\tsd = ent.field(name);\n\t\t\t\tif((name == \"Weight\") && (sd != def)){\n\t\t\t\t\tsd = parseFloat(parseFloat(sd).toFixed(2));\n\t\t\t\t}\n\t\t\t\tif(sd != def){\n\t\t\t\t\tsimpleData[name].ct++;\n\t\t\t\t\tsimpleData[name].sum += sd;\n\t\t\t\t\tsimpleData[name].lg = new DATE(ent).time + \" - \" + sd + \"\\n\" + simpleData[name].lg;\n\t\t\t\t}\n\t\t\t});\n\t\tsimpleData[name].mean = (simpleData[name].sum / simpleData[name].ct).toFixed(2);\n}", "startData() { return {\n unlocked: false,\n\t\t points: new Decimal(0),\n unlockOrder: 0\n }}", "startData() { return {\n unlocked: false,\n\t\t points: new Decimal(0),\n unlockOrder: 0\n }}", "startData() { return {\n unlocked: false,\n\t\t points: new Decimal(0),\n unlockOrder: 0\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 getTotalData(){\r\n\t \t\t var totalUnitData = 0;\r\n\t \t\t for (var i=0; i<unitValues.length;i++){\r\n\t \t\t\t totalUnitData += unitValues[i]; \r\n\t \t\t }\r\n\t \t\t return totalUnitData;\r\n\t \t }", "function aggregated(data) {\n if (!data) {\n return;\n }\n\n return data.reduce(function (previousValue, obj) {\n if (!obj.net_total) {\n return previousValue + 0;\n }\n return previousValue + obj.net_total.value;\n }, 0)\n\n }", "function question1 () {\n let priceAvg = []\n for (var i = 0; i < data.length; i++) {\n priceAvg.push(data[i].price)\n }\n let AvgReduced = priceAvg.reduce(function(a,b){return a + b})/data.length\n console.log(AvgReduced)\n}", "startData() { return {\n unlocked: true,\n points: new Decimal(0),\n bugs:new Decimal(0)\n }}", "function calculateNext(data) {\n\n var alpham, betam, alphah, betah, alphaj, betaj, alphaoa,\n betaoa, alphaoi, betaoi, alphaua, betaua, alphaui, betaui, alphaxr, betaxr, alphaxs, betaxs,\n temp, xnaca11, xnaca21;\n\n var exptaum_t, xinfm_t, exptauh_t, xinfh_t, exptauj_t, xinfj_t, \n xk1t_t, exptauoa_t, xinfoa_t, exptauoi_t, xinfoi_t, exptauua_t, xinfua_t, exptauui_t, xinfui_t, xkurcoeff_t, xkrcoeff_t, \n exptaud_t, xinfd_t, exptauf_t, xinff_t, xnakt_t, xnaca1_t, \n xnaca2_t, exptauw_t, xinfw_t;\n\n /* moved to settings as previous value required \n exptauxr_t, xinfxr_t, exptauxs_t, xinfxs_t*/\n\n var xinffca_t , xpcat_t, ecat_t, xupt_t, carow2_t;\n\n var xinfut_t, exptauvt_t, xinfvt_t; \n\n var xstim, eca, xinfm1, exptaum1, xinfh1, exptauh1, xinfj1, exptauj1,\n xinfoa1, exptauoa1, xinfoi1, exptauoi1,\n xinfua1, exptauua1, xinfui1, exptauui1, xkurcoeff1,\n xinfxr1, exptauxr1, xkrcoeff1,\n xinfxs1, exptauxs1,\n xinfd1, exptaud1, xinff1, exptauf1, xinffca1,\n xinfu, exptauv, xinfv, xinfw1, exptauw1,\n xtr, xup, xupleak,\n di_ups, carow21; \n\n //calculations start\n //\n\n alpham = (Math.abs( cS.v + 47.13) < 1e-5) ? 3.2 : 0.32 * ( cS.v + 47.13 )/( 1.- Math.exp(-0.1*( cS.v + 47.13 ) ) );\n\n betam = 0.08 * Math.exp (- cS.v /11.);\n\n alphah = ( cS.v > -40.0 ) ? 0.0 : 0.135 * Math.exp(-( cS.v+80.0)/6.8); \n\n betah = ( cS.v > -40.0 ) ? 1.0/ (0.13 * (1.0 + Math.exp (-( cS.v + 10.66)/11.1))) \n : 3.56 * Math.exp ( 0.079 * cS.v ) + 3.1e5 * Math.exp(0.35 * cS.v); \n\n alphaj = ( cS.v > -40.0 ) ? 0.0 \n : (-127140 * Math.exp(0.2444 * cS.v)-3.474e-5 * Math.exp(-0.04391 * cS.v)) * ( cS.v + 37.78)/(1. + Math.exp (0.311 * ( cS.v + 79.23))); \n\n betaj = ( cS.v > -40.0 ) ? 0.3 * Math.exp(-2.535e-7 * cS.v)/(1.+Math.exp(-0.1 * ( cS.v+32.))) \n : 0.1212 * Math.exp(-0.01052 * cS.v)/(1.+Math.exp(-0.1378 * ( cS.v+40.14))); \n\n alphaoa = 0.65 / ( Math.exp ( - ( cS.v + 10. ) / 8.5 ) + Math.exp ( - ( cS.v-30. ) / 59. ) ); \n\n betaoa = 0.65 / ( 2.5 + Math.exp ( ( cS.v + 82. ) / 17. ) );\n\n alphaoi = 1.0 / ( 18.53 + Math.exp ( ( cS.v + 113.7 ) / 10.95 ) );\n\n betaoi = 1.0 / ( 35.56 + Math.exp ( - ( cS.v + 1.26 ) / 7.44 ) ); \n\n alphaua = 0.65 / ( Math.exp ( - ( cS.v + 10. ) / 8.5 ) + Math.exp ( - ( cS.v-30. ) / 59. ) ); \n\n betaua = 0.65 / ( 2.5 + Math.exp ( ( cS.v + 82. ) / 17. ) ); \n\n alphaui = 1.0 / ( 21. + Math.exp ( - ( cS.v-185. ) / 28. ) ) ; \n\n betaui = Math.exp ( ( cS.v-158. ) / 16. ); \n\n alphaxr = 0.0003* ( cS.v + 14.1 ) / ( 1.- Math.exp ( - ( cS.v + 14.1 ) / 5. ) ); \n\n betaxr = 7.3898e-5* ( cS.v-3.3328 ) / ( Math.exp ( ( cS.v-3.3328 ) / 5.1237 ) -1. ); \n\n alphaxs = 4e-5* ( cS.v-19.9 ) / ( 1.- Math.exp ( - ( cS.v-19.9 ) / 17. ) ); \n\n betaxs = 3.5e-5* ( cS.v-19.9 ) / ( Math.exp ( ( cS.v-19.9 ) / 9. ) -1. );\n\n //table variables depending on V\n\n exptaum_t = Math.exp(- cS.timestep*(alpham+betam));\n\n xinfm_t = alpham/(alpham+betam);\n\n exptauh_t = Math.exp(- cS.timestep*(alphah+betah));\n\n xinfh_t = alphah/(alphah+betah);\n\n exptauj_t = Math.exp(- cS.timestep*(alphaj+betaj));\n\n xinfj_t = alphaj/(alphaj+betaj);\n\n xk1t_t = cS.gk1*( cS.v- cC.ek)/(1.+Math.exp(0.07*( cS.v + 80.)));\n\n exptauoa_t = Math.exp(- cS.timestep*((alphaoa+betaoa)* cS.xkq10));\n\n xinfoa_t = 1.0/(1.+Math.exp(-( cS.v+20.47)/17.54));\n\n exptauoi_t = Math.exp(- cS.timestep*((alphaoi+betaoi)* cS.xkq10));\n\n xinfoi_t = 1.0/(1.+Math.exp(( cS.v+43.1)/5.3));\n\n exptauua_t = Math.exp(- cS.timestep*((alphaua+betaua)* cS.xkq10));\n\n xinfua_t = 1.0/(1.+Math.exp(-( cS.v+30.3)/9.6));\n\n exptauui_t = Math.exp(- cS.timestep*((alphaui+betaui)* cS.xkq10));\n\n xinfui_t = 1.0/(1.+Math.exp(( cS.v-99.45)/27.48));\n\n xkurcoeff_t = (0.005+0.05/(1.+Math.exp(-( cS.v-15.)/13.)))*( cS.v- cC.ek);\n\n\n if(!((Math.abs( cS.v+14.1) < 1e-5) || (Math.abs( cS.v-3.3328)<1e-5))){\n cS.exptauxr_t = Math.exp(- cS.timestep*(alphaxr+betaxr));\n cS.xinfxr_t = 1.0/(1.+Math.exp(-( cS.v+14.1)/6.5));\n }\n\n xkrcoeff_t = cS.gkr*( cS.v- cC.ek)/(1.+Math.exp(( cS.v+15.)/22.4));\n\n if(!(Math.abs( cS.v-19.9) < 1e-5)){\n cS.exptauxs_t = Math.exp(- cS.timestep/0.5*(alphaxs+betaxs));\n cS.xinfxs_t = 1.0/Math.sqrt(1.+Math.exp(-( cS.v-19.9)/12.7));\n }\n\n //temp varaible used for calculations\n temp = (1.0-Math.exp(-( cS.v+10.)/6.24))/(0.035*( cS.v+10.)* (1.+Math.exp(-( cS.v+10.)/6.24)));\n\n if(Math.abs( cS.v+10) < 1e-5){\n exptaud_t = 2.2894;\n exptauf_t = 0.9997795;\n }\n else{\n exptaud_t = Math.exp(- cS.timestep/temp); \n exptauf_t = Math.exp(- cS.timestep/9.*(0.0197*Math.exp(Math.pow(-(0.0337 *( cS.v+10.)), 2))+0.02));\n }\n\n xinfd_t = 1.0/(1.+Math.exp(-( cS.v+10.)/8.));\n\n xinff_t = 1.0/(1.+Math.exp(( cS.v+28.)/6.9));\n\n xnakt_t = (1.0/(1.+0.1245*Math.exp(-0.1* cS.v/ cC.rtof)+0.0365* cC.sigma*Math.exp(- cS.v/ cC.rtof)))* cS.xinakmax/(1.+(Math.pow(( cS.xkmnai/ cS.cnai),1.5)))*( cS.cko/( cS.cko+ cS.xkmko));\n\n xnaca1_t = cS.xinacamax*Math.exp( cS.gamma* cS.v/ cC.rtof)*(Math.pow( cS.cnai,3))* cS.ccao/((Math.pow( cS.xkmna,3)+ Math.pow( cS.cnao,3))*( cS.xkmca+ cS.ccao)*(1.+ cS.xksat*Math.exp(( cS.gamma-1.)* cS.v/ cC.rtof)));\n\n xnaca2_t = cS.xinacamax*Math.exp(( cS.gamma-1.)* cS.v/ cC.rtof)/((Math.pow( cS.xkmna,3) + Math.pow( cS.cnao,3))*( cS.xkmca+ cS.ccao)*(1.+ cS.xksat*Math.exp(( cS.gamma-1.)* cS.v/ cC.rtof))); \n\n temp = 6.0*(1.-Math.exp(-( cS.v-7.9)/5.))/((1.+0.3*Math.exp(-( cS.v-7.9)/5.))*( cS.v-7.9)); \n\n exptauw_t = Math.exp(- cS.timestep/temp);\n\n xinfw_t = 1.0-1.0/(1.+Math.exp(-( cS.v-40.)/17.));\n\n //table variables depending on ca\n\n xinffca_t = 1.0/(1.+ cS.ccai/0.00035);\n xpcat_t = cS.xipcamax* cS.ccai/(0.0005+ cS.ccai);\n ecat_t = cC.rtof*0.5*Math.log( cS.ccao/ cS.ccai);\n xupt_t = cS.xupmax/(1.+ cS.xkup/ cS.ccai);\n carow2_t = ( cS.trpnmax* cS.xkmtrpn/( cS.ccai+ cS.xkmtrpn)/( cS.ccai+ cS.xkmtrpn) + cS.cmdnmax* cS.xkmcmdn/( cS.ccai+ cS.xkmcmdn)/( cS.ccai+ cS.xkmcmdn)+1.)/ cC.c_b1c;\n\n //table variables depending on fn\n /* fnlo=-0.2,fnhi=2.3,nfnt=2500\n dfntable=(fnhi-fnlo)/float(nfnt)\n fn=fnlo+i*dfntable\n */\n xinfut_t = 1.0/(1.+ Math.exp(-( cS.fn/13.67e-4-250.0)));\n\n temp = 1.91+2.09/(1.+ Math.exp(-( cS.fn/13.67e-4-250.0)));\n\n exptauvt_t = Math.exp(- cS.timestep/temp);\n\n xinfvt_t = 1.-1.0/(1.+ Math.exp(-( cS.fn-6.835e-14)/13.67e-16));\n\n\n // table loop starts here\n\n xstim = _s1s2Stimulus(count, data);\n\n //c equilibrium potentials\n eca = ecat_t;\n\n //c fast sodium current\n xinfm1 = xinfm_t;\n exptaum1 = exptaum_t;\n xinfh1 = xinfh_t;\n exptauh1 = exptauh_t;\n xinfj1 = xinfj_t;\n exptauj1 = exptauj_t;\n\n cS.xm = xinfm1 + ( cS.xm - xinfm1) * exptaum1;\n cS.xh = xinfh1 + ( cS.xh - xinfh1) * exptauh1;\n cS.xj = xinfj1 + ( cS.xj - xinfj1) * exptauj1; \n cS.xna = cS.xm * cS.xm * cS.xm * cS.xh * cS.xj * cS.gna *( cS.v - cC.ena);\n\n //c time-independent k+ current\n cS.xk1 = xk1t_t;\n\n //c transient outward k+ current\n xinfoa1 = xinfoa_t;\n exptauoa1 = exptauoa_t;\n xinfoi1 = xinfoi_t;\n exptauoi1 = exptauoi_t;\n\n cS.xoa = xinfoa1+( cS.xoa-xinfoa1)*exptauoa1;\n cS.xoi = xinfoi1+( cS.xoi-xinfoi1)*exptauoi1;\n cS.xto = cS.xoa* cS.xoa* cS.xoa* cS.xoi* cS.gto*( cS.v - cC.ek);\n\n //c ultrarapid delayed rectifier k+ current\n xinfua1 = xinfua_t;\n exptauua1 = exptauua_t;\n xinfui1 = xinfui_t;\n exptauui1 = exptauui_t;\n xkurcoeff1= xkurcoeff_t;\n\n cS.xua = xinfua1+( cS.xua-xinfua1)*exptauua1;\n cS.xui = xinfui1+( cS.xui-xinfui1)*exptauui1;\n cS.xkur = cS.xua* cS.xua* cS.xua* cS.xui*xkurcoeff1;\n\n //c rapid delayed outward rectifier k+ current\n xinfxr1 = cS.xinfxr_t;\n exptauxr1 = cS.exptauxr_t;\n xkrcoeff1 = xkrcoeff_t;\n\n cS.xr = xinfxr1+( cS.xr-xinfxr1)*exptauxr1;\n cS.xkr = cS.xr*xkrcoeff1;\n\n //c slow delayed outward rectifier k+ current\n xinfxs1 = cS.xinfxs_t;\n exptauxs1 = cS.exptauxs_t;\n\n cS.xs = xinfxs1+( cS.xs-xinfxs1)*exptauxs1;\n cS.xks = cS.xs* cS.xs* cS.gks*( cS.v- cC.ek);\n\n //c L-tpe ca2+ current\n xinfd1 = xinfd_t;\n exptaud1 = exptaud_t;\n xinff1 = xinff_t;\n exptauf1 = exptauf_t;\n xinffca1 = xinffca_t;\n\n cS.xd = xinfd1+( cS.xd-xinfd1)*exptaud1;\n cS.xf = xinff1+( cS.xf-xinff1)*exptauf1;\n cS.xfca = xinffca1+( cS.xfca-xinffca1)* cC.exptaufca;\n cS.xcal = cS.xd* cS.xf* cS.xfca* cS.gcal*( cS.v-65.0);\n\n //xnak, xnaca, xbca, xbna, xpca; \n\n //cc na+/k+ pump current\n cS.xnak = xnakt_t;\n\n //c na+/ca2+ exchanger current\n xnaca11 = xnaca1_t;\n xnaca21 = xnaca2_t;\n cS.xnaca = xnaca11 - xnaca21* cC.cnao3* cS.ccai;\n\n //cc background currents\n cS.xbca = cS.gbca * ( cS.v - eca);\n\n cS.xbna = cS.gbna * ( cS.v - cC.ena);\n\n //c ca2+ pump current\n cS.xpca = xpcat_t;\n\n /*c ca2+ release current from JSR\n c correction: divide first fn term by cm, multiply second fn term by cm\n c then to ensure computational accuracy (no problems with tiny numbers),\n c divide fn by 1e-12 and adjust functions accordingly*/\n cS.xrel = cS.xkrel* cS.xu* cS.xu* cS.xv* cS.xw*( cS.ccarel- cS.ccai);\n\n cS.fn = cS.vrel/ cS.cm* cS.xrel-0.5 * cS.cm/ cS.xxf*(0.5* cS.xcal-0.2* cS.xnaca);\n\n xinfu = xinfut_t;\n exptauv = exptauvt_t;\n xinfv = xinfvt_t;\n\n cS.xu = xinfu+( cS.xu-xinfu)* cC.exptauu;\n cS.xv = xinfv+( cS.xv-xinfv)*exptauv;\n\n xinfw1 = xinfw_t;\n exptauw1 = exptauw_t;\n\n cS.xw = xinfw1+( cS.xw-xinfw1)*exptauw1;\n cS.xrel = cS.xkrel* cS.xu* cS.xu* cS.xv* cS.xw*( cS.ccarel - cS.ccai);\n\n // c transfer current from NSR to JSR\n xtr = ( cS.ccaup - cS.ccarel)/ cS.tautr;\n\n // c ca2+ uptake current by the NSR\n xup = xupt_t;\n\n // c ca2+ leak current by the NSR\n xupleak = cS.ccaup* cS.xupmax/ cS.ccaupmax;\n\n //c intracellular ion concentrations\n di_ups = xup-xupleak;\n carow21 = carow2_t;\n cS.ccai = cS.ccai + cS.timestep * ( cC.c_b1d*( cS.xnaca + cS.xnaca - cS.xpca - cS.xcal - cS.xbca)- cC.c_b1e* di_ups + cS.xrel) / carow21; \n cS.ccaup = cS.ccaup + cS.timestep * (xup - xupleak-xtr*( cS.vrel/ cS.vup));\n cS.ccarel = cS.ccarel + cS.timestep * ((xtr - cS.xrel)/ (1.+( cS.csqnmax* cS.xkmcsqn)/(Math.pow(( cS.ccarel+ cS.xkmcsqn),2))));\n\n //console.log( cS.xna , cS.xk1 , + cS.xkur + cS.xto , cS.xkur , cS.xkr , cS.xks , cS.xcal , cS.xpca , cS.xnak, cS.xnaca, cS.xbna, cS.xbca-xstim);\n \n cS.v = cS.v - cS.timestep * ( cS.xna + cS.xk1 + cS.xto + cS.xkur + cS.xkr + cS.xks + cS.xcal + cS.xpca + cS.xnak + cS.xnaca + cS.xbna + cS.xbca - xstim);\n\n // table loop ends\n\n //cal ends\n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n\n // iterate the count\n count++;\n\n return data; \n }", "function getAverage (data) {\n return data.reduce((acc, curr) => (acc += curr), 0) / data.length\n}", "function getStaticMinValueTrendline(points) {\n var min = Math.min(...points);\n var trendline = [];\n for (var i = 0; i < points.length; i++) {\n trendline.push(min);\n }\n return trendline;\n}", "function simple_average(data) {\n\tlet sum = 0\n\tfor(var i = 0; i < data.length; i++) {\n\t\tsum += data[i]\n\t}\n\treturn sum / data.length\n}", "mean() {\n return Utils.mean(this.series)\n }", "function topFillingCalculations(){\r\n\t//1. Assign 0 if input left blank\r\n\tvar assign_zero = [$topSkirtLength, $topSpoutDaimeter, $topSpoutLength];\r\n\t$.each(assign_zero, (index, $item) => {\r\n\t\tassignDefaultIfNull($item, 0);\r\n\t});\r\n\t\r\n\t//2. Unit MF\r\n\tmultiplyAccordingToUnit[$topSkirtLength, $topSpoutDaimeter, $topSpoutLength];\r\n}", "function calculate() {\n\tgetTempBonuses();\n\tgetNumberBoonsValues();\n\tgetRelicBonuses();\n\tgetFatebondBonuses();\n\tgetCoreTraitsValues();\n\tgetAttributesValues();\n\tgetSkillsValues();\n\tgetVirtuesValues();\n\tgetBoonsDiceValues();\n\tgetPresetRolls();\n\tgetAttackBonuses();\n}", "var(arr) {\r\n let av = this.avg(arr);\r\n let sum = 0;\r\n for (let i = 0; i < arr.length; i++) {\r\n sum += parseFloat(arr[i]) * parseFloat(arr[i]);\r\n }\r\n return sum / arr.length - av * av;\r\n }", "function calculateNext(data){\n \n var AM, BM, TAU_M, AH, BH, TAU_H, AJ, BJ, TAU_J, axr1, bxr1, TAU_Xr1,\n axr2, bxr2, TAU_Xr2, Axs, Bxs, TAU_Xs, TAU_R, TAU_S, Ad, Bd, Cd, TAU_D, \n Af, Bf, Cf, TAU_F, Af2, Bf2, Cf2, TAU_F2, temp, temp2, Ak1, Bk1,\n Ek, Ena, Eks, Eca, FCaSS_INF, exptaufcass, kCaSR, k1, k2, dRR,\n CaCSQN, dCaSR, bjsr, cjsr, CaSSBuf, dCaSS, bcss, ccss, CaBuf, dCai, bc, cc,\n dNai, dKi, sOO; \n\n var minft_t, exptaumt_t, hinft_t, exptauht_t, jinft_t, exptaujt_t, xr1inft_t,\n exptauxr1t_t, xr2inft_t, exptauxr2t_t, xsinft_t, exptauxst_t, rinft_t , sinft_t,\n exptaurt_t, exptaust_t, dinft_t, exptaudt_t, finft_t, exptauft_t, f2inft_t, \n exptauf2t_t, inakcoefft_t, ipkcoefft_t, ical1t_t, ical2t_t, inaca1t_t, inaca2t_t,\n ik1coefft_t, fcassinft_t, exptaufcasst_t; \n\n\n sOO = ( cS[iType] === 'epi') ? 8.958e-8 : ( cS[iType] === 'endo' ) ? 8.848e-8 : 1.142e-7; // (cS.itype === 'M')\n \n\n //table setup starts\n AM = 1.0/(1.+ Math.exp((-60.-cS.v)/5.));\n BM = 0.1/(1.+ Math.exp((cS.v+35.)/5.))+0.10/(1.+Math.exp((cS.v-50.)/200.));\n minft_t = 1.0/((1.+Math.exp((-56.86-cS.v)/9.03))*(1.+Math.exp((-56.86-cS.v)/9.03)));\n TAU_M = AM*BM;\n exptaumt_t = Math.exp(-cS.timestep/TAU_M);\n\n hinft_t = 1.0/((1.+Math.exp((cS.v+71.55)/7.43))*(1.+Math.exp((cS.v+71.55)/7.43)));\n \n AH = (cS.v > -40) ? 0. : (0.057*Math.exp(-(cS.v+80.)/6.8));\n BH = (cS.v > -40) ? (0.77/(0.13*(1.+Math.exp(-(cS.v+10.66)/11.1)))) \n : (2.7*Math.exp(0.079*cS.v)+(3.1e5)*Math.exp(0.3485*cS.v));\n TAU_H = 1.0/(AH+BH);\n exptauht_t = Math.exp(-cS.timestep/TAU_H);\n\n AJ = (cS.v > -40) ? 0. : (((-2.5428e4)*Math.exp(0.2444*cS.v)-(6.948e-6)*Math.exp(-0.04391*cS.v))*(cS.v+37.78)/(1.+Math.exp(0.311*(cS.v+79.23))));\n BJ = (cS.v > -40) ? (0.6*Math.exp((0.057)*cS.v)/(1.+Math.exp(-0.1*(cS.v+32.))))\n : (0.02424*Math.exp(-0.01052*cS.v)/(1.+Math.exp(-0.1378*(cS.v+40.14))));\n TAU_J = 1.0/(AJ+BJ);\n exptaujt_t = Math.exp(-cS.timestep/TAU_J);\n\n jinft_t = hinft_t;\n\n xr1inft_t = 1.0/(1.+Math.exp((-26.-cS.v)/7.));\n\n axr1 = 450.0/(1.+Math.exp((-45.-cS.v)/10.));\n bxr1 = 6.0/(1.+Math.exp((cS.v-(-30.))/11.5));\n TAU_Xr1 = axr1*bxr1;\n exptauxr1t_t = Math.exp(-cS.timestep/TAU_Xr1);\n\n\n xr2inft_t = 1.0/(1.+Math.exp((cS.v-(-88.))/24.));\n \n axr2 = 3.0/(1.+Math.exp((-60.-cS.v)/20.));\n bxr2 = 1.12/(1.+Math.exp((cS.v-60.)/20.));\n TAU_Xr2 = axr2*bxr2;\n exptauxr2t_t = Math.exp(-cS.timestep/TAU_Xr2);\n\n xsinft_t = 1.0/(1.+ Math.exp((-5.-cS.v)/14.));\n\n Axs = (1400.0/(Math.sqrt(1.+Math.exp((5.-cS.v)/6.))));\n Bxs = (1.0/(1.+ Math.exp((cS.v-35.)/15.)));\n TAU_Xs = Axs*Bxs+80.;\n exptauxst_t = Math.exp(-cS.timestep/TAU_Xs);\n\n rinft_t = ( cS.itype === 'epi') ? 1.0/(1.+ Math.exp((20.- cS.v)/6.)) \n : ( cS.itype === 'endo' ) ? 1.0/(1.+Math.exp((20.-cS.v)/6.))\n : 1.0/(1.+ Math.exp((20.-cS.v)/6.)) ; // (cS.itype === 'M')\n\n sinft_t = ( cS.itype === 'epi') ? 1.0/(1.+Math.exp((cS.v+20.)/5.))\n : ( cS.itype === 'endo' ) ? 1.0/(1.+ Math.exp((cS.v+28.)/5.))\n : 1.0/(1.+ Math.exp((cS.v+20.)/5.)); // (cS.itype === 'M')\n\n TAU_R = ( cS.itype === 'epi') ? 9.5* Math.exp(-(cS.v+40.)*(cS.v+40.)/1800.)+0.8\n : ( cS.itype === 'endo' ) ? 9.5* Math.exp(-(cS.v+40.)*(cS.v+40.)/1800.)+0.8\n : 9.5* Math.exp(-(cS.v+40.)*(cS.v+40.)/1800.)+0.8; // (cS.itype === 'M')\n\n TAU_S = ( cS.itype === 'epi') ? 85.* Math.exp(-(cS.v+45.)*(cS.v+45.)/320.) +5.0/(1.+Math.exp((cS.v-20.)/5.))+3. \n : ( cS.itype === 'endo' ) ? 1000.*Math.exp(-(cS.v+67.)*(cS.v+67.)/1000.)+8.\n : 85.*Math.exp(-(cS.v+45.)*(cS.v+45.)/320.)+5.0/(1.+Math.exp((cS.v-20.)/5.))+3.; // (cS.itype === 'M')\n \n exptaurt_t = Math.exp(-cS.timestep/TAU_R);\n exptaust_t = Math.exp(-cS.timestep/TAU_S);\n \n dinft_t = 1.0/(1.+Math.exp((-8.-cS.v)/7.5));\n \n Ad = 1.4/(1.+Math.exp((-35.-cS.v)/13.))+0.25;\n Bd = 1.4/(1.+Math.exp((cS.v+5.)/5.));\n Cd = 1.0/(1.+Math.exp((50.-cS.v)/20.));\n TAU_D = Ad*Bd+Cd;\n exptaudt_t = Math.exp(-cS.timestep/TAU_D);\n\n finft_t = 1.0/(1.+Math.exp((cS.v+20.)/7.));\n\n Af = 1102.5*Math.exp(-(cS.v+27.)*(cS.v+27.)/225.);\n Bf = 200.0/(1.+Math.exp((13.-cS.v)/10.));\n Cf = (180.0/(1.+Math.exp((cS.v+30.)/10.)))+20.;\n TAU_F = Af+Bf+Cf;\n exptauft_t = Math.exp(-cS.timestep/TAU_F);\n\n f2inft_t = 0.67/(1.+Math.exp((cS.v+35.)/7.))+0.33;\n\n //original code had the following, but paper uses denom of 170**2, not 7**2\n\n Af2 = 600.*Math.exp(-(cS.v+25.)*(cS.v+25.)/49.);\n\n // paper value for Af2 is INCORRECT to match the figure\n //Af2=600.*exp(-(vv+25.)*(vv+25.)/(170.*170.))\n \n Bf2 = 31.0/(1.+Math.exp((25.-cS.v)/10.));\n Cf2 = 16.0/(1.+Math.exp((cS.v+30.)/10.));\n TAU_F2 = Af2+Bf2+Cf2\n exptauf2t_t = Math.exp(-cS.timestep/TAU_F2);\n\n inakcoefft_t = (1.0/(1.+0.1245*Math.exp(-0.1*cS.v*cC.fort)+0.0353*Math.exp(-cS.v*cC.fort)))*cS.knak*(cS.Ko/(cS.Ko+cS.KmK)); \n ipkcoefft_t = cS.GpK/(1.+Math.exp((25.-cS.v)/5.98)); \n temp = Math.exp(2*(cS.v-15)*cC.fort);\n\n if(!(Math.abs(cS.v-15.) < 1e-4)){\n // need implemented\n ical1t_t = cS.GCaL*4.*(cS.v-15.)*(cS.FF*cC.fort)* (0.25*temp)/(temp-1.);\n ical2t_t = cS.GCaL*4.*(cS.v-15.)*(cS.FF*cC.fort)*cS.Cao/(temp-1.);\n }\n \n temp = Math.exp((cS.n-1.)*cS.v*cC.fort);\n temp2 = cS.knaca/((cC.KmNai3+cC.Nao3)*(cS.KmCa+cS.Cao)*(1.+cS.ksat*temp));\n inaca1t_t = temp2*Math.exp(cS.n*cS.v*cC.fort)*cS.Cao;\n inaca2t_t = temp2*temp*cC.Nao3*cS.alphanaca; \n\n\n //reversal potentials\n Ek = cC.rtof*(Math.log((cS.Ko/cS.ki)));\n Ena = cC.rtof*(Math.log((cS.Nao/cS.nai)));\n Eks = cC.rtof*(Math.log((cS.Ko+cS.pKNa*cS.Nao)/(cS.ki+cS.pKNa*cS.nai)));\n Eca = 0.5*cC.rtof*(Math.log((cS.Cao/cS.cai)));\n \n // need to figure out vmek is (cS.v - Ek) \n Ak1 = 0.1/(1.+Math.exp(0.06*((cS.v - Ek)-200.)));\n Bk1 = (3.*Math.exp(0.0002*((cS.v - Ek)+100.))+Math.exp(0.1*((cS.v - Ek)-10.)))/(1.+Math.exp(-0.5*((cS.v - Ek)))); \n ik1coefft_t = cS.GK1*Ak1/(Ak1+Bk1); \n \n fcassinft_t = 0.6/(1+(cS.cass/0.05)*(cS.cass/0.05))+0.4;\n temp = 80.0/(1+(cS.cass/0.05)*(cS.cass/0.05))+2.;\n exptaufcasst_t = Math.exp(-cS.timestep/temp); \n\n //stimulus\n\n cS.Istim = _s1s2Stimulus(count, settings);\n \n //Compute currents\n\n cS.sm = minft_t - (minft_t-cS.sm)*exptaumt_t;\n cS.sh = hinft_t - (hinft_t-cS.sh)*exptauht_t;\n cS.sj = jinft_t - (jinft_t-cS.sj)*exptaujt_t;\n cS.ina = cS.GNa*cS.sm *cS.sm *cS.sm *cS.sh*cS.sj*(cS.v-Ena); \n\n cS.sxr1 = xr1inft_t-(xr1inft_t - cS.sxr1) * exptauxr1t_t;\n\n \n cS.sxr2 = xr2inft_t-(xr2inft_t - cS.sxr2) * exptauxr2t_t;\n \n cS.ikr = cS.Gkr*cC.Gkrfactor*cS.sxr1*cS.sxr2*(cS.v-Ek); \n \n cS.sxs = xsinft_t-(xsinft_t-cS.sxs)*exptauxst_t;\n\n cS.iks = cS.Gks*cS.sxs*cS.sxs*(cS.v-Eks);\n\n cS.sr = rinft_t-(rinft_t-cS.sr)*exptaurt_t;\n\n cS.ss = sinft_t-(sinft_t-cS.ss)*exptaust_t;\n\n cS.ito = cS.Gto*cS.sr*cS.ss*(cS.v-Ek);\n\n cS.sd = dinft_t-(dinft_t-cS.sd)*exptaudt_t;\n\n cS.sf = finft_t-(finft_t-cS.sf)*exptauft_t;\n\n cS.sf2 = f2inft_t-(f2inft_t-cS.sf2)*exptauf2t_t; \n\n FCaSS_INF = (cS.cass > cS.casshi) ? 0.4 : fcassinft_t ;\n\n exptaufcass = (cS.cass > cS.casshi) ? cC.exptaufcassinf : exptaufcasst_t;\n\n cS.sfcass = FCaSS_INF-(FCaSS_INF- cS.sfcass)*exptaufcass;\n\n cS.ical = cS.sd*cS.sf*cS.sf2*cS.sfcass*(ical1t_t* cS.cass - ical2t_t);\n\n cS.ik1 = ik1coefft_t*(cS.v-Ek);\n\n cS.ipk = ipkcoefft_t*(cS.v-Ek);\n\n cS.inaca = inaca1t_t*cS.nai*cS.nai*cS.nai-inaca2t_t*cS.cai;\n\n cS.inak = inakcoefft_t*(cS.nai/(cS.nai+cS.KmNa));\n\n cS.ipca = cS.GpCa*cS.cai/(cS.KpCa+cS.cai);\n\n cS.ibna = cS.GbNa*(cS.v-Ena);\n\n cS.ibca = cS.GbCa*(cS.v-Eca);\n\n //total current\n cS.sItot = cS.ikr+ cS.iks+ cS.ik1+ cS.ito+ cS.ina+ cS.ibna+ cS.ical+ cS.ibca+ cS.inak+ cS.inaca+ cS.ipca+ cS.ipk+ cS.Istim;\n\n //console.log(cS.ikr, cS.iks, cS.ik1, cS.ito, cS.ina, cS.ibna, cS.ical, cS.ibca, cS.inak, cS.inaca, cS.ipca, cS.ipk, cS.Istim);\n\n //update concentrations\n\n kCaSR = cS.maxsr-((cS.maxsr-cS.minsr)/(1+(cS.EC/cS.casr*(cS.EC/cS.casr))));\n k1 = cS.k1prime/kCaSR;\n k2 = cS.k2prime*kCaSR;\n dRR = cS.k4*(1.-cS.srr)-k2*cS.cass*cS.srr;\n cS.srr = cS.srr+cS.timestep*dRR;\n sOO = k1*cS.cass*cS.cass*cS.srr/(cS.k3+k1*cS.cass*cS.cass);\n\n //intracellular calcium currents\n\n cS.Irel = cS.Vrel*sOO*(cS.casr- cS.cass);\n cS.Ileak = cS.Vleak*(cS.casr-cS.cai);\n cS.Iup = cS.Vmaxup/(1.+((cS.Kup*cS.Kup)/(cS.cai*cS.cai)));\n cS.Ixfer = cS.Vxfer*(cS.cass - cS.cai);\n\n\n CaCSQN = cS.Bufsr*cS.casr/(cS.casr+cS.Kbufsr);\n dCaSR = cS.timestep*(cS.Iup-cS.Irel-cS.Ileak);\n bjsr = cS.Bufsr-CaCSQN-dCaSR-cS.casr+cS.Kbufsr;\n cjsr = cS.Kbufsr*(CaCSQN+dCaSR+cS.casr);\n cS.casr = (Math.sqrt(bjsr*bjsr+4.*cjsr)-bjsr)/2.;\n\n CaSSBuf = cS.Bufss * cS.cass/(cS.cass+cS.Kbufss);\n dCaSS = cS.timestep * (-cS.Ixfer*(cS.Vc/cS.Vss)+cS.Irel*(cS.Vsr/cS.Vss)+(-cS.ical*cC.inversevssF2*cS.CAPACITANCE)); \n bcss = cS.Bufss - CaSSBuf - dCaSS - cS.cass+cS.Kbufss;\n ccss = cS.Kbufss*(CaSSBuf+dCaSS+cS.cass);\n cS.cass = (Math.sqrt(bcss*bcss+4.*ccss)-bcss)/2.;\n\n CaBuf = cS.Bufc*cS.cai/(cS.cai+cS.Kbufc);\n dCai = cS.timestep *((-(cS.ibca+cS.ipca-2*cS.inaca)*cC.inverseVcF2*cS.CAPACITANCE)-(cS.Iup-cS.Ileak)*(cS.Vsr/cS.Vc)+cS.Ixfer); \n bc = cS.Bufc-CaBuf-dCai-cS.cai+cS.Kbufc;\n cc = cS.Kbufc*(CaBuf+dCai+cS.cai);\n cS.cai = (Math.sqrt(bc*bc+4.*cc)-bc)/2.;\n\n dNai = -(cS.ina+cS.ibna+3.*cS.inak+3.*cS.inaca)*cC.inverseVcF*cS.CAPACITANCE;\n cS.nai = cS.nai+cS.timestep*dNai;\n\n dKi = -(cS.Istim+cS.ik1+cS.ito+cS.ikr+cS.iks-2.*cS.inak+cS.ipk)*cC.inverseVcF*cS.CAPACITANCE; \n cS.ki = cS.ki+cS.timestep*dKi;\n cS.v = cS.v - cS.sItot * cS.timestep ;\n \n\n //cal ends\n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n\n return data; \n }", "calculateProfit(data) {\n for (var i = 0; i < data.length; i ++) {\n data[i].profit = data[i].revenue - data[i].totalCost\n }\n return data;\n }", "function final_rssi(rssi_array, mean, standart){\n \tfor(var i= 0;i<rssi_array.length;i++){\n \t\tif(rssi_array[i]<mean-2*standart) rssi_array.splice(i,1);\n \t}\n\n \treturn rssi_array.reduce(sum_array)/rssi_array.length;\n }", "get mean(): number {\n if(this.alpha > 1) {\n return this.alpha * this.xm / (this.alpha - 1);\n }\n return Infinity;\n }", "function t3(){\n return dataArray[1][1]-dataArray[0][1];\n }", "function compute_average_in_timeframe (period_in, device_in) {\n var min = get_min_date(period_in);\n var arr = get_records (min, device_in);\n console.log (arr)\n var average_result = compute_average (arr)\n console.log(average_result)\n return average_result;\n }", "function getMinValue(data){\n let min = 9999\n let t_min\n data.forEach(function(e) { \n t_min = d3.min(Object.values(e));\n if(t_min < min) {\n min = t_min;\n } \n });\n return min;\n}", "_calcProgressStart() {\n if(this.isRange) {\n return this._scale(this.value);\n }\n return 0;\n }", "function calculation () {\n omega = 2*Math.PI*ny; // Kreisfrequenz (1/s)\n if (dPhi == 0) i0 = u0/r; // Maximale Stromstärke (A, für Widerstand)\n else if (dPhi > 0) i0 = u0*omega*c; // Maximale Stromstärke (A, für Kondensator)\n else i0 = u0/(omega*l); // Maximale Stromstärke (A, für Spule)\n }", "function computeMarketCaps(data) {\n let large = 0\n let medium = 0\n let small = 0\n let micro = 0\n let portfolioDta = data\n for (var j = 0; j < portfolioDta.length; j++) {\n let mCap = parseFloat(portfolioDta[j]['marketcap'])\n let holding = parseFloat(portfolioDta[j]['current_total'])\n // Micro cap\n console.log(\"Marketdd caps data:::\", j, mCap, portfolioDta.length)\n if (mCap < 0.3e9) {\n micro += holding\n\n // Else Small cap\n } else if (mCap < 2e9) {\n small += holding\n // Else medium cap\n } else if (mCap < 10e9) {\n medium += holding\n // Else large cap\n } else {\n large += holding\n }\n\n }\n const total = micro + small + medium + large\n let obj = [{ label: \"Micro\", val: micro, total: total }, { label: \"Small\", val: small, total: total }, { label: \"Medium\", val: medium, total: total }, { label: \"Large\", val: large, total: total }]\n\n let cleanObj = obj.filter(function (el) {\n return el['val'] !== 0\n })\n\n console.log(\"Market caps obj is\", cleanObj)\n setPortfolioStatistics_mCapAggregate(cleanObj);\n }", "function calcSum(){\n var sum = 0;\n for (var i = 0; i < data.length ; i++) {\n if (data[i].type === 'inc') {\n sum += parseInt(data[i].value);\n\n }else if (data[i].type === 'exp') {\n sum -= parseInt(data[i].value);\n }\n }\n return sum;\n}", "function expectationCalc(data) {\n\treturn data.reduce(function(a, b, i){return a+b.p*(i+1);},0);\n}", "findMinAndMaxFromHistoricalData(stock) {\n let lowest = Number.POSITIVE_INFINITY;\n let highest = Number.NEGATIVE_INFINITY;\n let tmp;\n const historicalData = stock.historicalData.historical;\n for (let i = historicalData.length - 1; i >= 0; i--) {\n tmp = historicalData[i];\n if (tmp.low < lowest) lowest = tmp.low;\n if (tmp.high > highest) highest = tmp.high;\n }\n stock.high = highest;\n stock.low = lowest;\n }", "keskiarvo() {\n let sum = this.state.timer20.reduce((previous, current) => current += previous);\n let avg = sum / this.state.timer20.length;\n return avg\n }", "function computeSimpleMovingAverage(dataPoints) {\n\tif (dataPoints.length == 0) {\n\t\treturn 0;\n\t}\n\telse {\n\t\t// Computes the SMA for the current data points\n\t\tvar sum = 0;\n\t\t// faster implementation than doing a for loop\n\t\tvar i = dataPoints.length;\n\t\twhile (i--) {\n\t\t\tsum += dataPoints[i];\n\t\t}\n\t\treturn sum / dataPoints.length;\n\t}\n}", "getPreviousIntervalTotalPoints() {\n let totalPoints = 0;\n this.previousIntervalPoints.forEach(element => {\n totalPoints += element.totalPoints;\n });\n return totalPoints;\n }", "function getTotal() {\n if (!runningTotal) {\n operate(x, sign, y);\n runningTotal = true;\n } else if (runningTotal) {\n operate(total, sign, y);\n } \n}", "function draw_min_data(min_data) {\n}", "function calculateNext(data) {\n \n\t\tvar yinft_t, exptauyt_t, xinft_t, exptauxt_t, ikcoefft_t, rinft_t, exptaurt_t, itoterm1t_t, itoterm2t_t, itoterm3t_t,\n\t\tinacaterm1t_t, inacaterm2t_t, minft_t, exptaumt_t, hinft_t, exptauht_t, dinft_t, exptaudt_t, finft_t, exptauft_t,\n\t\tisicaterm1t_t, isikterm1t_t, isikterm2t_t, pinft_t, exptaupt_t, ik1term1t_t, \n\n\t\tadum, bdum, ena, ek, emh, eca, vmek, yinf, exptauy, ikc, inac, ionc, xinf, exptaux, ikcoeff, ik1term1, rinf, exptaur,\n\t\titoterm1, itoterm2, itoterm3, icac, inacaterm1, inacaterm2, nai3, dum2, dum3, dum4, minf, exptaum, hinf, exptauh, \n\t\tdinf, exptaud, finf, exptauf, tvar, inf, isicaterm1, isikterm1, isikterm2, imk, imna, imca, iion,\n\t\tfactor, derv, pinf, exptaup, iup, itr, irel, dcaup, dcarel, dcai, dna, dk ;\n\n\t\tadum = 0.05 * Math.exp(-0.067 * (cS.v + 42.));\n bdum = (Math.abs(cS.v + 42.) <= 1e-6) ? 2.5 : (cS.v + 42.) / (1.- Math.exp(-0.2 * (cS.v + 42.)));\n cS.tau = adum + bdum;\n yinft_t = adum / cS.tau;\n exptauyt_t = Math.exp(-cS.timestep * cS.tau);\n adum = 0.5 * Math.exp(0.0826 * (cS.v + 50.)) / (1.0 + Math.exp(0.057 * (cS.v + 50.)));\n bdum = 1.3 * Math.exp(-0.06 * (cS.v + 20.)) / (1. + Math.exp(-0.04 * (cS.v + 20.)));\n cS.tau = adum + bdum;\n xinft_t = adum / cS.tau;\n exptauxt_t = Math.exp(-cS.timestep * cS.tau);\n ikcoefft_t = Math.exp(-cS.v * cC.fort);\n adum = 0.033 * Math.exp(-cS.v / 17.);\n bdum = 33. / (1. + Math.exp(-(cS.v + 10.) / 8.));\n cS.tau = adum + bdum;\n rinft_t = adum / cS.tau;\n exptaurt_t = Math.exp(-cS.timestep * cS.tau);\n itoterm1t_t = (Math.abs(cS.v + 10.) <= (10e-6)) ? 5. : (cS.v + 10.) / (1.-Math.exp(-2. * (cS.v + 10.)));\n itoterm2t_t = Math.exp(.02 * cS.v);\n itoterm3t_t = Math.exp(-.02 * cS.v);\n inacaterm1t_t = Math.exp(cS.gamma * cS.v * cC.fort);\n inacaterm2t_t = Math.exp((cS.gamma - 1.) * cS.v * cC.fort);\n adum = (Math.abs(cS.v + 41.) <= 1e-6) ? 2000 : 200. * (cS.v + 41.) / (1.-Math.exp(-0.1 * (cS.v + 41.)));\n bdum = 8000. * Math.exp(-0.056 * (cS.v + 66.));\n cS.tau = adum + bdum;\n minft_t = adum / cS.tau;\n exptaumt_t = Math.exp(-cS.timestep * cS.tau);\n adum = 20. * Math.exp(-0.125 * (cS.v + 75.));\n bdum = 2000. / (1. + 320. * Math.exp(-0.1 * (cS.v + 75.)));\n cS.tau = adum + bdum;\n hinft_t = adum / cS.tau;\n exptauht_t = Math.exp(-cS.timestep * cS.tau);\n if(Math.abs(cS.v + 19.) <= 1e-6){\n adum = 120.;\n bdum = 120.;\n }\n else{\n adum = 30. * (cS.v + 19.) / (1.-Math.exp(-(cS.v + 19.) / 4.));\n bdum = 12. * (cS.v + 19.) / (Math.exp((cS.v + 19.) / 10.)-1.);\n }\n cS.tau = adum + bdum;\n dinft_t = adum / cS.tau;\n exptaudt_t = Math.exp(-cS.timestep * cS.tau);\n adum = (Math.abs((cS.v + 34.)) <= 1e-6) ? 25. : 6.25 * (cS.v + 34.) / (Math.exp((cS.v + 34.) / 4.)-1.);\n bdum = 50. / (1. + Math.exp(-(cS.v + 34.) / 4.));\n cS.tau = adum + bdum;\n finft_t = adum / cS.tau;\n exptauft_t = Math.exp(-cS.timestep * cS.tau);\n isicaterm1t_t = Math.exp(-2. * (cS.v - 50.) * cC.fort);\n isikterm1t_t = (1.- Math.exp(-(cS.v - 50.) * cC.fort));\n isikterm2t_t = Math.exp((50. - cS.v) * cC.fort);\n adum = (Math.abs((cS.v + 34.)) <= 1e-6) ? 2.5 : .625 * (cS.v + 34.) / (Math.exp((cS.v + 34.) / 4.)-1.);\n bdum = 5.0 / (1. + Math.exp(-(cS.v + 34.) / 4.));\n cS.tau = adum + bdum;\n pinft_t = adum / cS.tau;\n exptaupt_t = Math.exp(-cS.timestep * cS.tau);\n\n // compute equilibrium potentials\n\t\t\n\t\tena = cC.rtof * Math.log(cS.nao / cS.nai);\n ek = cC.rtof * Math.log(cS.kc / cS.ki);\n emh = cC.rtof * Math.log((cS.nao + 0.12 * cS.kc) / (cS.nai + 0.12 * cS.ki));\n eca = 0.5 * cC.rtof * Math.log(cS.cao / cS.cai);\n \n vmek = cS.v - ek;\n ik1term1t_t = cS.gk1 * (vmek) / (1. + Math.exp(2. * (vmek + 10.) * cC.fort));\n\t\t\n\t\t// hyperpolarizing-activated current\n yinf = yinft_t;\n exptauy = exptauyt_t;\n cS.y = yinf - (yinf - cS.y) * exptauy;\n\n cS.ifk = cS.y * (cS.kc / (cS.kc + cS.kmf)) * cS.gfk * (cS.v - ek);\n cS.ifna = cS.y * (cS.kc / (cS.kc + cS.kmf)) * cS.gfna * (cS.v - ena);\n// cS.ifk = 0.0\n// cS.ifna = 0.0\n ikc = cS.ifk;\n inac = cS.ifna;\n ionc = cS.ifk + cS.ifna;\n\n// time-dependent (delayed K + current)\n xinf = xinft_t;\n exptaux = exptauxt_t;\n cS.x = xinf - (xinf - cS.x) * exptaux;\n\n ikcoeff = ikcoefft_t;\n cS.ik = cS.x * cS.ikmax * (cS.ki - cS.kc * ikcoeff) / 140.;\n ikc = ikc + cS.ik;\n ionc = ionc + cS.ik;\n\n// time-independent (background) K + current\n ik1term1 = ik1term1t_t;\n cS.ik1 = (cS.kc / (cS.kc + cS.km1)) * ik1term1;\n ikc = ikc + cS.ik1;\n ionc = ionc + cS.ik1;\n\n\t\t// transient outward current\n rinf = rinft_t;\n exptaur = exptaurt_t;\n cS.r = rinf - (rinf - cS.r) * exptaur;\n\n itoterm1 = itoterm1t_t;\n itoterm2 = itoterm2t_t;\n itoterm3 = itoterm3t_t;\n cS.ito = (cS.r * cS.gto * (0.2 + (cS.kc / (cS.kc + cS.kmt))) * (cS.cai / \n (cS.kact + cS.cai)) * itoterm1) * (cS.ki * itoterm2-cS.kc * itoterm3); // gto = 0.28\n ikc = ikc + cS.ito;\n ionc = ionc + cS.ito;\n\t\t \n// background sodium current\n cS.ibna = cS.gbna * (cS.v - ena);\n inac = inac + cS.ibna;\n ionc = ionc + cS.ibna;\n\n// background calcium current\n cS.ibca = cS.gbca * (cS.v - eca);\n icac = cS.ibca;\n ionc = ionc + cS.ibca;\n\n// na-k pump exchange current\n cS.inak = cS.ipmax * (cS.kc / (cS.kmk + cS.kc)) * (cS.nai / (cS.kmna + cS.nai));\n ikc = ikc - 2. * cS.inak;\n inac = inac + 3. * cS.inak;\n ionc = ionc + cS.inak;\n\n// na-ca pump exchange current\n inacaterm1 = inacaterm1t_t;\n inacaterm2 = inacaterm2t_t;\n nai3 = cS.nai * cS.nai * cS.nai;\n dum2 = nai3 * cS.cao * inacaterm1;\n dum3 = cC.nao3 * (cS.cai) * inacaterm2;\n dum4 = 1. + cS.dnaca * ((cS.cai) * cC.nao3 + cS.cao * nai3);\n cS.inaca = cS.knaca * (dum2 - dum3) / dum4;\n inac = inac + 3 * cS.inaca;\n icac = icac - 2. * cS.inaca;\n ionc = ionc + cS.inaca;\n\n// fast sodium current\n minf = minft_t;\n exptaum = exptaumt_t;\n cS.m = minf - (minf - cS.m) * exptaum;\n\n hinf = hinft_t;\n exptauh = exptauht_t;\n cS.h = hinf - (hinf - cS.h) * exptauh;\n\n cS.ina = cS.m * cS.m * cS.m * cS.h * cS.gna * (cS.v - emh);\n inac = inac + cS.ina;\n ionc = ionc + cS.ina; \n\n// fast second inward current (calcium)\n dinf = dinft_t;\n exptaud = exptaudt_t;\n cS.d = dinf - (dinf - cS.d) * exptaud;\n\n finf = finft_t;\n exptauf = exptauft_t;\n cS.f = finf - (finf - cS.f) * exptauf;\n\n adum = 5.;\n bdum = cS.cai * adum / cS.kmf2;\n tvar = adum + bdum;\n inf = adum / (adum + bdum);\n cS.f2 = inf - (inf - cS.f2) * Math.exp(-cS.timestep * tvar);\n\n dum2 = cS.d * cS.f * cS.f2 * (4. * cS.psi * (cS.v - 50.) * cC.fort);\n isicaterm1 = isicaterm1t_t;\n dum3 = (1. - isicaterm1);\n dum4 = cS.cai * cC.exp100fort - cS.cao * isicaterm1;\n cS.isica = dum2 * dum4 / dum3;\n icac = icac + cS.isica;\n ionc = ionc + cS.isica;\n\n// more fast inward current\n isikterm1 = isikterm1t_t;\n isikterm2 = isikterm2t_t;\n dum3 = isikterm1;\n dum4 = cS.ki * cC.exp50fort - cS.kc * isikterm2;\n cS.isik = dum2 * dum4 / (400. * dum3);\n ikc = ikc + cS.isik;\n ionc = ionc + cS.isik;\n\n// total currents used to update each ion concentration\n imk = ikc;\n imna = inac;\n imca = icac;\n\n// convert from nanoamperes to microampers per square cm\n\n// iion = 0.015 * ionc\n\n// derv = -1000. * iion / cm\n\n imna = cS.ifna + cS.ina + 3. * cS.inaca + 3. * cS.inak + cS.ibna;\n imk = cS.ifk + cS.ik + cS.ik1 + cS.ito + cS.isik - 2. * cS.inak;\n imca = cS.isica - 2. * cS.inaca + cS.ibca;\n iion = imna + imk + imca;\n\n\n// stimulus\n// if(ttim * 1000.0.le.1.0) then\n// if(mod(it,icycle).le.istimdur) then\n// if(ttim * 1000.0.le.1.0.or.\n// & (ttim * 1000.0.gt.500.0.and.ttim * 1000.0.le.501.0)) then\n// ionc = ionc-10000.0\n// endif\n// 1750 works, 1800 does not so use 1750 as diast. thresh, 3500 = 2 * \n // if(mod(ntime,icycle).le.istimdur) then\n factor = _s1s2Stimulus(count,data);\n iion = iion - factor;\n imk = imk - factor;\n \n derv = iion / cS.cm;\n\n \n// change in intracellular sodium \n dna = (-imna / (cC.vi * cS.fcon)) * cS.timestep;\n cS.nai = cS.nai + dna;\n\n// change in extracellular potassium\n dk = (-cS.prate * (cS.kc - cS.kb) + imk / (cC.ve * cS.fcon)) * cS.timestep;\n cS.kc = cS.kc + dk;\n\n// change in intracellular potassium\n dk = (-imk / (cC.vi * cS.fcon)) * cS.timestep;\n cS.ki = cS.ki + dk;\n\t\t\n// intracellular calcium handling\n pinf = pinft_t;\n exptaup = exptaupt_t;\n cS.p = pinf - (pinf - cS.p) * exptaup;\n\n iup = cC.aup * cS.cai * (cS.cabarup - cS.caup);\n itr = cC.atr * cS.p * (cS.caup - cS.carel);\n irel = cC.arel * cS.carel * (((cS.cai) * cS.cai) / ((cS.cai) * cS.cai + cS.kmca * cS.kmca));\n\n dcaup = ((iup - itr) / (2. * cC.vup * cS.fcon)) * cS.timestep;\n cS.caup = cS.caup + dcaup;\n\n dcarel = ((itr - irel) / (2. * cC.vrel * cS.fcon)) * cS.timestep;\n cS.carel = cS.carel + dcarel;\n\n dcai = (-(imca + iup - irel) / (2. * cC.vi * cS.fcon)) * cS.timestep;\n cS.cai = cS.cai + dcai;\n\n// update voltage\n cS.v = cS.v - cS.timestep * derv;\n\t\t\n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n return data; \n }", "function calculateDeltasPerMin(graphData) {\n const time = graphData.time;\n const xpData = graphData.xp;\n const goldData = graphData.totalGold;\n\n const timeDeltas = [];\n const xpDeltas = [];\n const goldDeltas = [];\n\n for(let i = 0; i < time.length - 1; i++) {\n const xpDeltaPerMin = xpData[i + 1] - xpData[i];\n const goldDeltaPerMin = goldData[i + 1] - goldData[i];\n\n timeDeltas.push(i);\n xpDeltas.push(xpDeltaPerMin);\n goldDeltas.push(goldDeltaPerMin);\n }\n\n const deltaData = {\n timeDeltas,\n xpDeltas,\n goldDeltas\n };\n\n return deltaData;\n}", "function calcPowerContractValues(){\r\n\t\t$scope.energyContractKWH_Year = $scope.fhemPower.Readings.energy_contract_kWh_Year.Value;\r\n\t\t$scope.energyContractKWH_Month = $scope.energyContractKWH_Year / 12;\r\n\t\t$scope.energyContractKWH_Day = $scope.energyContractKWH_Month / moment().daysInMonth();\r\n\t\t$scope.energyContractKWH_Week = $scope.energyContractKWH_Day * 7;\r\n\r\n\t\tcalcPowerPercentToYearValues();\r\n\t}", "function getCurrData(n)\n{\n const ii = getBaseLog(2,n)-2;\n return allValues.allData[ii];\n}", "function getEstimate() {\n vm.estimate.after15Sec = 0;\n if (vm.rentTime > 15) {\n vm.estimate.first15Sec = 15 * 20;\n vm.estimate.after15Sec = (vm.rentTime - 15) * 25\n } else {\n vm.estimate.first15Sec = vm.rentTime * 20;\n }\n vm.estimate.total = vm.estimate.after15Sec + vm.estimate.first15Sec\n }", "function getAvg(data) {\r\n\r\n\t\tvar sum = 0;\r\n\r\n\t\tfor (var i = 0; i < data.length; i++) {\r\n\t\t\tsum = sum + data[i];\r\n\t\t}\r\n\r\n\t\tvar average = (sum / data.length).toFixed(4);\r\n\t\treturn average;\r\n\t}", "function question1() {\n let total = 0;\n // console.log('TOTAL', total);\n // Answer:\n for (let i = 0; i < data.length; i++) {\n // console.log('allthethings', data[i].price);\n total += data[i].price;\n // console.log('TOTAL', total);\n }\n // console.log('datalength', data.length);\n let avg = total / data.length;\n console.log('The average price is ', avg);\n}", "calculateTotals(data) {\n let calculate = (acc, current) => acc + current;\n let total = data.reduce(calculate);\n return total;\n }", "getCumulativeTotal() {\n var transactions = fake_data.transactions.sort((a, b) => {\n return new Date(a.date) - new Date(b.date);\n });\n console.log(transactions);\n var starting_balance = fake_data.balance;\n var totalValues = [];\n var total = 0;\n transactions.forEach((t) => {\n starting_balance += t.amount;\n totalValues.push(starting_balance);\n });\n return totalValues;\n }", "function question1() {\n let total = 0\n for (p in data) {\n (total += data[p].price);\n }\n let avg = total / data.length;\n console.log(avg.toFixed(2));\n}", "function normalize(data) {\n var total = 0;\n var count = 0;\n\n data.markets.forEach(function(market) {\n var base = market.base.currency + '.' + market.base.issuer;\n var counter = market.counter.currency + '.' + market.counter.issuer;\n var swap\n\n // no trades or already determined\n if (!market.count || market.convertedAmount) {\n return;\n\n } else if (data.rates[base]) {\n market.convertedAmount = market.amount / data.rates[base];\n market.rate /= data.rates[base];\n\n } else if (data.rates[counter]) {\n swap = market.base;\n market.base = market.counter;\n market.counter = swap;\n market.rate = 1 / market.rate;\n market.amount = market.rate * market.amount;\n market.convertedAmount = market.amount / data.rates[counter];\n market.rate /= data.rates[counter];\n\n } else {\n console.log('no rate for:', base, counter);\n }\n });\n\n data.markets = data.markets.filter(function(market) {\n return market.count && market.convertedAmount;\n });\n\n data.markets.sort(function(a, b) {\n return b.convertedAmount - a.convertedAmount;\n });\n\n data.markets.forEach(function(market) {\n total += market.convertedAmount;\n count += market.count;\n });\n\n\n return {\n startTime: params.start.moment.format(),\n exchange: {currency: 'XRP'},\n exchangeRate: 1,\n total: total,\n count: count,\n components: data.markets\n }\n }", "function computeValues() {\n\t\t\t\n\t\t\tvar scaler;\n\t\t\t// deal with loop\n\t\t\tif (repeat > 0) {\n\t\t\t\t// not first run, save last scale ratio\n\t\t\t\txFrom = xTo;\n\t\t\t\tyFrom = yTo;\n\t\t\t\tratioFrom = ratioTo;\n\t\t\t} else {\n\t\t\t\t// get the scaler using conf options\n\t\t\t\tscaler = $.pixelentity.Geom.getScaler(zoom == \"out\" ? \"fill\" : \"none\",align.w,align.h,w,h,tw,th);\n\t\t\t\txFrom = scaler.offset.w;\n\t\t\t\tyFrom = scaler.offset.h;\n\t\t\t\tratioFrom = scaler.ratio;\n\t\t\t}\n\t\t\t\n\t\t\tscaler = $.pixelentity.Geom.getScaler(zoom == \"in\" ? \"fill\" : \"none\",pan.w,pan.h,w,h,tw,th);\n\t\t\txTo = scaler.offset.w;\n\t\t\tyTo = scaler.offset.h;\n\t\t\tratioTo = scaler.ratio;\n\t\t\t\n\t\t\txPrev = 0;\n\t\t\tyPrev = 0;\n\t\t\t\n\t\t\tduration = parseFloat(normalized)*33;\n\t\t\t\n\t\t\t// reset counter\n\t\t\tcounter = 0;\n\t\t\t\n\t\t\t// update runs count\n\t\t\trepeat++;\n\t\t\t\n\t\t}", "startCalcSpeed () {\n // calc rest time of backup\n this.lastTenData.length = 0\n this.startTime = new Date().getTime()\n let restTime = -1\n let lastRestTime = -1\n let beforeLastRestTime = -1\n clearInterval(this.timer)\n this.timer = setInterval(() => {\n const data = this.summary()\n this.lastTenData.unshift(data)\n\n // keep 10 data\n if (this.lastTenData.length > 10) this.lastTenData.length = 10\n\n const length = this.lastTenData.length\n // start calc restTime\n if (length > 1) {\n const deltaSize = this.lastTenData[0].transferSize - this.lastTenData[length - 1].transferSize\n const restTimeBySize = (data.size - data.completeSize) / deltaSize * (length - 1)\n\n const deltaCount = this.lastTenData[0].finishCount - this.lastTenData[length - 1].finishCount\n const restTimeByCount = (data.count - data.finishCount) / deltaCount * (length - 1)\n\n const usedTime = (new Date().getTime() - this.startTime) / 1000\n const restTimeByAllSize = (data.size - data.completeSize) * usedTime / data.transferSize\n const restTimeByAllCount = data.count * usedTime / data.finishCount - usedTime\n\n /* combine of restime by different method */\n restTime = Math.max(Math.min(restTimeBySize, restTimeByCount), Math.min(restTimeByAllSize, restTimeByAllCount))\n\n /* only use restTimeBySize */\n restTime = restTimeBySize\n // max restTime: 30 days\n restTime = Math.min(restTime, 2592000)\n /* average of the last 3 restTime */\n if (lastRestTime < 0 || beforeLastRestTime < 0) {\n lastRestTime = restTime\n beforeLastRestTime = restTime\n }\n restTime = (beforeLastRestTime + lastRestTime + restTime) / 3\n\n beforeLastRestTime = lastRestTime\n lastRestTime = restTime\n }\n\n const ltd = this.lastTenData\n const speed = ltd.length > 1 ? (ltd[0].transferSize - ltd[ltd.length - 1].transferSize) / ltd.length - 1 : 0\n\n const bProgress = data.count ? `${data.finishCount || 0}/${data.count}` : '--/--'\n\n const args = { speed, restTime: getLocaleRestTime(restTime), bProgress, ...data }\n webContents.getAllWebContents().forEach(contents => contents.send('BACKUP_MSG', args))\n }, 1000)\n }", "function calculateAverageofDay(index1, index2, weatherData, minmax) {\n\tlet temps = [];\n\tlet val = 0;\n\tlet times = weatherData[0].getElementsByTagName('forecast')[0].getElementsByTagName('time');\n\tfor(let i = index1; i < index2; i++) {\n\t\ttemps.push(parseFloat(times[i].getElementsByTagName('temperature')[0].getAttribute(minmax)));\n\t}\n\tif(minmax == \"max\") {\n\t\tlet value = temps.reduce(function(a, b) {\n\t\t\treturn Math.max(a, b);\n\t\t});\n\t\tval = value;\n\t\t\n\t} else if(minmax == \"min\") {\n\t\tlet value = temps.reduce(function(a, b) {\n\t\t\treturn Math.min(a, b);\n\t\t});\n\t\tval = value;\n\t}\n\treturn Math.floor(val);\t\n}", "getHeroMetrics() {\n let profit = 0;\n let tables = 0;\n let restaurants = [];\n let days = [];\n let sortedData = this.data.sort((a, b) => (a.reportDate > b.reportDate) ? 1 : -1);\n for (var i = 0; i < this.data.length; i ++) {\n profit += this.data[i].profit;\n tables += this.data[i].totalTables;\n\n if (!restaurants.includes(this.data[i].name)) {\n restaurants.push(this.data[i].name);\n }\n if (!days.includes(this.data[i].reportDate)) {\n days.push(this.data[i].reportDate);\n }\n }\n\n let profitHash = {};\n\n for (var i = 0; i < sortedData.length; i ++) {\n if (profitHash[sortedData[i].reportDate]) {\n profitHash[sortedData[i].reportDate] += sortedData[i].profit;\n } else {\n profitHash[sortedData[i].reportDate] = sortedData[i].profit;\n }\n }\n\n const profitArray = [];\n for (const [key, value] of Object.entries(profitHash)) {\n profitArray.push(profitHash[key]);\n }\n \n let max = 1;\n let len = 1;\n\n for (var i = 1; i < profitArray.length; i ++) {\n if (profitArray[i] > profitArray[i - 1]) {\n len++;\n } else {\n if (max < len) {max = len};\n len = 1;\n }\n }\n\n let avgTablesServed = tables / restaurants.length * days.length;\n\n return {totalProfit: profit, averageTablesServed: avgTablesServed, longestProfitableStreak: max};\n }" ]
[ "0.6367299", "0.63397056", "0.6321267", "0.62329835", "0.61852723", "0.61299384", "0.61247957", "0.61146003", "0.6068757", "0.59933585", "0.59275985", "0.59129316", "0.5865102", "0.58449256", "0.58365875", "0.58078015", "0.5736259", "0.57030255", "0.57030255", "0.57030255", "0.57030255", "0.56858456", "0.568484", "0.5671238", "0.56476283", "0.563132", "0.562074", "0.56050104", "0.5593547", "0.5585576", "0.5578665", "0.5571902", "0.5571338", "0.55540806", "0.55365145", "0.5532779", "0.55284417", "0.55270696", "0.5518334", "0.5517438", "0.5514545", "0.5491816", "0.5491399", "0.5487812", "0.54854876", "0.54763263", "0.5453815", "0.54537714", "0.5430472", "0.5428843", "0.54243946", "0.54185236", "0.54185236", "0.54185236", "0.54155403", "0.5407916", "0.53902507", "0.53798133", "0.53708094", "0.53696656", "0.53562516", "0.5344155", "0.5335756", "0.5326349", "0.5322004", "0.5319831", "0.53101987", "0.5307353", "0.53049934", "0.5293532", "0.52844167", "0.52807426", "0.5278573", "0.52709025", "0.5263681", "0.52457124", "0.5239561", "0.5239233", "0.5238735", "0.5238333", "0.52336895", "0.52327234", "0.5230114", "0.5217791", "0.5216307", "0.5215615", "0.52143", "0.5207902", "0.5206952", "0.5195912", "0.51958644", "0.5191621", "0.5189973", "0.5187987", "0.5186598", "0.51816726", "0.51797163", "0.51783293", "0.517781", "0.51764166" ]
0.58766943
12
calculate the sum of some given data
function sum_array(total, sum){ return total + sum; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sumData(data) {\n\n return data.reduce(sum);\n }", "function calcSum(){\n var sum = 0;\n for (var i = 0; i < data.length ; i++) {\n if (data[i].type === 'inc') {\n sum += parseInt(data[i].value);\n\n }else if (data[i].type === 'exp') {\n sum -= parseInt(data[i].value);\n }\n }\n return sum;\n}", "function sumValues() {\n return data.reduce((temp, currValue) => temp + currValue.cost, 0);\n }", "function sum(data) {\n var sum = 0; // declare sum vairable\n\n // iterate through the array and sum the numbers into variable\n for(var i = 0; i < data.length; i++) {\n sum += data[i];\n }\n\n return sum;\n}", "sum(){\n let t=data[0];\n var sum;\n for(x=0;x<t.length; x++){\n sum=sum+t[x];\n }\n return sum;\n }", "do_calculation( bunch_of_numerical_data)\n {\n var total = 0 ;\n bunch_of_numerical_data.forEach(element => {\n total += element\n });\n return total ;\n }", "suma(){\n let suma = 0;\n let i = 0;\n for(let x of this._data){\n i++;\n suma = suma + x;\n }\n return suma;\n }", "function findTotal(dataArray){\n let sum = 0;\n for (let i = 0; i < dataArray.length; i++){\n sum += dataArray[i];\n }\n return sum;\n}", "calculateTotals(data) {\n let calculate = (acc, current) => acc + current;\n let total = data.reduce(calculate);\n return total;\n }", "function arraySum(data) {\n\t\treturn data.reduce(function(a, b) {\n\t\t\treturn a + b;\n\t\t}, 0);\n\t}", "function Total(data) {\n var total = 0\n angular.forEach(data, function(value) {\n total += value;\n })\n return total;\n }", "function sumAll( ) {\n let sum = 0;\n // TODO: loop to add items\n return sum;\n}", "function get_total(data){\n return d3.sum(data,function(d){return d.PWT;});\n}", "sum() {}", "function aggregated(data) {\n if (!data) {\n return;\n }\n\n return data.reduce(function (previousValue, obj) {\n if (!obj.net_total) {\n return previousValue + 0;\n }\n return previousValue + obj.net_total.value;\n }, 0)\n\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 total(x){\n let resultat=0\n for(let i=0; i<x.length;i++){\n resultat += x[i]\n }\n return resultat\n}", "function sum() {\n // FILL THIS IN\n var sumValue = 0;\n for (var i = 0; i < arguments.length; i++) {\n sumValue += arguments[i];\n }\n }", "function total(arr) {\n const result = arr.reduce(function(num, finalSum){\n return finalSum = finalSum + num;\n });\n return result;\n \n}", "function sum(){\r\n // parse arguments into an array\r\n var args = [].slice.call(arguments);\r\n var totalValue = 0;\r\n\r\n // .. do something with each element of args\r\n args.forEach(function(value, idx, list) {\r\n totalValue += args[idx];\r\n });\r\n\r\n return totalValue;\r\n}", "function sum() {\r\n\t\tvar result = 0;\r\n\t\tfor(var i = 0, iLen = arguments.length; i < iLen; i++) {\r\n\t\t\tresult += arguments[i];\r\n\t\t}\r\n\t\treturn result;\r\n\t}", "function total(arr)\n{\n\t//your code here \n\tconst result = arr.reduce(function(num, addedValue){\n\t\taddedValue = addedValue + num; // 0 + 1 = 1, 1 + 2 = 3, 3 + 3 = 6\n\t\treturn addedValue;\n\t});\n\treturn result;\n}", "function sum(awalderet, akhirderet, step){\n if(awalderet != null && akhirderet != null && step == null){ //jika step kosong maka nilainya 1\n step = 1;\n var tampung = rangeWithStep(awalderet, akhirderet, step);\n var total = 0;\n\n for(i = 0; i < tampung.length; i++){\n total += tampung [i]\n }\n return total;\n\n }//jika semua parameter tidak null maka masuk ke sini\n else if(awalderet != null && akhirderet != null && step != null){\n var tampung = rangeWithStep(awalderet, akhirderet, step);\n var total = 0;\n\n for(i = 0; i < tampung.length; i++){\n total += tampung [i]\n }\n return total;\n\n }//jika hanya terdapat parameter awalderet maka sum bernilai awalderet\n else if(awalderet != null && akhirderet == null && step == null){\n total = awalderet;\n return total;\n }//jika parameter kosong semua maka return 0;\n else{\n return 0;\n }\n\n}", "function calcSum(value) {\n totalVotes += value;\n}", "function getTotalCost(data) {\n var total = 0;\n data.forEach(function(element) {\n total += parseInt(element.cost);\n });\n \n return total.toFixed(2);\n}", "function suma(...params) {\n // los array cuentan con el metodo reduce, que permite iterar sobre cada elemento de un array\n return params.reduce((acumulativo, actual) => acumulativo + actual, 0)\n}", "function calcSum(value) {\r\n totalVotes += value;\r\n}", "function calcSum(value) {\r\n totalVotes += value;\r\n}", "function sum(x){\n\tlet total = 0;\n\tfor ( let i = 0; i < x.length; i++ ){\n\t\ttotal += x[i];\n\t} \n\treturn total;\n}", "totalDataPoint(data, stat) {\n let values = data.map(elem => {\n return elem[stat];\n });\n\n let total = this.calculateTotals(values);\n return total;\n }", "function staffTotal(staffData){\n const staffBalance = staffData.map(function(cost){\n return cost.balance;\n });\n const totalBalance = staffBalance.reduce(function(prev, curr){\n return prev + curr;\n });\n console.log(staffBalance);\n console.log(totalBalance);\n}", "static getTotalPrice(data) {\n let totalPrice = 0\n data.forEach(product => {\n totalPrice += product.totalHarga\n })\n return totalPrice\n }", "function getTotalData(){\r\n\t \t\t var totalUnitData = 0;\r\n\t \t\t for (var i=0; i<unitValues.length;i++){\r\n\t \t\t\t totalUnitData += unitValues[i]; \r\n\t \t\t }\r\n\t \t\t return totalUnitData;\r\n\t \t }", "function sum(x) {\n var value = 0;\n for (var i = 0; i < x.length; i++) {\n value += x[i];\n }\n return value;\n }", "function sum(x) {\n var value = 0;\n for (var i = 0; i < x.length; i++) {\n value += x[i];\n }\n return value;\n }", "function sum(x) {\n var value = 0;\n for (var i = 0; i < x.length; i++) {\n value += x[i];\n }\n return value;\n }", "function calculateSum(arrayType) {\n\t//arrayType can be srcAmounts or expAmounts(two global arrays)\n\tlet totalSum = 0;\n\ttotalSum = arrayType.reduce(function(acc, curr) {\n\t\treturn acc + curr;\n\t}, 0);\n\treturn totalSum;\n}", "function sum(arr){\n\nresult = arr.reduce((total, elem)=>{\n return total += elem;\n })\n return result}", "function sum(numbers) {\n return _.reduce(numbers, function(result, current) {\n return result + parseFloat(current);\n }, 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 suma_total(arreglo){\n let suma = 0;\n arreglo.forEach( valor => {\n suma += valor;\n });\n return suma;\n}", "function fx_Add(data)\n{\n\t//default result:\n\tvar nRes = 0;\n\t//is the data valid?\n\tif (!String_IsNullOrWhiteSpace(data))\n\t{\n\t\t//split it into an array\n\t\tvar parameters = data.split(\",\");\n\t\t//two parameters?\n\t\tif (parameters.length == 2)\n\t\t{\n\t\t\t//add them together as numbers\n\t\t\tnRes = Get_Number(parameters[0], 0) + Get_Number(parameters[1], 0);\n\t\t}\n\t}\n\t//return the result\n\treturn nRes;\n}", "function computeTotal(data, callback){\n var appleSum = 0;\n var tomatoSum = 0;\n data.Items.forEach(function(entry){\n if(entry.offeredGoods.S == 'Tomatoes')\n tomatoSum = (tomatoSum*1 +entry.Capacity.N*1);\n else\n appleSum = (appleSum*1 +entry.Capacity.N*1);\n })\n total = [\n {\"Name\": \"Apples\", \"Quota\": appleSum},\n {\"Name\": \"Tomatoes\", \"Quota\": tomatoSum}\n ]\n callback(total);\n}", "function dataTotal(v) {\n\tvar vT = 0;\n\tfor(var i=0, len=v.length; i<len; i++) {\n\t\tvT += v[i];\n\t}\n\treturn vT;\n}", "function sum() {\n var sum = 0;\n\n for (var i = 0; i < arguments.length; i++) {\n sum += arguments[i];\n }\n\n return sum;\n }", "function sum(arr){\n return arr.reduce(function(d, i){ return i + d; });\n }", "function sum() {\n // FILL THIS IN\n var n = 0;\n for(i = 0; i < arguments.length; i++){\n n += arguments[i];\n }\n\n return n;\n }", "function sum(arr) {\n return arr.reduce(function(a, b) {\n return a + b;\n });\n }", "checkSum(){\n let sum = 0;\n for(let i in this.dices){\n sum += this.dices[i];\n }\n return sum;\n }", "function sum( arr ){\n\tvar total = 0;\n\t\n\tfor( var i in arr )\n\t\ttotal += arr[i];\n\t\n\treturn total\n}", "function sum(arr) {\n return arr.reduce(function(a, b) {\n return a + b;\n }, 0);\n }", "function suma(o,o1,o2,oT)\n{\n\tvar t=0;\n\tif (EsReal(o.value))\n\t{\n\t\tt+=parseFloat(o.value);\n\t}\n\tif (EsReal(o1.value))\n\t{\n\t\tt+=parseFloat(o1.value);\n\t}\n\tif (o2!=null)\n\t{\n\t\tif (EsReal(o2.value))\n\t\t{\n\t\t\tt+=parseFloat(o2.value);\n\t\t}\n\t}\n\tt=redondear(t,2)\n\toT.value=t;\n}", "function sum() {\n let total = 0;\n for (value of arguments) total += value;\n return total;\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}", "function sumArray(arr){\n\tvar sum = 0;\n\tarr.forEach(function(data){\n\t\tsum=sum+data;\n\t});\n\treturn sum;\n}", "function megaSum() {\n let all = 0;\n for (let i = 0; i < products.length; i++) {\n all += products[i].total;\n\n }\n console.log(all, 'this all');\n return all;\n}", "function sum(arr){\n let sum=0;\n for(let i=0; i<arr.length; i++){\n sum +=arr[i];\n }\n return sum;\n }", "function getSum(total, num) {\n return total + num;\n }", "function getSum(total, num) {\n return parseInt(total) + parseInt(num);\n }", "sum(arr) {\n return arr.reduce( (sum, val) => sum + val, 0);\n }", "function calculateSales(salesData){\n var totalSales = 0;\n for (var sale in salesData){\n totalSales = totalSales + salesData[sale];\n }\n return totalSales;\n}", "function getSum(total, num) {\n return total + num;\n }", "function suma(array) {\n\t\t\tlet suma = 0;\n\t\t\tfor(i=0; i<array.length; i++) {\n\t\t\t\tsuma = suma + array[i];\n\t\t\t};\n\t\t\treturn suma;\n\t\t}", "function calculateSum(...arguments) {\n let accumulator = 0;\n for (let i = 0; i < arguments.length; i++) {\n accumulator += arguments[i];\n };\n return accumulator;\n}", "function findSum() {\r\n var result = 0;\r\n for (var i = 0; i < arguments.length; i++) {\r\n result += arguments[i];\r\n }\r\n return result;\r\n}", "function calculateSum(){\n var sum = 0;\n for (var i = 0 ; i < arguments.length; i++) {\n sum += arguments[i];\n }\n return sum;\n}", "function sum() {\r\n\tvar items = sum.arguments.length;\r\n\tvar thissum = 0;\r\n\tvar thisnum;\r\n\tvar usedNums = false;\r\n\tfor (i = 0; i < items; i++) {\r\n\t\tthisnum = sum.arguments[i];\r\n\t\tif (isFloat(thisnum) && thisnum != 'NaN') {\r\n\t\t\tthissum += parseFloat(thisnum);\r\n\t\t\tusedNums = true;\r\n\t\t} else if (thisnum != null && thisnum != \"undefined\" && thisnum != \"\" && thisnum != 'NaN') {\r\n\t\t\treturn 'NaN';\r\n\t\t}\r\n\t}\r\n\treturn (usedNums ? thissum : 'NaN');\t\r\n}", "function total(arr) {\n return arr.reduce((acc, el) => acc + el)\n}", "function sum(arr){\n let ourSum=0;\nfor(i=0;i<arr.length;i++){\n ourSum=ourSum+arr[i]\n}\nreturn ourSum;\n}", "function sum() {\n return [...arguments].reduce((total, el) => {\n total += Number.isInteger(el) ? el : 0;\n return total;\n }, 0);\n}", "function sum(a) {\n\tif (isArrayLike(a)) {\n\t\tvar total = 0;\n\t\tfor (var i = 0; i < a.length; i++) {\n\t\t\tvar element = a[i];\n\t\t\tif (element == null) continue;\n\t\t\tif (isFinite(element)) total += element;\n\t\t\telse throw new Error(\"sum(): elements must be finite numbers\");\n\t\t}\n\t\treturn total;\t\t\n\t}\n\telse throw new Error(\"sum(): argument must be array-like\");\n}", "function sumMix(x){\n return x.reduce(function (total, n) { return total = total + Number(n); }, 0);\n \n \n}", "function sumFunction(total, value) {\r\n return total + value;\r\n}", "function sumOfAllBalances(data) {\n let totalSum = 0;\n for(let i = 0; i < data.length; i++) {\n let sum = parseFloat(data[i]['balance'].replaceAll(',', '').replaceAll('$', ''))\n totalSum += sum\n }\n return totalSum\n}", "totalSpent(){\n return this.meals().reduce((a,b)=>(a += b.price), 0);\n }", "function getSum(total, num) {\n return total + num;\n}", "function getSum(total, num) {\n return total + num;\n}", "function accumulativeData(data) {\n var total = 0;\n\n for (var i = 0; i < data.length; i++) {\n total = data[i][1] + total;\n data[i][1] = total;\n }\n\n return data\n }", "function sumValues() {\n let total = 0;\n $('.activities input:checkbox:checked').each(function() {\n const cost = parseActivity($(this)).cost;\n total += cost;\n });\n $('.activities .js-total-value strong').text(total);\n}", "_sum (arr) {\r\n return arr.reduce((acc,val) => acc+val)\r\n }", "function sum(numbers) {\n\t//your code is here \n\treturn numbers.reduce((acc,item) => acc+item);\n\n}", "function total(arr) {\n return arr.reduce(function (final, num) {\n return (final += num);\n });\n}", "function sum(array){\n\tlet somme = 0;\n\tarray.forEach( (element) => { somme+=element;})\n\treturn somme;\n}", "function sum(arr) {\n \tconst len = arr.length;\n \tlet result = 0;\n \tfor (let i = 0; i < len; i++) {\n \t\tresult += arr[i];\n \t}\n \treturn result;\n }", "get_sum(all_weights) {\n return all_weights;\n }", "totalSpent() {\n let prices = this.meals().map(\n function(meal) {\n return meal.price;\n }\n );\n\n return prices.reduce(\n function (total, price) {\n return total + price;\n }\n )\n\n }", "function total(arr) {\n return arr.reduce((a, b) => a + b);\n}", "function summing() {\n sum = 0\n for (i = 5; i < inpt.length; i = i + 4) {\n //console.log(inpt[i].value)\n if (inpt[i].value == \"\") {\n inpt[i].value = 0;\n }\n sum = sum + parseFloat(inpt[i].value)\n }\n return sum;\n }", "function totals(arr){\n\tvar total = 0;\n\tvar t_M = 0;\n\tvar ft_M = 0;\n\tvar f_M = 0;\n\tarr.forEach(function totals(element){\n\t\tt_M += element.threesMade;\n\t\tft_M += element.freeThrowsMade;\n\t\tf_M += element.fieldGoalsMade;\n\t});\n\tf_M -= t_M;\n\tf_M *= 2;\n\tt_M *= 3;\n\ttotal += f_M + t_M + ft_M;\n\treturn total;\n}", "function sum(arg) {\n return arg.reduce(function (lastValue, curr) { return lastValue + curr; });\n}", "function sum(arr){\r\n var total = 0;\r\n for (let i = 0; i < arr.length; i++) {\r\n total= total + arr[i];\r\n }\r\n return total;\r\n}", "calcTotal(){\n\t\t\tlet length = this.sales.length;\n\t\t\tthis.paidCommissionTotal = 0;\n\t\t\tthis.commissionTotal = 0;\n\t\t\tfor(let i = 0; i < length; ++i){\n\t\t\t\t\tthis.commissionTotal += this.sales[i].commission;\n\t\t\t\t\tif(this.sales[i].paid == true){\n\t\t\t\t\t\tthis.paidCommissionTotal += this.sales[i].commission;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tthis.sales.length;\n\t\t}", "totalSpent(){\n let sum = 0;\n for(const meal of this.meals()){\n sum += meal.price;\n }\n return sum;\n\n \n }", "SumPoints()\n {\n let sum = 0;\n\n for(let i = 0; i < this.scoreOverTime.length; i++)\n {\n sum += this.scoreOverTime[i];\n }\n\n return sum;\n }", "function sum() {\n\t var clean = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : filter.ignoreMissing;\n\t\n\t return function (values) {\n\t var cleanValues = clean(values);\n\t if (!cleanValues) return null;\n\t return _underscore2.default.reduce(cleanValues, function (a, b) {\n\t return a + b;\n\t }, 0);\n\t };\n\t}", "function getSum(total, num) {\n return total + num;\n}", "function getSum(total, num) {\n return total + num;\n}", "sumValues() {\n return (this.root ? this.root.sum() : 0);\n }", "function total(index) {\n\n var total = 0\n matrix[index].forEach(element => {\n total += element\n })\n return total; \n\n }", "function reduceSum(value) {\n\t return reduce(crossfilter_reduceAdd(value), crossfilter_reduceSubtract(value), crossfilter_zero);\n\t }" ]
[ "0.81762326", "0.78467035", "0.7704513", "0.7694907", "0.76389396", "0.7378151", "0.73089653", "0.7301588", "0.72892815", "0.69822073", "0.6935143", "0.69191206", "0.6882943", "0.6880673", "0.6829435", "0.6761839", "0.6756418", "0.66930217", "0.6690375", "0.6690102", "0.66677105", "0.6633744", "0.6629137", "0.66240466", "0.6615365", "0.66104805", "0.6605002", "0.6581874", "0.65798956", "0.6577996", "0.65674406", "0.6562418", "0.65592605", "0.6545479", "0.6545479", "0.6545479", "0.6535991", "0.6531103", "0.65303224", "0.65259606", "0.6515166", "0.6511728", "0.64992744", "0.64971304", "0.64701736", "0.6457354", "0.64377165", "0.64231914", "0.64171416", "0.6416669", "0.6416597", "0.6414653", "0.6412958", "0.64038783", "0.6401298", "0.639925", "0.6398281", "0.6392222", "0.6390216", "0.63894427", "0.6384086", "0.6382893", "0.6373536", "0.637042", "0.6367403", "0.63655895", "0.6360638", "0.63601804", "0.635959", "0.63574946", "0.6356547", "0.6356441", "0.63532454", "0.6351924", "0.63416076", "0.63414", "0.63414", "0.63401425", "0.6330784", "0.63298255", "0.6322651", "0.6322273", "0.632099", "0.6317873", "0.63106716", "0.6308328", "0.63080406", "0.6307149", "0.63027024", "0.63016874", "0.62983304", "0.6297891", "0.6296766", "0.62958366", "0.6291037", "0.6290561", "0.6290561", "0.62887895", "0.62874573", "0.62825364" ]
0.6701153
17
calculate the average of some given data
function final_rssi(rssi_array, mean, standart){ for(var i= 0;i<rssi_array.length;i++){ if(rssi_array[i]<mean-2*standart) rssi_array.splice(i,1); } return rssi_array.reduce(sum_array)/rssi_array.length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function average(data){\n let sum = data.reduce(function(sum, value){\n return sum + value;\n }, 0);\n \n let avg = sum / data.length;\n return avg;\n}", "function average(data){\n var sum = data.reduce(function(sum, value){\n return sum + value;\n }, 0);\n var avg = sum / data.length;\n return avg;\n}", "function average(data) {\n\tvar total = data.reduce(function(a, b){return a+b;},0);\n\tvar sum = data.reduce(function(a, b, i){return a+b*(i+1);},0);\n\treturn [total,sum/total]; \n}", "function average(data){\n\treturn _.round(_.sum(data) / data.length);\n}", "function simple_average(data) {\n\tlet sum = 0\n\tfor(var i = 0; i < data.length; i++) {\n\t\tsum += data[i]\n\t}\n\treturn sum / data.length\n}", "function getAvg(data) {\r\n\r\n\t\tvar sum = 0;\r\n\r\n\t\tfor (var i = 0; i < data.length; i++) {\r\n\t\t\tsum = sum + data[i];\r\n\t\t}\r\n\r\n\t\tvar average = (sum / data.length).toFixed(4);\r\n\t\treturn average;\r\n\t}", "function getAverage (data) {\n return data.reduce((acc, curr) => (acc += curr), 0) / data.length\n}", "avg(){\n let t=data[0];\n var avg;\n var sum;\n for(x=0;x<t.length; x++){\n sum=sum+t[x];\n }//for\n avg=sum/t.length;\n return avg;\n }", "function calculateAverage() {\r\n var sum = 0;\r\n for (var i = 0; i < arguments.length; i++) {\r\n sum += arguments[i];\r\n }\r\n return sum / 4;\r\n }", "function avg(data){\n let sum = 0;\n for(let i = 0; i < data.size; i++) {\n sum+= data.products[i].price;\n }\n return sum / data.size;\n}", "function average() {\n\t\tvar sum = 0;\n\t\tif (avgNum.length != 0) {\n\t\t\tfor (var i = 0; i < avgNum.length; i++) {\n\t\t\t\tsum = sum + parseInt(avgNum[i]);\n\t\t\t}\n\t\t}\n\t\treturn sum/avgNum.length;\n\t}", "avg(arr) {\r\n let sum = 0;\r\n for(let i = 0; i < arr.length; i++){\r\n sum += parseFloat(arr[i]);\r\n }\r\n return sum / arr.length;\r\n }", "function find_avg(arr) {\n\t\tvar sum = 0, avg;\n\t\tfor (var i = 0; i < arr.length; i++) {\n\t\t\tsum += arr[i];\n\t\t}\n\t\tavg = sum / arr.length;\n\t\treturn avg;\n\t}", "function avg(arr) {\n return arr.reduce((a,b) => +a + +b) / arr.length;\n }", "function avg( arr ){\n\treturn sum( arr ) / arr.length\n}", "function average(arr){\n return sum(arr) / arr.length;\n }", "function avg(values){\n var sum = 0;\n for (var i = 0; i < values.length; i++){\n sum += values[i];\n }\n return sum/values.length;\n}", "avg() {}", "function avgFilteredData( dat, val, maleloc, femaleloc, ages )\n{\n\tvar total = 0;\n\tfor( var age = ages[0]; age <= ages[1]; age++ )\n\t\ttotal += genderFilteredData( dat[age], gender, maleloc, femaleloc )\n\t\t\n\ttotal /= ( ages[1] + 1 - ages[0] );\n\ttotal *= 100;\n\t\n\treturn total;\n}", "function average(array) {\n function plus(a, b) { return a + b; }\n return array.reduce(plus) / array.length;\n }", "function compute_average (array_in) {\n console.log(array_in)\n //console.log(array_in.length)\n console.log(typeof(array_in))\n\n var sum = 0;\n \n for (var i = 0; i < array_in.length; i++ ) {\n //console.log(array_in[i].count)\n sum += array_in[i].count\n }\n var ave = sum / array_in.length;\n //console.log(ave)\n return ave;\n }", "function aveArray(arr){\n\tvar sum1=0;\n\tvar avg=0;\n for(i=0 ; i<arr.length ; i++){\n sum1 += arr[i];\n avg= sum1/arr.length;\n }return avg;\n}", "function avg() {\n var sum = 0;\n for (var i = 0, j = arguments.length; i < j; i++) {\n sum += arguments[i];\n }\n return sum / arguments.length;\n}", "function avg() {\n var sum = 0;\n for (var i = 0, j = arguments.length; i < j; i++) {\n sum += arguments[i];\n }\n return sum / arguments.length;\n}", "average() {\n if (this.length)\n return this.reduce((accumulator, value) => accumulator + value, 0) / this.length;\n else\n return 0;\n }", "function mean(n, data)\n{\n\tlet sum= data.reduce( (t,s) => t+s );\n\treturn ( sum/n );\n}", "function average(a){\n\tvar store=0;\n\tif (a.length === 0){\n\t\treturn 0;\n\t};\n\n\tfor (var i=0; i < a.length; i++){\n\t\tstore+= a[i];\n\t\t\n\t}return store/a.length;\n\n}", "function calcAVG(array) {\n var total = 0;\n for (var i = 0; i < array.length; i++) {\n total += array[i];\n }\n var avg = total / array.length;\n return (avg);\n}", "function findMean(dataArray, total){\n let sum = 0;\n for (let i = 0; i < dataArray.length; i++){\n sum += i*dataArray[i];\n }\n let mean = sum/total;\n return mean;\n}", "function findAvg(arr) {\n var sum = 0;\n var avg = 0;\n for(var i = 0; i < arr.length; i++) {\n sum += arr[i];\n }\n avg = sum / arr.length;\n return avg; \n}", "function calcAverage (arr){\n // needs to initialize\n var sum = 0;\n for ( var i = 0 ; i < arr .length; i ++ ){\n sum += arr [ i ];\n }\n // must divide by the length\n return sum/arr.length;\n}", "function calcAverage(array) {\n let sum = 0;\n for (let i=0;i<array.length;i++){\n sum += array[i]; \n };\n avg = sum/array.length;\n return avg;\n }", "function average(array){\n function plus(a, b){return a + b;}\n return array.reduce(plus) / array.length;\n}", "function avg (x,y,z) {\n add = x + y + z\n return add/3\n\n}", "avg() {\n\t\tlet argArr = this.args;\n\t\tfunction avgSet(s,c,f) {\n\t\t\taverage: s;\n\t\t\tceiling: c;\n\t\t\tfloor: f;\n\t\t}\n\t\tlet evaluate = function() {\n\t\t\tlet sum = 0;\n\t\t\tfor(let c=0;c<argArr.length;c++) {\n\t\t\t\tsum += argArr[c];\n\t\t\t}\n\t\t\tsum /= argArr.length\n\t\t\tlet ceil = Math.ceil(sum)\n\t\t\tlet floor = Math.floor(sum)\n\n\t\t\tlet avg = avgSet(sum,ceil,floor); //{average:sum,ceiling:ceil,floor:floor}\n\t\t\treturn avg;\n\t\t};\n\t\t// console.log(evaluate())\n\t\tthis.record(`Evaluated avg: ${evaluate().average} | fxnCount: ${this.fxnCount} | avgCount: ${this.avgCount}`,evaluate());\n\t}", "function avg(d, u, h) {\n return (d + u + h) / 3;\n}", "function averageFinder(arr) {\n var average = 0;\n var sum = 0;\n for(var i = 0; i < arr.length; i++) {\n sum+= arr[i]\n } \n average = (sum / arr.length);\n return average; \n }", "function avg(array) {\r\n\tvar sum = array.reduce(function(prev,current){\r\n\t\treturn prev + current;\r\n\t});\r\n\treturn sum/array.length;\r\n}", "function averageOf(no1, no2, no3) {\n return (no1 + no2 + no3)/3;\n}", "function avg (a,b,c,d)\n{\nlet i = [a,b,c,d]\n x = (a+b+c+d)/i.length\n return x;\n}", "function avg(arr){\n var sum =0;\n \n for(var i=0; i<arr.length; i++){\n sum+=arr[i]\n \n }\n return sum/arr.length;\n}", "function mean(){\n return (a.reduce(getSum) / (a.length))\n}", "function average(array){\n function plus(a,b){return a+b}\n return array.reduce(plus)/array.length;\n}", "function aveArray(arr){\r\n\t\tvar sum=0\r\n\t\tfor (i=0;i<arr.length;i++) {\r\n\t\t\tsum+=arr[i]\r\n\t\t}\r\n\t\tvar avg=sum/arr.length;\r\n\t\treturn avg;\r\n\t}", "function average(array) {\n function plus(a, b) {\n return a + b;\n }\n return array.reduce(plus) / array.length;\n}", "function findAVG(arr){\n var avg = 0;\n for(var i = 0; i < arr.length; i++){\n avg += arr[i];\n }\n return avg/arr.length;\n}", "function getArithmeticAverage (data) {\n let _data = data.reduce((acc, item) => {\n if (!Number(item.grade)) return acc;\n acc.subjects++;\n acc.acc += item.grade;\n return acc;\n }, { subjects: 0, acc: 0 });\n return (_data.acc / _data.subjects).toFixed(4);\n }", "function average(array) {\n function plus(a, b) { return a + b; }\n return array.reduce(plus) / array.length;\n}", "function average(array) {\n function plus(a, b) { return a + b; }\n return array.reduce(plus) / array.length;\n}", "function average(array) {\n function plus(a, b) { return a + b; }\n return array.reduce(plus) / array.length;\n}", "function average(array) {\n function plus(a, b) { return a + b; }\n return array.reduce(plus) / array.length;\n}", "function average(array) {\n function plus(a, b) { return a + b; }\n return array.reduce(plus) / array.length;\n}", "function average(array) {\n function plus(a, b) { return a + b; }\n return array.reduce(plus) / array.length;\n}", "function average(array) {\n function plus(a, b) { return a + b; }\n return array.reduce(plus) / array.length;\n}", "function question1() {\n let total = 0\n for (p in data) {\n (total += data[p].price);\n }\n let avg = total / data.length;\n console.log(avg.toFixed(2));\n}", "function average(array){\n //함수를 완성하세요\n var result = 0;\n for (var i = 0; i < array.length; i++) {\n result = result + array[i]\n }\n return result/array.length ;\n}", "function average(arr) {\n return _.reduce(arr, function (memo, num) {\n return memo + num;\n }, 0) / arr.length;\n }", "function average(array) {\n function plus(a, b) {\n return a + b;\n }\n\n return array.reduce(plus) / array.length;\n}", "function avg(arr){\n return arr.reduce((a,b) => a + b, 0) / arr.length\n }", "function avgAll(myarray) {\n var tot = 0;\n for(var i = 0; i < myarray.length; i++) {\n tot += myarray[i];\n }\n return tot / myarray.length;\n}", "function average(array){\n\tvar result= 0;\n\tvar total= 0;\n\tfor (var i= 0; i<array.length; i++){\n\t\tresult+= array[i];\n\t\ttotal= result / array.length;\n\t} \n\treturn total; \t\n}", "function average (xs) {\n if (xs.length === 0) {\n return\n }\n\n return xs.reduce(function (total, x) {\n return total + x\n }) / xs.length\n}", "function avg_array(arr) {\n var sum = 0\n for( var i = 0; i < arr.length; i++) {\n sum += arr[i];\n }\n return sum / arr.length;\n}", "function m_average(table) //table -> tableau contenant les chiffres\n{\n var _sum = 0;\n\n for(var i = 0; i < table.length; i=i+1)\n {\n _sum = _sum + table[i];\n }\n\n return _sum/table.length;\n}", "function getAverage(arr){\n var avg = 0;\n for(var i = 0; i < arr.length; i++){\n avg += arr[i];\n }\n avg = avg/arr.length;\n return avg;\n}", "function avg() {\n\t var clean = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : filter.ignoreMissing;\n\t\n\t return function (values) {\n\t var cleanValues = clean(values);\n\t if (!cleanValues) return null;\n\t var sum = _underscore2.default.reduce(cleanValues, function (a, b) {\n\t return a + b;\n\t }, 0);\n\t return sum / cleanValues.length;\n\t };\n\t}", "function question1 () {\n let priceAvg = []\n for (var i = 0; i < data.length; i++) {\n priceAvg.push(data[i].price)\n }\n let AvgReduced = priceAvg.reduce(function(a,b){return a + b})/data.length\n console.log(AvgReduced)\n}", "function mean(arr){\n var ave = 0;\n if(arr.length === 0){\n return null;\n }else{\n for (var i = 0; i < arr.length; i++) {\n ave += arr[i];\n }\n }return ave/arr.length;\n}", "function avg(arr) {\n\tlet total = 0;\n\t//loop over each num\n\tfor (let num of arr) {\n\t\t//add them together\n\t\ttotal += num;\n\t}\n\t//divide by number of nums\n\treturn total / arr.length;\n}", "function calculateAvgOf(attribute) {\n\tvar total = [],\n\t\tnumStudents = [],\n\t\taverages = [];\n\n\t// Initialize all array values to 0\n\tfor (var i = 0; i < 6; i++) {\n\t\ttotal.push(0);\n\t\tnumStudents.push(0);\n\t}\n\n\t// Looks at every row, take the alcohol consumption for that row\n\t// based on the specified attribute.\n\tfor (var i = 0; i < dataset.length; i++) {\n\t\tvar alcConsumption = Number(dataset[i][attribute]);\n\n\t\t// Find age of student in that row, subtract 15 to turn it into an \n\t\t// index from 0-5\n\t\t var ageIndex = Number(dataset[i].age) - 15;\n\n\t\t total[ageIndex] += alcConsumption;\n\t\t numStudents[ageIndex]++;\n\t}\n\n\tfor (var i = 0; i < 6; i++) {\n\t\taverages.push(total[i] / numStudents[i]);\n\t}\n\treturn averages;\n}", "function avg(arr) {\n\tvar sum = 0;\n\tfor (var i = arr.length - 1; i >= 0; i--) {\n\t\tsum += arr[i]\n\t}\n\treturn sum / arr.length\n}", "function calculateAverage(){\r\n var average = 0;\r\n for (var i=0; i<students.length;i++){\r\n average+=students[i].score; \r\n }\r\n //console.log(average/students.length);\r\n\r\n return (average/(students.length)); \r\n}", "function avg(arr) {\n const total = arr.reduce((sum, b) => (sum + b));\n return (total / arr.length);\n}", "function average (array) {\n\tvar total = 0;\nfor(var i = 0; i < array.length; i++){\n\t\ttotal = sum (array) / array.length;\n }return total;\n}", "function question1() {\n let totalPrice = 0;\n for (let i = 0; i < data.length; i++) {\n totalPrice += data[i].price\n }\n let avg = totalPrice / data.length;\n let avgPrice = Math.round(avg * 100) / 100;\n\n console.log(\"The average price is $\" + avgPrice);\n\n\n}", "function arrayAvg(x) {\n var avg=0;\n for (i=0; i<x.length; i++) {\n avg = avg + x[i];\n }\n avg = avg/x.length;\n return avg;\n}", "getAverageRating() {\n let ratingsSum = this.ratings.reduce((currentSum, rating) => currentSum + rating, 0);\n const lengthOfArray = this._ratings.length;\n return ratingsSum/lengthOfArray;\n }", "function find_average(array) {\n // your code here\n var sum = 0;\n array.forEach( element => sum += element); \n return sum / array.length;\n}", "function findAverage(arr){\n var sum = 0;\n for(var i = 0; i < arr.length; i++){\n sum = sum + arr[i]; //or: sum += arr[i]\n }\n var avg = sum / arr.length;\n console.log(avg); //or: return avg;\n}", "function average (array) {\n\tvar n = array.length ;\n\tvar a = 0 ;\n\tfor (var i=0 ; i<n ; i++) {\n\t\ta+= array[i]\n\t}\n\treturn a/n ;\n}", "function getAvg(stats) {\n let total = 0;\n for (let i = 0; i < stats.length; i++) {\n total += Number(stats[i])\n }\n\n let avg = total / stats.length\n console.log(\"average\", avg)\n return avg\n }", "function avg(num1, num2, num3) {\n return (num1 + num2 + num3) / 3; \n}", "function average(arr){\n var sum = 0;\n for(var i = 0; i < arr.length; i++){\n sum += arr[i];\n }\n return sum / arr.length;\n}", "function arrAvg(a){\n\tvar sum = 0;\n\tfor( var i = 0; i < a.length; i++ ){\n\t\t\tsum += a[i]\n\t}\n\n\tvar avg = sum/a.length;\n\treturn avg;\n}", "function average (array) {\n\tif (sum(array) === 0) {\n\treturn 0;\n\t}\n\telse {\n\ta = (sum(array)) / (array.length);\n\treturn a;\n\t}\n}", "function getAvg(array) {\n return array.reduce(function (p, c) {\n return p + c;\n }) / array.length;\n}", "getAverageGrades() {\n let total = 0\n for (let i = 0; i < this.grades.length; i++) {\n total += this.grades[i];\n }\n return total / this.grades.length\n }", "function calculateAverage(array_params){\n var sum = 0;\n for (var i= 0;i<array_params.length;i++){\n sum+=array_params[i];\n }\n var average = sum/array_params.length;\n return average\n}", "getAverageRating() {\n let ratingsSum = this.ratings.reduce((accumulator, rating) => accumulator + rating);\n return ratingsSum / this.ratings.length;\n }", "average() {\n const length = this.length();\n let sum = 0;\n // this.traverse(function (node) {\n // sum += node.value;\n // });\n this.traverse(node => sum += node.value);\n\n return this.isEmpty() ? null : sum / length;\n }", "function average(array) {\n var sum = 0;\n var i;\n\n for (i = -2; i < array.length; i += 1) {\n sum += array[i];\n }\n\n return sum / Object.keys(array).length;\n}", "function getAvg(grades) {\n var sum = 0;\n for (var i = 0; i < grades.length; i++) {\n sum += parseInt(grades[i], 10);\n }\n return sum / grades.length;\n }", "function calcuateAverage(arr) {\n let n = arr.length\n let sum = 0\n for (const element of arr) {\n sum = sum + element\n }\n return sum / n\n}", "function find_average(array) {\n var average = 0\n array.forEach(x => average += x)\n return average/array.length\n}", "function avg(arr){\n let denom = arr.length;\n let numerator = sum(arr);\n \n return numerator / denom;\n}", "function avg(num1, num2, num3){\n return (num1 + num2 + num3) / 3;\n}", "function getAverageAge(data) {\n let age = 0;\n for(let i = 0; i < data.length; i++) {\n let total = data[i]['age']\n age += total\n }\n return Math.trunc(age / getProfileCount(data))\n}", "function Average(arr){\n var av = 0;\n for(var i = 0 ; i < arr.length ;i++){\n av += arr[i]\n }\n av = av/arr.length\n return(av)\n}", "function avg(x, y, z) {\n return (x + y + z) / 3;\n}", "function findAvg(numArr) {\n var sum = 0;\n for (var i = 0; i < numArr.length; i++) {\n sum = sum + numArr[i];\n }\n avg = sum / numArr.length;\n return avg;\n}", "function arMean (a, b, c, d) {\n return (a + b + c + d) / 2;\n}" ]
[ "0.8258804", "0.8206199", "0.81998265", "0.80797553", "0.80615735", "0.8038417", "0.79780704", "0.79375184", "0.7774714", "0.75901926", "0.7577477", "0.7478954", "0.7475001", "0.7375702", "0.7371123", "0.7346446", "0.7333981", "0.7316082", "0.7303658", "0.73003805", "0.7281247", "0.7246135", "0.72433215", "0.72433215", "0.7232469", "0.7230322", "0.72004145", "0.7191736", "0.7183026", "0.7178474", "0.7163566", "0.71627647", "0.716046", "0.7151821", "0.71516484", "0.714353", "0.71400326", "0.7137205", "0.71344435", "0.7132928", "0.71237624", "0.71169966", "0.71168315", "0.7116104", "0.71135366", "0.71088743", "0.71034366", "0.7100579", "0.7100579", "0.7100579", "0.7100579", "0.7100579", "0.7100579", "0.7085604", "0.7081453", "0.70801836", "0.70768607", "0.7070777", "0.7055713", "0.7055627", "0.7048666", "0.70432997", "0.70371586", "0.7036322", "0.70329034", "0.7032094", "0.7031363", "0.70220935", "0.7014441", "0.70059717", "0.7003967", "0.7001376", "0.6995559", "0.6995542", "0.6993721", "0.69820315", "0.6978179", "0.69757086", "0.69710815", "0.6970441", "0.6963076", "0.6956472", "0.69531137", "0.6947519", "0.69405454", "0.69364804", "0.6935901", "0.6934761", "0.69323814", "0.69288844", "0.69238216", "0.6916298", "0.69160104", "0.69146", "0.6910389", "0.69080615", "0.6905361", "0.69002795", "0.6897312", "0.68972045", "0.68904126" ]
0.0
-1
calculate the distance from the the rssi
function distance_rssi(rssi_p){ var cal= -66; var dist; if(cal<rssi_p){ dist = Math.pow(10,rssi_p/cal) } else{ dist = (0.9*Math.pow(7.71,rssi_p/cal)+0.11)*0.001 } return dist }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapBeaconRSSI(rssi)\n {\n if (rssi >= 0) return 1; // Unknown RSSI maps to 1.\n if (rssi < -100) return 100; // Max RSSI\n return 100 + rssi;\n }", "function mapBeaconRSSI(rssi) {\n if (rssi >= 0)\n return 1; // Unknown RSSI maps to 1.\n if (rssi < -100)\n return 100; // Max RSSI\n return 100 + rssi;\n}", "get distance() {}", "calculer_distance() {}", "distance() {\n return this.speed * this.duration() / 3600000;\n }", "function distance(lRequirement, rRequirement, listening, reading) {\r\n var lr = Number.parseInt(lRequirement);\r\n var rr = Number.parseInt(rRequirement);\r\n var l = Number.parseInt(listening);\r\n var r = Number.parseInt(reading);\r\n if (l - lr < 0)\r\n return -1;\r\n if (r - rr < 0)\r\n return -1;\r\n return (l - lr) + (r - rr);\r\n}", "function getTotalDistance (result) {\n var total = 0;\n var myroute = result.routes[0];\n for (var i = 0; i < myroute.legs.length; i++) {\n total += myroute.legs[i].distance.value;\n }\n total /= 1000;\n return total;\n}", "GetDistanceToPoint() {}", "function calculate_distance() {\n\n currgal_length_in_Mpc = convert_ltyr_to_Mpc(currgal_length_in_ltyr);\n currgal_distance = currgal_length_in_Mpc / view_height_rad;\n\n print_distance(\"calculating.\");\n setTimeout(function () {\n print_distance(\"calculating..\")\n }, 500);\n setTimeout(function () {\n print_distance(\"calculating...\")\n }, 1000);\n setTimeout(function () {\n print_distance(Math.round(currgal_distance).toLocaleString() + \" Mpc\")\n }, 1500);\n }", "calDistance(lat1, lon1, lat2, lon2) {\n let R = 6371; // km\n let dLat = this.toRad(lat2 - lat1);\n let dLon = this.toRad(lon2 - lon1);\n let radlat1 = this.toRad(lat1);\n let radlat2 = this.toRad(lat2);\n let a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(radlat1) * Math.cos(radlat2);\n let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n let d = R * c;\n return d;\n }", "function get_distance(device, link_station) {\n return Math.sqrt((device[0] - link_station[0])**2 + (device[1] - link_station[1])**2);\n}", "function getDistance() {\r\n\talert('Detecting distance');\r\n\tnavigator.geolocation.getCurrentPosition(getDistanceFromPoint); \r\n}", "function computeTotalDistance(result) {\n var total = 0;\n var myroute = result.routes[0];\n for (var i = 0; i < myroute.legs.length; i++) {\n total += myroute.legs[i].distance.value;\n }\n total = total / 1000.0;\n}", "function getDistance() {\n var dLat = deg2rad(loc2X - loc1X); // deg2rad below\n var dLon = deg2rad(loc2Y - loc1Y);\n var a =\n Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.cos(deg2rad(loc1X)) *\n Math.cos(deg2rad(loc2X)) *\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 = rr * c; // Distance in km\n return d;\n}", "distance() {\n return distanceBetweenPoints(this.sourceAirport.latLng, this.destinationAirport.latLng);\n }", "function calculateDistance(pointer_1, pointer_2) {\n var dist = (google.maps.geometry.spherical.computeDistanceBetween(pointer_1, pointer_2) / 1000).toFixed(2);\n return parseFloat(dist);\n\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 RSSI(measurementType, RSSIValue, proximityBinThreshold) {\n\n if (typeof measurementType !== \"undefined\")\n this.measurementType = measurementType;\n\n if (typeof RSSIValue !== \"undefined\")\n this.RSSIValue = RSSIValue;\n\n if (typeof proximityBinThreshold !== \"undefined\") {\n \n this.thresholdConfigurationValue = (new Int8Array([proximityBinThreshold]))[0]; // Default -128 dB = \"Off\" -setting , spec. p. 36, specified in proximity search command\n }\n}", "function getDistance(x, y){\n return power2(x) + power2(y);\n }", "function findXY(bid_1, bid_2, bid_3, rssi_1, rssi_2, rssi_3) {\n console.log(String.format('Matching BID:({0},{1},{2})', bid_1, bid_2, bid_3));\n\n // obj storing x,y with min. error\n var min_err = {\n 'x': -1, 'y': -1, 'err': Number.MAX_SAFE_INTEGER\n };\n var row_matched = 0;\n\n // loop all the data\n for(var i = 0; i < data.length; i++) {\n var row = data[i];\n // match the beacon ids\n if(row.bid_1 == bid_1 && row.bid_2 == bid_2 && row.bid_3 == bid_3) {\n row_matched++;\n var sum_err = 0;\n sum_err = Math.pow(row.rssi_1 - rssi_1, 2) + Math.pow(row.rssi_2 - rssi_2, 2) + Math.pow(row.rssi_3 - rssi_3, 2);\n if(sum_err < min_err.err) {\n min_err.x = row.x;\n min_err.y = row.y;\n min_err.err = Math.sqrt(sum_err/3); // TODO: Modify the error function\n }\n }\n }\n console.log(String.format(\"Total matched: {0}\", row_matched));\n console.log(\"RESULT:\");\n console.log(min_err);\n return min_err;\n}", "function distance(p1, p2) { return length_v2(diff_v2(p1, p2)); }", "_getRemainingDistance()\r\n {\r\n let distanceList = this._navPath.distances;\r\n let distRemaining = 0;\r\n\r\n // Add distance to next waypoint.\r\n distRemaining += this._distanceToNext();\r\n\r\n for (let distIdx = this._waypointIdx + 1; distIdx < distanceList.length; distIdx++)\r\n {\r\n // Add distances between all successive waypoints.\r\n distRemaining += distanceList[distIdx]\r\n }\r\n\r\n // Return distance in metres.\r\n return distRemaining;\r\n }", "function DISTANCE(here, there) {\n \n var mapObj = Maps.newDirectionFinder();\n mapObj.setOrigin(here);\n mapObj.setDestination(there);\n \n var directions = mapObj.getDirections();\n var getTheLeg = directions[\"routes\"][0][\"legs\"][0];\n var mins = getTheLeg[\"duration\"][\"text\"];\n \n return mins;\n}", "calculateDistanceBetween(position, source) {\n if ((position.lat === source.lat) && (position.lng === source.lng)) {\n return 0\n }\n\n var radlat1 = Math.PI * position.lat/180\n var radlat2 = Math.PI * source.lat/180\n var theta = position.lng - source.lng\n var radtheta = Math.PI * theta/180\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta)\n if (dist > 1) {\n dist = 1\n }\n return Math.acos(dist) * 180/Math.PI * DISTANCE_BETWEEN_LATITUDE_IN_MILES * KILOMETRES_IN_A_MILE \n }", "function getDistance(location) {\n return Math.abs(location[0]) + Math.abs(location[1]);\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 getDistance(a, b) {\n return ((addresses[a][0] - addresses[b][0]) ** 2) + ((addresses[a][1] - addresses[b][1]) ** 2)\n}", "function rssi_ping (sig) {\n if (sig > 199) {\n frq_ping(30, 0.2, 0.3) // ERROR\n } else {\n if (sig < 30) sig = 30\n const frq = Math.pow(2, (100 - sig) / 12) * 100\n frq_ping(frq, 0.5, 0.15)\n }\n }", "function calculateDistance(lat1, lon1, lat2, lon2) {\n var R = 6371e3; // m\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 console.log(\"distance=\"+d + \"R = \"+ R);\n return Math.round(d);\n }", "distance(lat1, lon1) {\n if (lat1 === this.latitude && lon1 === this.longitude) {\n return 0;\n }\n else {\n const radlat1 = (Math.PI * lat1) / 180;\n const radlat2 = (Math.PI * this.latitude) / 180;\n const theta = lon1 - this.longitude;\n const radtheta = (Math.PI * theta) / 180;\n let dist = Math.sin(radlat1) * Math.sin(radlat2) +\n Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = (dist * 180) / Math.PI;\n dist = dist * 60 * 1.1515;\n dist = dist * 1.609344;\n return dist;\n }\n }", "function calcDistance(val){\n var factor = .9222;\n var expon = 1.0/.891;\n var tv = val;\n var temp = factor/tv;\n \n return Math.pow(temp,expon);\n}", "function calculateDistance(linkStation, device) {\n return Math.sqrt(Math.pow(device.x - linkStation.x, 2) + Math.pow(device.y - linkStation.y, 2));\n}", "compare(a, b){\n if(a.rssi < b.rssi){\n return 1\n }\n if(a.rssi > b.rssi){\n return -1\n }\n return 0\n }", "function gps_distance(lat1, lon1, lat2, lon2)\r\n{\r\n\t// http://www.movable-type.co.uk/scripts/latlong.html contains Algorithm\r\n var R = 6371; // km\r\n var dLat = (lat2-lat1) * (Math.PI / 180);\r\n var dLon = (lon2-lon1) * (Math.PI / 180);\r\n var lat1 = lat1 * (Math.PI / 180);\r\n var lat2 = lat2 * (Math.PI / 180);\r\n\r\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\r\n Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2);\r\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\r\n var d = R * c;\r\n\r\n return d;\r\n}", "function getDistance(x1,y1,x2,y2)\n{\n var xD = (x2-x1);\n var yD = (y2-y1);\n var power = Math.pow(xD,2)+Math.pow(yD,2);\n return Math.sqrt(power);\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 getFormatedRSSI(band, rssi, sta_status) {\n\tvar rssi_data = \"> \" + getDefaultRSSI(band) + \"dBm (Strong)\";\n\n\tif (rssi != 0) {\n\t\trssi_data = rssi + \"dBm\";\n\t\tif (sta_status.length > 0) {\n\t\t\trssi_data += \" (\" + sta_status + \")\";\n\t\t}\n\t}\n\n\treturn rssi_data;\n}", "function gps_distance(lat1, lon1, lat2, lon2) {\n // http://www.movable-type.co.uk/scripts/latlong.html\n var R = 6371; // km\n var dLat = (lat2 - lat1) * (Math.PI / 180);\n var dLon = (lon2 - lon1) * (Math.PI / 180);\n var lat1 = lat1 * (Math.PI / 180);\n var lat2 = lat2 * (Math.PI / 180);\n\n var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +\n Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n var d = R * c;\n\n return d;\n}", "GetDistance(lat1, lng1, lat2, lng2) {// coordinates of two GPS positions\n    var radLat1 = this.Rad(lat1);\n     var radLat2 = this.Rad(lat2);\n var a = radLat1 - radLat2;\n var b = this.Rad(lng1) - this.Rad(lng2);\n var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +\n     Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));\n     s = s * 6378.137;// EARTH_RADIUS;\n   s = Math.round(s * 10000) / 10000; //output unit is kilo\n     s = s.toFixed(2);//2 digitals after dot\n return s;\n }", "getStationDistanceToLocation(dest) {\n let currentStation = this.props.closestStations[0]\n if (!currentStation) return 0 // wtf?\n return Utils.getDistanceFromLatLonInKm(currentStation.latitude,currentStation.longitude,dest.latitude,dest.longitude).toFixed(2)\n\n }", "function get_total_distance(result) {\n var meters = 0;\n var route = result.routes[0];\n for (ii = 0; ii < route.legs.length; ii++) {\n // Google stores distance value in meters\n meters += route.legs[ii].distance.value;\n }\n //Make it km with 1 decimal\n km = make_km(meters);\n return km;\n}", "function getDistance(x1, y1, x2, y2) {\n return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));\n }", "calcDistance(lat1, lon1, lat2, lon2) {\n let radlat1 = Math.PI * lat1/180;\n \tlet radlat2 = Math.PI * lat2/180;\n \tlet theta = lon1-lon2;\n \tlet radtheta = Math.PI * theta/180;\n \tlet dist = Math.sin(radlat1) * Math.sin(radlat2)\n + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n \tdist = Math.acos(dist);\n \tdist = dist * 180/Math.PI;\n \tdist = dist * 60 * 1.1515;\n dist = dist * 1609.344;\n \treturn dist;\n }", "function get_power(device, link_station) {\n distance = get_distance(device, link_station)\n if (distance > link_station[2]) {\n return 0;\n } else {\n return (link_station[2] - distance)**2\n }\n}", "function getDistance(x1, y1, x2, y2)\r\n{\r\n\treturn (((x2-x1)**2)+((y2-y1)**2))**(1/2);\r\n}", "function getDistance(lat1, lon1, lat2, lon2) {\n let R = 6371; // Radius of the earth in km\n let dLat = deg2rad(lat2 - lat1); // deg2rad below\n let dLon = deg2rad(lon2 - lon1);\n let 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 let c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));\n let d = R * c; // Distance in km\n\n distanceArray.push(d);\n \n }", "function processPinProximData()\n \t{\n \t\tvar pinData = null;\n \t\t\n \t\t// Reads the specified pin data from buffer\n \t\tpinData = storedData.pinA2;\n \t\t\n \t\tvar analogVal = ((pinData[0] & 0xFF) << 8) | (pinData[1] & 0xFF); // Combines high and low bytes\n \t\t\n \t\t// Convert analog value into the number of volts (2.048 = 0.01V)\n \t\tanalogVal = analogVal / 2.048 / 100;\n \t\t\n \t\tconsole.log(analogVal);\n \t\t// If analog value is valid, calculate corresponding distance else return 0\n \t\tif(analogVal < 3.5 && analogVal > 0)\n \t\t{\n \t\t\treturn Math.pow((analogVal / 15.556), (1/-0.832));\n \t\t}\n \t\telse\n \t\t{\n \t\t\treturn 0;\n \t\t}\n \t\t\n \t}", "distance(_pos1, _pos2) {\n return Math.sqrt(Math.pow(_pos2[0] - _pos1[0], 2) + Math.pow(_pos2[1] - _pos1[1], 2));\n }", "function calcDistance(p1, p2) {\n\n return (google.maps.geometry.spherical.computeDistanceBetween(p1, p2) / 628).toFixed(3);\n }", "function patternDistance ( refPattern, targetPattern){\n var accent1 = refPattern[0];\n var weight1 = refPattern[1];\n var accent2 = targetPattern[0];\n var weight2 = targetPattern[1];\n\n var distanceMeasure = accent2.map(function(s,index){\n\treturn (s - accent1[index]) * (weight2[index] - weight1[index]);\n });\n\n var diff = distanceMeasure.reduce(sum); \n \n function sum(a,b){\n\treturn a + b;\n }\n console.log(diff);\n return diff;\t\n}", "function getDistance(){\n if (departure.value == \"dep-auck\" && destination.value == \"dest-taup\" || departure.value == \"dep-taup\" && destination.value == \"dest-auck\"){\n tripDistance = distance.taupAuck;\n }\n else if (departure.value == \"dep-well\" && destination.value == \"dest-taup\" || departure.value == \"dep-taup\" && destination.value == \"dest-well\"){\n tripDistance = distance.wellTaup;\n }\n else if (departure.value == \"dep-well\" && destination.value == \"dest-auck\" || departure.value == \"dep-auck\" && destination.value == \"dest-well\"){\n tripDistance = distance.auckWell;\n }\n }", "distance(x0, y0, x1, y1) {\n return Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2));\n }", "getNeighborDistance(node1, node2) {\n const R = 6371e3; // meters\n const phi1 = node1.y * Math.PI / 180;\n const phi2 = node2.y * Math.PI / 180;\n const deltaLat = (node2.y - node1.y) * Math.PI / 180;\n const deltaLong = (node2.x - node1.x) * Math.PI / 180;\n\n const a = Math.sin(deltaLat / 2) * Math.sin(deltaLat / 2) +\n Math.cos(phi1) * Math.cos(phi2) *\n Math.sin(deltaLong / 2) * Math.sin(deltaLong / 2);\n const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n\n const distance = R * c;\n\n // 150 lb person burns 4 calories/minute @ 1.34112 meters/sec. (https://caloriesburnedhq.com/calories-burned-walking/)\n // For every 1% of grade, increase calories burned by about 0.007456472% more calories per meter for a 150-pound person (https://www.verywellfit.com/how-many-more-calories-do-you-burn-walking-uphill-3975557) \n let secondsToTravel = (distance / 1.34112);\n let percentGrade = (node2.elevation - node1.elevation) / distance || 1;\n let calorieMultiplierFromElevation = 0.00007456472 / percentGrade / 100;\n let caloriesBurned = (4 / 60) * secondsToTravel;\n caloriesBurned += (calorieMultiplierFromElevation * caloriesBurned);\n\n return {\n distance: distance,\n calories: caloriesBurned,\n grade: percentGrade\n };\n }", "function getPatientDistance(patientA, patientB) {\n var delta = 0;\n\n // Get the delta for each position, not including the patient status.\n for (var i = 0; i < patientA.length - 1; i++) {\n delta += Math.abs(parseInt(patientA[i]) - parseInt(patientB[i]));\n }\n\n return delta;\n}", "function totalDistance(legsArray) {\n var result = 0;\n for(var i=0; i<legsArray.length; i++) {\n result += legsArray[i].distance.value;\n }\n return result;\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 distance_estimate(station1id, station2id) {\n\tif ((typeof station1id == \"undefined\") || (isNaN(parseInt(station1id)))) {\n\t\tthrow new Error(\"Cannot find straight line distance between stations \" + station1id + \" and \" + station2id + \" because \" + station1id + \" is not a valid id\");\n\t}\n\tif ((typeof station2id == \"undefined\") || (isNaN(parseInt(station2id)))) {\n\t\tthrow new Error(\"Cannot find straight line distance between stations \" + station1id + \" and \" + station2id + \" because \" + station2id + \" is not a valid id\");\n\t}\n\n\tif (station1id == station2id) {\n\t\treturn 0;\n\t}\n\n\tvar station1 = getById(stations, parseInt(station1id));\n\tvar station2 = getById(stations, parseInt(station2id));\n\n\t//more error checking\n\tif (typeof station1 == \"undefined\") {\n\t\tthrow new Error(\"Cannot find straight line distance between stations \" + station1id + \" and \" + station2id + \" because there is no station with id \" + station1id);\n\t}\n\tif (typeof station2 == \"undefined\") {\n\t\tthrow new Error(\"Cannot find straight line distance between stations \" + station1id + \" and \" + station2id + \" because there is no station with id \" + station2id);\n\t}\n\n\t//if joined, then count as one station\n\tvar neighbours = station1.getNeighbours();\n\tfor (var i = 0; i < neighbours.length; i++) {\n\t\tif (neighbours[i][0] == station2id) {\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\t//find straight line distance between all pairs of markers at the stations. return the shortest distance.\n\tvar shortest = 99999;\n\tfor (var i = 0; i < station2.mapMarkers.length; i++) {\n\t\tvar marker2 = station2.mapMarkers[i];\n\t\t\n\t\tfor (var j = 0; j < station1.mapMarkers.length; j++) {\n\t\t\tvar marker1 = station1.mapMarkers[j];\n\t\t\tvar distance = Math.sqrt(Math.pow(marker2.x - marker1.x, 2) + Math.pow(marker2.y - marker1.y, 2));\n\t\t\tshortest = Math.min(shortest, distance);\n\t\t}\n\t}\n\treturn shortest;\n}", "distance(lat1, lon1, lat2, lon2, unit) {\n if ((lat1 == lat2) && (lon1 == lon2)) {\n return 0;\n }\n else {\n var radlat1 = Math.PI * lat1 / 180;\n var radlat2 = Math.PI * lat2 / 180;\n var theta = lon1 - lon2;\n var radtheta = Math.PI * theta / 180;\n var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);\n if (dist > 1) {\n dist = 1;\n }\n dist = Math.acos(dist);\n dist = dist * 180 / Math.PI;\n dist = dist * 60 * 1.1515;\n if (unit == \"K\") { dist = dist * 1.609344 }\n if (unit == \"N\") { dist = dist * 0.8684 }\n if (dist > 80) {\n alert(AorE.A == true ? LangAr.Distance : LangEn.Distance)\n }\n }\n }", "perimeterDistance(v1, v2) {\n return this.distance(this.tracePerimeter(v1, v2, true))\n }", "function getDistance(x1,y1,x2,y2){\r\n\tlet xOff = x1 - x2;\r\n\tlet yOff = y1 - y2;\r\n\treturn Math.sqrt(xOff * xOff + yOff * yOff);\r\n}", "distance(loc) {\n var lat1 = loc[LAT];\n var lon1 = loc[LONG];\n\n var lat2 = lat1; // default lat2 to safe default value\n var lon2 = lon1; // default lat2 to safe default value\n\n if (navigator.geolocation) {\n navigator.geolocation.getCurrentPosition((p)=>{\n lat2 = p.coords.latitude;\n lon2 = p.coords.longitude;\n }, \n (e)=>{});\n }else{\n return 0; // oops! Cannot get geolocation return a safe distance \n }\n\n var lat1 = loc[0]; //const LAT = 0;\n var lon1 = loc[1]; //const LONG = 1;\n var theta = lon1 - lon2;\n // var dist = Math.sin(Math.deg2rad(lat1)) * Math.sin(Math.deg2rad(lat2)) \n // + Math.cos(Math.deg2rad(lat1)) * Math.cos(Math.deg2rad(lat2)) * Math.cos(Math.deg2rad(theta));\n var dist = mySin(lat1) * mySin(lat2) \n + myCos(lat1) * myCos(lat2) * myCos(theta);\n dist = Math.rad2deg( Math.acos( dist ) );\n //dist = Math.rad2deg(dist);\n var miles = dist * 60 * 1.1515;\n return miles;\n }", "function distanzaAppartamenti(lat1,lon1,lat2,lon2)\n {\n var R = 6372.8; // Earth Radius in Kilometers\n\n var dLat = deg2Rad(lat2-lat1);\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;\n\n // Return Distance in Kilometers\n return d;\n }", "function distanceFromSpaceStation() {\n prompt.start();\n prompt.get(['city'],function(err, result) {\n var requestAddress = 'https://maps.googleapis.com/maps/api/geocode/json?address=' + result.city;\n request(requestAddress, function(err, result) {\n var resultObject = JSON.parse(result.body);\n lat1 = resultObject.results[0].geometry.location.lat;\n lon1 = resultObject.results[0].geometry.location.lng;\n console.log(lat1);\n console.log(lon1);\n var issAddress = 'http://api.open-notify.org/iss-now.json';\n request(issAddress, function(err, result) {\n var resultObject = JSON.parse(result.body);\n lat2 = resultObject.iss_position.latitude.toFixed(2);\n lon2 = resultObject.iss_position.longitude.toFixed(2);\n console.log(distanceBetweenTwoPoints(lat1, lon1, lat2, lon2));\n });\n });\n });\n}", "function computeTotalDistance(result) {\n var total = 0;\n var myroute = result.routes[0];\n for (var i = 0; i < myroute.legs.length; i++) {\n total += myroute.legs[i].distance.value;\n }\n total = total / 1000.0;\n // document.getElementById('total').innerHTML = total + ' km';\n // pushing new destination info\n destinationInfo.push({\n label: \"distance\",\n value: total + \" km\"\n });\n}", "function calculateDistance(x1,x2,y1,y2){\n return Math.sqrt(Math.pow((x2-x1),2)+Math.pow((y2-y1),2));\n}", "function _distFromCharger(pos) {\n\tvar delta = Math.abs(pos.x - _charger.x) + Math.abs(pos.y - _charger.y);\n\treturn delta;\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 calcDistance(p1, p2) {\n var valorKm = parseFloat((google.maps.geometry.spherical.computeDistanceBetween(p1, p2) / 1000).toFixed(2));\n\n if (valorKm <= parseInt(radioAccionHome)) { dentroRango = 1; }\n else { dentroRango = 0; }\n return dentroRango;\n}", "function calculateDistance(p1x, p1y, p2x, p2y) {\n\t\t\tvar xDistance = p1x - p2x,\n\t\t\t\tyDistance = p1y - p2y;\n\t\t\treturn Math.sqrt(Math.pow(xDistance, 2) + Math.pow(yDistance, 2));\n\t\t}", "function getDistance(data) {\n var nextStopId = data.data.entry.status.nextStop;\n var prevStopId = data.data.entry.schedule.stopTimes[0].stopId;\n var prevStopTime = data.data.entry.schedule.stopTimes[0].arrivalTime;\n var prevStopDist = data.data.entry.schedule.stopTimes[0].distanceAlongTrip;\n var i = 0;\n while(i < data.data.entry.schedule.stopTimes.length - 1 && data.data.entry.schedule.stopTimes[i].stopId != nextStopId) {\n prevStopId = data.data.entry.schedule.stopTimes[i].stopId;\n prevStopTime = data.data.entry.schedule.stopTimes[i].arrivalTime;\n prevStopDist = data.data.entry.schedule.stopTimes[i].distanceAlongTrip;\n i++;\n }\n nextStopTime = data.data.entry.schedule.stopTimes[i].arrivalTime;\n nextStopDist = data.data.entry.schedule.stopTimes[i].distanceAlongTrip;\n if(i == 0) return data.data.entry.schedule.stopTimes[data.data.entry.schedule.stopTimes.length - 1].distanceAlongTrip - prevStopDist;\n return nextStopDist - prevStopDist;\n}", "function getDistance(nodeA, nodeB) {\n var diagonal = document.getElementById(\"diagonal-flag\").checked;\n var dx = Math.abs(nodeA.row - nodeB.row);\n var dy = Math.abs(nodeA.col - nodeB.col);\n if (diagonal === false) {\n //Manhattan Distance\n return dx + dy;\n } else {\n // Diagonal Distance\n if (dx > dy) {\n return 1.4 * dy + 1 * (dx - dy);\n }\n return 1.4 * dx + 1 * (dy - dx);\n }\n}", "getDistance(x1, y1, x2, y2){\r\n let dx = x2 - x1;\r\n let dy = y2 - y1;\r\n\r\n return Math.sqrt(Math.pow(dx,2) + Math.pow(dy,2));\r\n }", "function match_bitapScore_(e, x) {\n var accuracy = e / pattern.length,\n proximity = Math.abs(loc - x)\n\n if (!Match_Distance) {\n // Dodge divide by zero error.\n return proximity ? 1.0 : accuracy\n }\n return accuracy + proximity / Match_Distance\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 }", "distance(p) {\n return Math.sqrt(this.squaredDistance(p));\n }", "function calcDistance(x1, y1, x2, y2)\n{\n\treturn Math.sqrt(Math.pow((x2 - x1),2) + Math.pow((y2 - y1),2));\n}", "function calculateDistance(request,i) {\n let distance1;\n let URL = \n `https://maps.googleapis.com/maps/api/distancematrix/json?origins=${coordinates.lat},${coordinates.lng}&destinations=${request.roughLocationCoordinates[0]},${request.roughLocationCoordinates[1]}&key=${process.env.REACT_APP_GMAP_API_KEY}`;\n console.log(\"Entered\");\n \n axios.get(URL)\n .then((response) => {\n console.log(response,16);\n distance1 = response.data.rows[0].elements[0].distance.value;\n allRequests[i].distance = distance1/1000;\n })\n .catch((error) => {\n console.log(error,1010);\n });\n console.log(\"f*\",distance1);\n }", "function calculateDistance(p1x, p1y, p2x, p2y) {\n var xDistance = p1x - p2x,\n yDistance = p1y - p2y;\n return Math.sqrt(Math.pow(xDistance, 2) + Math.pow(yDistance, 2));\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 heuristicDistance(x, y) {\n return Math.pow(gravityCenter.x - x, 2) + Math.pow(gravityCenter.y - y, 2)\n }", "function findDistance(x,y){\n return Math.sqrt(Math.pow(x,2)+Math.pow(y,2));\n}", "set ['distance'](val){\r\n\t\tthis.d = val * this.shapeOfDif;\r\n\t\tthis.dist = val;\r\n\t\tthis.calculateDiffGradient();\r\n\t}", "getDistance(curLat, curLon, destLat, destLon) {\n\t\tif (curLat === 0 || curLon === 0)\n\t\t\treturn \"-\";\n\t\tvar x = destLat - curLat;\n\t\tx = x * x;\n\n\t\tvar y = destLon - curLon;\n\t\ty = y * y;\n\n\t\tx = Math.sqrt(x + y) * 65.02;\n\n\t\treturn x.toFixed(2);\n\t}", "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 getDistance(x1, y1, x2, y2) {\n\treturn Math.sqrt(Math.pow((x1 - x2), 2) + Math.pow((y1 - y2), 2));\n}", "function updateOdometer(distance){\n odometer += distance;\n }", "function updateOdometer(distance){\n odometer += distance;\n }", "function computeTotalDistance(result) {\n var total = 0;\n var myroute = result.routes[0];\n for (var i = 0; i < myroute.legs.length; i++) {\n total += myroute.legs[i].distance.value;\n }\n total = total / 1000;\n document.getElementById('distancia_value').innerHTML = total + ' km';\n}", "distanceRan(){\n var resultDist = google.maps.geometry.spherical.computeDistanceBetween(this._startLocation, this._endLocation);\n this._distanceRan = resultDist;\n return resultDist.toFixed(2);\n }", "function distance(x1,y1,x2,y2) {\n return sqrt(pow(x2-x1,2)+pow(y2-y1,2)) \n}", "function totalDistance(height, length, tower) {\n\tlet numberStair = 0;\n numberOfStair = tower / height;\n totaldistance = numberOfStair * (height + length);\n return totaldistance.toFixed(1)*1;\n}", "distance() {\n return this.get('DISTANCE');\n }", "function distance_calc(loc1, loc2){\n\treturn getDistanceFromLatLonInKm(loc1.lat, loc1.lng, loc2.lat, loc2.lng);\n}", "function getDistance(p1, p2){\r\n\tvar dLon = Math.radians(p2.lng - p1.lng); \r\n\tvar dLat = Math.radians(p2.lat - p1.lat);\r\n\tvar lat1 = Math.radians(p1.lat);\r\n\tvar lat2 = Math.radians(p2.lat);\r\n\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2); \r\n\tvar c = 2 * Math.atan2( Math.sqrt(a), Math.sqrt(1-a) ) ;\r\n\tvar output = 6371 * c ;\r\n\treturn output;\r\n}", "function calcDistanceFrom(lat1, lon1, lat2, lon2) {\n\tvar R = 6371; // km\n\tvar dLat = toRad(lat2-lat1);\n\tvar dLon = toRad(lon2-lon1);\n\tlat1 = toRad(lat1);\n\tlat2 = toRad(lat2);\n\n\tvar a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n\t\tMath.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2);\n\tvar c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); \n\tvar d = R * c;\n\treturn d;\n}", "function calculateDistance(lat1, lon1, lat2, lon2) {\n var R = 6371; // km\n var dLat = (lat2-lat1).toRad();\n var dLon = (lon2-lon1).toRad();\n var a = Math.sin(dLat/2) * Math.sin(dLat/2) +\n Math.cos(lat1.toRad()) * Math.cos(lat2.toRad()) *\n Math.sin(dLon/2) * Math.sin(dLon/2);\n var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));\n var d = R * c;\n return d;\n}", "function getDistance(x1,y1,x2,y2) {\n\treturn Math.sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));\n}", "get shadowDistance() {}", "Dis(x2, y2) {\n var x1 = 0;\n var y1 = 0;\n\n console.log(\"X1 is \" + x1);\n console.log(\"Y is \" + y1);\n\n var xs = (x2 - x1);\n var ys = (y2 - y1);\n xs *= xs;\n ys *= ys;\n\n var distance = Math.sqrt(xs + ys);\n console.log(\"Result is =>\" + distance);\n\n }", "function getDistance(p1, p2) {\n return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));\n}" ]
[ "0.65244526", "0.647684", "0.6271676", "0.6180164", "0.5978584", "0.59419155", "0.59161425", "0.5910772", "0.5836793", "0.5821521", "0.58053833", "0.5753798", "0.5730081", "0.57222176", "0.571949", "0.5654595", "0.56274945", "0.562134", "0.5585668", "0.5531825", "0.54504734", "0.54362464", "0.54044425", "0.5402833", "0.53960925", "0.53888756", "0.5380199", "0.5367861", "0.5364444", "0.53586274", "0.5354365", "0.5345241", "0.53230834", "0.5305366", "0.528358", "0.52821064", "0.52729267", "0.5271549", "0.5266755", "0.5266427", "0.52639824", "0.5260425", "0.52594197", "0.52563655", "0.524997", "0.5249217", "0.52474004", "0.5229881", "0.52269226", "0.5217955", "0.5211988", "0.52034426", "0.52022916", "0.5200602", "0.5196115", "0.5194156", "0.5189694", "0.5187092", "0.51869595", "0.51758313", "0.5175797", "0.5173285", "0.516214", "0.5161919", "0.51546335", "0.5145528", "0.5143689", "0.5141035", "0.51351446", "0.512939", "0.51133347", "0.5112244", "0.5107864", "0.510673", "0.5104823", "0.51036656", "0.51026875", "0.51021403", "0.5101501", "0.5101289", "0.5098827", "0.50970894", "0.5095038", "0.50897783", "0.50864637", "0.50836", "0.50836", "0.50764656", "0.5075131", "0.5073884", "0.50719833", "0.50623786", "0.5061159", "0.50601226", "0.5059033", "0.5056933", "0.50566995", "0.50564057", "0.50519997", "0.5051893" ]
0.8016069
0
Begin Of accelerationDevice get acceleration Device
function accelerationDevice(){ var acc; $('#ShowBeacons').empty(); setInterval(function(){navigator.accelerometer.getCurrentAcceleration( function(acceleration) { acc +='<p>Acceleration X: ' + acceleration.x + '</p>\n' + '<p>Acceleration Y: ' + acceleration.y + '</p>\n' + '<p>Acceleration Z: ' + acceleration.z + '</p>\n' + '<p>Timestamp: ' + acceleration.timestamp + '</p>\n<p>------------------</p>'; $('#ShowBeacons').append(acc); }, function() {alert('onError!');} );},5000); }//Ende of accelerationDevice
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get Acceleration() {}", "accelerometer() {\n this.setup();\n\n let accel = [0, 0, 0];\n\n //\n // taken from https://github.com/pimoroni/enviro-phat/pull/31/commits/78b1058e230c88cc5969afa210bb5b97f7aa3f82\n // as there is no real counterpart to struct.unpack in js\n //\n // in order to read multiple bytes the high bit of the sub address must be asserted\n accel[X] = twos_comp(this.i2c_bus.read_word_data(this.addr, OUT_X_L_A|0x80), 16);\n accel[Y] = twos_comp(this.i2c_bus.read_word_data(this.addr, OUT_Y_L_A|0x80), 16);\n accel[Z] = twos_comp(this.i2c_bus.read_word_data(this.addr, OUT_Z_L_A|0x80), 16);\n\n for (let i = X; i < Z + 1; i += 1) {\n this._accel[i] = accel[i] / Math.pow(2, 15) * ACCEL_SCALE;\n }\n\n return new Vector(this._accel);\n }", "static get acceleration() {}", "function getAccelerationSnapshot() {\n navigator.accelerometer.getCurrentAcceleration(assessCurrentAcceleration, handleError);\n }", "function Accelerometer() {\n\t/*\n\t * The last known acceleration.\n\t */\n\tthis.lastAcceleration = null;\n}", "function Accelerometer() {\n /**\n * The last known acceleration.\n */\n this.lastAcceleration = null;\n}", "function Accelerometer() {\n\t/**\n\t * The last known acceleration.\n\t */\n\tthis.lastAcceleration = null;\n}", "function Accelerometer()\n{\n\t/**\n\t * The last known acceleration.\n\t */\n\tthis.lastAcceleration = new Acceleration(0, 0, 0);\n\n // private callback called from Obj-C by name\n this._onAccelUpdate = function(x, y, z)\n {\n this.lastAcceleration = new Acceleration(x, y, z);\n }\n\n /**\n * Asynchronously aquires the current acceleration.\n * @param {Function} successCallback The function to call when the acceleration\n * data is available\n * @param {Function} errorCallback The function to call when there is an error\n * getting the acceleration data.\n * @param {AccelerationOptions} options The options for getting the accelerometer data\n * such as timeout.\n */\n this.getCurrentAcceleration = function(successCallback, errorCallback, options)\n {\n // If the acceleration is available then call success\n // If the acceleration is not available then call error\n\n // Created for iPhone, Iphone passes back _accel obj litteral\n if (typeof successCallback == \"function\")\n {\n successCallback(this.lastAcceleration);\n }\n }\n\n /**\n * Asynchronously aquires the acceleration repeatedly at a given interval.\n * @param {Function} successCallback The function to call each time the acceleration\n * data is available\n * @param {Function} errorCallback The function to call when there is an error\n * getting the acceleration data.\n * @param {AccelerationOptions} options The options for getting the accelerometer data\n * such as timeout.\n */\n this.watchAcceleration = function(successCallback, errorCallback, options)\n {\n //this.getCurrentAcceleration(successCallback, errorCallback, options);\n // TODO: add the interval id to a list so we can clear all watches\n var frequency = (options != undefined && options.frequency != undefined) ? options.frequency : 10000;\n var updatedOptions = {desiredFrequency: frequency};\n navigator.comcenter.exec(\"Accelerometer.start\", options);\n\n var self = this;\n return setInterval(function() {self.getCurrentAcceleration(successCallback, errorCallback, options)}, frequency);\n }\n\n /**\n * Clears the specified accelerometer watch.\n * @param {String} watchId The ID of the watch returned from #watchAcceleration.\n */\n this.clearWatch = function(watchId)\n {\n navigator.comcenter.exec(\"Accelerometer.stop\");\n clearInterval(watchId);\n }\n}", "function example3() {try {kony.accelerometer.retrieveCurrentAcceleration(onSuccessCallback, onFailureCallback);} catch (err) {alert(\"Accelerometer not supported\");}}", "static set acceleration(value) {}", "get enableAccelerationInput() {\n return this._enableAcceleration;\n }", "function YAccelerometer_FirstAccelerometer()\n {\n var next_hwid = YAPI.getFirstHardwareId('Accelerometer');\n if(next_hwid == null) return null;\n return YAccelerometer.FindAccelerometer(next_hwid);\n }", "get acceleration() {\n return configs.accelerationKMPHPS / 3600000000;\n }", "calculateAcceleration(){\n\t\treturn new THREE.Vector3(0,0,0);\n\t}", "function startWatch() {\n\n// Update acceleration every 3 seconds\nvar options = { frequency: 3000 };\n\nwatchID = navigator.accelerometer.watchAcceleration(onSuccess_accelerometer2, onError_accelerometer2, options);\n }", "function YAccelerometer_nextAccelerometer()\n { var resolve = YAPI.resolveFunction(this._className, this._func);\n if(resolve.errorType != YAPI_SUCCESS) return null;\n var next_hwid = YAPI.getNextHardwareId(this._className, resolve.result);\n if(next_hwid == null) return null;\n return YAccelerometer.FindAccelerometer(next_hwid);\n }", "function yFirstAccelerometer()\n{\n return YAccelerometer.FirstAccelerometer();\n}", "function handleDeviceMotion1(event) {\n\t// here we will access a \"devicemotion\" attribute \"acceleration\"\n\t// w/in acceleration we will get acceleration in the x-axis\n\t// document.getElementById('acc_text').innerHTML = event.acceleration.x;\n\tdocument.getElementById(\"acc_text\").innerHTML = event.acceleration.x;\n\n\t// w/in devicemotion we have a few different accelerometer options\n\t// to choose from. acceleration, accelerationIncludingGravity\n\t// and rotation rate (radians per second squared)\n\t// e.g.\n\t// event.accelerationIncludingGravity.x\n\t// event.rotationRate.alpha\n}", "get flightAcceleration() {\n return configs.flightAccelerationKMPHPS / 3600000000;\n }", "set Acceleration(value) {}", "async setDeviceCharacteristic() {\n const service = await this.device.gatt.getPrimaryService(0xfff1);\n const vendor = await service.getCharacteristic(\n \"d7e84cb2-ff37-4afc-9ed8-5577aeb84542\"\n );\n this.cpuVendor = vendor;\n\n const speed = await service.getCharacteristic(\n \"d7e84cb2-ff37-4afc-9ed8-5577aeb84541\"\n );\n this.cpuSpeed = speed;\n }", "function getAccelBetweenPoints(prev, curr, prevTick) {\n let tick = new Date();\n let delta = tick - prevTick;\n let accel = (curr - prev) / delta;\n return accel;\n}", "function startWatch() { \n // Update acceleration every 0.1 seconds \n var options = { frequency: 100 }; \n watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options); \n }", "function start() {\n exec(function (a) {\n var tempListeners = listeners.slice(0);\n accel = new Acceleration(a.x, a.y, a.z, a.timestamp);\n for (var i = 0, l = tempListeners.length; i < l; i++) {\n tempListeners[i].win(accel);\n }\n }, function (e) {\n var tempListeners = listeners.slice(0);\n for (var i = 0, l = tempListeners.length; i < l; i++) {\n tempListeners[i].fail(e);\n }\n }, \"Accelerometer\", \"start\", []);\n running = true;\n}", "function start() {\n exec(function(a) {\n var tempListeners = listeners.slice(0);\n accel = new Acceleration(a.x, a.y, a.z, a.timestamp);\n for (var i = 0, l = tempListeners.length; i < l; i++) {\n tempListeners[i].win(accel);\n }\n }, function(e) {\n var tempListeners = listeners.slice(0);\n for (var i = 0, l = tempListeners.length; i < l; i++) {\n tempListeners[i].fail(e);\n }\n }, \"Accelerometer\", \"start\", []);\n running = true;\n}", "get device() {\n\t\treturn this.__device;\n\t}", "_setupAccelerometer () {\n this._gyroscope = new GyroNorm()\n this._gyroscope.init().then(() => {\n this._gyroscope.start(this._handleAccelerometer.bind(this))\n }).catch((e) => {\n logger.warn('Accelerometer is not supported by this device')\n })\n }", "function enableAccel() {\n\t\tconsole.log('enableAccelerometer');\n\t\ttag.enableAccelerometer(notifyMe);\n\t}", "function onSuccess_accelerometer2(acceleration) {\nvar element = document.getElementById('accelerometervalue');\nelement.innerHTML = 'Acceleration X: ' + acceleration.x + ', ' +\n\t\t\t\t'Acceleration Y: ' + acceleration.y + ', ' +\n\t\t\t\t'Acceleration Z: ' + acceleration.z + '\\n' +\n\t\t\t\t'Timestamp: ' + acceleration.timestamp + '\\n';\n }", "function onAccelerationSuccess(acceleration) {\nalert( 'Acceleration X: ' + acceleration.x + ', Acceleration Y: ' + acceleration.y \n+ ', Acceleration Z: ' + acceleration.z );\n}", "function Accelerometer(options) {\n var sp,\n self = this;\n\n options = options || {};\n events.EventEmitter.call(this);\n\n try {\n fs.statSync(devicePath);\n } catch (e) {\n throw new Error('device not found');\n }\n sp = new SerialPort(devicePath, {\n baudRate: 115200,\n });\n\n this.close = function () {\n sp.close();\n };\n\n sp.on('open', function () {\n logger.info('start ap..', startAccessPoint);\n\n sp.write(startAccessPoint);\n sp.write(accDataRequest);\n\n sp.on('data', function (data) {\n var x, y, z, on,\n timeout = 0,\n buf = new Buffer(data);\n if (data.length >= 7) {\n x = buf.readInt8(5);\n y = buf.readInt8(4);\n z = buf.readInt8(6);\n on = (buf[3] === 1);\n if (on) {\n off_times = 0;\n if (options.freeFallDetection) {\n //console.log('x:' + x + ' y:' + y + ' z:' + z);\n if (Math.abs(x) > FREE_FALL_THRESHOLD && Math.abs(y) > FREE_FALL_THRESHOLD && \n Math.abs(z) > FREE_FALL_THRESHOLD) {\n logger.info('freefall: ' + ' x:' + x + ' y:' + y + ' z:' + z);\n self.emit('freefall');\n } \n }\n } else {\n off_times++;\n }\n } else {\n off_times++;\n //logger.debug((new Date()).getTime() + ' invalid data', buf);\n }\n if (off_times > MAX_OFF_TIMES) {\n off_times = 0;\n timeout = POLL_INTERVAL;\n } \n setTimeout(function () {sp.write(accDataRequest); }, timeout);\n });\n sp.on('close', function (err) {\n logger.info('port closed');\n self.emit('close');\n });\n sp.on('error', function (err) {\n logger.error('error', err);\n self.emit('error', err);\n });\n });\n}", "get device () {\n\t\treturn this._device;\n\t}", "function startWatch() {\n\n // Update acceleration every 1000/60 seconds\n var options = { frequency: 1000/60 };\n\n watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);\n }", "function startWatch() {\n\n // Update acceleration every 3 seconds\n var options = { frequency: 100 };\n\n watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);\n }", "function startWatch() {\n \n var previousReading = {\n x: null,\n y: null,\n z: null\n }\n \n navigator.accelerometer.watchAcceleration(function (acceleration) {\n var changes = {},\n bound = 0.2;\n if (previousReading.x !== null) {\n changes.x = Math.abs(previousReading.x, acceleration.x);\n changes.y = Math.abs(previousReading.y, acceleration.y);\n changes.z = Math.abs(previousReading.z, acceleration.z);\n }\n \n if (changes.x > bound && changes.y > bound && changes.z > bound) {\n shaken();\n }\n \n previousReading = {\n x: acceleration.x,\n y: acceleration.y,\n z: acceleration.z\n }\n \n }, onError, { frequency: 2000 });\n }", "function accelerate(){this.velInfluence = accelerator;}", "function onSuccess_accelerometer1(acceleration) {\nalert('Acceleration X: ' + acceleration.x + '\\n' +\n\t 'Acceleration Y: ' + acceleration.y + '\\n' +\n\t 'Acceleration Z: ' + acceleration.z + '\\n' +\n\t 'Timestamp: ' + acceleration.timestamp + '\\n');\n }", "function startWatch() {\n\n\t\t\t// Update acceleration every x seconds\n\t\t\tvar options = { frequency: 100 };\n\n\t\t\twatchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);\n\t\t}", "function onAccelerationSuccess(acceleration) {\n currentAccelerationResult.innerHTML = 'Acceleration X: ' + acceleration.x + '<BR>' +\n 'Acceleration Y: ' + acceleration.y + '<BR>' +\n 'Acceleration Z: ' + acceleration.z + '<BR>' +\n 'Timestamp: ' + acceleration.timestamp + '<BR>';\n}", "updateAccelerationState() {\n\n if (this.acceleration.fwd || this.acceleration.back) {\n this.allMotorsGo();\n } else {\n this.allMotorsStop();\n\n }\n }", "get unitAccelerationMagnitude() { return this._unitAccelerationMagnitude; }", "get unitAccelerationMagnitude() { return this._unitAccelerationMagnitude; }", "get unitAccelerationMagnitude() { return this._unitAccelerationMagnitude; }", "function onAccelerationWatchSuccess(acceleration) {\n \n // alert(\"here!\");\n updates++;\n watchResult.innerHTML = 'Acceleration X: ' + acceleration.x + '<BR>' +\n 'Acceleration Y: ' + acceleration.y + '<BR>' +\n 'Acceleration Z: ' + acceleration.z + '<BR>' +\n 'Timestamp: ' + acceleration.timestamp + '<BR>' +\n 'Update Number: ' + updates + '<BR>';\n}", "async requestDevice() {\n const device = await Device.requestDevice();\n\n return this.addDevice(device);\n }", "function AccelerationObject(){\n\tthis.x = 0;\n\tthis.y = 0;\n\tthis.z = 0;\n}", "function init() {\n //Find our div containers in the DOM\n var dataContainerOrientamation = document.getElementById('dataContainerOrientation');\n var dataContainerMotion = document.getElementById('dataContainerMotion');\n \n //Check for support for DeviceOrientation event\n if(window.DeviceOrientationEvent) {\n window.addEventListener('deviceorientation', function(event) {\n alpha = event.alpha;\n beta = event.beta;\n gamma = event.gamma;\n }, true);\n } \n \n /*\n // Check for support for DeviceMotion events\n if(window.DeviceMotionEvent) {\n window.addEventListener('devicemotion', function(event) {\n alpha = event.accelerationIncludingGravity.x;\n beta = event.accelerationIncludingGravity.y;\n gamma = event.accelerationIncludingGravity.z;\n var r = event.rotationRate;\n var html = 'Acceleration:<br />';\n html += 'x: ' + x +'<br />y: ' + y + '<br/>z: ' + z+ '<br />';\n html += 'Rotation rate:<br />';\n if(r!=null) html += 'alpha: ' + r.alpha +'<br />beta: ' + r.beta + '<br/>gamma: ' + r.gamma + '<br />';\n dataContainerMotion.innerHTML = html; \n });\n }\n */ \n}", "devicemotion(e) {\n\t\tconst current = e.acceleration;\n\n\t\tif ((this.lastX === null) && (this.lastY === null) && (this.lastZ === null)) {\n\t\t\tthis.lastX = current.x;\n\t\t\tthis.lastY = current.y;\n\t\t\tthis.lastZ = current.z;\n\t\t\treturn;\n\t\t}\n\n\t\tconst deltaX = this.lastX - current.x;\n\t\tconst deltaY = this.lastY - current.y;\n\t\tconst deltaZ = this.lastZ - current.z;\n\n\t\tlet activedEventName = null;\n\t\tif (deltaX > this.options.threshold) {\n\t\t\tactivedEventName = 'shake-x-positive';\n\t\t} else if (-deltaX > this.options.threshold) {\n\t\t\tactivedEventName = 'shake-x-negative';\n\t\t} else if (deltaY > this.options.threshold) {\n\t\t\tactivedEventName = 'shake-y-positive';\n\t\t} else if (-deltaY > this.options.threshold) {\n\t\t\tactivedEventName = 'shake-y-negative';\n\t\t} else if (deltaZ > this.options.threshold) {\n\t\t\tactivedEventName = 'shake-z-positive';\n\t\t} else if (-deltaZ > this.options.threshold) {\n\t\t\tactivedEventName = 'shake-z-negative';\n\t\t}\n\t\tif (activedEventName != null) {\n\t\t\tconst currentTime = new Date();\n\t\t\tconst timeDifference = currentTime.getTime() - this.lastTime.getTime();\n\n\t\t\tif (timeDifference > this.options.timeout) {\n\t\t\t\twindow.dispatchEvent(this.events[this.eventNames.indexOf(activedEventName)]);\n\t\t\t\tthis.lastTime = new Date();\n\t\t\t}\n\t\t}\n\n\t\tthis.lastX = current.x;\n\t\tthis.lastY = current.y;\n\t\tthis.lastZ = current.z;\n\n\t}", "getClearedDevice(layer, port) {\nconst device = this.getLayerPort(layer, port).device;\nif (!device || !device.connected) {\nreturn null;\n}\nif (device._onInterval) {\nclearInterval(device._onInterval);\ndevice._onInterval = null;\n}\nreturn device;\n}", "function initialiseAccelerometer() {\n\tif (USE_ACCELEROMETER) {\n\t\t// accPermissionButton = createButton('Use accelerometer');\n\t \t// accPermissionButton.position(0.1*windowWidth, windowHeight-50);\n\t \t// accPermissionButton.size(0.8*windowWidth, 50);\n\t \t// accPermissionButton.style('font-size: 30px');\n\t\t// accPermissionButton.mousePressed(getAccel);\n\t}\n}", "function tryNextDevice() \n \t{\n \t\tdevice = potentialDevices.shift(); // Set device to the next available device\n \tif (!device) return; // If there was no device available, return\n\n \tdevice.open({ stopBits: 0, bitRate: 9600, ctsFlowControl: 0 }); // Opens connection\n \t\n \t// When data is received from device, store the data in the buffer object\n \tdevice.set_receive_handler(function(data) {\n \t\tdataView = new Uint8Array(data);\n \t\tstoredData.write(dataView);\n \t\t\n \t\t// If data received is in the format of a analog value, store in \n \t\t// corresponding buffer attribute\n \t\tif(dataView.length == 2)\n \t\t{\n \t\t\tdataReceived = true;\n \t\t\tif(infraStream == true)\n \t\t\t{\n \t\t\t\tstoredData.writePin(currentPinRequest % 2, dataView);\n \t\t\t}\n \t\t\telse \n \t\t\t{\n \t\t\t\tif(proximStream == true)\n \t\t\t\t{\n \t\t\t\t\tstoredData.writePin(2, dataView);\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t});\n \t\n \t}", "setAccelerometerEnabled(isEnable) {\n if (this._accelEnabled === isEnable) {\n return;\n }\n\n this._accelEnabled = isEnable;\n const scheduler = legacyCC.director.getScheduler();\n scheduler.enableForTarget(this);\n\n if (this._accelEnabled) {\n this._registerAccelerometerEvent();\n\n this._accelCurTime = 0;\n scheduler.scheduleUpdate(this);\n } else {\n this._unregisterAccelerometerEvent();\n\n this._accelCurTime = 0;\n scheduler.unscheduleUpdate(this);\n }\n\n {\n // @ts-ignore\n jsb.device.setMotionEnabled(isEnable);\n }\n }", "function yFindAccelerometer(func)\n{\n return YAccelerometer.FindAccelerometer(func);\n}", "magnetometer() {\n this.setup();\n\n //\n // taken from https://github.com/pimoroni/enviro-phat/pull/31/commits/78b1058e230c88cc5969afa210bb5b97f7aa3f82\n // as there is no real counterpart to struct.unpack in js\n //\n // in order to read multiple bytes the high bit of the sub address must be asserted\n this._mag[X] = twos_comp(this.i2c_bus.read_word_data(this.addr, OUT_X_L_M|0x80), 16);\n this._mag[Y] = twos_comp(this.i2c_bus.read_word_data(this.addr, OUT_Y_L_M|0x80), 16);\n this._mag[Z] = twos_comp(this.i2c_bus.read_word_data(this.addr, OUT_Z_L_M|0x80), 16);\n\n return new Vector(this._mag)\n }", "function assessCurrentAcceleration(acceleration) {\n\t//alert(\"assessCurrentAcceleration\");\n\n\t\tvar accelerationChange = {x:0, y:0, z:0};\n\t\tif (previousAcceleration.x != null) {\n\t\t\taccelerationChange.x = Math.abs(previousAcceleration.x- acceleration.x);\n\t\t\taccelerationChange.y = Math.abs(previousAcceleration.y- acceleration.y);\n\t\t\taccelerationChange.z = Math.abs(previousAcceleration.z- acceleration.z);\n\t\t\t\tshake.stopWatch();\n\t\t\tif(count < 10)\n\t\t\t{\n\t\t\t\t//alert(count);\n\n\t\t\t\tAvgX = AvgX + accelerationChange.x;\n\t\t\t\tAvgY = AvgY + accelerationChange.y;\n\t\t\t\tAvgZ = AvgZ + accelerationChange.z;\n\n\t\t\t\tcount++;\n\t\t\t\tsetTimeout(shake.startWatch, shake.frequency, shakeCallBack);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tcount = 0;\n\t\t\t\tax = AvgX/10;\n\t\t\t\tay = AvgY/10;\n\t\t\t\taz = AvgZ/10;\n\t\t\t\tAvgX=0;\n\t\t\t\tAvgY=0;\n\t\t\t\tAvgZ=0;\n\t\t\t\tpreviousAcceleration = { x: null, y: null, z: null }\n\t\t\t\t//alert(\"Acceleration Logger \" + ax + \" \" + ay + \" \" + az);\n\t\t\t\tshake.stopWatch();\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tpreviousAcceleration = {\n\t\t\t\tx: acceleration.x,\n\t\t\t\ty: acceleration.y,\n\t\t\t\tz: acceleration.z\n\t\t\t}\n\t\t}\n\t}", "function orientationDevice(_callback){\n \n navigator.compass.getCurrentHeading(\n\n function(heading){ hd = heading.magneticHeading;\n _callback(hd);\n //biba = 300;\n },\n function(error){ alert('CompassError: ' + error.code);}\n );\n\n //return hd;\n }//Ende of orientationDevice", "function listenForAccel() {\n tag.on('accelerometerChange', function(x, y, z) {\n // store accelerometer data (in G)\n acc_data[\"x\"] = x.toFixed(3);\n acc_data[\"y\"] = y.toFixed(3);\n acc_data[\"z\"] = z.toFixed(3);\n // send osc msgs\n client.send('/sensortag', [acc_data]);\n console.log(\"messege sent\");\n });\n }", "function assessCurrentAcceleration(acceleration) {\n var accelerationChange = {};\n if (previousAcceleration.x !== null) {\n // ---------------- change , to -\n accelerationChange.x = Math.abs(previousAcceleration.x - acceleration.x);\n accelerationChange.y = Math.abs(previousAcceleration.y - acceleration.y);\n accelerationChange.z = Math.abs(previousAcceleration.z - acceleration.z);\n }\n //console.log(acceleration.x, acceleration.y, acceleration.z);\n //console.log(\"change\", accelerationChange.x, accelerationChange.y, accelerationChange.z);\n if (accelerationChange.x + accelerationChange.y + accelerationChange.z > 10) {\n // bump detected\n accelerationChange.timestamp = Math.abs(previousAcceleration.timestamp - acceleration.timestamp);\n console.log('bumped', accelerationChange.timestamp,previousAcceleration.timestamp, acceleration.timestamp);\n previousAcceleration.timestamp = acceleration.timestamp;\n if(accelerationChange.timestamp >= 1000){\n if (typeof bumpCallBack === \"function\") {\n bumpCallBack();\n }\n bump.stopWatch();\n setTimeout(bump.startWatch, 1000); // ??\n }\n previousAcceleration.x = null;\n previousAcceleration.y = null;\n previousAcceleration.z = null;\n// previousAcceleration = {\n// x: null,\n// y: null,\n// z: null\n// };\n } else {\n previousAcceleration.x = acceleration.x;\n previousAcceleration.y = acceleration.y;\n previousAcceleration.z = acceleration.z;\n// previousAcceleration = {\n// x: acceleration.x,\n// y: acceleration.y,\n// z: acceleration.z\n// };\n }\n }", "async function getACCLData(data) {\n let frameRate;\n let inner = '';\n let device = '';\n if (data['frames/second'] != null)\n frameRate = `${Math.round(data['frames/second'])} fps`;\n for (const key in data) {\n if (data[key]['device name'] != null) device = data[key]['device name'];\n if (data[key].streams) {\n for (const stream in data[key].streams) {\n await breathe();\n //If we find a ACCL stream, we won't look on any other DEVCS\n if (stream === 'ACCL' && data[key].streams.ACCL.samples) {\n let name;\n if (data[key].streams.ACCL.name != null)\n name = data[key].streams.ACCL.name;\n let units = `[g]`;\n //Loop all the samples\n for (let i = 0; i < data[key].streams.ACCL.samples.length; i++) {\n const s = data[key].streams.ACCL.samples[i];\n //Check that at least we have the valid values\n if (s.value && s.value.length) {\n let time = '';\n let acceleration = '';\n\n //Set time if present\n if (s.date != null) {\n if (typeof s.date != 'object') s.date = new Date(s.date);\n try {\n time = `\n <time>${s.date.toISOString()}</time>`;\n } catch (e) {\n time = `\n <time>${s.date}</time>`;\n }\n }\n\n acceleration = `\n <extensions>\n <gpxacc:AccelerationExtension>\n <gpxacc:accel offset=\"0\" x=\"${s.value[1] / 9.80665}\" y=\"${\n s.value[2] / 9.80665\n }\" z=\"${s.value[0] / 9.80665}\"/>\n <gpxacc:accel offset=\"0\" x=\"${s.value[1] / 9.80665}\" y=\"${\n s.value[2] / 9.80665\n }\" z=\"${s.value[0] / 9.80665}\"/>\n </gpxacc:AccelerationExtension>\n </extensions>`;\n //Create sample string\n const partial = `\n <trkpt lat=\"0\" lon=\"0\">\n ${(time + acceleration).trim()}\n </trkpt>`;\n if (i === 0 && s.cts > 0) {\n // If first sample missing, fake it for better sync\n let firstDate;\n try {\n firstDate = new Date(s.date.getTime() - s.cts).toISOString();\n } catch (e) {\n firstDate = new Date(s.date - s.cts).toISOString();\n }\n const firstTime = `\n <time>${firstDate}</time>`;\n const firstAccel = `\n <extensions>\n <gpxacc:AccelerationExtension>\n <gpxacc:accel offset=\"0\" x=\"0\" y=\"0\" z=\"0\"/>\n <gpxacc:accel offset=\"0\" x=\"0\" y=\"0\" z=\"0\"/>\n </gpxacc:AccelerationExtension>\n </extensions>`;\n const fakeFirst = `\n <trkpt lat=\"0\" lon=\"0\">\n ${(firstTime + firstAccel).trim()}\n </trkpt>`;\n inner += `${fakeFirst}`;\n }\n //Add it to samples\n inner += `${partial}`;\n }\n }\n //Create description of file/stream\n const description = [frameRate, name, units]\n .filter(e => e != null)\n .join(' - ');\n return { inner, description, device };\n }\n }\n }\n }\n return { inner, description: frameRate || '', device };\n}", "motion() {\n return this.accel * this.dir;\n }", "function DeviceLayer() {}", "function findDevice() {\n return isVR() ? VRControls() : pcControls();\n}", "function getAccelerometerValues() {\n acc.onreading = () => {\n xval.innerHTML = acc.x.toFixed(3);\n yval.innerHTML = acc.y.toFixed(3);\n zval.innerHTML = acc.z.toFixed(3);\n // Data must be sent on reading!\n this.sendValues();\n }\n acc.start();\n}", "function assessCurrentAcceleration(acceleration) {\n var accelerationChange = {};\n if (previousAcceleration.x !== null) {\n accelerationChange.x = Math.abs(previousAcceleration.x, acceleration.x);\n accelerationChange.y = Math.abs(previousAcceleration.y, acceleration.y);\n accelerationChange.z = Math.abs(previousAcceleration.z, acceleration.z);\n }\n if (accelerationChange.x + accelerationChange.y + accelerationChange.z > 30) {\n // Shake detected\n if (typeof (shakeCallBack) === \"function\") {\n shakeCallBack();\n }\n\n shake.stopWatch();\n\n setTimeout(function() {\n shake.startWatch(myCallBack);\n }, 3000);\n\n previousAcceleration = {\n x: null,\n y: null,\n z: null\n }\n } else {\n previousAcceleration = {\n x: acceleration.x,\n y: acceleration.y,\n z: acceleration.z\n }\n }\n }", "function onSuccess(acceleration) {\n\t\tif (acceleration){\n\t\t\t/*\n\t\t\tvar deltaX=acceleration.x - watchLastX;\n\t\t\tvar deltaY=acceleration.y - watchLastY;\n\t\t\tvar deltaZ=acceleration.z - watchLastZ;\n\t\t\tvar suma=deltaY+deltaZ;\n\t\t\twatchLastY = acceleration.y;\n\t\t\t*/\n\t\t\t//$('#infotest').innerHTML=' :x:'+deltaX+' :y:'+deltaY+' :z:'+deltaZ+' :s:'+suma;\n\t\t\tif (acceleration.y < -3) {goback(); return;}\n\t\t\tif (acceleration.y > 9) {gonext(); return;}\n\t\t\t//acceleration.timestamp\n\t\t}\n }", "function handleDeviceMotion2(event) {\n\t// create a variable grabbing our 'text' object from the DOM\n\t// (so that we don't have to type it out everytime)\n\tvar mssg = document.getElementById(\"acc_text\");\n\n\t// Acceleration (m/s2)\n\tvar accX = event.acceleration.x;\n\tvar accY = event.acceleration.y;\n\tvar accZ = event.acceleration.z;\n\n\t// Accerlation w/ gravity (m/s2)\n\tvar accXwG = event.accelerationIncludingGravity.x;\n\tvar accYwG = event.accelerationIncludingGravity.y;\n\tvar accZwG = event.accelerationIncludingGravity.z;\n\n\t// create vars for Rotation rate (r/s2) here\n\tvar rotX = event.rotationRate.alpha;\n\tvar rotY = event.rotationRate.beta;\n\tvar rotZ = event.rotationRate.gamma;\n\n\t// now update the output message\n\t// format the output of each direction accel on a\n\t// new line. you can do this with the <br>\n\t// character. Use toFixed(1) to make your txt output\n\t// have only 1 decimal place. You can also append\n\t// to the innerHTML of your output mssg using +=\n\n\t// do this for both acceleration and acceleration w/Gravity.\n\t// what difference do you notice?\n\tmssg.innerHTML = accX.toFixed(1) + \" <br>\";\n\tmssg.innerHTML += accY.toFixed(1) + \" <br>\";\n\tmssg.innerHTML += accZ.toFixed(1) + \" <br><br>\";\n\n\tmssg.innerHTML += accXwG.toFixed(1) + \" <br>\";\n\tmssg.innerHTML += accYwG.toFixed(1) + \" <br>\";\n\tmssg.innerHTML += accZwG.toFixed(1) + \" <br><br>\";\n\n\tmssg.innerHTML += rotX.toFixed(1) + \" <br>\";\n\tmssg.innerHTML += rotY.toFixed(1) + \" <br>\";\n\tmssg.innerHTML += rotZ.toFixed(1) + \" <br><br>\";\n\n\t// next task we'd like to use this information for step counting\n\t// how might we code this out? we have our immediate xyz values\n\t// of acceleration, how do we build an array to make comparisons\n\t// between historical values?\n\tlet time = new Date();\n\tlet n = time.getTime();\n\tongoingMotion.push(new Array(n, accX, accY, accZ, accZwG));\n\t// document.getElementById(\"motion_text\").innerHTML =\n\t// ongoingMotion[ongoingMotion.length - 1];\n}", "getOGDevice() {\n return this.getOGDeviceModel();\n }", "accelerate(){\n this.speed += 10;\n }", "function AccelerationOptions() {\n\t/*\n\t * The timeout after which if acceleration data cannot be obtained the errorCallback\n\t * is called.\n\t */\n\tthis.timeout = 10000;\n}", "updateAcceleration() {\n //this.a = [0, -0.2 * gravity, 0];\n this.a = glMatrix.vec3.fromValues(0, -0.2 * gravity, 0);\n }", "function calculateParticleAcceleration(i){\r\n let y_left = particleArray[i-1].yPos;\r\n let y_center = particleArray[i].yPos;\r\n let y_right = particleArray[i+1].yPos;\r\n\r\n let v_center = particleArray[i].velocity;\r\n\r\n // dx = space between leftmost and rightmost particle\r\n let dx = 0.5 * Math.abs(particleArray[i+1].xPos - particleArray[i-1].xPos);\r\n // acceleration = second derivative of position\r\n let d2y = (y_left - 2 * y_center + y_right) / (2 * dx);\r\n let a_elastic = Math.pow(waveParams.oSpeed, 2) * d2y;\r\n let a_drag = -waveParams.b * v_center;\r\n return a_elastic + a_drag;\r\n }", "enable() {\n if(this.isAvailable == false)\n {\n return;\n }\n \n log(\"Accelerometer enabled\");\n this.isEnabled = true;\n this.renderHTML();\n\n this.accelerometer.start();\n }", "update() {\n\t\tthis.velocity.add(this.acceleration);\n\t\tthis.location.add(this.velocity);\n\t\tthis.acceleration.mult(0);\n\t}", "function AccelerationOptions() {\n\t/**\n\t * The timeout after which if acceleration data cannot be obtained the errorCallback\n\t * is called.\n\t */\n\tthis.timeout = 10000;\n}", "get focalDevice() {\n\t\treturn this.__focalDevice;\n\t}", "startDeceleration(timeStamp) {\n var self = this\n\n self.minDecelerationScrollTop = self.minScrollTop\n self.maxDecelerationScrollTop = self.maxScrollTop\n\n // Wrap class method\n var step = function(percent, now, render) {\n self.stepThroughDeceleration(render)\n }\n\n // How much velocity is required to keep the deceleration running\n var minVelocityToKeepDecelerating = 0.5\n\n // Detect whether it's still worth to continue animating steps\n // If we are already slow enough to not being user perceivable anymore, we stop the whole process here.\n var verify = function() {\n var shouldContinue = Math.abs(self.decelerationVelocityY) >= minVelocityToKeepDecelerating\n if (!shouldContinue) {\n self.didDecelerationComplete = true\n }\n return shouldContinue\n }\n\n var completed = function(renderedFramesPerSecond, animationId, wasFinished) {\n self.isDecelerating = false\n if (self.scrollTop <= self.minScrollTop || self.scrollTop >= self.maxScrollTop) {\n self.scrollTo(self.scrollTop)\n return\n }\n if (self.didDecelerationComplete) {\n self.scrollingComplete()\n }\n }\n\n // Start animation and switch on flag\n self.isDecelerating = Animate.start(step, verify, completed)\n }", "function PositionSensorVRDevice() {\n}", "function PositionSensorVRDevice() {\n}", "function PositionSensorVRDevice() {\n}", "function PositionSensorVRDevice() {\n}", "function PositionSensorVRDevice() {\n}", "function PositionSensorVRDevice() {\n}", "function PositionSensorVRDevice() {\n}", "updateAccelerationVectors() {\n const massesLen = this.masses.length;\n \n for (let i = 0; i < massesLen; i++) {\n let acceleration = {\n x: 0,\n y: 0,\n z: 0\n };\n\n let massI = this.masses[i];\n\n for (let j = 0; j < massesLen; j++) {\n if (i !== j) {\n const massJ = this.masses[j];\n\n const d = {\n x: massJ.Position.x - massI.Position.x,\n y: massJ.Position.y - massI.Position.y,\n z: massJ.Position.z - massI.Position.z\n };\n\n const distSq = (d.x * d.x) + (d.y * d.y) + (d.z * d.z);\n\n let f = (this.g * massJ.mass) / (distSq * Math.sqrt(distSq + this.softeningConstant));\n\n acceleration.x += d.x * f;\n acceleration.y += d.y * f;\n acceleration.z += d.z * f;\n }\n }\n\n massI.Acceleration.x = acceleration.x;\n massI.Acceleration.y = acceleration.y;\n massI.Acceleration.z = acceleration.z;\n }\n return this;\n }", "function DeviceSlot() {}", "function setAccelPeriod() {\n\t\tconsole.log('set accelerometer period...');\n\t\ttag.setAccelerometerPeriod(100, enableAccel);\n\t}", "start() {\n\t\tthis.reset();\n\t\tif (this.hasDeviceMotion) {\n\t\t\twindow.addEventListener('devicemotion', this, false);\n\t\t}\n\t}", "start3DCalibration() {\n var _this14 = this;\n\n return _asyncToGenerator(function* () {\n if (!(yield _this14.isOnline())) {\n return _this14._yapi.DEVICE_NOT_FOUND;\n }\n if (_this14._calibStage != 0) {\n yield _this14.cancel3DCalibration();\n }\n _this14._calibSavedParams = yield _this14.get_calibrationParam();\n _this14._calibV2 = _this14._yapi.imm_atoi(_this14._calibSavedParams) == 33;\n yield _this14.set_calibrationParam('0');\n _this14._calibCount = 50;\n _this14._calibStage = 1;\n _this14._calibStageHint = 'Set down the device on a steady horizontal surface';\n _this14._calibStageProgress = 0;\n _this14._calibProgress = 1;\n _this14._calibInternalPos = 0;\n _this14._calibPrevTick = _this14._yapi.GetTickCount() & 0x7FFFFFFF;\n _this14._calibOrient.length = 0;\n _this14._calibDataAccX.length = 0;\n _this14._calibDataAccY.length = 0;\n _this14._calibDataAccZ.length = 0;\n _this14._calibDataAcc.length = 0;\n return _this14._yapi.SUCCESS;\n })();\n }", "function calculate_accel(decs) {\n var drdt = []; var tmp = 0;\n \tfor (var i=0; i<(userSpiral.length-1); i++) {\n \t tmp = (userSpiral[i+1].time-userSpiral[i].time);\n \t if (tmp<1) { tmp =1; }\n \t drdt.push((userSpiral[i+1].r-userSpiral[i].r) / tmp);\n \t}\n \t\n \tvar mean_ddrddt = 0; var sd_ddrddt = 0;\n \tfor (var i=0; i<drdt.length-1; i++) {\n \t mean_ddrddt += (drdt[i+1] - drdt[i]);\n \t}\n \tmean_ddrddt=mean_ddrddt/drdt.length;\n \tfor (var i=0; i<drdt.length-1; i++) {\n \t sd_ddrddt += Math.pow(((drdt[i+1] - drdt[i]) - mean_ddrddt),2);\n \t}\n \tsd_ddrddt = Math.sqrt(sd_ddrddt/drdt.length); \n \treturn([mean_ddrddt.toFixed(decs),sd_ddrddt.toFixed(decs)]);\n}", "function YAccelerometer_FindAccelerometer(func) // class method\n {\n var obj; // YAccelerometer;\n obj = YFunction._FindFromCache(\"Accelerometer\", func);\n if (obj == null) {\n obj = new YAccelerometer(func);\n YFunction._AddToCache(\"Accelerometer\", func, obj);\n }\n return obj;\n }", "update() {\n this.accelerometer();\n this.magnetometer();\n }", "get deviceNumber() { return this._deviceNumber; }", "function Acceleration(x, y, z)\n{\n\tthis.x = x;\n\tthis.y = y;\n\tthis.z = z;\n\tthis.timestamp = new Date().getTime();\n}", "function PositionSensorVRDevice() {\n\t}", "deltaX() { return Math.cos(this.angle) * (this.speed); }", "function telemetry() {\n\tlet status = document.getElementById('status');\n\tvar newMeasurement = {};\n\tlet sensor = new Accelerometer();\n\tsensor.addEventListener('reading', function(e) {\n\t\tstatus.innerHTML = 'x: ' + e.target.x + '<br> y: ' + e.target.y + '<br> z: ' + e.target.z;\n\t\tnewMeasurement.x = e.target.x;\n\t\tnewMeasurement.y = e.target.y;\n\t\tnewMeasurement.z = e.target.z;\n\t});\n\tsensor.start();\n\treturn newMeasurement;\n}", "function Correcto(acceleration){\n\tvar element=document.getElementById('acelerometro');\n\t\n\telement.innerHTML='Aceleracion en X;'+acceleration.x+'<br/>'+\n\t'Aceleracion en Y:'+acceleration.y+'<br/>'+\n\t'intervalo:'+acceleration.timestamp+'<br/>';\n}", "isRealDevice () {\n return false;\n }", "function touchStarted(){\n x=0;\n if (osc1control=='enabled'){osc1.start();}\n // if (osc2control=='enabled'){osc2.start();}\n //if (osc3control=='enabled'){osc3.start();}\n //if (osc4control=='enabled'){osc4.start();}\n }", "getSpeed() { return this.speed; }" ]
[ "0.6690568", "0.6640508", "0.6575329", "0.6475521", "0.64167273", "0.6317041", "0.63064206", "0.6251409", "0.62481874", "0.6175653", "0.61529523", "0.6152147", "0.6133971", "0.600708", "0.600152", "0.59922844", "0.58851343", "0.5872435", "0.58339185", "0.5817319", "0.57336676", "0.5732492", "0.57044613", "0.5691479", "0.5666848", "0.56517076", "0.56290895", "0.5620796", "0.56138945", "0.5591642", "0.5561246", "0.5555084", "0.5520119", "0.55084956", "0.55016786", "0.54783815", "0.5456935", "0.5443267", "0.54376405", "0.543303", "0.5426495", "0.5426495", "0.5426495", "0.5395141", "0.5384661", "0.5381329", "0.5308662", "0.52677566", "0.525337", "0.5227558", "0.5212373", "0.52039546", "0.5194663", "0.51866364", "0.51864934", "0.5173813", "0.51648444", "0.51637036", "0.5148391", "0.51387036", "0.5134572", "0.50873506", "0.5077198", "0.5070658", "0.5068678", "0.5065357", "0.50619227", "0.5052767", "0.50252485", "0.4997459", "0.49869394", "0.49782637", "0.49765447", "0.497376", "0.49696368", "0.49532616", "0.49496493", "0.49496493", "0.49496493", "0.49496493", "0.49496493", "0.49496493", "0.49496493", "0.49384734", "0.49294677", "0.49200243", "0.49182478", "0.49162883", "0.4913737", "0.49098682", "0.49073625", "0.4896237", "0.48818618", "0.48766932", "0.48523295", "0.4846827", "0.48436183", "0.48383066", "0.4836821", "0.48336583" ]
0.63024956
7
Begin of All orientationDevice to get the Orientation
function orientationDevice(_callback){ navigator.compass.getCurrentHeading( function(heading){ hd = heading.magneticHeading; _callback(hd); //biba = 300; }, function(error){ alert('CompassError: ' + error.code);} ); //return hd; }//Ende of orientationDevice
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get orientation() {\n return this._orientation;\n }", "get orientation() {\n return this._orientation;\n }", "get orientation() {\n return this._orientation;\n }", "function readDeviceOrientation() {\n\t switch (window.orientation) {\n\t case 0:\n\t break;\n\t case 180:\n\t break;\n\t case -90:\n\t break;\n\t case 90:\n\t break;\n\t }\n\t}", "get orientation() {\n if (this.hasAttribute(\"orientation\")) {\n return this.getAttribute(\"orientation\");\n }\n return false;\n }", "setOrientation() {\n this.orientation = Object.keys(this.orientations).find(key => this.orientations[key] === this.degrees)\n }", "get currentOrientation() {\n const me = this;\n\n if (!me._currentOrientation) {\n //me.taskRendering = me._currentOrientation = new TaskRendering(me);\n me.taskRendering = me._currentOrientation = new NewTaskRendering(me);\n }\n\n return me._currentOrientation;\n }", "getScreenOrientation() {\n\t\tconst orientation = (this._window.screen.orientation || {}).type || this._window.screen.mozOrientation || this._window.screen.msOrientation;\n\t\tif (!orientation) {\n\t\t\tconst widthHeightRatio = this._window.screen.width / this._window.screen.height;\n\t\t\treturn {\n\t\t\t\tportrait: widthHeightRatio < 1,\n\t\t\t\tlandscape: widthHeightRatio >= 1\n\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tportrait: orientation.startsWith('portrait'),\n\t\t\tlandscape: orientation.startsWith('landscape')\n\t\t};\n\t}", "onDeviceReorientation() {\n this.data.orientation = (window.orientation * this.RAD) || 0;\n }", "onDeviceReorientation() {\n this.data.orientation = (window.orientation * this.RAD) || 0;\n }", "function calculateDeviceOrientation(e) {\n isLandscape =\n document.documentElement.clientHeight < document.documentElement.clientWidth;\n isRotatedClockwise = window.orientation === -90;\n }", "getInitialViewportOrientation(viewport) {\n return getOrientation(viewport, viewport);\n }", "function Orientation() {\n\t/**\n\t * The current orientation, or null if the orientation hasn't changed yet.\n\t */\n\tthis.currentOrientation = null;\n}", "function determineOrientationIndex(orientation) {\n var o = orientation;\n var index = undefined;\n switch (o) {\n case 'A':\n case 'P':\n index = 1;\n break;\n case 'L':\n case 'R':\n index = 0;\n break;\n case 'S':\n case 'I':\n index = 2;\n break;\n default:\n console.assert(false, \" OBLIQUE NOT SUPPORTED\");\n break;\n }\n return index;\n}", "get legibleOrientation() {\n return Utils.getLegibleOrientation(this.orientation)\n }", "function Orientation(_f0,_f1,_f2,_f3,\n _b0,_b1,_b2,_b3,\n _start_angle) {\n this.f0=_f0; \n this.f1=_f1;\n this.f2=_f2;\n this.f3=_f3;\n this.b0=_b0;\n this.b1=_b1;\n this.b2=_b2;\n this.b3=_b3;\n this.start_angle=_start_angle;\n}", "function handleOrientationChange() {\n setTimeout(function() {\n calculateDeviceOrientation();\n }, 500);\n }", "function changeOrientationsForMobile(){\n for (var i = 0; i < sts.specs.playback.orientation.length; i++) {\n var entry = sts.specs.playback.orientation[i];\n var entry_orientations = entry.orientations;\n var new_orientations = [];\n for (var j = 0; j < entry_orientations.length; j++) {\n var ori = entry_orientations[j] * -1.0;\n new_orientations.push(ori);\n };\n var out_orientations = new_orientations.slice();\n sts.specs.playback.orientation[i].orientations = out_orientations;\n };\n}", "function testOrientation(){\n\t\treturn win.innerHeight >= win.innerWidth ? 'portrait' : 'landscape' ;\n\t}", "function Orientation() {\n\tthis.started = false;\n}", "function DeviceOrientationControlMethod() {\n this._dynamics = {\n yaw: new Marzipano.Dynamics(),\n pitch: new Marzipano.Dynamics()\n };\n\n this._deviceOrientationHandler = this._handleData.bind(this);\n\n if (window.DeviceOrientationEvent) {\n window.addEventListener('deviceorientation', this._deviceOrientationHandler);\n } else {\n alert('DeviceOrientationEvent not defined');\n }\n\n this._previous = {};\n this._current = {};\n this._tmp = {};\n\n this._getPitchCallbacks = [];\n}", "function orient() {\n // reset orientation to initial\n reference_orientation_component.autoView(1000);\n}", "function initializeCheckOrientation(){\n window.addEventListener(\"orientationchange\", function() {\n setTimeout(function(){\n check_orientation();\n }, 150);\n });\n check_orientation();\n }", "function getOrientationClass(){\n\tif (viewHeight > viewWidth) {\n\t\taddClass(html, 'portrait');\n\t\tremoveClass(html, 'landscape');\n\t\treturn \"portrait\";\n\t}\n\telse{\n\t\taddClass(html, 'landscape');\n\t\tremoveClass(html, 'portrait');\n\t\treturn \"landscape\";\n\t}\n}", "updateOrientation() {\n const me = this,\n {\n element\n } = this;\n\n if (me._prevOrientation) {\n element.classList.remove(me._prevOrientation);\n } // Orientation auto and already rendered, determine orientation to use\n\n if (!me._currentOrientation && me.rendered && element.offsetParent) {\n const flexDirection = DomHelper.getStyleValue(element.parentElement, 'flex-direction'); // If used in a flex layout, determine orientation from flex-direction\n\n if (flexDirection) {\n me._currentOrientation = flexDirection.startsWith('column') ? 'horizontal' : 'vertical';\n } // If used in some other layout, try to determine form sibling elements position\n else {\n const previous = element.previousElementSibling,\n next = element.nextElementSibling;\n\n if (!previous || !next) {\n // To early in rendering, next sibling not rendered yet\n return;\n }\n\n const prevRect = previous.getBoundingClientRect(),\n nextRect = next.getBoundingClientRect(),\n topMost = prevRect.top < nextRect.top ? prevRect : nextRect,\n bottomMost = topMost === nextRect ? prevRect : nextRect;\n me._currentOrientation = topMost.top !== bottomMost.top ? 'horizontal' : 'vertical';\n }\n }\n\n if (me._currentOrientation) {\n element.classList.add(`b-${me._currentOrientation}`);\n }\n\n me._prevOrientation = me._currentOrientation;\n }", "get groupOrientation() {\n\t\treturn this.nativeElement ? this.nativeElement.groupOrientation : undefined;\n\t}", "getRobotOrientation(direction) {\n let current_orientation = this.robotPosition[1], current_orientation_index = this.orientation.indexOf(current_orientation);\n (direction == 'R') ? current_orientation_index++ : current_orientation_index--;\n if (current_orientation_index == -1)\n current_orientation_index = 3;\n if (current_orientation_index == 4)\n current_orientation_index = 0;\n this.robotPosition[1] = this.orientation[current_orientation_index];\n return this.robotPosition;\n }", "function DeviceOrientationModule() {\n _classCallCheck(this, DeviceOrientationModule);\n\n _get(Object.getPrototypeOf(DeviceOrientationModule.prototype), 'constructor', this).call(this, 'deviceorientation');\n\n /**\n * Raw values coming from the `deviceorientation` event sent by this module.\n *\n * @this DeviceOrientationModule\n * @type {number[]}\n * @default [null, null, null]\n */\n this.event = [null, null, null];\n\n /**\n * The `Orientation` module.\n * Provides unified values of the orientation compliant with {@link\n * http://www.w3.org/TR/orientation-event/|the W3C standard}\n * (`alpha` in `[0, 360]`, beta in `[-180, +180]`, `gamma` in `[-90, +90]`).\n *\n * @this DeviceOrientationModule\n * @type {DOMEventSubmodule}\n */\n this.orientation = new DOMEventSubmodule(this, 'orientation');\n\n /**\n * The `OrientationAlt` module.\n * Provides alternative values of the orientation\n * (`alpha` in `[0, 360]`, beta in `[-90, +90]`, `gamma` in `[-180, +180]`).\n *\n * @this DeviceOrientationModule\n * @type {DOMEventSubmodule}\n */\n this.orientationAlt = new DOMEventSubmodule(this, 'orientationAlt');\n\n /**\n * Required submodules / events.\n *\n * @this DeviceOrientationModule\n * @type {object}\n * @property {bool} orientation - Indicates whether the `orientation` unified values are required or not (defaults to `false`).\n * @property {bool} orientationAlt - Indicates whether the `orientationAlt` values are required or not (defaults to `false`).\n */\n this.required = {\n orientation: false,\n orientationAlt: false\n };\n\n /**\n * Number of listeners subscribed to the `DeviceOrientation` module.\n *\n * @this DeviceOrientationModule\n * @type {number}\n */\n this._numListeners = 0;\n\n /**\n * Resolve function of the module's promise.\n *\n * @this DeviceOrientationModule\n * @type {function}\n * @default null\n * @see DeviceOrientationModule#init\n */\n this._promiseResolve = null;\n\n /**\n * Gravity vector calculated from the `accelerationIncludingGravity` unified values.\n *\n * @this DeviceOrientationModule\n * @type {number[]}\n * @default [0, 0, 0]\n */\n this._estimatedGravity = [0, 0, 0];\n\n /**\n * Method binding of the sensor check.\n *\n * @this DeviceOrientationModule\n * @type {function}\n */\n this._deviceorientationCheck = this._deviceorientationCheck.bind(this);\n\n /**\n * Method binding of the `'deviceorientation'` event callback.\n *\n * @this DeviceOrientationModule\n * @type {function}\n */\n this._deviceorientationListener = this._deviceorientationListener.bind(this);\n }", "get horizontalOrientation() {\n return this.navBarLocation === 'top' || this.navBarLocation === 'bottom';\n }", "function handleOrientation() {\n if (device.landscape()) {\n removeClass('portrait');\n addClass('landscape');\n walkOnChangeOrientationList('landscape');\n } else {\n removeClass('landscape');\n addClass('portrait');\n walkOnChangeOrientationList('portrait');\n }\n\n setOrientationCache();\n}", "function orientationCheck() {\n switch(window.orientation) {\n case -90: // landscape\n changeToLandscape();\n break;\n case 90: // landscape\n changeToLandscape();\n break;\n default: // portrait\n changeToPortrait();\n break;\n }\n}", "function cameraUpdateOrientation()\n {\n if(CamMotion.UP || CamMotion.DOWN || CamMotion.RIGHT || CamMotion.LEFT)\n {\n if(CamMotion.UP)\n {\n CamMotion.vertical += CamMotion.rotationSpeed;\n CamMotion.vertical = CamMotion.vertical > CamMotion.verticalMax ? CamMotion.verticalMax : CamMotion.vertical;\n }\n if(CamMotion.DOWN)\n {\n CamMotion.vertical -= CamMotion.rotationSpeed;;\n CamMotion.vertical = CamMotion.vertical < CamMotion.verticalMin ? CamMotion.verticalMin : CamMotion.vertical;\n }\n if(CamMotion.RIGHT)\n {\n CamMotion.horizontal += CamMotion.rotationSpeed;;\n CamMotion.horizontal = CamMotion.horizontal > CamMotion.horizontalMax ? CamMotion.horizontalMax : CamMotion.horizontal;\n }\n if(CamMotion.LEFT)\n {\n CamMotion.horizontal -= CamMotion.rotationSpeed;;\n CamMotion.horizontal = -CamMotion.horizontal > CamMotion.horizontalMax ? -CamMotion.horizontalMax : CamMotion.horizontal;\n }\n // Update the tilt display\n updateTiltDot();\n // Send new info only if the last packet hasn't been sent, helps with slow connections\n safeSendData();\n }\n }", "function imageOrientation() {\n\tlet images = document.getElementsByTagName('img')\n\n\tfunction setOrientationState(image) {\n\t\tlet orientation = 'square'\n\n\t\tif (image.width > image.height) {\n\t\t\torientation = 'landscape'\n\t\t} else if (image.height > image.width) {\n\t\t\torientation = 'portrait'\n\t\t}\n\n\t\tstate.set('orientation', orientation, image)\n\t}\n\n\tfor (let i = 0; i < images.length; i++) {\n\t\tif (!images[i].naturalWidth || !images[i].naturalHeight) {\n\t\t\timages[i].addEventListener('load', function () {\n\t\t\t\tsetOrientationState(this)\n\t\t\t})\n\t\t} else {\n\t\t\tsetOrientationState(images[i])\n\t\t}\n\t}\n}", "function checkOrientation() {\n\t var mql = window.matchMedia(\"(orientation: portrait)\");\n\t if (mql.matches) {\n\t\t $('#divProductSpecs').css({\"width\": \"100%\"});\n\t $('#divProductImage').css({\"width\": \"100%\"});\n\t $('#divProductPromo').css({\"width\": \"100%\"});\n\t } else {\n\t $('#divProductSpecs').css({\"width\": \"50%\", \"float\":\"left\"});\n\t $('#divProductImage').css({\"width\": \"50%\", \"float\":\"left\"});\n\t $('#divProductPromo').css({\"width\": \"100%\"});\n\t }\n }", "componentDidMount() {\n AddOrientation(this);\n }", "componentDidMount() {\n AddOrientation(this);\n }", "componentDidMount() {\n AddOrientation(this);\n }", "function handleDeviceorientationEvent(e) {\n var alpha = normaliseAlpha(e);\n var beta = normaliseBeta(e);\n var gamma = normaliseGamma(e);\n\n emit(alpha, beta, gamma);\n render(alpha, beta, gamma);\n debug(alpha, beta, gamma, e);\n }", "function updateOrientation(){\n // var res = getPossibleOrientations();\n var res = getPossibleOrientationsWithTimes();\n var orientations = res.orientations;\n var times = res.times;\n\n // if there are any possible orientations, we're just going\n // to take the first one and trigger a cut\n if (orientations !== null && times && times.length > 0\n && (orientations[0] !== sts.current_orientation\n || times[0].toString() !== sts.current_orientation_time )) {\n //console.log(orientations[0] + \" orientations[0]\");\n var first_orientation = orientations[0];\n if (sts.cuts.regular_cuts && !sts.cuts.all_regular_cuts_stopped) {\n // orient important to consistant direction\n if (sts.current_orientation === undefined || sts.current_orientation === null) {\n sts.current_orientation = 0;\n //document.getElementById('print-current-orientation').innerHTML = sts.current_orientation;\n }\n var regular_cut_orientation = first_orientation + (sts.theta.current - sts.current_orientation);\n if (sts.specs.isMobile) {\n regular_cut_orientation = first_orientation - (sts.theta.current - sts.current_orientation);\n }\n //console.log(sts.current_orientation + \"sts current orientation\");\n vrView.setOrientation(regular_cut_orientation);\n recordInteraction(\"regularCut\", regular_cut_orientation);\n\n } else if (sts.cuts.regular_cuts && sts.cuts.all_regular_cuts_stopped) {\n recordInteraction(\"noCutPerformed\");\n } else {\n // normal, orient important to viewer\n vrView.setOrientation(first_orientation);\n console.log(\"setOrientation: \" + first_orientation);\n recordInteraction(\"forcedCut\", first_orientation);\n }\n sts.current_orientation = first_orientation;\n sts.current_orientation_time = times[0].toString();\n //document.getElementById('print-current-orientation').innerHTML = sts.current_orientation;\n //console.log(first_orientation);\n }\n}", "function handleOrientationChange(mql) {\n if (mql.matches) {\n mobile = true;\n } else {\n mobile = false;\n }\n }", "function startMonitorOrientation(device) {\n // Start to monitor the orientation of the device\n device.startMonitorOrientation((error) => {\n if(error) {\n console.log(error.toString());\n process.exit();\n }\n });\n\n // Set a listener for orientation events fired on the ThunderboardReactDevice object\n device.on('orientation', (res) => {\n // Show the event data\n console.log('- Orientation:');\n console.log(' - alpha :' + res.alpha + '°');\n console.log(' - beta :' + res.beta + '°');\n console.log(' - gamma :' + res.gamma + '°');\n });\n\n // Stop to monitor and disconnect the device in 5 seconds\n setTimeout(() => {\n device.stopMonitorOrientation((error) => {\n // Disconnect the device\n device.disconnect(() => {\n console.log('- Disconnected ' + device.localName);\n process.exit();\n });\n });\n }, 10000);\n}", "function determineOrientation(v) {\n\n let axis = undefined;\n const oX = v.x < 0 ? 'R' : 'L';\n const oY = v.y < 0 ? 'A' : 'P';\n const oZ = v.z < 0 ? 'I' : 'S';\n\n const aX = Math.abs(v.x);\n const aY = Math.abs(v.y);\n const aZ = Math.abs(v.z);\n const obliqueThreshold = 0.8;\n if (aX > obliqueThreshold && aX > aY && aX > aZ) {\n axis = oX;\n }\n else if (aY > obliqueThreshold && aY > aX && aY > aZ) {\n axis = oY;\n }\n else if (aZ > obliqueThreshold && aZ > aX && aZ > aY) {\n axis = oZ;\n }\n this.orientation = axis;\n return axis;\n}", "function getKeyOrientation() {\n\t\tvar keyOrientation;\n\t\t\n\t\tif (width > Configuration.SMALL_BREAKPOINT && options.keyType == \"scalar\") {\n\t\t\tkeyOrientation = \"vertical\";\n\t\t} else {\n\t\t\tkeyOrientation = \"horizontal\";\n\t\t}\n\n\t\treturn keyOrientation;\n\t}", "orientation(newX, newY, oldX, oldY) {\n if (newY > oldY) return 'up'\n if (newY < oldY) return 'down'\n if (newX > oldX) return 'right'\n return 'left'\n }", "function handler() {\n // Get the current orientation.\n var orientation = get_orientation();\n if(orientation !== last_orientation) {\n // The orientation has changed, so trigger the orientationchange event.\n last_orientation = orientation;\n win.trigger(\"orientationchange\");\n }\n }", "deviceorientationListener(event) {\n (this.dataset.orientation = this.dataset.orientation || []).push(event);\n }", "function OrientationAttribute(orientation) {\n var _this = this;\n var __arguments = new Array(arguments.length);\n for (var __argumentIndex = 0; __argumentIndex < __arguments.length; ++__argumentIndex) {\n __arguments[__argumentIndex] = arguments[__argumentIndex];\n }\n if (__arguments.length == 1) {\n var orientation_1 = __arguments[0];\n _this = _super.call(this) || this;\n _super.prototype.setAttributeType.call(_this, fm.liveswitch.sdp.AttributeType.OrientationAttribute);\n _this.setOrientation(orientation_1);\n _super.prototype.setMultiplexingCategory.call(_this, fm.liveswitch.sdp.AttributeCategory.Normal);\n }\n else {\n throw new fm.liveswitch.Exception('Constructor overload does not exist with specified parameter count/type combination.');\n }\n return _this;\n }", "function resetOrientation(armband){\n if(typeof armband == 'undefined'){\n for(var i= 0; i < Myo.myos.length; i++) {\n var myo = Myo.myos[i];\n myo.zeroOrientation();\n }\n } else {\n console.log(armband.connectIndex)\n Myo.myos[armband.connectIndex].zeroOrientation();\n }\n}", "function handler() {\n // Get the current orientation.\n var orientation = get_orientation();\n\n if (orientation !== last_orientation) {\n // The orientation has changed, so trigger the orientationchange event.\n last_orientation = orientation;\n win.trigger(\"orientationchange\");\n }\n }", "get baseRotation() { return this._baseRotation; }", "rotation() {\n return this.rotationInRadians().map(VrMath.radToDeg);\n }", "componentDidMount() {\n Orientation.addOrientationListener(this.orientationDidChange);\n }", "get verticalOrientation() {\n return this.navBarLocation === 'left' || this.navBarLocation === 'right';\n }", "_getRotationDirection() {\n const that = this,\n quadrant = that._getQuadrant(that._actualAngle);\n\n if ((that._actualAngle < that._angle && (quadrant !== 1 || that._quadrant !== 4)) || (that._actualAngle > that._angle && quadrant === 4 && that._quadrant === 1)) {\n return 'cw';\n }\n else {\n return 'ccw';\n }\n }", "function determineOrientation (event) {\n let key = event.keyCode;\n\n let w=window,\n d=document,\n e=d.documentElement,\n g=d.getElementsByTagName('body')[ 0 ],\n x=w.innerWidth||e.clientWidth||g.clientWidth,\n y=w.innerHeight||e.clientHeight||g.clientHeight;\n\n let vertical = x < breakpoints.md;\n let proceed = false;\n\n if (vertical) {\n if (key === keys.up || key === keys.down) {\n event.preventDefault();\n proceed = true;\n }\n }\n else {\n if (key === keys.left || key === keys.right) {\n proceed = true;\n }\n }\n if (proceed) {\n switchTabOnArrowPress(event);\n }\n}", "determineOrientation(event) {\n var key = event.keyCode;\n var vertical = this.tablist.getAttribute('aria-orientation') == 'vertical';\n var proceed = false;\n\n if (vertical) {\n if (key === keys.up || key === keys.down) {\n event.preventDefault();\n proceed = true;\n };\n }\n else {\n if (key === this.keys.left || key === this.keys.right) {\n proceed = true;\n };\n };\n\n if (proceed) {\n this.switchTabOnArrowPress(event);\n };\n }", "function WR_Rotate_Mobile() {\n\t \t$( window ).resize( function() {\n\t \t\tvar height_broswer = $( window ).height();\n\t \t\tvar width_broswer = $( window ).width();\n\n\t \t\tif ( typeof window.is_vertical_mobile === 'undefined' )\n\t \t\t\twindow.is_vertical_mobile = ( height_broswer < width_broswer ) ? true : false;\n\n\t\t\tif ( height_broswer < width_broswer && window.is_vertical_mobile ) { // Horizontal\n\t\t\t\twindow.is_vertical_mobile = false;\n\t\t\t\tcallback_resize();\n\t\t\t} else if ( height_broswer > width_broswer && !window.is_vertical_mobile ) { // Vertical\n\t\t\t\twindow.is_vertical_mobile = true;\n\t\t\t\tcallback_resize();\n\t\t\t}\n\t\t} );\n\n\t \tfunction callback_resize() {\n\t \t\t$.each( $.function_rotate_device, function( key, val ) {\n\t \t\t\tval.call();\n\t \t\t} );\n\t \t}\n\t }", "function displayInformation_orientationChanged(args) {\r\n oDisplayOrientation = args.target.currentOrientation;\r\n setPreviewRotation();\r\n }", "async function angleTest() {\n let angle;\n function updateAngle() {\n angle = screen.orientation.angle;\n }\n await document.documentElement.requestFullscreen();\n await screen.orientation.lock(\"portrait-primary\");\n updateAngle();\n console.log(`${angle} should be 0, 90 or 270`);\n await screen.orientation.lock(\"portrait-secondary\");\n console.log(`${screen.orientation.angle} should be 180, 90 or 270`);\n await screen.orientation.lock(\"landscape-primary\");\n console.log(`${screen.orientation.angle} should be 0, 90 or 270`);\n await screen.orientation.lock(\"landscape-secondary\");\n console.log(`${screen.orientation.angle} should be 180, 90 or 270`);\n screen.orientation.unlock();\n if (screen.width > screen.height) {\n console.log(\n `${\n screen.orientation.type\n } should be landscape-primary or landscape-secondary`\n );\n } else if (screen.width < screen.height) {\n console.log(\n `${\n screen.orientation.type\n } should be portrait-primary or portrait-secondary`\n );\n }\n return document.exitFullscreen();\n}", "_isHorizontal() {\n return this.orientation === 'horizontal';\n }", "function onScreenOrientationChange(event){\n\tcontrols.disconnect();\n\tif (window.innerWidth > window.innerHeight) camera = new THREE.PerspectiveCamera( 75, window.innerHeight / window.innerWidth, 1, 1100 );\n\telse camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 1, 1100 );\n\trenderer.setSize( window.innerWidth, window.innerHeight );\n\tcontrols = new DeviceOrientationController( camera, renderer.domElement );\n\tcontrols.connect();\n\tinfo.innerHTML += \"<br>rotation\"; \n}", "function calculateHeading() {\n if (window.DeviceOrientationEvent) {\n window.addEventListener(\"deviceorientation\", function (event) {\n if ('ondeviceorientationabsolute' in window) {\n window.ondeviceorientationabsolute = function(event) {\n currHeading = event.alpha;\n return true;\n };\n } else if(event.webkitCompassHeading) {\n var compass = event.webkitCompassHeading;\n handleOrientationEvent(compass);\n return true;\n } else if (event.absolute == true) {\n var compass = event.alpha;\n handleOrientationEvent(compass);\n return true;\n } else {\n demo.innerHTML = \"<br>Compass Heading Not Working\";\n return false;\n }\n }, true);\n } else {\n demo.innerHTML = \"<br>Compass Heading Not Working\";\n return false;\n }\n}", "function parseOrientationTag({buffer, exifData}) {\n let orientation = null\n if (exifData['0th'] && exifData['0th'][piexif.ImageIFD.Orientation]) {\n orientation = parseInt(exifData['0th'][piexif.ImageIFD.Orientation])\n }\n if (orientation === null) {\n throw new CustomError(m.errors.no_orientation, 'No orientation tag found in EXIF', buffer)\n }\n if (isNaN(orientation) || orientation < 1 || orientation > 8) {\n throw new CustomError(m.errors.unknown_orientation, `Unknown orientation (${orientation})`, buffer)\n }\n if (orientation === 1) {\n throw new CustomError(m.errors.correct_orientation, 'Orientation already correct', buffer)\n }\n return orientation\n}", "static get Orientations() {\n return [{\n title: i18nString(UIStrings.presets),\n value: [\n { title: i18nString(UIStrings.portrait), orientation: '[0, 90, 0]' },\n { title: i18nString(UIStrings.portraitUpsideDown), orientation: '[-180, -90, 0]' },\n { title: i18nString(UIStrings.landscapeLeft), orientation: '[90, 0, -90]' },\n { title: i18nString(UIStrings.landscapeRight), orientation: '[90, -180, -90]' },\n { title: i18nString(UIStrings.displayUp), orientation: '[0, 0, 0]' },\n { title: i18nString(UIStrings.displayDown), orientation: '[0, -180, 0]' },\n ],\n }];\n }", "function setOrientation(orientation){\n if(orientation)\n camera.rotation.z=Math.PI/2; ///=+\n else\n camera.rotation.z=0;\n}", "rotationInRadians() {\n return VrMath.getRotation(this.headMatrix);\n }", "function orientation(img_element) {\n var canvas = document.createElement('canvas');\n // Set variables\n var ctx = canvas.getContext(\"2d\");\n var exifOrientation = '';\n var width = img_element.width,\n height = img_element.height;\n\n // Check orientation in EXIF metadatas\n EXIF.getData(img_element, function () {\n var allMetaData = EXIF.getAllTags(this);\n exifOrientation = allMetaData.Orientation;\n });\n\n // set proper canvas dimensions before transform & export\n if (jQuery.inArray(exifOrientation, [5, 6, 7, 8]) > -1) {\n canvas.width = height;\n canvas.height = width;\n } else {\n canvas.width = width;\n canvas.height = height;\n }\n\n // transform context before drawing image\n switch (exifOrientation) {\n case 2:\n ctx.transform(-1, 0, 0, 1, width, 0);\n break;\n case 3:\n ctx.transform(-1, 0, 0, -1, width, height);\n break;\n case 4:\n ctx.transform(1, 0, 0, -1, 0, height);\n break;\n case 5:\n ctx.transform(0, 1, 1, 0, 0, 0);\n break;\n case 6:\n ctx.transform(0, 1, -1, 0, height, 0);\n break;\n case 7:\n ctx.transform(0, -1, -1, 0, height, width);\n break;\n case 8:\n ctx.transform(0, -1, 1, 0, 0, width);\n break;\n default:\n ctx.transform(1, 0, 0, 1, 0, 0);\n }\n\n // Draw img_element into canvas\n ctx.drawImage(img_element, 0, 0, width, height);\n var __return = canvas.toDataURL();\n $(canvas).remove();\n return __return;\n}", "orientationAndCreate(ori){\n if(ori === \"h\" || ori === \"H\"){\n // return buildAssetPath(hBlank)\n } else if(ori ===\"v\" || ori === \"V\") {\n\n return buildAssetPath(vBlank)\n }\n\n }", "function calculateOrientation(body_joint, joint_string){\n var x = body_joint.orientationX;\n var y = body_joint.orientationY;\n var z = body_joint.orientationZ;\n var w = body_joint.orientationW;\n // $('#text').text(body_joint);\n // console.log(body_joint);\n var T_x = 180/3.1416*Math.atan2( 2*y*z+2*x*w,1-2*x*x - 2*y*y); // leaning forward/backward\n var T_y = 180/3.1416*Math.asin(2*y*w-2*x*z); // turning\n var T_z = 180/3.1416*Math.atan2( 2*x*y + 2*z*w,1 - 2*y*y - 2*z*z); // leaning left/right\n\n // orientation_value = (Math.abs(T_x) / T_x) * (180 - Math.abs(T_x)) + 90;\n // var joint_orientationX = (Math.abs(T_x) / T_x) * (180 - Math.abs(T_x)) + 180;\n // var joint_orientationY = (Math.abs(T_y) / T_y) * (Math.abs(T_y) ) + 180;\n // var joint_orientationZ = (Math.abs(T_z) / T_z) * (180 - Math.abs(T_z)) + 180;\n var joint_orientationX = T_x + 180;\n var joint_orientationY = T_y + 180;\n var joint_orientationZ = T_z + 180;\n // console.log(joint_orientationX, joint_orientationY, joint_orientationZ);\n // $('#text').text(Math.round(joint_orientationX) + ' ' + Math.round(joint_orientationY) + ' ' + Math.round(joint_orientationZ));\n // $('#text').text(Math.round(T_x) + ' ' + Math.round(T_y) + ' ' + Math.round(T_z));\n if(joint_string == \"spine_mid\"){\n orientation_valueX = joint_orientationX;\n orientation_valueY = joint_orientationY;\n orientation_valueZ = joint_orientationZ;\n }\n\n return joint_orientationX;\n }", "_orientationDidChange(orientation) {\n let dimension = CommonUtils.getScreenDimension();\n let screenW;\n let { widthS, heightS } = dimension;\n if (orientation == \"LANDSCAPE\") {\n screenW = Math.max(widthS, heightS);\n }\n else\n screenW = Math.min(widthS, heightS);\n if (screenW != this.width) {\n this.width = screenW;\n this.vContainer && this.vContainer.forceUpdate();\n }\n }", "extractSlice(requestedOrientation,index){\n\n }", "function getOrientation(file, callback) {\n var reader = new FileReader();\n\n reader.onload = function(event) {\n var view = new DataView(event.target.result);\n\n if (view.getUint16(0, false) != 0xFFD8) return callback(-2);\n\n var length = view.byteLength,\n offset = 2;\n\n while (offset < length) {\n var marker = view.getUint16(offset, false);\n offset += 2;\n\n if (marker == 0xFFE1) {\n if (view.getUint32(offset += 2, false) != 0x45786966) {\n return callback(-1);\n }\n var little = view.getUint16(offset += 6, false) == 0x4949;\n offset += view.getUint32(offset + 4, little);\n var tags = view.getUint16(offset, little);\n offset += 2;\n\n for (var i = 0; i < tags; i++)\n if (view.getUint16(offset + (i * 12), little) == 0x0112)\n return callback(view.getUint16(offset + (i * 12) + 8, little));\n } else if ((marker & 0xFF00) != 0xFF00) break;\n else offset += view.getUint16(offset, false);\n }\n return callback(-1);\n };\n\n reader.readAsArrayBuffer(file.slice(0, 64 * 1024));\n}", "getRotation() {\nreturn this.rotation;\n}", "function isPortrait(){\n switch (window.orientation) { \n case 0: \n return true;\n \n case 180: \n \t return true;\n \n case -90: \n \t return false;\n \n case 90: \n \t return false;\n }\n }", "function init() {\n //Find our div containers in the DOM\n var dataContainerOrientamation = document.getElementById('dataContainerOrientation');\n var dataContainerMotion = document.getElementById('dataContainerMotion');\n \n //Check for support for DeviceOrientation event\n if(window.DeviceOrientationEvent) {\n window.addEventListener('deviceorientation', function(event) {\n alpha = event.alpha;\n beta = event.beta;\n gamma = event.gamma;\n }, true);\n } \n \n /*\n // Check for support for DeviceMotion events\n if(window.DeviceMotionEvent) {\n window.addEventListener('devicemotion', function(event) {\n alpha = event.accelerationIncludingGravity.x;\n beta = event.accelerationIncludingGravity.y;\n gamma = event.accelerationIncludingGravity.z;\n var r = event.rotationRate;\n var html = 'Acceleration:<br />';\n html += 'x: ' + x +'<br />y: ' + y + '<br/>z: ' + z+ '<br />';\n html += 'Rotation rate:<br />';\n if(r!=null) html += 'alpha: ' + r.alpha +'<br />beta: ' + r.beta + '<br/>gamma: ' + r.gamma + '<br />';\n dataContainerMotion.innerHTML = html; \n });\n }\n */ \n}", "function getSurfaceOrientation(dumpsys) {\n var m = /SurfaceOrientation: \\d/gi.exec(dumpsys);\n return m && parseInt(m[0].split(':')[1]);\n}", "function DisplayOrientation() {\n\tthis.code = null;\n\tthis.message = \"\";\n}", "function Device(portrait, landscape, portraitCallback, landscapeCallback)\n{\n\tthis.camera = null;\n\tthis.geoCallback = null;\n\tthis.geoId = null;\n\tthis.position = [0, 0, 0];\n\tthis.portrait_div = portrait;\n\tthis.landscape_div = landscape;\n\n\tthis.orientationcallback = function(event) \n\t{ \n\t\tif (Math.abs(window.orientation) == 90)\n\t\t{\n\t\t\tdocument.getElementById(this.portrait_div).style.display = 'none';\n\t\t\tdocument.getElementById(this.landscape_div).style.display = 'block';\n\t\t\tif (landscapeCallback) landscapeCallback();\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdocument.getElementById(this.portrait_div).style.display = 'block';\n\t\t\tdocument.getElementById(this.landscape_div).style.display = 'none';\n\t\t\tif (portraitCallback) portraitCallback();\n\t\t}\n\t}.bind(this);\n\tthis.orientationcallback();\n\n\tthis.gn = new GyroNorm();\n\n\t// add listener for device orientation, effectively switches to the other 'main' div when rotated\n\twindow.addEventListener(\"orientationchange\", this.orientationcallback);\n}", "function setOrientation() {\n $(\".cardBody\").css('height', window.innerHeight - 70);\n $(\".cardBody\").css('width', window.innerWidth - 100);\n if (self.widget) {\n \tself.widget.setCorrectAnswerTickHeight();\n }\n \n }", "function orientation(img, canvas) {\n var ctx = canvas.getContext(\"2d\");\n var exifOrientation = '';\n var width = img.width,\n height = img.height;\n // Check orientation in EXIF metadatas\n EXIF.getData(img, function() {\n var allMetaData = EXIF.getAllTags(this);\n exifOrientation = allMetaData.Orientation;\n console.log('Exif orientation: ' + exifOrientation);\n console.log(allMetaData);\n });\n // set proper canvas dimensions before transform & export\n if (jQuery.inArray(exifOrientation, [5, 6, 7, 8]) > -1) {\n canvas.width = height;\n canvas.height = width;\n } else {\n canvas.width = width;\n canvas.height = height;\n }\n switch (exifOrientation) {\n case 2:\n ctx.transform(-1, 0, 0, 1, width, 0);\n break;\n case 3:\n ctx.transform(-1, 0, 0, -1, width, height);\n break;\n case 4:\n ctx.transform(1, 0, 0, -1, 0, height);\n break;\n case 5:\n ctx.transform(0, 1, 1, 0, 0, 0);\n break;\n case 6:\n ctx.transform(0, 1, -1, 0, height, 0);\n break;\n case 7:\n ctx.transform(0, -1, -1, 0, height, width);\n break;\n case 8:\n ctx.transform(0, -1, 1, 0, 0, width);\n break;\n default:\n ctx.transform(1, 0, 0, 1, 0, 0);\n }\n ctx.drawImage(img, 0, 0, width, height);\n}", "function getAxis(orientation) {\n if (!orientation)\n return null;\n\n if (orientation === 12 || orientation === 6)\n return 'X';\n else\n return 'Y';\n}", "function _toggleOrientation() {\n var tmpWidth = pageWidth;\n pageWidth = pageHeight;\n pageHeight = tmpWidth;\n }", "function _toggleOrientation() {\n var tmpWidth = pageWidth;\n pageWidth = pageHeight;\n pageHeight = tmpWidth;\n }", "function handler()\n\t{\n\t\t// Get the current orientation.\n\t\tvar orientation = get_orientation();\n\n\t\tif(orientation !== last_orientation)\n\t\t{\n\t\t\t// The orientation has changed, so trigger the orientationchange event.\n\t\t\tlast_orientation = orientation;\n\t\t\twin.trigger( \"orientationchange\" );\n\t\t}\n\t}", "function keyboardOrientationChange() {\n //console.log(\"orientationchange fired at: \" + Date.now());\n //console.log(\"orientation was: \" + (ionic.keyboard.isLandscape ? \"landscape\" : \"portrait\"));\n\n // toggle orientation\n ionic.keyboard.isLandscape = !ionic.keyboard.isLandscape;\n // //console.log(\"now orientation is: \" + (ionic.keyboard.isLandscape ? \"landscape\" : \"portrait\"));\n\n // no need to wait for resizing on iOS, and orientationchange always fires\n // after the keyboard has opened, so it doesn't matter if it's open or not\n if (ionic.Platform.isIOS()) {\n keyboardUpdateViewportHeight();\n }\n\n // On Android, if the keyboard isn't open or we aren't using the keyboard\n // plugin, update the viewport height once everything has resized. If the\n // keyboard is open and we are using the keyboard plugin do nothing and let\n // nativeShow handle it using an accurate keyboard height.\n if ( ionic.Platform.isAndroid()) {\n if (!ionic.keyboard.isOpen || !keyboardHasPlugin()) {\n keyboardWaitForResize(keyboardUpdateViewportHeight, false);\n } else {\n wasOrientationChange = true;\n }\n }\n}", "function updateOrientation(e) {\n var a = Math.round(e.alpha); // Left and Right\n var g = Math.round(e.gamma);// Up and down\n // The below rules for fixing gamma and alpha were found by watching initial values and playing with the phone\n // Fix gamma so it doesn't jump\n if(g < 0)\n {\n g+=180;\n }\n\n g -= 90;\n g = g > CamMotion.verticalMax ? CamMotion.verticalMax : g;\n g = g < CamMotion.verticalMin ? CamMotion.verticalMin : g;\n \n // Fix alpha so it doesn't jump\n // There are different rules if gamma is more than or less than 0\n if(g > 0)\n {\n a -= 180; \n }\n else\n {\n if(a > 180)\n {\n a -= 360;\n }\n }\n a = a > CamMotion.horizontalMax ? CamMotion.horizontalMax : a;\n a = a < -CamMotion.horizontalMax ? -CamMotion.horizontalMax : a;\n \n // This may be useful for debugging other phones someday so leaving it here\n //$('#rotAlpha').text(a);\n //$('#rotBeta').text(b);\n //$('#rotGamma').text(g);\n \n CamMotion.vertical = -g;\n CamMotion.horizontal = -a;\n\n // Update the tilt display\n updateTiltDot();\n \n // Safely send the new info\n safeSendData();\n }", "isRotateSupported() {\n return true;\n }", "function onOrientationChanged(e){\n\tif (e.orientation == 1 || e.orientation == 2) {\n\t\tnew Animator().moveTo({\n\t\t\tview: $.author,\n\t\t\tvalue: {\n\t\t\t\tx: 0,\n\t\t\t\ty: '130dp'\n\t\t\t}\n\t\t});\n\t} else if (e.orientation == 3 || e.orientation == 4) {\n\t\tnew Animator().moveTo({\n\t\t\tview: $.author,\n\t\t\tvalue: {\n\t\t\t\tx: 0,\n\t\t\t\ty: '0dp'\n\t\t\t}\n\t\t});\n\t}\n}", "getTurn (orientation, clockwise) {\n if (orientation === Orientation.left) return clockwise ? Orientation.up : Orientation.down;\n if (orientation === Orientation.up) return clockwise ? Orientation.right : Orientation.left;\n if (orientation === Orientation.down) return clockwise ? Orientation.left : Orientation.right;\n if (orientation === Orientation.right) return clockwise ? Orientation.down : Orientation.up;\n }", "getOrientation(tile1, tile2) {\n var arr = [[0,1,2], [7,8,3], [6,5,4]];\n\n var hor = [];\n if(tile1.y < tile2.y) {\n //Up\n hor = arr[0];\n } else if(tile1.y>=tile2.y && tile1.y <= (tile2.y + tile2.height)) {\n //Middle\n hor = arr[1];\n } else {\n //Down\n hor = arr[2];\n }\n\n var result = 0;\n if(tile1.x<tile2.x) {\n result = hor[0];\n } else if(tile1.x>=tile2.x && tile1.x<=(tile2.x+tile2.width)) {\n result = hor[1];\n } else {\n result = hor[2];\n }\n return result;\n }", "get tabTextOrientation() {\n\t\treturn this.nativeElement ? this.nativeElement.tabTextOrientation : undefined;\n\t}", "get tabTextOrientation() {\n\t\treturn this.nativeElement ? this.nativeElement.tabTextOrientation : undefined;\n\t}", "get isPhoneLandscape() {\n return window.matchMedia(this.PHONE_LANDSCAPE).matches;\n }", "function handleOrientation(event){\n\t\tbeta = Math.floor(event.beta);\n\t\tgamma = Math.floor(event.gamma);\n\n\t\t//send the values to the DOM so we can actually see what they are \n\t\t// document.getElementById('alpha').innerHTML = alpha;\n\t\t// document.getElementById('beta').innerHTML = beta;\n\t\t// document.getElementById('gamma').innerHTML = gamma;\n\n\t\tsocket.emit('orientation',{\n\t\t\t// 'alpha':alpha,\n\t\t\t'beta': beta,\n\t\t\t'gamma': gamma\n\t\t});\n\n\t}", "function Orientation(a,b,c) {\n var det=b.x*c.y-a.x*c.y-b.y*c.x+a.y*c.x+a.x*b.y-a.y*b.x;\n if (det>0.0001) {\n return 1;\n }\n else if (det>0) {\n return 0;\n }\n else {\n return -1;\n }\t\n }", "function orientation(p, q, r) {\n\tlet val = (r.x - q.x) * (q.y - p.y) - (r.y - q.y) * (q.x - p.x);\n\tif (val == 0) return 0;\n\treturn (val > 0) ? 1 : 2;\n}", "function ensurePWAorientation(orientation) {\n if (orientation && typeof orientation === 'string') {\n let webOrientation = orientation.toLowerCase();\n if (webOrientation !== 'default') {\n return webOrientation;\n }\n }\n return DEFAULT_ORIENTATION;\n}", "get baseRotationDegree() { return this._baseRotation * 180.0 / Math.PI; }", "function getPossibleOrientationsWithTimes(){\n\n if (sts.specs.playback !== null) {\n // get relevant orientation objects\n var res = $(sts.specs.playback.orientation).filter(function(){\n // console.log(sts.currentTime);\n return this.start <= sts.currentTime\n && this.end > sts.currentTime;\n\n });\n\n //round to two decimal spaces\n var cTime = sts.currentTime.toFixed(2);\n document.getElementById('print-time').innerHTML = cTime;\n\n //convert radians to degrees\n var cOri = sts.theta.current*180/Math.PI;\n // if the radian was in negative value make sure to conver it\n if (cOri < 0){\n cOri = 360 + cOri;\n }\n //round to two decimal spaces\n cOri = cOri.toFixed(0);\n document.getElementById('print-current-orientation').innerHTML = cOri;\n\n // arrow directions\n // threshold degree 10\n\n // update main orientation\n closestMOri = res[0].orientations[0]*180/Math.PI;\n for (var i = 0; i < res[0].orientations.length; i++){\n // convert radians to degrees\n var mOri = res[0].orientations[i]*180/Math.PI;\n if (mOri < 0){\n mOri = 360 + mOri;\n }\n var diff = Math.min(Math.abs(cOri-mOri), 360 - Math.abs(cOri-mOri));\n if (diff < Math.abs(cOri-closestMOri)){\n closestMOri = mOri;\n }\n }\n\n var absOri = Math.abs(cOri-closestMOri);\n if (absOri > 5){\n if (absOri <= 180){\n if ((cOri-closestMOri) > 0){\n document.getElementById(\"rarrow\").style.visibility=\"visible\";\n document.getElementById(\"larrow\").style.visibility=\"hidden\";\n }\n else {\n document.getElementById(\"larrow\").style.visibility= \"visible\";\n document.getElementById(\"rarrow\").style.visibility= \"hidden\";\n }\n }\n else {\n if ((cOri-closestMOri) < 0){\n document.getElementById(\"rarrow\").style.visibility=\"visible\";\n document.getElementById(\"larrow\").style.visibility=\"hidden\";\n }\n else {\n document.getElementById(\"larrow\").style.visibility= \"visible\";\n document.getElementById(\"rarrow\").style.visibility= \"hidden\";\n }\n }\n }\n else {\n document.getElementById(\"larrow\").style.visibility=\"hidden\";\n document.getElementById(\"rarrow\").style.visibility= \"hidden\";\n }\n\n if (s != res[0].start){\n // console.log(\":)\");\n // alert(res[0].orientations + \" :)\");\n s = res[0].start;\n\n // document.getElementById('print-main-orientation').innerHTML = res[0].orientations;\n\n //round to two decimal spaces\n // var ori = (res[0].orientations).toFixed(2);\n // document.getElementById('print-main-orientation').innerHTML = ori;\n // i++;\n\n //var cOri = document.getElementById('iframe_id').getOrientation();\n //document.getElementById('print-main-orientation').innerHTML = cOri;\n // vrView.Message.GET_ORIENTATION;\n\n //var check = document.getElementById(\"vrView\").contentWindow.Message.GET_ORIENTATION;\n\n // res[0].orientations is an array\n\n //if (res[0].orientations.includes(\",\") == \"true\"){\n\n var ori = \"\";\n closestMOri = res[0].orientations[0]*180/Math.PI;\n for (var i = 0; i < res[0].orientations.length; i++){\n // convert radians to degrees\n var mOri = res[0].orientations[i]*180/Math.PI;\n if (mOri < 0){\n mOri = 360 + mOri;\n }\n var diff = Math.min(Math.abs(cOri-mOri), 360 - Math.abs(cOri-mOri));\n if (diff < Math.abs(cOri-closestMOri)){\n closestMOri = mOri;\n }\n\n ori = ori + mOri.toFixed(0) + \" \";\n }\n document.getElementById('print-main-orientation').innerHTML = ori;\n }\n\n\n // vrView.getOrientation();\n // console.log(\"orientations get \" + vrView.getOrientation());\n\n // else if ()\n // for each relevant orientation object, append possible orientations\n var all_orientations = [];\n var all_times = [];\n for (var i = 0; i < res.length; i++) {\n all_orientations = all_orientations.concat(res[i].orientations);\n for (var j = 0; j < res[i].orientations.length; j++) {\n all_times.push([res[i].start, res[i].end]);\n };\n };\n return {times: all_times, orientations: all_orientations};\n }\n\n}", "function orientationFromPlacement(plc) {\r\n return placementToOrientationMap[plc];\r\n }" ]
[ "0.71755445", "0.71755445", "0.71301854", "0.7077261", "0.69223964", "0.6693444", "0.66563964", "0.6649725", "0.6569375", "0.6569375", "0.65346885", "0.6391145", "0.63472396", "0.6303498", "0.62987596", "0.6279408", "0.6264217", "0.62104577", "0.61887944", "0.6141835", "0.6119318", "0.6116887", "0.6066357", "0.5975018", "0.5948803", "0.59364265", "0.5882776", "0.58613133", "0.5853059", "0.5843462", "0.58418745", "0.57954854", "0.57843906", "0.56915504", "0.5691479", "0.5691479", "0.5691479", "0.56841403", "0.56749475", "0.56558", "0.5622671", "0.56109005", "0.5605643", "0.5587865", "0.555762", "0.5548557", "0.55450296", "0.54937804", "0.5491837", "0.5483095", "0.54807705", "0.54616714", "0.546116", "0.54402673", "0.5435756", "0.54237497", "0.5419799", "0.5404825", "0.5401064", "0.539842", "0.53972256", "0.5394652", "0.53702635", "0.5365431", "0.5365214", "0.5363021", "0.534714", "0.5343313", "0.53416187", "0.5329459", "0.5327239", "0.53209424", "0.53160673", "0.5305917", "0.5301908", "0.5301333", "0.5275306", "0.52751416", "0.52699214", "0.52657574", "0.52494174", "0.5236721", "0.5236721", "0.5226206", "0.5225777", "0.52231735", "0.5220505", "0.5209855", "0.5204843", "0.52047354", "0.5197284", "0.5197284", "0.51925725", "0.51917475", "0.51679933", "0.5158847", "0.5153788", "0.5151608", "0.51378417", "0.513548" ]
0.6605403
8
Ende of calculate_Tri / == end tkharbi9 dial ayoub == ==
function findWay(source){ var id_room = $('#room').val().split(" ").join("").toLowerCase(); id_room = zimmerNameId[id_room]; graph = new Graph(map); var shortWay = []; shortWay = graph.findShortestPath(zonesNameId[source],id_room); console.log("the short way to the destination : \n"+shortWay); var len = shortWay.length; // the points of each noud which will be drawed var points =[]; for(i=0;i<len;i++){ var key = shortWay[i]; if(mapCoordnidates[key]){ object = {"x":mapCoordnidates[key].x, "y":mapCoordnidates[key].y}; points.push(object); } } /*for(i=0;i<points.length;i++){ console.log("points of the line : \n"+points[i].x+' '+points[i].y); }*/ // draw the line of the points until the destination d3.select("#theWay").attr("visibility","hidden"); // hide the distination to draw it again // d3.select("#destination").attr("visibility","hidden"); var lineFunction = d3.svg.line() .x(function(d) { return d.x; }) .y(function(d) { return d.y; }) .interpolate("linear"); // the arrow of the end var defs = d3.select("#svg8").append("svg:defs"); /* here to generate the marker shape and assign it the "arrow" id */ defs.append("svg:marker") .attr("id", "arrow") .attr("viewBox", "0 0 10 10") .attr("refX", 1) .attr("refY", 5) .attr("markerWidth", 6) .attr("markerHeight", 6) .attr("orient", "auto") .attr('fill','#3498db') .append('svg:path') .attr('d', "M 0 0 L 10 5 L 0 10 z"); d3.select("#theWay").attr("d", lineFunction(points)) .attr("id","theWay") .attr("stroke", "#3498db") .attr("stroke-width", 2) .attr("fill", "none") .attr("visibility","visible") .attr('marker-end', 'url(#arrow)'); // draw the destination // d3.select("#"+id_room) // .style("fill","#d35400") // .attr("r",3) // .attr('id','destination') // .attr("visibility","visible"); }// end finWay
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function kiemTra(X, Y, viTriMoi){\n X = viTriX + X;\n Y = viTriY + Y;\n viTriMoi = viTriMoi || ViTriXoay; // khi xoay khoi co bi qua ngoai man hinh khong\n\n\n\n for ( var y = 0; y < 4; ++y ) {\n for ( var x = 0; x < 4; ++x ) {\n if ( viTriMoi [ y ][ x ] ) {\n if ( typeof bangGiaTri[ y + Y ] == 'undefined' // kiem tra cac Dk cua khoi co kha thi hay khong, khong ra ngoai khung hinh\n || typeof bangGiaTri[ y + Y ][ x + X ] == 'undefined'\n || bangGiaTri[ y + Y ][ x + X ]\n || x + X < 0\n || y + Y >= dongBang\n || x + X>= cotBang ) {\n if (Y == 1) \n\t\t\t\t\t{\n\t\t\t\t\t\tThua = true; // neu khoi dang o dong tren cung thi thua\n\t\t\t\t\t\t\n\t\t\t\t\t}\n return false;\n }\n }\n }\n }\n return true;\n}", "function TinhTien() {\n //Lay loai xe\n var loaiXe = LayloaiXe();\n console.log(loaiXe);\n //Lay thoi gian cho\n var tgCho = getEle('tgCho').value;\n //lay so km\n var soKM = getEle('soKm').value;\n var tongHoaDon = 0;\n //Tinh theo loai xe\n switch (loaiXe) {\n case 'uberX':\n tongHoaDon = TinhTheoLoaiXe(soKM, tgCho, UberX_1, UberX_2, UberX_3, tgCho_UberX);\n break;\n case 'uberSUV':\n tongHoaDon = TinhTheoLoaiXe(soKM, tgCho, UberSUV_1, UberSUV_2, UberSUV_3, tgCho_UberSUV);\n break;\n case 'uberBlack':\n tongHoaDon = TinhTheoLoaiXe(soKM, tgCho, UberBlack_1, UberBlack_2, UberBlack_3, tgCho_UberBlack);\n break;\n default:\n break;\n }\n}", "function perimetroTriangulo(lado1, lado2, base){\n return lado1 + lado2 + base;\n}", "function perimetroTriangulo(lado1,lado2,lado3){\n return lado1+lado2+lado3;\n}", "function calcularAlturaTrianguloIsoceles(){\n console.group(\"llamados\");\n const inputLado1 = document.getElementById(\"inputLado1TrianguloIso\")\n const lado1Triangulo = inputLado1.value;\n const lado1Tri = parseInt(lado1Triangulo);\n console.log(lado1Tri);\n console.log(typeof(lado1Tri));\n \n\n const inputLado2 = document.getElementById(\"inputLado2TrianguloIso\")\n const lado2Triangulo = inputLado2.value;\n const lado2Tri = parseInt(lado2Triangulo);\n console.log(lado2Tri);\n console.log(typeof(lado2Tri));\n\n const inputLado3 = document.getElementById(\"inputLado3TrianguloIso\")\n const lado3Triangulo = inputLado3.value;\n const lado3Tri = parseInt(lado3Triangulo);\n console.log(lado3Tri);\n console.log(typeof(lado3Tri));\n console.groupEnd();\n \n function despejeAlturaTriangulo(lado, base){\n return Math.sqrt((lado * lado) - (base/2) * (base/2));\n } \n function filtrandoDatos (){\n console.group(\"filtrado\")\n if (lado1Tri === lado2Tri){\n const lado = lado1Tri;\n console.log(lado);\n console.log(typeof(lado));\n const base = lado3Tri;\n console.log(base)\n console.log(typeof(base));\n const altura = despejeAlturaTriangulo(lado, base);\n alert (altura);\n } \n \n else if (lado1Tri === lado3Tri){\n const lado = lado1Tri;\n console.log(lado);\n console.log(typeof(lado));\n const base = lado2Tri; \n console.log(base)\n console.log(typeof(base));\n const altura = despejeAlturaTriangulo(lado, base);\n alert (altura);\n } \n \n else if (lado2Tri === lado3Tri){\n const lado = lado2Tri;\n console.log(lado);\n console.log(typeof(lado));\n const base = lado1Tri;\n console.log(base)\n console.log(typeof(base));\n const altura = despejeAlturaTriangulo(lado, base);\n alert (altura);\n } \n \n else{\n alert(\"Tus valores no corresponden con un Triangulo Isoceles\");\n }\n console.groupEnd();\n }\n filtrandoDatos();\n}", "function calcularPerimetroTriangulo(){\n const base=document.getElementById(\"InputBase\").value;\n const lado1=document.getElementById(\"InputLado1\").value;\n const lado2=document.getElementById(\"InputLado2\").value;\n const perimetro=redondear((Number(base+lado1+lado2)),2);\n alert(perimetro);\n}", "function myFunction() {\n\n var a = parseInt(document.getElementById(\"one\").value);\n var b = parseInt(document.getElementById(\"two\").value);\n var c = parseInt(document.getElementById(\"three\").value);\n // console.log(a);\n // console.log(b);\n // console.log(c);\n var result = triangles(a, b, c);\n\n alert(result)\n}", "function zbirTri(br1, br2, br3){\n let rez = br1 + br2 + br3;\n return rez;\n}", "function crystal () {\"use strict\"; \n var antenna = Calc.calc ({\n name: \"antenna_loop\",\n input : {\n f : [1e3],\n d : [1e0],\n s : [1e0],\n w : [1e0],\n b : [1e-3],\n h : [1e0],\n N : [],\n design: [\"O\", \"[]\", \"[ ]\", \"[N]\"],\n wire_d : [1e-3],\n material : [\"Perfect\", \"Cu\", \"Al\"]\n },\n output : { \n // part 1\n lambda : [1e+0, 3],\n mu : [1e0, 1],\n g : [1e0, 2, \"exp\"], \n l : [1e0, 2],\n ll : [1e0, 2],\n ll0 : [1e0, 2],\n p : [1e0, 2],\n pl : [1e0, 2],\n S : [1e0, 2],\n \n W : [1e0, 2],\n\n D : [1e0, 2],\n G : [1e-1, 2],\n hg : [1e0, 2],\n RS : [1e0, 2, \"exp\"],\n R1 : [1e0, 2],\n Rl : [1e0, 2],\n Qa : [1e0, 2],\n C : [1e-12, 2],\n C0 : [1e-12, 2],\n L0 : [1e-6, 2],\n eta : [1e0, 2, \"exp\"], \n Za : [1e0, 2, \"complex\"],\n f0 : [1e6, 2],\n lambda0 : [1e0, 2]\n }\n }, function () { \n var KWH = 10;\n var KL = 0.14;\n \n this.check (this.f >= 1e3 && this.f <= 30e6, \"f\"); \n this.check ((this.w > this.h && this.w / this.h <= KWH) || (this.h > this.w && this.h / this.w <= KWH) || (this.h == this.w), \"wh\");\n this.check (this.wire_d > 0, \"wire_d\");\n \n this.lambda = Phys.C / this.f;\n \n // характеристики материала проводника\n var material = Materials [this.material];\n this.g = material.g;\n this.mu = material.mu;\n \n // непосредственно рамка\n if (this.design === \"O\") {\n \tthis.check (this.d > 0, \"d\");\n \t\n this.S = Math.PI * Math.pow (this.d / 2, 2);\n this.p = Math.PI * this.d;\n this.w = 0;\n this.h = 0;\n this.N = 1;\n } else if (this.design === \"[]\") {\n\t\t\tthis.check (this.s > 0, \"s\");\n\t\t\t\n this.S = Math.pow (this.s, 2);\n this.p = this.s * 4;\n this.w = this.s;\n this.h = this.s;\n this.d = 0;\n this.N = 1;\n } else if (this.design === \"[N]\") {\n this.check (this.N >= 2 && this.N <= 60, \"N\");\n this.check (this.b >= 5 * this.wire_d && this.b <= this.s / (5 * this.N), \"b\");\n this.check (this.s > 0, \"s\");\n \n this.S = Math.pow (this.s, 2);\n this.p = this.s * 4;\n this.w = this.s;\n this.h = this.s;\n this.d = 0;\n } else {\n \tthis.check (this.w > 0, \"w\");\n\t\t\tthis.check (this.h > 0, \"h\");\n\t\t\t\n this.S = this.h * this.w;\n this.p = (this.h + this.w) * 2;\n this.d = 0;\n this.N = 1;\n }\n \n var antenna = new MagneticLoop (this.d, this.w, this.h, this.wire_d, this.b, this.N, this.g, this.mu);\n this.antenna = antenna;\n \n var antennaAtLambda = this.antenna.fn (this.lambda);\n this.antennaAtLambda = antennaAtLambda;\n \n this.R1 = antennaAtLambda.R1;\n this.eta = antennaAtLambda.eta;\n this.RS = antennaAtLambda.RS;\n this.Rl = antennaAtLambda.Rl;\n this.Za = antennaAtLambda.Z;\n this.hg = antennaAtLambda.lg;\n this.D = antennaAtLambda.D; \n this.W = antennaAtLambda.W; \n this.Qa = antennaAtLambda.Q;\n this.S = antennaAtLambda.S;\n this.p = antennaAtLambda.p;\n this.l = antennaAtLambda.l;\n this.ll = this.l / this.lambda;\n this.pl = this.p / this.lambda;\n this.f0 = antennaAtLambda.f0;\n this.C0 = antennaAtLambda.C0;\n this.L0 = antennaAtLambda.L0;\n this.lambda0 = antennaAtLambda.lambda0;\n this.ll0 = this.lambda / this.lambda0;\n\n // ограничение на периметр 0,14 lambda (Кочержевский)\n this.suggest (this.p <= this.lambda * KL, \"pL\"); \n this.suggest (!isNaN (this.f0), \"f0\"); \n\n this.check (this.l <= this.lambda * KL || this.N === 1, \"lL\");\n this.check (this.p <= this.lambda, \"pl\"); \n this.check (this.wire_d <= this.p / 20, \"wire_d\"); \n \n // http://www.chipinfo.ru/literature/radio/200404/p67.html\n // this.Q = 3 * Math.log (this.d / this.wire_d) * Math.pow (this.lambda / this.p, 3) / Math.PI * this.eta; \n this.G = Math.log10 (this.D * this.eta);\n\n // fmax ограничиваем l = 0.14 * lambda\n this.band = Plots.band (this.f, KL * Phys.C / this.l);\n this.fnZ = function (freq) {\n return antenna.fn (Phys.C / freq).Z;\n };\n \n this.plot (Plots.impedanceResponseData (this.fnZ, this.band, 200), Plots.impedanceResponseAxes (this.band), 0);\n });\n \n var circuit = Calc.calc ({\n name: \"circuit\",\n input : {\n E : [1e-3],\n Ctype : [\"A12-495x1\", \"A12-495x2\", \"A12-495x3\", \"A12-365x1\", \"A12-365x2\", \"A12-365x3\", \n \"A4-15x1\", \"A4-15x2\", \n \"S5-270x1\", \"S5-270x2\", \"S5-180x1\", \"S5-180x2\"],\n R : [1e3],\n Cx : [1e-12],\n f : antenna.f\n },\n output : { \n C : [1e-12, 2],\n \n // part 2\n Pn : [1e0, 1, \"exp\"],\n Ea : [1e-3, 2],\n Ee : [1e-3, 2],\n Cmin : [1e-12, 2],\n Cmax : [1e-12, 2],\n Ct : [1e-12, 2],\n QC : [1e0, 3],\n rC : [1e0, 2],\n etaF : [1e0, 2, \"exp\"],\n Rn : [1e3, 2],\n KU : [1e-1, 2],\n Un : [1e-3, 2],\n Qn : [1e0, 2],\n dF : [1e3, 2]\n }\n }, function () { \n this.check (this.E <= 10 && this.E > 0, \"E\"); \n this.check (this.R > 0, \"R\");\n \n // -------------------------------------------------------\n var capacitor = Capacitors [this.Ctype];\n \n this.Ea = antenna.antennaAtLambda.fnE (this.E);\n this.QC = capacitor.Q;\n \n this.C = 1 / (2 * Math.PI * this.f * antenna.antennaAtLambda.Z.y); \n this.check (this.C >= 0, \"C\");\n this.C = this.C < 0 ? 0 : this.C;\n \n this.check (this.Cx >= 0, \"Cx\"); \n this.Ct = this.C - this.Cx;\n\n this.Cmin = capacitor.Cmin * capacitor.N + this.Cx;\n this.Cmax = capacitor.Cmax * capacitor.N + this.Cx;\n this.check (this.C >= this.Cmin, \"Cmin\");\n this.check (this.C <= this.Cmax, \"Cmax\");\n \n this.Ct = Math.clamp (this.Ct, this.Cmin - this.Cx, this.Cmax - this.Cx);\n this.CC = this.Ct + this.Cx;\n \n function fnCircuit (f, aerial, C, QC, R) {\n var result = [];\n \n result.zC = Phys.fnCapacitor (f, C, QC).Z;\n result.zRC = result.zC.par (new Complex (R, 0));\n result.z = aerial.Z.sum (result.zRC);\n result.fnU = function (E) {\n return new Complex (aerial.fnE (E), 0).div (result.z).mul (result.zRC);\n };\n \n return result;\n };\n\n this.fnCircuit = function (f) {\n var aerial = antenna.antenna.fn (Phys.C / f);\n return {\n x : fnCircuit (f, aerial, this.CC, this.QC, this.R),\n min : fnCircuit (f, aerial, this.Cmax, this.QC, this.R),\n max : fnCircuit (f, aerial, this.Cmin, this.QC, this.R)\n };\n }; \n \n var p0 = Math.pow (antenna.lambda * this.E / (2 * Math.PI), 2) / (4 * Phys.Z0 / Math.PI);\n var circuit = fnCircuit (this.f, antenna.antennaAtLambda, this.CC, this.QC, this.R);\n \n this.Ee = fnCircuit (this.f, antenna.antennaAtLambda, this.CC, this.QC, 1e12).fnU (this.E).mod ();\n this.rC = circuit.zC.x;\n // TODO: Точный расчет\n this.Qn = -circuit.zC.y / circuit.z.x;\n this.dF = this.f / this.Qn;\n this.Un = circuit.fnU (this.E).mod ();\n this.Rn = antenna.Za.par (circuit.zC).mod ();\n this.Pn = this.Un * this.Un / this.R;\n this.etaF = this.RS / (this.rC + antenna.Za.x);\n this.KU = Math.log10 (this.Pn / p0);\n \n var Ux = [];\n var Umin = [];\n var Umax = [];\n \n var fmin = antenna.band [0];\n var fmax = antenna.band [1];\n\n if (fmax > fmin) {\n for (var freq = fmin; freq <= fmax; freq += (fmax - fmin) / 200) {\n \tvar p0 = Math.pow (Phys.C / freq * this.E / (2 * Math.PI), 2) / (4 * Phys.Z0 / Math.PI);\n\n var circuit = this.fnCircuit (freq);\n \n\t\t\t\tvar px = Math.pow (circuit.x.fnU (this.E).mod (), 2) / this.R;\n\t\t\t\tvar pmin = Math.pow (circuit.min.fnU (this.E).mod (), 2) / this.R;\n\t\t\t\tvar pmax = Math.pow (circuit.max.fnU (this.E).mod (), 2) / this.R;\n \n\t\t\t\tUx.push ( [freq, 10 * Math.log10 (px / p0)]);\n\t\t\t\tUmin.push ( [freq, 10 * Math.log10 (pmin / p0)]);\n\t\t\t\tUmax.push ( [freq, 10 * Math.log10 (pmax / p0)]); \n }\n \n\t\t\tvar options1;\n\t\t\toptions1 = {\n\t\t\t\tseries : {\n\t\t\t\t\tlines : {\n\t\t\t\t\t\tshow : true,\n\t\t\t\t\t\tlineWidth : 2,\n\t\t\t\t\t\tzero : false\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\txaxis : Plots.linFx (),\n\t\t\t\tyaxes : [Plots.logDB ()],\n\t\t\t\tlegend : {\n\t\t\t\t\tshow : true,\n\t\t\t\t\tnoColumns : 1,\n\t\t\t\t\tposition : \"se\"\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tthis.plot ( [{\n\t\t\t\tdata : Ux,\n\t\t\t\tcolor : \"#030\",\n\t\t\t\tlabel : \"При настройке на расчетную частоту\",\n\t\t\t\tshadowSize : 0\n\t\t\t}, {\n\t\t\t\tdata : Umin,\n\t\t\t\tcolor : \"#F00\",\n\t\t\t\tlabel : \"При максимальной ёмкости КПЕ\",\n\t\t\t\tshadowSize : 0\n\t\t\t}, {\n\t\t\t\tdata : Umax,\n\t\t\t\tcolor : \"#00F\",\n\t\t\t\tlabel : \"При минимальной ёмкости КПЕ\",\n\t\t\t\tshadowSize : 0\n\t\t\t}], options1, 0);\n } \n });\n}", "function trasf_equa_azim(njd,Ar,De,Long,Lat){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) giugno 2013\n // njd= numero del giorno giuliano dell'istante da calcolare riferito al T.U.\n // Ar= ascensione retta in ore decimali.\n // De= declinazione in gradi sessadecimali\n // Long= Longitudine dell'osservatore =- per ovest rispetto a Greenwich\n // Lat= Latitudine dell'osservatore.\n\nvar ang_H=angolo_H(njd,Ar,Long); // calcolo dell'angolo orario H.\n\n // trasformare gli angoli sessadecimali in radianti.\n\n ang_H=Rad(ang_H*15); \n Ar= Rad(Ar*15); \n De= Rad(De); \n Long=Rad(Long); \n Lat= Rad(Lat); \n \n // angolo_a=altezza sull'orizzonte dell'astro. \n\nvar angolo_a=Math.sin(De)*Math.sin(Lat)+Math.cos(De)*Math.cos(Lat)*Math.cos(ang_H);\n angolo_a=Math.asin(angolo_a); // in radianti.\n angolo_a=Rda(angolo_a); // altezza dell'astro in gradi. \n \nvar azimut=(Math.sin(De)-Math.sin(Lat)*Math.sin(Rad(angolo_a)))/(Math.cos(Lat)*Math.cos(Rad(angolo_a)));\n azimut=Math.acos(azimut); \n azimut=Rda(azimut);\n\nazimut=(Math.sin(ang_H)<0) ? (azimut=azimut):(azimut=360-azimut); // operatore ternario.\n\nvar coord_azimut= new Array(angolo_a,azimut) ; // restituisce 2 valori: altezza e azimut.\n\nreturn coord_azimut;\n\n// NOTE SUL CALCOLO: \n// Se il seno di ang_H(angolo orario) è negativo (>180°) azimut=azimut, se positivo azimut=360-azimut\n\n}", "function perimetroTriangulo(lado1, lado2, base) {\n return lado1 + lado2 + base ;\n}", "function calculate(){}", "function checkIfTriangle(){\n const sum =sumOfAngle(Number(inputAngle[0].value),Number(inputAngle[1].value),Number(inputAngle[2].value))\n // console.log(sum);\n if(sum === 180){\n output.innerText = \"Hurrey ,this angles forms a Triangle 😃\"\n }\n else{\n output.innerText = \"Oops! it's not a Triangle 👋\"\n }\n // console.log(\"yess\")\n}", "function outputstep() {\r\n let number = start();\r\n degvplus =[];\r\n degvminus =[];\r\n\r\n var text = document.getElementById('step');\r\n text.value = '';\r\n for (var i = 1; i <= number[0][0][0]; i++) {\r\n var degplus = 0;\r\n for (var j = 1; j < number.length; j++) {\r\n if (number[j][0][0] == i) {\r\n degplus++\r\n }\r\n }\r\n degvplus.push(degplus)\r\n }\r\n for (var i = 1; i <= number[0][0][0]; i++) {\r\n var degminus = 0;\r\n for (var j = 1; j < number.length; j++) {\r\n if (number[j][0][1] == i) {\r\n degminus++\r\n }\r\n }\r\n degvminus.push(degminus)\r\n }\r\n for (var i = 0; i < degvplus.length; i++) {\r\n text.value += \"Степінь виходу вершини \" + (i + 1)+\"--\"+ + degvplus[i] +'\\n';\r\n }\r\n text.value +=\"\\n\"\r\n for (var i = 0; i < degvminus.length; i++) {\r\n text.value += \"Степінь заходу вершини \" + (i + 1)+\"--\"+ + degvminus[i] +'\\n';\r\n }\r\n}", "function valorTriangulo(){\n if(trianguloAparienciaInteraccion == true && trianguloAparienciaTono == true && trianguloAparienciaMirada == true && trianguloAparienciaLlanto == true){\n trianguloApariencia = true;\n }else{\n trianguloApariencia = false;\n }\n}", "function perimetroTriangulo(lado1, lado2, base) {\n return lado1 + lado2 + base\n}", "function perimetroTriangulo(lado1, lado2, base) {\n return lado1 + lado2 + base;\n}", "function perimetroTriangulo(lado1, lado2, base) {\n return lado1 + lado2 + base;\n}", "function t1(){\n return (1/3)*(dataArray[1][1]-dataArray[0][1])+(dataArray[2][1]-dataArray[1][1])+(dataArray[3][1]-dataArray[2][1]);\n }", "function calcularPerimetroTriangulo() {\n const input1 = document.getElementById(\"InputTrianguloLado1\");\n const lado1 = Number(input1.value);\n\n const input2 = document.getElementById(\"InputTrianguloLado2\");\n const lado2 = Number(input2.value);\n \n const input3 = document.getElementById(\"InputTrianguloBase\");\n const base = Number(input3.value);\n \n // llamamos a la funcion perimetroCuadrado la cual va arealizar el calculo!\n const perimetro = perimetroTriangulo(lado1, lado2, base);\n alert('El Perímetro Total es de: ' + perimetro + 'cm');\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 TinhTheoLoaiXe(sokm, tgcho, giaLoai1, giaLoai2, giaLoai3, tgChoTheoLoai) {\n var tien = 0;\n if (sokm <= 1) {\n tien = sokm * giaLoai1 + tgcho * tgChoTheoLoai;\n // console.log(tien);\n } else if (sokm > 1 && sokm < 21) {\n tien = giaLoai1 + (sokm - 1) * giaLoai2 + tgcho * tgChoTheoLoai;\n // console.log(tien);\n } else if (sokm >= 21) {\n tien = giaLoai1 + 19 * giaLoai2 + (sokm - 20) * giaLoai3 + tgcho * tgChoTheoLoai;\n // console.log(tien);\n }\n return document.getElementById('xuatTien').innerHTML = tien + ' vnđ';\n}", "function drawTriSpace(){\n triangleClear();\n loadMedicineGrid();\n var medAllNum =0;\n var inNums = 170;\n var outNums = 200;\n for (var i=0; i<trianglesContinued.length; i++) {\n if(trianglesContinued[i]!=undefined&&lines[i]!=undefined){\n \tif(trianglesContinued[i].eventSign=='ME'){\n \t\tvar medNums = 5;\n \t\tfor(var j = 0;j<mEvents.length;j++){\n \t\t\tif(mEvents[j]!=undefined){\n \t\t\t\tif(mEvents[j].m_sign=='ME'&&mEvents[j].m_point==i){\n \t\t\t if(mEvents[j].m_durable=='1'){\n \t\t\t\t if(mEvents[j].m_ended=='1'){\n \t\t\t\t \t lines[i].end_y=medNums;\n \t\t\t\t \t lines[i].start_x=mEvents[j].m_starttime;\n \t\t\t\t \t lines[i].start_y=medNums;\n \t\t\t\t \t trianglesContinued[i].y = medNums;\n \t\t\t\t \t stopTriangle[i].y = medNums;\n \t\t\t\t\t drawTriangle(triangleCtx, mEvents[j].m_starttime, medNums, 10,trianglesContinued[i].medicineText);\n \t\t\t\t\t drawLine(triangleCtx,mEvents[j].m_starttime, medNums,mEvents[j].m_endtime,medNums);\n \t\t\t\t\t drawTriangle(triangleCtx,mEvents[j].m_endtime, medNums, 10,''); \t\n \t\t\t\t }else{\n \t\t\t\t \t lines[i].end_y=medNums;\n \t\t\t\t \t lines[i].start_x=mEvents[j].m_starttime;\n \t\t\t\t \t lines[i].start_y=medNums;\n \t\t\t\t \t trianglesContinued[i].y = medNums;\n \t\t\t\t\t drawTriangle(triangleCtx, mEvents[j].m_starttime, medNums, 10,trianglesContinued[i].medicineText);\n \t\t drawLine(triangleCtx,mEvents[j].m_starttime, medNums,lines[i].end_x,medNums);\n \t\t drawArrow(triangleCtx,lines[i].end_x,medNums);\n \t\t if(lines[i].end_x<totalLong[i]+trianglesContinued[i].x){\n \t\t lines[i].end_x+=oneLong;\n \t\t }\n \t\t\t\t}\n \t\t\t\t \n \t\t\t}\n \t\t\tif('0'==mEvents[j].m_durable){\n \t\t\t trianglesContinued[i].y = medNums;\n \t\t\t drawTriangle(triangleCtx, mEvents[j].m_starttime, medNums, 10,trianglesContinued[i].medicineText);\n \t\t\t}\n \t\t}\n \t\t\t\tmedNums+=15;\n \t\t\t}\n \t\t}\n \t\t\n \t}\n \t\n \tvar inEventSpeed=1/(40*medicinesCount);\n \tif(trianglesContinued[i].eventSign=='IE'){\n \t\tfor(var j = 0;j<ioEvents.length;j++){\n \t\t\tif(ioEvents[j]!=undefined){\n \t\t\t\tif(ioEvents[j].ioe_sign=='IE'&&ioEvents[j].ioe_point==i){\n \t\t\t\t\tif(inNums<=185){\n \t\t\t\t\t\tif(ioEvents[j].ioe_ended=='1'){\n \t\t\t\t\t\t\tlines[i].end_y=inNums;\n \t\t\t\t\t\t\tlines[i].start_x=ioEvents[j].ioe_starttime;\n \t\t\t\t\t\t\tlines[i].start_y=inNums;\n \t\t\t\t\t\t\ttrianglesContinued[i].y = inNums;\n \t\t\t\t\t\t\tstopTriangle[i].y = inNums;\n \t\t\t\t\t\t\tdrawTriangle(triangleCtx, ioEvents[j].ioe_starttime, inNums, 10,inNums);\n \t\t\t\t\t\t\tdrawTriangle(triangleCtx,ioEvents[j].ioe_endtime, inNums, 10,''); \t\n \t\t\t\t\t\t\tdrawLine(triangleCtx,ioEvents[j].ioe_starttime, inNums,ioEvents[j].ioe_endtime,inNums);\n \t\t\t\t\t\t\tinNums+=15;\n \t\t\t\t\t\t}else{\n \t\t\t\t\t\t\tlines[i].end_y=inNums;\n \t\t\t\t\t\t\tlines[i].start_x=ioEvents[j].ioe_starttime;\n \t\t\t\t\t\t\tlines[i].start_y=inNums;\n \t\t\t\t\t\t\ttrianglesContinued[i].y = inNums;\n \t\t\t\t\t\t\tdrawTriangle(triangleCtx, ioEvents[j].ioe_starttime, inNums, 10,trianglesContinued[i].medicineText);\n \t\t\t\t\t\t\tdrawLine(triangleCtx,ioEvents[j].ioe_starttime, inNums,lines[i].end_x,inNums);\n \t\t\t\t\t\t\tdrawArrow(triangleCtx,lines[i].end_x,inNums);\n \t\t\t\t\t\t\t\n \t\t\t\t\t if(lines[i].end_x<totalLong[i]+ioEvents[j].ioe_starttime){\n \t\t\t\t\t lines[i].end_x+=inEventSpeed;\n \t\t\t\t\t }\n \t\t\t\t\t inNums+=15;\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\n \t\t\t\t\t}else{\n \t\t\t\t\t\t//console.log('备注---------------多了');\n \t\t\t\t\t}\n \t\t\t\t \n \t\t\t\n \t\t}\n// \t\t\t\tif(inNums<185){\n// \t\t\t\t\t\n// \t\t\t\t\tinNums+=15;\n// \t\t\t\t}else{\n// \t\t\t\t\t//console.log('备注');\n// \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\t\n \t}\n \tif(trianglesContinued[i].eventSign=='OE'){\n \t\tfor(var j = 0;j<ioEvents.length;j++){\n \t\t\tif(ioEvents[j]!=undefined){\n \t\t\t\tif(ioEvents[j].ioe_sign=='OE'&&ioEvents[j].ioe_point==i){\n \t\t\t\t\tif(outNums<=215){\n \t\t\t\t\t\tif(ioEvents[j].ioe_ended=='1'){\n \t\t\t\t\t\t\tlines[i].end_y=outNums;\n \t\t\t\t\t\t\tlines[i].start_x=ioEvents[j].ioe_starttime;\n \t\t\t\t\t\t\tlines[i].start_y=outNums;\n \t\t\t\t\t\t\ttrianglesContinued[i].y = outNums;\n \t\t\t\t\t\t\tstopTriangle[i].y = outNums;\n \t\t\t\t\t\t\tdrawTriangle(triangleCtx, ioEvents[j].ioe_starttime, outNums, 10,trianglesContinued[i].medicineText);\n \t\t\t\t\t\t\tdrawTriangle(triangleCtx,ioEvents[j].ioe_endtime, outNums, 10,''); \t\n \t\t\t\t\t\t\tdrawLine(triangleCtx,ioEvents[j].ioe_starttime, outNums,ioEvents[j].ioe_endtime,outNums);\n \t\t\t\t\t\t\toutNums+=15;\n \t\t\t\t\t\t}else{\n \t\t\t\t\t\t\tlines[i].end_y=outNums;\n \t\t\t\t\t\t\tlines[i].start_x=ioEvents[j].ioe_starttime;\n \t\t\t\t\t\t\tlines[i].start_y=outNums;\n \t\t\t\t\t\t\ttrianglesContinued[i].y = outNums;\n \t\t\t\t\t\t\tdrawTriangle(triangleCtx, ioEvents[j].ioe_starttime, outNums, 10,trianglesContinued[i].medicineText);\n \t\t\t\t\t\t\tdrawLine(triangleCtx,ioEvents[j].ioe_starttime, outNums,lines[i].end_x,outNums);\n \t\t\t\t\t\t\tdrawArrow(triangleCtx,lines[i].end_x,outNums);\n \t\t\t\t\t if(lines[i].end_x<totalLong[i]+trianglesContinued[i].x){\n \t\t\t\t lines[i].end_x+=oneLong;\n \t\t\t\t }\n \t\t\t\t\t outNums+=15;\n \t\t\t\t\t\t}\n \t\t\t\t\t\t\n \t\t\t\t\t}else{\n \t\t\t\t\t\t//console.log('备注---------------多了');\n \t\t\t\t\t}\n \t\t\t\t \n \t\t\t\t}\n \t\t\t\t\n \t\t\n// \t\t\t\tif(outNums<215){\n// \t\t\t\t\t\n// \t\t\t\t\toutNums+=15;\n// \t\t\t\t}else{\n// \t\t\t\t\t//console.log('备注');\n// \t\t\t\t}\n \t\t\t\t\n \t\t\t}\n \t\t}\n \t\t\n \t}\n \t\n\n// if(lines[i].end_x<totalLong[i]+trianglesContinued[i].x){\n// lines[i].end_x+=oneLong;\n// }\n }\n }\n}", "function calculateNext(data){\n \n var AM, BM, TAU_M, AH, BH, TAU_H, AJ, BJ, TAU_J, axr1, bxr1, TAU_Xr1,\n axr2, bxr2, TAU_Xr2, Axs, Bxs, TAU_Xs, TAU_R, TAU_S, Ad, Bd, Cd, TAU_D, \n Af, Bf, Cf, TAU_F, Af2, Bf2, Cf2, TAU_F2, temp, temp2, Ak1, Bk1,\n Ek, Ena, Eks, Eca, FCaSS_INF, exptaufcass, kCaSR, k1, k2, dRR,\n CaCSQN, dCaSR, bjsr, cjsr, CaSSBuf, dCaSS, bcss, ccss, CaBuf, dCai, bc, cc,\n dNai, dKi, sOO; \n\n var minft_t, exptaumt_t, hinft_t, exptauht_t, jinft_t, exptaujt_t, xr1inft_t,\n exptauxr1t_t, xr2inft_t, exptauxr2t_t, xsinft_t, exptauxst_t, rinft_t , sinft_t,\n exptaurt_t, exptaust_t, dinft_t, exptaudt_t, finft_t, exptauft_t, f2inft_t, \n exptauf2t_t, inakcoefft_t, ipkcoefft_t, ical1t_t, ical2t_t, inaca1t_t, inaca2t_t,\n ik1coefft_t, fcassinft_t, exptaufcasst_t; \n\n\n sOO = ( cS[iType] === 'epi') ? 8.958e-8 : ( cS[iType] === 'endo' ) ? 8.848e-8 : 1.142e-7; // (cS.itype === 'M')\n \n\n //table setup starts\n AM = 1.0/(1.+ Math.exp((-60.-cS.v)/5.));\n BM = 0.1/(1.+ Math.exp((cS.v+35.)/5.))+0.10/(1.+Math.exp((cS.v-50.)/200.));\n minft_t = 1.0/((1.+Math.exp((-56.86-cS.v)/9.03))*(1.+Math.exp((-56.86-cS.v)/9.03)));\n TAU_M = AM*BM;\n exptaumt_t = Math.exp(-cS.timestep/TAU_M);\n\n hinft_t = 1.0/((1.+Math.exp((cS.v+71.55)/7.43))*(1.+Math.exp((cS.v+71.55)/7.43)));\n \n AH = (cS.v > -40) ? 0. : (0.057*Math.exp(-(cS.v+80.)/6.8));\n BH = (cS.v > -40) ? (0.77/(0.13*(1.+Math.exp(-(cS.v+10.66)/11.1)))) \n : (2.7*Math.exp(0.079*cS.v)+(3.1e5)*Math.exp(0.3485*cS.v));\n TAU_H = 1.0/(AH+BH);\n exptauht_t = Math.exp(-cS.timestep/TAU_H);\n\n AJ = (cS.v > -40) ? 0. : (((-2.5428e4)*Math.exp(0.2444*cS.v)-(6.948e-6)*Math.exp(-0.04391*cS.v))*(cS.v+37.78)/(1.+Math.exp(0.311*(cS.v+79.23))));\n BJ = (cS.v > -40) ? (0.6*Math.exp((0.057)*cS.v)/(1.+Math.exp(-0.1*(cS.v+32.))))\n : (0.02424*Math.exp(-0.01052*cS.v)/(1.+Math.exp(-0.1378*(cS.v+40.14))));\n TAU_J = 1.0/(AJ+BJ);\n exptaujt_t = Math.exp(-cS.timestep/TAU_J);\n\n jinft_t = hinft_t;\n\n xr1inft_t = 1.0/(1.+Math.exp((-26.-cS.v)/7.));\n\n axr1 = 450.0/(1.+Math.exp((-45.-cS.v)/10.));\n bxr1 = 6.0/(1.+Math.exp((cS.v-(-30.))/11.5));\n TAU_Xr1 = axr1*bxr1;\n exptauxr1t_t = Math.exp(-cS.timestep/TAU_Xr1);\n\n\n xr2inft_t = 1.0/(1.+Math.exp((cS.v-(-88.))/24.));\n \n axr2 = 3.0/(1.+Math.exp((-60.-cS.v)/20.));\n bxr2 = 1.12/(1.+Math.exp((cS.v-60.)/20.));\n TAU_Xr2 = axr2*bxr2;\n exptauxr2t_t = Math.exp(-cS.timestep/TAU_Xr2);\n\n xsinft_t = 1.0/(1.+ Math.exp((-5.-cS.v)/14.));\n\n Axs = (1400.0/(Math.sqrt(1.+Math.exp((5.-cS.v)/6.))));\n Bxs = (1.0/(1.+ Math.exp((cS.v-35.)/15.)));\n TAU_Xs = Axs*Bxs+80.;\n exptauxst_t = Math.exp(-cS.timestep/TAU_Xs);\n\n rinft_t = ( cS.itype === 'epi') ? 1.0/(1.+ Math.exp((20.- cS.v)/6.)) \n : ( cS.itype === 'endo' ) ? 1.0/(1.+Math.exp((20.-cS.v)/6.))\n : 1.0/(1.+ Math.exp((20.-cS.v)/6.)) ; // (cS.itype === 'M')\n\n sinft_t = ( cS.itype === 'epi') ? 1.0/(1.+Math.exp((cS.v+20.)/5.))\n : ( cS.itype === 'endo' ) ? 1.0/(1.+ Math.exp((cS.v+28.)/5.))\n : 1.0/(1.+ Math.exp((cS.v+20.)/5.)); // (cS.itype === 'M')\n\n TAU_R = ( cS.itype === 'epi') ? 9.5* Math.exp(-(cS.v+40.)*(cS.v+40.)/1800.)+0.8\n : ( cS.itype === 'endo' ) ? 9.5* Math.exp(-(cS.v+40.)*(cS.v+40.)/1800.)+0.8\n : 9.5* Math.exp(-(cS.v+40.)*(cS.v+40.)/1800.)+0.8; // (cS.itype === 'M')\n\n TAU_S = ( cS.itype === 'epi') ? 85.* Math.exp(-(cS.v+45.)*(cS.v+45.)/320.) +5.0/(1.+Math.exp((cS.v-20.)/5.))+3. \n : ( cS.itype === 'endo' ) ? 1000.*Math.exp(-(cS.v+67.)*(cS.v+67.)/1000.)+8.\n : 85.*Math.exp(-(cS.v+45.)*(cS.v+45.)/320.)+5.0/(1.+Math.exp((cS.v-20.)/5.))+3.; // (cS.itype === 'M')\n \n exptaurt_t = Math.exp(-cS.timestep/TAU_R);\n exptaust_t = Math.exp(-cS.timestep/TAU_S);\n \n dinft_t = 1.0/(1.+Math.exp((-8.-cS.v)/7.5));\n \n Ad = 1.4/(1.+Math.exp((-35.-cS.v)/13.))+0.25;\n Bd = 1.4/(1.+Math.exp((cS.v+5.)/5.));\n Cd = 1.0/(1.+Math.exp((50.-cS.v)/20.));\n TAU_D = Ad*Bd+Cd;\n exptaudt_t = Math.exp(-cS.timestep/TAU_D);\n\n finft_t = 1.0/(1.+Math.exp((cS.v+20.)/7.));\n\n Af = 1102.5*Math.exp(-(cS.v+27.)*(cS.v+27.)/225.);\n Bf = 200.0/(1.+Math.exp((13.-cS.v)/10.));\n Cf = (180.0/(1.+Math.exp((cS.v+30.)/10.)))+20.;\n TAU_F = Af+Bf+Cf;\n exptauft_t = Math.exp(-cS.timestep/TAU_F);\n\n f2inft_t = 0.67/(1.+Math.exp((cS.v+35.)/7.))+0.33;\n\n //original code had the following, but paper uses denom of 170**2, not 7**2\n\n Af2 = 600.*Math.exp(-(cS.v+25.)*(cS.v+25.)/49.);\n\n // paper value for Af2 is INCORRECT to match the figure\n //Af2=600.*exp(-(vv+25.)*(vv+25.)/(170.*170.))\n \n Bf2 = 31.0/(1.+Math.exp((25.-cS.v)/10.));\n Cf2 = 16.0/(1.+Math.exp((cS.v+30.)/10.));\n TAU_F2 = Af2+Bf2+Cf2\n exptauf2t_t = Math.exp(-cS.timestep/TAU_F2);\n\n inakcoefft_t = (1.0/(1.+0.1245*Math.exp(-0.1*cS.v*cC.fort)+0.0353*Math.exp(-cS.v*cC.fort)))*cS.knak*(cS.Ko/(cS.Ko+cS.KmK)); \n ipkcoefft_t = cS.GpK/(1.+Math.exp((25.-cS.v)/5.98)); \n temp = Math.exp(2*(cS.v-15)*cC.fort);\n\n if(!(Math.abs(cS.v-15.) < 1e-4)){\n // need implemented\n ical1t_t = cS.GCaL*4.*(cS.v-15.)*(cS.FF*cC.fort)* (0.25*temp)/(temp-1.);\n ical2t_t = cS.GCaL*4.*(cS.v-15.)*(cS.FF*cC.fort)*cS.Cao/(temp-1.);\n }\n \n temp = Math.exp((cS.n-1.)*cS.v*cC.fort);\n temp2 = cS.knaca/((cC.KmNai3+cC.Nao3)*(cS.KmCa+cS.Cao)*(1.+cS.ksat*temp));\n inaca1t_t = temp2*Math.exp(cS.n*cS.v*cC.fort)*cS.Cao;\n inaca2t_t = temp2*temp*cC.Nao3*cS.alphanaca; \n\n\n //reversal potentials\n Ek = cC.rtof*(Math.log((cS.Ko/cS.ki)));\n Ena = cC.rtof*(Math.log((cS.Nao/cS.nai)));\n Eks = cC.rtof*(Math.log((cS.Ko+cS.pKNa*cS.Nao)/(cS.ki+cS.pKNa*cS.nai)));\n Eca = 0.5*cC.rtof*(Math.log((cS.Cao/cS.cai)));\n \n // need to figure out vmek is (cS.v - Ek) \n Ak1 = 0.1/(1.+Math.exp(0.06*((cS.v - Ek)-200.)));\n Bk1 = (3.*Math.exp(0.0002*((cS.v - Ek)+100.))+Math.exp(0.1*((cS.v - Ek)-10.)))/(1.+Math.exp(-0.5*((cS.v - Ek)))); \n ik1coefft_t = cS.GK1*Ak1/(Ak1+Bk1); \n \n fcassinft_t = 0.6/(1+(cS.cass/0.05)*(cS.cass/0.05))+0.4;\n temp = 80.0/(1+(cS.cass/0.05)*(cS.cass/0.05))+2.;\n exptaufcasst_t = Math.exp(-cS.timestep/temp); \n\n //stimulus\n\n cS.Istim = _s1s2Stimulus(count, settings);\n \n //Compute currents\n\n cS.sm = minft_t - (minft_t-cS.sm)*exptaumt_t;\n cS.sh = hinft_t - (hinft_t-cS.sh)*exptauht_t;\n cS.sj = jinft_t - (jinft_t-cS.sj)*exptaujt_t;\n cS.ina = cS.GNa*cS.sm *cS.sm *cS.sm *cS.sh*cS.sj*(cS.v-Ena); \n\n cS.sxr1 = xr1inft_t-(xr1inft_t - cS.sxr1) * exptauxr1t_t;\n\n \n cS.sxr2 = xr2inft_t-(xr2inft_t - cS.sxr2) * exptauxr2t_t;\n \n cS.ikr = cS.Gkr*cC.Gkrfactor*cS.sxr1*cS.sxr2*(cS.v-Ek); \n \n cS.sxs = xsinft_t-(xsinft_t-cS.sxs)*exptauxst_t;\n\n cS.iks = cS.Gks*cS.sxs*cS.sxs*(cS.v-Eks);\n\n cS.sr = rinft_t-(rinft_t-cS.sr)*exptaurt_t;\n\n cS.ss = sinft_t-(sinft_t-cS.ss)*exptaust_t;\n\n cS.ito = cS.Gto*cS.sr*cS.ss*(cS.v-Ek);\n\n cS.sd = dinft_t-(dinft_t-cS.sd)*exptaudt_t;\n\n cS.sf = finft_t-(finft_t-cS.sf)*exptauft_t;\n\n cS.sf2 = f2inft_t-(f2inft_t-cS.sf2)*exptauf2t_t; \n\n FCaSS_INF = (cS.cass > cS.casshi) ? 0.4 : fcassinft_t ;\n\n exptaufcass = (cS.cass > cS.casshi) ? cC.exptaufcassinf : exptaufcasst_t;\n\n cS.sfcass = FCaSS_INF-(FCaSS_INF- cS.sfcass)*exptaufcass;\n\n cS.ical = cS.sd*cS.sf*cS.sf2*cS.sfcass*(ical1t_t* cS.cass - ical2t_t);\n\n cS.ik1 = ik1coefft_t*(cS.v-Ek);\n\n cS.ipk = ipkcoefft_t*(cS.v-Ek);\n\n cS.inaca = inaca1t_t*cS.nai*cS.nai*cS.nai-inaca2t_t*cS.cai;\n\n cS.inak = inakcoefft_t*(cS.nai/(cS.nai+cS.KmNa));\n\n cS.ipca = cS.GpCa*cS.cai/(cS.KpCa+cS.cai);\n\n cS.ibna = cS.GbNa*(cS.v-Ena);\n\n cS.ibca = cS.GbCa*(cS.v-Eca);\n\n //total current\n cS.sItot = cS.ikr+ cS.iks+ cS.ik1+ cS.ito+ cS.ina+ cS.ibna+ cS.ical+ cS.ibca+ cS.inak+ cS.inaca+ cS.ipca+ cS.ipk+ cS.Istim;\n\n //console.log(cS.ikr, cS.iks, cS.ik1, cS.ito, cS.ina, cS.ibna, cS.ical, cS.ibca, cS.inak, cS.inaca, cS.ipca, cS.ipk, cS.Istim);\n\n //update concentrations\n\n kCaSR = cS.maxsr-((cS.maxsr-cS.minsr)/(1+(cS.EC/cS.casr*(cS.EC/cS.casr))));\n k1 = cS.k1prime/kCaSR;\n k2 = cS.k2prime*kCaSR;\n dRR = cS.k4*(1.-cS.srr)-k2*cS.cass*cS.srr;\n cS.srr = cS.srr+cS.timestep*dRR;\n sOO = k1*cS.cass*cS.cass*cS.srr/(cS.k3+k1*cS.cass*cS.cass);\n\n //intracellular calcium currents\n\n cS.Irel = cS.Vrel*sOO*(cS.casr- cS.cass);\n cS.Ileak = cS.Vleak*(cS.casr-cS.cai);\n cS.Iup = cS.Vmaxup/(1.+((cS.Kup*cS.Kup)/(cS.cai*cS.cai)));\n cS.Ixfer = cS.Vxfer*(cS.cass - cS.cai);\n\n\n CaCSQN = cS.Bufsr*cS.casr/(cS.casr+cS.Kbufsr);\n dCaSR = cS.timestep*(cS.Iup-cS.Irel-cS.Ileak);\n bjsr = cS.Bufsr-CaCSQN-dCaSR-cS.casr+cS.Kbufsr;\n cjsr = cS.Kbufsr*(CaCSQN+dCaSR+cS.casr);\n cS.casr = (Math.sqrt(bjsr*bjsr+4.*cjsr)-bjsr)/2.;\n\n CaSSBuf = cS.Bufss * cS.cass/(cS.cass+cS.Kbufss);\n dCaSS = cS.timestep * (-cS.Ixfer*(cS.Vc/cS.Vss)+cS.Irel*(cS.Vsr/cS.Vss)+(-cS.ical*cC.inversevssF2*cS.CAPACITANCE)); \n bcss = cS.Bufss - CaSSBuf - dCaSS - cS.cass+cS.Kbufss;\n ccss = cS.Kbufss*(CaSSBuf+dCaSS+cS.cass);\n cS.cass = (Math.sqrt(bcss*bcss+4.*ccss)-bcss)/2.;\n\n CaBuf = cS.Bufc*cS.cai/(cS.cai+cS.Kbufc);\n dCai = cS.timestep *((-(cS.ibca+cS.ipca-2*cS.inaca)*cC.inverseVcF2*cS.CAPACITANCE)-(cS.Iup-cS.Ileak)*(cS.Vsr/cS.Vc)+cS.Ixfer); \n bc = cS.Bufc-CaBuf-dCai-cS.cai+cS.Kbufc;\n cc = cS.Kbufc*(CaBuf+dCai+cS.cai);\n cS.cai = (Math.sqrt(bc*bc+4.*cc)-bc)/2.;\n\n dNai = -(cS.ina+cS.ibna+3.*cS.inak+3.*cS.inaca)*cC.inverseVcF*cS.CAPACITANCE;\n cS.nai = cS.nai+cS.timestep*dNai;\n\n dKi = -(cS.Istim+cS.ik1+cS.ito+cS.ikr+cS.iks-2.*cS.inak+cS.ipk)*cC.inverseVcF*cS.CAPACITANCE; \n cS.ki = cS.ki+cS.timestep*dKi;\n cS.v = cS.v - cS.sItot * cS.timestep ;\n \n\n //cal ends\n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n\n return data; \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 }", "calc(){\n let lastIndex =\"\";\n //armazenando o ultimo operador\n this._lastOperator = this.getLastItem(true);\n\n if(this._operation.length < 3){\n let firstNumber = this._operation[0];\n this._operation =[];\n this._operation = [firstNumber, this._lastOperator, this._lastNumber];\n }\n\n //arrumando para quando o método for chamado pelo sinal de igual =\n if(this._operation.length > 3){\n\n lastIndex = this._operation.pop();\n //armazenando o ultimo número digitado na calcl\n this._lastNumber = this.getResult();\n\n }else if(this._operation.length == 3){\n //armazenando o ultimo número digitado na calcl\n this._lastNumber = this.getLastItem(false);\n }\n\n //transforma um vetor em uma string, usando um separador, qo separador é definido pelo parametro passado no método\n let result = this.getResult();\n\n if(lastIndex == \"%\"){\n result /= 100;\n this._operation = [result];\n }else{\n this._operation =[result];\n //se o ultimo index for diferente de vazio, então adiciona ele no vetor\n if(lastIndex){\n this._operation.push(lastIndex);\n }\n \n }\n this.setLastNumberToDisplay();\n \n }", "function turis(r) { // funkicja, funkcijos pavadinimas () skliausteliuose duomenys, {} aprasoma ka funkcija turi daryti // r kintamasis\nlet t = 4 * 3.14 * r * r * r / 3;\nreturn t; // grazinimas\n}", "function atvd17(){\n \n let a = parseFloat(document.querySelector(\"#atvd17-1\").value);\n let b = parseFloat(document.querySelector(\"#atvd17-2\").value);\n let c = parseFloat(document.querySelector(\"#atvd17-3\").value);\n\n let de,x1=0,x2=0;\n \n\n de = (Math.pow(b, 2)) - (4*a*c);\n \n \n x1= (-b - Math.sqrt(de))/(2*a);\n \n x2= (-b + Math.sqrt(de))/(2*a);\n \n\n if(de<0){\n document.getElementById(\"raiz\").innerHTML = \"Não existe raiz real\";\n\n }else{\n document.getElementById(\"raiz\").innerHTML = \"VALOR DA PRIMEIRA RAIZ:\" + x1+ \" | \" + \"VALOR DA SEGUNDA RAIZ:\" + x2;\n \n }\n \n }", "static approxEqTrans(ta, tb) {\nvar aeq, i;\n//------–-----\naeq = (function() {\nvar j, results;\nresults = [];\nfor (i = j = 0; j < 3; i = ++j) {\nresults.push(this.approxEq(ta[i], tb[i]));\n}\nreturn results;\n}).call(this);\nreturn aeq[0] && aeq[1] && aeq[2];\n}", "function sumaRazFunc(niz, ajdi)\n{\n\tvar tmp = 0;\n\n\tif (niz[0] >= 0 && niz[6] >=0 && niz[7] >=0)\n\t{\n\t\ttmp = (niz[6] - niz[7])*niz[0];\n\t\tdocument.getElementById(ajdi).innerText=tmp;\n\tvar i1 = Number(document.getElementById(\"suma5\").innerText);\n\tvar i2 = Number(document.getElementById(\"suma6\").innerText);\n\tvar i3 = Number(document.getElementById(\"suma7\").innerText);\n\tvar i4 = Number(document.getElementById(\"suma8\").innerText);\n\n\ti1 = i1 + i2 + i3 + i4;\n\tdocument.getElementById(\"suma14\").innerText=i1;\n\n\t\n\tvar i1 = Number(document.getElementById(\"suma13\").innerText);\n\tvar i2 = Number(document.getElementById(\"suma14\").innerText);\n\tvar i3 = Number(document.getElementById(\"suma15\").innerText);\n\t\n\ti1 = i1 + i2 + i3;\n\tdocument.getElementById(\"konrez\").innerText=i1;\n\t}\n}", "function fun_invierte_tratamiento_tildes(arg_palabra){ //ESTA FUNCION SE ENCARGA DE TRANSFORMAR TODOS LOS ACUTES EN SU RESPECTIVO CARACTER, SE UTILIZA PARA IMPRIMIR LOS CARACTERES EN CAMPOS INPUT, YA QUE EN ESTOS LA TRADUCCION POR PARTE DE HTML NO ES AUTOMÁTICA\r\n\r\n\tvar indice_ini=1,indice_fin;\r\n\t\r\n\twhile(indice_ini!=-1){\r\n\t\tindice_ini=arg_palabra.indexOf(\"&\");\r\n\t\tindice_fin=arg_palabra.indexOf(\";\");\r\n\t\t\r\n\t\tif(indice_ini!=-1){\r\n\t\t\tletra_equivalente=fun_caracter_equiv(arg_palabra.substring(indice_ini,indice_fin+1));\r\n\t\t\t\r\n\t\t\targ_palabra=arg_palabra.substring(0,indice_ini)+letra_equivalente+arg_palabra.substring(indice_fin+1,arg_palabra.length);\r\n\t\t\t\r\n\t\t}\r\n\t}\r\n\treturn arg_palabra;\r\n}", "function perimetroTriangulo(ladoTriangulo){\n return ladoTriangulo * 3;\n}", "function triangle() {\n\n}", "stepThyratrons() {\n let X2bPtr = this.Xptr[1]-1;\n if (X2bPtr===0) X2bPtr = ROTOR_SIZES.X2;\n let S1bPtr = this.Sptr[0]-1;\n if (S1bPtr===0) S1bPtr = ROTOR_SIZES.S1;\n\n // Get Chi rotor 5 two back to calculate plaintext (Z+Chi+Psi=Plain)\n let X5bPtr=this.Xptr[4]-1;\n if (X5bPtr===0) X5bPtr=ROTOR_SIZES.X5;\n X5bPtr=X5bPtr-1;\n if (X5bPtr===0) X5bPtr=ROTOR_SIZES.X5;\n // Get Psi rotor 5 two back to calculate plaintext (Z+Chi+Psi=Plain)\n let S5bPtr=this.Sptr[4]-1;\n if (S5bPtr===0) S5bPtr=ROTOR_SIZES.S5;\n S5bPtr=S5bPtr-1;\n if (S5bPtr===0) S5bPtr=ROTOR_SIZES.S5;\n\n const x2sw = this.limitations.X2;\n const s1sw = this.limitations.S1;\n const p5sw = this.limitations.P5;\n\n // Limitation calculations\n let lim=1;\n if (x2sw) lim = this.rings.X[2][X2bPtr-1];\n if (s1sw) lim = lim ^ this.rings.S[1][S1bPtr-1];\n\n // P5\n if (p5sw) {\n let p5lim = this.P5Zbit[1];\n p5lim = p5lim ^ this.rings.X[5][X5bPtr-1];\n p5lim = p5lim ^ this.rings.S[5][S5bPtr-1];\n lim = lim ^ p5lim;\n }\n\n const basicmotor = this.rings.M[2][this.Mptr[0]-1];\n this.totalmotor = basicmotor;\n\n if (x2sw || s1sw) {\n if (basicmotor===0 && lim===1) {\n this.totalmotor = 0;\n } else {\n this.totalmotor = 1;\n }\n }\n\n // Step Chi rotors\n for (let r=0; r<5; r++) {\n this.Xptr[r]++;\n if (this.Xptr[r] > ROTOR_SIZES[\"X\"+(r+1)]) this.Xptr[r] = 1;\n }\n\n if (this.totalmotor) {\n // Step Psi rotors\n for (let r=0; r<5; r++) {\n this.Sptr[r]++;\n if (this.Sptr[r] > ROTOR_SIZES[\"S\"+(r+1)]) this.Sptr[r] = 1;\n }\n }\n\n // Move M37 rotor if M61 set\n if (this.rings.M[1][this.Mptr[1]-1]===1) this.Mptr[0]++;\n if (this.Mptr[0] > ROTOR_SIZES.M37) this.Mptr[0]=1;\n\n // Always move M61 rotor\n this.Mptr[1]++;\n if (this.Mptr[1] > ROTOR_SIZES.M61) this.Mptr[1]=1;\n }", "function sumaIgFunc(niz, ajdi)\n{\n\tvar tmp = 0;\n\tfor (var i=8; i<12; ++i)\n\t{\n\t\tif(niz[i] >= 0)\n\t\t\ttmp += niz[i];\n\t\n\t}\n\n\tdocument.getElementById(ajdi).innerText=tmp;\n\tvar i1 = Number(document.getElementById(\"suma9\").innerText);\n\tvar i2 = Number(document.getElementById(\"suma10\").innerText);\n\tvar i3 = Number(document.getElementById(\"suma11\").innerText);\n\tvar i4 = Number(document.getElementById(\"suma12\").innerText);\n\n\ti1 = i1 + i2 + i3 + i4;\n\tdocument.getElementById(\"suma15\").innerText=i1;\n\n\tvar i1 = Number(document.getElementById(\"suma13\").innerText);\n\tvar i2 = Number(document.getElementById(\"suma14\").innerText);\n\tvar i3 = Number(document.getElementById(\"suma15\").innerText);\n\t\n\ti1 = i1 + i2 + i3;\n\tdocument.getElementById(\"konrez\").innerText=i1;\n}", "function diem_trung_binh() {\n let toan = +document.getElementById('diem_toan').value;\n let ly = +document.getElementById('diem_ly').value;\n let hoa = +document.getElementById('diem_hoa').value;\n let tb = (toan + ly + hoa) / 3;\n if (tb > 8) {\n // dk dunng\n document.getElementById('result').innerHTML = \"Hoc sinh dat\";\n } else {\n // dk sai\n document.getElementById('result').innerHTML = \"Khong dat\";\n }\n}", "finePartita(){\n //controllo le righe\n if (this.state[0]!==\"\" && this.state[0]===this.state[1] && this.state[1]===this.state[2]){\n return this.state[0]\n }\n if (this.state[3]!==\"\" && this.state[3]===this.state[4] && this.state[4]===this.state[5]){\n return this.state[3]\n }\n if (this.state[6]!==\"\" && this.state[6]===this.state[7] && this.state[7]===this.state[8]){\n return this.state[6]\n }\n //controllo le colonne\n if (this.state[0]!==\"\" && this.state[0]===this.state[3] && this.state[3]===this.state[6]){\n return this.state[0]\n }\n if (this.state[1]!==\"\" && this.state[1]===this.state[4] && this.state[4]===this.state[7]){\n return this.state[1]\n }\n if (this.state[2]!==\"\" && this.state[2]===this.state[5] && this.state[5]===this.state[8]){\n return this.state[2]\n }\n\n //controllo le diagonali\n if (this.state[0]!==\"\" && this.state[0]===this.state[4] && this.state[4]===this.state[8]){\n return this.state[0]\n }\n if (this.state[2]!==\"\" && this.state[2]===this.state[4] && this.state[4]===this.state[6]){\n return this.state[2]\n }\n\n //la griglia e' piena e non ha vinto nessuno=TIE\n if (this.isFull()){\n return \"tie\"\n }\n return \"in corso\"\n}", "function Tangent() {\r\n}", "function triArea(w, b) {\r\n area = w * b;\r\n console.log(area);\r\n}", "function totaal (a , b , c){\n\nlet sum = a + b + c ;\nreturn sum\n\n\n}", "function calctwotheta (button, event) { \n //Calculates and stores the B and UB matricies when the button 'Calculate UB Matrix' is pressed\n params = {'data': [] };\n \n params['data'].push({\n 'a': aField.getValue(),\n 'b': bField.getValue(),\n 'c': cField.getValue(),\n 'alpha': alphaField.getValue(),\n 'beta': betaField.getValue(),\n 'gamma': gammaField.getValue(),\n 'wavelength': wavelengthField.getValue()\n });\n \n //only sends the observations that aren't (0,0,0)\n for (var i = 0; i < store.getCount(); i++) {\n var record = store.getAt(i)\n if (record.data['h'] != 0 || record.data['k'] != 0 || record.data['l'] != 0){ \n params['data'].push(record.data); \n }\n };\n \n conn.request({\n url: '/WRed/files/calcTheta/',\n method: 'POST',\n params: Ext.encode(params),\n success: thetasuccess,\n failure: function () {\n Ext.Msg.alert('Error: Failed to calculate 2θ with current lattice parameters');\n }\n });\n\n }", "function areaTriangulo (base, altura){\n return (base * altura)/ 2;\n}", "function calculate_reverse() {\r\n\r\n if ($.isNumeric(power_cycle) && !$.isNumeric(power_hour) && !$.isNumeric(power_day) && $.isNumeric(battery_power)) {\r\n\r\n custom_power_cycle = power_cycle;\r\n empty_check(true);\r\n } else {\r\n if (!$.isNumeric(power_cycle) && $.isNumeric(power_hour) && !$.isNumeric(power_day) && $.isNumeric(battery_power)) {\r\n\r\n custom_power_cycle = battery_power / power_hour;\r\n empty_check(true);\r\n } else {\r\n if (!$.isNumeric(power_cycle) && !$.isNumeric(power_hour) && $.isNumeric(power_day) && $.isNumeric(battery_power)) {\r\n\r\n custom_power_cycle = battery_power / (power_day * 24);\r\n empty_check(true);\r\n } else {\r\n if ($.isNumeric(power_cycle) && !$.isNumeric(power_hour) && !$.isNumeric(power_day) && !$.isNumeric(battery_power)) {\r\n\r\n custom_power_cycle = power_cycle;\r\n empty_check(false);\r\n } else {\r\n if (!$.isNumeric(power_cycle) && $.isNumeric(power_hour) && !$.isNumeric(power_day) && !$.isNumeric(battery_power)) {\r\n\r\n return multiple_argument_error;\r\n } else {\r\n if (!$.isNumeric(power_cycle) && !$.isNumeric(power_hour) && $.isNumeric(power_day) && !$.isNumeric(battery_power)) {\r\n // No case Possible\r\n return multiple_argument_error;\r\n } else {\r\n if ($.isNumeric(power_cycle) && $.isNumeric(battery_power)) {\r\n // No case Possible\r\n custom_power_cycle = power_cycle;\r\n empty_check(true);\r\n } else {\r\n if ($.isNumeric(power_cycle) && !$.isNumeric(battery_power)) {\r\n\r\n custom_power_cycle = power_cycle;\r\n empty_check(false);\r\n } else {\r\n\r\n return multiple_argument_error;\r\n }\r\n }\r\n\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }", "function doCalculate_hx() {\n // inputs\n k0 = document.SSKappa_Hx.k0.value;\n k1 = document.SSKappa_Hx.k1.value;\n p = document.SSKappa_Hx.p.value;\n alpha = document.SSKappa_Hx.alpha.value;\n power = document.SSKappa_Hx.power.value/100;\n drop = document.SSKappa_Hx.drop.value;\n //calculate\n z_alpha = jStat.normal.inv(1 - alpha/2, 0, 1);\n z_beta = jStat.normal.inv(power, 0, 1);\n ncp = (z_alpha + z_beta)**2;\n n = Math.ceil( ncp*( ((p*(1-p)*(k1-k0))**2 / (p**2+p*(1-p)*k0)) + (2*(p*(1-p)*(k1-k0))**2 / (p*(1-p)*(1-k0))) + ((p*(1-p)*(k1-k0))**2 / ((1-p)**2+p*(1-p)*k0)) )**(-1) );\n n_drop = Math.ceil( n / ((100 - drop) / 100) );\n //results\n document.SSKappa_Hx.n.value = n;\n document.SSKappa_Hx.n_drop.value = n_drop;\n document.getElementById(\"drop_\").innerHTML = drop;\n return;\n}", "function calculator(button){\r\n if(button.type == \"operator\"){\r\n data.operation.push(button.symbol);\r\n data.result.push(button.formula);\r\n }\r\n else if (button.type == \"number\"){\r\n data.operation.push(button.symbol);\r\n data.result.push(button.formula);\r\n }\r\n else if(button.type == \"key\"){\r\n if(button.name == \"delete\"){\r\n data.operation.pop();\r\n data.result.pop();\r\n }\r\n else if (button.name == \"clear\"){\r\n data.result = [];\r\n data.operation = [];\r\n output_result_element.innerHTML = 0;\r\n }\r\n else if(button.name == \"rad\"){\r\n RADIAN = true;\r\n angleToggler();\r\n }\r\n else if (button.name == \"deg\"){\r\n RADIAN = false;\r\n angleToggler();\r\n }\r\n }\r\n \r\n else if (button.type == \"math_function\") {\r\n\r\n if (button.name == \"factorial\") {\r\n data.operation.push(\"!\");\r\n data.result.push(button.formula);\r\n } else if (button.name == \"square\") {\r\n data.operation.push(\"^(\");\r\n data.result.push(button.formula);\r\n data.operation.push(\"2)\");\r\n data.result.push(\"2)\");\r\n }\r\n else if (button.name == \"power\")\r\n {\r\n data.operation.push(\"^(\");\r\n data.result.push(button.formula);\r\n\r\n }\r\n else {\r\n data.operation.push(button.symbol + \"(\");\r\n data.result.push(button.formula + \"(\");\r\n }\r\n }\r\n else if (button.type == \"trigo_function\") {\r\n data.operation.push(button.symbol + \"(\");\r\n data.result.push(button.formula);\r\n }\r\n \r\n else if (button.type == \"calculate\"){\r\n let result_tot = data.result.join(\"\");\r\n \r\n let final_result;\r\n \r\n let power_search = searcher(data.result,POWER);\r\n\r\n let factorial_search = searcher(data.result,FACTORIAL);\r\n\r\n const power_base = power_base_search(data.result,power_search);\r\n power_base.forEach( ele => {\r\n let toReplace = ele + POWER;\r\n let replacement = \"Math.pow(\" + ele + \",\";\r\n result_tot = result_tot.replace(toReplace,replacement);\r\n })\r\n\r\n const facto_base = fact_base_search(data.result,factorial_search);\r\n\r\n facto_base.forEach(ele => {\r\n result_tot = result_tot.replace(ele.toReplace, ele.replacement);\r\n })\r\n \r\n //CHECKING SYNTAX-ERROR\r\n try {\r\n final_result = eval(result_tot);\r\n } catch (error) {\r\n if( error instanceof SyntaxError){\r\n final_result = \"Error!\";\r\n output_result_element.innerHTML = final_result;\r\n return;\r\n }\r\n }\r\n\r\n final_result = calculate(final_result);\r\n ans = final_result;\r\n data.operation.push(final_result);\r\n data.result.push(final_result);\r\n output_result_element.innerHTML = final_result;\r\n return;\r\n }\r\n updateOutputOperation( data.operation.join('') );\r\n}", "getRelation(t) {\n\n var r = 0;\n var a = [0, 0];\n var b = [0, 0];\n a = this.type.getSerialNumbers();\n b = t.getSerialNumbers();\n var a1 = a[0];\n var a2 = a[1];\n var b1 = b[0];\n var b2 = b[1];\n\n //pretend we are comparing to ISTP\n if (a1%10===b1%10) { //_i both are introverted\n if (Math.floor(a1/100)===Math.floor(b1/100)) { //both are judging. Ti or Fi\n if (Math.floor(a1/10)%10===Math.floor(b1/10)%10) { // both are thinking Ti\n if (Math.floor(a2/10)%10===Math.floor(b2/10)%10) r = 2; // both are sensing TiSe\n else r = 5; //TiNe\n } else { // Fi\n if (Math.floor(a2/10)%10===Math.floor(b2/10)%10) r = 6; //FiSe\n else r = 9; //FiNe\n }\n } else { //Ni or Si\n if (Math.floor(a2/10)%10===Math.floor(b1/10)%10) { //Si\n if (Math.floor(a1/10)%10===Math.floor(b2/10)%10) r = 14; //thinking, SiTe\n else r = 11; //SiFe\n } else { //Ni\n if (Math.floor(a1/10)%10===Math.floor(b2/10)%10) r = 10; //thinking, NiTe\n else r = 3; //NiFe\n }\n }\n } else { //_e one is extraverted\n if (Math.floor(a1/100)===Math.floor(b1/100)) { //both are judging. Te or Fe\n if (Math.floor(a1/10)%10===Math.floor(b1/10)%10) { // both are thinking Te\n if (Math.floor(a2/10)%10===Math.floor(b2/10)%10) r = 15; // both are sensing TeSi\n else r = 8; //TeNi\n } else { // Fe\n if (Math.floor(a2/10)%10===Math.floor(b2/10)%10) r = 7; //FeSi\n else r = 1; //FeNi\n }\n } else { //Ne or Se\n if (Math.floor(a2/10)%10===Math.floor(b1/10)%10) { //Se\n if (Math.floor(a1/10)%10===Math.floor(b2/10)%10) r = 4; //thinking, SeTi\n else r = 12; //SeFi\n } else { //Ni\n if (Math.floor(a1/10)%10===Math.floor(b2/10)%10) r = 13; //thinking, NeTi\n else r = 16; //NeFi\n }\n }\n }\n return r;\n }", "function calculateNext(data) {\n \n var hthv, hthw, hthso, hthsi, hthvm, htho, hthvinf, hthwinf,\n tvm, ts, to, twp, twm, tso, tsi, vinf, winf, dv, dw, ds;\n \n cS.istim = _s1s2Stimulus(count,data);\n\n // Step functions\n hthv = (cS.u >= cS.thv);\n hthw = (cS.u >= cS.thw);\n hthso = (cS.u >= cS.thw);\n hthsi = (cS.u >= cS.thw);\n hthvm = (cS.u >= cS.thvm);\n htho = (cS.u >= cS.tho);\n hthvinf = (cS.u >= cS.thvm);\n hthwinf = (cS.u >= cS.tho); //thwinf = tho.\n\n // Multi-part terms\n tvm = (1 - hthvm) * cS.tv1m + hthvm * cS.tv2m;\n ts = (1 - hthw) * cS.ts1 + hthw * cS.ts2;\n to = (1 - htho) * cS.to1 + htho * cS.to2;\n twp = cS.tw1p + (cS.tw2p - cS.tw1p) * (1 + Math.tanh((cS.w - cS.wcp) * cS.kwp)) / 2;\n twm = cS.tw1m + (cS.tw2m - cS.tw1m) * (1 + Math.tanh((cS.u - cS.uwm) * cS.kwm)) / 2;\n tso = cS.tso1 + (cS.tso2 - cS.tso1) * (1 + Math.tanh((cS.u - cS.uso) * cS.kso)) / 2;\n tsi = cS.tsi1 + (cS.tsi1 - cS.tsi1) * (1 + Math.tanh((cS.s - cS.sc) * cS.ksi)) / 2;\n vinf = 1 - hthvinf;\n winf = (1 - hthwinf) * (1 - cS.u / cS.twinf) + hthwinf * cS.winfstar;\n\n // Gate evolution\n dv = (1 - hthv) * (vinf - cS.v) / tvm - hthv * cS.v / cS.tvp;\n dw = (1 - hthw) * (winf - cS.w) / twm - hthw * cS.w / twp;\n ds = ((1 + Math.tanh((cS.u - cS.us) * cS.ks)) / 2 - cS.s) / ts;\n cS.v = cS.v + cS.timestep * dv;\n cS.w = cS.w + cS.timestep * dw;\n cS.s = cS.s + cS.timestep * ds;\n \n // Currents\n cS.xfi = -cS.v * hthv * (cS.u - cS.thv) * (cS.uu - cS.u) / cS.tfi;\n cS.xso = (cS.u - cS.uo) * (1 - hthso) / to + hthso / tso;\n cS.xsi = -hthsi * cS.w * cS.s / tsi;\n \n // update u using forward Euler\n cS.u = cS.u - cS.timestep * (cS.xfi + cS.xso + cS.xsi - cS.istim);\n \n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n \n return data; \n }", "get choices_ans() {\n switch (this.idx) {\n case 0:\n // this is for position\n var choices = [\n \"$$(\"+this.h+\",\"+this.k+\")$$\",\n \"$$(\"+ (this.h == 0 ? (this.h+'x') : -this.h) +\",\"+ -this.k +\")$$\",\n \"$$(\"+ (this.k == 0 ? (this.h+'x') : -this.k) +\",\"+ this.h +\")$$\",\n \"Degenerate\"];\n return knuth(choices, 0);\n break;\n case 1:\n // this is LR length\n // split between central ana parabola\n if (this.type == 0) {\n var choices = [\n \"$$\"+Math.abs(this.lr)+\"$$\",\n \"$$\"+m_round(Math.abs(this.lr)/4)+\"$$\",\n \"$$\"+ this.lr*4 +\"$$\",\n \"Degenerate\"];\n return knuth(choices, 0)\n }\n else {\n var choices = [\n \"$$\"+2*m_round(Math.pow(this.b,2)/this.a)+\"$$\",\n \"$$\"+2*m_round(Math.pow(this.a-this.b, 2))+\"$$\",\n \"$$\"+2*m_round(Math.pow(this.a,1)/this.b)+1+\"$$\",\n \"Degenerate\"];\n return knuth(choices, 0);\n }\n break;\n case 2:\n // eccentricity\n var choices = [\"$$1$$\", \"$$< 1$$\", \"$$> 1$$\", \"Degenerate\"];\n return knuth(choices, this.type);\n break;\n default:\n // focus\n // split between central and parabola\n var symb = this.type == 0 ? \"+\" : \"\\\\pm\"\n var choices = [\n \"$$(\"+this.h+\", \"+this.k+\")$$\",\n \"$$(\"+this.h+symb+m_round(this.c)+\", \"+this.k+\")$$\",\n \"$$(\"+this.h+\", \"+this.k+symb+m_round(this.c)+\")$$\",\n \"Degenerate\"];\n return knuth(choices, 1+this.o);\n }\n }", "function countTriangle(alas, tinggi) {\n var luas = 0.5*(alas*tinggi);\n return luas;\n}", "function calculate(){\r\n let str\r\n let y=math.complex(0,1/Xc);\r\n let z = math.complex(R*l,Xl);\r\n \r\n\r\n let drop=document.getElementById('drop')\r\n if(drop.value===\"short\"){\r\n console.log(\"Short\");\r\n str=\"Short\"\r\n abcdParams(\"S\",z)\r\n\r\n }else if(drop.value===\"nominalpi\"){\r\n console.log(\"Nominal-Pi\");\r\n str=\"Nominal-Pi\"\r\n abcdParams(\"N\",z,y)\r\n \r\n }else if(drop.value===\"long\"){\r\n console.log(\"Long\");\r\n str=\"Long\"\r\n abcdParams(\"L\",z,y)\r\n }\r\n\r\n if(pfr<0){\r\n pfr=math.abs(pfr)\r\n Ir= math.complex({r:receivingCurr(Pr,pfr,V),phi:-math.acos(pfr)});\r\n sign =1;\r\n }\r\n else{\r\n pfr=math.abs(pfr)\r\n Ir= math.complex({r:receivingCurr(Pr,pfr,V),phi:math.acos(pfr)});\r\n sign =-1;\r\n }\r\n\r\n let a =math.multiply(A,parseFloat(V)/math.sqrt(3))\r\n let b= math.multiply(B,Ir)\r\n let c=math.multiply(C,parseFloat(V)/math.sqrt(3))\r\n let d =math.multiply(D,Ir)\r\n\r\n Vs=math.add(a,b);\r\n Is=math.add(c,d);\r\n\r\n let Vr=VR(parseFloat(V)/math.sqrt(3))\r\n let eff=effc(Pr,Vs,Is)\r\n let comp\r\n let Cs=[]\r\n let Cr=[]\r\n let Vp=parseFloat(V)/math.sqrt(3)\r\n \r\n if(drop.value===\"short\"){\r\n Cs.push((math.abs(D)*Math.pow(math.abs(Vs),2)*math.cos(math.atan(B.im/B.re)))/math.abs(B))\r\n Cs.push((math.abs(D)*Math.pow(math.abs(Vs),2)*math.sin(math.atan(B.im/B.re)))/math.abs(B))\r\n Cr.push((math.abs(A)*Math.pow(Vp,2)*math.cos(math.atan(B.im/B.re)))/math.abs(B))\r\n Cr.push((math.abs(A)*Math.pow(Vp,2)*math.sin(math.atan(B.im/B.re)))/math.abs(B))\r\n }\r\n else{\r\n Cs.push((math.abs(D)*Math.pow(math.abs(Vs),2)*math.cos(math.atan(B.im/B.re)-math.atan(D.im/D.re)))/math.abs(B))\r\n Cs.push((math.abs(D)*Math.pow(math.abs(Vs),2)*math.sin(math.atan(B.im/B.re)-math.atan(D.im/D.re)))/math.abs(B))\r\n Cr.push((math.abs(A)*Math.pow(Vp,2)*math.cos(math.atan(B.im/B.re)-math.atan(A.im/A.re)))/math.abs(B))\r\n Cr.push((math.abs(A)*Math.pow(Vp,2)*math.sin(math.atan(B.im/B.re)-math.atan(A.im/A.re)))/math.abs(B))\r\n }\r\n\r\n let Rc = math.abs(Vs)*Vp/math.abs(B);\r\n graph(Cs,Cr,Rc)\r\n\r\n\r\n let inputDiv=document.getElementById(\"visible\");\r\n let inputHead=document.getElementById(\"inputhead\");\r\n inputDiv.style.display=\"none\";\r\n inputHead.style.display=\"none\";\r\n let outputDiv=document.getElementById(\"invisible\");\r\n let outputHead=document.getElementById(\"outputhead\");\r\n let graphDiv=document.getElementById(\"graphsec\");\r\n graphDiv.style.display=\"flex\"\r\n let op = document.getElementsByClassName(\"op\");\r\n outputDiv.style.display=\"flex\"\r\n outputHead.style.display=\"flex\"\r\n Ich=chargingCurr();\r\n op[0].innerText=str;\r\n \r\n\r\n op[1].innerText=math.round(L,5);\r\n op[2].innerText=math.round(Cap,12);\r\n op[3].innerText=math.round(Xl,5);\r\n op[4].innerText=math.round(Xc,5);\r\n op[5].innerText=math.round(A,5);\r\n op[6].innerText=math.round(B,5);\r\n op[7].innerText=math.round(C,5);\r\n op[8].innerText=math.round(D,5);\r\n op[9].innerText=math.round(Vs,5);\r\n op[10].innerText=math.round(Is,5);\r\n op[11].innerText=math.round(Vr,5);\r\n op[12].innerText=math.round((Ps-Pr)/math.pow(10,6),5);\r\n op[13].innerText=math.round(eff,5);\r\n op[14].innerText=math.round(Ich,5);\r\n \r\n if(drop.value ===\"short\"){\r\n comp=compensation()\r\n \r\n if(comp){\r\n op[15].innerText=math.round(comp,5)\r\n }\r\n else{\r\n op[15].innerText=\"invalid\"\r\n }\r\n document.getElementsByClassName('h')[0].style.display=\"block\"\r\n if(comp<0)\r\n document.getElementsByClassName('h')[1].style.display=\"block\"\r\n else\r\n document.getElementsByClassName('h')[2].style.display=\"block\"\r\n }\r\n else{\r\n op[15].style.display=\"none\"\r\n document.getElementsByClassName('h')[0].style.display=\"none\"\r\n \r\n }\r\n \r\n}", "function ctfclick(){\r\n //define the number\r\n let C = Number(document.getElementById('tic').value);\r\n\r\n //create the formula\r\n let answerC = 'Temperature in Farhrenheit' + [32 + (C * 9/5)]\r\n\r\n //output\r\n document.getElementById('result').innerHTML = answerC;\r\n}", "function triangleSolver() {\n // this.given_conditions = {a:4, b:6, c:9}; //sss\n // this.given_conditions = {a:4, b:60, c:9}; //sas\n // this.given_conditions = {a:50,b:3,c:20}; //asa\n // this.given_conditions = {a:20,b:50,c:5} //aas\n // this.given_conditions = {a:2,b:4,c:1}; //sss-not possible\n // this.given_conditions = {a:5,b:2,c:70} //ssa; no solutions\n this.given_conditions = {a:5,b:10,c:70} //ssa; one solution\n // this.given_conditions = {a:16,b:10,c:30} //ssa; two solutions\n\n\n // converts degrees to radians\n var convertDegsToRads = function(degree_angle) {\n var radian_angle = degree_angle*(Math.PI)/180;\n return radian_angle;\n };\n\n // converts radians to degrees\n var convertRadsToDegs = function(radian_angle) {\n var degree_angle = radian_angle/(Math.PI)*180;\n return degree_angle;\n };\n\n // finds third angle given two angles, must be in degrees\n var findThirdAngle = function(angle1,angle2) {\n var angle = 180 - angle1 - angle2;\n return angle;\n }\n\n // finds the angle opposite of first_side, angles are in rads\n var lawOfCosinesAngle = function(first_side,second_side,third_side) {\n var angle = Math.acos((second_side**2 + third_side**2 - first_side**2) / (2*second_side*third_side));\n angle = convertRadsToDegs(angle); // convert from radians to degrees\n return angle;\n };\n\n // finds the (third) side opposite of the given angle, angles are in rads\n var lawOfCosinesSide = function(angle,first_side,second_side) {\n var side = (first_side**2 + second_side**2 - 2*first_side*second_side*(Math.cos(angle)))**(0.5);\n return side;\n };\n\n // finds the angle opposite of second_side, given that first_angle is opposite of first_side, angles are in rads\n var lawOfSinesAngle = function(first_angle,first_side,second_side) {\n var angle = Math.asin(second_side*(Math.sin(first_angle)/first_side));\n angle = convertRadsToDegs(angle); // convert from radians to degrees\n return angle;\n };\n\n // finds the side opposite of second_angle, given that first_angle is opposite of first_side, angles are in rads\n var lawOfSinesSide = function(first_angle,first_side,second_angle) {\n var side = Math.sin(second_angle)*first_side/Math.sin(first_angle);\n return side;\n };\n\n // determines if a triangle is possible to construct given three sides using Triangle Inequality Theorem\n // this.given_conditions = {a:2,b:4,c:1}; // sss-not possible\n this.tit = function() {\n var side1 = this.given_conditions.a;\n var side2 = this.given_conditions.b;\n var side3 = this.given_conditions.c;\n\n if (side1 + side2 > side3 && side1 + side3 > side2 && side3 + side2 > side1) {\n return this.sss();\n } else {\n return \"This is not a constructible triangle.\"\n };\n };\n\n\n // finds three angles when the given conditions are only sides\n // this.given_conditions = {a:4, b:6, c:9}; //sss\n this.sss = function() {\n var side1 = this.given_conditions.a;\n var side2 = this.given_conditions.b;\n var side3 = this.given_conditions.c;\n var solutions = {};\n\n solutions.angle1 = lawOfCosinesAngle(side1,side2,side3);\n solutions.angle2 = lawOfCosinesAngle(side2,side1,side3);\n solutions.angle3 = lawOfCosinesAngle(side3,side1,side2);\n\n return solutions;\n };\n\n // finds two angles opposite of the given sides and the side opposite of the given angle\n // this.given_conditions = {a:4, b:60, c:9};\n // this.given_conditions = {non-paired side, non-paired angle, non-paired side};\n this.sas = function () {\n\n var side1 = this.given_conditions.a;\n var angle3 = convertDegsToRads(this.given_conditions.b);\n var side2 = this.given_conditions.c;\n var solutions = {};\n\n solutions.side3 = lawOfCosinesSide(angle3,side1,side2);\n solutions.angle1 = lawOfSinesAngle(angle3,solutions.side3,side1);\n solutions.angle2 = lawOfCosinesAngle(side2,solutions.side3,side1);\n\n return solutions;\n };\n\n // finds two sides opposite of the given angles and the angle opposite of the given side\n // this.given_conditions = {a:50,b:3,c:20}\n // this.given_conditions = {non-paired angle, non-paired side, non-paired angle} //aas\n\n this.asa = function(){\n\n var angle1 = this.given_conditions.a;\n var side2 = this.given_conditions.b;\n var angle3 = this.given_conditions.c;\n var solutions = {};\n\n solutions.angle2 = findThirdAngle(angle1,angle3);\n solutions.side1 = lawOfSinesSide(convertDegsToRads(solutions.angle2),side2,convertDegsToRads(angle1));\n solutions.side3 = lawOfSinesSide(convertDegsToRads(solutions.angle2),side2,convertDegsToRads(angle3));\n\n return solutions;\n };\n // finds two sides and an angle, given that there is one opposite pair\n // this.given_conditions = {a:20,b:50,c:5} //aas\n // this.given_conditions = {non-paired angle, pair angle, pair side} //aas\n this.aas = function(){\n\n var angle1 = this.given_conditions.a;\n var angle2 = this.given_conditions.b;\n var side2 = this.given_conditions.c;\n var solutions = {};\n\n solutions.angle3 = findThirdAngle(angle1,angle2);\n solutions.side1 = lawOfSinesSide(convertDegsToRads(angle2),side2,convertDegsToRads(angle1));\n solutions.side3 = lawOfSinesSide(convertDegsToRads(angle2),side2,convertDegsToRads(solutions.angle3));\n\n return solutions;\n };\n\n // finds two angles and a side, given that there is one opposite pair\n // this handles ambiguous situations\n // this.given_conditions = {non-paired side, paired side, paired angle} //aas\n // this.given_conditions = {a:5,b:2,c:70} //ssa; no solutions\n // this.given_conditions = {a:5,b:10,c:70} //ssa; one solution\n // this.given_conditions = {a:16,b:10,c:30} //ssa; two solutions\n this.ssa = function(){\n\n var side1 = this.given_conditions.a;\n var side2 = this.given_conditions.b;\n var angle2 = convertDegsToRads(this.given_conditions.c);\n var solutions = {};\n var angle1 = lawOfSinesAngle(angle2,side2,side1);\n\n // ratio determines whether a triangle is possible\n // var ratio = side1*Math.sin(angle2)/side2;\n\n if (isNaN(angle1)) {\n return \"No possible triangle\";\n } else if ( (180 - angle1) + convertRadsToDegs(angle2) > 180) {\n // only one solution\n return \"one solution\";\n // var angle3 = findThirdAngle(angle1,convertRadsToDegs(angle2));\n // return angle3;\n } else {\n // two solution sets\n return \"two solutions\";\n\n };\n\n // solutions.angle3 = findThirdAngle(angle1,angle2);\n // solutions.side1 = lawOfSinesSide(convertDegsToRads(angle2),side2,convertDegsToRads(angle1));\n // solutions.side3 = lawOfSinesSide(convertDegsToRads(angle2),side2,convertDegsToRads(solutions.angle3));\n\n // return angle1;\n };\n\n\n}", "function NotaFinal() {\r\n\r\n pregunta1();\r\n pregunta3();\r\n cor =\r\n parseFloat(tpre1) +\r\n parseFloat(tpre3);\r\n Calculo_nota();\r\n}", "function calculateNext(data) {\n \n var aK1, bK1, hlp, hlp2, hlp3, tau, fNaK, am, bm, ad, bd, Infi, af, bf, ar, br, ato, bto, Itot;\n //xlap;\n \n var vi_t, tauv_t, xi_t, taux_t, zIK1_t, zINaCa1_t, zINaCa2_t, zINaK_t, zINab_t, zICab_t,\n expm_t, mi_t, zINa_t, expv_t, zICa_t, expff_t, fi_t, zIto_t, expto_t, toi_t, expxx_t,\n zIK_t;\n \n \n /* tabulations */\n \n vi_t=.5*(1-((Math.exp(7.74+.12*cS.v)-Math.exp(-(7.74+.12*cS.v)))/(Math.exp(7.74+.12*cS.v)+Math.exp(-(7.74+.12*cS.v)))));\n tauv_t = .25+2.24*((1-(Math.exp(7.74+.12*cS.v)-Math.exp(-(7.74+.12*cS.v)))/(Math.exp(7.74+.12*cS.v)+Math.exp(-(7.74+.12*cS.v))))/(1-(Math.exp(0.07*(cS.v+92.4))-Math.exp(-(0.07*(cS.v+92.4))))/(Math.exp(0.07*(cS.v+92.4))+Math.exp(-(0.07*(cS.v+92.4))))));\n xi_t = 0.988/(1+Math.exp(-.861-0.062*cS.v));\n taux_t = 240*Math.exp(-((25.5+cS.v)*(25.5+cS.v))/156)+182*(1+(Math.exp(0.154+0.0116*cS.v)-Math.exp(-(0.154+0.0116*cS.v)))/(Math.exp(0.154+0.0116*cS.v)+Math.exp(-(0.154+0.0116*cS.v))))+40*(1+(Math.exp(160+2*cS.v)-Math.exp(-(160+2*cS.v)))/(Math.exp(160+2*cS.v)+Math.exp(-(160+2*cS.v))));\n \n /* Time-independent functions */\n aK1 = 0.1/(1.0+Math.exp(0.06*(cS.v-cC.ek1-200.0)));\n bK1=(3.0*Math.exp(0.0002*(cS.v-cC.ek1+100.0))+Math.exp(0.1*(cS.v-cC.ek1-10.0)))/(1.0+Math.exp(-0.5*(cS.v-cC.ek1)));\n hlp = aK1/(aK1+bK1);\n zIK1_t = cS.gK1*hlp*(cS.v-cC.ek1);\n \n hlp = cS.v/cC.RTonF;\n hlp2 = Math.exp(cS.eta*hlp);\n hlp3 = Math.exp((cS.eta-1.0)*hlp);\n hlp = cS.gNaCa/( (cS.KmNa*cS.KmNa*cS.KmNa+cS.Nae*cS.Nae*cS.Nae)*(cS.KmCa+cS.Cae)*(1.0+cS.ksat*hlp3));\n zINaCa1_t = hlp*hlp2*cS.Nai*cS.Nai*cS.Nai*cS.Cae;\n zINaCa2_t = hlp*hlp3*cS.Nae*cS.Nae*cS.Nae;\n \n hlp = cS.v/cC.RTonF;\n fNaK = 1.0/(1.0+0.1245*Math.exp(-0.1*hlp) + 0.0365*cC.sigma*Math.exp(-hlp));\n hlp = cS.KmNai/cS.Nai;\n hlp2 = 1.0/(1.0+Math.sqrt(hlp*hlp*hlp));\n hlp3 = cS.Ke/(cS.Ke+cS.KmKe);\n zINaK_t = cS.gNaK*fNaK*hlp2*hlp3;\n zINab_t = cS.gNab*(cS.v-cC.ena);\n zICab_t = cS.gCab*(cS.v-cC.eca);\n \n /* NA gating variables */\n am = ((Math.abs(cS.v+47.13)) > 0.001) ? 0.32*(cS.v+47.13)/(1.0 - Math.exp(-0.1*(cS.v+47.13)) ): 3.2;\n bm = 0.08*Math.exp(cS.v/(-11.0));\n hlp = am+bm;\n tau = 1.0/hlp;\n expm_t = Math.exp(-cS.timestep/tau);\n \n mi_t = am/hlp;\n zINa_t = cS.gNa*(cS.v - cC.ena);\n expv_t = Math.exp(-cS.timestep/tauv_t);\n \n \n /*CA gating variables */\n \n hlp = Math.sqrt(2.0*cC.pi);\n hlp2= (cS.v-22.36)/16.6813;\n ad = (14.9859/(16.6813*hlp))*Math.exp(-0.5*hlp2*hlp2);\n hlp2 = (cS.v-6.2744)/14.93;\n bd = 0.1471-((5.3/(14.93*hlp))*Math.exp(-0.5*hlp2*hlp2));\n hlp = ad+bd;\n Infi = ad/hlp;\n zICa_t = cS.gCa*cC.fCa*Infi*(cS.v-cC.eca);\n \n af = 0.006872/(1.0+Math.exp((cS.v-6.1546)/6.1223));\n hlp = 0.0687*Math.exp(-0.1081*(cS.v+9.8255)) + 0.0112;\n hlp2 = 1.0+Math.exp(-0.2779*(cS.v+9.8255));\n bf = hlp/hlp2 + 0.0005474;\n hlp = af+bf;\n tau = 1.0/hlp;\n expff_t = Math.exp(-cS.timestep/tau);\n fi_t = af/hlp;\n \n /*TO gating variables */\n hlp = cS.v-42.2912;\n hlp2 = 0.5266*Math.exp(-0.0166*hlp);\n hlp3 = 1.0 + Math.exp(-0.0943*hlp);\n ar = hlp2/hlp3;\n hlp = 0.5149*Math.exp(-0.1344*(cS.v-5.0027)) + 0.00005186*cS.v;\n hlp2 = 1.0 + Math.exp(-0.1348*(cS.v-0.00005186));\n br = hlp/hlp2;\n hlp = ar+br;\n Infi = ar/hlp;\n zIto_t= cS.gto*Infi*(cS.v-cC.eto);\n hlp = cS.v + 34.2531;\n hlp2 = 0.0721*Math.exp(-0.173*hlp)+0.00005612*cS.v;\n hlp3 = 1.0+Math.exp(-0.1732*hlp);\n ato = hlp2/hlp3;\n hlp = cS.v + 34.0235;\n hlp2 = 0.0767*Math.exp(-1.66E-9*hlp)+0.0001215*cS.v;\n hlp3 = 1.0+Math.exp(-0.1604*hlp);\n bto = hlp2/hlp3;\n hlp = ato+bto;\n tau = 1.0/hlp;\n expto_t = Math.exp(-cS.timestep/tau);\n toi_t = ato/hlp;\n \n /* IK gating variables */\n expxx_t= Math.exp(-cS.timestep/(taux_t+40.0*(1.0-(Math.exp(160.0+cS.v*2.0)- Math.exp(-(160.0+cS.v*2.0)))/(Math.exp(160.0+cS.v*2.0)+ Math.exp(-(160.0+cS.v*2.0)))) ));\n zIK_t = cS.gK*(cS.v- cC.ekr);\n \n cS.istim = _s1s2Stimulus(count, data);\n \n /* Gating variables */\n cS.m = mi_t + ( cS.m - mi_t ) * expm_t;\n cS.f = fi_t + ( cS.f - fi_t ) * expff_t;\n cS.xv = vi_t + ( cS.xv - vi_t ) * expv_t;\n cS.to = toi_t + ( cS.to - toi_t ) * expto_t;\n cS.xx = xi_t + ( cS.xx - xi_t ) * expxx_t;\n \n /* The membrane currents */\n cS.ica = cS.f*zICa_t;\n cS.icab= zICab_t;\n cS.ina = cS.gNa*cS.xv*cS.xv*cS.m*cS.m*cS.m*(cS.v - cC.ena);\n cS.inab= zINab_t;\n cS.ik = cS.xx*cS.xx*zIK_t;\n cS.ik1 = zIK1_t;\n cS.ito = cS.to*zIto_t;\n cS.inaca = zINaCa1_t - cS.Cai*zINaCa2_t;\n cS.inak = zINaK_t;\n Itot= cS.ica+cS.icab+cS.ik1+cS.ik+cS.ina+cS.inab+cS.inaca+cS.inak+cS.ito-cS.istim;\n \n // \n \n /*if(count == 1){\n xlap = cC.d_o_dx2*(2.0*v(i+1)-2.0*cS.v);\n }\n else if (count == 1){\n xlap = cC.d_o_dx2*(2.0*v(i-1)-2.0*cS.v)\n }\n else{\n xlap = cC.d_o_dx2*(v(i+1)-2.0*cS.v+v(i-1))\n }*/\n \n /* The membrane potential */\n \n //cS.v = cS.v - cS.timestep*Itot+xlap; \n cS.v = cS.v - cS.timestep*Itot;\n \n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n return data; \n }", "function areaTriangulo (base,altura){\n\n return (base*altura)/2;\n}", "function effemeridi_pianeti(np,TEMPO_RIF,LAT,LON,ALT,ITERAZIONI,STEP,LAN){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) ottobre 2011\n // funzione per il calcolo delle effemeridi del Sole.\n // Parametri utilizzati\n // np= numero identificativo del pianeta 0=Mercurio,1=Venere.....7=Nettuno\n // il valore np=2 (Terra) non deve essere utilizzato come parametro.\n // TEMPO_RIF= \"TL\" o \"TU\" tempo locale o tempo universale.\n // LAT= latitudine in gradi sessadecimali.\n // LON= longtudine in gradi sessadecimali.\n // ALT= altitudine in metri.\n // ITERAZIONE =numero di ripetizioni del calcolo.\n // STEP=salto \n // LAN=\"EN\" versione in inglese.\n \n \n var njd=calcola_jdUT0(); // numero del giorno giuliano all'ora 0 di oggi T.U.\n\n njd=njd+0.00078; // correzione per il Terrestrial Time.\n\n //njd=njd+t_luce(njd,np); // correzione tempo luce.\n \nvar data_ins=0; // data\nvar data_inser=0; // data\nvar numero_iterazioni=ITERAZIONI;\n\nvar fusoloc=-fuso_loc(); // recupera il fuso orario della località (compresa l'ora legale) e riporta l'ora del pc. come T.U.\n\nvar sorge=0;\nvar trans=0;\nvar tramn=0;\nvar azimuts=0;\nvar azimutt=0;\n\nvar effe_pianeta=0;\nvar ar_pianeta=0;\nvar de_pianeta=0;\nvar classetab=\"colore_tabellaef1\";\nvar istanti=0;\nvar magnitudine=0;\nvar fase=0;\nvar diametro=0;\nvar distanza=0;\nvar elongazione=0;\nvar costl=\"*\"; // nome della costellazione.\nvar parallasse=0;\nvar p_ap=0; // coordinate apparenti del pianeta.\n\nif (STEP==0) {STEP=1;}\n \n document.write(\"<table width=100% class='.table_effemeridi'>\");\n document.write(\" <tr>\");\n\n // versione in italiano.\n\n if (LAN!=\"EN\") // diverso da EN\n {\n document.write(\" <td class='colore_tabella'>Data:</td>\");\n document.write(\" <td class='colore_tabella'>Sorge:</td>\");\n document.write(\" <td class='colore_tabella'>Culmina:</td>\");\n document.write(\" <td class='colore_tabella'>Tramonta:</td>\");\n document.write(\" <td class='colore_tabella'>A. So.:</td>\");\n document.write(\" <td class='colore_tabella'>A. Tr.:</td>\");\n document.write(\" <td class='colore_tabella'>A. Retta:</td>\");\n document.write(\" <td class='colore_tabella'>Dec.:</td>\");\n document.write(\" <td class='colore_tabella'>Fase.</td>\");\n document.write(\" <td class='colore_tabella'>Dist.</td>\");\n document.write(\" <td class='colore_tabella'>Dia.</td>\");\n document.write(\" <td class='colore_tabella'>El.</td>\");\n document.write(\" <td class='colore_tabella'>Ma.</td>\");\n document.write(\" <td class='colore_tabella'>Cost.</td>\");\n }\n\n // versione in inglese.\n\nif (LAN==\"EN\")\n {\n\n document.write(\" <td class='colore_tabella'>Date:</td>\");\n document.write(\" <td class='colore_tabella'>Rise:</td>\");\n document.write(\" <td class='colore_tabella'>Transit:</td>\");\n document.write(\" <td class='colore_tabella'>Set:</td>\");\n document.write(\" <td class='colore_tabella'>Az. Rise:</td>\");\n document.write(\" <td class='colore_tabella'>Az. Set:</td>\");\n document.write(\" <td class='colore_tabella'>R.A.:</td>\");\n document.write(\" <td class='colore_tabella'>Dec.:</td>\");\n document.write(\" <td class='colore_tabella'>Ph.</td>\");\n document.write(\" <td class='colore_tabella'>Dist.</td>\");\n document.write(\" <td class='colore_tabella'>Dia.</td>\");\n document.write(\" <td class='colore_tabella'>El.</td>\");\n document.write(\" <td class='colore_tabella'>Ma.</td>\");\n document.write(\" <td class='colore_tabella'>Const.</td>\");\n\n }\n\n\n document.write(\" </tr>\");\n\n // ST_ASTRO_DATA Array(azimut_sorgere,azimut_tramonto,tempo_sorgere,tempo_transito,tempo_tramonto)\n // 0 1 2 3 4\n\n njd=njd-STEP;\n\n for (b=0; b<numero_iterazioni; b=b+STEP){\n njd=njd+STEP;\n effe_pianeta=pos_pianeti(njd,np); \n\n // calcola le coordinate apparenti nutazione e aberrazione.\n\n p_ap=pos_app(njd,effe_pianeta[0],effe_pianeta[1]);\n ar_pianeta= sc_ore(p_ap[0]); // ascensione retta in hh:mm:ss.\n de_pianeta=sc_angolo(p_ap[1],0); // declinazione. \n \n fase=effe_pianeta[2];\n magnitudine=effe_pianeta[3];\n distanza=effe_pianeta[4].toFixed(3);\n diametro=effe_pianeta[5].toFixed(1);\n elongazione=effe_pianeta[6].toFixed(1);\n costl=costell(effe_pianeta[0]); // costellazione.\n\n istanti=ST_ASTRO_DATA(njd,effe_pianeta[0],effe_pianeta[1],LON,LAT,ALT,0);\n\nif (TEMPO_RIF==\"TL\"){\n sorge=ore_24(istanti[2]+fusoloc);\n trans=ore_24(istanti[3]+fusoloc);\n tramn=ore_24(istanti[4]+fusoloc); }\n\nelse {\n sorge=ore_24(istanti[2]);\n trans=ore_24(istanti[3]);\n tramn=ore_24(istanti[4]); } \n\n sorge=sc_ore_hm(sorge); // istanti in hh:mm\n trans=sc_ore_hm(trans);\n tramn=sc_ore_hm(tramn);\n\n // formatta la data da inserire.\n\n data_ins=jd_data(njd);\n\n if (LAN!=\"EN\") {data_inser=Lnum(parseInt(data_ins[0]),2)+\":\"+Lnum(parseInt(data_ins[1]),2)+\" |\"+data_ins[3];} // versione in italiano.\n if (LAN==\"EN\") {data_inser=Lnum(parseInt(data_ins[0]),2)+\":\"+Lnum(parseInt(data_ins[1]),2)+\" |\"+data_ins[4];} // versione in inglese.\n\n azimuts=istanti[0].toFixed(1);\n azimutt=istanti[1].toFixed(1);\n\n if (b%2==0){classetab=\"colore_tabellaef2\"; }\n\n else {classetab=\"colore_tabellaef1\";}\n\n\n document.write(\" <tr>\");\n document.write(\" <td class='\"+classetab+\"'>\"+data_inser+\"</td>\");\n document.write(\" <td class='\"+classetab+\"'>\"+sorge+\"</td>\");\n document.write(\" <td class='\"+classetab+\"'>\"+trans+\"</td>\");\n document.write(\" <td class='\"+classetab+\"'>\"+tramn+\"</td>\");\n document.write(\" <td class='\"+classetab+\"'>\"+azimuts+\"&deg;</td>\");\n document.write(\" <td class='\"+classetab+\"'>\"+azimutt+\"&deg;</td>\");\n document.write(\" <td class='\"+classetab+\"'>\"+ar_pianeta+\"</td>\");\n document.write(\" <td class='\"+classetab+\"'>\"+de_pianeta+\"</td>\");\n document.write(\" <td class='\"+classetab+\"'>\"+fase+\"</td>\");\n document.write(\" <td class='\"+classetab+\"'>\"+distanza+\"</td>\");\n document.write(\" <td class='\"+classetab+\"'>\"+diametro+\"</td>\");\n document.write(\" <td class='\"+classetab+\"'>\"+elongazione+\"</td>\");\n document.write(\" <td class='\"+classetab+\"'>\"+magnitudine+\"</td>\");\n document.write(\" <td class='\"+classetab+\"'>\"+costl+\"</td>\");\n\n document.write(\" </tr>\");\n\n }\n document.write(\" </table>\");\n\n\n}", "function calT(a, b, op) {\n\n var result;\n \n if (op == \"+\") {\n \n result = a + b;\n \n alert(result);\n }\n \n else if (op == \"-\") {\n \n result = a - b;\n \n alert(result);\n \n }\n \n else if(op == \"*\") {\n \n result = a * b;\n \n alert(result);\n }\n \n else if(op == \"/\"){\n \n result = a / b;\n \n alert(result);\n }\n \n \n }", "function areaTriangulo (base, altura) {\n return (base * altura)/2;\n}", "quadratic(){\nvar a=readlinesync.question(\"Enter the value of a:\");\nvar b=readlinesync.question(\"Enter the value of b:\");\nvar c=readlinesync.question(\"Enter the value of c:\");\nvar delta=Math.pow(b,2)-4*a*c;\nvar root1=(-b+Math.sqrt(delta)/(2*a*c));\nconsole.log(\"Root1 of x:\"+root1);\nvar root2=(-b-Math.sqrt(delta)/(2*a*c));\nconsole.log(\"Root2 of x:\"+root2);\n}", "function fl_outToTu_btn ()\n\t\t{\n\t\t\tif(freez == \"false\"){\n\t\t\tconsole.log(\"hit\")\n\t\t this.rimon.alpha=1\n\t\t\tthis.sufgania.alpha=1\n\t\t\tthis.selek.alpha=1\n\t\t\tthis.tamar.alpha=1\n\t\t\tthis.karpas.alpha=1\n\t\t\tthis.levivot.alpha=1\n\t\t\tthis.haroset.alpha=1\n\t\t\tthis.maza.alpha=1\n\t\t\tthis.hasa.alpha=1\n\t\t\tthis.beiza.alpha=1\n\t\t\tthis.hazeret.alpha=1\n\t\t\tthis.mamtak.alpha=1\n\t\t\tthis.gvina.alpha=1\n\t\t\tthis.oznei_aman.alpha=1\n\t\t\tthis.dvash.alpha=1\n\t\t\tthis.dag.alpha=1\n\t\t\tthis.sumsum.alpha=1\n\t\t\tthis.mishloah.alpha=1\n\t\t this.of.alpha=1\n\t\t this.chanuka_btn.alpha=1\n\t\t this.purim_btn.alpha=1\n\t\t this.pesach_btn.alpha=1\n\t\t this.shavuot_btn.alpha=1\n\t\t this.rosh_ha_shana_btn.alpha=1\n\t\t this.bible_btn.alpha=1\n\t\t\t\t\t this.arrow_btn.alpha=0\n\t\tthis.arrowAside_mc.alpha=0\n\t\tthis.gvina_explain.alpha=0\n\t\tthis.mishloah_explain.alpha=0\n\t\tthis.sufgania_explain.alpha=0\n\t\t\n\t\tthis.perot_explain.alpha=0\n\t\t\n\t\tthis.tapuah_explain.alpha=0\n\t\t\n\t\tthis.maza_explain.alpha=0\n\t\t\n\t\t}}", "function calcRoutee(){\r\n\t\t\r\n\t\tvar half= document.getElementById(\"half\").value;\r\n\t\tvar end = document.getElementById(\"end\").value;\r\n\t\tvar request = { origin: half, destination: end,\r\n\t\t\ttravelMode: google.maps.DirectionsTravelMode.DRIVING\r\n\t\t};\r\n\t\tdirectionsService.route(request, function(directionsResults, status){\r\n\t\t\tif(status==google.maps.DirectionsStatus.OK){\r\n\t\t\t\thandleDirectionsResponse1(\r\n\t\t\t\t\t\t half,end, directionsResults);\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\t }", "function fl_outToSumsum ()\n\t\t{if(freez==\"false\"){\n\t\t\tconsole.log(\"hit\")\n\t\t\tthis.rimon.alpha=1\n\t\t\tthis.sufgania.alpha=1\n\t\t\tthis.selek.alpha=1\n\t\t\tthis.tamar.alpha=1\n\t\t\tthis.karpas.alpha=1\n\t\t\tthis.levivot.alpha=1\n\t\t\tthis.haroset.alpha=1\n\t\t\tthis.maza.alpha=1\n\t\t\tthis.hasa.alpha=1\n\t\t\tthis.beiza.alpha=1\n\t\t\tthis.hazeret.alpha=1\n\t\t\tthis.mamtak.alpha=1\n\t\t\tthis.gvina.alpha=1\n\t\t\tthis.oznei_aman.alpha=1\n\t\t\tthis.dvash.alpha=1\n\t\t\tthis.dag.alpha=1\n\t\t\tthis.perot.alpha=1\n\t\t\tthis.mishloah.alpha=1\n\t\t\tthis.of.alpha=1\n\t\t this.chanuka_btn.alpha=1\n\t\t this.tu_btn.alpha=1\n\t\t this.purim_btn.alpha=1\n\t\t this.pesach_btn.alpha=1\n\t\t this.shavuot_btn.alpha=1\n\t\t this.bible_btn.alpha=1\n\t\t\t\t\t this.arrow_btn.alpha=0\n\t\tthis.arrowAside_mc.alpha=0\n\t\tthis.gvina_explain.alpha=0\n\t\tthis.mishloah_explain.alpha=0\n\t\tthis.sufgania_explain.alpha=0\n\t\tthis.perot_explain.alpha=0\n\t\tthis.tapuah_explain.alpha=0\n\t\tthis.maza_explain.alpha=0\n\t\t}}", "function PlanarCoordinates() {\n var x1 = parseFloat(document.getElementById('x1').value);\n var y1 = parseFloat(document.getElementById('y1').value);\n var x2 = parseFloat(document.getElementById('x2').value);\n var y2 = parseFloat(document.getElementById('y2').value);\n var x3 = parseFloat(document.getElementById('x3').value);\n var y3 = parseFloat(document.getElementById('y3').value);\n\n var length = {\n lineLengthAtoB: countDistance(x1, y1, x2, y2),\n lineLengthBtoC: countDistance(x2, y2, x3, y3),\n lineLengthAtoC: countDistance(x1, y1, x3, y3)\n }\n\n function countDistance(varX1, varY1, varX2, varY2) {\n var result = Math.sqrt(((varX2 - varX1) * (varX2 - varX1)) +\n ((varY2 - varY1) * (varY2 - varY1)));\n\n return result;\n }\n\n var resultAtoB = Count(length.lineLengthAtoB.toString());\n var resultBtoC = Count(length.lineLengthBtoC.toString());\n var resultAtoC = Count(length.lineLengthAtoC.toString());\n\n function Count(str) {\n var i;\n var index = str.length;\n\n for (i = 0; i < str.length; i++) {\n if (str[i] === '.'.toString()) {\n index = i + 4;\n\n break;\n }\n }\n\n return str.substring(0, index);\n }\n\n var form = formTriangle(parseFloat(resultAtoB), parseFloat(resultBtoC), parseFloat(resultAtoC));\n\n function formTriangle(a, b, c) {\n var biggest = a;\n var second = b;\n var third = c;\n if (b > a && b > c) {\n biggest = b;\n second = a;\n } else if (c > a && c > b) {\n biggest = c;\n second = a;\n }\n\n var val = second + third;\n\n if (val > biggest) {\n return true;\n } else {\n return false;\n }\n }\n\n var endResult = 'Distanance:<br />A to B = <span style=\"color: red;\">' + resultAtoB + \n '</span><br />B to C = <span style=\"color: red;\">' + resultBtoC + '</span><br />A to C = <span style=\"color: red;\">' + \n resultAtoC + '</span><br />';\n endResult += 'Can the lines form a triangle? <span style=\"color: red;\">' + form + '</span>';\n\n document.getElementById('result1').innerHTML = '<h4>Result Task 1:</h4> ' + endResult;\n}", "function calculation () { \n var cos = Math.cos(phi), sin = Math.sin(phi);\n xB0 = xM0+R0*cos; yB0 = yM0-R0*sin; // Beobachtungsort (linke Skizze) \n xN0 = xB0-R1*sin; yN0 = yB0-R1*cos; // Norden (linke Skizze)\n xS0 = xB0+R1*sin; yS0 = yB0+R1*cos; // S�den (linke Skizze)\n xZ0 = xB0+R1*cos; yZ0 = yB0-R1*sin; // Zenit (linke Skizze)\n if (phi < 0) {cos = -cos; sin = -sin;} // Vorzeichenumkehr f�r S�dhalbkugel\n xP1 = xB1-R1*cos; yP1 = yB1-R1*sin; // Himmelspol (rechte Skizze) \n }", "function sum(awalderet, akhirderet, step){\n if(awalderet != null && akhirderet != null && step == null){ //jika step kosong maka nilainya 1\n step = 1;\n var tampung = rangeWithStep(awalderet, akhirderet, step);\n var total = 0;\n\n for(i = 0; i < tampung.length; i++){\n total += tampung [i]\n }\n return total;\n\n }//jika semua parameter tidak null maka masuk ke sini\n else if(awalderet != null && akhirderet != null && step != null){\n var tampung = rangeWithStep(awalderet, akhirderet, step);\n var total = 0;\n\n for(i = 0; i < tampung.length; i++){\n total += tampung [i]\n }\n return total;\n\n }//jika hanya terdapat parameter awalderet maka sum bernilai awalderet\n else if(awalderet != null && akhirderet == null && step == null){\n total = awalderet;\n return total;\n }//jika parameter kosong semua maka return 0;\n else{\n return 0;\n }\n\n}", "function noncommercial(){\n calculate(1.25, 1.5)\n \t\n }", "function indi(){\nalert(\"If a number is written in the form 2⁴, the number 2 is called the base and 4 is the index or power of the number.2⁴ means 2×2×2×2. The same applies for all numbers and algebraic letters.\");\nalert(\"Lets look at the laws of indices.\");\nalert(\"LAW 1: a^x × a^y=a^(x+y).This is interpreted as follows:When multiplying numbers in index form to the same base add the powers eg 3²×3²=3⁴(notice the powers have been added). Another example is x² × x¹=x³.\");\nalert(\"LAW 2: a^x÷a^y=a^(x-y).This is interpreted as follows:When dividing numbers in index form to the same base subtract the powers eg 4¹÷4³=4-².Another example y³÷y²=y(notice how the powers have been subtracted.\");\nalert(\"LAW 3:(a^x)^y=a^xy.This is interpreted as follows:When raising a number in index form to another power multiply the powers and maintain the base eg (5²)²=5⁴(notice the powers have been multiplied and the base remains unchanged)\");\nalert(\"Any number or letter raised to the power 1 equals the number itself eg 5¹=5 and d¹=d.\");\nalert(\"Any number or letter raised to the power zero equals 1 eg 6°=1 and x°=1.\");\nalert(\"Any number or letter raised to a negative power equals to the inverse or reciprocal of the positive power of the number eg 3-²=1/3² and g-⁴=1/g⁴\");\nalert(\"×√a=a^(1/x) interpreted as follows: The root of a number equals that number raised to the inverse of the root eg √a=a^½, ³√a=a^⅓, ⁴√8=8^¼ etc.\");\nalert(\"Lets work on some examples.\");\nalert(\"Lets simplify a^5÷a^6=a-¹=1/a (use law 2).\");\nalert(\"Lets evaluate x² × x-²=x°=1(use law 1)\");\nalert(\"Evaluate (⅔)-²=1/(⅔)²=1/(2²/3²)=1×(3²/2²)=3²/2²=9/4(use law 3)\");\nalert(\"Simplify 3y²×4y-⁴=3×4×y²×y-⁴=12×y-²=12/y².\");\nalert(\"Simplify √x × x-¹=x^½ × x-¹=x^-½=1/x^½=1/√x.\");\nalert(\"Simplify 5^¾×5^¼=5^(¾+¼)=5¹=5.\");\nalert(\"Simplify (7^²)^-¼=7^(2×-¼)=7^-½=1/7^½=1/√7.\");\nalert(\"Lets look at equations with indices.Remember the ultimate goal of solving equations is to end up with the numerical value of the unknown letter.\");\nalert(\"Lets solve x^½=3.We should strive to make the power of x be 1.To do so we square both sides ie (x^½)²=3² and this becomes x¹=9 hence x=9.\");\nalert(\"Lets solve 3x-³=24.Dividing through by 3 this becomes x-³=8.Again we want to make the power of x be 1.To do so we raise both sides to the power of -⅓ ie (x-³)^-⅓=8^-¼.Remember 8=2³ hence the equation can be written as (x-³)^-⅓=(2³)^-⅓ and this becomes x=2-¹ hence x=½.\");\nalert(\"Lets solve 4^x=32.Express each side in index form using the same base ie (2²)^x=2^5.Now equate the powers ie 2x=5 hence x=5/2, x=2½.\");\n}", "function calcularTasaMuerta(id) {\r\n //Obtener el valor de la Amortizacion\r\n var lista1 = document.getElementById(\"amortizacion1\");\r\n var amort_cf1 = lista1.options[lista1.selectedIndex].text;\r\n //Si el usuario ingresa el valor Efectivo anual\r\n if (id == \"EA1\") {\r\n \t\r\n //Si es mensual\r\n if (amort_cf1 == \"Mensual\") {\r\n\t\t\r\n tasa_ip_cf1 = (Math.pow((1 + (parseFloat(document.getElementById(\"tasa_EA_cf1\").value) / 100)), (30 / 360)) - 1) * 100;\r\n tasa_na_cf1 = tasa_ip_cf1 * 12;\r\n tasa_ea_cf1 = (Math.pow((1 + (tasa_ip_cf1 / 100)), (360 / 30)) - 1) * 100;\r\n document.getElementById(\"tasa_Ip_cf1\").value = tasa_ip_cf1.toFixed(2) + \" %\";\r\n document.getElementById(\"tasa_NA_cf1\").value = tasa_na_cf1.toFixed(2) + \" %\";\r\n document.getElementById(\"tasa_EA_cf1\").value = tasa_ea_cf1.toFixed(2) + \" %\";\r\n //alert(document.getElementById(\"tasa_EA_cf1\").value);\r\n \r\n\r\n } else {\r\n //Si es trimestral\r\n tasa_ip_cf1 = (Math.pow((1 + (parseFloat(document.getElementById(\"tasa_EA_cf1\").value) / 100)), (90 / 360)) - 1) * 100;\r\n tasa_na_cf1 = tasa_ip_cf1 * 4;\r\n tasa_ea_cf1 = (Math.pow((1 + (tasa_ip_cf1 / 100)), (360 / 90)) - 1) * 100;\r\n document.getElementById(\"tasa_Ip_cf1\").value = tasa_ip_cf1.toFixed(2) + \" %\";\r\n document.getElementById(\"tasa_NA_cf1\").value = tasa_na_cf1.toFixed(2) + \" %\";\r\n document.getElementById(\"tasa_EA_cf1\").value = tasa_ea_cf1.toFixed(2) + \" %\";\r\n }\r\n }\r\n\r\n if (id == \"NA1\") {\r\n //Si es mensual\r\n if (amort_cf1 == \"Mensual\") {\r\n tasa_ip_cf1 = (parseFloat(document.getElementById(\"tasa_NA_cf1\").value) / 12);\r\n tasa_ea_cf1 = (Math.pow((1 + (tasa_ip_cf1 / 100)), (360 / 30)) - 1) * 100;\r\n tasa_na_cf1 = tasa_ip_cf1 * 12;\r\n document.getElementById(\"tasa_Ip_cf1\").value = tasa_ip_cf1.toFixed(2) + \" %\";\r\n document.getElementById(\"tasa_NA_cf1\").value = tasa_na_cf1.toFixed(2) + \" %\";\r\n document.getElementById(\"tasa_EA_cf1\").value = tasa_ea_cf1.toFixed(2) + \" %\";\r\n } else {\r\n //Si es trimestral\r\n tasa_ip_cf1 = (parseFloat(document.getElementById(\"tasa_NA_cf1\").value) / 4);\r\n tasa_ea_cf1 = (Math.pow((1 + (tasa_ip_cf1 / 100)), (360 / 90)) - 1) * 100;\r\n tasa_na_cf1 = tasa_ip_cf1 * 4;\r\n document.getElementById(\"tasa_Ip_cf1\").value = tasa_ip_cf1.toFixed(2) + \" %\";\r\n document.getElementById(\"tasa_NA_cf1\").value = tasa_na_cf1.toFixed(2) + \" %\";\r\n document.getElementById(\"tasa_EA_cf1\").value = tasa_ea_cf1.toFixed(2) + \" %\";\r\n }\r\n }\r\n\r\n if (id == \"Ip1\") {\r\n //Si es mensual\r\n if (amort_cf1 == \"Mensual\") {\r\n tasa_ea_cf1 = (Math.pow((1 + (parseFloat(document.getElementById(\"tasa_Ip_cf1\").value) / 100)), (360 / 30)) - 1) * 100;\r\n tasa_ip_cf1 = (Math.pow((1 + (tasa_ea_cf1 / 100)), (30 / 360)) - 1) * 100;\r\n tasa_na_cf1 = tasa_ip_cf1 * 12;\r\n document.getElementById(\"tasa_Ip_cf1\").value = tasa_ip_cf1.toFixed(2) + \" %\";\r\n document.getElementById(\"tasa_NA_cf1\").value = tasa_na_cf1.toFixed(2) + \" %\";\r\n document.getElementById(\"tasa_EA_cf1\").value = tasa_ea_cf1.toFixed(2) + \" %\";\r\n } else {\r\n //Si es trimestral\r\n tasa_ea_cf1 = (Math.pow((1 + (parseFloat(document.getElementById(\"tasa_Ip_cf1\").value) / 100)), (360 / 90)) - 1) * 100;\r\n tasa_ip_cf1 = (Math.pow((1 + (tasa_ea_cf1 / 100)), (90 / 360)) - 1) * 100;\r\n tasa_na_cf1 = tasa_ip_cf1 * 4;\r\n document.getElementById(\"tasa_Ip_cf1\").value = tasa_ip_cf1.toFixed(2) + \" %\";\r\n document.getElementById(\"tasa_NA_cf1\").value = tasa_na_cf1.toFixed(2) + \" %\";\r\n document.getElementById(\"tasa_EA_cf1\").value = tasa_ea_cf1.toFixed(2) + \" %\";\r\n }\r\n }\r\n}", "function OdectiTri(x)\n{\n return +x -3;\n}", "function Calculation() {\n }", "function operations(typeOperator) {\n\t\n\tif(typeOperator=='comma' && v!='v'){\n\t\tresText=resText+\".\";\n\t\tv='v';\n\t\tdv=1;\n\t\tanimateButtons('comma');\n\t}else if(typeOperator!='comma'){\n\t\tv='f';\n\t}\n\n\tif(typeOperator==\"sum\"){\n\t\tresText=resText+\"+\";\n\t\tanimateButtons('sum');\t \n\t}else if(typeOperator==\"minus\"){\n\t\tresText=resText+\"-\";\n\t\tanimateButtons('minus');\n\n\n\t}else if(typeOperator==\"times\"){\n\t\tresText=\"ans\"+\"×\";\n\t\tanimateButtons('times');\n\n\n\t}else if(typeOperator==\"divided\"){\n\t\tresText=\"ans\"+\"÷\";\n\t\tanimateButtons('divided');\n\n\t}\n\n\n\tif(typeOperator!='comma'){\n\n\t\tif(prevTypeOperator=='sum'){\n\t\t\tresNum=numberInstMemo+resNum;\n\t\t\tnumberInstMemo=0;\n\n\t\t}else if(prevTypeOperator=='minus'){\n\t\t\tresNum=resNum-numberInstMemo;\n\t\t\tnumberInstMemo=0;\n\n\t\t}else if(prevTypeOperator=='times' && d!=0){\n\t\t\tresNum=resNum*numberInstMemo;\n\t\t\tnumberInstMemo=0; \n\n\t\t}else if(prevTypeOperator=='divided' && d!=0){\n\t\t\tresNum=resNum/numberInstMemo;\n\t\t\tnumberInstMemo=0; \n\n\t\t}\n\n\t\tprevTypeOperator=typeOperator;\n\t\t\n\t}\n\t\n\t\n\tif(typeOperator=='equal'){\n\n\t\tresText='ans';\n\t\tanimateButtons('equal');\n\t\t\n\t}\n\n\tdocument.getElementById(\"resText\").innerHTML = resText;\n\tdocument.getElementById(\"resNum\").innerHTML = resNum;\n\t\n\td=0;\n\n\n}", "function calcCelBtnClicked() {\n\n //Get our input from field\n const tempFahField = document.getElementById(\"tempFah\");\n let tempFah = Number(tempFahField.value);\n //Convert tempFah to Cdegrees using formula to change from tempFah to Cdegrees \n let conversionFC = (tempFah - 32) * 5 / 9;\n //Generate our output \n //tied to our conversionFC\n const CdegreesField = document.getElementById(\"Cdegrees\");\n CdegreesField.value = conversionFC\n\n}", "function ftcclick(){\r\n //define the number\r\n let F = Number(document.getElementById('tif').value);\r\n \r\n //creat the formula\r\n let answerf = 'Temperature in Celsius:' + (F- 32) * 5/9 \r\n\r\n //output\r\n document.getElementById('result').innerHTML = answerf;\r\n}", "function ok2(){ \n if(j-avain2<0){\n \n r=29-avain2+j;\n \n \n }\n else{\n r=(j-avain2);\n \n }\n}", "checkTriangle(x,y,z){\n\t\tlet segmentA = x;\n\t\tlet segmentB = y;\n\t\tlet pointX = z;\n\t\tlet pointA = segmentA.a\n\t\tlet pointB = segmentA.b\n\t\tlet pointC = segmentB.b\n\t\tlet Ax = pointA[0];\n\t\tlet Ay = pointA[1];\n\t\tlet Bx = pointB[0];\n\t\tlet By = pointB[1];\n\t\tlet Cx = pointC[0];\n\t\tlet Cy = pointC[1];\n\t\tlet Xx = pointX[0];\n\t\tlet Xy = pointX[1];\n\t\tlet c = Math.sqrt((Ax-Bx)*(Ax-Bx)+(Ay-By)*(Ay-By))\n\t\tlet a = Math.sqrt((Bx-Cx)*(Bx-Cx)+(By-Cy)*(By-Cy))\n\t\tlet b = Math.sqrt((Ax-Cx)*(Ax-Cx)+(Ay-Cy)*(Ay-Cy))\n\t\tlet xa = Math.sqrt((Xx-Ax)*(Xx-Ax)+(Xy-Ay)*(Xy-Ay))\n\t\tlet xb = Math.sqrt((Xx-Bx)*(Xx-Bx)+(Xy-By)*(Xy-By))\n\t\tlet xc = Math.sqrt((Xx-Cx)*(Xx-Cx)+(Xy-Cy)*(Xy-Cy))\n\t\tlet gamma1 = Math.acos((xa*xa + xb*xb -c*c)/(2*xa*xb))\n\t\tlet gamma2 = Math.acos((xb*xb + xc*xc -a*a)/(2*xb*xc))\n\t\tlet gamma3 = Math.acos((xa*xa + xc*xc -b*b)/(2*xa*xc))\n\t\tlet result = gamma1+gamma2+gamma3\n\t\t//on edge or point will return true\n\t\tif (Math.round((result - Math.PI*2)*1000)){\n\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\treturn true;\n\t\t}\n\t}", "function Espi_calc(Form) {\n t0 = Number(Form.Tower0.value);\n t1 = Number(Form.Tower1.value);\n t2 = Number(Form.Tower2.value);\n t3 = Number(Form.Tower3.value);\n t4 = Number(Form.Tower4.value);\n t5 = Number(Form.Tower5.value);\n if (t0 >= 0 && t1 >= 0 && t2 >= 0 && t3 >= 0 && t4 >= 0 && t5 >= 0 && t0 + t1 + t2 + t3 + t4 + t5 <= 20) {\n a = 16 * t5 + 13 * t4 + 10 * t3 + 6 * t2 + 3 * t1 + t0 + \" men on the walls<BR><BR>\"\n } else {\n a = \"Cannot count the men on the walls<BR><BR>\"\n }\n ok = false;\n for (i = 0; i < 5; i++) {\n if (Form.Walle[i].checked) {\n w = Number(Form.Walle[i].value);\n ok = true\n }\n }\n if (ok) {\n t = 20 * w + 50;\n a = a + 20 * w + \"% wall bonus before tools (maximum you will face is \" + t + \"% per section per wave)<BR>\";\n a = a + \"Send at least \" + Math.round(20 * w / 10) + \" ladders or \" + Math.round(20 * w / 15) + \" siege towers or \" + Math.round(20 * w / 20) + \" belfries in each section.<BR>\";\n a = a + \"But no more than \" + Math.round(t / 10) + \" ladders or \" + Math.round(t / 15) + \" siege towers or \" + Math.round(t / 20) + \" belfries in each section.<BR><BR>\"\n } else {\n a = a + \"Cannot calculate the wall bonus<BR><BR>\"\n }\n g = Number(Form.Gatee.value);\n if (g > 0 && g < 6) {\n t = 20 * g + 75;\n a = a + 20 * g + \"% gate bonus before tools (maximum you will face is \" + t + \"% per section per wave)<BR>\";\n a = a + \"Send at least \" + Math.round(20 * g / 10) + \" battering rams or \" + Math.round(20 * g / 15) + \" iron rams or \" + Math.round(20 * g / 20) + \" heavy rams in each section.<BR>\";\n a = a + \"But no more than \" + Math.round(t / 10) + \" battering rams or \" + Math.round(t / 15) + \" iron rams or \" + Math.round(t / 20) + \" heavy rams in each section.<BR><BR>\"\n } else {\n a = a + \"Cannot calculate the gate bonus<BR><BR>\"\n }\n ok = false;\n for (i = 0; i < 3; i++) {\n if (Form.Moate[i].checked) {\n m = Number(Form.Moate[i].value);\n ok = true\n }\n }\n if (ok) {\n if (m > 0) {\n t = 10 * m + 110;\n } else {\n t = 0;\n }\n a = a + 10 * m + \"% moat bonus before tools (maximum you will face is \" + t + \"% per section per wave)<BR>\";\n a = a + \"Send at least \" + Math.round(10 * m / 5) + \" wood bundles or \" + Math.round(10 * m / 10) + \" assault bridges or \" + Math.round(10 * m / 15) + \" boulders in each section.<BR>\";\n a = a + \"But no more than \" + Math.round(t / 5) + \" wood bundles or \" + Math.round(t / 10) + \" assault bridges or \" + Math.round(t / 15) + \" boulders in each section.<BR><BR>\"\n } else {\n a = a + \"Cannot calculate the moat bonus<BR><BR>\"\n }\n document.getElementById(\"toolsanswer\").innerHTML = a\n}", "function start() {\n// Calls on an instance of the function written below\ntri_loop();\n}", "function triangular(n) {\n \n}", "function resistor_calculate6(){var a_digit_js=document.getElementsByName(\"a_digit\")[0].value;var b_digit_js=document.getElementsByName(\"b_digit\")[0].value;var c_digit_js=document.getElementsByName(\"c_digit\")[0].value;var mult_js=document.getElementsByName(\"mult\")[0].value;var tole_js=document.getElementsByName(\"tole\")[0].value;var temp_js=document.getElementsByName(\"temco\")[0].value;var f=document.getElementById(\"five\");document.getElementById(\"five_div\").style.backgroundColor=f.options[f.selectedIndex].style.backgroundColor;var g=document.getElementById(\"six\");document.getElementById(\"six_div\").style.backgroundColor=g.options[g.selectedIndex].style.backgroundColor;var h=document.getElementById(\"seven\");document.getElementById(\"seven_div\").style.backgroundColor=h.options[h.selectedIndex].style.backgroundColor;var i=document.getElementById(\"eight\");document.getElementById(\"eight_div\").style.backgroundColor=i.options[i.selectedIndex].style.backgroundColor;var j=document.getElementById(\"nine\");document.getElementById(\"nine_div\").style.backgroundColor=j.options[j.selectedIndex].style.backgroundColor;var k=document.getElementById(\"ten\");document.getElementById(\"ten_div\").style.backgroundColor=k.options[k.selectedIndex].style.backgroundColor;var first_three_digit=a_digit_js+b_digit_js+c_digit_js;var total_res=(first_three_digit*mult_js);if(total_res>1000&&total_res<1000000){total_res=(total_res/1000)+' k';}\nelse if(total_res>1000000){total_res=(total_res/1000000)+' M';}\ndocument.getElementsByName('resistance')[0].value=total_res+'\\u03A9';document.getElementsByName('tole_html')[0].value=tole_js;document.getElementsByName('temp_html')[0].value=temp_js+'ppm/\\u2103';}", "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 areaTriangulo(base, altura) {\n return (base * altura) / 2\n}", "function calculateNext(data) {\n \n\t\tvar yinft_t, exptauyt_t, xinft_t, exptauxt_t, ikcoefft_t, rinft_t, exptaurt_t, itoterm1t_t, itoterm2t_t, itoterm3t_t,\n\t\tinacaterm1t_t, inacaterm2t_t, minft_t, exptaumt_t, hinft_t, exptauht_t, dinft_t, exptaudt_t, finft_t, exptauft_t,\n\t\tisicaterm1t_t, isikterm1t_t, isikterm2t_t, pinft_t, exptaupt_t, ik1term1t_t, \n\n\t\tadum, bdum, ena, ek, emh, eca, vmek, yinf, exptauy, ikc, inac, ionc, xinf, exptaux, ikcoeff, ik1term1, rinf, exptaur,\n\t\titoterm1, itoterm2, itoterm3, icac, inacaterm1, inacaterm2, nai3, dum2, dum3, dum4, minf, exptaum, hinf, exptauh, \n\t\tdinf, exptaud, finf, exptauf, tvar, inf, isicaterm1, isikterm1, isikterm2, imk, imna, imca, iion,\n\t\tfactor, derv, pinf, exptaup, iup, itr, irel, dcaup, dcarel, dcai, dna, dk ;\n\n\t\tadum = 0.05 * Math.exp(-0.067 * (cS.v + 42.));\n bdum = (Math.abs(cS.v + 42.) <= 1e-6) ? 2.5 : (cS.v + 42.) / (1.- Math.exp(-0.2 * (cS.v + 42.)));\n cS.tau = adum + bdum;\n yinft_t = adum / cS.tau;\n exptauyt_t = Math.exp(-cS.timestep * cS.tau);\n adum = 0.5 * Math.exp(0.0826 * (cS.v + 50.)) / (1.0 + Math.exp(0.057 * (cS.v + 50.)));\n bdum = 1.3 * Math.exp(-0.06 * (cS.v + 20.)) / (1. + Math.exp(-0.04 * (cS.v + 20.)));\n cS.tau = adum + bdum;\n xinft_t = adum / cS.tau;\n exptauxt_t = Math.exp(-cS.timestep * cS.tau);\n ikcoefft_t = Math.exp(-cS.v * cC.fort);\n adum = 0.033 * Math.exp(-cS.v / 17.);\n bdum = 33. / (1. + Math.exp(-(cS.v + 10.) / 8.));\n cS.tau = adum + bdum;\n rinft_t = adum / cS.tau;\n exptaurt_t = Math.exp(-cS.timestep * cS.tau);\n itoterm1t_t = (Math.abs(cS.v + 10.) <= (10e-6)) ? 5. : (cS.v + 10.) / (1.-Math.exp(-2. * (cS.v + 10.)));\n itoterm2t_t = Math.exp(.02 * cS.v);\n itoterm3t_t = Math.exp(-.02 * cS.v);\n inacaterm1t_t = Math.exp(cS.gamma * cS.v * cC.fort);\n inacaterm2t_t = Math.exp((cS.gamma - 1.) * cS.v * cC.fort);\n adum = (Math.abs(cS.v + 41.) <= 1e-6) ? 2000 : 200. * (cS.v + 41.) / (1.-Math.exp(-0.1 * (cS.v + 41.)));\n bdum = 8000. * Math.exp(-0.056 * (cS.v + 66.));\n cS.tau = adum + bdum;\n minft_t = adum / cS.tau;\n exptaumt_t = Math.exp(-cS.timestep * cS.tau);\n adum = 20. * Math.exp(-0.125 * (cS.v + 75.));\n bdum = 2000. / (1. + 320. * Math.exp(-0.1 * (cS.v + 75.)));\n cS.tau = adum + bdum;\n hinft_t = adum / cS.tau;\n exptauht_t = Math.exp(-cS.timestep * cS.tau);\n if(Math.abs(cS.v + 19.) <= 1e-6){\n adum = 120.;\n bdum = 120.;\n }\n else{\n adum = 30. * (cS.v + 19.) / (1.-Math.exp(-(cS.v + 19.) / 4.));\n bdum = 12. * (cS.v + 19.) / (Math.exp((cS.v + 19.) / 10.)-1.);\n }\n cS.tau = adum + bdum;\n dinft_t = adum / cS.tau;\n exptaudt_t = Math.exp(-cS.timestep * cS.tau);\n adum = (Math.abs((cS.v + 34.)) <= 1e-6) ? 25. : 6.25 * (cS.v + 34.) / (Math.exp((cS.v + 34.) / 4.)-1.);\n bdum = 50. / (1. + Math.exp(-(cS.v + 34.) / 4.));\n cS.tau = adum + bdum;\n finft_t = adum / cS.tau;\n exptauft_t = Math.exp(-cS.timestep * cS.tau);\n isicaterm1t_t = Math.exp(-2. * (cS.v - 50.) * cC.fort);\n isikterm1t_t = (1.- Math.exp(-(cS.v - 50.) * cC.fort));\n isikterm2t_t = Math.exp((50. - cS.v) * cC.fort);\n adum = (Math.abs((cS.v + 34.)) <= 1e-6) ? 2.5 : .625 * (cS.v + 34.) / (Math.exp((cS.v + 34.) / 4.)-1.);\n bdum = 5.0 / (1. + Math.exp(-(cS.v + 34.) / 4.));\n cS.tau = adum + bdum;\n pinft_t = adum / cS.tau;\n exptaupt_t = Math.exp(-cS.timestep * cS.tau);\n\n // compute equilibrium potentials\n\t\t\n\t\tena = cC.rtof * Math.log(cS.nao / cS.nai);\n ek = cC.rtof * Math.log(cS.kc / cS.ki);\n emh = cC.rtof * Math.log((cS.nao + 0.12 * cS.kc) / (cS.nai + 0.12 * cS.ki));\n eca = 0.5 * cC.rtof * Math.log(cS.cao / cS.cai);\n \n vmek = cS.v - ek;\n ik1term1t_t = cS.gk1 * (vmek) / (1. + Math.exp(2. * (vmek + 10.) * cC.fort));\n\t\t\n\t\t// hyperpolarizing-activated current\n yinf = yinft_t;\n exptauy = exptauyt_t;\n cS.y = yinf - (yinf - cS.y) * exptauy;\n\n cS.ifk = cS.y * (cS.kc / (cS.kc + cS.kmf)) * cS.gfk * (cS.v - ek);\n cS.ifna = cS.y * (cS.kc / (cS.kc + cS.kmf)) * cS.gfna * (cS.v - ena);\n// cS.ifk = 0.0\n// cS.ifna = 0.0\n ikc = cS.ifk;\n inac = cS.ifna;\n ionc = cS.ifk + cS.ifna;\n\n// time-dependent (delayed K + current)\n xinf = xinft_t;\n exptaux = exptauxt_t;\n cS.x = xinf - (xinf - cS.x) * exptaux;\n\n ikcoeff = ikcoefft_t;\n cS.ik = cS.x * cS.ikmax * (cS.ki - cS.kc * ikcoeff) / 140.;\n ikc = ikc + cS.ik;\n ionc = ionc + cS.ik;\n\n// time-independent (background) K + current\n ik1term1 = ik1term1t_t;\n cS.ik1 = (cS.kc / (cS.kc + cS.km1)) * ik1term1;\n ikc = ikc + cS.ik1;\n ionc = ionc + cS.ik1;\n\n\t\t// transient outward current\n rinf = rinft_t;\n exptaur = exptaurt_t;\n cS.r = rinf - (rinf - cS.r) * exptaur;\n\n itoterm1 = itoterm1t_t;\n itoterm2 = itoterm2t_t;\n itoterm3 = itoterm3t_t;\n cS.ito = (cS.r * cS.gto * (0.2 + (cS.kc / (cS.kc + cS.kmt))) * (cS.cai / \n (cS.kact + cS.cai)) * itoterm1) * (cS.ki * itoterm2-cS.kc * itoterm3); // gto = 0.28\n ikc = ikc + cS.ito;\n ionc = ionc + cS.ito;\n\t\t \n// background sodium current\n cS.ibna = cS.gbna * (cS.v - ena);\n inac = inac + cS.ibna;\n ionc = ionc + cS.ibna;\n\n// background calcium current\n cS.ibca = cS.gbca * (cS.v - eca);\n icac = cS.ibca;\n ionc = ionc + cS.ibca;\n\n// na-k pump exchange current\n cS.inak = cS.ipmax * (cS.kc / (cS.kmk + cS.kc)) * (cS.nai / (cS.kmna + cS.nai));\n ikc = ikc - 2. * cS.inak;\n inac = inac + 3. * cS.inak;\n ionc = ionc + cS.inak;\n\n// na-ca pump exchange current\n inacaterm1 = inacaterm1t_t;\n inacaterm2 = inacaterm2t_t;\n nai3 = cS.nai * cS.nai * cS.nai;\n dum2 = nai3 * cS.cao * inacaterm1;\n dum3 = cC.nao3 * (cS.cai) * inacaterm2;\n dum4 = 1. + cS.dnaca * ((cS.cai) * cC.nao3 + cS.cao * nai3);\n cS.inaca = cS.knaca * (dum2 - dum3) / dum4;\n inac = inac + 3 * cS.inaca;\n icac = icac - 2. * cS.inaca;\n ionc = ionc + cS.inaca;\n\n// fast sodium current\n minf = minft_t;\n exptaum = exptaumt_t;\n cS.m = minf - (minf - cS.m) * exptaum;\n\n hinf = hinft_t;\n exptauh = exptauht_t;\n cS.h = hinf - (hinf - cS.h) * exptauh;\n\n cS.ina = cS.m * cS.m * cS.m * cS.h * cS.gna * (cS.v - emh);\n inac = inac + cS.ina;\n ionc = ionc + cS.ina; \n\n// fast second inward current (calcium)\n dinf = dinft_t;\n exptaud = exptaudt_t;\n cS.d = dinf - (dinf - cS.d) * exptaud;\n\n finf = finft_t;\n exptauf = exptauft_t;\n cS.f = finf - (finf - cS.f) * exptauf;\n\n adum = 5.;\n bdum = cS.cai * adum / cS.kmf2;\n tvar = adum + bdum;\n inf = adum / (adum + bdum);\n cS.f2 = inf - (inf - cS.f2) * Math.exp(-cS.timestep * tvar);\n\n dum2 = cS.d * cS.f * cS.f2 * (4. * cS.psi * (cS.v - 50.) * cC.fort);\n isicaterm1 = isicaterm1t_t;\n dum3 = (1. - isicaterm1);\n dum4 = cS.cai * cC.exp100fort - cS.cao * isicaterm1;\n cS.isica = dum2 * dum4 / dum3;\n icac = icac + cS.isica;\n ionc = ionc + cS.isica;\n\n// more fast inward current\n isikterm1 = isikterm1t_t;\n isikterm2 = isikterm2t_t;\n dum3 = isikterm1;\n dum4 = cS.ki * cC.exp50fort - cS.kc * isikterm2;\n cS.isik = dum2 * dum4 / (400. * dum3);\n ikc = ikc + cS.isik;\n ionc = ionc + cS.isik;\n\n// total currents used to update each ion concentration\n imk = ikc;\n imna = inac;\n imca = icac;\n\n// convert from nanoamperes to microampers per square cm\n\n// iion = 0.015 * ionc\n\n// derv = -1000. * iion / cm\n\n imna = cS.ifna + cS.ina + 3. * cS.inaca + 3. * cS.inak + cS.ibna;\n imk = cS.ifk + cS.ik + cS.ik1 + cS.ito + cS.isik - 2. * cS.inak;\n imca = cS.isica - 2. * cS.inaca + cS.ibca;\n iion = imna + imk + imca;\n\n\n// stimulus\n// if(ttim * 1000.0.le.1.0) then\n// if(mod(it,icycle).le.istimdur) then\n// if(ttim * 1000.0.le.1.0.or.\n// & (ttim * 1000.0.gt.500.0.and.ttim * 1000.0.le.501.0)) then\n// ionc = ionc-10000.0\n// endif\n// 1750 works, 1800 does not so use 1750 as diast. thresh, 3500 = 2 * \n // if(mod(ntime,icycle).le.istimdur) then\n factor = _s1s2Stimulus(count,data);\n iion = iion - factor;\n imk = imk - factor;\n \n derv = iion / cS.cm;\n\n \n// change in intracellular sodium \n dna = (-imna / (cC.vi * cS.fcon)) * cS.timestep;\n cS.nai = cS.nai + dna;\n\n// change in extracellular potassium\n dk = (-cS.prate * (cS.kc - cS.kb) + imk / (cC.ve * cS.fcon)) * cS.timestep;\n cS.kc = cS.kc + dk;\n\n// change in intracellular potassium\n dk = (-imk / (cC.vi * cS.fcon)) * cS.timestep;\n cS.ki = cS.ki + dk;\n\t\t\n// intracellular calcium handling\n pinf = pinft_t;\n exptaup = exptaupt_t;\n cS.p = pinf - (pinf - cS.p) * exptaup;\n\n iup = cC.aup * cS.cai * (cS.cabarup - cS.caup);\n itr = cC.atr * cS.p * (cS.caup - cS.carel);\n irel = cC.arel * cS.carel * (((cS.cai) * cS.cai) / ((cS.cai) * cS.cai + cS.kmca * cS.kmca));\n\n dcaup = ((iup - itr) / (2. * cC.vup * cS.fcon)) * cS.timestep;\n cS.caup = cS.caup + dcaup;\n\n dcarel = ((itr - irel) / (2. * cC.vrel * cS.fcon)) * cS.timestep;\n cS.carel = cS.carel + dcarel;\n\n dcai = (-(imca + iup - irel) / (2. * cC.vi * cS.fcon)) * cS.timestep;\n cS.cai = cS.cai + dcai;\n\n// update voltage\n cS.v = cS.v - cS.timestep * derv;\n\t\t\n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n \n // iterate the count\n count++;\n return data; \n }", "function trasf_azim_equa(A,AZ,LAT,TSLO){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) giugno 2013\n // A= altezza in gradi sull'orizzonte.\n // AZ= azimut in gradi.\n // LAT= latitudine in gradi.\n // TSLO= Tempo Siderale Locale in ore decimali. \n\n // Calcolo della declinazione dec:\n\nvar dec=Math.sin(Rad(A))*Math.sin(Rad(LAT))+Math.cos(Rad(A))*Math.cos(Rad(LAT))*Math.cos(Rad(AZ));\n dec=Math.asin(dec);\n dec=Rda(dec); // declinazione in gradi sessadecimali.\n\n // Calcolo dell'Angolo orario H in ore:\n\nvar H=(Math.sin(Rad(A))-Math.sin(Rad(LAT))*Math.sin(Rad(dec)))/(Math.cos(Rad(LAT))*Math.cos(Rad(dec)));\n H= Math.acos(H);\n H= Rda(H); // Angolo orario H in gradi.\n\n H=(Math.sin(Rad(AZ))<0) ? (H=H):(H=360-H); // operatore ternario.\n H=H/15;\n\n // angolo orario H in ore.\n\nvar ar=TSLO-H; // Calcolo dell'ascensione retta (ar).\n\n if(ar<0) { ar=ar+24; } // All'interno dell'intervallo 0-24.\n \nvar coord_equa= new Array(dec,ar,H) ; // restituisce 3 valori: declinazione, ascensione retta e angolo orario H.\n\nreturn coord_equa;\n\n// NOTE SUL CALCOLO: \n// L'ascensione retta è misurata in senso opposto all'angolo orario H.\n// Se il seno di AZ(azimut) è negativo (>180°) H=H, se positivo H=360-H\n// Gli angoli (I/O) sono in gradi sessadecimali.\n\n\n}", "function areaTriangulo(base, altura) {\n return (base * altura) / 2;\n}", "function calculation () {\n omega1 = Math.sqrt(G/L); // 1. Eigen-Kreisfrequenz (parallele Schwingung)\n omega2 = Math.sqrt(G/L+2*D/M); // 2. Eigen-Kreisfrequenz (antiparallele Schwingung)\n a1 = (alpha01+alpha02)/2; // Hilfsgröße \n a2 = (alpha01-alpha02)/2; // Hilfsgröße\n }", "function perimetroTiangulo(lado1,lado2,base) { \n return lado1+lado2+base; \n }", "function DiametroCirculo (radio){ return radio*2;}", "function sumar() {\n num1 = obtenerResultado();\n operacion = \"+\";\n limpiar();\n}", "function trasf_ecli_equa(njd,long,lat){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) dicembre 2009\n // funzione per trasformare le coordinate eclittiche in equatoriali.\n // long e lat: coordinate ecclittiche dell'astro in gradi sessadecimali.\n // njd=numero del giorno giuliano.\n\nvar obli_eclittica=obli_ecli(njd);\n obli_eclittica=obli_eclittica/180*Math.PI; \n \nlong=long/180*Math.PI;\n lat= lat/180*Math.PI;\n\nvar y=Math.sin(long)*Math.cos(obli_eclittica)-Math.tan(lat)*Math.sin(obli_eclittica);\nvar x=Math.cos(long);\n\nvar ascensione_retta=quadrante(y,x)/15;\n\nvar declinazione=Math.sin(lat)*Math.cos(obli_eclittica)+Math.cos(lat)*Math.sin(obli_eclittica)*Math.sin(long);\n declinazione=Math.asin(declinazione);\n declinazione=declinazione*180/Math.PI;\n\nvar coord_equa= new Array(ascensione_retta,declinazione) ; // restituisce le variabili AR e DEC .\n\nreturn coord_equa;\n\n}", "function mesurementsTri(base, height) {\n return base * height;\n}", "function trigOp(){\n\tif (!this.classList.contains(\"disabled\")){\n\t\tevaluate();\n\t\tvar inputScreen = document.querySelector('.screen');\n\t\tvar value = inputScreen.innerHTML;\n\t\tif(this.innerHTML.contains(\"sin\")){\n\t\t\tinputScreen.innerHTML = Math.sin(value);\n\t\t}\n\t\telse if(this.innerHTML.contains(\"cos\")){\n\t\t\tinputScreen.innerHTML = Math.cos(value);\n\t\t}\n\t\telse if(this.innerHTML.contains(\"tan\")){\n\t\t\tinputScreen.innerHTML = Math.tan(value);\n\t\t}\n\t\tstartNew = true;\n\t\tif (inputScreen.innerHTML.contains(\".\")){\n\t\t\tdecimalBool = false;\n\t\t\tfactorialBool = false;\n\t\t\tdocument.getElementById(\"deci\").classList.add(\"disabled\");\n\t\t\tdocument.getElementById(\"factorial\").classList.add(\"disabled\");\n\t\t}\n\t}\t\n}", "function f_g(x) { //Вычисление нужной функции\n //window.alert(document.getElementById('a_1').value);\n //window.alert(Math.sin(document.getElementById('b_1').value * Math.PI * document.getElementById('c_1').value * x))\n //window.alert(document.getElementById('a_1').value * Math.sin(document.getElementById('b_1').value * Math.PI * document.getElementById('c_1').value));\n var x_t;\n if (x == document.getElementById('c_1').value) {\n x_t = document.getElementById('a_1').value;\n } else if (x == document.getElementById('c_2').value) {\n x_t = document.getElementById('a_2').value;\n } else {\n x_t = 0;\n }\n return x_t;\n // switch (x) {\n\n // case (document.getElementById('a_1').value):\n // window.alert(\"Прошло\");\n // return document.getElementById('c_1').value;\n // break;\n\n // case (document.getElementById('a_2').value):\n // return document.getElementById('c_2').value;\n // break;\n // default:\n // return 0;\n // break;\n\n}", "function triangle(a, b) {\n\n}", "function fl_outToLevivot ()\n\t\t{if(freez==\"false\"){\n\t\t\tconsole.log(\"hit\")\n\t\t\tthis.rimon.alpha=1\n\t\t\tthis.sufgania.alpha=1\n\t\t\tthis.selek.alpha=1\n\t\t\tthis.tamar.alpha=1\n\t\t\tthis.karpas.alpha=1\n\t\t\tthis.haroset.alpha=1\n\t\t\tthis.maza.alpha=1\n\t\t\tthis.hasa.alpha=1\n\t\t\tthis.beiza.alpha=1\n\t\t\tthis.hazeret.alpha=1\n\t\t\tthis.mamtak.alpha=1\n\t\t\tthis.gvina.alpha=1\n\t\t\tthis.oznei_aman.alpha=1\n\t\t\tthis.dvash.alpha=1\n\t\t\tthis.dag.alpha=1\n\t\t\tthis.sumsum.alpha=1\n\t\t\tthis.perot.alpha=1\n\t\t\tthis.mishloah.alpha=1\n\t\t\tthis.of.alpha=1\n\t\t this.tu_btn.alpha=1\n\t\t this.purim_btn.alpha=1\n\t\t this.pesach_btn.alpha=1\n\t\t this.shavuot_btn.alpha=1\n\t\t this.rosh_ha_shana_btn.alpha=1\n\t\t this.modern_btn.alpha=1\n\t\t\t\t\t this.arrow_btn.alpha=0\n\t\tthis.arrowAside_mc.alpha=0\n\t\tthis.gvina_explain.alpha=0\n\t\tthis.mishloah_explain.alpha=0\n\t\tthis.sufgania_explain.alpha=0\n\t\tthis.perot_explain.alpha=0\n\t\tthis.tapuah_explain.alpha=0\n\t\tthis.maza_explain.alpha=0\n\t\t\n\t\t}}", "function runMath() {\n console.log(\n input_diameter1.value, input_diameter1.flag + \"\\n\",\n input_diameter2.value, input_diameter2.flag + \"\\n\",\n input_lateral.value, input_lateral.flag\n ) \n if(input_diameter1.flag && input_diameter2.flag && input_lateral.flag) {\n // frustumMath(),\n mockMath(); \n } \n else console.log(\"fnx: runMath Failed\");\n }", "function calculateNext(data) {\n\n var alpham, betam, alphah, betah, alphaj, betaj, alphaoa,\n betaoa, alphaoi, betaoi, alphaua, betaua, alphaui, betaui, alphaxr, betaxr, alphaxs, betaxs,\n temp, xnaca11, xnaca21;\n\n var exptaum_t, xinfm_t, exptauh_t, xinfh_t, exptauj_t, xinfj_t, \n xk1t_t, exptauoa_t, xinfoa_t, exptauoi_t, xinfoi_t, exptauua_t, xinfua_t, exptauui_t, xinfui_t, xkurcoeff_t, xkrcoeff_t, \n exptaud_t, xinfd_t, exptauf_t, xinff_t, xnakt_t, xnaca1_t, \n xnaca2_t, exptauw_t, xinfw_t;\n\n /* moved to settings as previous value required \n exptauxr_t, xinfxr_t, exptauxs_t, xinfxs_t*/\n\n var xinffca_t , xpcat_t, ecat_t, xupt_t, carow2_t;\n\n var xinfut_t, exptauvt_t, xinfvt_t; \n\n var xstim, eca, xinfm1, exptaum1, xinfh1, exptauh1, xinfj1, exptauj1,\n xinfoa1, exptauoa1, xinfoi1, exptauoi1,\n xinfua1, exptauua1, xinfui1, exptauui1, xkurcoeff1,\n xinfxr1, exptauxr1, xkrcoeff1,\n xinfxs1, exptauxs1,\n xinfd1, exptaud1, xinff1, exptauf1, xinffca1,\n xinfu, exptauv, xinfv, xinfw1, exptauw1,\n xtr, xup, xupleak,\n di_ups, carow21; \n\n //calculations start\n //\n\n alpham = (Math.abs( cS.v + 47.13) < 1e-5) ? 3.2 : 0.32 * ( cS.v + 47.13 )/( 1.- Math.exp(-0.1*( cS.v + 47.13 ) ) );\n\n betam = 0.08 * Math.exp (- cS.v /11.);\n\n alphah = ( cS.v > -40.0 ) ? 0.0 : 0.135 * Math.exp(-( cS.v+80.0)/6.8); \n\n betah = ( cS.v > -40.0 ) ? 1.0/ (0.13 * (1.0 + Math.exp (-( cS.v + 10.66)/11.1))) \n : 3.56 * Math.exp ( 0.079 * cS.v ) + 3.1e5 * Math.exp(0.35 * cS.v); \n\n alphaj = ( cS.v > -40.0 ) ? 0.0 \n : (-127140 * Math.exp(0.2444 * cS.v)-3.474e-5 * Math.exp(-0.04391 * cS.v)) * ( cS.v + 37.78)/(1. + Math.exp (0.311 * ( cS.v + 79.23))); \n\n betaj = ( cS.v > -40.0 ) ? 0.3 * Math.exp(-2.535e-7 * cS.v)/(1.+Math.exp(-0.1 * ( cS.v+32.))) \n : 0.1212 * Math.exp(-0.01052 * cS.v)/(1.+Math.exp(-0.1378 * ( cS.v+40.14))); \n\n alphaoa = 0.65 / ( Math.exp ( - ( cS.v + 10. ) / 8.5 ) + Math.exp ( - ( cS.v-30. ) / 59. ) ); \n\n betaoa = 0.65 / ( 2.5 + Math.exp ( ( cS.v + 82. ) / 17. ) );\n\n alphaoi = 1.0 / ( 18.53 + Math.exp ( ( cS.v + 113.7 ) / 10.95 ) );\n\n betaoi = 1.0 / ( 35.56 + Math.exp ( - ( cS.v + 1.26 ) / 7.44 ) ); \n\n alphaua = 0.65 / ( Math.exp ( - ( cS.v + 10. ) / 8.5 ) + Math.exp ( - ( cS.v-30. ) / 59. ) ); \n\n betaua = 0.65 / ( 2.5 + Math.exp ( ( cS.v + 82. ) / 17. ) ); \n\n alphaui = 1.0 / ( 21. + Math.exp ( - ( cS.v-185. ) / 28. ) ) ; \n\n betaui = Math.exp ( ( cS.v-158. ) / 16. ); \n\n alphaxr = 0.0003* ( cS.v + 14.1 ) / ( 1.- Math.exp ( - ( cS.v + 14.1 ) / 5. ) ); \n\n betaxr = 7.3898e-5* ( cS.v-3.3328 ) / ( Math.exp ( ( cS.v-3.3328 ) / 5.1237 ) -1. ); \n\n alphaxs = 4e-5* ( cS.v-19.9 ) / ( 1.- Math.exp ( - ( cS.v-19.9 ) / 17. ) ); \n\n betaxs = 3.5e-5* ( cS.v-19.9 ) / ( Math.exp ( ( cS.v-19.9 ) / 9. ) -1. );\n\n //table variables depending on V\n\n exptaum_t = Math.exp(- cS.timestep*(alpham+betam));\n\n xinfm_t = alpham/(alpham+betam);\n\n exptauh_t = Math.exp(- cS.timestep*(alphah+betah));\n\n xinfh_t = alphah/(alphah+betah);\n\n exptauj_t = Math.exp(- cS.timestep*(alphaj+betaj));\n\n xinfj_t = alphaj/(alphaj+betaj);\n\n xk1t_t = cS.gk1*( cS.v- cC.ek)/(1.+Math.exp(0.07*( cS.v + 80.)));\n\n exptauoa_t = Math.exp(- cS.timestep*((alphaoa+betaoa)* cS.xkq10));\n\n xinfoa_t = 1.0/(1.+Math.exp(-( cS.v+20.47)/17.54));\n\n exptauoi_t = Math.exp(- cS.timestep*((alphaoi+betaoi)* cS.xkq10));\n\n xinfoi_t = 1.0/(1.+Math.exp(( cS.v+43.1)/5.3));\n\n exptauua_t = Math.exp(- cS.timestep*((alphaua+betaua)* cS.xkq10));\n\n xinfua_t = 1.0/(1.+Math.exp(-( cS.v+30.3)/9.6));\n\n exptauui_t = Math.exp(- cS.timestep*((alphaui+betaui)* cS.xkq10));\n\n xinfui_t = 1.0/(1.+Math.exp(( cS.v-99.45)/27.48));\n\n xkurcoeff_t = (0.005+0.05/(1.+Math.exp(-( cS.v-15.)/13.)))*( cS.v- cC.ek);\n\n\n if(!((Math.abs( cS.v+14.1) < 1e-5) || (Math.abs( cS.v-3.3328)<1e-5))){\n cS.exptauxr_t = Math.exp(- cS.timestep*(alphaxr+betaxr));\n cS.xinfxr_t = 1.0/(1.+Math.exp(-( cS.v+14.1)/6.5));\n }\n\n xkrcoeff_t = cS.gkr*( cS.v- cC.ek)/(1.+Math.exp(( cS.v+15.)/22.4));\n\n if(!(Math.abs( cS.v-19.9) < 1e-5)){\n cS.exptauxs_t = Math.exp(- cS.timestep/0.5*(alphaxs+betaxs));\n cS.xinfxs_t = 1.0/Math.sqrt(1.+Math.exp(-( cS.v-19.9)/12.7));\n }\n\n //temp varaible used for calculations\n temp = (1.0-Math.exp(-( cS.v+10.)/6.24))/(0.035*( cS.v+10.)* (1.+Math.exp(-( cS.v+10.)/6.24)));\n\n if(Math.abs( cS.v+10) < 1e-5){\n exptaud_t = 2.2894;\n exptauf_t = 0.9997795;\n }\n else{\n exptaud_t = Math.exp(- cS.timestep/temp); \n exptauf_t = Math.exp(- cS.timestep/9.*(0.0197*Math.exp(Math.pow(-(0.0337 *( cS.v+10.)), 2))+0.02));\n }\n\n xinfd_t = 1.0/(1.+Math.exp(-( cS.v+10.)/8.));\n\n xinff_t = 1.0/(1.+Math.exp(( cS.v+28.)/6.9));\n\n xnakt_t = (1.0/(1.+0.1245*Math.exp(-0.1* cS.v/ cC.rtof)+0.0365* cC.sigma*Math.exp(- cS.v/ cC.rtof)))* cS.xinakmax/(1.+(Math.pow(( cS.xkmnai/ cS.cnai),1.5)))*( cS.cko/( cS.cko+ cS.xkmko));\n\n xnaca1_t = cS.xinacamax*Math.exp( cS.gamma* cS.v/ cC.rtof)*(Math.pow( cS.cnai,3))* cS.ccao/((Math.pow( cS.xkmna,3)+ Math.pow( cS.cnao,3))*( cS.xkmca+ cS.ccao)*(1.+ cS.xksat*Math.exp(( cS.gamma-1.)* cS.v/ cC.rtof)));\n\n xnaca2_t = cS.xinacamax*Math.exp(( cS.gamma-1.)* cS.v/ cC.rtof)/((Math.pow( cS.xkmna,3) + Math.pow( cS.cnao,3))*( cS.xkmca+ cS.ccao)*(1.+ cS.xksat*Math.exp(( cS.gamma-1.)* cS.v/ cC.rtof))); \n\n temp = 6.0*(1.-Math.exp(-( cS.v-7.9)/5.))/((1.+0.3*Math.exp(-( cS.v-7.9)/5.))*( cS.v-7.9)); \n\n exptauw_t = Math.exp(- cS.timestep/temp);\n\n xinfw_t = 1.0-1.0/(1.+Math.exp(-( cS.v-40.)/17.));\n\n //table variables depending on ca\n\n xinffca_t = 1.0/(1.+ cS.ccai/0.00035);\n xpcat_t = cS.xipcamax* cS.ccai/(0.0005+ cS.ccai);\n ecat_t = cC.rtof*0.5*Math.log( cS.ccao/ cS.ccai);\n xupt_t = cS.xupmax/(1.+ cS.xkup/ cS.ccai);\n carow2_t = ( cS.trpnmax* cS.xkmtrpn/( cS.ccai+ cS.xkmtrpn)/( cS.ccai+ cS.xkmtrpn) + cS.cmdnmax* cS.xkmcmdn/( cS.ccai+ cS.xkmcmdn)/( cS.ccai+ cS.xkmcmdn)+1.)/ cC.c_b1c;\n\n //table variables depending on fn\n /* fnlo=-0.2,fnhi=2.3,nfnt=2500\n dfntable=(fnhi-fnlo)/float(nfnt)\n fn=fnlo+i*dfntable\n */\n xinfut_t = 1.0/(1.+ Math.exp(-( cS.fn/13.67e-4-250.0)));\n\n temp = 1.91+2.09/(1.+ Math.exp(-( cS.fn/13.67e-4-250.0)));\n\n exptauvt_t = Math.exp(- cS.timestep/temp);\n\n xinfvt_t = 1.-1.0/(1.+ Math.exp(-( cS.fn-6.835e-14)/13.67e-16));\n\n\n // table loop starts here\n\n xstim = _s1s2Stimulus(count, data);\n\n //c equilibrium potentials\n eca = ecat_t;\n\n //c fast sodium current\n xinfm1 = xinfm_t;\n exptaum1 = exptaum_t;\n xinfh1 = xinfh_t;\n exptauh1 = exptauh_t;\n xinfj1 = xinfj_t;\n exptauj1 = exptauj_t;\n\n cS.xm = xinfm1 + ( cS.xm - xinfm1) * exptaum1;\n cS.xh = xinfh1 + ( cS.xh - xinfh1) * exptauh1;\n cS.xj = xinfj1 + ( cS.xj - xinfj1) * exptauj1; \n cS.xna = cS.xm * cS.xm * cS.xm * cS.xh * cS.xj * cS.gna *( cS.v - cC.ena);\n\n //c time-independent k+ current\n cS.xk1 = xk1t_t;\n\n //c transient outward k+ current\n xinfoa1 = xinfoa_t;\n exptauoa1 = exptauoa_t;\n xinfoi1 = xinfoi_t;\n exptauoi1 = exptauoi_t;\n\n cS.xoa = xinfoa1+( cS.xoa-xinfoa1)*exptauoa1;\n cS.xoi = xinfoi1+( cS.xoi-xinfoi1)*exptauoi1;\n cS.xto = cS.xoa* cS.xoa* cS.xoa* cS.xoi* cS.gto*( cS.v - cC.ek);\n\n //c ultrarapid delayed rectifier k+ current\n xinfua1 = xinfua_t;\n exptauua1 = exptauua_t;\n xinfui1 = xinfui_t;\n exptauui1 = exptauui_t;\n xkurcoeff1= xkurcoeff_t;\n\n cS.xua = xinfua1+( cS.xua-xinfua1)*exptauua1;\n cS.xui = xinfui1+( cS.xui-xinfui1)*exptauui1;\n cS.xkur = cS.xua* cS.xua* cS.xua* cS.xui*xkurcoeff1;\n\n //c rapid delayed outward rectifier k+ current\n xinfxr1 = cS.xinfxr_t;\n exptauxr1 = cS.exptauxr_t;\n xkrcoeff1 = xkrcoeff_t;\n\n cS.xr = xinfxr1+( cS.xr-xinfxr1)*exptauxr1;\n cS.xkr = cS.xr*xkrcoeff1;\n\n //c slow delayed outward rectifier k+ current\n xinfxs1 = cS.xinfxs_t;\n exptauxs1 = cS.exptauxs_t;\n\n cS.xs = xinfxs1+( cS.xs-xinfxs1)*exptauxs1;\n cS.xks = cS.xs* cS.xs* cS.gks*( cS.v- cC.ek);\n\n //c L-tpe ca2+ current\n xinfd1 = xinfd_t;\n exptaud1 = exptaud_t;\n xinff1 = xinff_t;\n exptauf1 = exptauf_t;\n xinffca1 = xinffca_t;\n\n cS.xd = xinfd1+( cS.xd-xinfd1)*exptaud1;\n cS.xf = xinff1+( cS.xf-xinff1)*exptauf1;\n cS.xfca = xinffca1+( cS.xfca-xinffca1)* cC.exptaufca;\n cS.xcal = cS.xd* cS.xf* cS.xfca* cS.gcal*( cS.v-65.0);\n\n //xnak, xnaca, xbca, xbna, xpca; \n\n //cc na+/k+ pump current\n cS.xnak = xnakt_t;\n\n //c na+/ca2+ exchanger current\n xnaca11 = xnaca1_t;\n xnaca21 = xnaca2_t;\n cS.xnaca = xnaca11 - xnaca21* cC.cnao3* cS.ccai;\n\n //cc background currents\n cS.xbca = cS.gbca * ( cS.v - eca);\n\n cS.xbna = cS.gbna * ( cS.v - cC.ena);\n\n //c ca2+ pump current\n cS.xpca = xpcat_t;\n\n /*c ca2+ release current from JSR\n c correction: divide first fn term by cm, multiply second fn term by cm\n c then to ensure computational accuracy (no problems with tiny numbers),\n c divide fn by 1e-12 and adjust functions accordingly*/\n cS.xrel = cS.xkrel* cS.xu* cS.xu* cS.xv* cS.xw*( cS.ccarel- cS.ccai);\n\n cS.fn = cS.vrel/ cS.cm* cS.xrel-0.5 * cS.cm/ cS.xxf*(0.5* cS.xcal-0.2* cS.xnaca);\n\n xinfu = xinfut_t;\n exptauv = exptauvt_t;\n xinfv = xinfvt_t;\n\n cS.xu = xinfu+( cS.xu-xinfu)* cC.exptauu;\n cS.xv = xinfv+( cS.xv-xinfv)*exptauv;\n\n xinfw1 = xinfw_t;\n exptauw1 = exptauw_t;\n\n cS.xw = xinfw1+( cS.xw-xinfw1)*exptauw1;\n cS.xrel = cS.xkrel* cS.xu* cS.xu* cS.xv* cS.xw*( cS.ccarel - cS.ccai);\n\n // c transfer current from NSR to JSR\n xtr = ( cS.ccaup - cS.ccarel)/ cS.tautr;\n\n // c ca2+ uptake current by the NSR\n xup = xupt_t;\n\n // c ca2+ leak current by the NSR\n xupleak = cS.ccaup* cS.xupmax/ cS.ccaupmax;\n\n //c intracellular ion concentrations\n di_ups = xup-xupleak;\n carow21 = carow2_t;\n cS.ccai = cS.ccai + cS.timestep * ( cC.c_b1d*( cS.xnaca + cS.xnaca - cS.xpca - cS.xcal - cS.xbca)- cC.c_b1e* di_ups + cS.xrel) / carow21; \n cS.ccaup = cS.ccaup + cS.timestep * (xup - xupleak-xtr*( cS.vrel/ cS.vup));\n cS.ccarel = cS.ccarel + cS.timestep * ((xtr - cS.xrel)/ (1.+( cS.csqnmax* cS.xkmcsqn)/(Math.pow(( cS.ccarel+ cS.xkmcsqn),2))));\n\n //console.log( cS.xna , cS.xk1 , + cS.xkur + cS.xto , cS.xkur , cS.xkr , cS.xks , cS.xcal , cS.xpca , cS.xnak, cS.xnaca, cS.xbna, cS.xbca-xstim);\n \n cS.v = cS.v - cS.timestep * ( cS.xna + cS.xk1 + cS.xto + cS.xkur + cS.xkr + cS.xks + cS.xcal + cS.xpca + cS.xnak + cS.xnaca + cS.xbna + cS.xbca - xstim);\n\n // table loop ends\n\n //cal ends\n // sets voltage variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.voltageVariables);\n \n // sets current variables after calculations\n utils.copySpecific(data.calculationSettings, cS, data.calculationSettings.currentVariables);\n\n // iterate the count\n count++;\n\n return data; \n }", "function pazymiuVidurkis(q,w,e,r,t) {\n var atsakymas = (q+w+e+r+t)/5;\n console.log(atsakymas);\n}", "function t3(){\n return dataArray[1][1]-dataArray[0][1];\n }", "function parametrossubbase() {\n var propbs = parseFloat($('#subbase-crc').val());\n var txtbs = $('#subbase-crc-td').text();\n\n if ((txtbs == \"CBR (%)\")) {\n if ((20 <= propbs) && (propbs <= 100)) {\n var rescbrmrbs = 1000 * polino8(15.0144902782049, 0.421429863898084, 0.0211445860477397, -0.00331487108633155, 0.000170131204924928, -0.00000440480956598321, 0.0000000615888041954893, -0.000000000444189750519602, 0.00000000000129840756710479, (propbs - 20))\n $(\"#subbaseMb\").val(rescbrmrbs.toFixed(2));\n $(\"#moduloresilientesubbase\").val(rescbrmrbs.toFixed(2));\n\n var rescbra2 = polino8(0.0698548909351757, 0.0031653059436394, -0.0000897195214406565, 0.00000178076124512927, -0.000000046953998467103, 0.00000000166266209827848, -0.0000000000343305394962662, 0.000000000000333592074591108, -0.0000000000000012176024699921, (propbs - 20))\n\n $(\"#subbasea2\").val(rescbra2.toFixed(3));\n loadGraph1();\n } else {\n $(\"#subbasea2\").val(\"\");\n $(\"#subbaseMb\").val(\"\");\n $(\"#subbase-crc\").val(\"\");\n alert(\"Valores de CBR entre 20 y 100 \");\n $(\"#moduloresilientesubbase\").val(\"\");\n }\n } else {\n if (txtbs == \"Valor-R\") {\n if ((50 <= propbs) && (propbs <= 85)) {\n var resvalrmrbs = 1000 * polino8(12.876417073363, 0.452196090715006, 0.0438440511934459, -0.00982612217194401, 0.000953206104895798, -0.0000526129201716685, 0.00000172642111806454, -0.0000000308742024168751, 0.000000000228477521190679, (propbs - 50))\n $(\"#subbaseMb\").val(resvalrmrbs.toFixed(2));\n $(\"#moduloresilientesubbase\").val(resvalrmrbs.toFixed(2));\n\n var resvalra2 = polino8(0.06046657944853, 0.00275476893784798, -0.000224124892611144, 0.0000661248425330996, -0.00000888859659653463, 0.000000608835710735889, -0.0000000223505547680691, 0.000000000419895487737548, -0.00000000000317369061261265, (propbs - 50))\n $(\"#subbasea2\").val(resvalra2.toFixed(3));\n loadGraph1();\n\n\n\n } else {\n $(\"#subbasea2\").val(\"\");\n $(\"#subbaseMb\").val(\"\");\n $(\"#subbase-crc\").val(\"\");\n alert(\"Valores de Valor-R entre 50 y 85 \");\n $(\"#moduloresilientesubbase\").val(\"\");\n }\n } else {\n if (txtbs == \"Triaxial de Texas\") {\n if ((2 <= propbs) && (propbs <= 4)) {\n var resttmrbs = 1000 * polino8(29.9622841116288, -13.6547539439052, -30.630188755691, 67.4826082289218, -4.39456802606582, -88.4573996663093, 89.4939237236976, -35.859985306859, 5.2930134255439, (propbs - 2))\n $(\"#subbaseMb\").val(resttmrbs.toFixed(2));\n $(\"#moduloresilientesubbase\").val(resttmrbs.toFixed(2));\n\n var restta2 = polino8(0.139504007016455, -0.0531663438887335, -0.118171937589068, 0.251250937348232, -0.0413149250671268, -0.258826182223856, 0.263710435247049, -0.10423649509903, 0.0152032711630454, (propbs - 2))\n $(\"#subbasea2\").val(restta2.toFixed(3));\n loadGraph1();\n\n\n\n } else {\n $(\"#subbasea2\").val(\"\");\n $(\"#subbaseMb\").val(\"\");\n $(\"#subbase-crc\").val(\"\");\n alert(\"Valores de Triaxial de Texas entre 2 y 4 \");\n $(\"#moduloresilientesubbase\").val(\"\");\n }\n\n } else {\n if (txtbs == \"Resistencia a la compresión no confinada\") {\n if ((200 <= propbs) && (propbs <= 1000)) {\n var resttmrbs = 100000 * polino8(5.21255219106388, 0.0054930539427005, -0.00004386513882082, 0.000000423866207022172, -0.00000000198679762745957, 0.00000000000507781747964391, -0.00000000000000713278280941073, 0.00000000000000000516842980835603, -0.00000000000000000000151039997429519, (propbs - 200))\n $(\"#subbaseMb\").val(resttmrbs.toFixed(2));\n $(\"#moduloresilientesubbase\").val(resttmrbs.toFixed(2));\n loadGraph2();\n\n var restta2 = polino8(0.126514423821391, 0.000119014438496379, 0.000000424778811236592, -0.00000000422194143534504, 0.000000000022355322508525, -0.0000000000000606037341739917, 0.0000000000000000874838801389102, -0.000000000000000000064637475936388, 0.000000000000000000000019323613498538, (propbs - 200))\n $(\"#subbasea2\").val(restta2.toFixed(3));\n\n\n\n } else {\n $(\"#subbasea2\").val(\"\");\n $(\"#subbaseMb\").val(\"\");\n $(\"#subbase-crc\").val(\"\");\n alert(\"Valores de Resistencia a la compresión no confinada entre 200 y 1000 \");\n $(\"#moduloresilientesubbase\").val(\"\");\n }\n\n } else {\n if (txtbs == \"Estabilidad de Marshall\") {\n if (((198.630256174412 <= propbs) && (propbs <= 1627.5568227323))) {\n var resttmrbs = 100000 * polino8(0.988304102334951, 0.00190091137710624, -0.000000695682100371187, -0.0000000263621080243137, 0.000000000111298716445364, -0.000000000000187423344516066, 0.000000000000000157695777240304, -0.0000000000000000000657330932932133, 0.0000000000000000000000108097433396437, (propbs - 198.630256174412))\n $(\"#subbaseMb\").val(resttmrbs.toFixed(2));\n $(\"#moduloresilientesubbase\").val(resttmrbs.toFixed(2));\n\n var restta2 = polino8(0.0692971293919982, 0.000207646355050883, 0.00000107767479518017, -0.00000000585385907109215, 0.0000000000124823124011714, -0.0000000000000139533965428724, 0.00000000000000000860481136885206, -0.00000000000000000000276939918568093, 0.000000000000000000000000363160776892116, (propbs))\n $(\"#subbasea2\").val(restta2.toFixed(3));\n\n loadGraph3();\n } else {\n $(\"#subbaseMb\").val(\"\");\n $(\"#moduloresilientesubbase\").val(\"\");\n $(\"#subbase-crc\").val(\"\");\n $(\"#subbasea2\").val(\"\");\n alert(\"Valores de Estabilidad de Marshall entre 198.6 y 1627.56\");\n\n }\n\n } else {}\n }\n }\n }\n }\n}", "function result() {\r\n\r\n \tlet entry1 = '';\r\n \t\r\n\r\n \tswitch (operation) {\r\n \t\tcase 1 : \r\n \t\tentry1 = `${operande} + ${output.value} = `\r\n \t\toutput.value = parseFloat(operande) + parseFloat(output.value);\r\n \t\tentry1 += output.value\r\n \t\tbreak;\r\n\r\n \t\tcase 2 : \r\n \t\tentry1 = `${operande} - ${output.value} = `\r\n \t\toutput.value = operande - output.value;\r\n \t\tentry1 += output.value\r\n \t\tbreak;\r\n\r\n \t\tcase 3 :\r\n \t\tentry1 = `${operande} * ${output.value} = ` \r\n \t\toutput.value = operande * output.value;\r\n \t\tentry1 += output.value\r\n \t\tbreak;\r\n\r\n \t\tcase 4 : \r\n \t\tentry1 = `${operande} / ${output.value} = `\r\n \t\toutput.value = operande / output.value;\r\n \t\tentry1 += output.value\r\n \t\tbreak;\r\n\r\n \t}\r\n\t\r\n\toutput_history.innerHTML = `<li>${history}</li>`;\r\n\thistory.push(entry1);\r\n \tdisplayHistory(history);\r\n\r\n \toutput.value = 0;\r\n \toperande = 0;\r\n\r\n }", "function down(_la){\n if((_la.my+_la.sp)<_la.ry){\n return _la.my + _la.sp;\n }else{\n if(_la.update_quadrant)\n qx--;\n return 0;\n }\n}" ]
[ "0.67896724", "0.6066422", "0.5990961", "0.5982269", "0.5970163", "0.5962472", "0.59592146", "0.592468", "0.5872448", "0.58453625", "0.5842195", "0.5775033", "0.5765286", "0.5762532", "0.57622886", "0.57548684", "0.57235354", "0.5721751", "0.57157576", "0.570762", "0.569522", "0.56859654", "0.5653393", "0.56154275", "0.5613775", "0.56111664", "0.5606514", "0.5597223", "0.55617017", "0.5530274", "0.5523096", "0.5509057", "0.5506134", "0.5496058", "0.5488017", "0.54852915", "0.5483414", "0.54809797", "0.54715806", "0.54679966", "0.5467027", "0.545198", "0.5450282", "0.5448035", "0.54451174", "0.5442422", "0.5441495", "0.54410976", "0.543764", "0.5435338", "0.53982866", "0.53982437", "0.5385921", "0.5367455", "0.536736", "0.5367262", "0.5365739", "0.53531545", "0.5352162", "0.5351519", "0.5350827", "0.5328879", "0.53287435", "0.5327867", "0.53276235", "0.53244907", "0.5323035", "0.5303751", "0.53031737", "0.53001773", "0.529991", "0.5299319", "0.5292769", "0.5291794", "0.5291361", "0.529054", "0.52892995", "0.5284125", "0.5282118", "0.5277651", "0.5265613", "0.5262799", "0.52598447", "0.5256595", "0.5256441", "0.5256252", "0.52557325", "0.52552384", "0.5250167", "0.52496606", "0.52459794", "0.52426267", "0.52060217", "0.52010375", "0.51989526", "0.5181835", "0.51803106", "0.5177241", "0.5175976", "0.5173636", "0.51734185" ]
0.0
-1
this function specifies the positions of bend points
bendPositionsFunction(ele) { return ele.data('bendPointPositions'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "bpos()\n\t{\n\t\treturn [this.x + DIRS[this.dir][0], this.y + DIRS[this.dir][1]];\n\t}", "function Bezier(startPt, endPt, startCtrlPt, endCtrlPt) {\n\tvar b;\n\tb.startPoint=startPt;\n\tb.endPoint=endPt;\n\tb.startControlPoint = startCtrlPt;\n\tb.endControlPoint = endCtrlPt;\n\tb.getCartesianAt = new function(t) {\n\t\tif (t > 1 || t < 0) { /* TODO error handler */}\n\t\tvar x = Math.pow((1 - t),3) * b.startPoint.x +\n\t\t3*t*Math.pow((1-t),2) * b.startControlPoint.x +\n\t\t3*Math.pow(t,2)*(1-t) * b.endControlPoint.x +\n\t\tpow(t,3) * b.endPoint.x;\n\t\t\n\t\tvar y = Math.pow((1 - t),3) * b.startPoint.y +\n\t\t3*t*Math.pow((1-t),2) * b.startControlPoint.y +\n\t\t3*Math.pow(t,2)*(1-t) * b.endControlPoint.y +\n\t\tMath.pow(t,3) * b.endPoint.y;\n\t\t\n\t\treturn [x,y];\n\t}\n\treturn b;\n}", "function endPoint(branch) {\r\n\tvar x = branch.x + branch.l * Math.sin(branch.a);\r\n\tvar y = branch.y - branch.l * Math.cos(branch.a);\r\n\treturn {x: x, y: y};\r\n}", "function extraBpoints(mm){\n let shift;\n if (g.uniformGen == \"A\"){\n shift = 100;\n } else {\n shift = 75;\n }\n let value_temp = 550 - 5*mm + 150 - shift;\n push();\n strokeWeight(0); fill(255,0,0);\n circle(75, value_temp,12);\n circle(252, value_temp,12);\n strokeWeight(2); stroke(255,0,0);\n line(75,value_temp, 252+15, value_temp);\n pop();\n}", "function bishops (positions, w) {\n\n}", "positionPoints() {\n const padding = this.getBoundsPadding();\n\n const centerX = (this.content.width / (this.edgePointsAmount) / 2); // center on the X axis\n const rightX = this.getBoundsRightX(); // get the right point position\n const centerY = (this.content.height / (this.edgePointsAmount) / 2); // center on the Y axis\n const bottomY = this.content.height; // the bottom point position\n\n this.topPoint.x = centerX;\n this.topPoint.y = -padding.top;\n this.bottomPoint.x = centerX;\n this.bottomPoint.y = bottomY + padding.bottom;\n this.rightPoint.x = rightX + padding.right;\n this.rightPoint.y = centerY;\n this.leftPoint.x = -padding.left;\n this.leftPoint.y = centerY;\n }", "bouton_centrage_pos() {}", "breadcrumbPoints(i) {\n\t\t\tconst points = [];\n\t\t\tpoints.push(\"0,0\");\n\t\t\tpoints.push(`${this.b.w},0`);\n\t\t\tpoints.push(`${this.b.w + this.b.t},${this.b.h / 2}`);\n\t\t\tpoints.push(`${this.b.w},${this.b.h}`);\n\t\t\tpoints.push(`0,${this.b.h}`);\n\t\t\tif (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n\t\t\t\tpoints.push(`${this.b.t},${this.b.h / 2}`);\n\t\t\t}\n\t\t\treturn points.join(\" \");\n\t\t}", "get endB() { return Math.max(this.fromB, this.toB - 1); }", "function addBottomPoints(_points) {\n _points.push({x: 42, y:197});\n _points.push({x: 143, y:197});\n _points.push({x: 127, y:252});\n _points.push({x: 96, y:253});\n _points.push({x: 58, y:307});\n _points.push({x: 51, y:350});\n _points.push({x: 69, y:378});\n _points.push({x: 110, y:390});\n _points.push({x: 140, y:392});\n _points.push({x: 173, y:391});\n _points.push({x: 202, y:382});\n _points.push({x: 218, y:369});\n _points.push({x: 208, y:353});\n _points.push({x: 192, y:344});\n _points.push({x: 143, y:340});\n _points.push({x: 182, y:255});\n _points.push({x: 165, y:252});\n _points.push({x: 184, y:199});\n _points.push({x: 307, y:197});\n _points.push({x: 300, y:218});\n _points.push({x: 297, y:234});\n _points.push({x: 299, y:252});\n _points.push({x: 311, y:287});\n _points.push({x: 347, y:342});\n _points.push({x: 372, y:400});\n _points.push({x: 392, y:456});\n _points.push({x: 400, y:428});\n _points.push({x: 399, y:400});\n _points.push({x: 394, y:352});\n _points.push({x: 390, y:306});\n _points.push({x: 390, y:285});\n _points.push({x: 392, y:258});\n _points.push({x: 392, y:254});\n _points.push({x: 365, y:253});\n _points.push({x: 384, y:200});\n _points.push({x: 457, y:201});\n _points.push({x: 447, y:240});\n _points.push({x: 437, y:332});\n _points.push({x: 431, y:446});\n _points.push({x: 422, y:515});\n _points.push({x: 419, y:531});\n _points.push({x: 409, y:539});\n _points.push({x: 397, y:522});\n _points.push({x: 389, y:492});\n _points.push({x: 367, y:448});\n _points.push({x: 319, y:365});\n _points.push({x: 269, y:302});\n _points.push({x: 213, y:253});\n _points.push({x: 202, y:257});\n _points.push({x: 188, y:288});\n _points.push({x: 184, y:291});\n _points.push({x: 205, y:302});\n _points.push({x: 228, y:329});\n _points.push({x: 237, y:364});\n _points.push({x: 233, y:388});\n _points.push({x: 223, y:406});\n _points.push({x: 205, y:418});\n _points.push({x: 178, y:428});\n _points.push({x: 138, y:433});\n _points.push({x: 100, y:433});\n _points.push({x: 76, y:425});\n _points.push({x: 51, y:409});\n _points.push({x: 43, y:399});\n _points.push({x: 31, y:369});\n _points.push({x: 31, y:342});\n _points.push({x: 37, y:315});\n _points.push({x: 45, y:289});\n _points.push({x: 54, y:271});\n _points.push({x: 62, y:261});\n _points.push({x: 63, y:255});\n _points.push({x: 56, y:251});\n _points.push({x: 28, y:251});\n }", "get bending() {\n return {\n position: { max: 4.0 },\n angularVelocity: { percent: 0.0 },\n angleLocal: { percent: 0.0 }\n };\n }", "getStartingPosition(){\n return [this.x,this.y];\n }", "function blockpositions(B) {\n var posx = 0;\n var posy = 0;\n var Px = [];\n var Py = [];\n for (var x = 0; x < B; ++x) {\n for (var y = 0; y < B; ++y) {\n Px.push(posx);\n Py.push(posy);\n posx += B;\n posy += 1;\n }\n posx += (B * B * B) - (B * B)\n posy += (B * B) - B\n }\n return [Px, Py];\n}", "function getBranchPoints(begin, end) {\n const branchPartitionFactor = 20;\n\n const branchPoints = [];\n const dx = end.x - begin.x;\n const dy = end.y - begin.y;\n\n for (let i = 0; i < branchPartitionFactor; i++) {\n const x = begin.x + i*dx/branchPartitionFactor;\n const y = begin.y + i*dy/branchPartitionFactor;\n\n branchPoints.push(new Point(x, y));\n }\n branchPoints.push(new Point(end.x, end.y));\n\n return branchPoints;\n}", "calculateB() {\n let dx = this.len * Math.cos(this.angle);\n let dy = this.len * Math.sin(this.angle);\n this.b.set(this.a.x + dx, this.a.y + dy);\n }", "function ky__initB(position,normal){\n //create the buffer for the positions\n var positBuffer=ky__gl.createBuffer();\n //bind the buffer to the top webGL buffer editing interface\n ky__gl.bindBuffer(ky__gl.ARRAY_BUFFER,positBuffer);\n //set the vertices \n //add the positions array data to the positions buffer.\n ky__gl.bufferData(ky__gl.ARRAY_BUFFER,new Float32Array(position),ky__gl.STATIC_DRAW);\n \n return positBuffer;\n}", "function Bendpoints(eventBus, canvas, interactionEvents, bendpointMove, connectionSegmentMove) {\n\n function getConnectionIntersection(waypoints, event) {\n var localPosition = BendpointUtil.toCanvasCoordinates(canvas, event),\n intersection = getApproxIntersection(waypoints, localPosition);\n\n return intersection;\n }\n\n function isIntersectionMiddle(intersection, waypoints, treshold) {\n var idx = intersection.index,\n p = intersection.point,\n p0, p1, mid, aligned, xDelta, yDelta;\n\n if (idx <= 0 || intersection.bendpoint) {\n return false;\n }\n\n p0 = waypoints[idx - 1];\n p1 = waypoints[idx];\n mid = getMidPoint(p0, p1),\n aligned = pointsAligned(p0, p1);\n xDelta = Math.abs(p.x - mid.x);\n yDelta = Math.abs(p.y - mid.y);\n\n return aligned && xDelta <= treshold && yDelta <= treshold;\n }\n\n function activateBendpointMove(event, connection) {\n var waypoints = connection.waypoints,\n intersection = getConnectionIntersection(waypoints, event);\n\n if (!intersection) {\n return;\n }\n\n if (isIntersectionMiddle(intersection, waypoints, 10)) {\n connectionSegmentMove.start(event, connection, intersection.index);\n } else {\n bendpointMove.start(event, connection, intersection.index, !intersection.bendpoint);\n }\n }\n\n function getBendpointsContainer(element, create) {\n\n var layer = canvas.getLayer('overlays'),\n gfx = layer.select('.djs-bendpoints[data-element-id=' + element.id + ']');\n\n if (!gfx && create) {\n gfx = layer.group().addClass('djs-bendpoints').attr('data-element-id', element.id);\n\n domEvent.bind(gfx.node, 'mousedown', function(event) {\n activateBendpointMove(event, element);\n });\n }\n\n return gfx;\n }\n\n function createBendpoints(gfx, connection) {\n connection.waypoints.forEach(function(p, idx) {\n BendpointUtil.addBendpoint(gfx).translate(p.x, p.y);\n });\n\n // add floating bendpoint\n BendpointUtil.addBendpoint(gfx, 'floating');\n }\n\n function createSegmentDraggers(gfx, connection) {\n\n var waypoints = connection.waypoints;\n\n var segmentStart,\n segmentEnd;\n\n for (var i = 1; i < waypoints.length; i++) {\n\n segmentStart = waypoints[i - 1];\n segmentEnd = waypoints[i];\n\n if (pointsAligned(segmentStart, segmentEnd)) {\n BendpointUtil.addSegmentDragger(gfx, segmentStart, segmentEnd);\n }\n }\n }\n\n function clearBendpoints(gfx) {\n gfx.selectAll('.' + BENDPOINT_CLS).forEach(function(s) {\n s.remove();\n });\n }\n\n function clearSegmentDraggers(gfx) {\n gfx.selectAll('.' + SEGMENT_DRAGGER_CLS).forEach(function(s) {\n s.remove();\n });\n }\n\n function addHandles(connection) {\n\n var gfx = getBendpointsContainer(connection);\n\n if (!gfx) {\n gfx = getBendpointsContainer(connection, true);\n\n createBendpoints(gfx, connection);\n createSegmentDraggers(gfx, connection);\n }\n\n return gfx;\n }\n\n function updateHandles(connection) {\n\n var gfx = getBendpointsContainer(connection);\n\n if (gfx) {\n clearSegmentDraggers(gfx);\n clearBendpoints(gfx);\n createSegmentDraggers(gfx, connection);\n createBendpoints(gfx, connection);\n }\n }\n\n eventBus.on('connection.changed', function(event) {\n updateHandles(event.element);\n });\n\n eventBus.on('connection.remove', function(event) {\n var gfx = getBendpointsContainer(event.element);\n\n if (gfx) {\n gfx.remove();\n }\n });\n\n eventBus.on('element.marker.update', function(event) {\n\n var element = event.element,\n bendpointsGfx;\n\n if (!element.waypoints) {\n return;\n }\n\n bendpointsGfx = addHandles(element);\n bendpointsGfx[event.add ? 'addClass' : 'removeClass'](event.marker);\n });\n\n eventBus.on('element.mousemove', function(event) {\n\n var element = event.element,\n waypoints = element.waypoints,\n bendpointsGfx,\n floating,\n intersection;\n\n if (waypoints) {\n\n bendpointsGfx = getBendpointsContainer(element, true);\n floating = bendpointsGfx.select('.floating');\n\n if (!floating) {\n return;\n }\n\n intersection = getConnectionIntersection(waypoints, event.originalEvent);\n\n if (intersection) {\n floating.translate(intersection.point.x, intersection.point.y);\n }\n }\n });\n\n eventBus.on('element.mousedown', function(event) {\n\n var originalEvent = event.originalEvent,\n element = event.element,\n waypoints = element.waypoints;\n\n if (!waypoints) {\n return;\n }\n\n activateBendpointMove(originalEvent, element, waypoints);\n });\n\n eventBus.on('selection.changed', function(event) {\n var newSelection = event.newSelection,\n primary = newSelection[0];\n\n if (primary && primary.waypoints) {\n addHandles(primary);\n }\n });\n\n eventBus.on('element.hover', function(event) {\n var element = event.element;\n\n if (element.waypoints) {\n addHandles(element);\n interactionEvents.registerEvent(event.gfx.node, 'mousemove', 'element.mousemove');\n }\n });\n\n eventBus.on('element.out', function(event) {\n interactionEvents.unregisterEvent(event.gfx.node, 'mousemove', 'element.mousemove');\n });\n}", "setInitialBowlerPosition() {\n\t\tthis.startBowlPosX = config.width * 0.55;\n\t\tthis.startBowlPosY = config.height * 0.35;\n\t}", "breadcrumbPoints(d, i) {\n var points = [];\n var b = this.opt.breadcrumbs;\n points.push(\"0,0\");\n points.push(b.w + \",0\");\n points.push(b.w + b.t + \",\" + (b.h / 2));\n points.push(b.w + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) {\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n }", "getBoneEndDistance(b) {\nreturn this.distance[b];\n}", "function posToBrgDst(x1, y1, x2, y2) {\n\tvar dx = x2-x1;\n\tvar dy = y2-y1;\n\t\n\treturn [\n\t\tMath.atan2(dx,dy), \n\t\tMath.sqrt(dx*dx+dy*dy)\n\t\t];\n}", "_parsePoints() {\n var top = this.options.topAnchor == \"\" ? 1 : this.options.topAnchor,\n btm = this.options.btmAnchor== \"\" ? document.documentElement.scrollHeight : this.options.btmAnchor,\n pts = [top, btm],\n breaks = {};\n for (var i = 0, len = pts.length; i < len && pts[i]; i++) {\n var pt;\n if (typeof pts[i] === 'number') {\n pt = pts[i];\n } else {\n var place = pts[i].split(':'),\n anchor = $(`#${place[0]}`);\n\n pt = anchor.offset().top;\n if (place[1] && place[1].toLowerCase() === 'bottom') {\n pt += anchor[0].getBoundingClientRect().height;\n }\n }\n breaks[i] = pt;\n }\n\n\n this.points = breaks;\n return;\n }", "function boundaryPoint_position(bp, relativeTo) {\n const nodeA = bp[0];\n const offsetA = bp[1];\n const nodeB = relativeTo[0];\n const offsetB = relativeTo[1];\n /**\n * 1. Assert: nodeA and nodeB have the same root.\n */\n console.assert(TreeAlgorithm_1.tree_rootNode(nodeA) === TreeAlgorithm_1.tree_rootNode(nodeB), \"Boundary points must share the same root node.\");\n /**\n * 2. If nodeA is nodeB, then return equal if offsetA is offsetB, before\n * if offsetA is less than offsetB, and after if offsetA is greater than\n * offsetB.\n */\n if (nodeA === nodeB) {\n if (offsetA === offsetB) {\n return interfaces_1.BoundaryPosition.Equal;\n }\n else if (offsetA < offsetB) {\n return interfaces_1.BoundaryPosition.Before;\n }\n else {\n return interfaces_1.BoundaryPosition.After;\n }\n }\n /**\n * 3. If nodeA is following nodeB, then if the position of (nodeB, offsetB)\n * relative to (nodeA, offsetA) is before, return after, and if it is after,\n * return before.\n */\n if (TreeAlgorithm_1.tree_isFollowing(nodeB, nodeA)) {\n const pos = boundaryPoint_position([nodeB, offsetB], [nodeA, offsetA]);\n if (pos === interfaces_1.BoundaryPosition.Before) {\n return interfaces_1.BoundaryPosition.After;\n }\n else if (pos === interfaces_1.BoundaryPosition.After) {\n return interfaces_1.BoundaryPosition.Before;\n }\n }\n /**\n * 4. If nodeA is an ancestor of nodeB:\n */\n if (TreeAlgorithm_1.tree_isAncestorOf(nodeB, nodeA)) {\n /**\n * 4.1. Let child be nodeB.\n * 4.2. While child is not a child of nodeA, set child to its parent.\n * 4.3. If child’s index is less than offsetA, then return after.\n */\n let child = nodeB;\n while (!TreeAlgorithm_1.tree_isChildOf(nodeA, child)) {\n /* istanbul ignore else */\n if (child._parent !== null) {\n child = child._parent;\n }\n }\n if (TreeAlgorithm_1.tree_index(child) < offsetA) {\n return interfaces_1.BoundaryPosition.After;\n }\n }\n /**\n * 5. Return before.\n */\n return interfaces_1.BoundaryPosition.Before;\n}", "function breadcrumbPoints(d, i) {\n\tvar points = [];\n\tpoints.push(\"0,0\");\n\tpoints.push(b.w + \",0\");\n\tpoints.push(b.w + b.t + \",\" + (b.h / 2));\n\tpoints.push(b.w + \",\" + b.h);\n\tpoints.push(\"0,\" + b.h);\n\tif (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n\t\tpoints.push(b.t + \",\" + (b.h / 2));\n\t}\n\treturn points.join(\" \");\n}", "function breadcrumbPoints(d, i) {\r\n var points = [];\r\n points.push(\"0,0\");\r\n points.push(b.w + \",0\");\r\n points.push(b.w + b.t + \",\" + (b.h / 2));\r\n points.push(b.w + \",\" + b.h);\r\n points.push(\"0,\" + b.h);\r\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\r\n points.push(b.t + \",\" + (b.h / 2));\r\n }\r\n return points.join(\" \");\r\n }", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push('0,0');\n points.push(b.w + ',0');\n points.push(b.w + b.t + ',' + (b.h / 2));\n points.push(b.w + ',' + b.h);\n points.push('0,' + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + ',' + (b.h / 2));\n }\n return points.join(' ');\n }", "function breadcrumbPoints(d, i) {\n const points = [];\n points.push('0,0');\n points.push(`${b.w},0`);\n points.push(`${b.w + b.t},${b.h / 2}`);\n points.push(`${b.w},${b.h}`);\n points.push(`0,${b.h}`);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(`${b.t},${b.h / 2}`);\n }\n return points.join(' ');\n}", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push(\"0,0\");\n points.push(b.w*4 + \",0\");\n points.push(b.w*4 + b.t + \",\" + (b.h / 2));\n points.push(b.w*4 + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n}", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push(\"0,0\");\n points.push(b.w + \",0\");\n points.push(b.w + b.t + \",\" + (b.h / 2));\n points.push(b.w + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n }", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push(\"0,0\");\n points.push(b.w + \",0\");\n points.push(b.w + b.t + \",\" + (b.h / 2));\n points.push(b.w + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n }", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push(\"0,0\");\n points.push(b.w + \",0\");\n points.push(b.w + b.t + \",\" + (b.h / 2));\n points.push(b.w + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n }", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push(\"0,0\");\n points.push(b.w + \",0\");\n points.push(b.w + b.t + \",\" + (b.h / 2));\n points.push(b.w + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n}", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push(\"0,0\");\n points.push(b.w + \",0\");\n points.push(b.w + b.t + \",\" + (b.h / 2));\n points.push(b.w + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n}", "getIgnitionEndPoints () {\n const pts = []\n this._horz.forEach(line => {\n const y = line.anchor()\n line.segments().forEach(segment => {\n if (segment.isBurned()) {\n pts.push([segment.begins(), y])\n if (segment.begins() !== segment.ends()) {\n pts.push([segment.ends(), y])\n }\n }\n })\n })\n return pts\n }", "function getWirePoints(start, end) {\n\t\tpoints = [];\t\t\t\t\t\t\t// null the points array\n\t\tpoints.push(start.x, start.y);\t\t\t// push start.x, start.y\n\t\tvar xMed = (points[0] + end.x) / 2;\t\t// comput the middle x\n\t\tpoints.push(xMed, start.y);\t\t\t\t// push middle.x, start.y\n\t\tpoints.push(xMed, end.y);\t\t\t\t// push middle.x, end.y\n\t\tpoints.push(end.x, end.y);\t\t\t\t// push end.x, end.y\n\t\treturn points;\t\t\t\t\t\t\t// return the array\n\t}", "function compareBoundaryPointsPosition(bpA, bpB) {\n const { node: nodeA, offset: offsetA } = bpA;\n const { node: nodeB, offset: offsetB } = bpB;\n\n if (nodeRoot(nodeA) !== nodeRoot(nodeB)) {\n throw new Error(`Internal Error: Boundary points should have the same root!`);\n }\n\n if (nodeA === nodeB) {\n if (offsetA === offsetB) {\n return 0;\n } else if (offsetA < offsetB) {\n return -1;\n }\n\n return 1;\n }\n\n if (isFollowing(nodeA, nodeB)) {\n return compareBoundaryPointsPosition(bpB, bpA) === -1 ? 1 : -1;\n }\n\n if (isInclusiveAncestor(nodeA, nodeB)) {\n let child = nodeB;\n\n while (domSymbolTree.parent(child) !== nodeA) {\n child = domSymbolTree.parent(child);\n }\n\n if (domSymbolTree.index(child) < offsetA) {\n return 1;\n }\n }\n\n return -1;\n}", "function ballCenter(){\n posicaoBolaX = larguraCampo / 2\n posicaoBolaY = alturaCampo / 2\n velocidadeBolaPosicaoX = -velocidadeBolaPosicaoX\n velocidadeBolaPosicaoY = 3\n}", "function pfPosBisa(x, y) {\n //check cell\n if (cellCheckDouble(x, y)) {\n return false;\n }\n //check block peta\n if (!petaPosValid(x, y)) {\n return false;\n }\n return true;\n}", "function bors() {\n\n var endval, startval;\n endval = actpts[19]\n startval = actpts[0]\n\n wait.shift()\n\n if (byorcell == 1) {\n color.push('green')\n signif = true\n }\n else if (byorcell == -1) {\n color.push('red')\n signif = true\n }\n else {\n signif = false\n wait.push(0)\n }\n\n if (signif == true) {\n if (movemoveit == false) {\n end = end - 1\n start = start -1\n }\n\n wait.push(1)\n profit.push(globaldata[e-1]['profit'])\n mvmt.push(globaldata[e-1]['sum'])\n x0.push(start)\n y0.push(startval)\n x1.push(end)\n y1.push(endval)\n console.log(x1, x0, y1, y0)\n }\n craft()\n}", "function Bendpoints(eventBus, canvas, interactionEvents, bendpointMove, connectionSegmentMove) {\n function getConnectionIntersection(waypoints, event) {\n var localPosition = Object(_BendpointUtil__WEBPACK_IMPORTED_MODULE_2__[\"toCanvasCoordinates\"])(canvas, event), intersection = Object(_util_LineIntersection__WEBPACK_IMPORTED_MODULE_5__[\"getApproxIntersection\"])(waypoints, localPosition);\n return intersection;\n }\n function isIntersectionMiddle(intersection, waypoints, treshold) {\n var idx = intersection.index, p = intersection.point, p0, p1, mid, aligned, xDelta, yDelta;\n if (idx <= 0 || intersection.bendpoint) {\n return false;\n }\n p0 = waypoints[idx - 1];\n p1 = waypoints[idx];\n mid = Object(_util_Geometry__WEBPACK_IMPORTED_MODULE_4__[\"getMidPoint\"])(p0, p1),\n aligned = Object(_util_Geometry__WEBPACK_IMPORTED_MODULE_4__[\"pointsAligned\"])(p0, p1);\n xDelta = Math.abs(p.x - mid.x);\n yDelta = Math.abs(p.y - mid.y);\n return aligned && xDelta <= treshold && yDelta <= treshold;\n }\n function activateBendpointMove(event, connection) {\n var waypoints = connection.waypoints, intersection = getConnectionIntersection(waypoints, event);\n if (!intersection) {\n return;\n }\n if (isIntersectionMiddle(intersection, waypoints, 10)) {\n connectionSegmentMove.start(event, connection, intersection.index);\n }\n else {\n bendpointMove.start(event, connection, intersection.index, !intersection.bendpoint);\n }\n // we've handled the event\n return true;\n }\n function bindInteractionEvents(node, eventName, element) {\n min_dom__WEBPACK_IMPORTED_MODULE_1__[\"event\"].bind(node, eventName, function (event) {\n interactionEvents.triggerMouseEvent(eventName, event, element);\n event.stopPropagation();\n });\n }\n function getBendpointsContainer(element, create) {\n var layer = canvas.getLayer('overlays'), gfx = Object(min_dom__WEBPACK_IMPORTED_MODULE_1__[\"query\"])('.djs-bendpoints[data-element-id=\"' + css_escape__WEBPACK_IMPORTED_MODULE_3___default()(element.id) + '\"]', layer);\n if (!gfx && create) {\n gfx = Object(tiny_svg__WEBPACK_IMPORTED_MODULE_6__[\"create\"])('g');\n Object(tiny_svg__WEBPACK_IMPORTED_MODULE_6__[\"attr\"])(gfx, { 'data-element-id': element.id });\n Object(tiny_svg__WEBPACK_IMPORTED_MODULE_6__[\"classes\"])(gfx).add('djs-bendpoints');\n Object(tiny_svg__WEBPACK_IMPORTED_MODULE_6__[\"append\"])(layer, gfx);\n bindInteractionEvents(gfx, 'mousedown', element);\n bindInteractionEvents(gfx, 'click', element);\n bindInteractionEvents(gfx, 'dblclick', element);\n }\n return gfx;\n }\n function createBendpoints(gfx, connection) {\n connection.waypoints.forEach(function (p, idx) {\n var bendpoint = Object(_BendpointUtil__WEBPACK_IMPORTED_MODULE_2__[\"addBendpoint\"])(gfx);\n Object(tiny_svg__WEBPACK_IMPORTED_MODULE_6__[\"append\"])(gfx, bendpoint);\n Object(_util_SvgTransformUtil__WEBPACK_IMPORTED_MODULE_7__[\"translate\"])(bendpoint, p.x, p.y);\n });\n // add floating bendpoint\n Object(_BendpointUtil__WEBPACK_IMPORTED_MODULE_2__[\"addBendpoint\"])(gfx, 'floating');\n }\n function createSegmentDraggers(gfx, connection) {\n var waypoints = connection.waypoints;\n var segmentStart, segmentEnd;\n for (var i = 1; i < waypoints.length; i++) {\n segmentStart = waypoints[i - 1];\n segmentEnd = waypoints[i];\n if (Object(_util_Geometry__WEBPACK_IMPORTED_MODULE_4__[\"pointsAligned\"])(segmentStart, segmentEnd)) {\n Object(_BendpointUtil__WEBPACK_IMPORTED_MODULE_2__[\"addSegmentDragger\"])(gfx, segmentStart, segmentEnd);\n }\n }\n }\n function clearBendpoints(gfx) {\n Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"forEach\"])(Object(min_dom__WEBPACK_IMPORTED_MODULE_1__[\"queryAll\"])('.' + _BendpointUtil__WEBPACK_IMPORTED_MODULE_2__[\"BENDPOINT_CLS\"], gfx), function (node) {\n Object(tiny_svg__WEBPACK_IMPORTED_MODULE_6__[\"remove\"])(node);\n });\n }\n function clearSegmentDraggers(gfx) {\n Object(min_dash__WEBPACK_IMPORTED_MODULE_0__[\"forEach\"])(Object(min_dom__WEBPACK_IMPORTED_MODULE_1__[\"queryAll\"])('.' + _BendpointUtil__WEBPACK_IMPORTED_MODULE_2__[\"SEGMENT_DRAGGER_CLS\"], gfx), function (node) {\n Object(tiny_svg__WEBPACK_IMPORTED_MODULE_6__[\"remove\"])(node);\n });\n }\n function addHandles(connection) {\n var gfx = getBendpointsContainer(connection);\n if (!gfx) {\n gfx = getBendpointsContainer(connection, true);\n createBendpoints(gfx, connection);\n createSegmentDraggers(gfx, connection);\n }\n return gfx;\n }\n function updateHandles(connection) {\n var gfx = getBendpointsContainer(connection);\n if (gfx) {\n clearSegmentDraggers(gfx);\n clearBendpoints(gfx);\n createSegmentDraggers(gfx, connection);\n createBendpoints(gfx, connection);\n }\n }\n eventBus.on('connection.changed', function (event) {\n updateHandles(event.element);\n });\n eventBus.on('connection.remove', function (event) {\n var gfx = getBendpointsContainer(event.element);\n if (gfx) {\n Object(tiny_svg__WEBPACK_IMPORTED_MODULE_6__[\"remove\"])(gfx);\n }\n });\n eventBus.on('element.marker.update', function (event) {\n var element = event.element, bendpointsGfx;\n if (!element.waypoints) {\n return;\n }\n bendpointsGfx = addHandles(element);\n if (event.add) {\n Object(tiny_svg__WEBPACK_IMPORTED_MODULE_6__[\"classes\"])(bendpointsGfx).add(event.marker);\n }\n else {\n Object(tiny_svg__WEBPACK_IMPORTED_MODULE_6__[\"classes\"])(bendpointsGfx).remove(event.marker);\n }\n });\n eventBus.on('element.mousemove', function (event) {\n var element = event.element, waypoints = element.waypoints, bendpointsGfx, floating, intersection;\n if (waypoints) {\n bendpointsGfx = getBendpointsContainer(element, true);\n floating = Object(min_dom__WEBPACK_IMPORTED_MODULE_1__[\"query\"])('.floating', bendpointsGfx);\n if (!floating) {\n return;\n }\n intersection = getConnectionIntersection(waypoints, event.originalEvent);\n if (intersection) {\n Object(_util_SvgTransformUtil__WEBPACK_IMPORTED_MODULE_7__[\"translate\"])(floating, intersection.point.x, intersection.point.y);\n }\n }\n });\n eventBus.on('element.mousedown', function (event) {\n var originalEvent = event.originalEvent, element = event.element, waypoints = element.waypoints;\n if (!waypoints) {\n return;\n }\n return activateBendpointMove(originalEvent, element, waypoints);\n });\n eventBus.on('selection.changed', function (event) {\n var newSelection = event.newSelection, primary = newSelection[0];\n if (primary && primary.waypoints) {\n addHandles(primary);\n }\n });\n eventBus.on('element.hover', function (event) {\n var element = event.element;\n if (element.waypoints) {\n addHandles(element);\n interactionEvents.registerEvent(event.gfx, 'mousemove', 'element.mousemove');\n }\n });\n eventBus.on('element.out', function (event) {\n interactionEvents.unregisterEvent(event.gfx, 'mousemove', 'element.mousemove');\n });\n // update bendpoint container data attribute on element ID change\n eventBus.on('element.updateId', function (context) {\n var element = context.element, newId = context.newId;\n if (element.waypoints) {\n var bendpointContainer = getBendpointsContainer(element);\n if (bendpointContainer) {\n Object(tiny_svg__WEBPACK_IMPORTED_MODULE_6__[\"attr\"])(bendpointContainer, { 'data-element-id': newId });\n }\n }\n });\n // API\n this.addHandles = addHandles;\n this.updateHandles = updateHandles;\n this.getBendpointsContainer = getBendpointsContainer;\n}", "function barycenter(points) {\n var lat = 0, lng = 0, n = points.length;\n for (var i = n - 1; i >= 0; i--) {\n lat += points[i].lat;\n lng += points[i].lng;\n }\n return new L.LatLng(lat/n, lng/n);\n}", "function breadcrumbPoints(datum, index) {\n\t\tvar points = [];\n\t\tpoints.push(\"0,0\");\n\t\tpoints.push(breadcrumbDim.w + \",0\");\n\t\tpoints.push(breadcrumbDim.w + breadcrumbDim.t + \",\" + (breadcrumbDim.h / 2));\n\t\tpoints.push(breadcrumbDim.w + \",\" + breadcrumbDim.h);\n\t\tpoints.push(\"0,\" + breadcrumbDim.h);\n\t\tif (index > 0) {\n\t\t\tpoints.push(breadcrumbDim.t + \",\" + (breadcrumbDim.h / 2));\n\t\t}\n\t\treturn points.join(\" \");\n\t}", "function setPosition(start, end) {\n var pos = { to: -1, start: -1, end: -1 };\n mRoot.objEntities.forEach(function (entity) {\n var holders = entity.holders;\n for (var i = 0; i < holders.length; i++) {\n var holder = holders[i];\n var limit = {\n min: {\n x: holder.attr(\"x\") - 5,\n y: holder.attr(\"y\") - 5\n },\n max: {\n x: holder.attr(\"x\") + holder.attr(\"width\") + 5,\n y: holder.attr(\"y\") + holder.attr(\"height\") + 5\n }\n }\n if (limit.min.x <= start.x && start.x <= limit.max.x &&\n limit.min.y <= start.y && start.y <= limit.max.y) {\n pos.start = holder.id;\n }\n if (limit.min.x <= end.x && end.x <= limit.max.x &&\n limit.min.y <= end.y && end.y <= limit.max.y) {\n pos.end = holder.id;\n pos.to = entity.id;\n }\n }\n });\n return pos;\n }", "function getPositions ( a, b, delimit ) {\n\t\n\t\t\t// Add movement to current position.\n\t\t\tvar c = a + b[0], d = a + b[1];\n\t\n\t\t\t// Only alter the other position on drag,\n\t\t\t// not on standard sliding.\n\t\t\tif ( delimit ) {\n\t\t\t\tif ( c < 0 ) {\n\t\t\t\t\td += Math.abs(c);\n\t\t\t\t}\n\t\t\t\tif ( d > 100 ) {\n\t\t\t\t\tc -= ( d - 100 );\n\t\t\t\t}\n\t\n\t\t\t\t// Limit values to 0 and 100.\n\t\t\t\treturn [limit(c), limit(d)];\n\t\t\t}\n\t\n\t\t\treturn [c,d];\n\t\t}", "bbox() {\n parser().path.setAttribute('d', this.toString());\n return parser.nodes.path.getBBox();\n }", "rtnStartPos() {\n this.x = this.plyrSrtPosX;\n this.y = this.plyrSrtPosY;\n}", "function getPositions ( a, b, delimit ) {\r\n\r\n\t\t\t// Add movement to current position.\r\n\t\t\tvar c = a + b[0], d = a + b[1];\r\n\r\n\t\t\t// Only alter the other position on drag,\r\n\t\t\t// not on standard sliding.\r\n\t\t\tif ( delimit ) {\r\n\t\t\t\tif ( c < 0 ) {\r\n\t\t\t\t\td += Math.abs(c);\r\n\t\t\t\t}\r\n\t\t\t\tif ( d > 100 ) {\r\n\t\t\t\t\tc -= ( d - 100 );\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Limit values to 0 and 100.\r\n\t\t\t\treturn [limit(c), limit(d)];\r\n\t\t\t}\r\n\r\n\t\t\treturn [c,d];\r\n\t\t}", "function _breadcrumbPoints(d, i) {\n var points = [];\n\n points.push('0,0');\n points.push(options.trail.b.w + ',0');\n points.push(options.trail.b.w + options.trail.b.t + ',' + (options.trail.b.h / 2));\n points.push(options.trail.b.w + ',' + options.trail.b.h);\n points.push('0,' + options.trail.b.h);\n\n if (i > 0) {\n points.push(options.trail.b.t + ',' + (options.trail.b.h / 2));\n }\n\n return points.join(' ');\n }", "function bouns(pointA, pointB, speed, obj) {\n \n if (obj.y <= pointA) flag = true;\n if (obj.y >= pointB) flag = false;\n \n if (flag) {\n obj.y+=speed;\n } else {\n obj.y-=speed;\n } \n \n}", "function getPositions ( a, b, delimit ) {\r\n\r\n\t\t// Add movement to current position.\r\n\t\tvar c = a + b[0], d = a + b[1];\r\n\r\n\t\t// Only alter the other position on drag,\r\n\t\t// not on standard sliding.\r\n\t\tif ( delimit ) {\r\n\t\t\tif ( c < 0 ) {\r\n\t\t\t\td += Math.abs(c);\r\n\t\t\t}\r\n\t\t\tif ( d > 100 ) {\r\n\t\t\t\tc -= ( d - 100 );\r\n\t\t\t}\r\n\r\n\t\t\t// Limit values to 0 and 100.\r\n\t\t\treturn [limit(c), limit(d)];\r\n\t\t}\r\n\r\n\t\treturn [c,d];\r\n\t}", "function updatePositionsfinal() {\n var positions = line2.geometry.attributes.position.array;\n\n var x = 6; \n var y = 2.7; \n var z = -2.5;\n var index = 0;\n\n for ( var i = 0, l = MAX_POINTS; i < l; i ++ ) {\n\n positions[ index ++ ] = x;\n positions[ index ++ ] = y;\n positions[ index ++ ] = z;\n\n x += (9/MAX_POINTS);\n y += (2.6/MAX_POINTS);\n }\n}", "function Bb(b){this.radius=b}", "CalculateBoundingBoxParameters() {\n\n\n\n /**\n * Initialize the minimum and the maximum x,y,z components of the bounding box.\n */\n var maxX = Number.MIN_SAFE_INTEGER;\n var maxY = Number.MIN_SAFE_INTEGER;\n var maxZ = Number.MIN_SAFE_INTEGER;\n\n var minX = Number.MAX_SAFE_INTEGER;\n var minY = Number.MAX_SAFE_INTEGER;\n var minZ = Number.MAX_SAFE_INTEGER;\n\n\n\n //Get the children meshes of the tank.\n var children = this.root.getChildren();\n\n\n\n //There are actually 12 childeren meshes.\n\n\n for (var i = 0; i < children.length; i++) {\n\n //The positions are returned in the model reference frame. The positions are stored\n //in the (x,y,z),(x,y,z) fashion.\n var positions = new BABYLON.VertexData.ExtractFromGeometry(children[i]).positions;\n if (!positions) continue;\n\n var index = 0;\n\n\n //Starting from j = 0, in j+3, j+6 .... there are all the x components.\n for (var j = index; j < positions.length; j += 3) {\n if (positions[j] < minX)\n minX = positions[j];\n if (positions[j] > maxX)\n maxX = positions[j];\n }\n\n index = 1;\n //Starting from j = 1, in j+3, j+6 .... there are all the y components.\n for (var j = index; j < positions.length; j += 3) {\n if (positions[j] < minY)\n minY = positions[j];\n if (positions[j] > maxY)\n maxY = positions[j];\n }\n\n //Starting from j = 2, in j+3, j+6 .... there are all the z components.\n index = 2;\n for (var j = index; j < positions.length; j += 3) {\n if (positions[j] < minZ)\n minZ = positions[j];\n if (positions[j] > maxZ)\n maxZ = positions[j];\n\n }\n\n\n /** \n * Take the length of the segment with a simple yet effective mathematical \n * formula: the absolute value of the maximum value - the minimum value for \n * each component.\n */\n\n var _lengthX = Math.abs(maxX - minX);\n var _lengthY = Math.abs(maxY - minY);\n var _lengthZ = Math.abs(maxZ - minZ);\n\n\n\n }\n\n\n\n //Return an object with all the three variables (the dimensions of the bounding box).\n return { lengthX: _lengthX, lengthY: _lengthY, lengthZ: _lengthZ }\n\n\n\n }", "function initPositionSerpent() {\n xSerp = Math.trunc(Math.random()*nombreBlockParWidth)*tailleSerp;\n ySerp = Math.trunc(Math.random()*nombreBlockParHeight)*tailleSerp;\n }", "pointLocation(point) {\n let location = 0b0\n\n if (point.x < -this.sizeX) {\n location += 0b1000\n } else if (point.x > this.sizeX) {\n location += 0b0100\n }\n\n if (point.y < -this.sizeY) {\n location += 0b0001\n } else if (point.y > this.sizeY) {\n location += 0b0010\n }\n\n return location\n }", "function getPositions ( a, b, delimit ) {\n\n\t\t// Add movement to current position.\n\t\tvar c = a + b[0], d = a + b[1];\n\n\t\t// Only alter the other position on drag,\n\t\t// not on standard sliding.\n\t\tif ( delimit ) {\n\t\t\tif ( c < 0 ) {\n\t\t\t\td += Math.abs(c);\n\t\t\t}\n\t\t\tif ( d > 100 ) {\n\t\t\t\tc -= ( d - 100 );\n\t\t\t}\n\n\t\t\t// Limit values to 0 and 100.\n\t\t\treturn [limit(c), limit(d)];\n\t\t}\n\n\t\treturn [c,d];\n\t}", "function getPositions ( a, b, delimit ) {\n\n\t\t// Add movement to current position.\n\t\tvar c = a + b[0], d = a + b[1];\n\n\t\t// Only alter the other position on drag,\n\t\t// not on standard sliding.\n\t\tif ( delimit ) {\n\t\t\tif ( c < 0 ) {\n\t\t\t\td += Math.abs(c);\n\t\t\t}\n\t\t\tif ( d > 100 ) {\n\t\t\t\tc -= ( d - 100 );\n\t\t\t}\n\n\t\t\t// Limit values to 0 and 100.\n\t\t\treturn [limit(c), limit(d)];\n\t\t}\n\n\t\treturn [c,d];\n\t}", "function getPositions ( a, b, delimit ) {\n\n\t\t// Add movement to current position.\n\t\tvar c = a + b[0], d = a + b[1];\n\n\t\t// Only alter the other position on drag,\n\t\t// not on standard sliding.\n\t\tif ( delimit ) {\n\t\t\tif ( c < 0 ) {\n\t\t\t\td += Math.abs(c);\n\t\t\t}\n\t\t\tif ( d > 100 ) {\n\t\t\t\tc -= ( d - 100 );\n\t\t\t}\n\n\t\t\t// Limit values to 0 and 100.\n\t\t\treturn [limit(c), limit(d)];\n\t\t}\n\n\t\treturn [c,d];\n\t}", "function outlineBuckyPoints()\n{\n var offset = [0,1,1,8,-2,-3];\n var count = 0;\n for(var i = 0; i < 240; i+= offset[count])\n {\n vertices.push(buckyBall[i]);\n count++;\n if (count == 6)\n {\n count = 0;\n i+=7;\n } \n }\n}", "function get_b(p, t) {\n var levels = [p];\n for (var i = 1; i < p.length; i ++) {\n levels.push(interpolate(levels[i - 1], t));\n }\n var point = levels[levels.length - 1][0];\n return point;\n }", "function Bezier(b1, b2, xDist)\n{\n this.rad = Math.atan(b1.point.mY / b1.point.mX)\n this.b2 = b2\n this.b1 = b1\n\n this.dist = Math.sqrt(((b2.x - b1.x) * (b2.x - b1.x)) + ((b2.y - b1.y) * (b2.y - b1.y)))\n this.curve = { rad: this.rad, dist: this.dist, cDist: xDist + this.dist }\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 andarBala(item, indice, balas){\n\tbalas[indice].setY(balas[indice].getY()-4);\n}", "edges()\n\t{\n\t\t//if center of ball hits defined values then run code\n\t\tif (this.y < 15 || this.y < 14 || this.y > height)\n\t\t{\n\t\t\t//mulitply value by -1\n\t\t\tthis.yspeed *= -1;\n\t\t}\n\n\n\t\tif(this.y > height - 15)\n\t\t{\n\t\t\tthis.yspeed *= -1;\n\t\t}\n\n\n\n\t\tif (this.x < 15 || this.x < 14 || this.x > width)\n\t\t{\n\t\t\tthis.xspeed *= -1;\n\t\t}\n\n\n\n\t\tif(this.x > width - 15)\n\t\t{\n\t\t\tthis.xspeed *= -1;\n\t\t}\n\t}", "pointList() {\n let bottom = this.bottom.screen,\n top = this.top.screen;\n\n return [bottom.x - bottom.w, bottom.y,\n bottom.x + bottom.w, bottom.y,\n top.x + top.w, top.y,\n top.x - top.w, top.y];\n }", "calculateControlPoints(){\n \n\tthis.controlPoints = \n\t [ \n [\n [-this.base/2, 0, 0, 1],\n [-this.base/2, 0.7*this.base, 0, 1],\n [this.base/2, 0.7*this.base, 0 , 1],\n [this.base/2, 0, 0, 1]\n ],\n\n [\n [-this.top/2, 0, this.height, 1],\n [-this.top/2, 0.7*this.top, this.height, 1],\n [this.top/2, 0.7*this.top, this.height, 1],\n [this.top/2, 0, this.height, 1]\n ],\n ];\n\n \n }", "function Ball(position_x_, position_y_) {\n\t\t\t/* Now, to properly interpolate an animation, you need to keep track of its current and last position. */\n\t\t\t/* the interesting thing about interpolation is that to do it propperly, you never actually render the most recent update. */\n\t\t\t/* You render the last update or the interpolated position of an object between its last position and current position. */\n\t\t\t/* You can't predict the future, so you draw between the last position you know and current position you are at. */\n\t\t\t/* The user is none the wiser and the interpolation makes up for the fixed time step game loop's sometimes choppy appearance. */\n\t\t\tthis.current_position = new Point(position_x_, position_y_);\n\t\t\tthis.last_position = new Point(position_x_, position_y_);\n\t\t\tthis.velocity = 2;\n\t\t}", "function getPositions(a, b, delimit) {\n // Add movement to current position.\n var c = a + b[0],\n d = a + b[1];\n // Only alter the other position on drag,\n // not on standard sliding.\n if (delimit) {\n if (c < 0) {\n d += Math.abs(c);\n }\n if (d > 100) {\n c -= (d - 100);\n }\n // Limit values to 0 and 100.\n return [limit(c), limit(d)];\n }\n return [c, d];\n }", "function b(t){\n\t\t\t\tvar tsquared = t*t;\n\t\t\t\tvar tcubed = t*tsquared;\n\t\t\t\tomtsquared = (1-t)*(1-t);\n\t\t\t\tomtcubed = (1-t)*omtsquared\n\t\t\t\tvar bt = {\t\"x\": p0.x()*omtcubed + 3*p1.x()*t*omtsquared + 3*p2.x()*tsquared*(1-t) + p3.x()*tcubed,\n\t\t\t\t\t\t\t\"y\": p0.y()*omtcubed + 3*p1.y()*t*omtsquared + 3*p2.y()*tsquared*(1-t) + p3.y()*tcubed };\n\t\t\t\t\n\t\t\t\treturn bt;\n\t\t\t}", "function inB(s) {\n s.draw(80 - 60, 320 + 60, 0.1, {\n callback: function(){\n inB2(s)\n }\n });\n}", "function Start () {\n\tif (bendArea == true && bendCenter != null) {\n\t\tradius = Vector3.Distance(transform.position, bendCenter.position);\n\t\tobjectBounds.x = Mathf.Abs(radius * bendAngle * Mathf.Deg2Rad);\n\t}\n}", "function inB(s) { s.draw(80 - 60, 320 + 60, 0.1, {callback: function(){ inB2(s) }}); }", "calculatePositions() {\n this.x1 = this.from.getCenterX()\n this.y1 = this.from.getCenterY()\n this.x2 = this.to.getCenterX()\n this.y2 = this.to.getCenterY()\n }", "function breadcrumbPoints(d, i) {\n var points = [];\n points.push(\"0,0\");\n points.push(d.policyTitle.length*charToPix+charPadding + \",0\");\n points.push(d.policyTitle.length*charToPix+charPadding + b.t + \",\" + (b.h / 2));\n points.push(d.policyTitle.length*charToPix+charPadding + \",\" + b.h);\n points.push(\"0,\" + b.h);\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\n points.push(b.t + \",\" + (b.h / 2));\n }\n return points.join(\" \");\n}", "generateBoundingBox(p1, p2) {\n let startTime = Date.now();\n let minX, minY, maxX, maxY;\n \n // Find min/max x values\n if (p1.x < p2.x) {\n minX = p1.x;\n maxX = p2.x;\n } else {\n minX = p2.x;\n maxX = p1.x;\n }\n\n // Find min/max y values\n if (p1.y < p2.y) {\n minY = p1.y;\n maxY = p2.y;\n } else {\n minY = p2.y;\n maxY = p1.y;\n }\n\n // Scale the BB so it's a more uniform square\n // This covers edge cases when the start and end points share an axis\n let slope = Math.abs((p2.y - p1.y) / (p2.x - p1.x));\n if (slope < 1) {\n // Scale Y values\n let deltaY = maxY - minY;\n let scale = deltaY / 5 * Math.abs((p2.x - p1.x) / (p2.y - p1.y));\n maxY += scale;\n minY -= scale;\n } else if (slope > 1) {\n // Scale X values\n let deltaX = maxX - minX;\n let scale = deltaX / 5 * slope;\n maxX += scale;\n minX -= scale;\n }\n\n this.boundingBox.topLeft = [minX, maxY];\n this.boundingBox.topRight = [maxX, maxY];\n this.boundingBox.bottomLeft = [minX, minY];\n this.boundingBox.bottomRight = [maxX, minY];\n\n this.timestamps.createBoundingBox = Date.now() - startTime;\n }", "function baseParams_2_extendedParams()\n {\n rg.b.value = 1- rg.a.value;\n setRgPoint( 'H', [ rg.A.pos[0] + rg.a.value, rg.O.pos[1] ] );\n }", "function getBranchCoords(bran,brs){\r\n\tvar i=0;\r\n\tvar adds = Math.floor((bran.length-1)/brs); \r\n\tvar lines= new Array();\r\n\tfor(i=0;i<brs-1;i++){\r\n\t\tvar j = 0;\r\n\t\tvar part = bran[i*adds + Math.round(adds*Math.random())];\r\n\t\tvar x = 0;\r\n\t\tvar y = 0;\r\n\t\tvar z = 0;\r\n\t\tvar len = part.length;\r\n\t\tfor(j=0;j<part.length;j++){\r\n\t\t\tx += part[j][0];\r\n\t\t\ty += part[j][1];\r\n\t\t\tz += part[j][2];\r\n\t\t}\r\n\t\tlines[i] = [x/len,y/len,z/len];\r\n\t}\r\n\treturn lines;\r\n}", "_splitPointsToBoundaries(splitPoints, textBuffer) {\n const boundaries = [];\n const lineCnt = textBuffer.getLineCount();\n const getLineLen = (lineNumber) => {\n return textBuffer.getLineLength(lineNumber);\n };\n // split points need to be sorted\n splitPoints = splitPoints.sort((l, r) => {\n const lineDiff = l.lineNumber - r.lineNumber;\n const columnDiff = l.column - r.column;\n return lineDiff !== 0 ? lineDiff : columnDiff;\n });\n // eat-up any split point at the beginning, i.e. we ignore the split point at the very beginning\n this._pushIfAbsent(boundaries, new position_1.Position(1, 1));\n for (let sp of splitPoints) {\n if (getLineLen(sp.lineNumber) + 1 === sp.column && sp.lineNumber < lineCnt) {\n sp = new position_1.Position(sp.lineNumber + 1, 1);\n }\n this._pushIfAbsent(boundaries, sp);\n }\n // eat-up any split point at the beginning, i.e. we ignore the split point at the very end\n this._pushIfAbsent(boundaries, new position_1.Position(lineCnt, getLineLen(lineCnt) + 1));\n // if we only have two then they describe the whole range and nothing needs to be split\n return boundaries.length > 2 ? boundaries : null;\n }", "function breadcrumbPoints(d, i) {\r\n var points = [];\r\n points.push(\"0,0\");\r\n if (b.w <= 0) {\r\n // calculate breadcrumb width based on string length\r\n points.push(d.string_length + \",0\");\r\n points.push(d.string_length + b.t + \",\" + (b.h / 2));\r\n points.push(d.string_length + \",\" + b.h);\r\n } else {\r\n points.push(b.w + \",0\");\r\n points.push(b.w + b.t + \",\" + (b.h / 2));\r\n points.push(b.w + \",\" + b.h);\r\n }\r\n points.push(\"0,\" + b.h);\r\n\r\n if (i > 0) { // Leftmost breadcrumb; don't include 6th vertex.\r\n points.push(b.t + \",\" + (b.h / 2));\r\n }\r\n return points.join(\" \");\r\n }", "function get_point_y(c) {\n\treturn 94 + c * 75;\n}", "constructor ({boundarySpacing=0} = {}) {\n let boundaryPoints = boundarySpacing > 0 ? addBoundaryPoints(boundarySpacing, 1000) : [];\n this.points = boundaryPoints;\n this.numBoundaryRegions = boundaryPoints.length;\n }", "function updatePos(pos, endpos) {\n var pipos = (pos/endpos)*2.5*Math.PI;\n return (Math.cos(pipos) + 1.04)*endpos/400;\n}", "function setAnimationPoints(){\n var a = vec4(0, 0, 0, 1);\n var b = vec4(-5, -25, 0, 1);\n var c = vec4(5, -25, 0, 1);\n var d = vec4(0, 0, 0, 1);\n var bezier = new Bezier([a, b, c, d]);\n animationPoints = bezier.vertices;\n}", "setBallPosition(minPosition, maxPosition){\n\n\t\tthis.ball= Math.floor(Math.random()* (maxPosition -minPosition+1);\n\n\t\n\t}", "function Bezier(idx, p0, p1, p2, p3){\n var cX = 3 * (p1.x - p0.x);\n var bX = 3 * (p2.x - p1.x) - cX;\n var aX = p3.x - p0.x - cX - bX;\n\n var cY = 3 * (p1.y - p0.y);\n var bY = 3 * (p2.y - p1.y) - cY;\n var aY = p3.y - p0.y - cY - bY;\n //x(t) = axt3 + bxt2 + cxt + x0\n this.x = (aX * Math.pow(idx, 3)) + (bX * Math.pow(idx, 2)) + (cX * idx) + p0.x;\n this.y = (aY * Math.pow(idx, 3)) + (bY * Math.pow(idx, 2)) + (cY * idx) + p0.y;\n \n}", "function _ibp() {\r\n var p = _pfa(arguments);\r\n if (p) {\r\n if (p.x + this.dim().w > self.dim().w + viewLeft())\r\n p.x = self.dim().w - this.dim().w + viewLeft();\r\n\r\n if (p.y + this.dim().h > self.dim().h + viewTop())\r\n p.y = self.dim().h - this.dim().h + viewTop();\r\n\r\n if (p.x < viewLeft())\r\n p.x = viewLeft();\r\n\r\n if (p.y < viewTop())\r\n p.y = viewTop();\r\n\r\n this.p = absPos(this, p);\r\n }\r\n return objCss(this, \"position\") == \"absolute\" ? this.p : absPos(this);\r\n}", "constructor(points, tension, cyclic, begin_curl, end_curl){\n this.points = [];\n for (const point of points){\n let x = point[0];\n let y = point[1];\n console.log(x,y);\n this.points.push(new HobbyPoint(x,y, tension));\n }\n this.ctrl_pts = [];\n this.is_cyclic = cyclic;\n this.begin_curl = begin_curl;\n this.end_curl = end_curl;\n this.num_points = points.length;\n }", "twistB() {\n this.fourCycle(this.cornerLoc, 2, 3, 5, 4, this.cornerOrient, 1, 2, 1, 2, 3);\n this.fourCycle(this.edgeLoc, 3, 4, 5, 7, this.edgeOrient, 1, 1, 1, 1, 2);\n this.sideOrient[5] = (this.sideOrient[5] + 3) % 4;\n }", "function bound() {\n ['top', 'bottom', 'tlc', 'left', 'blc', 'trc', 'right', 'brc'].forEach((piece) => {\n equilibriate(piece, 0, params.u0, 1);\n });\n}", "function AlphaPos () { }", "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 generatePointArrays()\r\n{\r\n\r\n dropPointsX = new Array();\r\n\r\n\r\n// deleted next line - used with early versions before floating menus\r\n// var bbxl = parseInt(document.getElementById(\"BreadboardDiv\").style.left);\r\n// we now have a component specific div with origin at top left of the total valid\r\n// component area, so we define bbxl and bby as zero (0)\r\n\tvar bbxl = 0;\r\n\r\n var bbwide = parseInt(document.getElementById(\"BreadboardDiv\").style.width);\r\n var lsmarg = 50;\r\n\r\n if(globalBreadBoardSize == \"AXE021V\")\r\n {\r\n var bbrows = 8; // bbrows = no spaces = No rows - 1\r\n var bbxr = 250;\r\n\t\tvar lsmarg = 152;\r\n }\r\n if(globalBreadBoardSize == \"STPBRD2\")\r\n {\r\n var bbrows = 18; // bbrows = no spaces = No rows - 1\r\n var bbxr = 25;\r\n\t\tvar lsmarg = 38;\r\n }\r\n if(globalBreadBoardSize == \"SMALL\")\r\n {\r\n var bbrows = 22; // bbrows = no spaces = No rows - 1\r\n var bbxr = 50;\r\n }\r\n if(globalBreadBoardSize == \"GADGETH\" )\r\n {\r\n var bbrows = 22;\r\n var bbxr = 173;\r\n var lsmarg = 93;\r\n }\r\n if(globalBreadBoardSize == \"DSEH5608\")\r\n {\r\n var bbrows = 24;\r\n var bbxr = 45;\r\n }\r\n if(globalBreadBoardSize == \"DATAK12-611B\")\r\n {\r\n var bbrows = 25;\r\n var bbxr = 48;\r\n }\r\n if(globalBreadBoardSize == \"KIWIP\")\r\n {\r\n var bbrows = 27;\r\n var bbxr = 173;\r\n var lsmarg = 125;\r\n }\r\n if(globalBreadBoardSize == \"SMALL2\")\r\n {\r\n var bbrows = 28; // bbrows = no spaces = No rows - 1\r\n var bbxr = 42;\r\n }\r\n if(globalBreadBoardSize == \"MEDIUM\")\r\n {\r\n var bbrows = 29;\r\n var bbxr = 51;\r\n }\r\n if(globalBreadBoardSize == \"DSEH5613P\" || globalBreadBoardSize == \"DSEH5613F\" )\r\n {\r\n var bbrows = 29;\r\n var bbxr = 49;\r\n \tvar lsmarg = 51\r\n }\r\n if(globalBreadBoardSize == \"SCHOOL\")\r\n {\r\n var bbrows = 31;\r\n var bbxr = 200;\r\n }\r\n if(globalBreadBoardSize == \"DEVBOARD-G1\")\r\n {\r\n\t\tlsmarg = 32;\r\n var bbrows = 20;\r\n var bbxr = 503;\r\n }\r\n if(globalBreadBoardSize == \"GADGETF\" )\r\n {\r\n var bbrows = 34;\r\n var bbxr = 102;\r\n var lsmarg = 80;\r\n }\r\n if(globalBreadBoardSize == \"LARGE\")\r\n {\r\n var bbrows = 37;\r\n var bbxr = 40;\r\n }\r\n if(globalBreadBoardSize == \"STPBRD1\")\r\n {\r\n var bbrows = 40;\r\n var bbxr = 22;\r\n\t\tvar lsmarg = 38;\r\n }\r\n if(globalBreadBoardSize == \"PROTOBLOC-1A\")\r\n {\r\n var bbrows = 42;\r\n var bbxr = 182;\r\n\t\tvar lsmarg = 213;\r\n }\r\n if(globalBreadBoardSize == \"BIGGER\")\r\n {\r\n var bbrows = 43;\r\n var bbxr = 38;\r\n }\r\n if(globalBreadBoardSize == \"DSEH5605\")\r\n {\r\n var bbrows = 44;\r\n var bbxr = 38;\r\n var lsmarg = 30;\r\n }\r\n if(globalBreadBoardSize == \"JaycarMini\")\r\n {\r\n var bbrows = 19;\r\n var bbxr = 154;\r\n var lsmarg = 105;\r\n }\r\n if(globalBreadBoardSize == \"JaycarHP9558\")\r\n {\r\n var bbrows = 33;\r\n var bbxr = 42;\r\n var lsmarg = 20;\r\n }\r\n if(globalBreadBoardSize == \"JaycarStripBrd\")\r\n {\r\n var bbrows = 33;\r\n var bbxr = 75;\r\n var lsmarg = 65;\r\n }\r\n if(globalBreadBoardSize == \"BIGGEST\")\r\n {\r\n var bbrows = 49;\r\n var bbxr = 34;\r\n }\r\n if(globalBreadBoardSize == \"PROTOBLOC-2A\")\r\n {\r\n var bbrows = 63;\r\n var bbxr = 44;\r\n }\r\n \tif(globalBreadBoardSize == \"FlexiStrip\") // variable sized stripboard\r\n {\r\n var bbrows = globalBBwidth - 1;\r\n var bbxr = 0 - 28;\r\n\t\tvar lsmarg = 12;\r\n\t\tbbwide = globalBBwidth * 27\r\n\t}\r\n \tif(globalBreadBoardSize == \"FingerBoard20x10\") // 20x10 Finger Board - Stan Swan SiChip article\r\n {\r\n var bbrows = 19;\r\n var bbxr = -2;\r\n\t\tvar lsmarg = 27;\r\n\t}\r\n\tif(globalBreadBoardSize == \"Datak12-600B\") // Datak Prototyping board == Altronics H0719\r\n {\r\n var bbrows = 50; // actually this board has 51 rows (not 50 per silk mask) ==> 0 - 50\r\n var bbxr = 65;\r\n\t\tvar lsmarg = 60;\r\n\t}\r\n\r\n\r\n\r\n// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \r\n\r\n var www = bbwide - 57 - bbxr;\r\n var xquant = www / bbrows;\r\n for(var i = 0; i <= bbrows; ++ i)\r\n {\r\n if(globalBreadBoardSize == \"SCHOOL\") // 23 rows plus right side parking area\r\n {\r\n if(i == 23) // leave a vertical gap at the right side of BB before off - board \"parking\" area\r\n {\r\n continue;\r\n }\r\n }\r\n if(globalBreadBoardSize == \"KIWIP\") // 23 rows plus left and right extras\r\n {\r\n if(i == 1 || i == 25 ) // leave a vertical gap both sides of the main board area\r\n {\r\n continue;\r\n }\r\n }\r\n if(globalBreadBoardSize == \"PROTOBLOC-1A\") // 30 rows plus left and right extras\r\n {\r\n if(i == 2 || i == 33 || i == 36 ) // leave a vertical gap both sides of the main board area\r\n {\r\n continue;\r\n }\r\n }\r\n if(globalBreadBoardSize == \"JaycarHP9558\") // 30 rows plus two extra offset at the left side\r\n {\r\n if(i == 2 || i == 3 ) // leave a vertical gap between left side extras and the main board area\r\n {\r\n continue;\r\n }\r\n }\r\n dropPointsX.push(Math.round(bbxl + lsmarg + (xquant * i)));\r\n }\r\n\r\n if(globalBreadBoardSize == \"DEVBOARD-G1\") // define some row in line with OLED displays for display location purposes\r\n {\r\n\t\tdropPointsX.push(Math.round(bbxl + lsmarg + (xquant * 22)));\r\n\t\tdropPointsX.push(Math.round(bbxl + lsmarg + (xquant * 26)));\r\n\t\tdropPointsX.push(Math.round(bbxl + lsmarg + (xquant * 30)));\r\n }\r\n\r\n// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \r\n\r\n dropPointsY = new Array();\r\n\tvar bbcols = 27; // 18 columns for standard breadboards, 1 space between BB and Parking area and 9 for parking area\r\n\r\n\tif (globalBBPower == \"Special2\")\r\n\t{\r\n\t\tbbcols = 39; // DSE-5613 protoboard has many extra columns of holes \r\n\t}\r\n\tif (globalBBPower == \"Special3\")\r\n\t{\r\n\t\tbbcols = 29; // Gadget half-board has one extra column of holes \r\n\t}\r\n\tif (globalBBPower == \"Special4\")\r\n\t{\r\n\t\tbbcols = 39; // Gadget full-board has many extra columns of holes \r\n\t}\r\n\tif (globalBBPower == \"Special5\")\r\n\t{\r\n\t\tbbcols = 36; // 4D SYstem DevBoard G1 \r\n\t}\r\n\tif (globalBBPower == \"Special6\")\r\n\t{\r\n\t\tbbcols = 45; // Futurlec stripboards STPBRD1 and STPBRD2 \r\n\t}\r\n\tif (globalBBPower == \"Special7\")\r\n\t{\r\n\t\tbbcols = 26; // DATAK 12-611B protoboard \r\n\t}\r\n\tif (globalBBPower == \"Special8\")\r\n\t{\r\n\t\tbbcols = 40; // Protobloc 1A Breadboard \r\n\t}\r\n\tif (globalBBPower == \"AXE021V-11\")\r\n\t{\r\n\t\tbbcols = 21; // AXE021 in vertical oientation\r\n\t}\r\n\tif (globalBBPower == \"DoubleBB\")\r\n\t{\r\n\t\tbbcols = 46; // Double BBs side by side \r\n\t}\r\n\tif (globalBBPower == \"JaycarMini\")\r\n\t{\r\n\t\tbbcols = 26; // Jaycar HP9556 Mini Proto Board\r\n\t}\r\n\tif (globalBBPower == \"JaycarHP9558\")\r\n\t{\r\n\t\tbbcols = 59; // Jaycar HP95586 Large Proto Board\r\n\t}\r\n\tif (globalBBPower == \"JaycarHP9540\")\r\n\t{\r\n\t\tbbcols = 39; // Jaycar Proto Board\r\n\t}\r\n\tif (globalBBPower == \"JaycarHP9542\")\r\n\t{\r\n\t\tbbcols = 69; // Jaycar Large Proto Board\r\n\t}\r\n\tif (globalBBPower == \"JaycarHP9544\")\r\n\t{\r\n\t\tbbcols = 129; // Jaycar Very Large Proto Board\r\n\t}\r\n\tif (globalBBPower == \"FlexiStrip\")\r\n\t{\r\n\t\tbbcols = globalBBheight * 1 + 9; // variable sized stripboard\r\n\t}\r\n \tif (globalBBPower == \"FingerBoard\")\r\n\t{\r\n\t\tbbcols = 20 ; // 20x10 Finger Board for Stan Swan SiChip Article\r\n\t}\r\n \tif (globalBBPower == \"Datak12-600B\")\r\n\t{\r\n\t\tbbcols = 50 ; // Datak 12-600B / Altronics H0719 proto board\r\n\t}\r\n\r\n// here for checking if there is a top off-board area or not)\r\n\r\n\r\n var yquant = (457 - 45) / 15;\r\n\r\n if(globalTopParkVisible == \"true\" || globalTopParkVisible == true)\r\n {\r\n\tvar topadj = 38; // use this value for the top off-board area only\r\n\r\n// deleted next line - used with early versions before floating menus\r\n// var bby = parseInt(document.getElementById(\"TopparkboardDiv\").style.top);\r\n// we now have a component specific div with origin at top left of the total valid\r\n// component area, so we define bbxl and bby as zero (0)\r\n\tvar bby = 0;\r\n\r\n\r\n for(var m = 0; m <= 8; ++ m)\r\n {\r\n \t dropPointsY.push(Math.round(bby + topadj + (yquant * m)));\r\n }\r\n topadj = 313; // and then modify the top adjust value for the actual breadboard and lower off-board area\r\n }\r\n else\r\n {\r\n\tvar topadj = 18 // now 18 was 45 now 27 less for extra row at top as standard\r\n\r\n\r\n//\r\n//\tvar bby = parseInt(document.getElementById(\"BreadboardDiv\").style.top);\r\n\tvar bby = 0;\r\n }\r\n\r\n if(globalBBPower == \"Special6\")\r\n {\r\n\t\t\tvar topadj = topadj + 21 // var topadj = 39;\r\n\t\t\tvar yquant = (935-39)/33; \r\n\t\t}\r\n if(globalBBPower == \"Special7\")\r\n {\r\n\t\t\tvar topadj = topadj + 8 // var topadj = 26;\r\n\t\t//\tvar yquant = (430-28)/15; \r\n\t\t}\r\n if(globalBBPower == \"Special8\")\r\n {\r\n\t\t\tvar topadj = topadj + 24 // var topadj = 42;\r\n\t\t//\tvar yquant = (430-28)/15; \r\n\t\t}\r\n if(globalBBPower == \"AXE021V-11\")\r\n {\r\n\t\t\tvar topadj = topadj + 279 // var topadj = 297;\r\n\t\t//\tvar yquant = 270 / 10; \r\n\t\t}\r\n\r\n\t\tif (globalBBPower == \"FlexiStrip\")\r\n {\r\n\t\t\tvar topadj = topadj + 21 - 29 // var topadj = 39;\r\n\t\t\tvar yquant = (935-39)/33; \r\n\t\t}\r\n\t\tif (globalBBPower == \"JaycarMini\")\r\n\t\t{\r\n\t\t\tvar topadj = topadj + 22 // var topadj = 40;\r\n\t\t}\r\n\t\tif (globalBBPower == \"JaycarHP9558\")\r\n\t\t{\r\n\t\t\tvar topadj = topadj + 14 // var topadj = 32;\r\n\t\t\tvar yquant = 27;\r\n\t\t}\r\n \tif(globalBreadBoardSize == \"JaycarStripBrd\")\r\n\t\t{\r\n\t\t\tvar topadj = topadj - 8 // + 14 // var topadj = 32;\r\n\t\t\tvar yquant = 3232/119;\r\n\t\t}\r\n \tif(globalBreadBoardSize == \"FingerBoard20x10\")\r\n\t\t{\r\n\t\t\tvar topadj = topadj + 6 // var topadj = 24;\r\n\t\t\t // var yquant = 296/11;\r\n\t\t}\r\n \tif(globalBreadBoardSize == \"Datak12-600B\")\r\n\t\t{\r\n\t\t\tvar topadj = topadj + 29 // var topadj = 47;\r\n\t\t\t var yquant = 1070 / 39;\r\n\t\t}\r\n\r\n// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \r\n\r\n for(var m = 0; m <= bbcols; ++ m)\r\n {\r\n if(globalBBPower == \"Single\") // single outer rails and no inner rails\r\n {\r\n if(m == 0 || m == 2 || m == 8 || m == 9 || m == 15 || m == 17 || m == 18)\r\n {\r\n continue;\r\n }\r\n }\r\n if(globalBBPower == \"Double\") // double outer rails and no inner rails\r\n {\r\n if(m == 2 || m == 8 || m == 9 || m == 15 || m == 18)\r\n {\r\n continue;\r\n }\r\n }\r\n if(globalBBPower == \"Triple\") // double outer rails plus double inner rails\r\n {\r\n if(m == 2 || m == 15 || m == 18)\r\n {\r\n continue;\r\n }\r\n }\r\n if(globalBBPower == \"KiwiFull\") // offset double outer rails plus double inner rails\r\n {\r\n if(m == 0 || m == 17 || m == 18)\r\n {\r\n continue;\r\n } \r\n }\r\n if (globalBBPower == \"Special1\") // there are no spare sets of holes for DSEH5613\r\n {\r\n if(m == 18) // only unused row is between board and off-board parking area\r\n {\r\n continue;\r\n }\r\n }\r\n if (globalBBPower == \"Special2\") // there are no spare sets of holes for DSEH5613\r\n {\r\n if(m == 30) // only unused row is between board and off-board parking area\r\n {\r\n continue;\r\n }\r\n }\r\n if (globalBBPower == \"Special3\") // there are no spare sets of central holes for Gadget half board\r\n {\r\n if(m == 0 || m == 1 || m == 19)\r\n {\r\n continue;\r\n }\r\n }\r\n if (globalBBPower == \"Special4\") // there are no spare sets of central holes for Gadget full board\r\n {\r\n if(m == 0 || m == 1 || m == 26 || m == 27 || m == 28 || m == 29 )\r\n {\r\n continue;\r\n }\r\n }\r\n if (globalBBPower == \"Special5\") // special config for the 4D Systems Devboard G1 to permit displays and jumpers\r\n {\r\n if(m == 1 || m == 2 || m == 6 || m == 10 || m == 11 || m == 13 || m == 19 || m == 20 || m == 26 )\r\n {\r\n continue;\r\n }\r\n }\r\n if (globalBBPower == \"Special6\") // Futurlec small and large stripboards\r\n {\r\n if(m == 34 || m == 35 )\r\n {\r\n continue;\r\n }\r\n }\r\n if (globalBBPower == \"Special7\") // Dick SMith / Datak stripboard\r\n {\r\n if(m == 16)\r\n {\r\n continue;\r\n }\r\n }\r\n if (globalBBPower == \"Special8\") // special config for the 4D Systems Devboard G1 to permit displays and jumpers\r\n {\r\n if(m == 6 || m == 7 || m == 14 || m == 15 || m == 22 || m == 23 || m == 30 )\r\n {\r\n continue;\r\n }\r\n }\r\n if (globalBBPower == \"AXE021V-11\") // special config for the 4D Systems Devboard G1 to permit displays and jumpers\r\n {\r\n if(m == 11 || m == 12 )\r\n {\r\n continue;\r\n }\r\n }\r\n if(globalBBPower == \"DoubleBB\") // double outer rails and no inner rails with two BB's side by side\r\n {\r\n if(m == 2 || m == 8 || m == 9 || m == 15 || m == 18)\r\n {\r\n continue;\r\n }\r\n if(m == 21 || m == 27 || m == 28 || m == 34 || m == 37)\r\n {\r\n continue;\r\n }\r\n\r\n }\r\n\t\tif (globalBBPower == \"FlexiStrip\") // variable sized stripboard\r\n {\r\n\r\n if(m == globalBBheight)\r\n {\r\n continue;\r\n }\r\n\t\t}\r\n\t\tif (globalBBPower == \"JaycarMini\")\r\n if(m == 16 || m == 17 )\r\n {\r\n continue;\r\n }\r\n\t\tif (globalBBPower == \"JaycarHP9558\")\r\n if(m == 50 )\r\n {\r\n continue;\r\n }\r\n\r\n\t\tif (globalBBPower == \"JaycarHP9540\")\r\n if(m == 30 )\r\n {\r\n continue;\r\n }\r\n\t\tif (globalBBPower == \"JaycarHP9542\")\r\n if(m == 60 )\r\n {\r\n continue;\r\n }\r\n\t\tif (globalBBPower == \"JaycarHP9544\")\r\n if(m == 120 )\r\n {\r\n continue;\r\n }\r\n\t\tif (globalBBPower == \"FingerBoard\")\r\n if(m == 10 )\r\n {\r\n continue;\r\n }\r\n\t\tif (globalBBPower == \"Datak12-600B\")\r\n if(m == 40 || m == 41 )\r\n {\r\n continue;\r\n }\r\n\r\n\r\n dropPointsY.push(Math.round(bby + topadj + (yquant * m)));\r\n\r\n }\r\n}", "function posfor(x, y, axis) {\n if (axis == 0) return x * 9 + y;\n if (axis == 1) return y * 9 + x;\n return [0,3,6,27,30,33,54,57,60][x] + [0,1,2,9,10,11,18,19,20][y];\n}", "function posfor(x, y, axis) {\n if (axis == 0) return x * 9 + y;\n if (axis == 1) return y * 9 + x;\n return [0,3,6,27,30,33,54,57,60][x] + [0,1,2,9,10,11,18,19,20][y];\n}", "function mxShapeArrows2BendArrow(bounds, fill, stroke, strokewidth)\n{\n\tmxShape.call(this);\n\tthis.bounds = bounds;\n\tthis.fill = fill;\n\tthis.stroke = stroke;\n\tthis.strokewidth = (strokewidth != null) ? strokewidth : 1;\n\tthis.dy = 0.5;\n\tthis.dx = 0.5;\n\tthis.notch = 0;\n\tthis.arrowHead = 40;\n}", "function Bx(t) { return (1-t)*(1-t)*x1 + 2*(1-t)*t*x3 + t*t*x2; }", "function Bendpoints(eventBus, canvas, interactionEvents, bendpointMove, connectionSegmentMove) {\n /**\n * Returns true if intersection point is inside middle region of segment, adjusted by\n * optional threshold\n */\n function isIntersectionMiddle(intersection, waypoints, treshold) {\n var idx = intersection.index,\n p = intersection.point,\n p0,\n p1,\n mid,\n aligned,\n xDelta,\n yDelta;\n\n if (idx <= 0 || intersection.bendpoint) {\n return false;\n }\n\n p0 = waypoints[idx - 1];\n p1 = waypoints[idx];\n mid = getMidPoint(p0, p1), aligned = pointsAligned(p0, p1);\n xDelta = Math.abs(p.x - mid.x);\n yDelta = Math.abs(p.y - mid.y);\n return aligned && xDelta <= treshold && yDelta <= treshold;\n }\n /**\n * Calculates the threshold from a connection's middle which fits the two-third-region\n */\n\n\n function calculateIntersectionThreshold(connection, intersection) {\n var waypoints = connection.waypoints,\n relevantSegment,\n alignment,\n segmentLength,\n threshold;\n\n if (intersection.index <= 0 || intersection.bendpoint) {\n return null;\n } // segment relative to connection intersection\n\n\n relevantSegment = {\n start: waypoints[intersection.index - 1],\n end: waypoints[intersection.index]\n };\n alignment = pointsAligned(relevantSegment.start, relevantSegment.end);\n\n if (!alignment) {\n return null;\n }\n\n if (alignment === 'h') {\n segmentLength = relevantSegment.end.x - relevantSegment.start.x;\n } else {\n segmentLength = relevantSegment.end.y - relevantSegment.start.y;\n } // calculate threshold relative to 2/3 of segment length\n\n\n threshold = calculateSegmentMoveRegion(segmentLength) / 2;\n return threshold;\n }\n\n function activateBendpointMove(event, connection) {\n var waypoints = connection.waypoints,\n intersection = getConnectionIntersection(canvas, waypoints, event),\n threshold;\n\n if (!intersection) {\n return;\n }\n\n threshold = calculateIntersectionThreshold(connection, intersection);\n\n if (isIntersectionMiddle(intersection, waypoints, threshold)) {\n connectionSegmentMove.start(event, connection, intersection.index);\n } else {\n bendpointMove.start(event, connection, intersection.index, !intersection.bendpoint);\n } // we've handled the event\n\n\n return true;\n }\n\n function bindInteractionEvents(node, eventName, element) {\n componentEvent.bind(node, eventName, function (event) {\n interactionEvents.triggerMouseEvent(eventName, event, element);\n event.stopPropagation();\n });\n }\n\n function getBendpointsContainer(element, create$1) {\n var layer = canvas.getLayer('overlays'),\n gfx = query('.djs-bendpoints[data-element-id=\"' + css_escape(element.id) + '\"]', layer);\n\n if (!gfx && create$1) {\n gfx = create('g');\n attr$1(gfx, {\n 'data-element-id': element.id\n });\n classes$1(gfx).add('djs-bendpoints');\n append(layer, gfx);\n bindInteractionEvents(gfx, 'mousedown', element);\n bindInteractionEvents(gfx, 'click', element);\n bindInteractionEvents(gfx, 'dblclick', element);\n }\n\n return gfx;\n }\n\n function getSegmentDragger(idx, parentGfx) {\n return query('.djs-segment-dragger[data-segment-idx=\"' + idx + '\"]', parentGfx);\n }\n\n function createBendpoints(gfx, connection) {\n connection.waypoints.forEach(function (p, idx) {\n var bendpoint = addBendpoint(gfx);\n append(gfx, bendpoint);\n translate(bendpoint, p.x, p.y);\n }); // add floating bendpoint\n\n addBendpoint(gfx, 'floating');\n }\n\n function createSegmentDraggers(gfx, connection) {\n var waypoints = connection.waypoints;\n var segmentStart, segmentEnd, segmentDraggerGfx;\n\n for (var i = 1; i < waypoints.length; i++) {\n segmentStart = waypoints[i - 1];\n segmentEnd = waypoints[i];\n\n if (pointsAligned(segmentStart, segmentEnd)) {\n segmentDraggerGfx = addSegmentDragger(gfx, segmentStart, segmentEnd);\n attr$1(segmentDraggerGfx, {\n 'data-segment-idx': i\n });\n bindInteractionEvents(segmentDraggerGfx, 'mousemove', connection);\n }\n }\n }\n\n function clearBendpoints(gfx) {\n forEach(all('.' + BENDPOINT_CLS, gfx), function (node) {\n remove$1(node);\n });\n }\n\n function clearSegmentDraggers(gfx) {\n forEach(all('.' + SEGMENT_DRAGGER_CLS, gfx), function (node) {\n remove$1(node);\n });\n }\n\n function addHandles(connection) {\n var gfx = getBendpointsContainer(connection);\n\n if (!gfx) {\n gfx = getBendpointsContainer(connection, true);\n createBendpoints(gfx, connection);\n createSegmentDraggers(gfx, connection);\n }\n\n return gfx;\n }\n\n function updateHandles(connection) {\n var gfx = getBendpointsContainer(connection);\n\n if (gfx) {\n clearSegmentDraggers(gfx);\n clearBendpoints(gfx);\n createSegmentDraggers(gfx, connection);\n createBendpoints(gfx, connection);\n }\n }\n\n function updateFloatingBendpointPosition(parentGfx, intersection) {\n var floating = query('.floating', parentGfx),\n point = intersection.point;\n\n if (!floating) {\n return;\n }\n\n translate(floating, point.x, point.y);\n }\n\n function updateSegmentDraggerPosition(parentGfx, intersection, waypoints) {\n var draggerGfx = getSegmentDragger(intersection.index, parentGfx),\n segmentStart = waypoints[intersection.index - 1],\n segmentEnd = waypoints[intersection.index],\n point = intersection.point,\n mid = getMidPoint(segmentStart, segmentEnd),\n alignment = pointsAligned(segmentStart, segmentEnd),\n draggerVisual,\n relativePosition;\n\n if (!draggerGfx) {\n return;\n }\n\n draggerVisual = getDraggerVisual(draggerGfx);\n relativePosition = {\n x: point.x - mid.x,\n y: point.y - mid.y\n };\n\n if (alignment === 'v') {\n // rotate position\n relativePosition = {\n x: relativePosition.y,\n y: relativePosition.x\n };\n }\n\n translate(draggerVisual, relativePosition.x, relativePosition.y);\n }\n\n eventBus.on('connection.changed', function (event) {\n updateHandles(event.element);\n });\n eventBus.on('connection.remove', function (event) {\n var gfx = getBendpointsContainer(event.element);\n\n if (gfx) {\n remove$1(gfx);\n }\n });\n eventBus.on('element.marker.update', function (event) {\n var element = event.element,\n bendpointsGfx;\n\n if (!element.waypoints) {\n return;\n }\n\n bendpointsGfx = addHandles(element);\n\n if (event.add) {\n classes$1(bendpointsGfx).add(event.marker);\n } else {\n classes$1(bendpointsGfx).remove(event.marker);\n }\n });\n eventBus.on('element.mousemove', function (event) {\n var element = event.element,\n waypoints = element.waypoints,\n bendpointsGfx,\n intersection;\n\n if (waypoints) {\n bendpointsGfx = getBendpointsContainer(element, true);\n intersection = getConnectionIntersection(canvas, waypoints, event.originalEvent);\n\n if (!intersection) {\n return;\n }\n\n updateFloatingBendpointPosition(bendpointsGfx, intersection);\n\n if (!intersection.bendpoint) {\n updateSegmentDraggerPosition(bendpointsGfx, intersection, waypoints);\n }\n }\n });\n eventBus.on('element.mousedown', function (event) {\n var originalEvent = event.originalEvent,\n element = event.element;\n\n if (!element.waypoints) {\n return;\n }\n\n return activateBendpointMove(originalEvent, element);\n });\n eventBus.on('selection.changed', function (event) {\n var newSelection = event.newSelection,\n primary = newSelection[0];\n\n if (primary && primary.waypoints) {\n addHandles(primary);\n }\n });\n eventBus.on('element.hover', function (event) {\n var element = event.element;\n\n if (element.waypoints) {\n addHandles(element);\n interactionEvents.registerEvent(event.gfx, 'mousemove', 'element.mousemove');\n }\n });\n eventBus.on('element.out', function (event) {\n interactionEvents.unregisterEvent(event.gfx, 'mousemove', 'element.mousemove');\n }); // update bendpoint container data attribute on element ID change\n\n eventBus.on('element.updateId', function (context) {\n var element = context.element,\n newId = context.newId;\n\n if (element.waypoints) {\n var bendpointContainer = getBendpointsContainer(element);\n\n if (bendpointContainer) {\n attr$1(bendpointContainer, {\n 'data-element-id': newId\n });\n }\n }\n }); // API\n\n this.addHandles = addHandles;\n this.updateHandles = updateHandles;\n this.getBendpointsContainer = getBendpointsContainer;\n this.getSegmentDragger = getSegmentDragger;\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 bezier() {\n\n ctx = this;\n ctx.lineWidth = this.curve_thickness;\n ctx.strokeStyle = this.bezier_color;\n /**check for correct number of arguments*/\n if (arguments.length % 2 != 0 || arguments.length < 4) {\n throw \"Incorrect number of points \" + arguments.length;\n }\n\n //transform initial arguments into an {Array} of [x,y] coordinates\n var initialPoints = [];\n for (var i = 0; i < arguments.length; i = i + 2) {\n initialPoints.push([arguments[i], arguments[i + 1]]);\n }\n\n function distance(a, b) {\n return Math.sqrt(Math.pow(a[0] - b[0], 2) + Math.pow(a[1] - b[1], 2));\n }\n\n /**Computes the drawing/support points for the Bezier curve*/\n function computeSupportPoints(points) {\n\n /**Computes factorial*/\n function fact(k) {\n if (k == 0 || k == 1) {\n return 1;\n } else {\n return k * fact(k - 1);\n }\n }\n\n /**Computes Bernstain\n *@param {Integer} i - the i-th index\n *@param {Integer} n - the total number of points\n *@param {Number} t - the value of parameter t , between 0 and 1\n **/\n function B(i, n, t) {\n //if(n < i) throw \"Wrong\";\n return fact(n) / (fact(i) * fact(n - i)) * Math.pow(t, i) * Math.pow(1 - t, n - i);\n }\n\n\n /**Computes a point's coordinates for a value of t\n *@param {Number} t - a value between o and 1\n *@param {Array} points - an {Array} of [x,y] coodinates. The initial points\n **/\n function P(t, points) {\n var r = [0, 0];\n var n = points.length - 1;\n for (var i = 0; i <= n; i++) {\n r[0] += points[i][0] * B(i, n, t);\n r[1] += points[i][1] * B(i, n, t);\n }\n return r;\n }\n\n\n /**Compute the incremental step*/\n var tLength = 0;\n for (var i = 0; i < points.length - 1; i++) {\n tLength += distance(points[i], points[i + 1]);\n }\n var step = 1 / tLength;\n\n //compute the support points\n var temp = [];\n for (var t = 0; t <= 1; t = t + step) {\n var p = P(t, points);\n temp.push(p);\n }\n return temp;\n }\n\n /**Generic paint curve method*/\n function paintCurve(points) {\n ctx.save();\n\n ctx.beginPath();\n ctx.moveTo(points[0][0], points[0][1]);\n for (var i = 1; i < points.length; i++) {\n ctx.lineTo(points[i][0], points[i][1]);\n }\n ctx.stroke();\n ctx.restore();\n }\n\n var supportPoints = computeSupportPoints(initialPoints);\n paintCurve(supportPoints);\n}" ]
[ "0.6731586", "0.6204395", "0.6165572", "0.6045086", "0.6009413", "0.59384155", "0.5921679", "0.59192485", "0.5889758", "0.58740854", "0.58181715", "0.58097786", "0.5790465", "0.57809985", "0.5769285", "0.5757061", "0.5715059", "0.56950915", "0.5672013", "0.5658654", "0.5606313", "0.56015635", "0.5580816", "0.555212", "0.554054", "0.55098283", "0.55026793", "0.55008674", "0.55004716", "0.54953337", "0.5492936", "0.5474905", "0.5474905", "0.5472255", "0.5463992", "0.5456276", "0.5454593", "0.5440091", "0.54397154", "0.5417871", "0.5407256", "0.5399378", "0.53969425", "0.5396928", "0.539604", "0.539542", "0.53943604", "0.5392015", "0.53735346", "0.535647", "0.5356427", "0.5346812", "0.53406453", "0.5336497", "0.5330854", "0.5330243", "0.5330243", "0.5330243", "0.53250724", "0.53071046", "0.5293007", "0.52901447", "0.52892685", "0.5287372", "0.52837193", "0.52809376", "0.5279271", "0.52746135", "0.5272311", "0.5271495", "0.5265085", "0.5263377", "0.52581835", "0.52536714", "0.525217", "0.5249921", "0.52319175", "0.52279675", "0.52279496", "0.5217698", "0.5212641", "0.52094865", "0.520799", "0.52012026", "0.5197999", "0.5197244", "0.5195831", "0.51797235", "0.51785827", "0.51775485", "0.5176712", "0.5176712", "0.5176017", "0.51649827", "0.51649827", "0.5159303", "0.5156943", "0.5156361", "0.51541597", "0.5153195" ]
0.6479256
1
Store the username and accessToken here so that it can be passed down to each corresponding child view.
login(username, accessToken) { this.setState({ username: username, accessToken: accessToken }); this.update(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "auth_user_data(state, user){\n state.auth_user = user\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 }", "function setUser(req, res, next) {\n if (!req.cookies) { return next(); }\n var token = req.cookies['access_token'];\n var expires = moment(req.cookies['expires']);\n if (token && expires) {\n OAuthAccessTokensModel.findOne({ accessToken: token, clientId: _clientId }, function(err, result) {\n if (!err && result) {\n req.username = result.userId;\n req.accessToken = token;\n }\n next();\n });\n }\n else { return next(); }\n}", "onLoggedIn(authData) {\n this.props.setUser(authData.user);\n localStorage.setItem('token', authData.token);\n localStorage.setItem('user' , authData.user.Username);\n }", "async handleAuth() {\n if (!this.API)\n return;\n // handle authorize and try to get the access_token\n const accessToken = await this.API.handleAuth();\n if (accessToken) {\n // new access_token\n this.setAccessToken(accessToken);\n this.user = await this.API.getUser({ accessToken });\n }\n else if (this.getAccessToken()) {\n // have access_token in localstorage\n this.user = await this.API.getUser({ accessToken: this.accessToken });\n }\n else {\n // no access_token\n this.setAccessToken(null);\n this.user = null;\n }\n }", "AUTH_USER (state, userData) {\n state.idToken = userData.token\n state.userId = userData.userId\n }", "authUser (state, userData) {\n \t\tstate.idToken = userData.token\n \t\tstate.userId = userData.userId\n \t}", "authUser (state, userData) {\n state.token = userData.token\n state.userId = userData.userId\n state.refreshToken = userData.refreshToken\n }", "function globalViewData(req, res, next) {\n res.ViewData = res.ViewData || {};\n res.ViewData.username = \"\"; \n if (req.session.user) {\n res.ViewData.username = req.session.user.username;\n }\n next();\n }", "onLoggedIn(authData) {\n console.log(authData);\n this.setState({\n user: authData.user.Username\n });\n\n localStorage.setItem('token', authData.token);\n localStorage.setItem('user', authData.user.Username);\n this.getMovies(authData.token);\n }", "static save(accessToken) {\n Authentication.accessToken = accessToken;\n }", "login(state, { username, token }) {\n state.currentUser = {\n username: username,\n token: token,\n };\n\n localStorage.trckrCurrentUser = JSON.stringify(state.currentUser);\n }", "async setCredentials() {\n\t\tif (this.state.save) {\n\t\t\tawait AsyncStorage.setItem('username', this.state.username);\n\t\t\tawait AsyncStorage.setItem('password', this.state.password);\n\t\t}\n\t\telse {\n\t\t\tawait AsyncStorage.setItem('username', '');\n\t\t\tawait AsyncStorage.setItem('password', '');\n\t\t}\n\t}", "async setUserData() {\n\t\tvar userinfo;\n\t\tawait AppX.fetch('User', 'self').then(async result => {\n\t\t\tvar info = result.data;\n\t\t\tglobal.userLogin = info.login;\n\n\t\t\tawait AppX.fetch('OrganizationDetail', info.organizationUid).then(result => {\n\t\t\t\tglobal.userOrgName = result.data.name;\n\t\t\t});\n\n\t\t});\n\t}", "login (state, user_info) {\n state.user_info.user_name = user_info.user_name;\n state.user_info.user_id = user_info.user_id.toString();\n }", "initializeHomePage(state, data) {\n state.userName = data.userName;\n }", "async getCredentials() {\n\t\tvar username = await AsyncStorage.getItem('username');\n\t\tvar password = await AsyncStorage.getItem('password');\n\t\tif (username) {\n\t\t\tthis.setState({\n\t\t\t\tsave: true,\n\t\t\t\tusername: username,\n\t\t\t\tpassword: password\n\t\t\t});\n\t\t}\n\t}", "__defineHandlers__() {\n self = this;\n this.auth.onAuthStateChanged(\n function (user) {\n if (user == null) {\n //console.log(\"state: logged out\");\n // show logged out view\n this.login_state = 0;\n } else {\n //console.log(\"state: logged in\");\n // show logged in view\n this.unsafe_user = user;\n this.primary = new User(user);\n this.login_state = 1;\n }\n this.refresh_view(user);\n }.bind(self)\n );\n }", "onLoggedIn(authData) {\n console.log(authData);\n this.props.setUser(authData.user.Username);\n\n localStorage.setItem('token', authData.token);\n localStorage.setItem('user', authData.user.Username);\n this.getMovies(authData.token);\n }", "connectAccount(){\n\n\n \n this.props.showLoading(true);\n let access_token;\n AsyncStorage.getItem(\"token\").then((value) => {\n if(value) {\n\n access_token=value;\n \n\n }\n else {\n\n \n }\n }).done();\n AsyncStorage.getItem(\"userId\").then((value) => {\n if(value) {\n\n\n console.log('userId if='+access_token);\n console.log('data if='+this.state.data);\n console.log('token if='+this.state.plaidToken);\n console.log('accountId if='+this.state.accountId);\n\n var user={\n authToken:access_token,\n userId:value,\n token:this.state.plaidToken,\n accountId:this.state.accountId,\n metadata:JSON.stringify(this.state.metaData)\n \n };\n console.log('connect USER='+JSON.stringify(user));\n this.props.connectBank(user);\n\n }\n else {\n\n console.log('userId else='+value);\n }\n }).done();\n\n\n }", "onLoggedIn(authData) {\n\t\tconsole.log(authData);\n\t\tthis.setState({\n\t\t\tuser: authData.user.Username,\n\t\t});\n\n\t\tlocalStorage.setItem('token', authData.token);\n\t\tlocalStorage.setItem('user', authData.user.Username);\n\t\tthis.getMovies(authData.token);\n\t}", "setAuth(state, userData) {\n state.authenticated = true\n localStorage.setItem('id_token', userData.id_token)\n if (userData.refresh_token) {\n localStorage.setItem('refresh', userData.refresh_token)\n }\n ApiService\n .setHeader(userData.id_token)\n }", "async setAccessToken(accessToken) {\n /*console.log('set accessToken: ', accessToken);*/\n\n await AsyncStorage.setItem(\n `${this.namespace}:${storegeKey}`,\n JSON.stringify(accessToken),\n );\n }", "get accessToken() {\n\t\treturn this.#_accessToken;\n\t}", "get accessToken() {\n return this.get(ACCESS_TOKEN_STORAGE_KEY);\n }", "get user() { return this.user_; }", "async function getUserInfo() {\n let userData = await Auth.currentAuthenticatedUser();\n setUser(userData.username);\n setUserEmail(userData.attributes.email);\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 setUserData() {\n //TODO: for non-social logins - userService is handling this - not a current issue b/c there is no data for these right after reg, but needs to be consistent!\n authService.setUserCUGDetails();\n authService.setUserLocation();\n authService.setUserPreferences();\n authService.setUserBio();\n authService.setUserBookings();\n authService.setUserFavorites();\n authService.setUserReviews();\n authService.setSentryUserContext();\n authService.setSessionStackUserContext();\n\n //was a noop copied from register controller: vm.syncProfile();\n }", "handleLoginChange(token, user) {\n this.setState({\n accessToken: token,\n user: user\n });\n }", "setUsername(username){\n this._username = username;\n }", "async retrieveDetails() {\n const response = await axios.get(`${BASE_URL}/users/${this.username}`, {\n params: {\n token: this.loginToken\n }\n });\n\n // update all of the user's properties from the API response\n this.name = response.data.user.name;\n this.createdAt = response.data.user.createdAt;\n this.updatedAt = response.data.user.updatedAt;\n\n // remember to convert the user's favorites and ownStories into instances of Story\n this.favorites = response.data.user.favorites.map(s => new Story(s));\n this.ownStories = response.data.user.stories.map(s => new Story(s));\n\n return this;\n }", "function setUser(){\n var user = JSON.parse(urlBase64Decode(getToken().split('.')[1]));\n o.status.username = user.username;\n o.status._id = user._id;\n console.log(o.status);\n }", "get userName() {\n return this._data.user_login;\n }", "get userName() {\n return this._data.user_login;\n }", "function saveUserData(userData) {\n localStorage.setItem('username', userData.username);\n localStorage.setItem('accessToken', userData.accessToken);\n localStorage.setItem('id', userData.id);\n username = userData.username;\n accessToken = userData.accessToken;\n }", "_handleLoginResponse(responseJson) {\n if (responseJson.objectId != null) {\n this._saveToLocalStorage(\"serverUrl\", this.state.serverUrl); //Save server url to local storage for future use\n this._saveToLocalStorage(\"userId\", responseJson.objectId); //Save User object id to local storage for future use\n this.props.navigation.navigate(\"App\"); //User is now logged in, redirect to app stack\n } else {\n console.error(responseJson); //Got empty response, log error\n }\n }", "function saveUserCredentialsInLocalStorage() {\n console.debug(\"saveUserCredentialsInLocalStorage\");\n if (currentUser) {\n localStorage.setItem(\"token\", currentUser.loginToken);\n localStorage.setItem(\"username\", currentUser.username);\n }\n}", "set accessToken(value) {\n if (value === null) {\n this.remove(ACCESS_TOKEN_STORAGE_KEY);\n } else {\n this.set(ACCESS_TOKEN_STORAGE_KEY, value);\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 }", "currentUser(state, user) {\n state.currentUser = user;\n }", "changeLoginState (response) {\n console.log('Welcome! Fetching your information.... ');\n FB.api('/me', function(meInfo) {\n\n console.log('Successful login for: ' + meInfo.name);\n let assembledMe = Object.assign({}, meInfo, response);\n this.props.dispatchLoginUser(assembledMe);\n // REQUEST ENDPOINT FOR SAVING USERS\n // 'http://localhost:8000/saveUser'\n // ALSO SET SESSION FROM HERE IN FUTURE\n this.requestForStorage(response);\n\n }.bind(this));\n }", "componentDidMount(){\n const idToken = JSON.parse(localStorage.getItem('okta-token-storage'));\n this.setState({\n currentUserEmail: idToken.idToken.claims.email,\n currentUserName: idToken.idToken.claims.name\n })\n}", "function saveUserCredentialsInLocalStorage() {\n console.debug('saveUserCredentialsInLocalStorage');\n if (currentUser) {\n localStorage.setItem('token', currentUser.loginToken);\n localStorage.setItem('username', currentUser.username);\n }\n}", "saveUsername() {\n var username = document.getElementById('usernameInput').value;\n\n this.currentUser = username;\n\n // Create the cookie\n this.setCookie(\n `${SETTINGS.cookieNameFirstPart}${this.eventID}`,\n { user: {\n name: username,\n pinsCreated: this.pinsCreated,\n pinsVoted: this.pinsVoted\n }\n },\n 100\n );\n }", "setAuth(state, data) {\n window.localStorage.setItem('jwt_token', data.access_token)\n if (data.user) window.localStorage.setItem('user', JSON.stringify(data.user))\n axios.defaults.headers.common['Authorization'] = 'Bearer ' + data.access_token\n state.token = data.access_token\n state.user = data.user\n state.isAuthenticated = true\n }", "onLoggedIn(authData) {\n console.log('Auth Data User', authData.user); \n this.setState({\n user: authData.user\n });\n localStorage.setItem('token', authData.token);\n localStorage.setItem('user', JSON.stringify(authData.user));\n localStorage.setItem('favoriteMovies', authData.user.FavoriteMovies);\n window.location.pathname = '/';\n this.getMovies(authData.token);\n }", "function setUserInfo(request) {\n return {\n _id: request._id,\n username: request.username,\n role: request.role\n };\n}", "login(state, data) {\r\n state.token = data.token\r\n state.refreshToken = data.refreshToken\r\n state.user = data.user\r\n state.isAuth = true\r\n }", "setInfo(token, expiresAt, role) {\n localStorage.setItem('token', token)\n localStorage.setItem('expiresAt', new Date(expiresAt).getTime())\n localStorage.setItem('role', role)\n }", "async makeCurrUser(token) {\n try {\n localStorage.setItem('userToken', token);\n let username = decode(token).username; // from payload\n let user = await JoblyApi.getUser(username);\n this.setState({ currUser: user });\n } catch (err) {\n throw err;\n }\n }", "userInfo(state) {\n return state.currentUserDetails;\n }", "constructor(props) {\n // variable which stores all user data retrieved at login\n this.userData = {};\n }", "function getCurrentUser() {\n authService.getCurrentUser()\n .then(function (data) {\n scope.userName = data.FullName;\n });\n }", "set accessToken(token) {\n\t\tthis.#_accessToken = token;\n\t}", "function getUserData(accessToken) {\n $.ajax({\n url: 'https://api.spotify.com/v1/me',\n headers: {\n 'Authorization': 'Bearer ' + accessToken\n }\n });\n \n }", "authorizedUser(user) { \n this.user = user;\n }", "function setToken(response) {\n var auth = {};\n auth.is_highest_role_level = false;\n auth.token = response.data['token'];\n auth.name = response.data['name'];\n auth.role_name = response.data['role_name'];\n auth.state = response.data['state'];\n auth.district = response.data['district'];\n auth.block = response.data['block'];\n auth.level = response.data['level_id'];\n auth.state_id = response.data['state_id'];\n auth.district_id = response.data['district_id'];\n auth.block_id = response.data['block_id'];\n\n auth.permissions = response.data['permissions'];\n auth.role = response.data[\"role\"];\n auth.warehouse = response.data[\"warehouse\"];\n auth.is_highest_role_level = response.data[\"is_highest_role_level\"];\n localStorage.setItem('authUser', JSON.stringify(auth));\n}", "authUser (state, authData) {\n state.idToken = authData.token\n state.userId = authData.userId\n state.expiresIn = authData.expiresIn\n \n saveToLocal({\n token: authData.token,\n userId: authData.userId,\n expiresIn: authData.expiresIn,\n })\n router.push('/dashboard').catch(()=>{})\n }", "componentDidMount() {\n const userToken = sessionStorage.getItem(\"token\");\n\n fetch(`${this.state.URL}/posts`, {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `bearer ${userToken}`,\n },\n });\n\n fetch(`${this.state.URL}/users/${this.state.username}`, {\n method: \"GET\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `bearer ${userToken}`,\n },\n })\n .then((response) => response.json())\n .then((data) => {\n //storing displayName\n sessionStorage.setItem(\n \"displayName\",\n JSON.stringify(data.user.displayName)\n );\n this.setState({ displayName: data.user.displayName });\n });\n }", "handleLoginSubmit(username, password) {\n loginUser({ \"username\": username, \"password\": password })\n .then(data => {\n this.setState({\n userInfo: { id: data.id, username: data.username }\n });\n localStorage.setItem('token', data.token);\n })\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 aclService.getAllAccessControlListAndPermissions('name').then(function (result) {\n authentication.accessControlList = result.accessControlList;\n authentication.domainObjectList = [];\n for (var i = 0; i < authentication.accessControlList.length; i++) {\n authentication.domainObjectList.push(authentication.accessControlList[i].domainObject.description);\n }\n\n $rootScope.currentUser = authentication;\n });\n }\n }", "get _currentUser() {\r\n return this.currentUser;\r\n }", "get _currentUser() {\r\n return this.currentUser;\r\n }", "get ownerUserProfile() {\r\n return this.profileLoader.ownerUserProfile;\r\n }", "function tradeAccessTokenForUserInfo(accessTokenResponse) {\n const accessToken = accessTokenResponse.data.access_token;\n return axios.get(`https://${process.env.REACT_APP_AUTH0_DOMAIN}/userinfo/?access_token=${accessToken}`);\n }", "_onAuthStoreChange() {\n this.setState({ user: AuthStore.jwt });\n }", "UPDATE_USER_INFO (state, payload) {\n const userInfo = {\n token : payload.access_token,\n expiry : (new Date()).getTime() + payload.expires_in,\n user : payload.user\n }\n // Store data in localStorage\n localStorage.setItem('userInfo', JSON.stringify(userInfo))\n\n }", "function setUser() {\n user = JSON.parse(getCookie(\"user\"));\n}", "async loadLoggedUser() {\n let userId = await AsyncStorage.getItem('userID');\n let formattedUserId = await JSON.parse(userId);\n let xAuth = await AsyncStorage.getItem('xAuth');\n let formattedXAuth = await JSON.parse(xAuth);\n this.setState({\n xAuth: formattedXAuth,\n userID: formattedUserId,\n });\n console.log(\n 'Logged user: ' +\n this.state.userID +\n ' with Xauthorization code: ' +\n this.state.xAuth,\n );\n }", "async getUserInfo(ctx) {\r\n const { name } = ctx.state.user;\r\n ctx.body = { name };\r\n }", "getAccessToken() {\r\n return this.store.getState().authenticationState.access_token;\r\n }", "function saveAuthToken(username, token) {\n\tsessionStorage.setItem(\"username\", username);\n\tsessionStorage.setItem(\"authToken\", token);\n}", "function setUserInfo(request) {\n return {\n _id: request._id,\n username: request.username,\n email: request.email\n\n };\n}", "function storeTokens() {\n const updatedTokens = configstore.get('tokens') || {};\n\n updatedTokens.access = tokens.access;\n\n configstore.set('user', user);\n configstore.set('tokens', updatedTokens);\n}", "static async getLoggedInUser(token, username) {\n // if we don't have user info, return null\n if (!token || !username) return null;\n\n // call the API\n const response = await axios.get(`${BASE_URL}/users/${username}`, {\n params: {\n token\n }\n });\n\n // instantiate the user from the API information\n const existingUser = new User(response.data.user);\n\n // attach the token to the newUser instance for convenience\n existingUser.loginToken = token;\n\n // instantiate Story instances for the user's favorites and ownStories\n\n existingUser.favorites = response.data.user.favorites.map(s => new Story(s));\n //console.log(existingUser.favorites.unshift(existingUser.favorites));\n\n //console.log(existingUser.favorites); // it's working -- objects are being saved to the server\n existingUser.ownStories = response.data.user.stories.map(s => new Story(s));\n return existingUser;\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 exchangeAccessTokenForUserInfo(response) {\n const accessToken = response.data.access_token\n return axios.get(`https://${process.env.REACT_APP_AUTH0_DOMAIN}/userinfo?access_token=${accessToken}`)\n }", "function syncCurrentUserToLocalStorage() {\n if (currentUser) {\n localStorage.setItem(\"token\", currentUser.loginToken);\n localStorage.setItem(\"username\", currentUser.username);\n }\n }", "function syncCurrentUserToLocalStorage() {\n if (currentUser) {\n localStorage.setItem(\"token\", currentUser.loginToken);\n localStorage.setItem(\"username\", currentUser.username);\n }\n }", "function syncCurrentUserToLocalStorage() {\n if (currentUser) {\n localStorage.setItem(\"token\", currentUser.loginToken);\n localStorage.setItem(\"username\", currentUser.username);\n }\n }", "function syncCurrentUserToLocalStorage() {\n if (currentUser) {\n localStorage.setItem(\"token\", currentUser.loginToken);\n localStorage.setItem(\"username\", currentUser.username);\n }\n }", "function syncCurrentUserToLocalStorage() {\n if (currentUser) {\n localStorage.setItem(\"token\", currentUser.loginToken);\n localStorage.setItem(\"username\", currentUser.username);\n }\n }", "function syncCurrentUserToLocalStorage() {\n if (currentUser) {\n localStorage.setItem(\"token\", currentUser.loginToken);\n localStorage.setItem(\"username\", currentUser.username);\n }\n }", "getInfo({ commit, state }) {\n // eslint-disable-next-line no-unused-vars\n return new Promise((resolve, reject) => {\n\t\t const roles = sessionStorage.getItem('roles')\n\t\t resolve(roles)\n\t // commit('SET_NAME', JSON.parse(roles).username)\n // getInfo(state.token).then(response => {\n // const { data } = response\n //\n // if (!data) {\n // reject('Verification failed, please Login again.')\n // }\n //\n // const { name, avatar } = data\n //\n // commit('SET_NAME', name)\n // commit('SET_AVATAR', avatar)\n // resolve(data)\n // }).catch(error => {\n // reject(error)\n // })\n })\n }", "constructor() {\n super();\n this.state = {\n error: null,\n isLoaded: false,\n items: []\n };\n if (window.sessionStorage.getItem('username') === null){\n window.sessionStorage.setItem('username', 'guest');\n }\n }", "fetch ({commit}) {\n return api.auth.me() // all client side apis are in api folder; see index.js inside api folder\n .then(response => {\n commit('set_user', response.data.user) // set the user state in sotre to fetched data from auth/me route\n return response\n })\n .catch(error => {\n commit('reset_user') // if there was any error then reset the user state\n return error\n })\n }", "setAuthData(data) {\n this.expiresAt = data.expires_at;\n this.accessToken = data.access_token;\n this.refreshToken = data.refresh_token;\n this.accountId = data.account_id;\n this.perms = data.perms;\n\n this.emit('auths_updated');\n }", "getUserProfileDetails() {\n fetch(\n this.props.baseUrl +\n \"?access_token=\" +\n sessionStorage.getItem(\"access-token\")\n )\n .then(res => res.json())\n .then(\n result => {\n this.setState({ userProfileData: result.data });\n },\n error => {\n console.log(\"error...\", error);\n }\n );\n }", "constructor(userObj, token) {\n this.username = userObj.username;\n this.name = userObj.name;\n this.createdAt = userObj.createdAt;\n this.updatedAt = userObj.updatedAt;\n\n // instantiate Story instances for the user's favorites and ownStories\n this.favorites = userObj.favorites.map(s => new Story(s));\n this.ownStories = userObj.stories.map(s => new Story(s));\n\n // store the login token on the user so it's easy to find for API calls.\n this.loginToken = token;\n }", "setAuthToken(value) {\n // this.setStorage(AUTH_KEY, value);\n //Setting the AUTH Toke in Variable instead of Storage\n this.globalAuthToken = value;\n this.hasGlobalAuth = true;\n }", "getAccessToken() {\n this.accessToken = window.localStorage.getItem(this.accessTokenKey);\n return this.accessToken;\n }", "storeUserInfo ({ state }, userData) {\n if (!state.token) return\n \n databaseAxios.put('users/' + state.userId + DBSuffix + authDB + state.token, userData)\n .then()\n .catch(err => dispatch('handleError', err.response))\n }", "function userInfo() {\n var url = 'https://api.dropboxapi.com/2/users/get_current_account';\n return $.ajax({\n type: 'GET',\n url: url,\n dataType: 'JSON',\n beforeSend: function(request) {\n request.setRequestHeader(\"Authorization\", 'Bearer ' + access_token);\n }\n });\n }", "getAccessToken() {\n if (!this.hasDataStored) this.getDataFromResponse(this.responseObject);\n return this.accessToken;\n }", "user(state, user) {\n state.user = user;\n }", "logIn(){\n fetch('/api/names/user/' +this.state.username.toLowerCase(), {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }).then((response) => {\n if (!response.ok) {\n this.setErrorMessage(response.json().content);\n }\n return response.json();\n }).then((data) => {\n var currentUsername = this.state.username.toLowerCase();\n if(data.length){\n this.props.setGlobalUsername(currentUsername);\n localStorage.setItem(\"username\", currentUsername);\n localStorage.setItem(\"seenTutorial\", false);\n this.props.setIsShown(false);\n this.props.history.push('/watch')\n }\n else{\n this.setState({ errorMessage: \"Username \"+currentUsername +\" does not exist in the Database.\"});\n }\n\n })\n .catch((error) => {\n this.setState({status:error})\n });\n }", "getUserData() {\n\t\tvar request = new Request(\n\t\t\t'https://api.github.com/users/' + this.state.username \n\t\t\t+ \"?client_id=\" + this.props.clientId\n\t\t\t+ \"&client_secret=\" + this.props.clientSecret\n\t\t);\n\n\t\tfetch(request)\n\t\t.then(function(response) {\n\t\t\tif(response.ok) {\n\t\t\t\tresponse\n\t\t\t\t.json()\n\t\t\t\t.then(function(data) {\n\t\t\t\t\tthis.setState({\n\t\t\t\t\t\tuserData: data\n\t\t\t\t\t});\n\t\t\t\t}.bind(this));\n\t\t\t} else {\n\t\t\t\talert('User not found.');\n\t\t\t}\n\t\t}.bind(this));\n\t}", "saveAuthData(token, expirationDate, admin) {\n localStorage.setItem('token', token);\n localStorage.setItem('expiration', expirationDate.toISOString());\n if (admin) {\n localStorage.setItem('qdqwdqdweg4hhvt4vhtyvw5 t5juykn ', admin.toString());\n }\n // edit here to add more users type\n }", "function App() {\n\n const [token, setToken] = useState(localStorage.getItem(\"token\"));\n const [username, setUsername] = useState(\"\");\n\n useEffect(() => {\n const fetchData = async () => {\n const result = await getUserName(token)\n \n const routData = result\n //.forEach(r => console.log(r.name, r.description))\n \n setUsername(routData)\n };\n \n fetchData();\n }, [setUsername, token]);\n\n // setToken(localStorage.getItem(\"token\"));\n\n\n return (\n <div className=\"App\">\n <Router>\n <Switch>\n \n \n <Route exact path = '/home'>\n <Home token={token} setToken={setToken} username={username} setUsername={setUsername}/>\n </Route>\n\n <Route exact path = '/routines'>\n <Routines token={token} setToken={setToken} username={username} setUsername={setUsername} />\n </Route>\n\n <Route exact path = '/myroutines'>\n <MyRoutines token={token} setToken={setToken} username={username} setUsername={setUsername} />\n </Route>\n\n <Route exact path = '/activities'>\n <Activities setToken={setToken} token={token} username={username} setUsername={setUsername} />\n </Route>\n \n\n </Switch> \n </Router>\n </div>\n );\n}" ]
[ "0.6262693", "0.62520564", "0.6088134", "0.60748285", "0.60652333", "0.60582477", "0.60401845", "0.5998425", "0.5996736", "0.59809166", "0.5964823", "0.5938157", "0.59332716", "0.59205633", "0.59056455", "0.5815292", "0.5793514", "0.57765085", "0.5760541", "0.5692263", "0.5680695", "0.56765556", "0.5663716", "0.56583", "0.56210375", "0.5620083", "0.56056917", "0.56006664", "0.55964273", "0.551568", "0.55155134", "0.5511074", "0.55068326", "0.5506616", "0.5506616", "0.550331", "0.5474763", "0.5474202", "0.5472698", "0.54669654", "0.54650915", "0.5458734", "0.54569644", "0.5454787", "0.5435108", "0.54346937", "0.54316455", "0.543019", "0.5429771", "0.54282194", "0.5423588", "0.5421074", "0.54175216", "0.5415661", "0.54118395", "0.54034704", "0.5385263", "0.53788775", "0.5378732", "0.5369749", "0.53635293", "0.5361837", "0.53488183", "0.53488183", "0.5348334", "0.53462917", "0.5340099", "0.53350353", "0.53282034", "0.5326927", "0.5320496", "0.53197765", "0.53086007", "0.53041226", "0.52996737", "0.52985686", "0.5292563", "0.5288569", "0.528407", "0.528407", "0.528407", "0.528407", "0.528407", "0.528407", "0.52832305", "0.52729976", "0.52719975", "0.52682513", "0.52682513", "0.5266261", "0.5265301", "0.5263577", "0.5260838", "0.5260089", "0.525671", "0.5253812", "0.5253656", "0.524053", "0.52347785", "0.52319676" ]
0.5947306
11
Revokes the access token, effectively signing a user out of their session.
revokeAccessToken() { this.setState({ accessToken: undefined }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "logout() {\n this.setAccessToken(null);\n this.user = null;\n }", "function revokeToken() {\n\t\texec_result.innerHTML='';\n\t\tgetAuthToken({\n\t\t\t'interactive': false,\n\t\t\t'callback': revokeAuthTokenCallback,\n\t\t});\n\t}", "function oauth2SignOut() {\n if (params['access_token']) {\n const xhr = new XMLHttpRequest();\n const url = OAUTH2_REVOKE_URI;\n var postParams = 'token=' + encodeURIComponent(params['access_token']);\n\n xhr.open('POST', url);\n xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');\n xhr.onreadystatechange = function() {\n if (xhr.readyState === 4 && xhr.status === 200) {\n signOut();\n } else if (xhr.readyState === 4) {\n console.error('OAuth2 error signing out', xhr.response);\n }\n };\n xhr.send(postParams);\n } else {\n console.error('OAuth2 sign out: access_token is unavailable');\n }\n }", "function logout() {\n setToken(null);\n setCurrentUser(null);\n }", "async logOut() {\n // Invalidate the refresh token\n try {\n if (this._refreshToken !== null) {\n await this.fetcher.fetchJSON({\n method: 'DELETE',\n path: routes.api().auth().session().path,\n tokenType: 'refresh'\n });\n }\n } finally {\n // Forget the access and refresh token\n this.accessToken = null;\n this.refreshToken = null;\n }\n }", "static deauthenticateUser() {\n sessionStorage.removeItem('refreshToken');\n }", "function logout() {\n setCurrentUser(null);\n setToken(null);\n }", "async revokeAll() {\n await this.revoke('access_token');\n await this.revoke('refresh_token');\n }", "function logoutAppUser() {\n this.setLoggedInUser(null);\n this.setToken(null);\n }", "function revokeToken() {\n // user_info_div.innerHTML=\"\";\n chrome.identity.getAuthToken({ 'interactive': false },\n function(current_token) {\n if (!chrome.runtime.lastError) {\n\n // @corecode_begin removeAndRevokeAuthToken\n // @corecode_begin removeCachedAuthToken\n // Remove the local cached token\n chrome.identity.removeCachedAuthToken({ token: current_token },\n function() {});\n // @corecode_end removeCachedAuthToken\n\n // Make a request to revoke token in the server\n var xhr = new XMLHttpRequest();\n xhr.open('GET', 'https://accounts.google.com/o/oauth2/revoke?token=' +\n current_token);\n xhr.send();\n // @corecode_end removeAndRevokeAuthToken\n\n // Update the user interface accordingly\n // changeState(STATE_START);\n // sampleSupport.log('Token revoked and removed from cache. '+\n // 'Check chrome://identity-internals to confirm.');\n }\n });\n}", "revokeAccessToken(accessToken) {\n var _this4 = this;\n\n return _asyncToGenerator(function* () {\n if (!accessToken) {\n accessToken = (yield _this4.tokenManager.getTokens()).accessToken;\n\n var accessTokenKey = _this4.tokenManager.getStorageKeyByType('accessToken');\n\n _this4.tokenManager.remove(accessTokenKey);\n } // Access token may have been removed. In this case, we will silently succeed.\n\n\n if (!accessToken) {\n return Promise.resolve(null);\n }\n\n return _this4.token.revoke(accessToken);\n })();\n }", "function discardToken() {\n delete oauth.access_token;\n tokenStore.forceOAuth = JSON.stringify(oauth);\n }", "function logout() {\n JoblyApi.token = null;\n setCurrentUser(null);\n localStorage.removeItem(\"token\");\n localStorage.removeItem(\"currentUser\");\n }", "static revokeToken() {\n this._revokeUserAuthorizationFromStore();\n\n const url = this.authUrlBeginning + \"revoke_token/\";\n const tokenFromLS = this.getTokenFromLS();\n\n localStorage.setItem(\"tokenObject\", \"\");\n\n const data = { token: tokenFromLS, client_id: process.env.REACT_APP_CLIENT_ID };\n const options = {\n headers: {\n \"Content-Type\": \"application/json\"\n },\n method: \"POST\",\n body: data\n };\n\n this._fetchFromAPI(url, options);\n }", "revoke(accessToken) {\n return __awaiter(this, void 0, void 0, function* () {\n const response = yield this.post('/oauth/revoke', { accessToken }, {\n headers: { 'Content-type': 'application/x-www-form-urlencoded' },\n });\n // The client may choose to ignore this error, as it wouldn't interfere with the user flow.\n if (!response || response.status !== 200) {\n throw response;\n }\n });\n }", "function logout() {\n setToken(\"\");\n ShareBnBApi.token = \"\";\n localStorage.removeItem(\"token\");\n setCurrentUser({});\n }", "logout() {\n const accessToken = localStorage.getItem('accessToken');\n localStorage.removeItem('accessToken');\n localStorage.removeItem('userId');\n const init = {\n method: 'POST',\n body: JSON.stringify(accessToken),\n headers: { 'Content-Type': 'application/json' },\n };\n fetch(`${APIURL}/users/logout`, init);\n this.user.authenticated = false;\n }", "logout(state, payload = LOGOUT_SUCCESS) {\n state.status = payload;\n state.user = {};\n state.isAuthenticated = false;\n userApi.deleteAccessTokenHeader();\n tokenService.removeAccessToken();\n tokenService.removeRefreshToken();\n }", "static deauthenticateUser() {\n console.log(\"de-authenticate\")\n localStorage.removeItem('token');\n }", "logout () {\n API.User.Logout(AppStorage.getAuthToken())\n .then(() => {\n AppDispatcher.handleAction({\n actionType: 'CLEAR_SESSION'\n })\n AppStorage.clearAll()\n browserHistory.push('/')\n })\n .catch(error => {\n AppSignal.sendError(error)\n AppDispatcher.handleAction({\n actionType: 'CLEAR_SESSION'\n })\n AppStorage.clearAll()\n browserHistory.push('/')\n })\n }", "async removeAccessToken() {\n await AsyncStorage.removeItem(`${this.namespace}:${storegeKey}`);\n }", "function logout() {\n tokenStore['igtoken'] = undefined;\n }", "logout() {\r\n this.authenticated = false;\r\n localStorage.removeItem(\"islogedin\");\r\n localStorage.removeItem(\"token\");\r\n localStorage.removeItem(\"user\");\r\n }", "logOut() {\n authContextApi.logOut();\n }", "static deauthenticateUser() {\n localStorage.removeItem('token');\n }", "function logout() {\n localStorage.removeItem('id_token');\n localStorage.removeItem('AWS.config.credentials');\n authManager.unauthenticate();\n $state.reload();\n }", "logout(){\n // clear bearer auth tokens to reset to state before login\n this.token = null;\n Cookies.remove(process.env.API_TOKEN_KEY);\n }", "static deauthenticateUser() {\n localStorage.removeItem('token');\n }", "static deauthenticateUser() {\n localStorage.removeItem('token');\n }", "static deauthenticateUser() {\n localStorage.removeItem('token');\n }", "static deauthenticateUser() {\n localStorage.removeItem('token');\n }", "static deauthenticateUser() {\n localStorage.removeItem('token');\n }", "signOutUser() {\n this.__userApiToken__ = null\n }", "function signOut() {\n // Clear Credentials:\n // updateClientId(\"\");\n // updateClientSecret(\"\");\n // updateProjectId(\"\");\n\n // Clear Tokens:\n updateOAuthCode(\"\");\n updateAccessToken(\"\");\n updateRefreshToken(\"\");\n\n // Clear Devices:\n clearDevices();\n\n // Signed Out:\n updateSignedIn(false);\n}", "static deauthenticateUser() {\n localStorage.removeItem('token');\n localStorage.removeItem('role');\n localStorage.removeItem('username');\n Auth.onAuthenticationStatusChange(false);\n }", "function logout() {\n if (Token.has()) {\n $http.get('auth/logout')\n .then(function () {\n AuthEvent.deauthenticated();\n currentUser = {};\n $state.go('login');\n });\n }\n }", "clear() {\n currentAccessToken = null;\n store.removeItem('__refresh_data__');\n }", "clear() {\n currentAccessToken = null;\n store.removeItem('__refresh_data__');\n }", "logout() {\n _handleUserLogout();\n userDb.logout(this.user);\n this.userId = null;\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 deleteRevokedTokens() {\n for (const token of revokedTokens) {\n try {\n jwt.verify(token, secrets.jwtKey);\n } catch (e) {\n revokedTokens.delete(token);\n console.info('removed revoked token', token);\n }\n }\n}", "deleteUserApiToken() {\n this.__userApiToken__ = null\n sessionStorage.removeItem('freendies-user-token')\n }", "static logout() {\n AuthService.clearSession();\n clearTimeout(tokenRenewalTimeout);\n }", "async revokeToken() {\n\t\tif (!this.token) {\n\t\t\tthrow new Error('No token to revoke.');\n\t\t}\n\n\t\treturn send('GET', GOOGLE_REVOKE_TOKEN_URL + this.token).then(r => {\n\t\t\tthis.configure({\n\t\t\t\tkey: this.key,\n\t\t\t\tscope: this.scope,\n\t\t\t\tadditionalClaims: this.additionalClaims,\n\t\t\t\temail: this.iss,\n\t\t\t\tsub: this.sub,\n\t\t\t});\n\t\t});\n\t}", "doLogout() {\n this.user = null;\n }", "logout () {\n // Clear access token and ID token from local storage\n localStorage.removeItem('access_token')\n localStorage.removeItem('id_token')\n localStorage.removeItem('expires_at')\n this.userProfile = null\n this.authNotifier.emit('authChange', false)\n // navigate to the home route\n router.replace('/')\n }", "removeToken(state) {\n localStorage.removeItem('accessToken');\n localStorage.removeItem('refreshToken');\n state.jwt_access = null;\n state.jwt_refresh = null;\n }", "function logout() {\n if(self.isLoggedIn){\n self.isLoggedIn = false;\n //clear token\n if ($window.localStorage.accessToken) {\n delete $window.localStorage.accessToken;\n }\n if ($window.sessionStorage.accessToken) {\n delete $window.sessionStorage.accessToken;\n }\n self.token = null;\n // Clear Authorization HTTP header.\n if ($http.defaults.headers.common.Authorization){\n delete $http.defaults.headers.common.Authorization;\n }\n //clear user data\n self.user = null;\n return $q.when({isLoggedOut:true});\n }else{\n return $q.reject({isLoggedOut:false});\n }\n }", "logout() {\n $cookies.remove('token');\n currentUser = {};\n }", "async logout () {\n this.state = 'pending'\n const token = this.rootStore.user.token\n if (!token) {\n this.state = 'done'\n console.info('No user was logged in')\n return\n }\n try {\n await Api({ token }).post('/logout/', {})\n runInAction(() => {\n this.state = 'done'\n })\n this.rootStore.clearUser()\n } catch (err) {\n this.handleError(err)\n }\n }", "[AUTH_MUTATIONS.LOGOUT](state) {\n state.user = null\n state.token = null\n }", "function logout() {\n TokenService.removeToken();\n self.all = [];\n self.user = {};\n CurrentUser.clearUser();\n $window.location.reload();\n }", "function oauthLogoutG() {\n\tjso.wipeTokens();\n}", "logout() {\n this.authenticated = false;\n\n localStorage.removeItem('user');\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 revokeToken({ token, ipAddress }) {\n const refreshToken = await getRefreshToken(token);\n \n // revoke token and save\n refreshToken.revoked = Date.now();\n refreshToken.revokedByIp = ipAddress;\n await refreshToken.save();\n }", "logout() {\n\t\tTokenService.destroy();\n\t\t// this.setState({ isAuthed: false });\n\t\tthis.resetState();\n\t\tconsole.log('Logout successful...');\n\t}", "function revokeAuthTokenCallback(current_token) {\n\t\tif (!chrome.runtime.lastError) {\n\n\t\t\t// Remove the local cached token\n\t\t\tchrome.identity.removeCachedAuthToken({ token: current_token }, function() {});\n\n\t\t\t// Make a request to revoke token in the server\n\t\t\tvar xhr = new XMLHttpRequest();\n\t\t\txhr.open('GET', 'https://accounts.google.com/o/oauth2/revoke?token=' +\n\t\t\t\t current_token);\n\t\t\txhr.send();\n\n\t\t\t// Update the user interface accordingly\n\t\t\tchangeState(STATE_START);\n\t\t\tsampleSupport.log('Token revoked and removed from cache. '+\n\t\t\t\t\t\t\t'Check chrome://identity-internals to confirm.');\n\t\t}\n\t}", "async handleLogout() {\n try {\n //delete their access token\n var res = await particle.deleteAccessToken({ username: particleSettings.username, password: particleSettings.password, token: particleSettings.userToken });\n particleSettings.username = \"\";\n particleSettings.userToken = \"\";\n particleSettings.password = \"\";\n this.setState({ toLogin: true });\n }\n catch (error) {\n console.log(error);\n }\n }", "function expireAccessToken () {\n clock.tick(DEFAULT_TOKEN_EXPIRES_IN_SECS * 1000);\n }", "function expireAccessToken () {\n clock.tick(DEFAULT_TOKEN_EXPIRES_IN_SECS * 1000);\n }", "function signOut() {\n var auth2 = gapi.auth2.getAuthInstance();\n auth2.signOut().then(function () {\n localStorage.removeItem('token');\n user = {};\n notif('top-end', 'success', 'Sign out Success');\n isSignIn();\n });\n}", "[AUTH_MUTATIONS.LOGOUT](state) {\n state.user_id = null;\n state.user = null;\n state.access_token = null;\n }", "function removeStoredToken(){\n var url = 'https://accounts.google.com/o/oauth2/revoke?token=' + tokenStored;\n window.fetch(url);\n chrome.identity.removeCachedAuthToken({token: tokenStored}, function (){});\n}", "function logout() {\n svc.token = null;\n svc.identity = null;\n delete $window.localStorage['authToken']; \n }", "logout() {\n this._userId = null\n this._userToken = null\n this._userUsername = null\n\n sessionStorage.clear()\n }", "clearCurrentUserId() {\n this.req.logout();\n }", "revokeAccessTokens(id, options) {\n const operationOptions = coreHttp.operationOptionsToRequestOptionsBase(options || {});\n return this.client.sendOperationRequest({ id, options: operationOptions }, revokeAccessTokensOperationSpec);\n }", "deauthenticate(): void {}", "logOutCurrentUser() {\n var self = this;\n self.auth.signOut();\n }", "logOutUser(){\n localStorage.removeItem('token')\n }", "logout() {\n // remove authentication credentials\n this.credentials = null;\n }", "function signOut() {\n var auth2 = gapi.auth2.getAuthInstance();\n auth2.signOut().then(function () {\n console.log('User signed out.');\n });\n }", "function signOut() {\r\n var auth2 = gapi.auth2.getAuthInstance();\r\n auth2.signOut().then(function () {\r\n console.log('User signed out.');\r\n });\r\n }", "function expireAccessToken() {\n clock.tick(DEFAULT_TOKEN_EXPIRES_IN_SECS * 1000);\n }", "function logout() {\n token = false;\n showLogin();\n}", "logout() {\n localStorage.removeItem(\"token\");\n localStorage.removeItem(\"user\");\n window.location.reload();\n }", "logout() {\n localStorage.removeItem('token');\n request.unset('Authorization');\n }", "function signOut() {\n AsyncStorage.clear().then(() => {\n setLoggedUser(null);\n });\n }", "async logout() {\n this.token = null;\n }", "function resetAuth() {\n getOAuthService().reset();\n}", "unset() {\n this.cachedToken = null;\n this.cachedCurrentUser = null;\n this.store.remove(this.tokenStore);\n this.store.remove(this.userStore);\n }", "logout() {\n localStorage.removeItem(\"token\");\n localStorage.removeItem(\"userName\");\n }", "function logout() {\n\t\t\ttokenStore['fbtoken'] = undefined;\n }", "logOutUser() {\n this.__userAdmin__ = null\n this.__userToken__ = null\n this.removeStorage()\n window.location.reload()\n }", "async logout() {\n await this.launcher.logout(this.Authorization.access_token);\n this.stream.disconnect();\n return await this.launcher.logout();\n }", "function logout() {\n //$cookies.remove('token');\n }", "function logout() {\n //$cookies.remove('token');\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}", "logout() {\n // Remove the HTTP header that include the JWT token\n delete axios.defaults.headers.common['Authorization'];\n // Delete the token from our session\n sessionStorage.removeItem('token');\n this.token = null;\n }", "logout() {\n return new Promise((resolve) => {\n store.commit('unsetToken');\n this.user.authenticated = false;\n return resolve();\n });\n }", "logoutUser(state, action) {\n state.isLoggedIn = false;\n localStorage.setItem(\"token\", \"\");\n state.token = localStorage.setItem(\"token\", \"\");\n state.currentUserId = localStorage.setItem(\"currentUserId\", \"\");\n state.currentUserAllForms = [];\n }", "function logoutDocusign() {\n getService().reset();\n}", "destroyToken(context) {\n\t\t\tif (context.getters.logedIn) {\n\t\t\t\taxios.defaults.headers.common['Authorization'] = 'Bearer ' + localStorage.getItem('access_token');\n\t\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\t\taxios.post(\"/logout\"\n\t\t\t\t\t).then((res) => {\n\t\t\t\t\t\tlocalStorage.removeItem('access_token');\n\t\t\t\t\t\tcontext.commit('DESTROY_TOKEN');\n\t\t\t\t\t\tresolve(res);\n\t\t\t\t\t})\n\t\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\t\tlocalStorage.removeItem('access_token');\n\t\t\t\t\t\t\tcontext.commit('DESTROY_TOKEN');\n\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t}\n\t\t}", "logout() {\n this.account.sid = null;\n this.account.token = null;\n this.account.save();\n this.account = null;\n this.cb.onLogoutSuccess();\n }", "function logout() {\n sessionStorage.removeItem('id');\n sessionStorage.removeItem('token');\n sessionStorage.removeItem('registerUser');\n setIsLoggedIn(false);\n }", "function logoutUser() {\n auth.logout()\n .then(() => {\n sessionStorage.clear();\n showInfo('Logout successful.');\n userLoggedOut();\n }).catch(handleError);\n }", "function logOut() {\n http.deleteAuthorization($stateParams.basic, $stateParams.id)\n .then(function (res) {\n console.log(res);\n $state.go('login');\n })\n }", "logOut(state) {\n state.user = null;\n state.authToken = null;\n state.authTenants = null;\n state.currentSection = null;\n state.error = null;\n }", "function signOut () {\n oauth.clearTokens();\n setIcon();\n}" ]
[ "0.7372787", "0.73320144", "0.6912185", "0.68594915", "0.6820923", "0.6796137", "0.6788129", "0.6767535", "0.6717279", "0.6638095", "0.6565397", "0.65397465", "0.6532335", "0.64746284", "0.6449039", "0.639707", "0.63275737", "0.62895507", "0.62471837", "0.62442386", "0.6211879", "0.61818147", "0.6173825", "0.6166838", "0.6141778", "0.61250734", "0.61185235", "0.61088973", "0.61088973", "0.61088973", "0.61088973", "0.61088973", "0.60998744", "0.60947263", "0.60816216", "0.60630417", "0.6056088", "0.6056088", "0.6055735", "0.6046551", "0.6045397", "0.6042332", "0.6025995", "0.6017516", "0.6011141", "0.60081416", "0.60050243", "0.59913015", "0.59901524", "0.5988803", "0.5944463", "0.5943187", "0.5939001", "0.5937679", "0.5935053", "0.59335405", "0.5933281", "0.59319466", "0.5925686", "0.5915062", "0.5915062", "0.59147334", "0.59046865", "0.5896408", "0.5894142", "0.588032", "0.5874948", "0.58630705", "0.5852347", "0.5848745", "0.5845722", "0.58439744", "0.58397424", "0.5839004", "0.5829639", "0.58261836", "0.5817075", "0.5798185", "0.5787213", "0.5785304", "0.5778912", "0.5776278", "0.5773323", "0.5772786", "0.5766016", "0.5763613", "0.57626885", "0.57626885", "0.5753835", "0.57459855", "0.5736305", "0.57333827", "0.57285553", "0.5724553", "0.57238466", "0.57063466", "0.570171", "0.5697427", "0.5695198", "0.56949604" ]
0.6577832
10
Note that there are many ways to do navigation and this is just one! I chose this way as it is likely most familiar to us, passing props to child components from the parent. Other options may have included contexts, which store values above (similar to this implementation), or route parameters which pass values from view to view along the navigation route. You are by no means bound to this implementation; choose what works best for your design!
render() { // Our primary navigator between the pre and post auth views // This navigator switches which screens it navigates based on // the existent of an access token. In the authorized view, // which right now only consists of the profile, you will likely // need to specify another set of screens or navigator; e.g. a // list of tabs for the Today, Exercises, and Profile views. let AuthStack = createStackNavigator(); let Tab = createBottomTabNavigator(); const Stack = createStackNavigator(); const ProfileStack = createStackNavigator(); const screenOptionStyle = { // headerStyle: { // backgroundColor: "#9AC4F8", // }, // headerTintColor: "white", // headerBackTitle: "Back", }; const ProfileStackNavigator = () => { return ( <ProfileStack.Navigator screenOptions={screenOptionStyle}> <ProfileStack.Screen name="Profile" options={{ title: 'Profile', headerLeft: this.SignoutButton }} > {(props) => <ProfileView {...props} username={this.state.username} accessToken={this.state.accessToken} revokeAccessToken={this.revokeAccessToken} update={this.update} />} </ProfileStack.Screen> </ProfileStack.Navigator> ); }; const DayViewStackNavigator = () => { return ( <Stack.Navigator screenOptions={screenOptionStyle}> <Stack.Screen name="Today" options={{ title: 'Today', headerLeft: this.SignoutButton }}> {(props) => <TodayView {...props} goalDailyActivity={this.state.goalDailyActivity} activities={this.state.activities} activityDone={this.state.activityDone} revokeAccessToken={this.revokeAccessToken} />} </Stack.Screen> </Stack.Navigator> ); }; // const ExercisesStackNavigator = (props) => { // return ( // <ExercisesStack.Navigator screenOptions={screenOptionStyle}> // <ExercisesStack.Screen name="Exercises" options={{ // title: 'Exercises', // headerLeft: this.SignoutButton, // headerRight: ({ nv }) => <Text onPress={() => console.log(nv)}> hello</Text>, // }}> // {(props) => <ExercisesView {...props} username={this.state.username} accessToken={this.state.accessToken} revokeAccessToken={this.revokeAccessToken} />} // </ExercisesStack.Screen> // <ExercisesStack.Screen name="AddExercise" options={{ // title: 'Add Exercise' // }}> // {(props) => <AddExerciseView {...props} username={this.state.username} accessToken={this.state.accessToken} revokeAccessToken={this.revokeAccessToken} />} // </ExercisesStack.Screen> // </ExercisesStack.Navigator> // ); // }; const BottomTabNavigator = () => { return ( <Tab.Navigator initialRouteName="Feed" tabBarOptions={{ activeTintColor: '#e91e63', }} > <Tab.Screen name="Today" options={{ tabBarLabel: 'Today', tabBarIcon: ({ color, size }) => ( <MaterialIcons name="today" size={size} color={color} /> ), }} component={DayViewStackNavigator} /> <Tab.Screen name="Profile" options={{ tabBarLabel: 'Profile', tabBarIcon: ({ color, size }) => ( <MaterialCommunityIcons name="account" color={color} size={size} /> ), }} component={ProfileStackNavigator} /> <Tab.Screen name="Exercises" options={{ tabBarLabel: 'Exercises', tabBarIcon: ({ color, size }) => ( <FontAwesome5 name="running" size={size} color={color} /> ), }} > {(props) => <ExercisesStackNavigator {...props} username={this.state.username} accessToken={this.state.accessToken} revokeAccessToken={this.revokeAccessToken} update={this.update} data={this.state.allActivities}></ExercisesStackNavigator>} </Tab.Screen> </Tab.Navigator>); }; return ( <NavigationContainer> {!this.state.accessToken ? ( <> <AuthStack.Navigator> <AuthStack.Screen name="Login" options={{ title: 'Fitness Tracker Welcome', }} > {(props) => <LoginView {...props} login={this.login} />} </AuthStack.Screen> <AuthStack.Screen name="SignUp" options={{ title: 'Fitness Tracker Signup', }} > {(props) => <SignupView {...props} />} </AuthStack.Screen> </AuthStack.Navigator> </> ) : ( // <> // <AuthStack.Screen name="FitnessTracker" options={{ // headerLeft: this.SignoutButton // }}> // {(props) => <ProfileView {...props} username={this.state.username} accessToken={this.state.accessToken} revokeAccessToken={this.revokeAccessToken} />} // </AuthStack.Screen> // </> <BottomTabNavigator /> )} </NavigationContainer > ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n\n return (\n <div>\n {/* ROUTE: This component is for creating and linking pages with each other. Passing props to cummunicate between parent and chideren. */}\n <Route exact path=\"/\" render={() => (\n <BookShelfs\n books={this.state.books}\n selectHandler={this.selectHandler}\n />\n )} />\n\n <Route exact path=\"/search\" render={() => (\n <BookSearch \n searchResult={this.state.searchResult}\n searchQuery={this.searchQuery}\n selectHandler={this.selectHandler}\n books={this.state.books}\n />\n )} />\n </div>\n )\n }", "pageView() {\n const { currentView } = this.state;\n\n switch (currentView) {\n case 'login page':\n return <Login\n handleLoginSubmit={this.handleLoginSubmit}\n favoriteCount={this.favoriteCount}\n handleLinks={this.handleLinks}\n />;\n\n case 'register page':\n return <Register\n handleRegisterSubmit={this.handleRegisterSubmit}\n favoriteCount={this.favoriteCount}\n handleLinks={this.handleLinks}\n />;\n\n case 'companies index':\n return <CompanyView\n handleCompanyLink={this.handleCompanyLink}\n companies={this.state.companies}\n userInfo={this.state.userInfo}\n />;\n case 'company page':\n return <CompanyInfoPage\n handleProductLink={this.handleProductLink}\n deleteFavorite={this.deleteFavorite}\n deleteProduct={this.deleteProduct}\n updateProduct={this.updateProduct}\n addFavorite={this.addFavorite}\n handleLinks={this.handleLinks}\n currentCompany={this.state.currentCompany}\n favorites={this.state.favorites}\n userInfo={this.state.userInfo}\n products={this.state.products}\n />;\n case 'products index':\n return <ProductView\n handleProductLink={this.handleProductLink}\n deleteFavorite={this.deleteFavorite}\n deleteProduct={this.deleteProduct}\n updateProduct={this.updateProduct}\n createProduct={this.createProduct}\n addFavorite={this.addFavorite}\n handleLinks={this.handleLinks}\n companies={this.state.companies}\n favorites={this.state.favorites}\n userInfo={this.state.userInfo}\n products={this.state.products}\n />;\n case 'favorites page':\n return <FavoritesView\n handleProductLink={this.handleProductLink}\n deleteFavorite={this.deleteFavorite}\n deleteProduct={this.deleteProduct}\n updateProduct={this.updateProduct}\n addFavorite={this.addFavorite}\n countFavorites={this.state.countFavorites}\n favoritesStats={this.state.favoritesStats}\n companies={this.state.companies}\n favorites={this.state.favorites}\n userInfo={this.state.userInfo}\n />\n default:\n return <LandingPage\n handleLinks={this.handleLinks}\n />;\n\n }\n }", "function ReduxNavigation(props) {\n const { dispatch, nav } = props;\n const navigation = addNavigationHelpers({\n dispatch,\n state: nav\n });\n\n return <RootNavigation navigation={navigation} />\n}", "function Wrapped(props) {\n const {\n location,\n pathname = getBaseUrl(location.pathname),\n params = {},\n } = props;\n\n let qs = Object.keys(params)\n .sort()\n .map((key) => `expand.contextnavigation.${key}=${params[key]}`)\n .join('&');\n const path = `${pathname}${\n pathname.endsWith('/') ? '' : '/'\n }@contextnavigation${qs ? `?${qs}` : ''}`;\n\n const dispatch = useDispatch();\n const nav = useSelector((state) => {\n return state.contextNavigation?.[path]?.data;\n });\n\n useDeepCompareEffect(() => {\n dispatch(getContextNavigation(pathname, params));\n }, [pathname, dispatch, params]);\n\n return <WrappedComponent {...props} navigation={nav} />;\n }", "route(props){\n if(props.path == \"/dynamic\"){\n return (\n <PropsRoute exact path={props.path} component={props.component} navData={this.state.navBarObj} content={this.state.dynamicContent}/>\n );\n }\n else if(props.path == \"budgetrequests\"){\n return(\n <PropsRoute exact path={props.path} component={DynamicScreen} navData={this.state.navBarObj} content={this.state.budgetrequests}/>\n );\n }\n return(\n <PropsRoute exact path={props.path} component={props.component} navData={this.state.navBarObj}/>\n );\n }", "render() {\n return (\n <div className=\"App\">\n <Header clearListName={this.clearListName} />\n <Nav\n backendUrl={backendUrl}\n logings={this.logings}\n isLoggedIn={this.state.isLoggedIn}\n />\n <Switch>\n <Route exact path=\"/\">\n <Main userId={this.state.userId} />\n </Route>\n <Route path=\"/SelectStore\">\n <ListStore\n populateStore={this.populateStore}\n getListHeader={this.getListHeader}\n handleCreateListButton={this.handleCreateListButton}\n listName={this.state.listName}\n />\n </Route>\n <Route path=\"/CreateList\">\n <CreateList\n populateCategory={this.populateCategory}\n populateProduct={this.populateProduct}\n listHeader={this.state.listHeader}\n getProductsByStore={this.getProductsByStore}\n productsByStore={this.state.productsByStore}\n userId={this.state.userId}\n backendUrl={backendUrl}\n clearListName={this.clearListName}\n />\n </Route>\n {/*emdlr*/}\n <Route\n path={\"/user/:id\"}\n render={(routerProps) => (\n <User\n {...routerProps}\n backendUrl={backendUrl}\n logings={this.logings}\n isLoggedIn={this.state.isLoggedIn}\n />\n )}\n />\n </Switch>\n <Footer />\n </div>\n );\n }", "constructor(props, context) {\n super(props, context);\n\n //this._onPushRoute = this.props.onNavigationChange(val);\n this._onPopRoute = this.props.onNavigationChange.bind(null, 'pop');\n this._renderScene = this._renderScene.bind(this);\n }", "function ReduxNavigation (props) {\n const { dispatch, nav } = props\n const navigation = ReactNavigation.addNavigationHelpers({\n dispatch,\n state: nav\n })\n\n return <navigation navigation={navigation} />\n}", "function App() {\n const [pages] = useState([\n {\n name: \"about me\",\n page: <About />\n },\n {\n name: \"projects\",\n page: <Portfolio />\n }\n // {\n // name: \"contact\",\n // page: <Contact />\n // },\n // {\n // name: \"resume\",\n // page: <Resume />\n // },\n ]);\n\n const [currentPage, setCurrentPage] = useState(pages[0]);\n\n // function displayPage() {\n // switch (currentPage.name) {\n // case \"about me\":\n // return <About />;\n\n // case \"portfolio\":\n // return <Portfolio />;\n\n // case 'resume':\n // return <Resume/>;\n\n // case 'contact':\n // return <Contact/>;\n\n // default: // defensive programming used to redirect user if information is missing or whatever scenario\n // return <About />;\n // }\n // }\n\n return (\n \n <div>\n <Title/>\n <Nav\n pages={pages}\n currentPage={currentPage}\n setCurrentPage={setCurrentPage}\n />\n <main>\n {currentPage.page}\n </main>\n\n\n \n <Footer />\n\n </div>\n );\n}", "constructor(props: any, context: any) {\n super(props, context);\n\n this._onPushRoute = this.props.onNavigationChange.bind(null, 'push');\n this.onPopRoute = this.props.onNavigationChange.bind(null, 'pop');\n\n this._renderScene = this._renderScene.bind(this);\n }", "render() {\n\n return (\n\n <div>\n <Router>\n\n <>\n \n \n <NavigationComponent/>\n\n {/* Adding the URL paths for each component */}\n\n <Switch>\n <Route path=\"/\" exact component={RegistrationSelection}/>\n <Route path=\"/signup\" exact component={RegistrationSelection}/>\n <Route path=\"/nr\" exact component={NurseryRegistration}/>\n <Route path=\"/pr\" exact component={ParentRegistration}/>\n <Route path=\"/ns\" exact component={NurserySearch}/>\n <Route path=\"/nsr\" exact component={SearchNurseryResults}/>\n <Route path=\"/single\" exact component={SingleNursery}/>\n <Route path=\"/login\" exact component={Login}/>\n <Route path=\"/ps\" exact component={PaymentSetup}/>\n <Route path=\"/p\" exact component={Prices}/>\n <Route path=\"/sn\" exact component={SendNotification}/>\n <Route path=\"/ans\" exact component={RegistrationRequestsSearch}/>\n <Route path=\"/ansr\" exact component={RegistrationRequests}/>\n <Route path=\"/ana\" exact component={NurseryApplication}/>\n <Route path=\"/add-child\" exact component={AddChild}/>\n <Route path=\"/my-children\" exact component={ViewChild}/>\n <Route path=\"/nursery-send\" exact component={NurseryNotification}/>\n <Route path=\"/view-requests\" exact component={ChildrenRequests}/>\n <Route path=\"/set-meeting\" exact component={Meeting}/>\n <Route path=\"/apply\" exact component={ApplyNursery}/>\n <Route path=\"/confirmation\" exact component={ApplyConfirmation}/>\n\n {/* <Route component={Error}/> WILL BE USED FOR ERROR PATHS*/}\n\n </Switch>\n\n </>\n\n </Router>\n\n </div>\n\n )\n\n }", "render() {\n return(\n <BrowserRouter>\n <div className=\"container\">\n <Navigation\n onSearch={ this.performSearch }\n />\n <Header />\n <Switch>\n {/*The current route should be reflected in the URL*/}\n <Route exact path=\"/\" render={ () => <Gallery loading={ this.state.home.loading }\n title={ this.state.home.title }\n data={this.state.home.photos } /> } />\n <Route path=\"/cats\" render={ () => <Gallery loading={ this.state.cats.loading }\n title={ this.state.cats.title }\n data={this.state.cats.photos } /> } />\n <Route path=\"/dogs\" render={ () => <Gallery loading={ this.state.dogs.loading }\n title={ this.state.dogs.title }\n data={this.state.dogs.photos } /> } />\n <Route path=\"/sunset\" render={ () => <Gallery loading={ this.state.sunset.loading }\n title={ this.state.sunset.title }\n data={this.state.sunset.photos } /> } />\n <Route path=\"/search\" render={ () => <Gallery loading={ this.state.loading }\n title={ this.state.title }\n data={this.state.photos } /> } />\n </Switch>\n </div>\n </BrowserRouter>\n\n );\n }", "function Nav(props){\n return (\n // this is where we return the html that we want\n <nav className=\"navbar\">\n <ul>\n <li>\n {/*the href routes the clicky game back to itself*/}\n <a href=\"/\">Click Game</a>\n </li>\n\n <li>\n {/*props.score means when you decide to use Nav in another component you would call this function via score*/}\n Score: {props.score} | Top Score: {props.topScore}\n </li>\n \n </ul>\n </nav>\n\n )\n}", "goToFriendsView(){\n var that = this;\n that.props.navigator.push({\n title: 'Friends',\n component: Friends,\n passProps: {userInfo: that.props.userInfo}\n });\n }", "renderScene(route, navigator) {\n if(route.name === 'Main') {\n return <Main tite={'Welcome'} navigator={navigator} {...route.passProps}/>\n }\n if(route.name === 'Time') {\n return <TabbedApp navigator={navigator} {...route.passProps}/>\n }\n if(route.name === 'SignUp') {\n return <SignUp navigator={navigator} {...route.passProps}/>\n } \n }", "function Navigator({ location, history, userType, userInfo }) {\n return (\n <TransitionGroup className=\"container-new bg-light\">\n <CSSTransition\n key={location.key}\n timeout={{ enter: 300, exit: 300 }}\n classNames={\"fade\"}\n >\n <Switch location={location}>\n <Route exact path=\"/home\">\n <Dashboard\n userType={userType}\n userInfo={userInfo}\n history={history}\n />\n </Route>\n <Route path=\"/campaigns\">\n <Campaign history={history} />\n </Route>\n <Route exact path=\"/autocampaigns\">\n <CreateCampaign userType={userType} history={history} />\n </Route>\n <Route path=\"/buycredits\">\n <BuyCredits userType={userType} location={location} />\n </Route>\n <Route exact path=\"/leads\">\n <LeadTable history={history} />\n </Route>\n <Route exact path=\"/leads/details\">\n <LeadDetail history={history} />\n </Route>\n <Route path=\"/leads/management\">\n <LeadManagement />\n </Route>\n <Route exact path=\"/leads/status\">\n <LeadStatus />\n </Route>\n <Route path=\"/leads/bucket\">\n <LeadBucket />\n </Route>\n <Route path=\"/leads/funnel\">\n <LeadFunnel />\n </Route>\n <Route path=\"/leads/mapping\">\n <LeadStatusMapping />\n </Route>\n <Route exact path=\"/leads/status/group/name/mapping\">\n <StatusMapping />\n </Route>\n <Route path=\"/leads/status/group/name\">\n <StatusGroup />\n </Route>\n <Route path=\"/leads/summary\">\n <Leads history={history} />\n </Route>\n <Route path=\"/leads/assignLead\">\n <LeadTable history={history} leadAssign=\"leadAssign\" />\n </Route>\n <Route path=\"/leads/leadtype/mapping\">\n <LeadTypeAssign />\n </Route>\n <Route path=\"/leads/publisher\">\n <PublisherMapping />\n </Route>\n <Route path=\"/leads/upload/report\">\n <LeadReportUpload />\n </Route>\n <Route path=\"/profile\">\n <ProfileV1 />\n </Route>\n <Route path=\"/sender-ids\">\n <SenderIds />\n </Route>\n <Route path=\"/transactions\">\n <Transactions />\n </Route>\n <Route path=\"/upload\">\n <FileUpload />\n </Route>\n <Route path=\"/landing-pages\">\n <LandingPages />\n </Route>\n <Route path=\"/mediums\">\n <Mediums history={history} />\n </Route>\n <Route path=\"/medium/mapped-datasource\">\n <MappedDatasource />\n </Route>\n <Route path=\"/services/all\">\n <Services userType={userType} />\n </Route>\n <Route path=\"/datasource\">\n <Datasource history={history} userType={userType} />\n </Route>\n <Route path=\"/mapped-clients\">\n <AddClients title=\"Mapped\" />\n </Route>\n <Route path=\"/blocked-clients\">\n <AddClients title=\"Blocked\" />\n </Route>\n <Route path=\"/segments\">\n <Segments />\n </Route>\n <Route path=\"/mapped-segments\">\n <DatasourceMapSegment />\n </Route>\n <Route path=\"/segment-group\">\n <SegmentGroup history={history} userType={userType} />\n </Route>\n <Route path=\"/mapped-segment-group\">\n <MappedSegmentGroup />\n </Route>\n <Route path=\"/templates\">\n <Templates />\n </Route>\n <Route path=\"/tasks\">\n <Task history={history} />\n </Route>\n <Route exact path=\"/view-campaign\">\n <ViewCampaign location={location} />\n </Route>\n <Route path=\"/view-campaign/clickShortURL\">\n <ViewCampaignPopup history={history} />\n </Route>\n <Route path=\"/update-stats-campaign\">\n <ViewCampaign location={location} />\n </Route>\n <Route path=\"/campaign-create\">\n <CreateNewCampaign location={location} history={history} />\n </Route>\n <Route path=\"/edit-campaign\">\n <CreateNewCampaign location={location} history={history} />\n </Route>\n <Route path=\"/clone-campaign\">\n <CreateNewCampaign location={location} history={history} />\n </Route>\n <Route path=\"/campaign/journey/designer\">\n <RetargettingSMSPro />\n </Route>\n <Route path=\"/campaign/report\">\n <SMSReports />\n </Route>\n <Route path=\"/manage/subscriptions\">\n <ManageSubscriptions />\n </Route>\n <Route path=\"/roles/manage\">\n <RolesV1 />\n </Route>\n <Route path=\"/service/package\">\n <ServicePackages\n showHeading=\"true\"\n history={history}\n userType={userType}\n />\n </Route>\n {/* <Route path='/service/package/edit'>\n <EditPackage assign=\"true\"/>\n </Route> */}\n <Route path=\"/test\">\n <ProfileV1 />\n </Route>\n <Route path=\"/clients\">\n <Clients location={location} />\n </Route>\n <Route path=\"/agency\">\n <Clients location={location} />\n </Route>\n <Route path=\"/ivr-panel\">\n <IVR />\n </Route>\n <Route path=\"/leads/reports\">\n <LeadReports history={history} />\n </Route>\n <Route path=\"/leads/push\">\n <LeadPush />\n </Route>\n </Switch>\n </CSSTransition>\n </TransitionGroup>\n );\n}", "render(){\n return (\n <div className=\"container\">\n <Switch>\n <Route exact path='/' render={(props)=><InventoryDisplay inventoryList={this.state.inventory}\n currentRouterPath={props.location.pathname} onBuyingItem={this.handleBuyingItem} />} />\n <Route exact path='/employees' render={(props)=><EmployeeDisplay onNewItemAdd={this.handleAddingNewItemToInventory} inventoryList={this.state.inventory}\n onDeletingItem={this.handleDeletingItem} onEditingItem={this.handleEditingItem} currentRouterPath={props.location.pathname} />} />\n <Route component={Error404} />\n <Route component={InventoryProps} />\n </Switch>\n </div>\n );\n }", "render() {\n return (\n <Provider store={this.props.store}>\n <AppWithNavigationState />\n </Provider>\n );\n }", "function App() {\n return (\n <Router>\n <div>\n {/* render nav component */}\n <Nav />\n {/* using router and switch render component user clicks on */}\n <Switch>\n <Route exact path=\"/\" component={Home} />\n <Route exact path=\"/saved\" component={Saved} />\n <Route component={NoMatch} />\n </Switch>\n </div>\n </Router>\n );\n}", "function Interview(props) {\n\n //Creating object of pages\n const navigation = {\n pages: [\n { path: '/', label: 'Welcome', },\n { path: '/about-me', label: 'About Me' },\n { path: '/about-website', label: 'Why this website?' }\n ],\n }\n\n //Handler for Navigation tab changed\n const selectionHandler = (event, value) => {\n props.history.push(value);\n }\n\n return (\n //Website Navigation Tabs \n <Grid className='Interview' style={{height: '100%'}}>\n <CustomTabs\n value={props.history.location.pathname || '/'}\n onChange={selectionHandler}\n centered\n >\n {navigation.pages.map((page) => {\n return (\n <CustomTab value={page.path} label={page.label} key={page.path} />\n )\n })}\n </CustomTabs>\n {/*Configuring Switch to rerender exact page requested*/}\n <Switch>\n <Route path='/about-website'>\n <AboutWebsite />\n </Route>\n <Route path='/about-me'>\n <AboutMe />\n </Route>\n <Route path='/'>\n <Welcome />\n </Route>\n </Switch>\n <Footer />\n </Grid>\n );\n}", "render() {\n return (\n <Router>\n <Nav currentUser={ this.state.currentUser } />\n <main>\n <Routes>\n <Route path='/' exact element={<Home currentUser={this.state.currentUser}/>} />\n <Route path='/user' exact element={<Users currentUser={this.state.currentUser}/>} />\n <Route path='/signin' exact element={<SignIn signIn={this.signIn}/>} />\n <Route path='/signup' exact element={<SignUp signUp={this.signUp}/>} />\n <Route path='/ladder' exact element={<Ladder />} />\n <Route path='/admingames' exact element={<AdminGames />} />\n <Route path='/gameform' exact element={<GameForm />} />\n <Route path='/creategame' exact element={<CreateGame currentUser={this.state.currentUser}/>} />\n <Route path='/teams/:id' exact element={<Teams />} />\n\n <Route path='/games' exact element={<Games />} />\n <Route path='/catgame' exact element={<CatGame />} />\n <Route path='/admin' exact element={<Admin />} />\n\n </Routes>\n </main>\n\n </Router>\n );\n }", "render() {\n const homepage = () => {\n return (\n <Head />\n );\n }\n const order = () => {\n return (\n <Order examples={this.state.examples} updateShoppingCart={this.updateShoppingCart} />\n );\n }\n const test = () => {\n return (\n <Test />\n );\n }\n const shoppingCart = () => {\n return (\n <ShoppingCart states={this.state.shoppingCart} updateShoppingCart={this.updateShoppingCart} reset={this.resetForm} />\n );\n }\n const contact = () => {\n return (\n <Contact />\n );\n }\n var cartItems = this.getShoppingCartItems();\n return (\n <div>\n <Navtab cartItems={cartItems} />\n <Typing />\n <Switch>\n <Route path='/home' component={homepage} />\n <Route exact path='/souvenirs' component={order} />\n <Route exact path='/Cart' component={shoppingCart} />\n <Route exact path='/Contact' component={contact} />\n <Route exact path='/Test' component={test} />\n\n {/* <Redirect to='/home' /> */}\n </Switch>\n {/* <Button onClick={this.resetForm}>Press</Button> */}\n <Footer />\n </div>\n );\n }", "render() {\n // The screen's current route is passed in to `props.navigation.state`:\n const { navigate } = this.props.navigation;\n const { params } = this.props.navigation.state;\n return (\n <View>\n <Text>Welcome {params.user}</Text>\n <TouchableOpacity\n style={styles.submitButton}\n onPress = { () => navigate('Profile')}>\n <Text style={styles.submitButtonText}>\n Next\n </Text>\n </TouchableOpacity>\n </View>\n );\n }", "function Navigation({ toggleDrawer, isDrawerOpen, tags, selectTag, email, ...props}) {\n console.log('props', props);\n return <div>\n <AppBar\n toggleDrawer={toggleDrawer}\n email={email}\n />\n <Drawer\n tags={tags}\n isDrawerOpen={isDrawerOpen}\n selectTag={selectTag}\n />\n </div>;\n}", "render () {\n\n const renderHouseListingView = (props) => {\n return (\n <HouseListingView\n currentHouseView={this.state.currentHouseView}\n />\n )\n }\n\n const renderSearchView = (props) => {\n return (\n <SearchView\n onInput={this.onInput.bind(this)}\n value={this.state.term}\n listings={this.state.listings}\n onSearch={this.onSearch.bind(this)}\n onTitleClick={this.onTitleClick.bind(this)}\n // {...props}\n />\n );\n };\n\n const renderCreateListingView = (props) => {\n return (\n <CreateListingView\n onSubmit={this.onSubmitPost}\n // {...props}\n />\n );\n };\n\n return (\n <Router>\n <div className=\"app\">\n <h1 className=\"title\">\n Roomie\n </h1>\n\n <Link to=\"/\" style={{ textDecoration: 'none', color: '#888' }}>\n <h4 className=\"link\">\n Home\n </h4>\n </Link>\n\n <Link to=\"/createListing\" style={{ textDecoration: 'none', color: '#888' }}>\n <h4 className=\"link\">\n New Listing\n </h4>\n </Link>\n\n <Link to=\"/loginView\" style={{ textDecoration: 'none', color: '#888' }}>\n <h4 className=\"link\">\n Login\n </h4>\n </Link>\n\n <Link to=\"/signUpView\" style={{ textDecoration: 'none', color: '#888' }}>\n <h4 className=\"link\">\n Sign Up\n </h4>\n </Link>\n\n <Link to=\"/search\" style={{ textDecoration: 'none', color: '#888' }}>\n <h4 className=\"link\">\n Search\n </h4>\n </Link>\n\n\n <Route path=\"/search\" render={renderSearchView} />\n <Route path=\"/createListing\" render={renderCreateListingView} />\n <Route path=\"/loginView\" component={LoginView} />\n <Route path=\"/signUpView\" component={SignUpView} />\n <Route path=\"/house\" render={renderHouseListingView} />\n </div>\n </Router>\n );\n }", "_renderScene(route, navigator) {\n _navigator = navigator;\n if(route.id === 1){\n return <Journal changeRoute={this._changeRoute} userID = {this.props.userID}/>\n } else if (route.id === 2){\n return <Products changeRoute={this._changeRoute} userID = {this.props.userID}/>\n } else if (route.id === 3) {\n return <AddEntry changeRoute={this._changeRoute} photo={route.arg} userID = {this.props.userID}/>\n } else if (route.id === 4) {\n return <EntryView changeRoute={this._changeRoute} entryID={route.arg} photo={route.arg2} userID = {this.props.userID}/>\n } else if (route.id === 5) {\n return <AddProduct changeRoute={this._changeRoute} userID = {this.props.userID}/>\n } else if (route.id === 6) {\n return <ProductView product={route.arg} productID={route.arg2} changeRoute={this._changeRoute} userID = {this.props.userID}/>\n } else if (route.id === 7) {\n return <ChoosePhoto changeRoute={this._changeRoute} location={route.arg} entryID={route.arg2} userID ={this.props.userID}/>\n } else if (route.id === 8) {\n return <EntryAnalytics changeRoute={this._changeRoute} userID = {this.props.userID} year={route.arg}/>\n } else if(route.id == 9){\n return <ProductAnalytics changeRoute={this._changeRoute} userID = {this.props.userID} option={route.arg}/>\n } else if (route.id === 10) {\n return <Years changeRoute={this._changeRoute} userID = {this.props.userID}/>\n } else if(route.id == 11){\n return <Options changeRoute={this._changeRoute} userID = {this.props.userID}/>\n }\n }", "constructor(props, context) {\n super(props, context);\n\n this.state = {\n // This defines the initial navigation state.\n navigationState: {\n index: 0, // starts with first route focused.\n routes: [{key: 'Welcome'}], // starts with only one route.\n },\n };\n\n this._exit = this._exit.bind(this);\n this._onNavigationChange = this._onNavigationChange.bind(this);\n }", "render() {\n return(\n <div>\n {/* {this is the router for changing pages on the site} */}\n <BrowserRouter history={history}>\n {/* The Main Context Providers */}\n <UserProvider>\n <OrganizationProvider>\n <VerifyStatusProvider>\n <PrimaryNavSelectedProvider>\n <OpenTicketContextProvider>\n <StatusListProvider>\n <PriorityListProvider>\n <TicketColumnsContextProvider>\n <TicketProvider>\n {/* {Navbar component to navigate} */}\n {/* <Navbar/> */}\n \n \n {/* TicketTabContext to hold the ticket tabs*/}\n <TicketTabContextProvider>\n <SelectedOrgProvider>\n \n\n \n {/* {creating a switch to swap out the component to show when on different pages} */}\n \n {/* {pages and the component assgined to them} */}\n \n <Route component={AllRoutes}/>\n\n </SelectedOrgProvider>\n \n </TicketTabContextProvider>\n \n </TicketProvider>\n </TicketColumnsContextProvider>\n </PriorityListProvider>\n </StatusListProvider>\n </OpenTicketContextProvider>\n </PrimaryNavSelectedProvider>\n </VerifyStatusProvider>\n </OrganizationProvider>\n </UserProvider>\n </BrowserRouter>\n </div>\n );\n }", "render() {\n return (\n <BrowserRouter>\n <div>\n {\n // if currentUser is null, show login screen\n !this.state.currentUser ? <SignIn signIn={this.signIn}/> :\n // else show app\n <div>\n <Navigation signOut={this.signOut} userInfo={this.state.currentUser}/>\n <Route exact path=\"/\" render={() => <Home movies={this.state.movies} currentUser={this.state.currentUser}/>} />\n <Route exact path=\"/search\" render={() => <Search addMovie={this.addMovie} />} />\n </div>\n }\n </div>\n </BrowserRouter>\n )\n }", "function App() {\n return (\n <div>\n <Router history={history}>\n <Route path=\"/\" exact>\n <Base myPage={\"Content\"} />\n </Route>\n <Route path=\"/About-us\" exact>\n <Base myPage={\"AboutUs\"} />\n </Route>\n <Route path=\"/Content\" exact>\n <Base myPage={\"Content\"} />\n </Route>\n <Route path=\"/Content2\" exact>\n <Base myPage={\"Content2\"} />\n </Route>\n <Route path=\"/Login\" exact>\n <Base myPage={\"Login\"} />\n </Route>\n <Route path=\"/Createdata\" exact>\n <Base myPage={\"Createdata\"} />\n </Route>\n <Route path=\"/ScoreCalculator\" exact>\n <Base myPage={\"ScoreCalculator\"} />\n </Route>\n </Router>\n </div>\n );\n}", "render () {\r\n let summary = <Redirect to=\"/\"/>\r\n if (this.props.ings) {\r\n // We add a new prop 'purchased' which will let us redirect, if purchased is true \r\n // now we may add purchasedRedirect in the summary which will redirect to the homepage if the purchase was successful \r\n const purchasedRedirect = this.props.purchased ? <Redirect to=\"/\" /> : null;\r\n summary = ( \r\n <div>\r\n {purchasedRedirect} \r\n <CheckoutSummary \r\n ingredients={this.props.ings}\r\n checkoutCancelled={this.checkoutCancelledHandler}\r\n checkoutContinued={this.checkoutContinuedHandler}/>\r\n <Route \r\n path ={this.props.match.path + '/contact-data'} \r\n // WE NOW NO LONGER NEED THE RENDER CONTACT DATA METHOD AND CAN SIMPLY PASS THE COMPONENT \r\n // WE CAN DO THIS BECAUSE WE CAN SIMPLY GET THE STATE WITHIN CONTACT DATA \r\n component={ContactData}/>\r\n </div> \r\n );\r\n }\r\n return summary;\r\n }", "render() {\n return (\n <Appbar.Header>\n {\n !this.props.noBack ?\n <Appbar.BackAction\n onPress={()=>this.props.redirectTo(this.props.route, this.props.nextProps)}\n /> : \n null\n }\n <Appbar.Content\n title={this.props.title}\n subtitle={this.props.subtitle}\n />\n {\n !this.props.noOffer ?\n <Appbar.Action icon=\"add\" onPress={this._onSearch} /> :\n null\n }\n {\n this.props.showMap ?\n <Appbar.Action icon=\"map\" onPress={()=>this.props.redirectTo('map')} /> :\n null\n }\n {\n this.props.showList ?\n <Appbar.Action icon=\"list\" onPress={()=>this.props.redirectTo('')} /> :\n null\n }\n\n {/* <Appbar.Action icon=\"more-vert\" onPress={this._onMore} /> */}\n </Appbar.Header>\n );\n }", "_renderScene(sceneProps: Object): React.Element {\n return (\n <YourScene\n route={sceneProps.scene.route}\n onPushRoute={this._onPushRoute}\n onPopRoute={this.onPopRoute}\n onExit={this.props.onExit}\n />\n );\n }", "function NavigationHome() {\n return (\n <NavigationContainer>\n <Stack.Navigator initialRouteName=\"Home\" \n >\n <Stack.Screen name=\"Home\" component={HomeScreen} />\n <Stack.Screen name=\"Elements\" component={ElementsScreen} />\n <Stack.Screen name=\"Form\" component={FormScreen} />\n <Stack.Screen name=\"Profile\" component={ProfileScreen} />\n <Stack.Screen name=\"HomeOp\" component={HomeOpScreen} \n options={\n (props)=>({\n title: '',\n headerStyle:{\n backgroundColor: '#263546',\n },\n headerTintColor: '#fff',\n headerTitleStyle:{\n fontWeight: 'bold',\n },\n headerRight: ()=> getLogo(props),\n })\n }\n />\n <Stack.Screen name=\"Two\" component={TwoScreen} options={{ headerShown: false }}/>\n <Stack.Screen name=\"Modal\" component={Modals} />\n </Stack.Navigator>\n </NavigationContainer>\n );\n}", "_onSelect(data) { \n this.props.navigator.push({title: 'Details Page', index: 4, \n passProps : { data: data}}) \n }", "render() {\n return (\n <div className=\"app\">\n <Route exact path=\"/\" render={() => (\n <ListBooks books={this.state.books} changeShelf={this.changeShelf} />\n )}\n />\n <Route path=\"/search\" render={({ history }) => (\n <SearchBooks books={this.state.books} changeShelf={this.changeShelf} />\n )} />\n <div className=\"open-search\">\n <Link to=\"/search\">Search</Link>\n </div>\n </div> \n )\n }", "_onForward() {\n this.props.navigator.push({\n title: 'Confirm Your Event Information',\n component: Confirmation,\n passProps: {\n title: this.state.title,\n category: this.state.category,\n location: this.state.location,\n latitude: this.state.latitude,\n longitude: this.state.longitude,\n date: this.state.date,\n description: this.state.description\n }\n });\n }", "_navigate(routeName, props = null){\n\t this.props.navigator.push({\n\t name: routeName,\n\t passProps: { ...props }\n\t })\n\t}", "render() {\n return (\n <div className=\"Main.Container\"> \n <Link to='/'>\n <h1>Products</h1>\n </Link>\n\n <Link to= '/cart' ><h1>Cart({this.state.cart.length})</h1></Link>\n\n <Link to= '/admin'>\n <h1>Admin</h1>\n </Link>\n \n <Route exact path='/' render={()=>{\n return <List displayProducts= {this.state.products} \n moveToCart= {this.moveToCart}/>\n }}/>\n <Route path='/cart' render={()=> {\n return <Cart cartContent= {this.state.cart} \n removeProductFromCart={this.removeFromCart}\n />}}/>\n <Route path = '/productdetails/:id' component = {Details}/> \n \n <Route path = '/admin' render={()=>{ return <Admin get Products={this.getProducts}/>}}/>\n </div>\n );\n }", "render() {\n \n return (\n <React.Fragment>\n\n <Route\n exact\n path=\"/home\"\n render={(props) => {\n return <Home {...props} />;\n }}\n />\n\n <Route\n exact\n path=\"/plan\"\n render={(props) => {\n return <Map {...props} />;\n }}\n />\n\n <Route\n exact\n path=\"/explore\"\n render={(props) => {\n return <ExploreList {...props} />;\n }}\n />\n\n <Route\n exact\n path=\"/mytrips\"\n render={(props) => {\n return <MyTripsList {...props} />;\n }}\n />\n\n <Route\n exact\n path=\"/help\"\n render={(props) => {\n return <Help {...props} />;\n }}\n /> \n\n </React.Fragment>\n );\n }", "handleGoToSearch(){\n this.props.navigator.push({\n title: 'Padticular Apartments',\n component: Search,\n leftButtonTitle: 'Back',\n onLeftButtonPress: () => { this.props.navigator.pop() },\n rightButtonTitle: 'Logout',\n onRightButtonPress: () => {\n ref.unauth(); // Destroys User Auth\n this.props.navigator.popToTop();\n },\n passProps: {\n user: this.props.user,\n homepage: this.homeRoute,\n },\n })\n }", "render() {\n return (\n <Router history={history}>\n <Header user={this.state.user} userType={this.state.userRole} loggedIn={this.state.loggedIn} updateUser={this.updateUser} logout={this.logout}/>\n <Switch>\n <Route\n exact path=\"/home\" \n render={() => <Home userType={this.state.userRole} user={this.state.user} />}\n />\n <Route exact path=\"/\"><Redirect to=\"/home\"/></Route>\n <Route path=\"/success\" render={() => <LoadingPaypal/>}/>\n <Route path=\"/failure\" render={() => <p>Payment failed.</p>}/>\n <Route exact path=\"/register\" render={() => <Register loggedIn={this.state.loggedIn}/>}/>\n <Route exact path=\"/login\" render={() => <Login setUserRole={this.setUserRole} loggedIn={this.state.loggedIn} login={this.login}/>}/>\n <AuthenticatedComponent verify={this.verify}>\n <Switch>\n <Route\n path=\"/users\"\n render={() => (\n <User\n loggedIn={this.state.loggedIn}\n user={this.state.user}\n logout={this.logout}\n />\n )}\n />\n <Route\n path=\"/vendors\"\n render={() => (\n <Vendor\n loggedIn={this.state.loggedIn}\n vendor={this.state.user}\n logout={this.logout}\n />\n )}\n />\n <Route path=\"/protected\" component={Protected} />\n <Route component={NotFound} />\n </Switch>\n </AuthenticatedComponent>\n </Switch>\n </Router>\n );\n }", "function Router() {\n return (\n <NavigationContainer>\n <AuthRoute />\n </NavigationContainer>\n );\n}", "render(): React.Element {\n return (\n <YourNavigator\n navigationState={this.state.navigationState}\n onNavigationChange={this._onNavigationChange}\n onExit={this._exit}\n />\n );\n }", "gotoDetails(){\n const { navigator } = this.props;\n navigator.push({ name: 'PRODUCT_DETAIL'});\n\n }", "_renderScene(sceneProps) {\n\t if (sceneProps.scene.index === 0) {\n\n\t\t return (\n\t\t <Home\n\t\t route={sceneProps.scene.route}\n\t\t onPushRoute={(val) => this._onPushRoute(val)}\n\t\t onPopRoute={() => this._onPushRoute(0)}\n\t\t onExit={this.props.onExit}\n\t\t {...this.props}\n\t\t />\n\t\t\t);\n\t\t}\n\t\tif (sceneProps.scene.index === 1) {\n\t\t\treturn (\n\t\t <SettingsPage\n\t\t \troute={sceneProps.scene.route}\n\t\t onPushRoute={(val) => this._onPushRoute(val)}\n\t\t onPopRoute={() => this._onPushRoute(0)}\n\t\t onExit={this.props.onExit}\n\t\t {...this.props}\n\t\t\t\t/>\n\t\t\t);\t\n\t\t}\n\t\tif (sceneProps.scene.index === 2) {\n\t\t\treturn (\n\t\t <ArchivePage\n\t\t \troute={sceneProps.scene.route}\n\t\t onPushRoute={(val) => this._onPushRoute(val)}\n\t\t onPopRoute={() => this._onPushRoute(0)}\n\t\t onExit={this.props.onExit}\n\t\t {...this.props}\n\t\t />\n\t\t\t);\t\n\t\t}\n\t\tif (sceneProps.scene.index === 3) {\n\t\t\treturn (\n\t\t <UnitsPage\n\t\t \troute={sceneProps.scene.route}\n\t\t onPushRoute={(val) => this._onPushRoute(val)}\n\t\t onPopRoute={() => this._onPushRoute(0)}\n\t\t onExit={this.props.onExit}\n\t\t {...this.props}\n\t\t />\n\t\t\t);\t\n\t\t}\t\t\t\t\t\n }", "render(){\n return (\n <BrowserRouter>\n <div className=\"container\">\n\n <MainPage \n performSearch={this.performSearch} \n dynTags={this.state.dynTags} \n searchWord={this.state.searchWord} \n history={this.props.history}\n handleHistoryPush={this.handleHistoryPush}\n />\n \n <Switch>\n <Route \n exact\n path=\"/\"\n render={ () => <FrontPageContainer /> }\n />\n <Route \n path=\"/tags/:tag\"\n render={ props => <SearchByRoute {...props} photos={this.state.photos} performSearch={this.performSearch} searchWord={this.state.searchWord}/> }\n />\n <Route \n path=\"/search/:tag\"\n render={ props => {\n return <SearchByRoute {...props} photos={this.state.photos} performSearch={this.performSearch} searchWord={this.state.searchWord} />\n } }\n />\n {/* <Route \n path=\"/search/:tag\"\n render={ () => <PhotoContainer photos={this.state.photos}/> }\n /> */}\n <Route \n render={ () => <FourOhFour /> }\n />\n </Switch>\n \n </div>\n </BrowserRouter>\n )\n }", "function goscreen(nthis, routeName, param = null) {\n if (param == null)\n nthis.props.navigation.navigate(routeName, {lang: nthis.lang});\n else nthis.props.navigation.navigate(routeName, {...param, lang: nthis.lang});\n}", "function App() {\n\n // LEAVING OFF HERE\n // IDEA BRING OUT STATE FROM HOME AND USE IT AS STATE FOR APP.JS\n\n\n const [generalLocation, setGeneralLocation] = useState(\"London\")\n const [data, setData] = useState(\"\")\n function handleCallback(childData) {\n setData(childData)\n \n }\n console.log(\"app\", data)\n return (\n <div>\n <Route path=\"/\" exact>\n <Home loc={generalLocation} parentCallback ={handleCallback}/>\n </Route>\n <Route path=\"/:id/addLoc\" exact component={SetLocation} />\n <Route path=\"/:id/tempLoc\" exact component={SetTempLocation} />\n <Route path=\"/register\" exact component={Register} />\n <Route path=\"/login\" exact component={Login} />\n <Route path=\"/logout\" exact component={Logout} />\n <Route path=\"/weather/:location\"><Weather data={data}/></Route>\n </div>\n );\n}", "render() {\n return (\n <Container>\n <RouterView router={router}>\n <HomePage path=\"/\" />\n <SecondPage path=\"/secondPage\" />\n </RouterView>\n </Container>\n );\n }", "renderPageView(){\n if(this.state.page === 0)\n return <Browse onClick={this.handleItemDetail.bind(this)} />\n if(this.state.page === 1)\n return <ItemDetail onBrowseClick={() => this.handleBackToProducts()} onAddToCartClick={this.handleAddItemToCart.bind(this)} item={this.state.currentlySelectedItem} />\n if(this.state.page === 2)\n return <Cart cart={currentCart} onBrowseClick={() => this.handleBackToProducts()} onRemoveClick={this.handleRemoveItemFromCart.bind(this)} />\n }", "navigate(route) {\n return this.props.navigation.dispatch(\n NavigationActions.navigate({ routeName: route })\n );\n }", "function Nav(props) {\n let to_my_tasks;\n let path;\n let nav_links;\n let session_info;\n let user;\n\n function select(ev) {\n let data = {\n id: user.id,\n name: user.name,\n email: user.email,\n password: \"\",\n password_confirmation: \"\"\n };\n\n props.dispatch({\n type: 'SELECT_USER_FOR_EDITING',\n data: data\n });\n }\n\n // include navigation links only if a user has logged in\n if (props.token) {\n to_my_tasks = \"/users/\" + props.token.user_id;\n path = \"/users/edit/\" + props.token.user_id;\n user = _.find(props.users, (uu) => uu.id == props.token.user_id);\n\n nav_links =\n <ul className=\"navbar-nav mr-auto\">\n <NavItem>\n <NavLink to=\"/\" exact={true} activeClassName=\"active\"\n className=\"nav-link\">tasks</NavLink>\n </NavItem>\n <NavItem>\n <NavLink to={to_my_tasks} href=\"#\" activeClassName=\"active\"\n className=\"nav-link\">myTasks</NavLink>\n </NavItem>\n <NavItem>\n <NavLink to=\"/users\" href=\"#\" activeClassName=\"active\"\n className=\"nav-link\">users</NavLink>\n </NavItem>\n <NavItem>\n <NavLink to={path} href=\"#\" onClick={select} activeClassName=\"active\"\n className=\"nav-link\">myAccount</NavLink>\n </NavItem>\n <Logout />\n </ul>;\n session_info = <Session token={props.token} />;\n }\n else {\n nav_links = <span></span>;\n session_info = <LoginForm />;\n }\n\n return (\n <nav className=\"navbar navbar-dark bg-dark navbar-expand mb-3\">\n <span className=\"navbar-brand\">TaskTracker</span>\n {nav_links}\n <span className=\"navbar-text text-right\">{session_info}</span>\n </nav>\n );\n}", "render() {\n \n console.log(\"Navbar component - > render\");\n console.log(this.state);\n \n\n return (\n \n <React.Fragment>\n\n <nav className=\"nav flex-column\">\n\n {/* -------------- Go Home -------------- */}\n\n <NavLink \n to=\"/\"\n className={this.state.homePageSelected ? \n \"nav-link navbar-brand text-dark border-left border-danger cLeftRedBorder\" : \n \"nav-link navbar-brand text-secondary border-left border-white cLeftWhiteBorder\" \n }\n onClick={ () => this.handleNavigationSelection(\"home\") }\n >\n HOME\n </NavLink>\n\n\n {/* -------------- Go To Questions Page -------------- */}\n <NavLink \n to={{\n pathname: \"/questions\", \n state: { originPage: \"Navbar\" }\n }} \n className={this.state.questionPageSelected ? \n \"nav-link navbar-brand text-dark border-left border-danger cLeftRedBorder\" : \n \"nav-link navbar-brand text-secondary border-left border-white cLeftWhiteBorder\" \n }\n onClick={ () => this.handleNavigationSelection(\"questions\") }\n >\n Questions\n </NavLink>\n\n\n {/* -------------- Go To All Tags Page -------------- */}\n <NavLink \n to=\"/tags\" \n className={this.state.tagPageSelected ? \n \"nav-link navbar-brand text-dark border-left border-danger cLeftRedBorder\" : \n \"nav-link navbar-brand text-secondary border-left border-white cLeftWhiteBorder\" \n }\n onClick={ () => this.handleNavigationSelection(\"tags\") }\n >\n Tags\n </NavLink>\n\n\n {/* Go To All Users Page */}\n <NavLink \n to=\"/allusers\" \n className={this.state.userPageSelected ? \n \"nav-link navbar-brand text-dark border-left border-danger cLeftRedBorder\" : \n \"nav-link navbar-brand text-secondary border-left border-white cLeftWhiteBorder\" \n }\n onClick={ () => this.handleNavigationSelection(\"allusers\") }\n >\n Users\n </NavLink>\n\n\n {/* -------------- Go To Jobs Page -------------- */}\n <NavLink \n to={{\n pathname: \"/jobs\", \n state: { originPage: \"Navbar\" }\n }} \n className={this.state.jobsPageSelected ? \n \"nav-link navbar-brand text-dark border-left border-danger cLeftRedBorder\" : \n \"nav-link navbar-brand text-secondary border-left border-white cLeftWhiteBorder\" \n }\n onClick={ () => this.handleNavigationSelection(\"jobs\") }\n >\n Jobs\n </NavLink>\n\n\n </nav>\n\n </React.Fragment>\n )\n }", "render() { \n const {location} = this.props;\n\n const homeClass = location.pathname === '/' ? 'active-item' : ' ';\n const aboutClass = location.pathname === '/about' ? 'active-item' : ' ';\n\n const projectsClass = location.pathname === '/projects' ? 'active-item' : ' ';\n\n const skillsClass = location.pathname === '/skills' ? 'active-item' : ' ';\n\n const contactClass = location.pathname === '/contact' ? 'active-item' : ' ';\n\n \n console.log(location)\n\n\n\n return ( \n <Menu>\n <Link to=\"/\" className={`menu-item ${homeClass}`} href=\"/\">Home</Link>\n <Link to=\"/about\" className={`menu-item ${aboutClass}`} >About</Link>\n <Link to=\"/projects\" className={`menu-item ${projectsClass}`} >Projects</Link>\n <Link to=\"/skills\" className={`menu-item ${skillsClass}`} >Skills</Link>\n <Link to=\"/contact\" className={`menu-item ${contactClass}`} >Contact</Link>\n \n </Menu>\n );\n }", "function App() {\n return (\n <Router>\n <nav>\n <Link to=\"/\">Home</Link>\n <Link to=\"/dogs\">Dogs</Link>\n <Link to=\"/cats\">Cats</Link>\n </nav>\n <GlobalContextProvider>\n <Switch>\n <Route exact path='/'>\n <Home/>\n </Route>\n <Route path='/dogs'>\n <Dogs/>\n </Route>\n <Route path='/cats'>\n <Cats/>\n </Route>\n </Switch>\n </GlobalContextProvider>\n </Router>\n );\n}", "render() {\n return (\n <nav className=\"c-nav\">\n <ul className=\"c-nav__list\">\n <li className=\"c-nav__home\">\n <a href=\"/\"><img className=\"c-nav__logo\" src={logo} alt=\"hn-logo\" /></a>\n </li>\n <li className=\"l-list-container c-nav__search\">\n <Search changeSearch={this.props.changeOption} />\n </li>\n </ul>\n </nav>\n )\n }", "function AnyPage() {\n return (\n <BrowserRouter>\n <div>\n <Link to=\"/\">\n <button>VOLTAR</button>\n </Link>\n\n <h2>AnyPage</h2>\n <NavSide />\n <p>\n Cras facilisis urna ornare ex volutpat, et convallis erat elementum.\n Ut aliquam, ipsum vitae gravida suscipit, metus dui bibendum est, eget\n rhoncus nibh metus nec massa. Maecenas hendrerit laoreet augue nec\n molestie. Cum sociis natoque penatibus et magnis dis parturient\n montes, nascetur ridiculus mus.\n </p>\n\n <p>Duis a turpis sed lacus dapibus elementum sed eu lectus.</p>\n <main>\n <Switch>\n <Route path=\"/child\" component={Child} />\n {/* <Route path=\"/\" component={App} /> */}\n </Switch>\n </main>\n </div>\n </BrowserRouter>\n );\n}", "render() {\n\n return (\n <React.Fragment>\n <Route path=\"/login\" render={props => {\n return <Login setUser={this.props.setUser} {...props} />\n }} />\n\n <Route exact path=\"/\" render={(props) => {\n return <Home />\n }} />\n\n\n <Route exact path=\"/animals\" render={props => {\n if (this.props.user) {\n return <AnimalList {...props} />\n } else {\n return <Redirect to=\"/login\" />\n }\n }} />\n <Route path=\"/animals/new\" render={(props) => {\n return <AnimalForm {...props} />\n }} />\n <Route path=\"/animals/:animalId(\\d+)/edit\" render={props => {\n return <AnimalEditForm {...props} />\n }} />\n <Route exact path=\"/animals/:animalId(\\d+)\" render={(props) => {\n // Pass the animalId to the AnimalDetailComponent\n return <AnimalDetail animalId={parseInt(props.match.params.animalId)} {...props} />\n }} />\n\n\n\n <Route exact path=\"/locations\" render={(props) => {\n if (this.props.user) {\n return <LocationList {...props} />\n } else {\n return <Redirect to=\"/login\" />\n }\n }} />\n <Route path=\"/locations/:locationId(\\d+)\" render={(props) => {\n return <LocationDetail locationId={parseInt(props.match.params.locationId)} {...props} />\n }} />\n <Route path=\"/locations/new\" render={(props) => {\n return <LocationForm {...props} />\n }} />\n <Route path=\"/locations/:locationId(\\d+)/edit\" render={props => {\n return <LocationEditForm {...props} />\n }} />\n <Route exact path=\"/locations/:locationId(\\d+)\" render={(props) => {\n // Pass the animalId to the AnimalDetailComponent\n return <LocationDetail locationId={parseInt(props.match.params.locationId)} {...props} />\n }} />\n\n\n\n\n <Route exact path=\"/Employee\" render={(props) => {\n if (this.props.user) {\n return <EmployeeList {...props} />\n } else {\n return <Redirect to=\"/login\" />\n }\n }} />\n <Route path=\"/employees/new\" render={(props) => {\n return <EmployeeForm {...props} />\n }} />\n <Route path=\"/employees/:employeeId(\\d+)/edit\" render={props => {\n return <EmployeeEditForm {...props} />\n }} />\n <Route path=\"/employees/:employeeId(\\d+)/details\" render={(props) => {\n return <EmployeeWithAnimals {...props} />\n }} />\n\n\n\n <Route exact path=\"/owner\" render={(props) => {\n if (this.props.user) {\n return <OwnerList {...props} />\n } else {\n return <Redirect to=\"/login\" />\n }\n }} />\n <Route path=\"/owners/:ownerId(\\d+)\" render={(props) => {\n return <OwnerDetail ownerId={parseInt(props.match.params.ownerId)} {...props} />\n }} />\n\n </React.Fragment>\n )\n }", "function Navigation() {\n\n //making the default useState the About page\n const [currentPage, setCurrentPage] = useState(\"About\");\n\n const renderPage = () => {\n if (currentPage === \"About\") {\n return <About />\n }\n if (currentPage === \"Portfolio\") {\n return <Portfolio />\n }\n if (currentPage === \"Skills\") {\n return <Skills />\n }\n if (currentPage === \"Contact\") {\n return <ContactInfo />\n }\n if (currentPage === \"Resume\") {\n return <Resume />\n }\n }\n\n //Function to update useState\n const handlePageChange = (page) => setCurrentPage(page);\n\n return (\n <>\n <Header currentPage={currentPage} handlePageChange={handlePageChange} />\n <main>\n {renderPage()}\n </main>\n <Footer />\n </>\n );\n \n}", "redirect() {\n const { navigate } = this.props.navigation\n navigate('MyWorkout')\n }", "static goPage(params, page) {\n const navigation = NavigationUtil.navigation;\n /*children level router can't jump to parent level router*/\n //const {navigation} = params;\n if (!navigation) {\n console.log('NavigationUtil.navigation can\\'t be null.')\n }\n navigation.navigate(\n page,\n {\n ...params\n }\n );\n }", "function App() {\n return (\n <NavigationContainer>\n <Stack.Navigator initialRouteName=\"Login\">\n <Stack.Screen name=\"Login\" component={Login} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"RegisterNewUser\" component={RegisterNewUser} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"HomeUser\" component={HomeUser} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"HomeAdmin\" component={HomeAdmin} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"InsertBooking\" component={InsertBooking} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"AddOtherSupplies\" component={AddOtherSupplies} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"ViewBookingsUser\" component={ViewBookingsUser} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"GetInvoice\" component={GetInvoice} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"RegisterMechanic\" component={RegisterMechanic} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"ViewMechanics\" component={ViewMechanics} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"GetAllBookings\" component={GetAllBookings} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"GetBookingsPerDay\" component={GetBookingsPerDay} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"GetBookingsPerWeek\" component={GetBookingsPerWeek} options={{ title: 'Garage' }}/> \n <Stack.Screen name=\"UpdateStatusOfBookings\" component={UpdateStatusOfBookings} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"AssignTasksToStaff\" component={AssignTasksToStaff} options={{ title: 'Garage' }}/>\n <Stack.Screen name=\"ViewRosterPerDay\" component={ViewRosterPerDay} options={{ title: 'Garage' }}/>\n\n </Stack.Navigator>\n </NavigationContainer>\n );\n}", "render(){\n return (\n <div>\n <Home />\n <Products products={this.state.products}/>\n <Menu />\n <About />\n </div>\n );\n }", "render() {\n return (\n <div className=\"app\">\n <Route\n\n //specifies to main page, which contains all the three shelves (categories)\n exact path=\"/\"\n render={() => (\n <BookInShelf books={this.state.books} changeShelf={this.changeShelf} />\n )}\n />\n\n\n <Route\n\n //specifies to search page, which contains the input text field to search for books per interest\n path=\"/search\"\n render={() => (\n <SearchPage\n\n //all methods to make sure the application works as per the requirements are called here with states\n selectShelf={this.selectShelf}\n books={this.state.searchedBooks}\n handleSearch={evt => this.handleSearch(evt.target.value)}\n query={this.state.query}\n clearQuery={this.clearQuery}\n />\n )}\n />\n\n </div>\n );\n }", "render() {\n return (\n <React.Fragment>\n <Route exact path=\"/\" render={props => {\n return <Home />;\n }}\n />\n <Route exact path=\"/animals\" render={props => {\n \n if (this.props.user) {\n return <AnimalList {...props} />;\n } else {\n return <Redirect to=\"/login\" />;\n }\n }}\n />\n <Route exact path=\"/owners\" render={props => {\n if (this.props.user) {\n return <OwnerList {...props} />;\n } else {\n return <Redirect to=\"/login\" />;\n }\n }}\n />\n <Route exact path=\"/employees\" render={props => {\n if (this.props.user) {\n return <EmployeeList {...props} />;\n } else {\n return <Redirect to=\"/login\" />;\n }\n \n }}\n />\n <Route exact path=\"/locations\" render={props => {\n if (this.props.user) {\n return <LocationList {...props} />;\n } else {\n return <Redirect to=\"/login\" />;\n }\n }}\n />\n <Route exact path=\"/animals/:animalId(\\d+)\" render={props => {\n console.log(props, parseInt(props.match.params.animalId));\n // Pass the animalId to the AnimalDetailComponent\n return (\n <AnimalDetail\n animalId={parseInt(props.match.params.animalId)}\n {...props}\n />\n );\n }}\n />\n <Route path=\"/employees/:employeeId(\\d+)/details\" render={(props) => {\n return <EmployeeWithAnimals {...props} />\n }} />\n <Route path=\"/locations/:locationId(\\d+)\" render={props => {\n console.log(props, parseInt(props.match.params.locationId));\n return (\n <LocationDetail\n locationId={parseInt(props.match.params.locationId)}\n {...props}\n />\n );\n }}\n />\n <Route path=\"/animals/new\" render={props => {\n return <AnimalForm {...props} />;\n }}\n />\n <Route path=\"/employees/new\" render={props => {\n return <EmployeeForm {...props} />;\n }}\n />\n <Route path=\"/locations/new\" render={props => {\n return <LocationForm {...props} />;\n }}\n /> \n <Route path=\"/owners/new\" render={props => {\n return <OwnerForm {...props}/>\n }}/>\n <Route path=\"/animals/:animalId(\\d+)/edit\" render={props => {\n return <AnimalEditForm {...props} />\n }}\n />\n \n {/* //pass the `setUser` function to Login component. */}\n <Route path=\"/login\" render={props => {\n return <Login setUser={this.props.setUser} {...props} />\n }} />\n </React.Fragment>\n );\n }", "function App() {\n return (\n <Router>\n <div>\n <Nav/>\n <Sidenav img=\"https://randomuser.me/api/portraits/men/72.jpg\" name=\"John Doe\"/>\n <Switch>\n <Route exact path=\"/top\" component={Top} />\n <Route exact path=\"/categories\" component={Categories} />\n <Route exact path=\"/categories/:category\" component={ByCategory} />\n <Route exact path=\"/complexity\" component={Complexity} />\n <Route exact path=\"/complexity/:complexity\" component={ByComplexity} />\n <Route exact path=\"/games/:id\" component={Game} />\n <Route exact path=\"/search/:search\" component={Search} />\n <Route exact path=\"/suggestions\" component={Recomendations} />\n <Route exact path=\"/\" component={Home} />\n <Route exact path=\"/games\" render={(props) => <SavedGames {...props}\n mail=\"[email protected]\"\n />}/>\n \n <Route exact path=\"/profile\" render={(props) => <User {...props} \n img={\"https://randomuser.me/api/portraits/men/72.jpg\"} \n name=\"John Doe\" \n saved=\"42\" \n phone=\"+555417187\" \n location=\"Mexico City, Mexico\" \n email=\"[email protected]\"\n gender=\"Male\"\n age=\"29\"\n favorite=\"Catan\"\n status=\"Looking for people to play Catan with\"/>}/>\n <Route component={NoMatch} />\n </Switch>\n </div>\n </Router>\n );\n}", "function App() {\n return (\n <BrowserRouter>\n <div className=\"App\">\n <Header />\n <Switch>\n <Route exact path = \"/\">\n <div className=\"HomePage\">\n <div className=\"parentHomePage\">\n <div className=\"childHomePage\">\n <SignIn />\n </div>\n <div className=\"childHomePage\">\n <HomeMenu />\n </div>\n </div> \n </div>\n </Route>\n\n <Route exact path = \"/signup\">\n <div className=\"HomePage\">\n <div className=\"parentHomePage\">\n <div className=\"childHomePage\" id=\"signup\">\n <SignUp />\n </div>\n <div className=\"childHomePage\">\n <HomeMenu />\n </div>\n </div> \n </div>\n </Route>\n\n {/* <Route exact path = \"/messages\">\n <div className=\"HomePage\">\n <div className=\"parentHomePage\">\n <div className=\"childHomePage\">\n <HomeMessage />\n </div>\n <div className=\"childHomePage\">\n <HomeMenu />\n </div>\n </div> \n </div>\n </Route> */}\n\n <Route exact path = \"/about\">\n <div className=\"HomePage\">\n <div className=\"parentHomePage\">\n <div className=\"childHomePage\" id=\"aboutview\">\n <About />\n </div>\n <div className=\"childHomePage\">\n <HomeMenu />\n </div>\n </div> \n </div>\n </Route>\n\n <Route path=\"/currentmessage\" component={CurrentMessage} />\n <Route path=\"/newmessage\">\n <div className=\"newMessage\">\n {/* <div className=\"savedAndNewMessage\" id=\"savedMessage\">\n <SavedMessage />\n </div> */}\n <div className=\"savedAndNewMessage\">\n <NewMessage />\n </div>\n </div>\n </Route>\n </Switch>\n </div>\n </BrowserRouter>\n );\n}", "_getARNavigator(organization) {\n if (this.state.cause === ENV){\n return (\n <ViroARSceneNavigator {...this.state.sharedProps}\n initialScene={{scene: EnvARScene}} />\n );\n } else if (this.state.cause === RIGHTS){\n return (\n <ViroARSceneNavigator {...this.state.sharedProps}\n initialScene={{scene: RightsARScene}} />\n );\n } else if (this.state.cause === SOCIAL){\n return (\n <ViroARSceneNavigator {...this.state.sharedProps}\n initialScene={{scene: SocialARScene}} />\n );\n }\n }", "render() {\n return (\n <div>\n <Header auth={this.props.auth} hasAProfile={this.state.hasAProfile} />\n <Switch>\n <Route exact path=\"/\" render={ () => <Home auth={this.props.auth} />} />\n { this.props.auth.isAuthenticated() ?\n <React.Fragment>\n { this.state.hasAProfile ?\n <React.Fragment>\n <Route path=\"/profile\" render={ () => <Profile full_name={this.state.full_name} city={this.state.city} state={this.state.state} />} />\n <Route path=\"/allbooks\" render={ () => <AllBooks />} />\n <Route path=\"/mybooks\" render={ () => <MyBooks />} />\n <Route path=\"/requests\" render={ () => <Requests />} />\n </React.Fragment> :\n <Profile full_name={this.state.full_name} city={this.state.city} state={this.state.state} />\n }\n </React.Fragment> :\n <Home auth={this.props.auth} />\n }\n </Switch>\n </div>\n );\n }", "render() {\n\n// define shelf values\n// var selectedShelf=['none','wantToRead','read','currentlyReading']\n\n return (\n <div className=\"app\">\n\n <Route\n exact\n path=\"/\"\n render={() => (\n\n <BookShelf\n books={this.state.books}\n onUpdateShelf={this.updateShelf}\n selectedShelf={this.state.selectedShelf}\n getBookShelf={this.getBookShelf}\n />\n\n // end of the route (\\) which include three component\n )}\n />\n\n <Route\n path=\"/search\"\n render={() => (\n <Search\n books={this.state.searchResults}\n shelf={this.state.selectedShelf}\n onSearchShelf={(query) => {\n this.searchShelf(query)\n }}\n onUpdateShelf={(book, shelf) => {\n this.updateShelf(book, shelf)\n }}\n getBookShelf={this.getBookShelf}\n />\n\n )}\n />\n\n\n </div>\n )// end of return\n }", "render() { // remove <Header currentUser={this.state.currentUser}/> when using redux\n return (\n <div>\n <Header />\n <Switch>\n <Route exact path='/' component={HomePage} />\n <Route path='/shop' component={ShopPage} />\n <Route path='/checkout' component={CheckoutPage} />\n <Route exact path='/signin' render={() => this.props.currentUser ? (<Redirect to='/' />) : (<SignInAndSignUpPage />)} /> \n </Switch>\n </div>\n );\n }", "render() {\n return (\n <div>\n <BrowserRouter>\n <Switch>\n <Redirect exact from=\"/\" to=\"/products\" ></Redirect>\n <Route path=\"/products\"\n render={(props) => (\n <Products {...props} products={this.state.products} />\n )}>\n </Route>\n\n <Route\n path=\"/basket\"\n render={(props) => (\n <Basket {...props} cartItems={this.state.cartItems} />\n )}>\n </Route>\n <Route\n path=\"/order\"\n render={(props) => (\n <Order {...props} cartItems={this.state.cartItems} />\n )}>\n </Route>\n </Switch>\n </BrowserRouter>\n </div>\n );\n }", "render(){\n return(\n\n // Routing works for all the sub components in the BrowserRouter component\n <BrowserRouter>\n\n {/* <Layout> handles the toolbar and the sidedrawers.\n props sent to component - \n username: taken from the redux state\n */}\n <Layout username = {this.props.username} >\n\n {/* Only one of the routes is selected at a time declared within <Switch> */}\n <Switch>\n { /*if user is authenticated then go to the home page otherwise to the login page when \"<baseurl>/\" is typed in url bar*/\n this.props.isAuthenticated ?\n <Route path =\"/\" exact render = {() => (<Redirect to={'/' + this.props.username + \"/home\"} />)} />\n :\n <Route path =\"/\" exact render = {() => (<Redirect to='/login' />)} />\n }\n \n { /* \n following proxyhome concept is used because the <Home> does no rerender otherwise if \n we search for a new user in the toolbar search box\n */}\n <Redirect exact from=\"/:urlUsername/proxyhome\" to='/:urlUsername/home' />\n <Route path= '/:urlUsername/home' exact component = {Home} />\n \n <Route path='/aboutapp' exact component = {AboutApp} />\n <Route path='/signup' exact component = {SignUp} />\n { /* \n if user is authenticated then go to home page otherwise go to login page when user \n types <baseurl>/login in url bar \n */\n this.props.isAuthenticated ?\n <Route path='/login' exact render = {() => (<Redirect to={'/' + this.props.username + \"/home\"} />)} />\n :\n <Route path='/login' exact component = {Auth} />\n }\n \n <Route path='/logout' exact component = {Logout} /> \n\n {/* All the other unmatched urls request will be given response of 404 page not found by the below route */}\n <Route \n render = {() => \n <div className = \"PageNotFound\">\n Error 404: Page not found\n </div> \n } \n />\n </Switch>\n </Layout> \n </BrowserRouter>\n );\n }", "render(){\n return (\n <div className=\"App\">\n <BrowserRouter>\n <Switch>\n <Route path=\"/\" exact component={PageOfStart}/>\n <Route path=\"/color\" exact render={(props) => <PageOfColorSelection colorList={this.state.colorList} getColorChoice={this.getColorChoice} getSizeChoice={this.getSizeChoice} setColorChoice={this.setColorChoice} />} />\n <Route path=\"/size\" exact render={(props) => <PageOfSizeSelection sizeList={this.state.sizeList} getSizeChoice={this.getSizeChoice} setSizeChoice={this.setSizeChoice} />} />\n <Route path=\"/bird\" exact render={(props) => <PageOfBirdSelection birdList={this.state.birdList} getBirdChoice={this.getBirdChoice} getSizeChoice={this.getSizeChoice} setBirdChoice={this.setBirdChoice} getColorChoice={this.getColorChoice} />} />\n <Route path=\"/birdInfo\" exact render={(props) => <PageOfBirdInfo birdList={this.state.birdList} getBirdChoice={this.getBirdChoice} getSizeChoice={this.getSizeChoice}/>}/>\n <Route path=\"/about\" exact render={(props) => <PageOfAbout birdList={this.state.birdList} getBirdChoice={this.getBirdChoice} getSizeChoice={this.getSizeChoice}/>}/>\n\n </Switch>\n </BrowserRouter>\n </div>\n );\n }", "function App() {\n return (\n <div>\n <Nav/>\n <Landing/>\n </div>\n )\n}", "render() {\n return (\n <Router>\n <div>\n <Navbar user={this.state.user} />\n <Route exact path=\"/\" component={HomePage} />\n <Route exact path=\"/browse\" component={() => <BrowserPage photos={this.state.photos} />}\n />\n <Route exact path=\"/browse/:id\" component={ViewPostPage} />\n <Route exact path=\"/browse/:id/create\" component={() => <CreatePostPage photoUpdate={this.updatePhotos}/>} />\n <Route exact path=\"/user/:id/profile\" render={(props) => {\n return ( this.state.user\n ? <ProfilePage renderProps={props} user={this.state.user} />\n : <LoginForm updateUser={this.updateUser} />\n )\n }} />\n <Route exact path=\"/login\" component={() => <LoginForm updateUser={this.updateUser} />}\n />\n <Route exact path=\"/signup\" component={() => <Signup updateUser={this.updateUser} />} />\n </div>\n </Router>\n );\n }", "function useNavigationHelpers(_ref) {\n let {\n id: navigatorId,\n onAction,\n getState,\n emitter,\n router\n } = _ref;\n const onUnhandledAction = React.useContext(_UnhandledActionContext.default);\n const parentNavigationHelpers = React.useContext(_NavigationContext.default);\n return React.useMemo(() => {\n const dispatch = op => {\n const action = typeof op === 'function' ? op(getState()) : op;\n const handled = onAction(action);\n\n if (!handled) {\n onUnhandledAction === null || onUnhandledAction === void 0 ? void 0 : onUnhandledAction(action);\n }\n };\n\n const actions = { ...router.actionCreators,\n ..._routers.CommonActions\n };\n const helpers = Object.keys(actions).reduce((acc, name) => {\n // @ts-expect-error: name is a valid key, but TypeScript is dumb\n acc[name] = function () {\n return dispatch(actions[name](...arguments));\n };\n\n return acc;\n }, {});\n const navigationHelpers = { ...parentNavigationHelpers,\n ...helpers,\n dispatch,\n emit: emitter.emit,\n isFocused: parentNavigationHelpers ? parentNavigationHelpers.isFocused : () => true,\n canGoBack: () => {\n const state = getState();\n return router.getStateForAction(state, _routers.CommonActions.goBack(), {\n routeNames: state.routeNames,\n routeParamList: {},\n routeGetIdList: {}\n }) !== null || (parentNavigationHelpers === null || parentNavigationHelpers === void 0 ? void 0 : parentNavigationHelpers.canGoBack()) || false;\n },\n getId: () => navigatorId,\n getParent: id => {\n if (id !== undefined) {\n let current = navigationHelpers;\n\n while (current && id !== current.getId()) {\n current = current.getParent();\n }\n\n return current;\n }\n\n return parentNavigationHelpers;\n },\n getState\n };\n return navigationHelpers;\n }, [navigatorId, emitter.emit, getState, onAction, onUnhandledAction, parentNavigationHelpers, router]);\n}", "render() {\n const authenticated = this.state.isAuth;\n return (\n <div className=\"Router\">\n <Header userData={this.state.userOptions} isAuth={this.state.isAuth} history={ this.props.history} signOut={this.saveToGlobalState} />\n <Switch>\n {/* redirect root route to courses route */}\n <Redirect from=\"/\" exact to=\"/courses\" />\n\n {/*\n I had some trouble figuring out nested routes within a switch\n found the solution here: https://stackoverflow.com/questions/41474134/nested-routes-with-react-router-v4\n */}\n\n <Route\n path=\"/courses\"\n render={({ match: { url } }) => (\n <>\n {/* Courses overview */}\n <Route exact path={ `${url}` } render={ () => <Courses history={ this.props.history } />} />\n\n {/*\n Create course\n This is a protected route\n When the user is authenticated render component\n Else render redirect component witch redirects to /signin\n I could use a HOC, but this is cleaner\n */}\n\n <Route exact path={ `${url}/create` } render={\n (props) => (authenticated) ?\n <CreateCourse {...props} history={ this.props.history } saveState={this.saveToGlobalState} userDetails={this.state.userOptions} /> :\n <Redirect to=\"/signin\" />\n } />\n\n {/* Course details */}\n\n <Route exact path={ `${url}/:courseId/detail` } render={\n (props) => <CourseDetail {...props} userDetails={this.state.userOptions} />\n } />\n\n {/*\n Update course\n This is a protected route\n When the user is authenticated render component\n Else render redirect component witch redirects to /signin\n I could use a HOC, but this is cleaner\n */}\n\n <Route exact path={ `${url}/:courseId/detail/update` } render={\n (props) => (authenticated) ?\n <UpdateCourse {...props} userDetails={this.state.userOptions} saveState={this.saveToGlobalState}/> :\n <Redirect to=\"/signin\" />\n } />\n </>\n )}\n />\n {/* Sign in */}\n <Route exact path=\"/signin\" render={() => <UserSignIn history={ this.props.history } isSignedIn={this.userSignIn} />} />\n {/* Sign up */}\n <Route exact path=\"/signup\" render={() => <UserSignUp history={ this.props.history } />} />\n {/* logout */}\n <Route exact path=\"/signout\" />\n {/* forbidden route */}\n <Route exact path=\"/forbidden\" component={Forbidden} />\n {/* route for errors */}\n <Route exact path=\"/error\" component={UnhandledError} />\n {/* When no route matches show not found component */}\n <Route component={NotFound} />\n </Switch>\n </div>\n )\n }", "render(){\n return (\n <Router>\n <main>\n <Header/>\n <Switch>\n <Route path=\"/home\" render={ (props) => <Home {...props} /> } />\n <Route path=\"/register\" render={ (props) => <Register {...props} setUserInfo={this.setUserInfo} /> } />\n <Route path=\"/login\" render={ (props) => <Login {...props} setUserInfo={this.setUserInfo} /> } />\n <Route path=\"/index\" component={ CountrySearch } />\n \n </Switch>\n </main>\n </Router>\n );\n }", "goDetails(){\n //this.props.navigation.push('RideDetails');\n }", "function AboutPageWithStack({ navigation }) {\n return (\n <Stack.Navigator\n initialRouteName=\"About\"\n screenOptions={{\n headerLeft: ()=> <NavigationDrawerStructure navigationProps={navigation} />, //left drawer menu icon from cust component\n headerStyle: {\n backgroundColor: '#0E7AD5', //Set Header background color\n },\n headerTintColor: '#fff', //Set Header text & icon color\n headerTitleStyle: {\n fontWeight: 'bold', //Set Header text font & style\n }\n }}>\n <Stack.Screen\n name=\"About\"\n component={aboutPage}\n options={{\n title: 'About', //Set Header Title\n }}/>\n <Stack.Screen\n name=\"Contact\"\n component={contactPage}\n options={{\n title: 'Contact', //Set Header Title\n }}/>\n </Stack.Navigator>\n );\n}", "render() {\n return(\n <HashRouter>\n <div className=\"container\">\n <Navigation />\n\n <Route exact path=\"/search\" render={ () => <SearchForm onSearch={this.performSearch} onSelectTitle={this.handleTitle} /> } />\n <h1 style={{display: this.state.loading ? 'block' : 'none' }}><br/>Loading...</h1>\n\n <Switch>\n <Route exact path=\"/\" render={ () => <Redirect to=\"/cats\"/> } />\n <Route exact path=\"/cats\" render={ () => <Cats fetch={this.fetchDefault} photos={this.state.catsPhotos} title=\"Cats\" /> } />\n <Route exact path=\"/dogs\" render={ () => <Dogs fetch={this.fetchDefault} photos={this.state.dogsPhotos} title=\"Dogs\" /> } />\n <Route exact path=\"/flowers\" render={ () => <Flowers fetch={this.fetchDefault} photos={this.state.flowersPhotos} title=\"Flowers\" /> } />\n <Route exact path=\"/search\" render={ () => <CurrentPhotos photos={this.state.currentPhotos} title={this.state.imageTitle} /> } />\n\n <Route component={PageNotFound} />\n </Switch>\n </div>\n </HashRouter>\n );\n }", "renderScene(route, navigator){\n switch(route.name){\n case 'Login': \n return(<Login navigator = {navigator} route = {route}/>);\n case 'Settings':\n return(<Settings navigator = {navigator} route = {route}/>);\n case 'ClientList':\n return(<ClientList navigator = {navigator} route = {route}/>);\n case 'ClientDetail':\n return(<ClientDetail navigator = {navigator} route = {route}/>);\n case 'Confirmation':\n return(<Confirmation navigator = {navigator} route = {route}/>);\n case 'Success':\n return(<Success navigator = {navigator} route = {route}/>);\n }\n }", "function Navigation() {\n\n \n\n return (\n <div>\n\n\n <div className=\"nav\">\n <Link to=\"/\">&#60; Movies</Link>\n <Link to=\"/about\">About</Link>\n <img className=\"img\"\n src={logo}\n alt=\"profile\" />\n <Link to=\"/Home2\">Home</Link>\n <Link to=\"/Home2\">Join us</Link>\n </div>\n\n\n <div>\n <p className=\"grade_title\">Quick grade guide</p>\n <div className=\"grade\">\n <p>violent1 : bleeding </p>\n <p>violent2 : physical fighting </p>\n <p>violent3 : kill, gore </p>\n \n <p>nudity1 : kiss </p>\n <p>nudity2 : nudity </p>\n <p>nudity3 : sex scene </p>\n </div>\n <Link to=\"/Home2\">Detail</Link>\n \n </div>\n\n\n \n <div className=\"copyright\">\n <p>copyright ©shootingcorn All rights reserve. </p>\n </div>\n \n\n\n </div>\n\n\n );\n}", "_onViewMyBookingsClick() {\n this.props.push('/bookings')\n }", "renderScreen() {\n switch (this.state.currentView) {\n case Views.Village:\n return <Village {...this.props} />\n case Views.Technology:\n return <TechTree {...this.props} />\n default: \n return <div/>\n }\n }", "render() {\n\n return (\n\n <div className=\"app\">\n\n <Switch>\n\n\n{/* Base Page Route */}\n <Route exact path=\"/\" render={() => (\n <BookListing bookInventory={this.state.bookInventory} changeShelf={this.changeShelf} />\n )}/>\n\n{/* Search Page Route */}\n <Route exact path=\"/search\" render={() => (\n <SearchBooks bookInventory={this.state.bookInventory} changeShelf={this.changeShelf} />\n )}/>\n\n{/* Bad URL */}\n <Route component={Error404} />\n\n </Switch>\n\n\n </div>\n )\n }", "render() {\n\n\t\tlet page;\n\n\t //renders appropriate personality info depending on this.props.current\n\t switch (this.props.current) {\n\t case \"Augest\":\n\t page = <Augest />;\n\t break;\n\t case \"Kalista\":\n\t \tpage = <Kalista />;\n\t \tbreak;\n\t case \"Kane\":\n\t \tpage = <Kane />;\n\t \tbreak;\n\t case \"Roque\":\n\t \tpage = <Roque />;\n\t \tbreak;\n\t case \"Urvyn\":\n\t \tpage = <Urvyn />;\n\t \tbreak;\n\t }\n\n\t\treturn (\n\t\t<div>\n\t\t\t<CharacterNavBar \n\t\t\t\tonClick = {this.props.onClick}\n \t\tcurrent = {this.props.current}/>\n\n\t\t\t{page}\n\n\t\t</div>\n\t\t)\n\t}", "function Main({ user }) {\n return (\n <Router>\n <div>\n <Navbar user={user}/>\n <Route exact path=\"/\">\n <About user={user} />\n </Route>\n <Route path=\"/portfolio\">\n <Portfolio user={user} />\n </Route>\n <Route path=\"/education\">\n <Education user={user} />\n </Route>\n <Route path=\"/experience\">\n <Experience user={user} />\n </Route>\n </div>\n </Router>\n );\n}", "render(){\n\n //destructure store\n const { navBar } = this.props.store\n\n return(\n <div>\n <NavBar store={navBar}/>\n <div class=\"content\">\n <div class=\"index_main_body\">\n {this.props.children}\n </div>\n </div>\n </div>\n )\n }", "render() {\n return (\n <div className=\"App\">\n <Particles className='particles'\n params={particlesOptions}\n />\n <Navigation type={this.state.user.type} isSignedIn={this.state.isSignedIn} onRouteChange={this.onRouteChange}/>\n\n <div className='switch'>\n {this.state.route === 'SYS_ADMIN'\n ? <Admin/>\n : (this.state.route === 'LOCAL_ADMIN' ?\n <LocalAdmin serverIdForAdmin={this.state.user.serverIdForAdmin}/>\n : (this.state.route === 'TECH') ?\n <TechnicianUI techMail={this.state.user.email}/>\n : <SignIn loadUser={this.loadUser} onRouteChange={this.onRouteChange}/>\n )\n }\n </div>\n </div>\n );\n }", "function NavItems(props) {\r\n\r\n // states for drop down menu\r\n const [open, setOpen] = useState(false);\r\n\r\n // Drop down menu switch\r\n const openTab = () => setOpen(!open); \r\n\r\n // Case 1: The admin navigation item\r\n if(props.admin === true)\r\n {\r\n return (\r\n <li className=\"navItem\">\r\n <Link to=\"/admin\" className=\"navButton\" onClick={openTab}>\r\n <RemixIcons.RiAdminLine size=\"32\"/> \r\n \r\n {open && props.children}\r\n </Link>\r\n </li>\r\n );\r\n }\r\n\r\n // Case 2: Other admin navigation item\r\n else {\r\n return (\r\n <li className=\"navItem\">\r\n <Link to={props.path || '/#'} className=\"navButton\" onClick={openTab}>\r\n <props.icon size=\"32\"/> \r\n \r\n {open && props.children}\r\n </Link>\r\n </li>\r\n );\r\n }\r\n \r\n}", "render() {\n return (\n <React.Fragment>\n <Route\n exact\n path=\"/\"\n render={props => {\n if (this.isAuthenticated()) {\n return <TopicList />;\n } else {\n return <Redirect to=\"/Login\" />;\n }\n }}\n />\n <Route\n exact\n path=\"/Topics\"\n render={props => {\n if (this.isAuthenticated()) {\n return <TopicList />;\n } else {\n return <Redirect to=\"/Login\" />;\n }\n }}\n />\n <Route\n exact\n path=\"/Login\"\n render={props => {\n if (this.isAuthenticated()) {\n return <Redirect to=\"/\" />;\n } else {\n return (\n <Login\n setUser={this.props.setUser}\n currentUser={this.props.currentUser}\n />\n );\n }\n }}\n setUser={this.props.setUser}\n />\n <Route\n exact\n path=\"/Signup\"\n render={props => {\n return <Signup setUser={this.props.setUser} />;\n }}\n />\n <Route\n path=\"/Topics/:TopicId\"\n render={props => {\n if (this.isAuthenticated()) {\n return (\n <Topic\n key={props.location.state.topic[\"topicId\"]}\n topic={props.location.state.topic}\n />\n );\n } else {\n return <Redirect to=\"/Login\" />;\n }\n }}\n />\n <Route\n exact\n path=\"/ResourceTypes\"\n render={props => {\n if (this.isAuthenticated()) {\n return <ResourceTypeList />;\n } else {\n return <Redirect to=\"/Login\" />;\n }\n }}\n />\n <Route\n path=\"/ResourceTypes/:ResourceTypeId\"\n render={props => {\n console.log(\"I hit the resource TYpes route\");\n console.log(props.location.state.resourceType);\n if (this.isAuthenticated()) {\n return (\n <ResourceType\n key={props.location.state.resourceType[\"resourceTypeId\"]}\n resourceType={props.location.state.resourceType}\n />\n );\n } else {\n return <Redirect to=\"/Login\" />;\n }\n }}\n />\n <Route\n exact\n path=\"/Resources/:ResourceId\"\n render={props => {\n if (this.isAuthenticated()) {\n return (\n <Resource\n key={props.location.state.resource[\"resourceId\"]}\n resource={props.location.state.resource}\n />\n );\n } else {\n return <Redirect to=\"/Login\" />;\n }\n }}\n />\n <Route\n exact\n path=\"/CreateTopic\"\n render={props => {\n if (this.isAuthenticated()) {\n return <CreateTopic />;\n } else {\n return <Redirect to=\"/Login\" />;\n }\n }}\n />\n <Route\n exact\n path=\"/CreateResource\"\n render={props => {\n if (this.isAuthenticated()) {\n return (\n <CreateResource\n key={props.location.state.resourceType[\"resourceTypeId\"]}\n resourceType={props.location.state.resourceType}\n />\n );\n } else {\n return <Redirect to=\"/Login\" />;\n }\n }}\n />\n <Route\n exact\n path=\"/EditResource/:ResourceId\"\n render={props => {\n if (this.isAuthenticated()) {\n return (\n <EditResource\n key={props.location.state.resource[\"resourceId\"]}\n resource={props.location.state.resource}\n />\n );\n } else {\n return <Redirect to=\"/Login\" />;\n }\n }}\n />\n <Route\n exact\n path=\"/EditTopic/:topic\"\n render={props => {\n if (this.isAuthenticated()) {\n return (\n <EditTopic\n key={props.location.state.topic[\"topicId\"]}\n topic={props.location.state.topic}\n />\n );\n } else {\n return <Redirect to=\"/Login\" />;\n }\n }}\n />\n </React.Fragment>\n );\n }", "render() {\n //console.log(this.props.user);\n return (\n <React.Fragment>\n {/* <Route\n exact\n path='/'\n render={props => {\n return <Home />;\n }}\n /> */}\n\n <Route\n exact\n path='/'\n render={props => {\n if (this.props.user) {\n return <AccountList user={this.props.user} {...props} />;\n } else {\n return <Redirect to='/login' />;\n }\n }}\n />\n <Route\n exact\n path='/accounts/:accountId(\\d+)'\n render={props => {\n if (this.props.user) {\n return (\n <AccountDetails\n AccountId={parseInt(props.match.params.accountId)}\n {...props}\n />\n );\n } else {\n return <Redirect to='/login' />;\n }\n }}\n />\n <Route\n exact\n path='/accounts/:accountId(\\d+)/Locations'\n render={props => {\n if (this.props.user) {\n return (\n <LocationList\n accountId={parseInt(props.match.params.accountId)}\n {...props}\n />\n );\n } else {\n return <Redirect to='/login' />;\n }\n }}\n />\n {/* <Route\n exact\n path='/accounts/:accountId(\\d+)/Locations/:locationId(\\d+)'\n render={props => {\n if (this.props.user) {\n return (\n <EditLocationForm\n accountId={parseInt(props.match.params.accountId)}\n locationId={parseInt(props.match.params.locationId)}\n {...props}\n />\n );\n } else {\n return <Redirect to='/login' />;\n }\n }}\n /> */}\n\n {/* <Route\n exact\n path='/login'\n render={props => {\n return (\n <Login setUser={this.props.setUser} {...props} />\n );\n }}\n /> */}\n {/* <Route render={() => <h1>404 Error</h1>} /> */}\n </React.Fragment>\n );\n }", "render(){ \n return ( \n <div>\n <NavBar/>\n <Switch>\n <Route path='/navigation' component={NavBar}/>\n <Route path=\"/movie/:id\" component={movieId}/> \n <Route path=\"/tv/:id\" component={seriesId}/> \n <Route path=\"/trending\" component={trending}/>\n <Route path=\"/movies\" component={movies}/> \n <Route path=\"/series\" component={series}/>\n <Route path=\"/search\" component={search}/>\n <Redirect from=\"/\" exact to=\"/trending\"/>\n <Route path=\"/not-found\" component={NotFound}/>\n <Redirect to=\"/not-found\"/>\n </Switch>\n </div>\n );\n }", "_navigateList(){\n this.props.navigator.push({\n name: 'MyListView', // Matches route.name\n })\n }", "render() {\n return (\n <div className=\"App\">\n <h1>Movies!</h1>\n <Router>\n {/* ADD PAGES! */}\n\n <nav>\n <Link to='/'>Movie List</Link> |\n <Link to='/AddMovie'>Add Movie</Link>\n </nav>\n\n <Route exact path=\"/\" component={MovieList} />\n <Route path=\"/AddMovie\" component={AddMovie} />\n <Route path=\"/details\" component={Details} />\n \n <Route path=\"/MovieItem\" component={MovieItem} />\n {/* <Route exact path=\"/Details/${}\" component={details} /> <== how does this component part work */}\n \n\n </Router>\n </div>\n );\n }", "navigateToApp(navProps) {\n this.props.navigation.navigate(\"App\", navProps);\n }", "render() {\n //const { loggedIn} = this.context\n const { classes } = this.props;\n return (\n <List className={classes.list}>\n\n <ListItem className={classes.listItem}>\n <Link to=\"/client-jobs\">\n <Button\n\n color=\"transparent\"\n className={classes.navLink}\n >\n <ViewList className={classes.icons} />Project Postings\n </Button>\n </Link>\n </ListItem>\n\n {this.context.loggedIn && <ListItem className={classes.listItem}>\n <Link to={\"/profile-page/\" + this.context.loggedInUser}>\n <Button\n color=\"transparent\"\n className={classes.navLink}\n onClick={this.props.loadProfile2}\n >\n <Mood className={classes.icons} />Profile\n </Button>\n </Link>\n </ListItem>\n }\n {!this.context.loggedIn &&\n <ListItem className={classes.listItem}>\n <Link to=\"/login-page\">\n <Button\n color=\"transparent\"\n target=\"_blank\"\n className={classes.navLink}\n >\n <PowerSettingsNew className={classes.icons} />Login\n </Button>\n </Link>\n </ListItem>\n }\n {this.context.loggedIn && <ListItem className={classes.listItem}>\n <Link to=\"/\">\n <Button\n onClick={() => this.logout(this.state.name)}\n color=\"transparent\"\n target=\"_blank\"\n className={classes.navLink}\n >\n <PowerSettingsNew className={classes.icons} />Logout\n </Button>\n </Link>\n </ListItem>\n }\n\n </List>\n );\n }", "GetSelectedPage() {\n if (this.page === 'EVENTS')\n return <Events key={ this.state.key } GetCookie={ this.props.GetCookie } Logout={ this.props.Logout } />;\n if (this.page === 'DEPARTMENTS')\n return <Departments key={ this.state.key } GetCookie={ this.props.GetCookie } Logout={ this.props.Logout } />;\n if (this.page === 'TEACHERS')\n return <Teachers key={ this.state.key } GetCookie={ this.props.GetCookie } Logout={ this.props.Logout } />;\n if (this.page === 'SUBJECTS')\n return <Subjects key={ this.state.key } GetCookie={ this.props.GetCookie } Logout={ this.props.Logout } />;\n }" ]
[ "0.62166464", "0.6067169", "0.60498744", "0.60171527", "0.5996524", "0.5996098", "0.59912044", "0.5903819", "0.588826", "0.5853206", "0.58374566", "0.5780554", "0.5774566", "0.57671595", "0.5743171", "0.57313657", "0.5705034", "0.56948984", "0.5681009", "0.5674471", "0.56671137", "0.5636198", "0.562583", "0.562418", "0.56223613", "0.5618016", "0.56105715", "0.5588784", "0.556727", "0.55411285", "0.552057", "0.55190873", "0.5490924", "0.54906094", "0.54900056", "0.5484786", "0.54838616", "0.5483859", "0.5477806", "0.54725266", "0.54716325", "0.54660547", "0.5440841", "0.5434031", "0.5424086", "0.54173404", "0.54155535", "0.5412369", "0.54091454", "0.5403724", "0.5394258", "0.5386687", "0.53831077", "0.53815174", "0.5377922", "0.5373819", "0.53732145", "0.5355648", "0.5349439", "0.5348684", "0.53485507", "0.5347041", "0.53454316", "0.5337697", "0.5337389", "0.5332415", "0.533", "0.53144395", "0.5305742", "0.5301951", "0.5301878", "0.53010666", "0.5296654", "0.5292972", "0.5278948", "0.5278378", "0.5277124", "0.52686846", "0.5268658", "0.52681816", "0.5265172", "0.5249087", "0.5245071", "0.52411145", "0.52398705", "0.5233348", "0.52318877", "0.5229216", "0.52281076", "0.522331", "0.522101", "0.5216699", "0.52101797", "0.51956695", "0.51947975", "0.5189373", "0.5188383", "0.51825416", "0.5170932", "0.51694864", "0.51662415" ]
0.0
-1
lifecycle method, runs before render
componentWillMount() { //ListView (scalable component for rendering scrolling list) //if item goes beyond screen, its component reused for next item in list const ds = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2 }); //set libraries prop (via mapStateToProps) of component as listView data source this.dataSource = ds.cloneWithRows(this.props.libraries); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "render() {\n if (!this.initialized) {\n this.init();\n }\n }", "onBeforeRendering() {}", "render() {\n if (!this.initialized) this.init();\n }", "onBeforeRender () {\n\n }", "postRender()\n {\n super.postRender();\n }", "render() {\n // always reinit on render\n this.init();\n }", "render() {\n // always reinit on render\n this.init();\n }", "ready() {\n super.ready();\n\n afterNextRender(this, function() {});\n }", "ready() {\n super.ready();\n\n afterNextRender(this, function() {});\n }", "ready() {\n super.ready();\n\n afterNextRender(this, function() {});\n }", "onAfterRendering() {}", "afterRender() { }", "afterRender() { }", "beforeRender() { }", "onRender()/*: void*/ {\n this.render();\n }", "onRender () {\n\n }", "init() {\n this.render();\n }", "init() {\n this.render();\n }", "ready() {\n super.ready();\n\n const that = this;\n\n that._render();\n }", "initialize() {\n this.render();\n }", "didRender() {\n console.log('didRender ejecutado!');\n }", "willRender() {\n this.startReloading();\n }", "createdCallback() {\n\t // component will mount only if part of the active document\n\t this.componentWillMount();\n\t}", "onBeforeRender()\n {\n this.model.set('available', this.model.available());\n }", "_afterRender () {\n this.adjust();\n }", "didRender() {\n super.didRender(...arguments);\n\n if (!get(this, 'isDestroyed') && !get(this, 'isDestroying')) {\n this._syncScroll();\n }\n }", "initialize() {\n this.listenTo(this.owner, {\n [events_1.RendererEvent.BEGIN]: this.onRenderBegin,\n [events_1.PageEvent.BEGIN]: this.onRendererBeginPage,\n });\n }", "onRender() {\n super.onRender();\n this.clearList();\n this.renderList();\n }", "constructor() {\n super();\n this.render();\n }", "_didRender(_props, _changedProps, _prevProps) { }", "postInitialize() {\n // Take component initialize asynchronously to take care\n // about constructor of extending component class\n setTimeout(() => {this.initialize()}, 1);\n }", "function init() { render(this); }", "onRendering() {\n this.set('tableIsLoading', false);\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "constructor() {\n super();\n this.state = {didLoad: false};\n }", "function handleRender() {\n view._isRendered = true;\n triggerDOMRefresh();\n }", "function handleRender() {\n view._isRendered = true;\n triggerDOMRefresh();\n }", "constructor(props) {\n super(props)\n this.state = {\n loaded: false\n }\n }", "_requestRender() { this._invalidateProperties(); }", "componentDidUpdate(){\n this.pageScrollTo();\n\n //automated pre render\n if( this.state.isLoaded && window.c && window.c.length > 2 ){\n console.log( \"Pre-rendering...\" );\n\n //Prerender.writeHTMLPrerender();\n this.shouldPreRender({mainPageRendered: true});\n }\n }", "createdCallback() {\r\n this.init()\r\n }", "finalizeInit() {\n if (this.insertBefore || this.appendTo || this.insertFirst) {\n this.render();\n }\n }", "onBecameVisible() {\n\n // Start rendering if needed\n if (!this.isRendering) {\n this.isRendering = true\n this.render()\n }\n\n }", "onInit() {\n this.score = this.timeLimit;\n this.quizOver = false;\n this.introView.render();\n this.introView.attachEventHandlers();\n }", "onRender()\n {\n this._initializeSettingsDisplay();\n }", "function onUpdate() {\n if (window.__INITIAL_STATE__ !== null) {\n window.__INITIAL_STATE__ = null;\n return;\n }\n const { state: { components, params } } = this;\n preRenderMiddleware(store.dispatch, components, params);\n}", "render(){\n console.log('Render Fired')\n return(\n <div>Lifecycle Method Examples</div>\n )\n }", "connectedCallback() {\n this.render();\n }", "created() {\n this.__initEvents();\n }", "constructor(props) {\n super(props);\n this.state = {\n isLoaded: false,\n }\n }", "function handleRender() {\n\t view._isRendered = true;\n\t triggerDOMRefresh();\n\t }", "ready() {\n super.ready();\n\n const that = this;\n\n //a flag used to avoid animations on startup\n that._isInitializing = true;\n\n that._createLayout();\n that._setFocusable();\n\n delete that._isInitializing;\n }", "beforerender (el) {\n console.log('Component is about to be rendered for the first time')\n\n // this is where you can register other lifecycle events:\n // on.resize()\n // on.ready()\n // on.intersect()\n // on.idle()\n }", "onInitialize() {}", "init() {\n if (this.initialised) {\n return;\n }\n\n // Set initialise flag\n this.initialised = true;\n // Create required elements\n this._createTemplates();\n // Generate input markup\n this._createInput();\n // Subscribe store to render method\n this.store.subscribe(this.render);\n // Render any items\n this.render();\n // Trigger event listeners\n this._addEventListeners();\n\n const callback = this.config.callbackOnInit;\n // Run callback if it is a function\n if (callback && isType('Function', callback)) {\n callback.call(this);\n }\n }", "componentDidMount() {\n this.onLoad();\n }", "render() {\n this.update();\n }", "finalizeInit() {\n if (this.insertBefore || this.appendTo || this.insertFirst || this.adopt) {\n this.render();\n }\n }", "onInit() {}", "function onInit() {\n loadData();\n manageBag();\n}", "didRender() {\n if (!this[STATE]) {\n this[STATE] = {\n $holder: this.$(\".holder\"),\n $runBtn: this.$(\"button\")\n };\n this[STATE].$runBtn.addEventListener(\"click\", this);\n this.onPropsChange(this._handleAutoRun, \"autoRun\");\n }\n }", "unrender() {\n this.rendered = false;\n }", "rendered() {\n\t\t\t\tthis.hasStorePropsChanged_ = false;\n\t\t\t\tthis.hasOwnPropsChanged_ = false;\n\t\t\t}", "function init(){\n buildComponent();\n attachHandlers();\n addComponents();\n doSomethingAfterRendering(); // 렌더 이후 처리함수 (예 - 서버접속)\n }", "connectedCallback(){\n this.render()\n }", "willRender() {\n console.log('willRender ejecutado!');\n }", "componentDidMount() {\n\t\tthis.props.onLoad();\n\t}", "ready() {\n this._root = this._createRoot();\n super.ready();\n this._firstRendered();\n }", "onSetup() {\n this.addSceneObject();\n if (this.sceneObject.geometry.boundingBox != null) {\n this.updateBoundingBox();\n }\n }", "handleRendered_() {\n\t\tthis.isRendered_ = true;\n\t}", "didInit() { }", "componentWillMount() { //First method in the lifecycle hook that gets update.\n console.log(\"Component will mount\"); //if you cann setState in here then new render will take it into account. \n }", "ready() {\n super.ready();\n\n\n }", "_render() {\n\t\tthis.tracker.replaceSelectedMeasures();\n }", "onInitialized() {\n this.vLab.SceneDispatcher.currentVLabScene.add(this.vLabItemModel);\n\n this.setupInteractables()\n .then((interactables) => {\n /**\n * Conditionally add to Inventory interactables\n * (for VLabItem by default this.interactables[0] (this.vLabScenObject in the root of [0] Interactable) is added to Inventory)\n */\n if (this.nature.addToInvnentory == true) {\n this.interactables[0].takeToInventory();\n this.interactables[0]['vLabItem'] = this;\n }\n this.updateTube();\n });\n\n /**\n * Event subscriptions\n */\n this.vLab.EventDispatcher.subscribe({\n subscriber: this,\n events: {\n window: {\n resize: this.repositionPutInFronOfCameraOnScreenWidth\n },\n VLabSceneInteractable: {\n transitTakenInteractable: this.onTransitTakenInteractable\n },\n VLabScene: {\n currentControlsUpdated: this.onCurrentControlsUpdated.bind(this),\n }\n }\n });\n }", "componentWillMount() {\n console.log('before initData call');\n this.initData(); \n\t}", "postrender() {\n this.gl.flush();\n }", "onInit() {\n this.__initEvents();\n }", "function resumeRender() {\n shouldRender = true;\n render();\n }", "createdCallback() {\n self = this\n self.init()\n }", "function main() {\n init();\n render();\n handleVisibilityChange();\n}", "onInit()\n {\n // \n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "ready() {\n super.ready();\n }", "componenetDidMount() { }", "render() {\n const self = this;\n const data = self.get('data');\n if (!data) {\n throw new Error('data must be defined first');\n }\n self.clear();\n self.emit('beforerender');\n self.refreshLayout(this.get('fitView'));\n self.emit('afterrender');\n }", "initialize () {\n\n if (!this.initialized) {\n\n // only perform once\n this.initialized = true;\n\n // loads batches of assets\n this.bulkLoader = new BulkLoader();\n this.bulkLoader.on('LOAD_PROGRESS', this.on_LOAD_PROGRESS.bind(this));\n this.bulkLoader.on('LOAD_COMPLETE', this.on_LOAD_COMPLETE.bind(this));\n \n // set HTML to DOM\n this.parentEl.innerHTML = this.html;\n }\n }", "initialize() {\n this.model.on('change', this.render, this);\n }", "initialize() {\n this.model.on('change', this.render, this);\n }" ]
[ "0.733038", "0.7321592", "0.73008275", "0.7182236", "0.7138608", "0.71131814", "0.71131814", "0.7108738", "0.7108738", "0.7108738", "0.71041113", "0.70622796", "0.70622796", "0.70150745", "0.6959523", "0.69214433", "0.6911439", "0.6911439", "0.68797517", "0.68407214", "0.6794594", "0.6721984", "0.67102605", "0.6696889", "0.6696603", "0.66853994", "0.6648598", "0.66441965", "0.6619146", "0.6590197", "0.6585075", "0.6576426", "0.6546802", "0.6532931", "0.6532931", "0.6532931", "0.65032387", "0.6493096", "0.6493096", "0.64535534", "0.64464056", "0.6434719", "0.6424685", "0.6424037", "0.6423811", "0.64180696", "0.64130855", "0.64093304", "0.64029723", "0.63689274", "0.634687", "0.63396823", "0.63395125", "0.6323253", "0.6304278", "0.62925994", "0.62923884", "0.6284111", "0.62639046", "0.62554663", "0.62513185", "0.6244659", "0.62415546", "0.6237388", "0.6236671", "0.6224671", "0.622291", "0.6207093", "0.6205286", "0.62019503", "0.6184272", "0.6179589", "0.6178875", "0.6165706", "0.6164557", "0.61377114", "0.6136521", "0.6129768", "0.6124604", "0.61226237", "0.61111736", "0.61102307", "0.6104975", "0.60957235", "0.6092002", "0.6092002", "0.6092002", "0.6092002", "0.6092002", "0.6092002", "0.6092002", "0.6092002", "0.6092002", "0.6092002", "0.6092002", "0.6092002", "0.60906863", "0.60875803", "0.6085104", "0.6082504", "0.6082504" ]
0.0
-1
helper method for rendering single library per row
renderRow(library) { return <ListItem library={library} />; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "renderRow(library) {\n\t\treturn <ListItem library={library} />; \n\t}", "renderRow( library ) {\n return <ListItem library={ library }/>\n }", "getLibraryCell(){\n\t\t\treturn <td>{this.getLibrariesInCombinations()['libraries']}</td>;\n\t\t}", "function render() {\n myLibrary.forEach((value, index) => {\n addBookToTable(value, index);\n });\n}", "function renderLibrary(myLibrary) {\n emptyLibrary();\n tableBody.innerHTML = '';\n if (myLibrary.length !== 0) {\n myLibrary.forEach((book, index) => {\n template = `\n <tr>\n <th scope=\"row\">${index + 1}</th>\n <td>${book.bTitle}</td>\n <td>${book.bDescription}</td>\n <td>${book.bNumber}</td>\n <td>${book.bAuthor}</td>\n <td>${book.bGenre}</td>\n <td>\n <button type=\"button\" class=\"btn btn-outline-primary read-btn\" data-btn=\"${index}\">\n ${book.bStatus}\n </button>\n </td>\n <td align='center'>\n <a href=\"#\"><i class=\"fas fa-trash-alt\" data-trash=\"${index}\"></i></a>\n </td>\n </tr>\n `;\n tableBody.innerHTML += template;\n });\n }\n clickReadBtn();\n clickTrashBtn();\n}", "function render() {\n myLibrary.forEach(function(e, i){\n var li = document.createElement(\"li\");\n li.classList.add(\"row\");\n \n ul.appendChild(li);\n\n var div = document.createElement(\"div\");\n li.appendChild(div)\n div.classList.add(\"innercols\")\n \n var p = document.createElement(\"p\");\n div.appendChild(p);\n p.innerText = e.title\n \n var p = document.createElement(\"p\");\n div.appendChild(p);\n p.innerText = e.author\n \n var p = document.createElement(\"p\");\n div.appendChild(p);\n p.innerText = e.pages\n \n var p = document.createElement(\"p\"); \n p.classList.add('read');\n p.classList.add(i); //adds to index of the added book to the innercols div as a class. beginning at 0.\n div.appendChild(p);\n p.innerText = e.read\n\n readClicks();\n })\n}", "function render(library = myLibrary){\n \n let table = document.getElementById('tableBody')\n \n //1. clear table content\n while (table.rows.length >= 1) {\n table.deleteRow(0)\n }\n \n //2. Append each book\n \n //auxiliar switch: makes the first row (after the header) always darker\n let situation1 = ''\n let situation2 = ''\n if (myLibrary.length % 2 === 0) {\n situation1 = 'even'\n situation2 = 'odd'\n } else {\n situation1 = 'odd'\n situation2 = 'even'\n }\n\n for (let i = 0; i < myLibrary.length; i++) {\n\n //add new row with ID and class\n let row = table.insertRow(0)\n\n row.setAttribute('id', `row${i}`)\n if (table.rows.length % 2 === 0) {row.classList.add(situation1)} else {row.classList.add(situation2)}\n\n //create and fill row cells\n let titleCell = row.insertCell(0)\n let authorCell = row.insertCell(1)\n let pagesCell = row.insertCell(2)\n let readCell = row.insertCell(3)\n let deleteButton = row.insertCell(4)\n \n pagesCell.setAttribute('class', 'toCenter')\n readCell.setAttribute('class', 'toCenter')\n\n titleCell.innerHTML = library[i].title\n authorCell.innerHTML = library[i].author\n pagesCell.innerHTML = library[i].pages\n readCell.innerHTML = library[i].read\n readCell.setAttribute('onClick', 'toggleRead(this)')\n deleteButton.innerHTML = 'Delete'\n deleteButton.classList.add('deleteButton')\n deleteButton.setAttribute('id', i)\n deleteButton.setAttribute('onClick', 'removeBookFromLibrary(this.id)')\n }\n}", "function RenderRow() {}", "function renderLibrary() {\r\n let iterateNum = 0;\r\n for (const book of library) {\r\n const displayBook = document.createElement('div');\r\n displayBook.setAttribute('class', 'book');\r\n for (const prop in book) {\r\n const cardItem = document.createElement('div');\r\n cardItem.setAttribute('class', 'book-item');\r\n cardItem.innerText = `${prop.charAt(0).toUpperCase() + prop.slice(1)}: ${book[prop]}`;\r\n displayBook.appendChild(cardItem);\r\n }\r\n // create garbage can for delete\r\n const exitBook = document.createElement('div');\r\n exitBook.innerHTML = '<i class=\"fas fa-trash\"></i>';\r\n exitBook.setAttribute('class', 'exit');\r\n exitBook.setAttribute('data-num', iterateNum);\r\n\r\n displayBook.appendChild(exitBook);\r\n // add button for read mode\r\n const readBtn = document.createElement('button');\r\n readBtn.innerText = 'Was read?';\r\n readBtn.setAttribute('class', 'read');\r\n readBtn.setAttribute('data-readnum', iterateNum);\r\n displayBook.appendChild(readBtn);\r\n // push book to html container\r\n cardContainer.appendChild(displayBook);\r\n iterateNum++;\r\n }\r\n deleteBook();\r\n toggleRead();\r\n}", "function renderBooks(myLibrary) {\n // Build card for each book and add it to the display\n for (let i of myLibrary) {\n renderBook(i)\n }\n}", "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 }", "function tableLibraryItems()\n\t\t{\n\t\t\tvar table = new Table(dom.library.items);\n\t\t\ttrace(table.render());\n\t\t}", "function render() {\n\tbookTable.innerHTML = \"\"; // Reset all books already rendered on page\n\t//Render the books currently in myLibrary to the HTML page\n\tfor (var book of library.getLibrary()) {\n\t\taddRow(book, book.firebaseKey); // Use book.firebaseKey to have a way to remove / update specific books\n\t}\n}", "function render(myLibrary, node){\n node.innerHTML = tableHeader;\n myLibrary.forEach(book => {\n let row = document.createElement('tr');\n row.innerHTML = bookCells(book);\n row.querySelector(\".read-button\").addEventListener('click', (e) => {\n if(e.target.innerHTML == \"Read\"){\n e.target.innerHTML = \"Unread\";\n }else {\n e.target.innerHTML = \"Read\";\n }\n });\n row.querySelector(\".delete-button\").addEventListener('click', (e) => {\n e.target.parentNode.parentNode.parentNode.removeChild(e.target.parentNode.parentNode);\n myLibrary.splice(myLibrary.indexOf(book), 1);\n setLocalStorage();\n });\n node.append(row);\n});\n}", "myRenderer (api, rowIdx) {\n\n\t}", "render_projects(row){\n return '<a href=\"' + this.root + 'components/languages/glossaries\">'+ row.name +'</a>'\n }", "renderRow (row, index) {\n return `\n <div class=\"tr\" data-id=\"${row.id}\">\n <div class=\"td\">${row.title}</div>\n <div class=\"td\">${row.date}</div>\n <div class=\"td\">${row.random}</div>\n </div>\n `\n }", "getListing() {\n\t\treturn (\n\t\t\t<Row>\n\t\t\t\t<div className=\"listingItem\">\n\t\t\t\t <Col className='listingItemNoPadding' style={{paddingLeft: \"0px\"}}xs={10} sm={10} md={10} lg={10}>\n\t\t\t\t\t\t{this.getContent()}\n\t\t\t\t\t</Col>\n\t\t\t\t</div>\n\t\t\t</Row>\n\t\t);\n\t}", "function renderEachLine() {\n return _.map(textArray, (eachLine, i) => {\n return <span key={i} >{eachLine}<br/></span>;\n });\n }", "oneRow(questions, rowNumber){\n let row = questions.map((element, i) => {\n //let row span entire width of the page\n return <>\n <Col span={24}>\n {element !== null ? (\n <HistoryCard key={element.id} id={element.id} title={element.question} \n userAnswer={element.answer === \"\" ? \"\" : element.userAnswer} quizAnswer= {element.quizAnswer} clicked={this.handleChange} extra={counter}/>) : null }\n </Col>\n </>\n }\n );\n\n return <div key={rowNumber}>\n <Row type=\"flex\" justify=\"center\">\n {row}\n </Row>\n <br />\n </div>\n }", "render() {\n let listBook = \"\";\n const category = this.props.getCategory(this.props.id);\n \n if (category) { \n if (category.books) {\n listBook = category.books.map((book) => (\n <div key={book._id} id={book._id} className=\"list-group container\">\n <div className=\"\">\n <div className=\"col-lg-4 bg-light\">\n <h1>Title: {book.title} </h1>\n <ul>\n <li>Author: {book.author}</li>\n <li>Seller: {book.sellerName}</li>\n <li>Category: {book.category}</li>\n <li>Price: {book.price}</li>\n </ul> \n </div>\n </div>\n </div>\n ));\n }\n }\n \n\n\n return (\n <div className=\"m-5\"> \n <div>\n <h3>Book details</h3>\n <div className=\"row list-group-horizontal-md mb-3\"> \n {listBook.length === 0 ? <p>No Book found!</p> : listBook}\n </div> \n </div>\n <div className=\"mt-5\">\n <Link to=\"/\">\n <i className=\"fa fa-long-arrow-left fa-1x circle-icon\"> </i>\n </Link>\n </div>\n </div>\n );\n }", "render() {\n const styles = {\n background: this.props.RowColor\n};\n return(\n <div style = {styles} class = \"BrowseRowContainer\">\n {// Passing in styles for container\n // Pass in title below (or leave blank)\n }\n\n <h3 class = \"BrowseRowTitle\"> {this.props.sectionTitle}</h3>\n <div class = \"BrowseRow\">\n {// Mapping art objects to art cards (if > 4, will make multiline)\n }\n {this.props.cardList.map(cardObj => (\n <BrowseCard handleClick = {this.props.openModal} artistLinkFunct = {this.props.artistLinkFunct} cardObj = {cardObj} type = {this.props.rowType}/>\n ))}\n\n </div>\n </div>\n )\n }", "function MyLibrary() {\n\n const [apiKey, setApiKey] = useState(\"google book api key\");\n const url = 'https://localhost:8000/library/api/getAll/';\n const [error, setError] = useState(null);\n const [isLoaded, setIsLoaded] = useState(false);\n const [item, setItem] = useState([]);\n const [layout, setLayout] = useState('grid');\n\n useEffect(() => {\n fetch(url, {mode: 'no-cors'})\n .then(res => res.json())\n .then(\n (result) => {\n setIsLoaded(true);\n setItem(result);\n },\n (error) => {\n setIsLoaded(true);\n setError(error);\n }\n )\n }, [])\n\n console.log(item);\n \n const renderGridItem = (data) => {\n return (\n <div className=\"p-col-12 p-md-4\">\n <div className=\"book-grid-item\">\n <div className=\"book-grid-item-content\">\n <Link to={`/book/details/${data.BookId}/${data.Author}`}>\n <img src={data.Image} onError={(e) => e.target.src='https://thumbs.dreamstime.com/b/book-error-line-icon-book-error-vector-line-icon-elements-mobile-concept-web-apps-thin-line-icons-website-design-114930650.jpg'} alt={data.Title} />\n </Link> \n <Link to={`/book/details/${data.BookId}/${data.Author}`}>\n <div className=\"book-title\">{data.Title}</div>\n </Link> \n <div className=\"book-author\">{data.Author}</div>\n </div>\n </div>\n </div>\n );\n }\n\n if (error) {\n return <div>Error: {error.message}</div>;\n }\n else if(!isLoaded){\n return <div>Loading...</div>;\n }\n else{\n return(\n <div className=\"dataview-demo\">\n <div className=\"card\">\n <DataView value={item} layout={layout} header={<Header title={'My library books'}/>}\n itemTemplate={renderGridItem} paginator rows={9} />\n </div> \n </div>\n )\n }\n}", "render() {\n console.log(this.props.responseItems);\n // Map over the list of books returned to create list of BookItem components\n const results = this.props.responseItems.map((item, idx) => {\n // Construct a call to BookItem\n const title = item.volumeInfo.title;\n const authors = item.volumeInfo.authors;\n // Deal with price issue\n let price = 'NA'\n // const price = item.saleInfo.listPrice.amount;\n if (item.saleInfo.saleability===\"FOR_SALE\"){\n price = item.saleInfo.listPrice.amount\n }\n const description = item.volumeInfo.description;\n // Add some logic because sometimes there is no thumbnail\n const image = item.volumeInfo.imageLinks.smallThumbnail;\n return <BookItem title={title} authors={authors} price={price} description={description} image={image} key={idx}/>\n });\n return (\n <div className=\"BookList\">\n {results}\n </div>\n );\n }", "renderLesson(row) {\n\t\treturn (\n\t\t\t<View style={Styles.lessonCol}>\n\t\t\t\t<TouchableHighlight onPress={this.playSound.bind(this, row)}>\n\t\t\t\t\t<Image \n\t\t\t\t\t\tsource={{ uri: 'http://amharicteacher.com/images/' + row + '.png' }} \n\t\t\t\t\t\tstyle={{width: 115, height: 110}}\n\t\t\t\t\t/>\n\t\t\t\t</TouchableHighlight>\n\t\t\t\t<Text style={Styles.itemDesc}>{row[0].toUpperCase() + row.substring(1)}</Text>\n\t\t\t</View>\n\t\t);\n\t}", "render() {\n return <section className=\"RepositoryList\">\n { this.renderMessage() }\n { this.renderTable() }\n </section>;\n }", "rowRenderer({index, key, style}) {\n const item = this.my_orders[index];\n \n // Getting the information for the coloring ratio by dividng by the max order\n const type = item[\"type\"];\n const ratio = item[\"curr_1\"]/this.max_order * 100;\n const direction = \"right\";\n let color_0 = \"rgba(255, 0, 0, 0.2)\";\n let color_1 = \"rgba(0,0,0,0)\";\n if(type === \"BUY\") {\n color_0 = \"rgba(0, 255, 0, 0.1)\";\n color_1 = \"rgba(0, 0, 0, 0)\";\n }\n\n // Getting the color for the color band\n const color = index % 2 === 0 ? `#182026` : `#1c262c`;\n\n const custom_style = { \n backgroundColor: color,\n backgroundImage: `linear-gradient(to ${direction}, ${color_0} , ${color_0}), linear-gradient(to ${direction}, ${color_1}, ${color_1})` ,\n backgroundSize: `calc(${ratio}%) 100%`,\n backgroundRepeat: `no-repeat`\n };\n style = Object.assign(custom_style, style);\n\n // Construct the HTML row\n const price = item[\"type\"] === \"BUY\" ? (<span className=\"green MarketHistory-type\">{numberWithCommas(Math.round(item[\"price\"] * 100)/100)}</span>) : (<span className=\"red MarketHistory-type\">{numberWithCommas(Math.round(item[\"price\"] * 100)/100)}</span>);\n return (\n <div className=\"MarketHistory-table-entry\" key={key} style={style}>\n <Grid padded={true}>\n <Grid.Column computer={3} tablet={3} mobile={3}>\n {price}\n </Grid.Column>\n <Grid.Column computer={4} tablet={4} mobile={6}>\n {item[\"timestamp\"]}\n </Grid.Column>\n <Grid.Column computer={3} tablet={3} mobile={3}>\n {numberWithCommas(Math.round(ethers.utils.formatUnits(item[\"curr_0\"], 'ether') * 100) / 100 )}\n </Grid.Column>\n <Grid.Column computer={3} tablet={3} mobile={4}>\n {numberWithCommas(Math.round(ethers.utils.formatUnits(item[\"curr_1\"], 'ether') * 100) / 100 )}\n </Grid.Column>\n <Grid.Column computer={3} tablet={3} only={'computer tablet'} textAlign='center'>\n <HumanName address={item[\"participant\"]} icon_only />\n </Grid.Column>\n </Grid>\n </div>\n )\n }", "renderRow(r) {\n return (\n <div>\n {this.renderSquare(r)}\n {this.renderSquare(r + 1)}\n {this.renderSquare(r + 2)}\n {this.renderSquare(r + 3)}\n {this.renderSquare(r + 4)}\n {this.renderSquare(r + 5)}\n {this.renderSquare(r + 6)}\n {this.renderSquare(r + 7)}\n {this.renderSquare(r + 8)}\n {this.renderSquare(r + 9)}\n {this.renderSquare(r + 10)}\n {this.renderSquare(r + 11)}\n {this.renderSquare(r + 12)}\n {this.renderSquare(r + 13)}\n {this.renderSquare(r + 14)}\n {this.renderSquare(r + 15)}\n {this.renderSquare(r + 16)}\n {this.renderSquare(r + 17)}\n {this.renderSquare(r + 18)}\n {this.renderSquare(r + 19)}\n {this.renderSquare(r + 20)}\n {this.renderSquare(r + 21)}\n {this.renderSquare(r + 22)}\n {this.renderSquare(r + 23)}\n {this.renderSquare(r + 24)}\n {this.renderSquare(r + 25)}\n {this.renderSquare(r + 26)}\n {this.renderSquare(r + 27)}\n {this.renderSquare(r + 28)}\n {this.renderSquare(r + 29)}\n {this.renderSquare(r + 30)}\n {this.renderSquare(r + 31)}\n {this.renderSquare(r + 32)}\n {this.renderSquare(r + 33)}\n {this.renderSquare(r + 34)}\n {this.renderSquare(r + 35)}\n {this.renderSquare(r + 36)}\n {this.renderSquare(r + 37)}\n {this.renderSquare(r + 38)}\n {this.renderSquare(r + 39)}\n </div>\n )\n }", "function handleLibraryClick(libId, formatFun) {\n let maybeLib = document.getElementById(libId);\n if (maybeLib) {\n if (maybeLib.style.display === 'none') {\n maybeLib.style.display = 'block';\n }\n else {\n maybeLib.style.display = 'none';\n }\n }\n else {\n // not created yet\n const lib = document.createElement('li');\n lib.id = libId;\n lib.className = 'linebreaker';\n lib.classList.add('card');\n formatFun(lib);\n sectionUl.appendChild(lib);\n }\n}", "function render() {\n\n //checking localStorage\n if (!localStorage.getItem('library')) {\n setLocalStorage();\n }\n\n createTableHeaders(tableRow);\n getLocalStorage();\n\n for (let i = 0; i < myLibrary.length; i++) {\n\n let trBook = document.createElement('tr');\n let tdRead = document.createElement('td');\n let tdBtn = document.createElement('td');\n\n let btnRemove = document.createElement('button');\n let btnBookRead = document.createElement('button');\n\n btnRemove.innerText = 'Delete Book';\n btnRemove.setAttribute('data-index', `${myLibrary.indexOf(myLibrary[i])}`);\n btnRemove.addEventListener('click', deleteBook);\n\n btnBookRead.addEventListener('click', function () {\n myLibrary[i].isRead;\n render();\n });\n\n btnBookRead.innerText = myLibrary[i].read;\n\n tdBtn.appendChild(btnRemove);\n tdRead.appendChild(btnBookRead);\n\n trBook.innerHTML = `<td>${myLibrary[i].title}</td>\n <td>${myLibrary[i].author}</td>\n <td>${myLibrary[i].numPages}</td>`;\n\n trBook.appendChild(tdRead);\n trBook.appendChild(tdBtn);\n tableRow.appendChild(trBook);\n }\n resetForm();\n}", "function displayLibrary(array) {\n // loop through myLibrary array and displays on page\n for (let i = 0; i < array.length; i++) {\n //create and append elements\n const bookDiv = document.createElement(\"div\");\n bookDiv.className = \"bookCard\";\n bookHolder.appendChild(bookDiv);\n const title = document.createElement(\"div\");\n title.className = 'title';\n bookDiv.appendChild(title);\n title.textContent = `Title: ${array[i].title}`;\n const author = document.createElement(\"div\");\n author.className = 'author';\n bookDiv.appendChild(author);\n author.textContent = `Author: ${array[i].author}`;\n const pageCount = document.createElement(\"div\");\n pageCount.className = 'pageCount';\n bookDiv.appendChild(pageCount);\n pageCount.textContent = `Page Count: ${array[i].pages}`;\n const read = document.createElement(\"button\");\n read.className = 'read';\n bookDiv.appendChild(read);\n read.textContent = 'Read?';\n const remove = document.createElement(\"button\");\n remove.className = 'remove';\n bookDiv.appendChild(remove);\n remove.textContent = 'Remove';\n }\n}", "renderRow(begin) {\n let row = [];\n for (let i = begin * 3; i < 3 + begin * 3; i++) {\n row.push(this.renderSquare(i));\n }\n return row;\n }", "render() {\n\n console.log(\"==>\" + this.props.items.length);\n //in case no array recieved for rows return to avoid run time erros\n if(this.props.items == null){\n return null;\n }\n //this code will divide the items array into small arrays \n //where each array contain the data required for each row\n\n //create an array to split items into arrays for each row\n var allRows = [];\n //save the total length of items\n var len = this.props.items.length;\n //fidn the total number of rows we will produce\n var totalRows = len / this.props.rowLength;\n //count how many rows we have so far\n var countRows = 0;\n\n //while we did not count all rows\n while(countRows < totalRows){\n \n //creare a new array for this row\n let newRow = [];\n\n //add the required items to the array\n for (var i = 0; i < this.props.rowLength; i++){\n \n //make sure we do not go beyond the array length\n let currentIndex = i + (countRows * this.props.rowLength);\n \n if(currentIndex < len)\n newRow.push(this.props.items[currentIndex]);\n \n }\n //increment the rows counter\n countRows++;\n //add the new array for this row in the pool of all row arrays\n allRows.push( this.GridRow(newRow, countRows) );\n }\n \n //after we saved all individual rows component inside the allRows now render them\n return (\n <div>\n {allRows} \n </div>\n );\n }", "renderRow(item, header, count, headerIndex) {\n const dataKey = header.path.replace(/\\$./i, '');\n const data = item[dataKey];\n\n // set the class to first if we are the first row\n const className = classNames({\n first: (count === 1)\n });\n\n // the icon for the row\n const iconStyle = {\n color: `#${header.iconColor}`,\n };\n const icon = (\n <span aria-label={header.label}>\n <FontAwesomeIcon icon={header.icon} style={iconStyle} />\n </span>\n );\n\n return (\n <TableRow className={className} key={count}>\n <TableCell>\n <Tooltip id={`header-${count}-${headerIndex}`} title={header.label} placement=\"right\">\n {icon}\n </Tooltip>\n </TableCell>\n <TableCell align=\"right\" title={header.label}>\n <Tooltip id={`header-${count}-${headerIndex}`} title={header.label} placement=\"right\">\n <span className=\"data-element\">\n {data}\n </span>\n </Tooltip>\n </TableCell>\n </TableRow>\n )\n }", "function renderProducts(model = []) {\n const template = model.map(m => `\n <tr>\n <td>${m.id}</td>\n <td>${m.name}</td>\n <td>${m.cost}</td>\n <td>${m.description}</td>\n </tr>\n \n `).join(' ');\n\n $(\"#products-tbody\").html(template);\n }", "renderProductList(products, rowId){\n\t return(\n\t \t<View style = {{flex: 1, flexDirection: 'row', justifyContent: 'center', alignItems: 'stretch', borderTopWidth: 0.5}}>\n\t\t <Text style = {{flex:1, fontSize: 15, textAlign: 'center', marginTop: 5, marginBottom: 5}}>{products.CLICOD}</Text>\n\t\t <Text style = {{flex:2, fontSize: 15, marginTop: 5, marginBottom: 5}}>{products.descr_producto}</Text>\n\t\t <Text style = {{flex:1, fontSize: 15, textAlign: 'center', marginTop: 5, marginBottom: 5}}>{products.devolucionPZ}</Text>\n\t\t </View>\n\t )\n\t}", "render() {\n const tableDisplay =\n \n this.props.products[0].map(obj => {\n return (\n <section key={obj.key} className=\"table\">\n {/* <Link to={`/${obj.key}`}> */}\n {/* <div className=\"table-row\"> */}\n <Link className=\"table-row\" to={`/${obj.key}`}>\n <div className=\"table-row__content\">\n <span className=\"table-row__content--key\">Item</span>\n <span className=\"table-row__content--bold\">{obj.item}</span>\n <span className=\"table-row__content--value\">\n {obj.description}\n </span>\n </div>\n <div className=\"table-row__content\">\n <span className=\"table-row__content--key\">Last Ordered</span>\n <span className=\"table-row__content--value\">\n {obj.last_ordered}\n </span>\n </div>\n <div className=\"table-row__content\">\n <span className=\"table-row__content--key\">Location</span>\n <span className=\"table-row__content--value\">{obj.location}</span>\n </div>\n <div className=\"table-row__content\">\n <span className=\"table-row__content--key\">Quantity</span>\n <span className=\"table-row__content--value\">{obj.quantity}</span>\n </div>\n <div className=\"table-row__content\">\n <span className=\"table-row__content--key\">Status</span>\n <span className=\"table-row__content--value\">{obj.status}</span>\n </div>\n {/* <div className=\"table-row__remove\">\n <img className=\"table-row__remove-button\" src={kebab} />\n </div> */}\n </Link>\n <RemoveButton refreshTable={this.props.refreshTable} productID={obj.key} />\n {/* </div> */}\n {/* </Link> */}\n </section>\n );\n });\n \n return <>{tableDisplay}</>;\n \n \n }", "eachRow(row, i){\r\n return (\r\n <li className=\"row\" key={i}>\r\n {row.map(cell=>this.eachCell(cell))}\r\n </li>\r\n )\r\n }", "function render(books) {\n\n let table = document.getElementById(\"lib-table\");\n\n while (index < books.length) {\n let row = table.insertRow();\n\n let indexColumn = document.createElement(\"th\");\n indexColumn.setAttribute(\"scope\", \"row\");\n indexColumn.innerHTML = index + 1;\n row.appendChild(indexColumn);\n\n let titleColumn = row.insertCell(1);\n titleColumn.innerHTML = books[index].title;\n\n let authorColumn = row.insertCell(2);\n authorColumn.innerHTML = books[index].author;\n\n let pagesColumn = row.insertCell(3);\n pagesColumn.innerHTML = books[index].pages;\n\n // status btn\n let btnColumn = row.insertCell(4);\n if (books[index].status === false) {\n createStatusBtn(btnColumn, \"btn btn-outline-info\", \"reading\", true);\n } else {\n createStatusBtn(btnColumn, \"btn btn-outline-success\", \"finished\", false);\n }\n\n // remove btn\n let removeColumn = row.insertCell(5);\n let removeBtn = document.createElement(\"button\");\n removeColumn.appendChild(removeBtn);\n removeBtn.setAttribute(\"class\", \"btn btn-outline-danger\");\n removeBtn.setAttribute(\"id\", `${index}`);\n removeBtn.innerHTML = \"remove\";\n row.appendChild(removeColumn);\n\n removeBtn.addEventListener(\"click\", function () {\n myLibrary.splice(this.id, 1);\n let tableRows = table.getElementsByTagName('tr');\n while (index > 0) {\n table.removeChild(tableRows[index - 1]);\n index--;\n };\n saveLocalAndRender();\n });\n \n index++;\n\n function createStatusBtn(btnColumn, btnClass, btnText, btnStatus) {\n let statusBtn = document.createElement(\"button\");\n btnColumn.appendChild(statusBtn);\n statusBtn.setAttribute(\"class\", btnClass);\n statusBtn.setAttribute(\"id\", `${index}`);\n statusBtn.innerHTML = btnText;\n\n statusBtn.addEventListener(\"click\", function () {\n books[this.id].status = btnStatus;\n let tableRows = table.getElementsByTagName('tr');\n while (index > 0) {\n table.removeChild(tableRows[index - 1]);\n index--;\n };\n saveLocalAndRender();\n });\n }\n\n }\n}", "render() {\n return (\n <div>\n <div className=\"grid-container\">\n {brands.map((value, index) => (\n <Brand\n key={index}\n name={value.name}\n logo={value.logo}\n chosen={this.isChosen(value.name)}\n clickFunction={this.changeManufacturer}\n />\n ))}\n </div>\n </div>\n );\n }", "renderRow(i){\r\n \r\n var arrayRow= [];\r\n for(let b = i ;b < i+this.props.widthSquare ; b++ ){\r\n arrayRow.push(this.renderSquare(b));\r\n }\r\n return(\r\n\r\n <div key={i} className='board-row'>\r\n {arrayRow}\r\n \r\n </div>\r\n \r\n )\r\n }", "function displayLibrary(){\n libraryContent.textContent = ''\n for (let i = 0; i < library.length; i++) {\n book = library[i];\n \n // create the book card\n const newBookCard = document.createElement('div');\n newBookCard.dataset.key = `index-${i}`;\n newBookCard.textContent = book.info();\n newBookCard.classList = 'card';\n \n // add remove button to the card\n const removeBookButton = document.createElement('div');\n removeBookButton.textContent = 'Remove';\n removeBookButton.classList = \"rounded-button-small\";\n removeBookButton.dataset.index = i;\n\n // add event listener to the remove button\n removeBookButton.addEventListener('click', removeBook);\n\n newBookCard.appendChild(removeBookButton);\n libraryContent.appendChild(newBookCard);\n }\n}", "DataTable() {\n return this.state.products.map((res, i) => {\n return <ProductTableRow obj={res} key={i} />;\n });\n }", "function renderBooks(response) {\n $(\".results\").empty();\n for (var i = 0; i < 4; i++) {\n var imageLink = response.items[i].volumeInfo.imageLinks.thumbnail;\n var bookTitle = response.items[i].volumeInfo.title;\n var author = response.items[i].volumeInfo.authors;\n var bookSummary = response.items[i].volumeInfo.description;\n var bookHtml = `<section style=\"margin-bottom: 40px; padding: 30px; background-color: rgb(128, 0, 0);\" class=\"container\">\n <div class=\"container \">\n <div class=\"card-group vgr-cards\">\n <div class=\"card\">\n <div class=\"card-img-body\">\n <img style=\"max-width: 125px; padding-top: 20px\" class=\"card-img\" src=${imageLink} alt=\"book cover\">\n </div>\n <div \"card-body\">\n <h4 class=\" card-title\">${bookTitle}</h4>\n <p class=\"card-text author\">${author}</p>\n <p style= \"font-size: 15px;\" class=\"card-text summary\">${bookSummary}</p>\n <button class=\"btn btn-color btn-size btn-book\" data-book=\"${bookTitle}\">Add to My Library</button>\n </div>\n </div>\n </section>`;\n\n $(\".results\").append(bookHtml);\n }\n}", "renderEvidenceRow(eco_groups, row, eco_index) {\n let eco = eco_groups[0].evidence_type;\n let eco_id = eco_groups[0].evidence_id;\n let eco_label = eco_groups[0].evidence_label;\n\n if (this.props.filters.get(eco)) {\n return (\n <div className='ontology-ribbon__evidence-row' key={row + '.' + eco_index}>\n <div className='ontology-ribbon__eco'>\n <div>\n <a\n className='link'\n href={`http://www.evidenceontology.org/term/${eco_id}`}\n key={row + '.' + eco_index + '.' + eco_id}\n title={eco_label}\n target='_blank'\n >\n {eco}\n </a>\n </div>\n {\n this.renderQualifiers(eco_groups, row, eco_index)\n }\n </div>\n <div className='ontology-ribbon__eco-group-column' key={row + '.' + eco_index + '.groups'}>{this.renderECOgroups(eco_groups, row, eco_index)}</div>\n </div>\n );\n } else {\n return null;\n }\n }", "render() {\n let ps = this.props,\n comps = ps.children,\n { ISRow } = inlineStyles;\n return (\n <div {...ps} className=\"ui-row\" style={ISRow}>\n { comps.length > 0 ? this.renderContent(comps) : null }\n </div>\n );\n }", "function render(books) {\n libraryBooks.forEach((book) => {\n renderBook(book);\n });\n\n body.append(bookList);\n}", "function renderRow(doc, fields) {\n doc.classList.add('row')\n if (!Array.isArray(fields)) {\n return new Error (\"Fields must be an array\")\n }\n\n for (const f of fields) {\n doc.append(f)\n }\n\n return doc\n\n}", "render() {\n const videoIndex = this.findValue(\"VIDEO\");\n const artistIndex = this.findValue(\"ARTIST\");\n const songIndex = this.findValue(\"SONG\");\n return(\n <Grid\n container\n direction=\"column\"\n justify=\"center\"\n alignItems=\"center\">\n <Grid item>\n <Typography variant=\"h4\">{\"Artist and Album Information:\"}</Typography>\n </Grid>\n <Grid item>\n <Grid\n container\n direction=\"row\"\n justify=\"center\"\n spacing={8}\n >\n <Grid\n alignContent=\"center\"\n justify=\"center\"\n direction=\"row\"\n spacing={20}\n >\n {this.renderYoutubeVideo(videoIndex)}\n {this.renderArtistImage(artistIndex)}\n {this.renderMetadata(songIndex)}\n </Grid>\n <Grid item>\n <Typography> \n {this.renderLyrics()}\n </Typography>\n </Grid>\n </Grid>\n </Grid>\n </Grid>\n );\n }", "function renderRow(entry, i) {\n const entryWidth = entry.total || 1;\n const y = options.rowHeight * i;\n const x = (entry.start || 0.001);\n const detailsHeight = 450;\n const rectData = {\n cssClass: Object(__WEBPACK_IMPORTED_MODULE_1__transformers_styling_converters__[\"a\" /* requestTypeToCssClass */])(entry.responseDetails.requestType),\n height: options.rowHeight,\n hideOverlay: options.showAlignmentHelpers ? mouseListeners.onMouseLeavePartial : undefined,\n label: `<strong>${entry.url}</strong><br/>` +\n `${Math.round(entry.start)}ms - ${Math.round(entry.end)}ms<br/>` +\n `total: ${isNaN(entry.total) ? \"n/a \" : Math.round(entry.total)}ms`,\n showOverlay: options.showAlignmentHelpers ? mouseListeners.onMouseEnterPartial : undefined,\n unit: context.unit,\n width: entryWidth,\n x,\n y,\n };\n const showDetailsOverlay = () => {\n context.overlayManager.toggleOverlay(i, y + options.rowHeight, detailsHeight, entry, rowItems);\n };\n const rowItem = __WEBPACK_IMPORTED_MODULE_4__row_svg_row__[\"a\" /* createRow */](context, i, maxIconsWidth, maxNumberWidth, rectData, entry, showDetailsOverlay);\n rowItems.push(rowItem);\n rowHolder.appendChild(rowItem);\n rowHolder.appendChild(__WEBPACK_IMPORTED_MODULE_0__helpers_svg__[\"e\" /* newG */](\"row-overlay-holder\"));\n }", "getInfoRow(annotation) {\n switch (annotation.annotationType) {\n case 'classification':\n return (\n <tr className=\"classification\">\n <td className=\"vocabulary\">\n <h4 className=\"label\">Vocabulary</h4>\n <p>{annotation.vocabulary}</p>\n </td>\n <td>\n <h4 className=\"label\">Classification</h4>\n <p>{annotation.label}</p>\n </td>\n <td className=\"created\">\n <h4 className=\"label\">Created</h4>\n <p>{annotation.created ? annotation.created.substring(0, 10) : '-'}</p>\n </td>\n </tr>\n );\n case 'comment':\n return (\n <tr className=\"comment\">\n <td>\n <h4 className=\"label\">Comment</h4>\n <p>{annotation.text}</p>\n </td>\n <td className=\"created\">\n <h4 className=\"label\">Created</h4>\n <p>{annotation.created ? annotation.created.substring(0, 10) : '-'}</p>\n </td>\n </tr>\n );\n case 'link':\n return (\n <tr className=\"link\">\n <td>\n <h4 className=\"label\">Id</h4>\n <p>{annotation.annotationId}</p>\n </td>\n <td>\n <h4 className=\"label\">?</h4>\n <p>Todo: Implemement Link fields (unknown now)</p>\n </td>\n <td className=\"created\">\n <h4 className=\"label\">Created</h4>\n <p>{annotation.created ? annotation.created.substring(0, 10) : '-'}</p>\n </td>\n </tr>\n );\n case 'metadata':\n return (\n <tr className=\"metadata\">\n <td className=\"template\">\n <h4 className=\"label\">Template</h4>\n <p>{annotation.annotationTemplate}</p>\n </td>\n\n {annotation.properties ? annotation.properties.map((property, index) => (\n <td key={index}>\n <h4 className=\"label\">{property.key}</h4>\n <p>{property.value}</p>\n </td>\n )) : '-'\n }\n\n <td className=\"created\">\n <h4 className=\"label\">Created</h4>\n <p>{annotation.created ? annotation.created.substring(0, 10) : '-'}</p>\n </td>\n </tr>\n );\n default:\n return (\n <tr>\n <td>Unknown annotation type: {annotation.annotationType}</td>\n </tr>\n );\n }\n }", "renderRow(startIndex, endIndex) {\n let elements = [];\n for (let i = startIndex; i !== endIndex; i++) {\n elements.push(this.renderElement(this.props.grid[i], i));\n }\n return (\n <Row key={startIndex}>\n {elements}\n </Row>\n );\n }", "function BookList() {\n return <section className = \"booklist\"> \n <Book \n img={book1.url}\n title = {book1.title}\n author = {book1.author}\n />\n <Book \n img={book2.url}\n title = {book2.title}\n author = {book2.author}\n /> <Book \n img={book3.url}\n title = {book3.title}\n author = {book3.author}\n /> <Book \n img={book4.url}\n title = {book4.title}\n author = {book4.author}\n />\n \n \n </section>;\n}", "function BookList() {\n return (\n <div className='container'>\n <section className='booklist row'>\n {books.map((book) => {\n return <Book key={book.id} {...book}></Book>;\n })}\n </section>\n </div>\n );\n}", "_renderImgAndInfo() {\n return this.state.items.map(function(imageObjs, index) {\n let {id, sm_img, rg_link, user, height, width} = imageObjs\n let orientation = height>width? \"Portrait\":\"Landscape\"\n return (\n <ListGroupItem className=\"show-grid infinite-scroll-example__list-item\"\n key={index}>\n\n\n\n <ListGroup>\n\n\n <ListGroupItem>\n <img src={sm_img} alt={id}/>\n </ListGroupItem>\n\n <ListGroupItem>\n <Table striped bordered >\n <thead >\n <tr>\n <th className=\"text-center\">User Name</th>\n <th className=\"text-center\">Link</th>\n <th className=\"text-center\">Width</th>\n <th className=\"text-center\">Height</th>\n <th className=\"text-center\">Oreintation</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td>{user}</td>\n <td><a href={rg_link}>Image Link</a></td>\n <td>{width}</td>\n <td>{height}</td>\n <td>{orientation}</td>\n </tr>\n </tbody>\n </Table>\n </ListGroupItem>\n\n\n </ListGroup>\n\n\n\n </ListGroupItem>\n );\n });\n }", "function renderMultipleBooks(books) {\n // listPanel.innerHTML = ''\n books.forEach(book => renderSingleBookTitle(book))\n}", "renderRow(rowData, sectionId, index) {\n\n // rowData contains grouped data for one row, \n // so we need to remap it into cells and pass to GridRow\n if (index === '0') {\n return (\n <TouchableOpacity key={index}>\n <Image\n styleName=\"large\"\n source={{ uri: rowData[0].image }}>\n <Tile>\n <Title styleName=\"md-gutter-bottom\">{rowData[0].name}</Title>\n <Subtitle styleName=\"sm-gutter-horizontal\">cdssdds</Subtitle>\n </Tile>\n </Image>\n <Divider styleName=\"line\" />\n </TouchableOpacity>\n );\n }\n\n\n const cellViews = rowData.map((item, id) => {\n return (\n <TouchableOpacity key={id} styleName=\"flexible\">\n <Card styleName=\"flexible\">\n <Image\n styleName=\"medium-wide\"\n source={{ uri: item.image }}\n />\n <View style={styles.cell}>\n <Subtitle numberOfLines={3}>{item.name}</Subtitle>\n <View styleName=\"horizontal\">\n <Caption styleName=\"collapsible\" numberOfLines={2}>cdscds</Caption>\n </View>\n </View>\n </Card>\n </TouchableOpacity>\n );\n })\n\n\t\treturn (\n <GridRow columns={2}>\n {cellViews}\n </GridRow>\n \t)\n\t}", "renderRows(){\n return this.state.list.map((item, index) => {\n\n return (\n <Table.Row key={item.id}>\n <Table.Cell>\n <Checkbox id={`cdItem${item.id}`} checked={item.checked} onChange={(e) => this.selectOne(e, index)} />\n </Table.Cell>\n <Table.Cell>{item.id}</Table.Cell>\n <Table.Cell>\n {item.avatar_url && (\n <ImageLoader\n src={item.avatar_url}\n loading={() => <Loader active inline />}\n error={() => <div>Error</div>}\n />\n )}\n </Table.Cell>\n <Table.Cell>{item.login}</Table.Cell>\n <Table.Cell>{item.type}</Table.Cell>\n <Table.Cell>$ {(Math.round(item.score * 100) / 100).toFixed(2).toString().replace('.',',')}</Table.Cell>\n </Table.Row>\n )\n })\n }", "function makeLibrary(response, type, err, contents, data)\n{\n var replacement = \"\";\n var table = util.getTable();\n var columns = [\"Author\", \"Title\", \"Year\", \"Notes\"];\n var row = [];\n var author = \"\", title = \"\", year = \"\", notes = \"\";\n\n table.setHTMLClass(\"conq\");\n table.setColumns(columns);\n for(var i = 0; i < data.length; i++)\n {\n author = util.deNullify(data[i].fullTitle);\n title = util.linkify(data[i].title, data[i].link);\n year = data[i].yearPublished;\n notes = util.deNullify(data[i].notes, \".\");\n row = [author, title, year, notes];\n table.addRow(row);\n }\n replacement = table.buildHTMLPrintout();\n\n contents = util.absRep(contents, \"LIBRARY\", replacement);\n\n final.wrapup(response, type, err, contents);\n}", "function 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 }", "function wrap(row) {\n return (\n <table>\n <tbody>\n {row}\n </tbody>\n </table>\n );\n }", "render() {\n return (\n <Grid>\n <Offerings\n productData={this.props.products.main_offering}\n type={\"main\"}\n maxProducts={1}\n />\n <Offerings\n productData={this.props.products.sale_offerings}\n type={\"ribbon\"}\n maxProducts={3}\n />\n </Grid>\n );\n }", "function render_next_row() {\n\n current_row = (current_row + 1) % DataManager.imported_data.length;\n render_row(current_row);\n\n}", "render(){\n\t\tconst title = ['Subtotal', 'IVA (16%)', 'Total'];\n\t\tconst { concepts, subtotal, iva, total, concept, quantity, num, price } = this.props;\n\t\tconst Concepts = concepts.map((concept, index) => \n\t\t\t<ConceptRow key={index} {...concept} \n\t\t\t\t\t\ttype = {index} \n\t\t\t\t\t\tonAddQuantity = {this.props.onAddQuantity}\n\t\t\t\t\t\tonRemoveQuantity = {this.props.onRemoveQuantity}\n\t\t\t\t\t\tonDeleteConcept = {this.props.onDeleteConcept}\n\t\t\t\t\t\trowType = {'concept'}/>\n\t\t);\n\t\t//Adding new concept\n\t\tConcepts.push(<ConceptRow key={Concepts.length}\n\t\t\t\t\t\tonUpdateAddConcept = {this.props.onUpdateAddConcept} \n\t\t\t\t\t\ttype = {Concepts.length} \n\t\t\t\t\t\trowType = {'newConcept'}/>);\n\t\t//Stats info\n\t\ttitle.forEach((titleType, index) =>{\n\t\t\tlet amountType;\n\t\t\tif(titleType === 'Subtotal'){\n\t\t\t\tamountType = subtotal;\n\t\t\t}else if(titleType === 'IVA (16%)'){\n\t\t\t\tamountType = iva;\n\t\t\t}else{\n\t\t\t\tamountType = total;\n\t\t\t}\n\t\t\tConcepts.push(<ConceptRow key={Concepts.length} \n\t\t\t\t\t\t\t\t\t type = {Concepts.length} \n\t\t\t\t\t\t\t\t\t title = {titleType} \n\t\t\t\t\t\t\t\t\t rowType = {'stats'}\n\t\t\t\t\t\t\t\t\t amount = {amountType}/>);\n\t\t});\n\t\treturn(\n\t\t\t<table className = \"tableGrid\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Descripción</th>\n\t\t\t\t\t\t<th>Cantidad</th>\n\t\t\t\t\t\t<th>Unidades</th>\n\t\t\t\t\t\t<th>Precio Unitario</th>\n\t\t\t\t\t\t<th>Total</th>\n\t\t\t\t\t\t<th>Acciones</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\n\t\t\t\t\t{Concepts}\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t);\n\t}", "render() {\n const modules = this.state.modules;\n let displayModules = modules.map((v,i) => {\n return <CourseDetail \n key={i}\n id={v.id}\n name={v.name}\n description={v.description}\n />\n })\n return (\n <div>\n <div className=\"[ courseDetail ][ row ]\">\n <div className=\"[ col-md-6 ]\">\n {/* Text components with course data from api will be added here */}\n {displayModules}\n </div>\n <div className=\"[ col-md-6 ]\">\n {/* Text components with course data from api will be added here */}\n </div>\n </div>\n\n <div className=\"[ modules ][ row ]\">\n {\n \n }\n {/* Module components with data from api will be added here */}\n </div>\n\n <div className=\"[ module-info ][ row ]\">\n <div className=\"[ col-md-6 ]\">\n {/* Text components with module data from api will be added here */} \n </div>\n <div className=\"[ col-md-6 ]\">\n {/* Text components with module data from api will be added here */}\n </div>\n </div>\n \n <div className=\"[ slides ][ row ]\">\n\n </div>\n </div>\n );\n }", "render() {\n\t\treturn (\n <View style={{flex:1, justifyContent: 'center', marginTop: 20}}>\n <ScrollView>\n {\n this.props.repos.map((repo, idx) => {\n const isStarred = this.props.starredRepos.some(e => e.url === repo.fullName);\n return this.renderRow(repo, isStarred);\n })\n }\n\t\t\t </ScrollView>\n </View>\n\t\t\t\n\t\t);\n\t}", "render() {\n return (\n <div className=\"main-content\">\n {this.props.planets.planets.map(j => (\n <ServiceItem key={j.id}>\n <table>\n <tr>\n <td>\n Plant Name: {j.PLANET_NAME}\n </td>\n </tr>\n <tr>\n <td>\n Class: {j.CLASS_TYPE}\n </td>\n </tr>\n <tr>\n <td>\n Climate: {j.CLIMATE}\n </td>\n </tr>\n <tr>\n <td>\n Notes: {j.NOTES}\n </td>\n </tr>\n </table>\n </ServiceItem>\n ))}\n </div>\n );\n }", "function renderLibraryStorage() {\n if(localStorage.myLibrary) {\n let getBooks = JSON.parse(localStorage.getItem(\"myLibrary\"))\n myLibrary = getBooks\n myLibrary.map((value) => {\n renderBook(value)\n })\n }\n}", "renderList() {\n return this.props.moduleDetails.map((module) => {\n return (\n <article\n key={module.module_name}\n onClick={() => this.props.selectModule(module)}\n className= {this.isBestanden(module.moduleID)}>\n <span className=\"glyphicon glyphicon-info-sign module-icon module-reference aria-hidden\"></span>\n <span data-toggle=\"tooltip\" title=\"Bereits bestanden !\" className=\"glyphicon glyphicon-ok-circle module-icon\"></span>\n\t <header>{module.moduleID}</header>\n <header className=\"module-name\">{module.module_name}</header>\n\t <div className=\"detail\">{module.cp_number} CPs</div>\n </article>\n );\n });\n }", "render() {\n\n // Create the link and col contents.\n const a = this.newLink('link-underline', this.assignmentLink, this.assignmentName);\n const nameCol = this.newCol(12);\n nameCol.appendChild(a);\n\n // Append the col to a new row.\n const row = this.newDiv('row');\n row.classList.add('assignment-name');\n row.appendChild(nameCol);\n\n return row;\n }", "render() {\n return (\n <div className=\"card-gallery\">\n \t\t{this.renderCardSection()}\n </div>\n );\n }", "formatSkillList(skills) {\r\n return skills ? skills.map(skill => {\r\n return <SkillRow key={ uniqueId() } label={ skill.name } rating={ skill.experience } clickHandler={ ()=>{ this.selectSkill(skill.name); } } selected={skill.selected} />;\r\n }) : null;\r\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 }", "renderPage() {\n const vendorTypes = _.pluck(VendorClass.collection.find().fetch(), 'vendor');\n const vendorTypeData = vendorTypes.map(vendorType => getInterestData(vendorType));\n return (\n <div id='byCategory-Page' className='pages-background' style={{ paddingTop: '20px' }}>\n <Container id=\"interests-page\">\n <Card.Group>\n {_.map(vendorTypeData, (vendorType, index) => <MakeCard key={index} vendorType={vendorType}/>)}\n </Card.Group>\n </Container>\n <div className='green-gradient' style={{ paddingTop: '100px' }}/>\n <div className='footer-background'/>\n </div>\n );\n }", "getRows(modules) {\n return modules.map(m => {\n return (\n <Row key={m.code}>\n <Col xs >\n <p>{m.code}</p>\n </Col>\n <Col xs >\n <p>{m.name}</p>\n </Col>\n <Col xs>\n {this.state.accessLevel === '3' ?\n <RaisedButton\n style={{ cursor: \"pointer\" }}\n onClick={() => this.handleRemove(this.props.moduleCode, m.code)}\n primary={true}\n label={\"Remove prerequisite\"} /> :\n <div></div>\n }\n </ Col>\n </Row>);\n });\n }", "renderItem(item) { return item; }", "render() {\n\n\t\treturn (\n\t\t\t\n\t\t\t<div className=\"UserRecipes\">\n\t\t\t\t<h4>Your Recipes:</h4>\n\t\t\t\t<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Name</th>\n\t\t\t\t\t\t<th>Status</th>\n\t\t\t\t\t\t<th>Views</th>\n\t\t\t\t\t\t<th>Comments</th>\n\t\t\t\t\t\t<th>Recommendations</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Name...</td>\n\t\t\t\t\t\t<td>Published (<a href=\"#\">Change Status</a>)</td>\n\t\t\t\t\t\t<td>50</td>\n\t\t\t\t\t\t<td>2</td>\n\t\t\t\t\t\t<td>1</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Fdsa...</td>\n\t\t\t\t\t\t<td>Unpublished (<a href=\"#\">Change Status</a>)</td>\n\t\t\t\t\t\t<td>12</td>\n\t\t\t\t\t\t<td>0</td>\n\t\t\t\t\t\t<td>0</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>Asdf...</td>\n\t\t\t\t\t\t<td>Published (<a href=\"#\">Change Status</a>)</td>\n\t\t\t\t\t\t<td>100</td>\n\t\t\t\t\t\t<td>20</td>\n\t\t\t\t\t\t<td>12</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</div>\n\t\t)\n\t}", "function renderArticles(articlesList) {\n var articlesListHTML = \"\";\n var currentColumnIndex = 0;\n $.each(articlesList, function (index, latestArticle) {\n articlesListHTML += getEach3ColumnsOpeningHtmlTag('<div class=\"row\">', index, currentColumnIndex);\n articlesListHTML += '<div class=\"sm-1-3\">';\n articlesListHTML += '\t<div class=\"wrap-col\">';\n articlesListHTML += '\t\t<div class=\"box-entry\">';\n articlesListHTML += '\t\t\t<div class=\"box-entry-inner\">';\n articlesListHTML += '\t\t\t\t<img src=\"' + getArticleFirstImageFile(latestArticle) + '\" class=\"img-responsive\" />';\n articlesListHTML += '\t\t\t\t<div class=\"entry-details\">';\n articlesListHTML += '\t\t\t\t\t<div class=\"entry-des\">';\n articlesListHTML += '\t\t\t\t\t\t<span>' + latestArticle.creation_date + '</span>';\n articlesListHTML += '\t\t\t\t\t\t<h3><a href=\"javascript:showArticle(' + latestArticle.article_id + ')\">' + latestArticle.title + '</a></h3>';\n articlesListHTML += '\t\t\t\t\t\t<h4>' + latestArticle.author_nickname + '</a></h4>';\n articlesListHTML += '\t\t\t\t\t\t<p>' + latestArticle.header_text + '</p>';\n articlesListHTML += '\t\t\t\t\t\t<a class=\"button button-skin\" href=\"javascript:showArticle(' + latestArticle.article_id + ')\">' + LABEL_READ + '</a>';\n articlesListHTML += '\t\t\t\t\t</div>';\n articlesListHTML += '\t\t\t\t</div>';\n articlesListHTML += '\t\t\t</div>';\n articlesListHTML += '\t\t</div>';\n articlesListHTML += '\t</div>';\n articlesListHTML += '</div>';\n articlesListHTML += getEach3ColumnsClosingHtmlTag('</div>', index, currentColumnIndex, false);\n currentColumnIndex = (currentColumnIndex < 2 ? ++currentColumnIndex : 0);\n shownArticlesCount++;\n });\n if (!(shownArticlesCount % 3 === 0) && currentColumnIndex != 2) { //Closing row div in case it has 1 or 2 articles\n articlesListHTML += '</div>';\n }\n if (articlesList.length == 0) { //Hide show next articles button if no more articles are found\n $(\"#showNextArticlesButton\").hide();\n }\n $(\"#latestArticles\").append(articlesListHTML);\n $(\"#latestArticles\").show(1000);\n}", "generateGridItems() {\n let items = this.state.items;\n return _.map(this.state.layouts.lg, function (l, i) {\n return (\n <div key={i}>\n <GridItem title={items[i].title} text={items[i].text} />\n </div>);\n });\n }", "courseRow(course, index) {\n return <div key={index}>{course.title}</div>;\n }", "render() {\n const { classes, renderings } = this.props;\n\n return (\n <React.Fragment>\n <Typography variant=\"h3\" className={classes.h3}>Other download options</Typography>\n <List>\n {renderings.map(rendering => (\n <RenderingDownloadLink rendering={rendering} key={rendering.id} />\n ))}\n </List>\n </React.Fragment>\n );\n }", "function ProductCategoryRow(props){\n return(\n <tr>\n <th>{props.header}</th>\n </tr>\n )\n}", "function renderContent(arr) {\n\tlet htmlContent = '';\n\tarr.forEach(function(item, index) {\n\t\thtmlContent += `\n\t\t<div class=\"col-md-4 text-center\">\n\t\t\t<a id=\"product_${index}\" href=\"detail_product.html\" onclick=\"transferId(${index})\">${\n\t\t\titem.image\n\t\t}</a>\n\t\t\t<p class=\"products-name\">${item.name}</p>\n\t\t\t<p class=\"products-name\">Year: ${item.year}</p>\n <p class=\"products-price\">${item.price} đ</p>\n <a href=\"cart.html\" class=\"products-btn products-btn-buy btn btn-sm btn-primary\" onclick=\"pushInfoById(${index})\">Mua ngay</a>\n <a id=\"product_${index}\" href=\"detail_product.html\" class=\"products-btn products-btn-more btn btn-sm btn-primary\" onclick=\"transferId(${index})\">Xem thêm</a>\n </div>\n `;\n\t});\n\t$('.products .col-md-9 .row').html(htmlContent);\n}", "wrapInParentHtml(htmlObjectArray) {\n var newData = [];\n let innerHtml = \"\";\n //if there are more than 3 entries, do wrapping operations\n if (htmlObjectArray.length > 3) {\n // https://stackoverflow.com/questions/63462236/merge-every-3-elements-in-array-javascript\n for (let i = 0; i < htmlObjectArray.length; i += 3) { // i+=3 can solve your problem\n let three = \"\";\n // don't pass the ones that aren't null\n if (htmlObjectArray[i]) {\n three += htmlObjectArray[i];\n }\n if (htmlObjectArray[i + 1]) {\n three += htmlObjectArray[i + 1];\n }\n if (htmlObjectArray[i + 2]) {\n three += htmlObjectArray[i + 2];\n }\n //push each set of three to the newData array\n newData.push(three)\n }\n //wrap each set of 3 and then return it\n for (const setOfHtml of newData) {\n innerHtml += `<div class='columns features is-centered'>${setOfHtml}</div>`;\n }\n return innerHtml;\n } else {\n //else just return the data wrapped in one row and return\n return `<div class='columns features is-centered'>${htmlObjectArray}</div>`;\n }\n }", "async getLibraryDetails(userId) {\n let that = this;\n var resp = await fetchLibrary(userId, this.props.client)\n let images = [];\n let videos = [];\n let templates = [];\n let documents = [];\n if (!resp)\n resp = [];\n resp.map(function (data) {\n if (data.libraryType === \"image\") {\n images.push(data);\n that.setState({ imageSpecifications: images, popImagesSpecifications: images })\n } else if (data.libraryType === \"video\") {\n videos.push(data)\n that.setState({ videoSpecifications: videos })\n } else if (data.libraryType === \"template\") {\n templates.push(data)\n that.setState({ templateSpecifications: templates })\n } else if (data.libraryType === \"document\") {\n documents.push(data)\n that.setState({ documentSpecifications: documents })\n }\n })\n }", "renderBooks() {\n return _.map(this.props.books, book => {\n return (<li className='list-group-item' key={book.id}>\n {book.book_title} </li>\n );\n });\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 }", "static oneItem(key, item) {\n var g = new GridRow(key, [item]);\n g.useColspan = true;\n return g;\n }", "render(){\n\n\t\treturn (\n <div className=\"bookshelf\">\n <h2 className=\"bookshelf-title\">{this.props.shelf.label}</h2>\n <div className=\"bookshelf-books\">\n <ol className=\"books-grid\">\n {this.props.shelf.books.map((book)=>(\n <li key={book.id}><Book book={book} updateBooks={this.props.updateBooks} options={this.props.shelf.shelfOptions}/></li>\n ))}\n </ol>\n </div>\n </div>\n\n\n );\n\t}", "function Booklist() {\n\treturn (\n\t\t<section className='BookList'>\n\t\t\t{Books.map((book) => {\n\t\t\t\treturn <Book key={book.id} {...book}></Book>;\n\t\t\t})}\n\t\t</section>\n\t);\n}", "function renderAlbum(album) {\n const photos = album.photos;\n let template = `\n<div class=\"album-card\">\n <header>\n <h3>${photos.title}, by Bret </h3>\n </header>\n <section class=\"photo-list\">\n </section>\n</div>\n `\n photos.forEach(photo => {\n $('.photo-list').append(renderPhoto(photo));\n })\n return template;\n}", "render() {\n // const { category } = this.props;\n const { products } = this.props.products;\n return (\n <div className=\"product-container\">\n {products.map((product) => {\n return <ProductItem product={product} />;\n })}\n {products.map((product) => {\n return <ProductItem product={product} />;\n })}\n {products.map((product) => {\n return <ProductItem product={product} />;\n })}\n {products.map((product) => {\n return <ProductItem product={product} />;\n })}\n {products.map((product) => {\n return <ProductItem product={product} />;\n })}\n {products.map((product) => {\n return <ProductItem product={product} />;\n })}\n </div>\n );\n }", "squareToRender() {\n const element = [];\n for (let i = 0; i < 3; i++) {\n element.push(this.handleSquare(i))\n }\n return element.map((item, index) => <Fragment key={index}>{item}</Fragment>);\n }", "renderBillRow() {\n console.log(\"ReadAll renderBillRow()...\");\n return this.state.billsArray.map(function(arrayValue, arrayIndex) {\n return <BillRow key={arrayValue._id} arrayIndex={arrayIndex} arrayValue={arrayValue} />;\n });\n }", "function ProductList(props) {\n const data = props.data;\n\n const listItems = data.map((item) =>\n <div key={item.id.toString()}>\n <ListItem alignItems=\"flex-start\">\n <ListItemAvatar className=\"image\">\n <Avatar alt={item.name} src={\"http://167.71.145.135/storage/\"+item.images[0].url} className=\"image-width\"/>\n </ListItemAvatar>\n <div>\n <ListItemText\n primary={item.name}\n secondary={\n <React.Fragment>\n {item.plazas.length ? \n\n <Typography\n component=\"span\"\n variant=\"body1\"\n className={useStyles.inline}\n color=\"textPrimary\"\n >\n {item.plazas[0].name}\n </Typography>\n :null\n }\n\n {' - '+item.description.slice(0, 120)+'...'} \n </React.Fragment>\n }\n />\n \n \n <ListItemText >\n <p className=\"price-color\"> { new Intl.NumberFormat('es-MX', { style: 'currency', currency: 'MXN' }).format( item.price) }</p>\n </ListItemText>\n </div>\n </ListItem>\n\n <Divider variant=\"inset\" />\n </div>\n );\n return (\n <ul>{listItems}</ul>\n );\n }", "function gdCarouselBuildHeadline(data, numPerRow)\n{\n\t/*\n<div class=\"row\">\n<div class=\"col-lg-4\">\n<img class=\"img-circle\" src=\"data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==\" alt=\"Generic placeholder image\" width=\"140\" height=\"140\">\n<h2>Links</h2>\n<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>\n<p id=\"gdsyslinksButton\"><a class=\"btn btn-default\" href=\"#\" role=\"button\">View details &raquo;</a></p>\n</div>\n\t */\n\tif(numPerRow === undefined || numPerRow < 1 || numPerRow > 12 || numPerRow == 5 || numPerRow > 6)\n\t\tnumPerRow = 3;\n\tvar counter = 0; \n\tvar cellspan = Math.ceil(12 / numPerRow);\n\tvar div_row = null;\n $.each(data, function(key, val)\n {\n \tif(counter == 0)\n \t\tdiv_row = $(\"<div/>\").addClass(\"row\");\n \t\n \tvar div_col = $(\"<div/>\").addClass(\"col-lg-\" + cellspan);\n \tvar img = $(\"<img/>\",\n\t\t\t{\n\t\t\t\tsrc: \"data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==\",\n\t\t\t\talt: \"Generic placeholder image\",\n\t\t\t\twidth: \"140\",\n\t\t\t\theight: \"140\"\n\t\t\t}).addClass(\"img-circle\");\n \tvar h2 = $(\"<h2/>\").text(val.label);\n \tvar pcountent = $(\"<p/>\").text(val.ldesc);\n \tvar pbutton = $(\"<p/>\");\n \tvar a = $(\"<a/>\",\n\t\t\t{\n \t\t\trole: \"button\"\n\t\t\t}).addClass(\"btn btn-default\");\n \tif(val.sdesc == \"USER_TYPE-PROSPECT\")\n \t\ta.attr(\"href\", \"register_login_prospect.php\").html(\"Begin Your Journey\");\n \telse if(val.sdesc == \"USER_TYPE-STUDENT\")\n \t\ta.attr(\"href\", \"register_login_student.php\").html(\"Lets Get You In\");\n \telse if(val.sdesc == \"USER_TYPE-ALUMNI\")\n \t\ta.attr(\"href\", \"register_login_alumni.php\").html(\"Share What You Know\");\n \telse if(val.sdesc == \"USER_TYPE-FACULTY\")\n \t\ta.attr(\"href\", \"register_login_faculty.php\").html(\"Become the Guide\");\n\n\t\tpbutton.append(a);\n \t\n \tdiv_col.append(img);\n \tdiv_col.append(h2);\n \tdiv_col.append(pcountent);\n \tdiv_col.append(pbutton);\n \tdiv_row.append(div_col);\n \t\n \tif(counter == numPerRow)\n\t\t{\n \t\t$(\"#usertypes\").append(div_row);\n \t\tcounter = 0;\n\t\t}\n \telse\n\t\t{\n \t\tcounter++;\n\t\t}\n });\n}", "renderListofAlbuns() {\n\n const { data, musicsArtist } = this.props.value;\n\n let dataAlbum = data.results;\n let dataSongs = musicsArtist;\n\n let zip = (a1, a2) => a1.map((x, i) => [x, a2[i]]);\n\n let albunsAndSongs = zip(dataAlbum, dataSongs);\n\n return (\n albunsAndSongs.map(item => (\n <Albuns key={item[0].collectionId} album={item} />\n ))\n )\n\n\n }", "function renderBooks() {\n let bookItems = CATALOG.map(describeBook);\n $(\".renderList\").html(bookItems.join(''));\n console.log(\"renderBook ran\")\n\n}", "createRowLabel() {\n let rowLabel = []\n for (let i = 1; i < 4; i++) {\n rowLabel.push(\n <div key={i} className=\"row-label\">\n <p>{i}</p>\n </div>\n )\n }\n return rowLabel\n }" ]
[ "0.7772568", "0.75394875", "0.6713735", "0.6692541", "0.6594222", "0.6527876", "0.6480885", "0.6388772", "0.6106803", "0.6100448", "0.60722", "0.5896136", "0.5722626", "0.5690623", "0.5689655", "0.5630077", "0.5628221", "0.56192666", "0.5600598", "0.5591161", "0.5584242", "0.5571201", "0.5569645", "0.55510134", "0.5534143", "0.54894763", "0.5487049", "0.54831755", "0.54807466", "0.5462442", "0.5436777", "0.542606", "0.54236853", "0.5419383", "0.5411681", "0.5411655", "0.5392024", "0.53880626", "0.5387855", "0.5377082", "0.53480434", "0.5346845", "0.53453344", "0.5342316", "0.53347045", "0.53233796", "0.53153867", "0.530815", "0.52988887", "0.52961665", "0.5287745", "0.528767", "0.52874297", "0.5287013", "0.52838546", "0.527987", "0.52744496", "0.5265544", "0.52545714", "0.5254403", "0.52502036", "0.5245384", "0.5222878", "0.5220486", "0.5219557", "0.5215512", "0.5214989", "0.5214063", "0.52089715", "0.5206903", "0.520643", "0.5203799", "0.5203538", "0.52027184", "0.51950574", "0.51886916", "0.5184793", "0.5183255", "0.5180191", "0.51693416", "0.51633793", "0.5158921", "0.51585346", "0.5139231", "0.5136098", "0.513416", "0.5131046", "0.51286167", "0.5125425", "0.5122582", "0.5120959", "0.5116468", "0.5112945", "0.5109898", "0.5109691", "0.51094055", "0.50964", "0.5094977", "0.5090927" ]
0.7407983
2
render component to screen
render() { return ( <ListView dataSource={this.dataSource} renderRow={this.renderRow} /> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_renderScreen() {\n\t\tif (this._el && this._component) {\n\t\t\tthis._component.render(this._el);\n\t\t}\n\t}", "render() { this.screen.render() }", "function render() {\n\n\t\t\t}", "function render() {\n\t\t\t}", "render() {\n\t\tif (!this.component_.element) {\n\t\t\tthis.component_.element = document.createElement('div');\n\t\t}\n\t\tthis.emit('rendered', !this.isRendered_);\n\t}", "renderScreenContent(){}", "function render() {\n\t\t\n\t}", "function render() {\n\t}", "render() { }", "render() {\n\n\t}", "render() {\n\n\t}", "onRender()/*: void*/ {\n this.render();\n }", "render(){}", "render(){}", "render() {\n if (this.renderer) {\n this.renderer.call(this.owner, this.content, this.owner, this.model);\n }\n }", "render() {\n // Subclasses should override\n }", "render() {\n this.renderComponents() // dial + outputs, algedonode, brass pads, strips, lights\n this.renderLabels()\n }", "_render() {\n this._reactComponent = this._getReactComponent();\n if (!this._root) this._root = createRoot(this._container.getElement()[0]);\n this._root.render(this._reactComponent);\n }", "render(){\r\n\r\n\t}", "render() {}", "render() {}", "render() {}", "function render() {\n\n\t\t\tisRendered = true;\n\n\t\t\trenderSource();\n\n\t\t}", "render() {\n\n }", "static rendered () {}", "static rendered () {}", "render(container) {\n this.renderer.render(container);\n }", "render() {\n }", "render() {\n // background box.\n this.renderBackground();\n this.renderName();\n this.renderTimeLine();\n this.renderWave();\n }", "function render() {\n\n isRendered = true;\n\n renderSource();\n\n }", "render() {\n\n }", "render() {\n\n }", "render() {\n\n }", "render() {\n\t\treturn <div>{this.renderContent()}</div>;\n\t}", "render() { return super.render(); }", "render() {\n this.update();\n }", "render() {\n return super.render();\n }", "render() {\n return this.renderContent();\n }", "render() {\n\n return (\n <div>\n {this.renderContent()}\n </div>\n );\n \n }", "function render() {\r\n\r\n}", "function render() {\r\n\r\n}", "render() {\n this.el.innerHTML = this.template();\n\n setTimeout(() => {\n this.bindUIElements();\n }, 0);\n }", "render() {\n }", "render() {\n }", "build() {\n const componentsRenderer =\n this.namespace().ComponentRenderer.new({ rootComponent: this })\n\n this.renderWith(componentsRenderer)\n }", "function Render() {\n ClearScreen();\n RenderEnergeticDroplets();\n ResetRenderingConditions();\n}", "function render() {\n if (!willRender) {\n willRender = true;\n process.nextTick(function() {\n screen.render();\n willRender = false;\n });\n }\n}", "function render() {\n renderLives();\n renderTimeRemaining();\n }", "render() {\n return super.render();\n }", "render() {\n return super.render();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "render() {\n this.notify('initial-load', {});\n /**\n * Used to load context menu\n */\n this.trigger('load');\n this.notify('initial-end', {});\n this.renderElements();\n this.renderComplete();\n }", "render() {\n return this.renderContent()\n }", "onRender () {\n\n }", "constructor() {\n super();\n this.render();\n }", "update () {\n this.render();\n }", "$render(displayRef) {\n if(this.$alive)\n this.render.apply(this, [this, displayRef]);\n }", "_render() {}", "render(...args) {\n if (this._render) {\n this.__notify(EV.BEFORE_RENDER);\n this._render(...args);\n this.__notify(EV.RENDERED);\n }\n\n this.rendered = true;\n }", "render() {\n return(<div />);\n }", "render(){if(this.renderer){this.renderer.call(this.owner,this.content,this.owner,this.model)}}", "function render() {\n\t// actually display the scene in the Dom element\n\trenderer.render( scene, camera );\n}", "function render() {\n renderCards();\n renderValue();\n}", "render() {\n const self = this;\n const data = self.get('data');\n if (!data) {\n throw new Error('data must be defined first');\n }\n self.clear();\n self.emit('beforerender');\n self.refreshLayout(this.get('fitView'));\n self.emit('afterrender');\n }", "render() {\n return <div>{this.toRender()}</div>;\n }", "render() {\n return super.render();\n }", "render() {\n return super.render();\n }", "render() {\n return super.render();\n }", "render() {\n return super.render();\n }", "render() {\n\t\tthis.patch();\n\t}", "connectedCallback() {\n this.render();\n }", "function render() {\n renderRegistry();\n renderDirectory();\n renderOverride();\n}", "render() {\r\n return <div />\r\n }", "function render(model) {\n const {\n mount\n } = model;\n\n container(mount).innerHTML = 'sometext'\n }", "render() {\n\t\treturn(\n\t\t\t<div className=\"border red\">\n\t\t\t\t{this.renderContent()}\n\t\t\t</div>\n\t\t);\n\t}", "render() {\n return (\n\n\n\n\n\n )\n }", "function general_render(obj) {\n obj.render();\n }", "render() {\n return (\n <div className=\"border red\">\n {this.renderContent()}\n </div>\n );\n \n }", "render () {\n\t\tthis.renderBoard();\n\t\tthis.renderPieces();\n\t\t$writeInnerHTML( this.view.$maxVal, this.model.maxTimes );\n\t\t$writeInnerHTML( this.view.$minVal, this.model.minTimes );\n\t\tthis.view.alocatePieces( this.model.finalPositionsArr, this.model.baseNumber, this.model.getPieceSize(), this.model.gutterSize );\n\t\tthis.toggleBoardLock();\n\t}", "renderComponents() {\n this.algedonodeActivators.forEach(aa => {\n aa.render(this.renderer)\n })\n this.dials.forEach(d => {\n d.render(this.renderer)\n })\n this.strips.forEach(s => {\n s.render(this.renderer)\n })\n this.rows.forEach(r => {\n r.forEach(c => {\n c.render(this.renderer)\n })\n })\n this.lights.forEach(lightPair => {\n lightPair.forEach(light => light.render(this.renderer))\n })\n }", "render() {\n this.activeObjects.forEach(function(object) {\n object.render();\n });\n }", "render() {\n return (\n <div className=\"red-border\">\n { this.renderContent() }\n </div>\n )\n }", "render() {\r\n return (\r\n <div className=\"border red\">\r\n { this.renderContent() }\r\n </div>\r\n );\r\n }", "render() {\n this._userEvent('beforeRender');\n const html = this.template.render({data: this.viewData}, (data) => {\n return this.wrapTemplate(data);\n });\n if (!this.wrapper) {\n this.wrapper = this._createWrapper();\n }\n this.updateNode(this.wrapper, html);\n this.resize();\n this._userEvent('afterRender');\n }", "function render() {\n\n // Call the Character instance's renderAt() method, passing along its current\n // left and top position\n _character.renderAt(_character.left, _character.top);\n }", "render( ) {\n return null;\n }", "display(t) {\r\n if (!this.gl || !this.canvasElement_)\r\n return;\r\n let gl = this.gl;\r\n gl.clearColor(0., 0., 0., 1.);\r\n gl.clear(this.gl.COLOR_BUFFER_BIT);\r\n gl.viewport(0, 0, this.canvasElement_.width, this.canvasElement_.height);\r\n if (this.vbo && this.program) {\r\n this.program.Use();\r\n this.vbo.Render(this.program.GetVertexPosition(\"position\"));\r\n }\r\n gl.useProgram(null);\r\n gl.bindBuffer(gl.ARRAY_BUFFER, null);\r\n }", "render() {\n render(offscreenCanvas);\n }", "_render()\n {\n if (this.isDisabled())\n return;\n\n this._setContentSizeCss();\n this._setDirection();\n const paragraph = html`<p>${this.text}</p>`;\n let anchor = \"\";\n let action = \"\";\n if (this.link && this.linkText)\n anchor = html`<a href=\"${this.link}\" target=\"_blank\">${this.linkText}</a>`;\n if (this.action && this.actionText)\n action = html`${anchor ? \" | \" : \"\"}<a href=\"javascript:void(0)\" @click=${this.action}>${this.actionText}</a>`;\n let heading = \"\";\n if (this.heading)\n heading = html`<h4>${this.heading}</h4>`;\n\n render(html`${heading}${paragraph}<div id=\"links\">${anchor}${action}</div>`, this.tooltipElem);\n }", "render()\n {\n return super.render();\n }", "_render() {\n\t\tif (this.ctx) {\n\t\t\tthis.ctx.fillStyle = this._settings.append_to.css('color');\n\t\t\tthis.ctx.beginPath();\n\t\t\tthis.ctx.arc(this.coordinates.x, this.coordinates.y, this.size, 0, 2 * Math.PI);\n\t\t\tthis.ctx.closePath();\n\t\t\tthis.ctx.fill()\n\t\t} else if (this.$element) {\n\t\t\t// TODO: look into rendering to a canvas\n\t\t\tthis.$element.css({\n\t\t\t\t'top': 0,\n\t\t\t\t'left': 0,\n\t\t\t\t'transform': 'translate(' + (this.coordinates.x - (this.height / 2)) + 'px, ' + (this.coordinates.y - (this.width / 2)) + 'px)',\n\t\t\t\t'width': this.width + 'px',\n\t\t\t\t'height': this.height + 'px'\n\t\t\t});\n\t\t\t\n\t\t}\n\t}", "render() {\n return this._flux.render(this._flux.state);\n }", "render() {\n\t return this._visibleView === null ? null : this._visibleView.render();\n\t }", "display() {\n if (this.texture == null) {\n return;\n }\n\n this.recTex.bind(1);\n this.scene.setActiveShader(this.shader);\n this.texture.bind();\n this.rectangle.display();\n this.texture.unbind();\n this.scene.setActiveShader(this.scene.defaultShader);\n }", "render() {\r\n this.updateFontSize();\r\n this.actValDiv.innerHTML = this.actValText;\r\n this.buttonElem.innerHTML = this.desValText;\r\n }", "render() {\n this._addChooserHandler();\n this._addLoggerListeners();\n this._addButtonHandler();\n }", "function init() { render(this); }", "render() {\n return (\n <div className=\"border-red\">\n {this.renderContent()}\n </div>\n );\n }", "render() {\n\t\trenderer.render(scene, camera);\n\t}", "render() {\n\t\trenderer.render(scene, camera);\n\t}" ]
[ "0.79888844", "0.77857107", "0.7595934", "0.75242615", "0.7523502", "0.7491365", "0.72410214", "0.72268414", "0.7118406", "0.7088789", "0.7088789", "0.707844", "0.7069973", "0.7069973", "0.706419", "0.70557594", "0.7053476", "0.7050479", "0.70393616", "0.7024166", "0.7024166", "0.7024166", "0.69703424", "0.69642335", "0.6952777", "0.6952777", "0.69461775", "0.6944381", "0.6896067", "0.68945634", "0.68913937", "0.68913937", "0.68913937", "0.6866364", "0.6865167", "0.6831102", "0.6820942", "0.6820742", "0.68197423", "0.6806717", "0.6806717", "0.6802309", "0.6782415", "0.6782415", "0.6777619", "0.67655724", "0.6755895", "0.6750192", "0.67476887", "0.67476887", "0.6692261", "0.6692261", "0.6692261", "0.66816753", "0.66570723", "0.6654798", "0.66535294", "0.6640322", "0.6638771", "0.6635944", "0.6588996", "0.65846014", "0.65607005", "0.6556212", "0.65530497", "0.6547332", "0.65429515", "0.65429515", "0.65429515", "0.65429515", "0.65422386", "0.65382665", "0.6537863", "0.6526408", "0.6515978", "0.6515861", "0.65158033", "0.65105236", "0.6502477", "0.6499107", "0.64935535", "0.64892405", "0.6479816", "0.6477961", "0.6476585", "0.6467547", "0.646516", "0.64618707", "0.6428127", "0.64270186", "0.64235604", "0.6419696", "0.64181817", "0.64173585", "0.64167356", "0.6414118", "0.6404403", "0.64037174", "0.63924557", "0.6386887", "0.6386887" ]
0.0
-1
! Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at THIS CODE IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NONINFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License.
function e(e,t,s,n){return new(s||(s=Promise))((function(i,r){function a(e){try{h(n.next(e))}catch(e){r(e)}}function o(e){try{h(n.throw(e))}catch(e){r(e)}}function h(e){e.done?i(e.value):new s((function(t){t(e.value)})).then(a,o)}h((n=n.apply(e,t||[])).next())}))}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function SBRecordsetPHP_analyzePlatformSpecific()\r\n{\r\n\r\n\r\n}", "function getClientVersion() { return '0.14.4'; }", "_getPageMetadata() {\n return undefined;\n }", "createObjectContext2() {\n console.log('deprecated')\n return C.extension\n }", "function test_crosshair_op_azone_azure() {}", "function assertBase64Available(){if(!PlatformSupport.getPlatform().base64Available){throw new index_esm_FirestoreError(Code.UNIMPLEMENTED,'Blobs are unavailable in Firestore in this environment.');}}", "function version(){ return \"0.13.0\" }", "supportsPlatform() {\n return true;\n }", "function gn() {\n if (!pe.Lt().ia) throw new c(h.UNIMPLEMENTED, \"Blobs are unavailable in Firestore in this environment.\");\n}", "function DataViewer() {\n\n \"use strict\";\n\n}", "function DataViewer() {\n\n \"use strict\";\n\n}", "defaultNodeMsalConfig(options) {\n const clientId = options.clientId || DeveloperSignOnClientId;\n const tenantId = resolveTenantId(options.logger, options.tenantId, options.clientId);\n this.authorityHost = options.authorityHost || process.env.AZURE_AUTHORITY_HOST;\n const authority = getAuthority(tenantId, this.authorityHost);\n this.identityClient = new IdentityClient(Object.assign(Object.assign({}, options.tokenCredentialOptions), { authorityHost: authority, loggingOptions: options.loggingOptions }));\n let clientCapabilities = [\"cp1\"];\n if (process.env.AZURE_IDENTITY_DISABLE_CP1) {\n clientCapabilities = [];\n }\n return {\n auth: {\n clientId,\n authority,\n knownAuthorities: getKnownAuthorities(tenantId, authority),\n clientCapabilities,\n },\n // Cache is defined in this.prepare();\n system: {\n networkClient: this.identityClient,\n loggerOptions: {\n loggerCallback: defaultLoggerCallback(options.logger),\n logLevel: getMSALLogLevel(logger$m.getLogLevel()),\n },\n },\n };\n }", "function _getResponse(){_getResponse=_asyncToGenerator$1(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request,config){var stageOne,response;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return fetch(request);case 3:stageOne=_context2.sent;_context2.next=9;break;case 6:_context2.prev=6;_context2.t0=_context2[\"catch\"](0);return _context2.abrupt(\"return\",createError('Network Error',config,'ERR_NETWORK',request));case 9:response={ok:stageOne.ok,status:stageOne.status,statusText:stageOne.statusText,headers:new Headers(stageOne.headers),// Make a copy of headers\n config:config,request:request};if(!(stageOne.status>=200&&stageOne.status!==204)){_context2.next=34;break;}_context2.t1=config.responseType;_context2.next=_context2.t1==='arraybuffer'?14:_context2.t1==='blob'?18:_context2.t1==='json'?22:_context2.t1==='formData'?26:30;break;case 14:_context2.next=16;return stageOne.arrayBuffer();case 16:response.data=_context2.sent;return _context2.abrupt(\"break\",34);case 18:_context2.next=20;return stageOne.blob();case 20:response.data=_context2.sent;return _context2.abrupt(\"break\",34);case 22:_context2.next=24;return stageOne.json();case 24:response.data=_context2.sent;return _context2.abrupt(\"break\",34);case 26:_context2.next=28;return stageOne.formData();case 28:response.data=_context2.sent;return _context2.abrupt(\"break\",34);case 30:_context2.next=32;return stageOne.text();case 32:response.data=_context2.sent;return _context2.abrupt(\"break\",34);case 34:return _context2.abrupt(\"return\",response);case 35:case\"end\":return _context2.stop();}},_callee2,null,[[0,6]]);}));return _getResponse.apply(this,arguments);}", "headers() {\n throw new Error('Not implemented');\n }", "function vc() {\n if (\"undefined\" == typeof atob) throw new T(E.UNIMPLEMENTED, \"Blobs are unavailable in Firestore in this environment.\");\n}", "private public function m246() {}", "function tokenExchangeMsi() {\n const azureFederatedTokenFilePath = process.env.AZURE_FEDERATED_TOKEN_FILE;\n let azureFederatedTokenFileContent = undefined;\n let cacheDate = undefined;\n // Only reads from the assertion file once every 5 minutes\n async function readAssertion() {\n // Cached assertions expire after 5 minutes\n if (cacheDate !== undefined && Date.now() - cacheDate >= 1000 * 60 * 5) {\n azureFederatedTokenFileContent = undefined;\n }\n if (!azureFederatedTokenFileContent) {\n const file = await readFileAsync$1(azureFederatedTokenFilePath, \"utf8\");\n const value = file.trim();\n if (!value) {\n throw new Error(`No content on the file ${azureFederatedTokenFilePath}, indicated by the environment variable AZURE_FEDERATED_TOKEN_FILE`);\n }\n else {\n azureFederatedTokenFileContent = value;\n cacheDate = Date.now();\n }\n }\n return azureFederatedTokenFileContent;\n }\n return {\n async isAvailable({ clientId }) {\n const env = process.env;\n const result = Boolean((clientId || env.AZURE_CLIENT_ID) && env.AZURE_TENANT_ID && azureFederatedTokenFilePath);\n if (!result) {\n logger$f.info(`${msiName$2}: Unavailable. The environment variables needed are: AZURE_CLIENT_ID (or the client ID sent through the parameters), AZURE_TENANT_ID and AZURE_FEDERATED_TOKEN_FILE`);\n }\n return result;\n },\n async getToken(configuration, getTokenOptions = {}) {\n const { identityClient, scopes, clientId } = configuration;\n logger$f.info(`${msiName$2}: Using the client assertion coming from environment variables.`);\n let assertion;\n try {\n assertion = await readAssertion();\n }\n catch (err) {\n throw new Error(`${msiName$2}: Failed to read ${azureFederatedTokenFilePath}, indicated by the environment variable AZURE_FEDERATED_TOKEN_FILE`);\n }\n const request = coreRestPipeline.createPipelineRequest(Object.assign(Object.assign({ abortSignal: getTokenOptions.abortSignal }, prepareRequestOptions$2(scopes, assertion, clientId || process.env.AZURE_CLIENT_ID)), { \n // Generally, MSI endpoints use the HTTP protocol, without transport layer security (TLS).\n allowInsecureConnection: true }));\n const tokenResponse = await identityClient.sendTokenRequest(request);\n return (tokenResponse && tokenResponse.accessToken) || null;\n },\n };\n}", "function ADC3Test__native_js( context )\n{\n console.log( \"Native test successful.\" );\n}", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "constructor() {\n \n\n \n \n\n \n\n \n }", "function SnpInspectMetadata() \n{\n\n\t/**\n\t The context in which this snippet can run.\n\t @type String\n\t*/\n\tthis.requiredContext = \"Needs to run in Bridge, \\nwith a selection of a file, \\nideally with some metadata\";\t\n}", "function assertUint8ArrayAvailable(){if(typeof Uint8Array==='undefined'){throw new index_esm_FirestoreError(Code.UNIMPLEMENTED,'Uint8Arrays are not available in this environment.');}}", "inspectPlatform() {\n this.inspectedPlatform = true;\n \n var key = process.env.AWS_LAMBDA_LOG_STREAM_NAME;\n if (key != null) {\n this.attributes[\"platform\"] = \"AWS Lambda\";\n this.attributes[\"containerID\"] = key;\n this.attributes[\"functionName\"] = process.env.AWS_LAMBDA_FUNCTION_NAME;\n this.attributes[\"functionMemory\"] = process.env.AWS_LAMBDA_FUNCTION_MEMORY_SIZE;\n this.attributes[\"functionRegion\"] = process.env.AWS_REGION;\n\n var vmID = this.runCommand(\"cat /proc/self/cgroup\");\n var index = vmID.indexOf(\"sandbox-root\");\n this.attributes[\"vmID\"] = vmID.substring(index + 13, index + 19);\n } else {\n key = process.env.X_GOOGLE_FUNCTION_NAME;\n if (key != null) {\n this.attributes[\"platform\"] = \"Google Cloud Functions\";\n this.attributes[\"functionName\"] = key;\n this.attributes[\"functionMemory\"] = process.env.X_GOOGLE_FUNCTION_MEMORY_MB;\n this.attributes[\"functionRegion\"] = process.env.X_GOOGLE_FUNCTION_REGION;\n } else {\n key = process.env.__OW_ACTION_NAME;\n if (key != null) {\n this.attributes[\"platform\"] = \"IBM Cloud Functions\";\n this.attributes[\"functionName\"] = key;\n this.attributes[\"functionRegion\"] = process.env.__OW_API_HOST;\n this.attributes[\"vmID\"] = this.runCommand(\"cat /sys/hypervisor/uuid\").trim();\n } else {\n key = process.env.CONTAINER_NAME;\n if (key != null) {\n this.attributes[\"platform\"] = \"Azure Functions\";\n this.attributes[\"containerID\"] = key;\n this.attributes[\"functionName\"] = process.env.WEBSITE_SITE_NAME;\n this.attributes[\"functionRegion\"] = process.env.Location;\n } else {\n this.attributes[\"platform\"] = \"Unknown Platform\";\n }\n }\n }\n }\n }", "async initialize()\n\t{ \n\t\tthrow new Error(\"initialize() method not implemented\");\n\t}", "function ɵɵnamespaceHTML() {\n _currentNamespace = null;\n}", "function t(e,t,a,s){var i,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,a):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)r=Reflect.decorate(e,t,a,s);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(r=(n<3?i(r):n>3?i(t,a,r):i(t,a))||r);return n>3&&r&&Object.defineProperty(t,a,r),r\n/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */}", "constructor() {\n this.startTime = Date.now();\n this.attributes = {\n \"version\": 0.5, \n \"lang\": \"node.js\",\n \"startTime\": this.startTime\n };\n\n this.inspectedCPU = false;\n this.inspectedMemory = false;\n this.inspectedContainer = false;\n this.inspectedPlatform = false;\n this.inspectedLinux = false;\n }", "function sdk(){\n}", "static get() {\n return (\"snapClinical JS SDK Version: \" + \"1.2.15\" );\n }", "detectRuntime() {\n return __awaiter(this, void 0, void 0, function* () {\n const csProjName = yield tryGetCsprojFile(this.functionAppPath);\n if (!csProjName) {\n throw new Error(localize_1.localize('csprojNotFound', 'Expected to find a single \"csproj\" file in folder \"{0}\", but found zero or multiple instead.', path.basename(this.functionAppPath)));\n }\n const csprojPath = path.join(this.functionAppPath, csProjName);\n const csprojContents = (yield fse.readFile(csprojPath)).toString();\n yield this.validateFuncSdkVersion(csprojPath, csprojContents);\n const matches = csprojContents.match(/<TargetFramework>(.*)<\\/TargetFramework>/);\n if (matches === null || matches.length < 1) {\n throw new Error(localize_1.localize('unrecognizedTargetFramework', 'Unrecognized target framework in project file \"{0}\".', csProjName));\n }\n else {\n const targetFramework = matches[1];\n this.telemetryProperties.cSharpTargetFramework = targetFramework;\n if (targetFramework.startsWith('netstandard')) {\n this._runtime = constants_1.ProjectRuntime.v2;\n }\n else {\n this._runtime = constants_1.ProjectRuntime.v1;\n const settingKey = 'show64BitWarning';\n if (ProjectSettings_1.getFuncExtensionSetting(settingKey)) {\n const message = localize_1.localize('64BitWarning', 'In order to debug .NET Framework functions in VS Code, you must install a 64-bit version of the Azure Functions Core Tools.');\n try {\n const result = yield this.ui.showWarningMessage(message, vscode_azureextensionui_1.DialogResponses.learnMore, vscode_azureextensionui_1.DialogResponses.dontWarnAgain);\n if (result === vscode_azureextensionui_1.DialogResponses.learnMore) {\n yield opn('https://aka.ms/azFunc64bit');\n }\n else if (result === vscode_azureextensionui_1.DialogResponses.dontWarnAgain) {\n yield ProjectSettings_1.updateGlobalSetting(settingKey, false);\n }\n }\n catch (err) {\n // swallow cancellations (aka if they clicked the 'x' button to dismiss the warning) and proceed to create project\n if (!vscode_azureextensionui_1.parseError(err).isUserCancelledError) {\n throw err;\n }\n }\n }\n }\n this.deploySubpath = `bin/Release/${targetFramework}/publish`;\n this._debugSubpath = `bin/Debug/${targetFramework}`;\n }\n this._hasDetectedRuntime = true;\n });\n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "constructor() {\n \n }", "function Ec() {\n if (\"undefined\" == typeof atob) throw new G(j.UNIMPLEMENTED, \"Blobs are unavailable in Firestore in this environment.\");\n}", "getHeader() {\n return `/**\n * IN2 Logic Tree File\n *\n * This file has been generated by an IN2 compiler.\n */\\n/*eslint-disable-line*/function run(isDryRun){\\n/* global player, core, engine */\nconst files = {};\nconst scope = {};\nconst CURRENT_NODE_VAR = '${CURRENT_NODE_VAR}';\nconst CURRENT_FILE_VAR = '${CURRENT_FILE_VAR}';\nconst LAST_FILE_VAR = '${LAST_FILE_VAR}';`;\n }", "function emptyByteString(){return PlatformSupport.getPlatform().emptyByteString;}/**\r\n * Copyright 2017 Google Inc.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */// TODO(mcg): Change to a string enum once we've upgraded to typescript 2.4.", "function ɵɵnamespaceHTML() {\n namespaceHTMLInternal();\n}", "function Ic() {\n if (\"undefined\" == typeof atob) throw new q(M.UNIMPLEMENTED, \"Blobs are unavailable in Firestore in this environment.\");\n}", "function tt() {\n if (\"undefined\" == typeof atob) throw new c(a.UNIMPLEMENTED, \"Blobs are unavailable in Firestore in this environment.\");\n}", "function S(){null===_featureset_support_cache_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"].applicationCache&&(_featureset_support_cache_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"].applicationCache=new _featureset_support_cache_js__WEBPACK_IMPORTED_MODULE_11__[\"default\"])}", "function APIcompatible(){\n return (window.File && window.FileReader && window.FileList && window.Blob);\n }", "function ɵɵnamespaceHTML() {\n namespaceHTMLInternal();\n}", "function ɵɵnamespaceHTML() {\n namespaceHTMLInternal();\n}", "function ɵɵnamespaceHTML() {\n namespaceHTMLInternal();\n}", "function ɵɵnamespaceHTML() {\n namespaceHTMLInternal();\n}", "function ɵɵnamespaceHTML() {\n namespaceHTMLInternal();\n}", "function ɵɵnamespaceHTML() {\n namespaceHTMLInternal();\n}", "function M() {\n if (\"undefined\" == typeof atob) throw new P(R.UNIMPLEMENTED, \"Blobs are unavailable in Firestore in this environment.\");\n}", "function cov_2fpze8ad7p(){var path=\"/Users/federicolacabaratz/bootcamp/collab/skylab-bootcamp-202001/staff/federico-lacabaratz/share-my-spot/share-my-spot-api/logic/save-spot-photo.spec.js\";var hash=\"6075a72b2a405bb8817f93427c26829ae2e7ed0d\";var global=new Function(\"return this\")();var gcv=\"__coverage__\";var coverageData={path:\"/Users/federicolacabaratz/bootcamp/collab/skylab-bootcamp-202001/staff/federico-lacabaratz/share-my-spot/share-my-spot-api/logic/save-spot-photo.spec.js\",statementMap:{},fnMap:{},branchMap:{},s:{},f:{},b:{},_coverageSchema:\"1a1c01bbd47fc00a2c39e90264f33305004495a9\",hash:\"6075a72b2a405bb8817f93427c26829ae2e7ed0d\"};var coverage=global[gcv]||(global[gcv]={});if(!coverage[path]||coverage[path].hash!==hash){coverage[path]=coverageData;}var actualCoverage=coverage[path];cov_2fpze8ad7p=function(){return actualCoverage;};return actualCoverage;}" ]
[ "0.5057278", "0.5027019", "0.4967857", "0.49631536", "0.4953607", "0.4946838", "0.4899115", "0.48889872", "0.48588374", "0.48144326", "0.48144326", "0.47849244", "0.475549", "0.4749384", "0.47311443", "0.47307473", "0.47276986", "0.47170758", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.47090656", "0.46811566", "0.46705332", "0.46570757", "0.4616156", "0.46101695", "0.46049047", "0.45990136", "0.45989737", "0.458465", "0.45746058", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.45726508", "0.4566125", "0.4539156", "0.45375475", "0.45368952", "0.45250773", "0.4524852", "0.45247683", "0.45187682", "0.45144445", "0.45144445", "0.45144445", "0.45144445", "0.45144445", "0.45144445", "0.44962138", "0.44891644" ]
0.0
-1
Draws the pipe on the canvas
draw(index) { fill(pipeColors[3 * this.status], pipeColors[3 * this.status + 1], pipeColors[3 * this.status + 2]); rect(index * pipesWidth + index * pipesWidth / (pipesAmount + 1), canvasHeight - this.height - (2 * minPipeHeight), pipesWidth, this.height + minPipeHeight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw() {\n \n // Clear the canvas\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n \n addIfPipeNeeded();\n\n // Check for collisions\n collisionDetection();\n \n for (var i = 0; i < pipes.length ; i++) {\n var pipe = pipes[i];\n pipe.move();\n drawcomponent(pipe);\n }\n// \n // Move stuff\n bird.move();\n \n \n // Draw everything\n \n bird.draw();\n}", "function draw() {\n // Clear the canvas\n clear();\n // Draw all pipes\n for (let i = 0; i < pipes.length; i++) pipes[i].draw(i);\n // If (60 / fps) frames have passed\n if (frameCounter++ > 60 / fps) {\n frameCounter %= 60 / fps;\n // Call the next animation and increment the animationIndex if it returns true or else decrement\n if (animations[animationIndex]()) animationIndex = (animationIndex + 1) % animations.length;\n else animationIndex--;\n if (focusedPipeIndex === pipesAmount) noLoop();\n }\n}", "function renderCanvas()\n {\n if (drawing)\n {\n context.moveTo(lastPos.x, lastPos.y);\n context.lineTo(mousePos.x, mousePos.y);\n context.stroke();\n lastPos = mousePos;\n }\n }", "drawBottomPipe() {\n\n // Draw the bottom pipe\n paint.fillStyle = this.color;\n paint.fillRect(this.x, this.y, this.width, this.height);\n\n }", "function renderCanvas() {\n if (drawing) {\n ctx.moveTo(lastPos.x, lastPos.y);\n ctx.lineTo(mousePos.x, mousePos.y);\n ctx.stroke();\n lastPos = mousePos;\n }\n }", "function renderCanvas() {\n\t\tif (drawing) {\n\t\t\tctx.moveTo(lastPos.x, lastPos.y);\n\t\t\tctx.lineTo(mousePos.x, mousePos.y);\n\t\t\tctx.stroke();\n\t\t\tlastPos = mousePos;\n\t\t}\n\t}", "function renderCanvas() {\n\t\tif (drawing) {\n\t\t\tctx.moveTo(lastPos.x, lastPos.y);\n\t\t\tctx.lineTo(mousePos.x, mousePos.y);\n\t\t\tctx.stroke();\n\t\t\tlastPos = mousePos;\n\t\t}\n\t}", "function renderCanvas() {\n\t\tif (drawing) {\n\t\t\tctx.moveTo(lastPos.x, lastPos.y);\n\t\t\tctx.lineTo(mousePos.x, mousePos.y);\n\t\t\tctx.stroke();\n\t\t\tlastPos = mousePos;\n\t\t}\n\t}", "function renderCanvas() {\n\t\tif (drawing) {\n\t\t\tctx.moveTo(lastPos.x, lastPos.y);\n\t\t\tctx.lineTo(mousePos.x, mousePos.y);\n\t\t\tctx.stroke();\n\t\t\tlastPos = mousePos;\n\t\t}\n\t}", "function renderCanvas() {\n if (drawing) {\n ctx.moveTo(lastPos.x, lastPos.y);\n ctx.lineTo(mousePos.x, mousePos.y);\n ctx.stroke();\n lastPos = mousePos;\n }\n }", "function renderCanvas() {\n if (drawing) {\n ctx.moveTo(lastPos.x, lastPos.y);\n ctx.lineTo(mousePos.x, mousePos.y);\n ctx.stroke();\n lastPos = mousePos;\n }\n }", "function renderCanvas() {\n if (drawing) {\n ctx.beginPath();\n ctx.moveTo(lastPos.x, lastPos.y);\n ctx.lineTo(mousePos.x, mousePos.y);\n ctx.closePath();\n ctx.stroke();\n\n lastPos = mousePos;\n }\n}", "draw() {\n this.checkContext();\n this.setRendered();\n if (this.unbeamable) return;\n\n if (!this.postFormatted) {\n this.postFormat();\n }\n\n this.drawStems();\n this.applyStyle();\n this.drawBeamLines();\n this.restoreStyle();\n }", "draw() {\n // always draw our ping pong planes first!\n this.drawPingPongStack();\n\n // enable first frame buffer for shader passes if needed\n this.enableShaderPass();\n\n // our planes that are drawn onto a render target\n this.drawStack(\"renderTargets\");\n\n // then draw the content of our render targets render passes\n this.drawRenderPasses();\n\n // disable blending for the opaque planes\n this.renderer.setBlending(false);\n\n // loop on our stacked planes\n this.drawStack(\"opaque\");\n\n // set blending and draw transparents planes only if we have some\n if(this.stacks.transparent.length) {\n this.renderer.setBlending(true);\n\n // draw the transparent planes\n this.drawStack(\"transparent\");\n }\n\n // now draw the render targets scene passes\n this.drawScenePasses();\n }", "function Pipe(y, height){\n this.x = canvas.width - 10;// para poder verlas \n this.y = y;\n this.width = 50;\n this.height = height;\n this.draw = function(){\n this.x --;\n ctx.fillStyle=\"green\";\n ctx.fillRect(this.x,this.y,this.width,this.height);\n }\n }", "_draw () {\r\n\t\tthis.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\r\n\r\n\t\tthis.particles.forEach(particle => {\r\n\t\t\tparticle.draw(this.context);\r\n\t\t});\r\n\t}", "function draw(){\n ctx.drawImage(bg,0,0);\n for(var i = 0; i < pipe.length; i++){\n // gambar pipeSouth pada kanvas dengan dimulai dari titik ordinat (x, y)\n // e.g\n ctx.drawImage(pipeNorth,pipe[i].x,pipe[i].y);\n // gunakan variable constant untuk mengambil tinggi pipeNorth ditambah gap\n // gambar pipeSouth pada kanvas dengan dimulai dari titik ordinat (x, y+contant)\n constant = pipeNorth.height+gap;\n ctx.drawImage(pipeSouth,pipe[i].x,pipe[i].y+constant);\n\n // pada setiap kali animasi, e.g\n pipe[i].x--;\n // jika pipa mendekati aksis(x) 100,\n // maka push pipe baru dengan x di ujung canvas menggunakan acuan lebar kanvas\n // dan y menggunakan pembulatan angka random (0sampai1) dikalikan tinggi pipeNorth yang kemudian dikurangi tinggi pipeNorth\n // posisi y menentukan posisi awal pipeNorth\n if( pipe[i].x == 125 ){\n pipe.push({\n x : cvs.width,\n y : Math.floor(Math.random()*pipeNorth.height)-pipeNorth.height\n });\n }\n\n // JIKA\n // \n // tabrak pipa\n // bX ditambah lebar karakter lebih besar atau sama dengan aksis pipe &&\n // \n // bX lebih kecil atau sama dengan aksis pipe ditambah dengan lebar northPipe &&\n // tabrak atas bawah\n // bY lebih kecil atau sama dengan ordinat pipe ditambah dengan tinggi northPipe || bY lebih besar atau sama dengan ordinat pipe ditambah nilai constant yang dibuat\n // \n // tabrak tanah\n // atau kondisi terakhir, ordinat karakter ditambah tinggi karakter lebih besar daripada tinggi canvas dikurangi tinggi fg\n if( bX + bird.width >= pipe[i].x && bX <= pipe[i].x + pipeNorth.width && (bY <= pipe[i].y + pipeNorth.height || bY+bird.height >= pipe[i].y+constant) || bY + bird.height >= cvs.height - fg.height){\n // apabila salah satu kondisi di atas tercapai, brarti game harus direload\n // location.reload(); // reload the page\n }\n\n // jika aksis dari pipe mencapai nilai 5, maka skor bertambah\n if(pipe[i].x == 5){\n score++;\n scor.play();\n }\n }\n // gambar ground di kanvas dengan menggunakan gambar fg yang telah disediakan, dengan koordinat (0, mulai dari tinggi kanvas dikurangi tinggi fg), ingat perhitungan drawImage adalah dari kiri atas\n // https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/height\n // gambar objek karakter dengan menggunakan file bird yang telah disediakan dengan posisi awal menggunakan koordinat (bX, bY)\n ctx.drawImage(fg,0,cvs.height - fg.height);\n ctx.drawImage(bird,bX,bY);\n // pada setiap animasi, posisi ordinat bertambah sesuai gravity\n // bY += gravity;\n\n // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle\n ctx.fillStyle = \"#000\";\n // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/font\n ctx.font = \"20px Verdana\";\n // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillText\n ctx.fillText(\"Score : \"+score,10,cvs.height-20);\n requestAnimationFrame(draw);\n}", "function draw() {\n\t// Redraw the background color\n\tbackground(17, 17, 17, 150)\n\t\n\t// loop through the streams array and render all streams\n\tstreams.forEach(function(stream) {\n\t\tstream.render()\n\t})\n}", "draw() {\n //draw the pen trace\n let colour = colourPicker.selectedColour;\n let p5Colour = p5Instance.color(colour.r, colour.g, colour.b, colour.a);\n this.command.context.chain.stroke(p5Colour);\n super.draw();\n\n this.command.context.chain.push();\n\n //draw the mouse pointer\n this.command.context.chain.strokeWeight(1);\n this.command.context.chain.circle(\n this.command.context.chain.mouseX,\n this.command.context.chain.mouseY,\n this.command.thickness,\n );\n this.command.context.chain.pop();\n }", "render() {\n this.ctx.save();\n this.ctx.strokeStyle = this.penColor;\n this.ctx.lineWidth = this.size;\n this.ctx.lineCap = \"round\";\n const [first, ...rest] = this.points;\n this.ctx.beginPath();\n this.ctx.moveTo(first.x, first.y);\n rest.forEach((point) => this.ctx.lineTo(point.x, point.y));\n this.ctx.stroke();\n this.ctx.restore();\n }", "function draw(){\n\t\t// Needed to comply with Tool Delegate design pattern\n\t}", "Draw(){\n\t\tthis.context.beginPath();\n\t\tthis.context.fillRect(this.posX, this.posY, this.width, this.height);\n\t\tthis.context.closePath();\n }", "draw(){\n\t\t\n\t\tlet height = this.height; //100\n\t\tlet width = this.width; //100\n\t\t\n\t\tlet ctx = this.ctx;\n\t\t//save last frame\n\t\tlet lastFrame = ctx.getImageData(0, 0, width, height);\n\t\t//clear canvas\n\t\tctx.clearRect(0, 0, width, height);\n\t\t//now, move frame 1 pixel to the left\n\t\tctx.putImageData(lastFrame, -1, 0);\n\t\t\n\t\t//then, draw the lines\n\t\tfor(var line of this.lines){\n\t\t\t\n\t\t\t\n\t\t\tlet range = line.maxValue - line.minValue;\n\t\t\tlet value = line.value;\n\t\t\t\n\t\t\t//Multiply line's value by the ratio between height and range, to get effective range the same but zero at the top\n\t\t\tvalue *= 1 * height / range;\n\t\t\t\n\t\t\t//Now, zero the value by adding the difference between minValue and 0\n\t\t\tvalue -= line.minValue * height / range;\n\t\t\t\n\t\t\t//Now, invert by subtracting from height\n\t\t\tvalue = height - value;\n\t\t\t\n\t\t\tctx.beginPath();\n\t\t\tctx.strokeStyle = line.color;\n\t\t\tctx.moveTo(width - 2, value);\n\t\t\tctx.lineTo(width, value);\n\t\t\tctx.stroke();\n\t\t}\n\t}", "function makePipe(lowRectX, lowRectY, lowRectWid, lowRectHeight, upRectX, upRectY, upRectWid, upRectHeight){ //This function will create the pipes based on it's parameters.\n ctx.clearRect(0, 0, c.width, c.height); //Clears the canvas every frame.\n for (var i = 0; i < rectArray.length; i++) {\n ctx.beginPath();\n ctx.rect(rectArray[i].xPosL, rectArray[i].yPosL, rectArray[i].widthL, rectArray[i].heightL); // draws the base of the bottom pipe.\n ctx.fillStyle = \"green\"; //These set the color of the pipes to green.\n ctx.fill();\n ctx.stroke();\n ctx.beginPath();\n ctx.rect(rectArray[i].xPosL-15, rectArray[i].yPosL, rectArray[i].widthL+30, 40); //draws the top of the bottom pipe.\n ctx.fillStyle = \"green\";\n ctx.fill();\n ctx.stroke();\n ctx.beginPath();\n ctx.rect(rectArray[i].xPosU, rectArray[i].yPosU, rectArray[i].widthU, rectArray[i].heightU); //draws the base of the top pipe.\n ctx.fillStyle = \"green\";\n ctx.fill();\n ctx.stroke();\n ctx.beginPath();\n ctx.rect(rectArray[i].xPosU-15, rectArray[i].heightU-40, rectArray[i].widthU+30, 40); //Will draw the top of the top pipe.\n ctx.fillStyle = \"green\";\n ctx.fill();\n ctx.stroke();\n }\n}", "draw() {\r\n this.ctx.save()\r\n this.ctx.translate(this.x + (this.pSize / 2), this.y + (this.pSize / 2))\r\n this.ctx.rotate(this.angle)\r\n this.ctx.translate(-(this.x + (this.pSize / 2)), -(this.y + (this.pSize / 2)))\r\n this.ctx.drawImage(this.pl1, this.x, this.y, this.pSize, this.pSize)\r\n this.ctx.rotate(this.angle)\r\n this.ctx.restore()\r\n }", "draw() {\n\t\tlet width = 30;\n\n\t\tinfo.context.beginPath();\n\t\tinfo.context.moveTo(this.position.x - width/2, this.position.y + width/2);\n\t\tinfo.context.lineTo(this.position.x + width/2, this.position.y + width/2);\n\t\tinfo.context.lineTo(this.position.x, this.position.y - width/2);\n\t\tinfo.context.closePath();\n\t\tinfo.context.fillStyle = this.color;\n\t\tinfo.context.fill();\n\t}", "draw() {\n if (this.dirty) {\n // Update pixels if any changes were made\n this.buffer.updatePixels();\n this.dirty = false;\n }\n\n background(230, 250, 250);\n image(this.buffer, 0, 0, width, height);\n\n // Draw all the collideable objects too\n for (let c of this.colliders) {\n c.draw();\n }\n }", "render() {\n this.context.drawImage(this.buffer.canvas,\n 0, 0,\n this.buffer.canvas.width,\n this.buffer.canvas.height,\n 0, 0,\n this.context.canvas.width,\n this.context.canvas.height);\n }", "draw() {\n let anchorWidth = -this.width * this.anchor.x;\n let anchorHeight = -this.height * this.anchor.y;\n\n this.context.save();\n this.context.translate(this.x, this.y);\n\n if (this.rotation) {\n this.context.rotate(this.rotation);\n }\n\n if (this.image) {\n this.context.drawImage(\n this.image,\n 0, 0, this.image.width, this.image.height,\n anchorWidth, anchorHeight, this.width, this.height\n );\n }\n else if (this.currentAnimation) {\n this.currentAnimation.render({\n x: anchorWidth,\n y: anchorHeight,\n width: this.width,\n height: this.height,\n context: this.context\n });\n }\n else {\n this.context.fillStyle = this.color;\n this.context.fillRect(anchorWidth, anchorHeight, this.width, this.height);\n }\n\n this.context.restore();\n }", "draw() {\n\t\tnoStroke();\n\t\tfill(\"rgba(255, 255, 255, 0.1)\");\n\t\tcircle(this.pos.x, this.pos.y, this.size);\n\t}", "draw() {\n\t\tlet width = 30;\n\n\t\tinfo.context.beginPath();\n\t\tinfo.context.rect(this.position.x - width/2, this.position.y - width/2, width, width);\n\t\tinfo.context.fillStyle = this.color;\n\t\tinfo.context.fill();\n\t}", "Draw()\n\t{\n\t\t// Clear the canvas, optimize later if enough brain\n\t\tthis.ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight);\n\n\t\t// Draw everything\n\t\tfor(var i = 0; i < this.CanvasComponentCollection.orderedCollection.length; i++)\n\t\t{\n\t\t\tthis.CanvasComponentCollection.orderedCollection[i].Draw();\n\t\t}\n\t}", "draw() {\r\n this.ctx.save()\r\n this.ctx.translate(this.x + (this.pSize / 2), this.y + (this.pSize / 2))\r\n this.ctx.rotate(this.angle)\r\n this.ctx.translate(-(this.x + (this.pSize / 2)), -(this.y + (this.pSize / 2)))\r\n this.ctx.drawImage(this.pl2, this.x, this.y, this.pSize, this.pSize)\r\n this.ctx.rotate(this.angle)\r\n this.ctx.restore()\r\n }", "draw() {\n // enable first frame buffer for shader passes if needed\n this.enableShaderPass();\n\n // loop on our stacked planes\n this.drawStack(\"opaque\");\n\n // draw transparent planes if needed\n if(this.stacks[\"transparent\"].length) {\n // clear our depth buffer to display transparent objects\n this.gl.clearDepth(1.0);\n this.gl.clear(this.gl.DEPTH_BUFFER_BIT);\n\n this.drawStack(\"transparent\");\n }\n\n // now render the shader passes\n this.drawShaderPasses();\n }", "draw() {\n\t\tnoStroke();\n\t\tfill('rgba(255,255,255,0.5)');\n\t\tcircle(this.pos.x, this.pos.y, this.size);\n\t}", "function drawCanvas() {\n\t\tdraw(context, drawer, colours, solver);\n\t\tsolver.callStateForItem(spanState);\n\t}", "render() {\n this.context.drawImage(this.buffer.canvas, 0, 0, this.buffer.canvas.width, this.buffer.canvas.height, 0, 0, this.context.canvas.width, this.context.canvas.height);\n }", "function draw() {\r\n\r\n //Background color.\r\n background(189, 253, 255);\r\n\r\n //This updates the Matter Engine.\r\n Engine.update(engine);\r\n\r\n //To display the platform.\r\n surface.display();\r\n\r\n //To display bricks.\r\n\r\n }", "draw() {\n this.setSize();\n this.setSizeBounds();\n this.move();\n this.coordinates = getPlaneCoordinates(this);\n this.setOut();\n }", "render() {\n ctx.beginPath();\n ctx.fillStyle = \"red\";\n ctx.drawImage(AMMO_IMAGE,((laneWidth - this.width) / 2 ) + laneWidth * (this.currentLane - 1), this.y , this.width, this.height )\n ctx.closePath();\n }", "draw() {\n this._drawLines(this.linesData);\n this._drawLines(this.linesAux);\n this._drawThickLines();\n this._drawSurfaces(this.surfaces);\n }", "draw(){\n this.ctx.strokeStyle = this.getStrokeColor();\n this.ctx.lineWidth = 2;\n this.ctx.beginPath()\n this.ctx.moveTo(this.prevx, this.prevy);\n this.ctx.lineTo(this.x, this.y)\n this.ctx.stroke()\n this.ctx.fill();\n }", "draw() {\n noStroke();\n if (this.color) {\n fill(this.color.x, this.color.y, this.color.z);\n } else {\n fill(0);\n }\n rect(this.pos.x, this.pos.y, this.w, this.h);\n }", "render() {\n noFill()\n stroke(this.layerColor)\n strokeWeight(this.randomWeight)\n push()\n translate(width / 2, height / 2)\n\n for (let i = 0; i < this.linesNumShapes; i++) {\n line(this.start * this.step, 0, (this.stop + 1) * this.step, 0)\n rotate(this.linesAngle)\n }\n\n pop()\n }", "function draw(patt) {\n\n $canvas.drawRect({\n layer: true,\n fillStyle: patt,\n x: x,\n y: y,\n width: width,\n height: height\n });\n }", "draw() {\n\n this.drawInteractionArea();\n\n //somewhat depreciated - we only really draw the curve interaction but this isnt hurting anyone\n if(lineInteraction)\n this.drawLine();\n else\n this.drawCurve();\n\n this.drawWatch(); \n\n }", "draw() {\n\t\t\tc.beginPath();\n\t\t\tc.fillStyle = this.color;\n\t\t\tc.fillRect(\n\t\t\t this.x - width / 2,\n\t\t\t this.y - height / 2,\n\t\t\t\twidth,\n\t\t\t\theight\n\t\t\t);\n\t\t\tc.closePath();\n\t\t }", "display() {\n strokeWeight(1);\n stroke(200);\n fill(200);\n beginShape();\n for (let i = 0; i < this.surface.length; i++) {\n let v = scaleToPixels(this.surface[i]);\n vertex(v.x, v.y);\n }\n vertex(width, height);\n vertex(0, height);\n endShape(CLOSE);\n }", "function draw() {\n const dim = Math.min(width, height);\n\n // Instead of drawing black, we draw with\n // transparent black to give a 'ghosting' effect\n const opacity = 0.085;\n background(0, 0, 0, opacity * 255);\n\n // If we have a mouse position, draw it\n if (mouse) {\n noFill();\n stroke(255);\n strokeWeight(dim * 0.01);\n circle(mouse[0], mouse[1], dim * 0.2);\n\n // Clear position so we stop drawing it,\n // this will make it fade away\n mouse = null;\n }\n\n // Draw a 'play' button\n noStroke();\n fill(255);\n polygon(width / 2, height / 2, dim * 0.1, 3);\n}", "render() {\n this.ctx.clearRect(0, 0, this.pad.width, this.pad.height);\n this.paths.forEach((path) => path.render());\n }", "function render() {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n for (let i=0; i<particles.length; i++) {\n const p = particles[i];\n\n const x = p.x + ((((canvas.width / 2) - mouse.x) * p.s) * 0.1);\n const y = p.y + ((((canvas.height / 2) - mouse.y) * p.s) * 0.1);\n\n ctx.fillStyle = '#fff';\n ctx.beginPath();\n ctx.fillRect(x, y, p.s, p.s);\n ctx.closePath();\n }\n }", "canvasDraw() {\n let prev = this.p0;\n for (const point of this.points) {\n Point.drawLine(prev, point, false, this.isSelected, this.color);\n prev = point;\n }\n Point.drawLine(prev, this.p3);\n Point.drawLine(this.p0, this.p1, true);\n Point.drawLine(this.p2, this.p3, true);\n this.p0.draw();\n this.p1.draw();\n this.p2.draw();\n this.p3.draw();\n }", "render(ctx, width, height) {\n ctx.beginPath();\n ctx.rect(0, 0, width, height);\n ctx.closePath();\n ctx.lineWidth = 2; //since this line is on the border, only 1px actually gets drawn\n ctx.strokeStyle = \"#ffffff\";\n ctx.stroke();\n\n this.guiManager.render(ctx, width, height);\n }", "paint() {\r\n graphics.fillStyle = \"#ff1a1a\";\r\n graphics.beginPath();\r\n graphics.moveTo(this.x, this.y + this.h / 2);\r\n graphics.lineTo(this.x + this.w / 2, this.y - this.h / 2);\r\n graphics.lineTo(this.x - this.w / 2, this.y - this.h / 2);\r\n graphics.closePath();\r\n graphics.fill();\r\n }", "function drawCanvas() {\n if( drawio.loadedIMG != ''){\n drawio.ctx.drawImage(drawio.loadedIMG, 0, 0);\n }\n for( var i = 0; i < drawio.shapes.length; i++) {\n drawio.shapes[i].render();\n }\n if(drawio.selectedElement) {\n drawio.selectedElement.render();\n }\n }", "draw() {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n // display problem\n this.drawProblem()\n // display input field\n if (this.input) {\n this.input._value = ''\n }\n \n this.drawInputField()\n\n // draw attacks\n this.attacks.draw(this.ctx, this.attackIndex)\n\n // draw player data\n this.player.drawPlayerData(this.ctx)\n // draw computer data\n this.computer.drawComputerData(this.ctx)\n \n }", "function render() {\n\tclearCanvas();\n\tRenderer.draw();\n\t\n\t\t\n}", "function Draw(self){\n self.viewport.clearRect(0,0,self.viewport.canvas.width, self.viewport.canvas.height); //do not edit this line\n /********************************/\n /**PUT YOUR DRAWING CODE BELOW**/\n /*******************************/\n self.viewport.fillStyle = \"rgb(200,150,150)\"; //background fill color - change or remove this if you want\n //fill background - change or remove the line below if you want\n self.viewport.fillRect(0,0,self.viewport.canvas.width,self.viewport.canvas.height);\n\n\n /******************************/\n /**END YOUR DRAWING CODE HERE**/\n /******************************/\n var pancake = self.backbuffer.flatten(); //flattening the backbuffer, don't edit this line\n self.viewport.drawImage(pancake.canvas,0,0); //draw the \"pancake\" to the viewport - do not edit this line\n self.backbuffer.flush();\n}", "draw(){\r\n //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n // Compute Position\r\n const thumb_h = 16;\r\n const thumb_w = 15;\r\n const track_h = 10;\r\n const on_color = \"#c8cad0\";\r\n\r\n\t\tlet p = this.pos;\r\n let h = this.height * 0.5;\r\n let h0 = h - thumb_h;\r\n let h1 = h + thumb_h;\r\n\r\n if( p < this.x_min + thumb_w ) p = this.x_min + thumb_w;\r\n if( p > this.x_max - thumb_w ) p = this.x_max - thumb_w;\r\n\r\n //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n // Drawing\r\n this.ctx.clearRect( 0, 0, this.width, this.height );\r\n \r\n // Draw Track\r\n this.draw_line( this.x_min, h, this.x_max, h, track_h, \"gray\", \"round\" );\r\n this.draw_line( this.x_min, h, p, h, track_h, on_color, \"round\" );\r\n\r\n // Draw Thumbs\r\n this.draw_line( p-thumb_w, h, p+thumb_w, h, thumb_h, on_color, \"round\", true );\r\n this.draw_text( this.value.toFixed(2), p, h, -1, \"black\" );\r\n }", "drawPath() {\n this.ctx.stroke();\n this.begin();\n }", "drawCanvas() {\n\n\t}", "render() {\n stroke(this.layerColor)\n noFill()\n strokeWeight(this.weight)\n\n push()\n translate(width / 2, height / 2)\n for (let i = 1; i < this.numSteps + 1; i++) {\n ellipse(0, 0, this.centerOffset + (i * this.singleStep), this.centerOffset + (i * this.singleStep))\n }\n\n pop()\n }", "render() {\n //draw the board\n this.ctx.fillStyle = '#FD8844';\n this.ctx.fillRect(0, 0, this.ctx.canvas.clientWidth, this.ctx.canvas.clientHeight);\n\n //draw the line\n this.ctx.beginPath();\n this.ctx.moveTo(this.ctx.canvas.clientWidth/2, 0);\n this.ctx.lineTo(this.ctx.canvas.clientWidth/2, this.ctx.canvas.clientHeight);\n this.ctx.strokeStyle = 'white';\n this.ctx.stroke();\n }", "function renderCanvas2() {\n\n if (drawing) {\n ctx.moveTo(lastPos.x, lastPos.y);\n ctx.lineTo(mousePos.x, mousePos.y);\n ctx.stroke();\n lastPos = mousePos;\n }\n}", "draw(ctx){\n saveMatrix();\n ctx.save();\n translate(0,0);\n\n if (this.extended) {\n this.dockPointsReq.forEach((value) => {\n value.draw(ctx);\n });\n this.dockPointsDev.forEach((value) => {\n value.draw(ctx);\n });\n }\n\n ctx.strokeRect(this.x,this.y+this.margin_top,this.width,this.height);\n restoreMatrix();\n ctx.restore();\n }", "_render() {\n\t\tif (this.ctx) {\n\t\t\tthis.ctx.fillStyle = this._settings.append_to.css('color');\n\t\t\tthis.ctx.beginPath();\n\t\t\tthis.ctx.arc(this.coordinates.x, this.coordinates.y, this.size, 0, 2 * Math.PI);\n\t\t\tthis.ctx.closePath();\n\t\t\tthis.ctx.fill()\n\t\t} else if (this.$element) {\n\t\t\t// TODO: look into rendering to a canvas\n\t\t\tthis.$element.css({\n\t\t\t\t'top': 0,\n\t\t\t\t'left': 0,\n\t\t\t\t'transform': 'translate(' + (this.coordinates.x - (this.height / 2)) + 'px, ' + (this.coordinates.y - (this.width / 2)) + 'px)',\n\t\t\t\t'width': this.width + 'px',\n\t\t\t\t'height': this.height + 'px'\n\t\t\t});\n\t\t\t\n\t\t}\n\t}", "drawBuffer(){\r\n this.context.drawImage(this.buffer, 0, 0);\r\n }", "draw() { \r\n // Make sure the canvas has been prepared\r\n if (!this._setup) {\r\n this.prepare();\r\n }\r\n \r\n // Get the drawing context\r\n let ctx = this._canvas.getContext(\"2d\");\r\n \r\n // Clear the canvas by displaying only the background color\r\n ctx.fillStyle = this._background;\r\n ctx.fillRect(0, 0, this._width, this._height);\r\n \r\n // Loop through all of the shapes, asking them to draw theirselves\r\n // on the drawing context\r\n this._shapes.forEach(s => s.draw(ctx));\r\n }", "renderCanvas() {\n /**\n * @type {p5.Vector} mouse\n */\n let mouse = this.p.createVector(this.p.mouseX - this.position.x, this.p.mouseY - this.position.y);\n mouse.x = Math.floor(mouse.x / this.cellSize) * this.cellSize;\n mouse.y = Math.floor(mouse.y / this.cellSize) * this.cellSize;\n\n this.canvas.image(this.gridCanvas, 0, 0);\n this.canvas.fill(255, 120, 0, 120);\n this.canvas.rect(mouse.x, mouse.y, this.cellSize, this.cellSize);\n\n this.canvasUpdateRequired = false;\n }", "draw() {\n // drawing curbs first\n const shades = ['#9ca297', '#b1bab0'];\n for (let i = 0; i < 2; i++) {\n ctx.fillStyle = shades[i];\n // curbs just big rects mildly translated so some shading\n if (i) {\n ctx.translate(0, 3.3);\n }\n ctx.fillRect(0, this.y - (this.linH / 3) * 1.5, init.w, inProptn(1, 7) + (this.linH / 3) * (3 - i * 1.5));\n }\n ctx.translate(0, -3.3);\n\n // road itself\n ctx.fillStyle = 'black';\n ctx.fillRect(0, this.y, init.w, inProptn(1, 7));\n\n this.markings();\n }", "render() {\n render(offscreenCanvas);\n }", "function render() {\n copyPixels(mouseX, mouseY);\n outputContext.putImageData(outputImageData, 0, 0);\n}", "draw(context) {\n //TO-DO\n }", "function drawCanvas() {\n\t\tdrawing(context, drawer, colours, solver, selectedSpacesGrid);\n\t\tsolver.callStateForItem(spanState);\n\t}", "draw () {\n const ctx = this.ctx;\n\n ctx.fillStyle = '#ffffff';\n ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);\n\n matrix.mat2d.multiply(this._drawProjection, this._scaleMatrix, this._projection);\n\n this._drawThese(this._drawList, this._drawProjection, {\n framebufferWidth: ctx.canvas.width,\n framebufferHeight: ctx.canvas.height\n });\n\n if (this._snapshotCallbacks.length > 0) {\n const snapshot = this.canvas.toDataURL();\n this._snapshotCallbacks.forEach(cb => cb(snapshot));\n this._snapshotCallbacks = [];\n }\n }", "function draw() {\n // Fade existing trails\n var prev = g.globalCompositeOperation;\n g.globalCompositeOperation = \"destination-in\";\n g.fillRect(0, 0, mapView.width, mapView.height);\n g.globalCompositeOperation = prev;\n\n // Draw new particle trails\n particles.forEach(function(particle) {\n if (particle.age < settings.maxParticleAge) {\n g.moveTo(particle.x, particle.y);\n g.lineTo(particle.xt, particle.yt);\n particle.x = particle.xt;\n particle.y = particle.yt;\n }\n });\n }", "function draw() {\n\t\t// add each of the components to the group\n\t\tgroup.add(compShape);\t// the shape\n\t\tgroup.add(text);\n\t\tgroup.add(plugout);\t\t// ... the plugin line\n\t\tgroup.add(transFg);\t\t// and finally the transparent foreground\n\t\tmainLayer.add(group);\t// add the group to the main layer\n\t\tstage.draw();\t\t\t// call draw on the stage to redraw its components\n\t}", "_render(){\n this._ctx.save();\n this._ctx.clearRect(0, 0, this._width, this._height);\n this._ctx.fillStyle = this._background;\n this._ctx.fillRect(0, 0, this._width, this._height);\n\n // Update this object's canvas here.\n this._ctx.restore();\n }", "draw() {\n var canv = document.getElementById(\"mycanvas\");\n var ctx = canv.getContext(\"2d\");\n ctx.clearRect(0, 0, canv.width, canv.height);\n\n //Render projectiles through manager\n this.pm.render();\n }", "function draw() {\n background(0);\n fill(col);\n for (var i = 0; i < streams.length; i++) {\n streams[i].update();\n streams[i].render();\n }\n}", "function render() {\n\t\tdraw.custom(function(canvas, context) {\n\t\t\tbullets.forEach(function(bullet, index, bulletList) {\n\t\t\t\tgetSides(bullet, bullet.angle);\n\t\t\t\tcontext.fillStyle = \"black\";\n\t\t\t\tcontext.beginPath();\n\t\t\t\tcontext.moveTo(bullet.points[0].x + bullet.x, bullet.points[0].y + bullet.y);\n\t\t\t\tfor (var i = 1; i < bullet.points.length; i++) {\n\t\t\t\t\tcontext.lineTo(bullet.points[i].x + bullet.x, bullet.points[i].y + bullet.y);\n\t\t\t\t}\n\t\t\t\tcontext.closePath();\n\t\t\t\tcontext.stroke();\n\t\t\t\tcontext.fill();\n\n\t\t\t});\n\t\t\ttanks.forEach(function(tank, index, tankList) {\n\t\t\t\tgetSides(tank, tank.angle);\n\t\t\t\tcontext.fillStyle = \"black\";\n\t\t\t\tcontext.beginPath();\n\t\t\t\tcontext.moveTo(tank.points[0].x + tank.x, tank.points[0].y + tank.y);\n\t\t\t\tfor (var i = 1; i < tank.points.length; i++) {\n\t\t\t\t\tcontext.lineTo(tank.points[i].x + tank.x, tank.points[i].y + tank.y);\n\t\t\t\t}\n\t\t\t\tcontext.closePath();\n\t\t\t\tcontext.stroke();\n\t\t\t\tcontext.fill();\n\t\t\t});\n\t\t\teffects.forEach(function(effect, index, effectList) {\n\t\t\t\tfor (var i = 0; i < effect.particles.length; i++) {\n\t\t\t\t\tvar particle = effect.particles[i];\n\t\t\t\t\tgetSides(particle, particle.angle);\n\t\t\t\t\tcontext.fillStyle = \"black\";\n\t\t\t\t\tcontext.beginPath();\n\t\t\t\t\tcontext.moveTo(particle.points[0].x + particle.x, particle.points[0].y + particle.y);\n\t\t\t\t\tfor (var e = 1; e < particle.points.length; e++) {\n\t\t\t\t\t\tcontext.lineTo(particle.points[e].x + particle.x, particle.points[e].y + particle.y);\n\t\t\t\t\t}\n\t\t\t\t\tcontext.closePath();\n\t\t\t\t\tcontext.stroke();\n\t\t\t\t\tcontext.fill();\n\t\t\t\t}\n\t\t\t});\n\t\t\tmap.forEach(function(wall, index, walls) {\n\t\t\t\tgetSides(wall, wall.angle);\n\t\t\t\tcontext.fillStyle = \"black\";\n\t\t\t\tcontext.beginPath();\n\t\t\t\tcontext.moveTo(wall.points[0].x + wall.x, wall.points[0].y + wall.y);\n\t\t\t\tfor (var i = 1; i < wall.points.length; i++) {\n\t\t\t\t\tcontext.lineTo(wall.points[i].x + wall.x, wall.points[i].y + wall.y);\n\t\t\t\t}\n\t\t\t\tcontext.closePath();\n\t\t\t\tcontext.stroke();\n\t\t\t\tcontext.fill();\n\t\t\t});\n\t\t});\n\t}", "render() {\n this.clearCanvas();\n this.sortEntities();\n this.updateScrollToFollow();\n for (let entity of this.entities) {\n if (!entity.visible)\n break;\n if (entity.shouldBeCulled(this.scrollX, this.scrollY))\n continue;\n entity.render(this.context, this.scrollX, this.scrollY);\n }\n // Dibujamos el overlay\n this.context.fillStyle = \"rgba(\" + this.overlayColor.r + \", \" + this.overlayColor.g + \", \" + this.overlayColor.b + \", \" + this.overlayColor.a + \")\";\n this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);\n this.context.fillStyle = \"#000000\";\n // Render del fotograma listo, disparamos el evento\n this.onFrameUpdate.dispatch();\n }", "draw() {\n\t\tinfo.context.beginPath();\n\t\tinfo.context.arc(this.position.x, this.position.y, 30, 0, 2 * Math.PI);\n\t\tinfo.context.fillStyle = this.color;\n\t\tinfo.context.fill();\n\t}", "display() {\n push();\n // Filter goes from transparent to more opaque\n this.fill.alpha += this.fill.alphaChangeRate;\n this.fill.alpha = constrain(this.fill.alpha, 0, this.fill.finalAlpha);\n // Draw a rectangle\n rectMode(CORNER);\n fill(this.fill.r, this.fill.g, this.fill.b, this.fill.alpha);\n rect(this.x, this.y, this.length, this.height);\n pop();\n }", "function renderCanvas() {\n\tframeCount++;\n\tif (frameCount < fCount) {\n\t\t// skips the drawing for this frame\n\t\trequestAnimationFrame(renderCanvas);\n\t\treturn;\n\t}\n\telse frameCount = 0;\n\n\tcontext.clearRect(0, 0, canvas.width, canvas.height);\n\t// context.fillStyle = \"#999999\";\n\t// context.fillRect(0,0,canvas.width,canvas.height);\n\n\t\n\n\tGhost.draw()\n\trequestAnimationFrame(renderCanvas);\n}", "render() {\n fill(this.layerColor)\n noStroke()\n push()\n translate(width / 2, height / 2)\n for (let i = 0; i <= this.numShapes; i++) {\n for (let x = this.centerOffset; x < CRYSTAL_SIZE / 2; x += this.singleStep) {\n ellipse(x, 0, this.shapeSize, this.shapeSize)\n }\n rotate(this.angle)\n }\n pop()\n }", "function draw() {\r\n canvas_resize();\r\n set_origin();\r\n set_speed();\r\n bars[it].display();\r\n if (looping && it < nb_op) it++;\r\n}", "function draw() {\n\n\t\t\t\t// キャンバスの描画をクリア\n\t\t\t\tcontext.clearRect(0, 0, width, height);\n\n\t\t\t\t//波を描画\n\t\t\t\tdrawWave('rgba(7, 126, 195, 0.30)', 1, 3, 0);\n\n\t\t\t\t// Update the time and draw again\n\t\t\t\tdraw.seconds = draw.seconds + .009;\n\t\t\t\tdraw.t = draw.seconds * Math.PI;\n\t\t\t\tsetTimeout(draw, 20);\n\t\t\t}", "drawThings() {\r\n this.paddle.render();\r\n this.ball.render();\r\n\r\n this.bricks.forEach((brick) => brick.display());\r\n this.blocks.forEach((block) => block.show());\r\n\r\n }", "draw(context) {\n context.save();\n context.translate(this.position.x, this.position.z);\n context.rotate(-this.rotation.y);\n context.fillStyle = \"#ef484b\";\n context.beginPath();\n context.arc(0, 0, this.diameter / 2, 0, Math.PI * 2);\n context.fill();\n context.stroke();\n context.beginPath();\n context.arc(this.diameter / 2 - 20, 0, 5, 0, Math.PI * 2);\n context.fillStyle = \"white\";\n context.fill();\n this.sensors.forEach((sensor) => {\n if (sensor.draw)\n sensor.draw(context);\n });\n context.restore();\n }", "render() {\n fill(100);\n noStroke();\n push();\n translate(this.x, this.y); // translate the coordinates to the grid cell\n this.drawlines();\n pop();\n }", "function draw() {\n\n\t\t\t\t// キャンバスの描画をクリア\n\t\t\t\tcontext.clearRect(0, 0, width, height);\n\n\t\t\t\t//波を描画\n\t\t\t\tdrawWave('rgba(7, 126, 195, 0.30)', 1, 3, 0);\n\n\t\t\t\t// Update the time and draw again\n\t\t\t\tdraw.seconds = draw.seconds + .009;\n\t\t\t\tdraw.t = draw.seconds * Math.PI;\n\t\t\t\tsetTimeout(draw, 30);\n\t\t\t}", "display(){\n noStroke();\n fill(this.color);\n this.shape(this.x, this.y, this.size, this.size);\n for(var i=0; i<this.history.length; i++){\n var pos = this.history[i];\n this.shape(pos.x, pos.y, 8, 8);\n }\n }", "render(ctx) { \n ctx.strokeStyle = this.strokeStyle\n ctx.lineWidth = this.lineWidth\n ctx.fillStyle = this.fillStyle\n ctx.beginPath()\n //Draw the sprite around its `pivotX` and `pivotY` point\n ctx.rect(\n -this.width * this.pivotX,\n -this.height * this.pivotY,\n this.width,\n this.height\n )\n if(this.strokeStyle !== \"none\") ctx.stroke()\n if(this.fillStyle !== \"none\") ctx.fill()\n if(this.mask && this.mask === true) ctx.clip()\n }", "paintCanvas() {\n // Draw the tile map\n this.game.map.drawMap();\n\n // Draw dropped items\n this.game.map.drawItems();\n\n // Draw the NPCs\n this.game.map.drawNPCs();\n\n // Draw the player\n this.game.map.drawPlayer();\n\n // Draw the mouse selection\n this.game.map.drawMouse();\n }", "function draw() {\n ctx.clearRect(0, 0, W, H);\n for (var i = 0; i < mp; i++) {\n let p = particles[i];\n ctx.beginPath();\n ctx.lineWidth = p.r;\n ctx.strokeStyle = p.color; // Green path\n ctx.moveTo(p.x, p.y);\n ctx.lineTo(p.x + p.tilt + p.r / 2, p.y + p.tilt);\n ctx.stroke(); // Draw it\n }\n update();\n }", "draw() { }", "draw() { }", "draw() { }", "draw() {\n\t\tthis.newPosition()\n\t\tthis.hoverCalc()\n\n\n\t\t// this.drawWaves()\n\n\t\tthis.applyCircleStyle()\n\n\n\t\tthis.ly.circle( this.x, this.y, 2 * this.r * this.scale )\n\n\t\tthis.applyTextStyle()\n\t\tthis.ly.text( this.label, this.x, this.y )\n\n\n\n\t}" ]
[ "0.74068165", "0.7403428", "0.73269916", "0.72956324", "0.7271177", "0.72699153", "0.72699153", "0.72699153", "0.72699153", "0.72226834", "0.7203878", "0.697974", "0.6968142", "0.6883081", "0.6842452", "0.6762215", "0.6756254", "0.67520845", "0.6738171", "0.66951376", "0.66822696", "0.66732097", "0.6658425", "0.6646911", "0.663854", "0.6636435", "0.66300744", "0.66171795", "0.6603997", "0.660062", "0.6570295", "0.65550053", "0.65519786", "0.6528942", "0.6517819", "0.6516979", "0.6513971", "0.6510349", "0.6501831", "0.6486216", "0.64800584", "0.64716715", "0.64707786", "0.6469006", "0.6468352", "0.6466491", "0.64603025", "0.6448877", "0.6446174", "0.6443877", "0.644084", "0.6437438", "0.64202905", "0.6419885", "0.6406883", "0.6398097", "0.6391289", "0.63904464", "0.6390094", "0.6387261", "0.63771504", "0.63762385", "0.6370979", "0.6367187", "0.6364619", "0.6361298", "0.63563514", "0.635558", "0.63529867", "0.63401854", "0.6333193", "0.6328815", "0.632247", "0.6314308", "0.6313276", "0.63127077", "0.63034254", "0.630273", "0.6299978", "0.6288362", "0.6286322", "0.6278788", "0.62734944", "0.62682635", "0.62653494", "0.6263283", "0.6259892", "0.6253254", "0.625123", "0.6250538", "0.6249459", "0.6244762", "0.6242545", "0.624045", "0.6238817", "0.623345", "0.62328285", "0.62328285", "0.62328285", "0.62285924" ]
0.7366688
2
Restarts the animation completely
function restartAnimation() { setup(); frameCounter = 0; animationIndex = 0; focusedPipeIndex = 0; lowestUnsortedIndex = 1; // Recreate the pipes array if the animation has been played before if (needsScrambling) { pipes = []; for (let i = 0; i < pipesAmount; i++) pipes.push(new Pipe(i * minPipeHeight)); pipes = scramble(pipes); pipes[0].status = 2; } needsScrambling = true; loop(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function animateRestart() {\n animation1.restart();\n animation2.restart();\n animation3.restart();\n animation4.restart();\n}", "restartAnimation() {\n for (var key in this.animations) {\n if (this.animations.hasOwnProperty(key)) {\n this.animations[key].setFinished(false);\n this.animations[key].reset();\n }\n }\n }", "function restartAnimation() {\n cancelAnimationFrame(animationID)\n init();\n}", "function restart(){\n animate_ca();\n }", "function resumeAnimation() {\n startAnimation()\n}", "async restartAnimation() {\n await this.updateComplete;\n this.animationReady = false;\n await new Promise(requestAnimationFrame);\n this.animationReady = true;\n await this.updateComplete;\n }", "function resetRuning(){\r\n Joey.changeAnimation(\"running\",Running_Joey);\r\n \r\n}", "function restartAnimation() {\n setup();\n let range = document.getElementById('range');\n elementsLength = parseInt(range.max);\n value = parseInt(range.value);\n min = 0;\n focus = 0;\n frames = 0;\n}", "function restart() {\n $(\".pause, .over\").css(\"display\", \"none\");\n\n clearInterval(interval);\n reset();\n\n main();\n}", "function restart() {\n\t if (direction === 'up') {\n\t PARAMS.elevation = 0;\n\t } else {\n\t PARAMS.elevation = elevationMax;\n\t }\n\n\t pane.refresh();\n\n\t generateScene();\n\t startRide();\n\t}", "restart() {\n this.reset();\n this.movie = false;\n this.displayMovie = false;\n this.movieArray = [];\n this.lastMovie = 0;\n }", "function reset_animations(){\n if(active != \"idee\"){tl_idee.restart();\n tl_idee.pause();}\n if(active != \"reunion\"){tl_reunion.restart();\n tl_reunion.pause();}\n if(active != \"travail\"){tl_travail.restart();\n tl_travail.pause();}\n if(active != \"deploiement\"){tl_depl.restart();\n tl_depl.pause();}\n }", "restart() {\n//------\nthis._needsResetClock = true;\nthis.clckBase = 0; // this should be set properly via _doResetClock()\nthis.clckCur = 0; // this should be set properly via _doResetClock()\nthis.animBase = 0;\nthis.animCur = 0;\nthis.speedCur = this._getSpeed();\nthis.frameCur = -1; // indicates no frame played yet\nthis.signCur = -1; // indicates no sign played yet\nthis.glossCur = null;\nthis.isStopped = false;\nthis.isSuspended = false;\nthis.oneStepUpIsPending = false;\nthis.oneStepDownIsPending = false;\nthis.casAnim.reset(); //========\nif (this._updateFPS) {\nthis._resetFPS();\n}\nthis._rqstNextTick();\nthis.traceMax = 400;\nreturn typeof lggr.trace === \"function\" ? lggr.trace(\"restart\") : void 0;\n}", "restart() {\r\n this.audioPlayer.restart();\r\n this.state.calibrating = true;\r\n this.state.stopped = false;\r\n this.state.conducting = false;\r\n this.state.finished = false;\r\n }", "restart() {\n this.x = 200;\n this.y = 380;\n }", "function restart() {}", "function restartAnimation(element) {\n\telement.classList.remove(\"show-slide-number\");\n\tvoid element.offsetWidth;\n\telement.classList.add(\"show-slide-number\");\n}", "function restartBallAnimation(){\n let $oldBall = $ballX;\n $ballX = $ballX.clone().appendTo('body');\n $oldBall.remove();\n $ballY = $('.ballY');\n $('.ball-paused').removeClass('ball-paused');\n}", "restart() {\n this.y = this.startY;\n this.x = this.startX;\n }", "restart() {\n return this.play(this.currentActions, 0)\n }", "function restart()\n{\n\tsetTimeout(function ()\n\t{\n\t\tmuziek.currentTime = 1; muziek.play(); restart();\n\t}, (muziek.duration - 1) * 1000);\n}", "re_animate_ghost() {\r\n\r\n this.sprite.status = this.statusEnum.ALIVE;\r\n this.set_animation_frame(0, 0);\r\n this.animate_start();\r\n \r\n }", "function restart() {\n game.state.restart();\n}", "function restart() {\n grid = createGrid(currentLevel);\n stepCount = 0;\n requestAnimationFrame(drawCanvas);\n win = false;\n scoreSet = false; //Set boolean to false\n}", "_resetAnimation() {\n // @breaking-change 8.0.0 Combine with _startAnimation.\n this._panelAnimationState = 'void';\n }", "_reset() {\n this._looped = 0;\n this._finished = 0;\n this._started = true;\n this._createAnimatables();\n }", "restart() {\r\n\r\n this.snake.reset();\r\n this.controls.classList.remove('game-over');\r\n this.board.classList.remove('game-over');\r\n\r\n }", "rewind() {\r\n\t\t\tthis.looping = false;\r\n\t\t\tthis.goToFrame(0);\r\n\t\t}", "if (m_bInitialAnim) { return; }", "function restart() {\n\t$('.card').removeClass('open show match animated bounce');\n\t$('.card').remove();\n\t$('#stars1').html('');\n\t$('#stars2').html('');\n\t$('.score-panel').show();\n\tinitStars();\n\tmakeCardHTML();\n\tmoves = -1;\n\tplayerMatches = 0;\n\tstopTimer();\n\t$(\".seconds\").html('00');\n\t$(\".minutes\").html('00');\n\tclickCards();\n\tdisplayMoves();\n\topenCards = [];\n}", "function restartGame() {\n\n\tgGamerPos = { i: 2, j: 9 };\n\tgBoard = buildBoard();\n\tgBallsToCollect = 2;\n\tgColector.innerText = 0;\n\tgAddBallInterval = setInterval(addBall, 5000);\n\tgIsGameOn = false;\n\telBtn = document.querySelector('.restart');\n\t// elBtn.classList.toggle('restart');\n\telBtn.style.display = 'none';\n\trenderBoard(gBoard);\n}", "restart() {\n\n this.snake.reset();\n this.food.reset();\n this.score = 0;\n this.scoreCounter.innerText = 0;\n this.controls.classList.remove('playing');\n this.controls.classList.remove('in-menu');\n this.board.classList.remove('game-over');\n this.board.classList.remove('leaderboard');\n\n }", "function anim() {\r\n Loop();\r\n requestAnimFrame(anim);\r\n }", "function restartInteractive() {\n $('.circle').remove();\n $('#background-colour-slider-container').addClass('d-none');\n firstStage = true;\n $('#instruction-text').html(START_TEXT);\n bgColourSlider[0].noUiSlider.destroy();\n $('#circles-area').removeClass(startColour);\n $('#circles-area').removeAttr('style');\n init();\n}", "function stop() {\r\n animating = false;\r\n }", "function restart() {\n clearInterval(timerInterval);\n started = false;\n runInterval();\n }", "gameRestart() {\n this.destroy();\n this.render();\n }", "function stop_dog_poop() {\n cancelAnimationFrame(anim_id);\n $('#restart').slideDown();\n }", "stop() {\n this.renderer.setAnimationLoop(null);\n }", "function Start () { \r\n animation.wrapMode = WrapMode.Loop; \r\n animation.Stop(); \r\n Idle();\r\n}", "start() {\n this._enableAnimation = true;\n this._numberOfAnimationCycles = 0;\n }", "function restart() {\n level = 1;\n gamePattern = [];\n userClickedPattern = [];\n startGame = false;\n //console.log(\"restarted\");\n}", "function animate() {\r\n if (!doAnim) {\r\n river.context=null; \r\n return;\r\n }\r\n\trequestAnimFrame( animate );\r\n river.background.draw();\r\n}", "function stopAnimation() {\n reset();\n sprite.gotoAndStop(sprite.currentFrame);\n }", "function restart() {\n debug(\"restart\");\n let reset = document.querySelector('.restart');\n\n reset.addEventListener('click', function(){\n clearBoard();\n resetMoves();\n clearStars();\n createStars();\n clearTimer();\n createTimer();\n createBoard();\n })\n }", "function restart() {\n clearInterval(timerId);\n clearInterval(moveTimer);\n gameIsOver = false;\n $tiles\n .show()\n .removeClass('active wrongTarget');\n $ready.show();\n $btn.show();\n lives = 5;\n $livestxt.html(lives);\n score = 0;\n $score.html(score);\n time = 30;\n $timer.html(time);\n }", "function animLoop() {\n\t\t// Calculate the time since last call.\n\t\tvar curDate = Date.now();\n\t\ttimeSinceLastFrame = curDate - startDate;\n\t\tstartDate = curDate;\n\t\t//console.log(\"animLoop \" + timeSinceLastFrame);\n\t\t// Render. Scene return when it is up to date.\n\t\tvar sceneIsUpToDate = scene.render();\n\t\t// Restart render loop.\n\t\tif(! sceneIsUpToDate || running) {\n\t\t\trequestAnimFrame(animLoop);\n\t\t} else {\n\t\t\t// The scene is up-to-date.\n\t\t\t// Update the GUI.\n\t\t\tui.update();\n\t\t\trunning = false;\n\t\t\t//console.log(\"animLoop stoped running\");\t\t\t\n\t\t}\n\t}", "restart() {\n this.x = 202;\n this.y = 395;\n gem = '';\n }", "function restartGame() {\n\tallOpenedCards.length = 0;\n\tresetTimer();\n\tresetMoveCount();\n\tresetStar();\n\tresetCards();\n\ttoggleModal();\n\tinit();\n}", "function replay() {\n\t$(\".congratulations\").css(\"display\", \"none\");\n\trestart(false);\n\t$(\".container\").removeClass(\"hide\");\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 reset() {\n\t\t/**\n\t\t * TODO: create initial game start page and additional\n\t\t * \tinteractivity when game resets once understand more about\n\t\t * animation\n\t\t */\n\t}", "function resetGame()\n{\n clearInterval(doAnimation);\n isfarmerRight = isseedsRight = isfoxRight = ischickenRight = false;\n \n updateImages(); //Place and size the images.\n setButtonsAndMessage(false, false, false, false, MSGINTRO);\n}", "function startAnimation() {\n waited += new Date().getTime() - stopTime\n stopAnim = false;\n Animation();\n}", "reset() {\n\n this.isFiring = false;\n this.anims.pause();\n this.body.setVelocity(0, 0);\n this.y = 431;\n }", "Restart() {\n\n }", "function restart() {\r\n hello();\r\n i = 0;\r\n health = 4;\r\n happiness = 4;\r\n hunger = 4;\r\n timer = setInterval(timePassed, 1000);\r\n }", "function restart(){\n speed = 1;\n score = 0;\n appleY = 200;\n}", "reAnimate(){\n\t\tthis.keyFrameStyle.parentNode.removeChild(this.keyFrameStyle);\n\t\tthis.keyFrameStyle = null;\n\t\tthis.keyFrameAnimate();\n\t}", "function reset() {\n setSeconds(duration);\n setRunning(false);\n }", "function restart() {\n // update entries and exits values\n computeIO();\n\n // -----Paths-----\n drawPaths();\n\n // -----Nodes-----\n createNodes();\n updateNodePositions();\n\n // update the distance of every link\n updateDistances();\n\n // set the graph in motion\n force.start();\n}", "updateAnimation() {\n return;\n }", "stop() {\n this._enableAnimation = false;\n }", "stopDrawing() {\n this.updateAnimation = false;\n }", "function restartGame() {\n player.restart();\n hearts = [new Lives(0, 534), new Lives(33, 534), new Lives(66, 534)];\n life = 3;\n points = 0;\n gameEnd.css('display', 'none');\n}", "async resetRocket() {\n this.alpha = 0;\n this.tl.pause();\n this._animationIsPlaying = false;\n\n this.emit(Rocket.events.RESET);\n }", "function playAgain(){\r\n restart();\r\n}", "stop(){this.__stopped=!1;this.toggleAnimation()}", "function restart(){\n\tmarioGame.enStatus = enStep.nInit;\n\t$(\"#gameover\").unbind();\n\t//if(isCompatible() == true){\n\t\t$(\"#gameover\").addClass(\"character-removed\");\n\t\t$(\"#gameover\").bind(\"webkitTransitionEnd\", removeDiv);\n\t\t$(\"#gameover\").bind(\"oTransitionEnd\", removeDiv);\n\t\t$(\"#gameover\").bind(\"otransitionend\", removeDiv);\n\t\t$(\"#gameover\").bind(\"transitionend\", removeDiv);\n\t\t$(\"#gameover\").bind(\"msTransitionEnd\", removeDiv);\n\t/*}\n\telse\n\t{\n\t\t$(\"#gameover\").empty();\n\t\t$(\"#gameover\").remove();\n\t}*/\n\tmarioGame.nTurn = 0;\n\tmarioGame.nFrame = 0;\n}", "play(){this.__stopped=!0;this.toggleAnimation()}", "function restartGame() {\n\tstart = false;\n}", "function RestartScene() {\n\n\tsimulate = false;\n\n\ttransformControls.detach();\n\n\tfor (var i = objects.length - 1; i >= 0; i--) {\n\t\tscene.remove(objects[i]);\n\n\t\tobjects[i].material.dispose()\n\t\tobjects[i].geometry.dispose();\n\n\t\tobjects[i] = resetObjects[i];\n\n\t\tscene.add(objects[i]);\n\t}\n\n}", "function restart() {\n //empty openCardsArray\n openCardsArray.pop();\n //reset move counter\n moves = 0;\n document.querySelector('.moves').textContent = moves;\n //reset time\n //reset stars\n document.querySelectorAll('.fa-star-o').forEach(function(element) {\n element.classList.replace('fa-star-o', 'fa-star');\n });\n //flip cards upside down\n document.querySelectorAll('.card').forEach(function(element) {\n element.classList.remove('match', 'open', 'show');\n });\n deckShuffle();\n stopTimer();\n timePassed = 0;\n document. querySelector('.timer').textContent = '';\n}", "_playAnimation() {\n if (this._animationLast === undefined && this._animationQueue.length > 0) {\n this._animationLast = this._animationCurrent;\n this._animationCurrent = this._animationQueue.shift();\n console.log(\"New: \" + this._animationCurrent.name);\n this._animationCurrent.runCount = 0;\n }\n this._serviceAnimation(this._animationCurrent, true);\n this._serviceAnimation(this._animationLast, false);\n if (this._animationLast && this._animationLast.cleanup) {\n this._animationLast.animation.stop();\n this._animationLast.animation = undefined;\n this._animationLast = undefined;\n }\n }", "function step() {\n redraw.stepAnimation();\n }", "function step() {\n redraw.stepAnimation();\n }", "function reset() {\n element[0].style.transitionDuration = 0;\n element.removeClass(initClass + ' ' + activeClass + ' ' + animation);\n }", "function reset() {\n element[0].style.transitionDuration = 0;\n element.removeClass(initClass + ' ' + activeClass + ' ' + animation);\n }", "function reset() {\n element[0].style.transitionDuration = 0;\n element.removeClass(initClass + ' ' + activeClass + ' ' + animation);\n }", "function reset() {\n element[0].style.transitionDuration = 0;\n element.removeClass(initClass + ' ' + activeClass + ' ' + animation);\n }", "function restart() {\n showElement(inputContent);\n showElement(startBtn);\n hideElement(counterContent, restartBtn);\n\n counterMinutes.innerHTML = \"\";\n nMinutes.value = \"\";\n }", "function reset() {\n element[0].style.transitionDuration = 0;\n element.removeClass(initClass + ' ' + activeClass + ' ' + animation);\n }", "function reset() {\n\t element[0].style.transitionDuration = 0;\n\t element.removeClass(initClass + ' ' + activeClass + ' ' + animation);\n\t }", "function restart () {\n\n randomNumberGoal ();\n numbers ();\n count = 0;\n randomCrystals ();\n\n }", "restart() {\n $('#player_turn').text('Red')\n const $board = $(this.selector)\n $board.empty()\n this.drop_btn()\n this.create_board()\n this.turn = 0\n this.game_over = false\n }", "function reset() {\n element[0].style.transitionDuration = 0;\n element.removeClass(initClass + ' ' + activeClass + ' ' + animation);\n }", "function restart() {\n\tplayer.stage = 0; // reset stage counter\n\tplayer.sprite = player.playerChar[player.stage];// reset player character\n\tplayer.resetPos(); //reset player position\n\twindow.open(\"#close\", \"_self\"); // close popup\n}", "function restartGame() {\n pipesGroup.clear(true, true);\n pipesGroup.clear(true, true);\n gapsGroup.clear(true, true);\n scoreboardGroup.clear(true, true);\n player.destroy();\n gameOverBanner.visible = false;\n restartButton.visible = false;\n\n const gameScene = game.scene.scenes[0];\n prepareGame(gameScene);\n\n gameScene.physics.resume();\n}", "function restart() {\r\n coffees.forEach((coffee) => {\r\n coffee.style.left = '0';\r\n coffee.style.top = '0';\r\n });\r\n spillCoffee();\r\n}", "reset() {\n if(!this.finishedAnimating) {\n return false;\n }\n\n const svg = this.shadowRoot.querySelector(\"svg\");\n\n svg.classList.remove(\"animate\");\n\n this.finishedAnimating = false;\n return true;\n }", "restartGame() {\n score=5;\n $('#restart-button').on('click', () => {\n $('.modal').hide();\n $('.game-container').css('display', 'block');\n $('.mushroom-container').css('display', 'block');\n setUpRound();\n $('#restart-button').off();\n });\n }", "function restartSimulation() {\n PLAY_STATUS = PlayStatus.INITAL_STATE_PAUSED\n CODE_MIRROR_BOX.setOption(\"theme\", NORMAL_CODE_THEME)\n\n pausePlay.innerHTML = 'Run!'\n d3.select(\"#messageBoxDiv\")\n .attr(\"class\", \"alert alert-block alert-success\")\n d3.select(\"#messageBoxHeader\")\n .text(\"Tip:\")\n d3.select(\"#messageBox\").html(\"<h3>Click the 'Run!' button to run your program</h3>\")\n d3.select(\"#restart\").attr(\"class\", \"btn menu-button\")\n\n cleanUpVisualization()\n\n BOARD = loadBoard(PUZZLE_CAMPAIGN, PUZZLE_CAMPAIGN_STATE)\n\n var program = compile()\n setBotProgram(BOARD, PROGRAMING_BOT_INDEX, program)\n\n initializeVisualization(PUZZLE_CAMPAIGN, PUZZLE_CAMPAIGN_STATE, BOARD)\n\n}", "function restartGame() {\n state = 0;\n body.innerHTML = '';\n buildGame();\n gameOver = false;\n}", "function restart() {\n nextStep(1);\n document.getElementById('end').innerHTML = '';\n}", "function resetGame() {\r\n\tconsole.log('the game restarts');\r\n\tclearInterval(gRndBallInterval);\r\n\tclearInterval(gGnerGlueInterval);\r\n\tdocument.querySelector('.restart').classList.remove('hide');\r\n}", "restart() {\r\n console.clear();\r\n this.curPos = [];\r\n [...this.curPos] = [...this._startPos];\r\n this.grid = [];\r\n \r\n if(!this.isAlive) {\r\n console.log(`You died...`);\r\n }\r\n else if (this.won){\r\n console.log(`You found your hat!`);\r\n }\r\n\r\n let ans = prompt('Do you want to play again?(y/n)');\r\n \r\n if (ans === 'y' && !this.isAlive) {\r\n this.isAlive = true;\r\n this.copyGrid(this.oGrid, this.grid);\r\n this.update();\r\n }\r\n else if (ans === 'y' && this.won) {\r\n this.won = false;\r\n let test = this.generateAndTestMap();\r\n\r\n if(test != null) {\r\n this.oGrid = [];\r\n this.copyGrid(this.grid, this.oGrid);\r\n [...this.curPos] = [...this._startPos];\r\n this.update();\r\n }\r\n }\r\n }", "function restartGame(){\n resetStars();\n initializeVariables();\n shuffleCards(cards);\n displayCards(cards);\n listenForCardFlip();\n $('.odometer').html(score);\n $('.resultsPopUp').hide();\n $('.placeholder').show();\n $(\"#timer\").TimeCircles().restart();\n $('#overlay').css('display', 'none');\n $(\"#try-again\").click(function(){\n restartGame();\n });\n}", "function reset(){\r\n gameState = PLAY;\r\n gameOver.visible = false;\r\n // restart.visible = false;\r\n enemiesGroup.destroyEach();\r\n blockGroup.destroyEach();\r\n stars1Group.destroyEach();\r\n stars2Group.destroyEach();\r\n candyGirl.addAnimation(\"running\", candygirl_running);\r\n score = 0;\r\n}", "function restartGame (){\n themeSong.pause();\n while (grid.firstChild) {\n grid.removeChild(grid.firstChild)\n }\n grid.removeAttribute('class');\n score = 0;\n totalGemsCollected = 0;\n currentGems = 0;\n gemDisplay.textContent = currentGems;\n angrySlimesHit = 0;\n timeLeft = 60;\n endDisplay.style.display = 'none';\n startDisplay.classList.add('show');\n}", "function restart(){\n\n x = 0\n\n document.getElementById('result').classList.add('hidden');\n document.getElementById('result').classList.remove('show');\n \n document.getElementById('vuur').classList.add('hidden');\n document.getElementById('vuur').classList.remove('show');\n\n document.getElementById('vuur1').classList.add('hidden');\n document.getElementById('vuur1').classList.remove('show');\n\n document.getElementById('vuur2').classList.add('hidden'); \n document.getElementById('vuur2').classList.remove('show');\n\n document.getElementById('vuur3').classList.add('hidden'); \n document.getElementById('vuur3').classList.remove('show');\n\n document.getElementById('vuur4').classList.add('hidden'); \n document.getElementById('vuur4').classList.remove('show');\n\n document.getElementById('restart').classList.add('hidden');\n document.getElementById('restart').classList.remove('show');\n\n document.getElementById('vuurButton').classList.add('show');\n document.getElementById(\"myC\").style.cursor = \"\";\n}" ]
[ "0.8510034", "0.8280984", "0.8237393", "0.82202595", "0.7657908", "0.7548187", "0.7501904", "0.73825663", "0.727779", "0.723018", "0.7139637", "0.7132513", "0.7120546", "0.70794916", "0.7055592", "0.7039486", "0.7033863", "0.70324564", "0.6966964", "0.6898116", "0.68861574", "0.68705773", "0.68305993", "0.68277013", "0.6807511", "0.68039507", "0.6776855", "0.6774433", "0.6774412", "0.67583036", "0.6751559", "0.67484915", "0.67441624", "0.67296064", "0.6724919", "0.6724354", "0.67096084", "0.6692868", "0.6691689", "0.6684877", "0.66822267", "0.6675239", "0.6672169", "0.6661317", "0.6647698", "0.66084737", "0.65971965", "0.6591402", "0.6583268", "0.6573787", "0.6570133", "0.6567524", "0.6567134", "0.6563691", "0.6553062", "0.6551009", "0.6541883", "0.6541511", "0.6535655", "0.652352", "0.6520899", "0.65096444", "0.64947987", "0.64911354", "0.648616", "0.64791834", "0.6478943", "0.6474414", "0.64710534", "0.6469649", "0.64551055", "0.64469767", "0.6429972", "0.6427076", "0.64208287", "0.64208287", "0.6416097", "0.6416097", "0.6416097", "0.6416097", "0.64159346", "0.6411017", "0.6401593", "0.63995486", "0.63955873", "0.6394087", "0.63870907", "0.6386696", "0.6383942", "0.6382215", "0.63760287", "0.63721555", "0.6369113", "0.63600796", "0.63588727", "0.6340853", "0.6336465", "0.633598", "0.6328661", "0.63277996" ]
0.73322004
8
Sets the size and position of the canvas, thus not interrupting or restarting the animation
function setup() { let canvasDiv = document.getElementById('animation'); canvasWidth = canvasDiv.offsetWidth; canvasHeight = canvasDiv.offsetHeight; pipesAmount = Math.floor(canvasHeight / (minPipeHeight + 1)); pipesWidth = canvasWidth / (pipesAmount + 1); // Creates canvas let canvas = createCanvas(canvasWidth, canvasHeight); // Declares the parent div of the canvas canvas.parent('animation'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setCanvas() {\n this.canvas.width = this.height = 800;\n this.canvas.height = this.width = 800;\n }", "resetCanvas() {\n this.positions = this.calcSizeAndPosition();\n }", "function setCanvasSize() {\n\t\t// Get the screen height and width\n\t\tscreenHeight = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight;\n\t\tscreenWidth = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;\n\t\t// Figure out which one is smaller\n\t\tminScreenSide = ( screenWidth < screenHeight ) ? screenWidth : screenHeight;\n\t\t// Figure out if the timer is at its max size\n\t\tif ( (minScreenSide + 2*timerPadding ) > maxTimerSide ) {\n\t\t\tcanvasSide = maxTimerSide - 2*timerPadding;\n\t\t} else {\n\t\t\tcanvasSide = minScreenSide;\n\t\t}\n\t\tcanvas.height = canvasSide;\n\t\tcanvas.width = canvasSide;\n\t\t//logDimensions();\n\t}", "function setCanvasSize() {\n\t\t// Get the screen height and width\n\t\tscreenHeight = window.innerHeight || document.documentElement.clientHeight || document.getElementsByTagName('body')[0].clientHeight;\n\t\tscreenWidth = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;\n\t\t// Figure out which one is smaller\n\t\tminScreenSide = ( screenWidth < screenHeight ) ? screenWidth : screenHeight;\n\t\t// Figure out if the timer is at its max size\n\t\tif ( (minScreenSide + 2*timerPadding ) > maxTimerSide ) {\n\t\t\tcanvasSide = maxTimerSide - 2*timerPadding;\n\t\t} else {\n\t\t\tcanvasSide = minScreenSide;\n\t\t}\n\t\tcanvas.height = canvasSide;\n\t\tcanvas.width = canvasSide;\n\t\t//logDimensions();\n\t}", "function fixCanvas(){\n CANVAS.width=400\n CANVAS.height=225\n CANVAS.style.width = \"400px\"\n CANVAS.style.height = \"225px\"\n}", "function Klein() {\n Zauberbild.canvas.height = 400;\n Zauberbild.canvas.width = 400;\n }", "function adjustCanvasSize() {\n CANVAS.width = CANVAS_WIDTH;\n CANVAS.height = window.innerHeight;\n}", "function setCanvasSize() {\n var width = $('#coloring').width();\n var height = $('#coloring').height();\n\n $('#coloring_canvas').attr('width', width);\n $('#coloring_canvas').attr('height', height);\n context.lineWidth = radius * 2;\n }", "setpos(x, y) {\n let disX = x - this.w / 2;\n let disY = y - this.h / 2;\n if (disX < 0)\n disX = 0;\n else if (disX > canvas.width - this.w)\n disX = canvas.width - this.w;\n if (disY < 0)\n disY = 0;\n else if (disY > canvas.height - this.w)\n disY = canvas.height - this.w;\n this.x = disX;\n this.y = disY;\n }", "_resize() {\n this.width = this._context.canvas.width;\n this.height = this._context.canvas.height;\n this.dirty = true;\n }", "function init () {\n resizeCanvas();\n}", "resize(width, height) {\n this.canvas.width = width;\n this.canvas.height = height;\n }", "resizeCanvas() {\n this.canvas.width = window.innerWidth;\n this.canvas.height = window.innerHeight;\n this.cx = this.ctx.canvas.width / 2;\n this.cy = this.ctx.canvas.height / 2;\n }", "SetCanvasTarget(canvas) {\n\n\t\tthis.canvasTarget = canvas;\n\t\tthis.canvasTargetContext = this.canvasTarget.getContext(\"2d\");\n\t\tthis.canvasTargetContext.imageSmoothingEnabled = false;\n\n\t\tvar maxSize = Math.max(canvas.width, canvas.height);\n\t\tthis.viewport = new rect(new vec2(), new vec2(maxSize));\n\t\tthis.viewport.center = new vec2(canvas.width, canvas.height).Scaled(0.5);\n\t}", "updateSize(newCanvasWidth, newCanvasHeight) {\n canvasWidth = newCanvasWidth;\n canvasHeight = newCanvasHeight;\n isCanvasDirty = true;\n }", "function SizeInit(){\n\t\n\t//event_canvas.style=\" height: 100%;width: 100%;margin: 0;padding: 0;display: block;\"\n\tcanvas = document.getElementById(\"event_canvas\"); \n\tif (!canvas.getContext) { \n\t\tconsole.log(\"Canvas not supported. Please install a HTML5 compatible browser.\"); \n\t\treturn; \n\t} \n\ttempContext = canvas.getContext(\"2d\"); \n\ttempContext.canvas.height= window.innerHeight;\n\ttempContext.canvas.width= window.innerWidth;\n\t\n\tSizeX= tempContext.canvas.width;\n\tSizeY= tempContext.canvas.height;\n\t\n\tif(SizeX<SizeY){\n\t\ttemps= SizeY;\n\t\tSizeY=SizeX;\n\t\tSizeX=temps;\n\t\tisrotate= 1;\n\t\ttempContext.rotate(90*Math.PI/180);\n\t\ttempContext.translate(0,-SizeY);\n\t}\n\telse{\n\t\tisrotate=0;\n\t}\n\n\tif(SizeY>SizeX*0.5625){\n\t\tframepx=0;\n\t\tframesx=SizeX;\n\t\tframepy=(SizeY-SizeX*0.5625)/2;\n\t\tframesy=SizeX*0.5625;\n\t}\n\telse{\n\t\tframepx=(SizeX-SizeY/0.5625)/2;\n\t\tframesx=SizeY/0.5625;\n\t\tframepy=0;\n\t\tframesy=SizeY;\n\t}\n\t\n\t//console.log(framesx,framesy);\n\t\n}", "function setCanvas(){\n _canvas = document.getElementById('canvas');\n _stage = _canvas.getContext('2d');\n _canvas.width = _puzzleWidth;\n _canvas.height = _puzzleHeight;\n}", "resetCanvasPosition(): void {\n this.translate(-this.canvasPosition.x, -this.canvasPosition.y);\n this.canvasPosition = { x: 0, y: 0 };\n }", "setup() {\n\t\t\tspeed = 5;\n\t\t\tposition = new Vector2D(this.canvas.width/2, this.canvas.height/2);\n\t\t}", "function animate() {\n\treqAnimFrame(animate);\n\tcanvasDraw();\n}", "canvasResize()\n {\n View.canvas.setAttribute(\"width\", this.floatToInt(window.innerWidth*0.95));\n View.canvas.setAttribute(\"height\",this.floatToInt(window.innerHeight*0.95));\n\n //update objects with the new size\n this.updateCharacterDim();\n this.updateVirusDim();\n this.updateSyringesDim();\n this.background.resize();\n\n }", "scaleCanvas() {\n this.canvas.setWidth(this.width);\n this.canvas.setHeight(this.height);\n this.canvas.renderAll();\n }", "resizeCanvas () {\n\t\tthis.width = this.canvas.width = window.innerWidth;\n\t\tthis.height = this.canvas.height = window.innerHeight;\n\t\tthis.center = {\n\t\t\tx: this.width / 2,\n\t\t\ty: this.height / 2\n\t\t};\n\n\t\t\t\t// Empty the previous container and fill it again with new CircleContainer\n\t\t\t\t// objects\n\t\tthis.circleContainers = [];\n\t\tthis.initializeCircleContainers();\n\t}", "function resize() {\n xMax = canvas.width;\n yMax = canvas.height;\n\n positionInstrumentCircles();\n\n getRun();\n tickChase();\n drawCircles();\n }", "function updateSize() {\n innerRadius = innerRadiusArg * canvas.width / 2;\n outerRadius = outerRadiusArg * canvas.width / 2;\n \n centerX = centerXArg * canvas.width;\n centerY = centerYArg * canvas.height;\n }", "function setUpCanvas() {\n /* clearing up the screen */\n clear();\n /* Set display size (vw/vh). */\n var sizeWidth = (80 * window.innerWidth) / 100,\n sizeHeight = window.innerHeight;\n //Setting the canvas site and width to be responsive\n upperLayer.width = sizeWidth;\n upperLayer.height = sizeHeight;\n upperLayer.style.width = sizeWidth;\n upperLayer.style.height = sizeHeight;\n lowerLayer.width = sizeWidth;\n lowerLayer.height = sizeHeight;\n lowerLayer.style.width = sizeWidth;\n lowerLayer.style.height = sizeHeight;\n rect = upperLayer.getBoundingClientRect();\n}", "function resize() {\n\t\t\tcanvas.width = container.offsetWidth;\n\t\t\tcanvas.height = container.offsetHeight;\n\t\t}", "resize() {\n if (this._isShutDown) return;\n this._canvas.width = window.innerWidth;\n this._canvas.height = window.innerHeight;\n this.redraw();\n }", "updateCanvasSize() {\n this.drawLines();\n }", "function setSize() {\n canvas.width = iOS ? screen.width : window.innerWidth;\n canvas.height = iOS ? screen.height : window.innerHeight;\n}", "function set_canvas_size() {\n canvas_width = the_canvas.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,\n canvas_height = the_canvas.height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\n }", "function setupAnimation(){\n\t// create canvas\n\tvar ctx = animation.persist.ctx = lib.canvas.create('canvas1');\n\n\twindow.requestAnimationFrame(animation.draw);\n}", "function resize_canvas() {\n\t\t\tcanvas_elem.width = window.innerWidth / 2;\n\t\t\tcanvas_elem.height = window.innerWidth / 2;\n\n\t\t\tupdate_needed = true;\n\t\t}", "fitCanvasToScreen() {\n this.canvas.width = window.innerWidth;\n this.canvas.height = window.innerHeight;\n this._rect = this.canvas.getBoundingClientRect(); // Update\n }", "function sizeCanvas() {\n var ratio = mMapHeight / mMapWidth;\n var width = window.innerWidth;\n var height = width * ratio;\n var canvas = $('#MapCanvas');\n canvas.css('width', width + 'px');\n canvas.css('height', height + 'px');\n\n document.getElementById(\"Instructions\").style.top = height + titleHeight - 8 + \"px\";\n\n // Save scale value for use with touch events.\n mCanvasScale = mMapWidth / width\n }", "updateConfig(canvas) {\n this.size = canvas.size;\n\n this.updateCache();\n }", "function updateCanvasSize() {\n canvasContainer.style.width = \"100vw\";\n var size = getCanvasSize();\n if (fullscreenCheckbox.checked) {\n canvasContainer.style.height = \"100%\";\n canvasContainer.style.maxWidth = \"\";\n canvasContainer.style.maxHeight = \"\";\n }\n else {\n size[1] = size[0] * maxHeight / maxWidth;\n canvasContainer.style.height = inPx(size[1]);\n canvasContainer.style.maxWidth = inPx(maxWidth);\n canvasContainer.style.maxHeight = inPx(maxHeight);\n }\n if (size[0] !== lastCanvasSize[0] || size[1] !== lastCanvasSize[1]) {\n lastCanvasSize = getCanvasSize();\n for (var _i = 0, canvasResizeObservers_1 = canvasResizeObservers; _i < canvasResizeObservers_1.length; _i++) {\n var observer = canvasResizeObservers_1[_i];\n observer(lastCanvasSize[0], lastCanvasSize[1]);\n }\n }\n }", "function setupCanvasSize() {\n margin = {top: 20, left: 80, bottom: 20, right: 100};\n width = 350 - margin.left - margin.right;\n height = 300 - margin.top - margin.bottom;\n}", "function _adjustCanvasBounds() {\n\t\t\tvar parentSize = canvas.parentNode.getBoundingClientRect();\n\t\t\tcanvas.width = parentSize.width;\n\t\t\tcanvas.height = parentSize.height;\n\t\t}", "function reescalaCanvas(){\n canvas.style.width = widthCanvasAmpliado + 'px';\n canvas.style.height = heightCanvasAmpliado + 'px';\n}", "resetPos() {\r\n this.pos.x = width/2;\r\n this.pos.y = height/2;\r\n }", "function initCanvas(width, height){}", "resizeCanvas() {\n const containerWidth = this.worldContainer.offsetWidth;\n this.canvasWidth = containerWidth;\n this.canvasHeight = containerWidth;\n\n this.canvas.width = this.canvasWidth;\n this.canvas.height = this.canvasHeight;\n\n this.cellSize = this.canvasWidth / this.colNumber;\n this.renderWorld();\n }", "function canvasResizer(){\n variables.semlet().height=240;\n variables.semlet().width=400;\n variables.ctx().strokeStyle=\"white\";\n}", "function setup(){\n createCanvas(windowWidth,windowHeight);\n sizeX = 10;\n sizeY = 10;\n xIncrement = width/height;\n //frameRate(10);\n\n}", "function respondCanvas() { \n var container = $($canvas).parent();\n\n $canvas.attr('width', $(container).width() ); //max width\n $canvas.attr('height', $(container).height() ); //max height\n\n $tmpCanvas.attr('width', $(container).width() ); //max width\n $tmpCanvas.attr('height', $(container).height() ); //max height\n }", "function setCanvas(){\r\n _canvas = document.getElementById('canvas');\r\n _stage = _canvas.getContext('2d');\r\n _canvas.width = _puzzleWidth;\r\n _canvas.height = _puzzleHeight;\r\n _canvas.style.border = \"1px solid black\";\r\n}", "function doResize()\n{\n\tcanvas.width = window.innerWidth;\n\tcanvas.height = window.innerHeight;\n}", "_setSize() {\n this.colorPickerCanvas.style.width = '100%';\n this.colorPickerCanvas.style.height = '100%';\n\n this.colorPickerCanvas.width = 289 * this.pixelRatio;\n this.colorPickerCanvas.height = 289 * this.pixelRatio;\n }", "function changeSettings() {\n originalWidth = width;\n originalHeight = height;\n xCentreCoord = 0;\n yCentreCoord = 0;\n }", "function resizeCanvas() {\n\t\tcanvas.width = (window.innerWidth) - 150;\n\t\tcanvas.height = (window.innerHeight) - 100;\n\t\tredraw();\n\t}", "function setup() {\n centerCanvas(); //make the canvas as big as the window\n frameRate(framesPerSecond);\n}", "function updateCanvas() {\n ctx.clearRect(0, 0, 430, 430);\n fillCanvas();\n }", "function resizeCanvas() {\n\tvar newHeight = window.innerHeight;\n\tvar newWidth = initWidth/initHeight * newHeight;\n\tcanvas.setWidth(newWidth);\n\tcanvas.setHeight(newHeight);\n\tcanvas.calcOffset();\n}", "function resizeCanvas() {\n canvas.height = window.innerHeight * 0.95;\n canvas.width = window.innerWidth * 0.95;\n stage.update();\n }", "function repositionCanvas(){\n let canvas = document.getElementById('canvas');\n let img = document.getElementById('image');\n \n canvas.width = img.clientWidth;\n canvas.height = img.clientHeight;\n\n redrawPaths();\n}", "resizeCanvas () {\n if (this._type === Sandpit.CANVAS && window.devicePixelRatio !== 1 && this._retina) {\n this._handleRetina()\n } else {\n this._canvas.width = this._canvas.clientWidth\n this._canvas.height = this._canvas.clientHeight\n }\n if (this._type === Sandpit.WEBGL || this._type === Sandpit.EXPERIMENTAL_WEBGL) {\n this._context.viewport(0, 0, this._context.drawingBufferWidth, this._context.drawingBufferHeight)\n }\n if (this.change) this.change()\n }", "function initCanvas() {\n let canvasWidth = miniViewWidth * 5.5 + 2\n let canvasHeight = 725\n canvas.style.width = canvasWidth + 'px'\n canvas.style.height = canvasHeight + 'px'\n let scale = window.devicePixelRatio\n canvas.width = canvasWidth * scale\n canvas.height = canvasHeight * scale\n ctx.scale(scale, scale)\n }", "function start() {\n var canvas = document.getElementById('can');\n var context = canvas.getContext(\"2d\");\n $('#can').css('width', '100');\n $('#can').css('height', '100');\n $('#can').css('top', '0');\n $('#can').css('left', '0');\n $('#can').css('z-index', '-1');\n canvas.width = 100;\n canvas.height = 100;\n var draw = false;\n}", "function setupCanvasSize() {\r\n margin = {top: 100, left: 180, bottom: 120, right: 130};\r\n width = 960 - margin.left - margin.right;\r\n height = 800 - margin.top - margin.bottom;\r\n}", "function setSize(){\n\t\tif(window.innerWidth > window.innerHeight * (2/1)){\n\t\t\tcanvas.style.height = window.innerHeight + \" px\";\n\t\t\tcanvas.style.width = window.innerHeight * (2/1);\n\t\t}else{\n\t\t\tcanvas.style.height = window.innerHeight * (1/2) + \" px\";\n\t\t\tcanvas.style.width = window.innerHeight + \" px\";\n\t\t}\n\t}", "function resizeCanvas() {\n htmlCanvas.width = window.innerWidth;\n htmlCanvas.height = window.innerHeight;\n updateBalls();\n redraw();\n}", "function sizer(){\n //update object\n å.screen.x = window.innerWidth;\n å.screen.y = window.innerHeight;\n //update canvas size\n canvas.width = å.screen.x;\n canvas.height = å.screen.y;\n}", "function setup_canvas(){\n ball_canvas.canvas = document.getElementById(\"ball_canvas\");\n if (ball_canvas.canvas.getContext){\n ball_canvas.context = ball_canvas.canvas.getContext('2d');\n ball_canvas.canvas.width = 400;\n ball_canvas.canvas.height = 400;\n }\n ball_visual.centre_x = ball_canvas.canvas.width / 2;\n ball_visual.centre_y = ball_canvas.canvas.height / 2;\n ball_visual.radius = 180;\n ball_visual.window_radius = 90;\n}", "clearCanvas(){\n this.canvas.width = this.canvas.width;\n }", "function canvas_resize()\n{\n canvas.style.width = window.innerWidth + 'px';\n canvas.style.height = window.innerHeight + 'px';\n}", "function updateSize() {\n\t\t// $log.log(preDebugMsg + \"updateSize\");\n\t\tfontSize = parseInt($scope.gimme(\"FontSize\"));\n\t\tif(fontSize < 5) {\n\t\t\tfontSize = 5;\n\t\t}\n\n\t\tvar rw = $scope.gimme(\"DrawingArea:width\");\n\t\tif(typeof rw === 'string') {\n\t\t\trw = parseFloat(rw);\n\t\t}\n\t\tif(rw < 1) {\n\t\t\trw = 1;\n\t\t}\n\n\t\tvar rh = $scope.gimme(\"DrawingArea:height\");\n\t\tif(typeof rh === 'string') {\n\t\t\trh = parseFloat(rh);\n\t\t}\n\t\tif(rh < 1) {\n\t\t\trh = 1;\n\t\t}\n\n\t\tvar bgDirty = false;\n\t\tif(bgCanvas === null) {\n\t\t\tbgDirty = true;\n\t\t\tvar myCanvasElement = $scope.theView.parent().find('#theBgCanvas');\n\t\t\tif(myCanvasElement.length > 0) {\n\t\t\t\tbgCanvas = myCanvasElement[0];\n\t\t\t} else {\n\t\t\t\t//$log.log(preDebugMsg + \"no canvas to resize!\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif(bgCanvas.width != rw) {\n\t\t\tbgDirty = true;\n\t\t\tbgCanvas.width = rw;\n\t\t}\n\t\tif(bgCanvas.height != rh) {\n\t\t\tbgDirty = true;\n\t\t\tbgCanvas.height = rh;\n\t\t}\n\n\t\tvar plotDirty = false;\n\t\tif(plotCanvas === null) {\n\t\t\tplotDirty = true;\n\t\t\tvar myCanvasElement = $scope.theView.parent().find('#thePlotCanvas');\n\t\t\tif(myCanvasElement.length > 0) {\n\t\t\t\tplotCanvas = myCanvasElement[0];\n\t\t\t} else {\n\t\t\t\t//$log.log(preDebugMsg + \"no canvas to resize!\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif(plotCanvas.width != rw) {\n\t\t\tplotDirty = true;\n\t\t\tplotCanvas.width = rw;\n\t\t}\n\t\tif(plotCanvas.height != rh) {\n\t\t\tplotDirty = true;\n\t\t\tplotCanvas.height = rh;\n\t\t}\n\n\t\tvar axesDirty = false;\n\t\tif(axesCanvas === null) {\n\t\t\taxesDirty = true;\n\t\t\tvar myCanvasElement = $scope.theView.parent().find('#theAxesCanvas');\n\t\t\tif(myCanvasElement.length > 0) {\n\t\t\t\taxesCanvas = myCanvasElement[0];\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//$log.log(preDebugMsg + \"no canvas to resize!\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tif(axesCanvas.width != rw) {\n\t\t\taxesDirty = true;\n\t\t\taxesCanvas.width = rw;\n\t\t}\n\t\tif(axesCanvas.height != rh) {\n\t\t\taxesDirty = true;\n\t\t\taxesCanvas.height = rh;\n\t\t}\n\n\t\tif(dropCanvas === null) {\n\t\t\tvar myCanvasElement = $scope.theView.parent().find('#theDropCanvas');\n\t\t\tif(myCanvasElement.length > 0) {\n\t\t\t\tdropCanvas = myCanvasElement[0];\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//$log.log(preDebugMsg + \"no canvas to draw on!\");\n\t\t\t}\n\t\t}\n\t\tif(dropCanvas) {\n\t\t\tdropCanvas.width = rw;\n\t\t\tdropCanvas.height = rh;\n\t\t}\n\n\t\tif(selectionCanvas === null) {\n\t\t\tvar selectionCanvasElement = $scope.theView.parent().find('#theSelectionCanvas');\n\t\t\tif(selectionCanvasElement.length > 0) {\n\t\t\t\tselectionCanvas = selectionCanvasElement[0];\n\t\t\t}\n\t\t\telse {\n\t\t\t\t//$log.log(preDebugMsg + \"no selectionCanvas to resize!\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tselectionCanvas.width = rw;\n\t\tselectionCanvas.height = rh;\n\t\tselectionCanvas.style.left = 0;\n\t\tselectionCanvas.style.top = 0;\n\n\t\tif(selectionHolderElement === null) {\n\t\t\tselectionHolderElement = $scope.theView.parent().find('#selectionHolder');\n\t\t}\n\t\tselectionHolderElement.width = rw;\n\t\tselectionHolderElement.height = rh;\n\t\tselectionHolderElement.top = 0;\n\t\tselectionHolderElement.left = 0;\n\n\t\tvar selectionRectElement = $scope.theView.parent().find('#selectionRectangle');\n\t\tselectionRectElement.width = rw;\n\t\tselectionRectElement.height = rh;\n\t\tselectionRectElement.top = 0;\n\t\tselectionRectElement.left = 0;\n\t\tif(selectionRectElement.length > 0) {\n\t\t\tselectionRect = selectionRectElement[0];\n\t\t\tselectionRect.width = rw;\n\t\t\tselectionRect.height = rh;\n\t\t\tselectionRect.top = 0;\n\t\t\tselectionRect.left = 0;\n\t\t}\n\n\t\tvar W = selectionCanvas.width;\n\t\tvar H = selectionCanvas.height;\n\t\tdrawW = W - leftMarg - rightMarg;\n\t\tdrawH = H - topMarg - bottomMarg * 2 - fontSize;\n\n\t\t// $log.log(preDebugMsg + \"updateSize found selections: \" + JSON.stringify(selections));\n\t\t// $log.log(preDebugMsg + \"updateSize updated selections to: \" + JSON.stringify(selections));\n\t}", "_resize() {\n this.aspect = this._context.canvas.width / this._context.canvas.height;\n this.dirty = true;\n }", "function resizeHandler() {\n\t\tcanvas.setAttribute('width', document.documentElement.offsetWidth);\n\t\tcanvas.setAttribute('height', document.documentElement.offsetHeight);\n\t}", "function clearCanvas() {\r\n canvas.width = 750;\r\n canvas.height = 500;\r\n}", "function resizeCanvas() {\n\t\tcanvas.width = (window.innerWidth) * .67;\n\t\tcanvas.height = (window.innerHeight) * .69;\n\t\tredraw();\n\t}", "function x() {\n fakecontext.drawImage(canvas, 0, 0);\n $('#can').css('height', Number($('#can').css('height').replace('px', '')) + 20);\n canvas.height += 20;\n context.drawImage(fakecanvas, 0, 0);\n fakecanvas.height += 20;\n }", "function resize() {\n canvas.height = window.innerHeight\n canvas.width = window.innerWidth\n }", "_resize() {\n const ratio = window.devicePixelRatio || 1;\n const width = window.innerWidth;\n const height = window.innerHeight;\n\n if (this.options.dpi) {\n this.width = width * ratio;\n this.height = height * ratio;\n } else {\n this.width = width;\n this.height = height;\n }\n\n this._canvas.width = this.width;\n this._canvas.height = this.height;\n\n this._canvas.style.width = width + 'px';\n this._canvas.style.height = height + 'px';\n }", "_updateRendering() {\n this._domElement.style.width = this._width + 'px'\n this._domElement.style.height = this._height + 'px'\n this._adjustAll()\n }", "function setCanvasAndTextSize() {\n if (windowWidth > 1529) {\n canvasWidth = 1200;\n canvasHeight = 800;\n currTextSize = 64;\n offset = 100;\n } else if (windowWidth > 929) {\n canvasWidth = 900;\n canvasHeight = 600;\n currTextSize = 48;\n offset = 75;\n } else {\n canvasWidth = 600;\n canvasHeight = 400;\n currTextSize = 32;\n offset = 50;\n }\n}", "function init(){\n\tw = window.innerWidth;\n\th = window.innerHeight;\n\n\timage_canvas.width = w;\n\timage_canvas.height = h;\n\n\tseek_canvas.width = image_canvas.width * (4/5);\n\tseek_canvas.height = 40;\n\n\tseek_overlay_canvas.width = seek_canvas.width;\n\tseek_overlay_canvas.height = seek_canvas.height;\n\n\tseek_canvas.relativeX = image_canvas.width * (1/10);\n\tseek_canvas.relativeY = image_canvas.height - seek_canvas.height - 50;\n}", "initCanvas() { \n\t\tthis.canvas = document.getElementById(\"canvas\");\n\t\tthis.canvas.width = this.level.getNumBlocksRow * Block.SIZE + (2 * Sprite.SIDE_LR_WIDTH);\n\t\tthis.canvas.height = this.level.getNumBlocksColumn * Block.SIZE + (3 * Sprite.SIDE_TMD_HEIGHT) + Sprite.PANEL_HEIGHT;\n\t\tthis.ctx = this.canvas.getContext(\"2d\");\t\n\t}", "function setupCanvasSize() {\n margin = {top: 0, left: 80, bottom: 20, right: 30};\n width = 960 - margin.left - margin.right;\n height = 120 - margin.top - margin.bottom;\n}", "function resizeCanvas () {\n canvasWidth = canvas.offsetWidth;\n canvasHeight = canvas.offsetHeight;\n canvas.width = canvasWidth;\n canvas.height = canvasHeight;\n pixelsPerUnit = canvasWidth / 10;\n}", "function cleanCanvas(){\r\n\tcanvas.width=ancho;\r\n\tcanvas.height=alto;\r\n}", "function setBounds() {\n let el = angular.element(canvas);\n\n //set initial style\n if ( scope.options.layout.height === \"inherit\" ) {\n let viewHeight = view.getHeight();\n el.css(\"height\", `${viewHeight}px`);\n el.attr(\"height\", `${viewHeight * view.scale}px`);\n } else {\n el.css(\"height\", `${scope.options.layout.height}px`);\n el.attr(\"height\", `${scope.options.layout.height * view.scale}px`);\n }\n //set initial style\n if ( scope.options.layout.width === \"inherit\" ) {\n let viewWidth = view.getWidth();\n el.css(\"width\", `${viewWidth}px`);\n el.attr(\"width\", `${viewWidth * view.scale}px`);\n } else {\n el.css(\"width\", `${scope.options.layout.width}px`);\n el.attr(\"width\", `${scope.options.layout.width * view.scale}px`);\n }\n }", "function reLayout() {\n var newHeight, newWidth;\n // Figure out what is limiting the size of our container and resize accordingly\n if ($(\"body\").height() * CANVAS_RATIO > $(\"body\").width()) {\n // Limited by width\n newWidth = $(\"body\").width();\n newHeight = $(\"body\").width() / CANVAS_RATIO;\n } else {\n // Limited by height\n if ($(\"body\").height() < parseInt($(\"#draw-container\").css(\"min-height\"))) {\n newWidth = $(\"#draw-container\").css(\"min-height\") * CANVAS_RATIO;\n newHeight = $(\"#draw-container\").css(\"min-height\");\n } else {\n newWidth = $(\"body\").height() * CANVAS_RATIO;\n newHeight = $(\"body\").height();\n }\n }\n\n $(\"#draw-container\").css({\"width\" : newWidth, \"height\": newHeight});\n $(canvas).css({\"width\": newWidth, \"height\": newHeight});\n\n // Save some info about the canvas for later calculations\n canvas.offsetX = $(canvas).offset()[\"left\"];\n canvas.offsetY = $(canvas).offset()[\"top\"];\n }", "function resize() {\n width = canvas.width = window.innerWidth;\n height = canvas.height = window.innerHeight - 60;\n }", "setCanvasDimensions(canvasWidth, canvasHeight) {\n\t\tthis.canvasWidth = canvasWidth;\n\t\tthis.canvasHeight = canvasHeight;\n\t}", "reset(canvas){\n this.x = Math.floor(Math.random() * (canvas.width - 50));\n this.y = Math.floor(Math.random() * (canvas.height - 50));\n }", "function setCanvasScale(scale) {\n\tcanvasScale = scale;\n\tcenterX = 525 * canvasScale;\n\tcenterY = 550 * canvasScale;\n\t$('canvas').attr('width' , 1050 * scale);\n\t$('canvas').attr('height', 510 * scale);\n\t$.jCanvas.defaults.strokeWidth = 2 * canvasScale;\n}", "resizeCanvases() {\n if (this.imageCanvas) {\n this.imageCanvas.width = this.lineCanvas.width = document.body.clientWidth;\n this.imageCanvas.height = this.lineCanvas.height = window.innerHeight;\n }\n }", "function onResize() {\n canvas.width = window.innerWidth;\n canvas.height = window.innerHeight;\n width = canvas.width;\n height = canvas.height;\n }", "render() {\n this.canvas.height = this.canvas.clientHeight;\n this.canvas.width = this.canvas.clientWidth;\n\n window.addEventListener('resize', this.render)\n }", "setCanvasSize(width, height) {\n this.width = width;\n this.height = height;\n this.landscape = this.width>=this.height;\n this.circleX = this.width / 2.0;\n this.circleY = this.height * 0.380;\n //this.circleY = this.height * 0.420;\n this.circleRadius = this.height * 0.310;\n if (this.circleRadius > this.width/2.0 - 15)\n this.circleRadius = this.width/2.0 - 15;\n //this.circleRadius = this.width * (375.0/480.0)/2.0;\n }", "function _adjustCanvasFidelity() {\n\t\t\tcanvas.style.width = canvas.width + \"px\";\n\t\t\tcanvas.style.height = canvas.height + \"px\";\n\t\t\tcanvas.width *= pixelRatio;\n\t\t\tcanvas.height *= pixelRatio;\n\t\t}", "function resizeCanvases() {\n imageCanvas.width = lineCanvas.width = window.innerWidth;\n imageCanvas.height = lineCanvas.height = window.innerHeight;\n}", "function setupCanvasSize() {\n margin = {top: 20, left: 80, bottom: 20, right: 30};\n width = 960 - margin.left - margin.right;\n height = 520 - margin.top - margin.bottom;\n}", "onLayout() {\n super.onLayout()\n\n // Update canvas size\n var density = window.devicePixelRatio || 1\n var box = this.canvas.getBoundingClientRect()\n this.canvas.width = box.width * density\n this.canvas.height = box.height * density\n\n }", "function windowResized() {\n centerCanvas();\n}", "setScale() {\n document.body.style.width = `${this.w}px`;\n document.body.style.height = `${this.h}px`;\n // style used on html els and not for canvas, since canvas css doesn't determine actual available coords -- actual obj size defaults to 300x150 n if only css is changed it just scales from that n looks rly bad\n canvas.width = this.w;\n canvas.height = this.h;\n\n road.draw();\n }", "constructor(canvasId, pxSize) {\n this.canvas = document.getElementById(canvasId);\n this.pixelSize = pxSize;\n this.ctx = this.canvas.getContext(\"2d\");\n\n this.resizeCanvas();\n\n //this.lastFrameTime = Date.now();\n\n fpsInterval = TARGET_FPS / 1000;\n\n this.updateLoop = this.updateLoop.bind(this);\n window.requestAnimationFrame(this.updateLoop);\n\n window.addEventListener('resize', () => {\n this.resizeCanvas();\n });\n }", "function borraCanvas(){\n \n canvas.width=500\n canvas.height=500\n\n\n}", "function init() {\n clearCanvas()\n drawBackgroundColor()\n drawOrigin()\n }", "set canvas(canvas){\n this._canvas = canvas;\n this.createStarship();\n }" ]
[ "0.75288343", "0.742607", "0.69726217", "0.69726217", "0.69273144", "0.6848055", "0.6791445", "0.66832364", "0.6642979", "0.66321373", "0.66212213", "0.66188926", "0.6609722", "0.65976095", "0.658687", "0.6559662", "0.6556843", "0.6542627", "0.6540094", "0.6537532", "0.6521248", "0.65125865", "0.6499169", "0.6469619", "0.6459695", "0.6458194", "0.6455261", "0.64286876", "0.64194363", "0.6413802", "0.63999116", "0.6398685", "0.639669", "0.63948697", "0.639468", "0.6391734", "0.6374543", "0.6367634", "0.63656515", "0.6352726", "0.635258", "0.6345413", "0.6332", "0.6331357", "0.6310232", "0.6304193", "0.6297574", "0.6296929", "0.62966734", "0.62961006", "0.6293362", "0.6257616", "0.6246619", "0.6242381", "0.6240441", "0.62401384", "0.6231397", "0.6208409", "0.6203454", "0.6202953", "0.6190124", "0.6179464", "0.61772937", "0.6159897", "0.61587644", "0.6157839", "0.615713", "0.61547333", "0.6154727", "0.6152515", "0.61508304", "0.61453974", "0.6144062", "0.61437255", "0.61300594", "0.6129509", "0.6128394", "0.6128338", "0.6127386", "0.6117171", "0.6105787", "0.61051494", "0.610386", "0.6095882", "0.6090243", "0.6082316", "0.607794", "0.6061638", "0.6050164", "0.6049398", "0.6049027", "0.60474175", "0.60453516", "0.60431635", "0.604294", "0.60413396", "0.604094", "0.60396296", "0.6038661", "0.60363203", "0.60340303" ]
0.0
-1
Gets called 60 times per second
function draw() { // Clear the canvas clear(); // Draw all pipes for (let i = 0; i < pipes.length; i++) pipes[i].draw(i); // If (60 / fps) frames have passed if (frameCounter++ > 60 / fps) { frameCounter %= 60 / fps; // Call the next animation and increment the animationIndex if it returns true or else decrement if (animations[animationIndex]()) animationIndex = (animationIndex + 1) % animations.length; else animationIndex--; if (focusedPipeIndex === pipesAmount) noLoop(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateTimeEveryMinute() {\n time.increment();\n flipClock(time.copy());\n setTimeout(updateTimeEveryMinute, 60000);\n }", "function updateEveryMinute() {\n var interval = setInterval(update, 1000 * 60)\n}", "function refresh () {\n // If the ticker is not running already...\n if (ticker === 0) {\n // Let's create a new one!\n ticker = self.setInterval(render, Math.round(1000 / 60));\n }\n }", "function refreshGamesEachSec() {\n setInterval(refreshGameStatus, 1000);\n}", "function run() {\n update();\n setInterval(update, 3600000);\n}", "function refreshLoop(){\n refreshInterval = setInterval(function(){ \n mlurl = matchlistURL+user;\n postRequest(createMatches,mlurl, true)\n }, 45000);\n}", "function _clockTicks() {\n\t\tfor (var i = 0; i < 60; i+= 1) {\n\t\t\t_addClockTick.call(this, i);\n\t\t}\n\t}", "function run() {\r\n\t intervalId = setInterval(startClock, 1000);\r\n \t}", "function printMsgRepeated(){\n console.log(\"This msg is fired every 1s\");\n}", "function reClock() {\n self.clock();\n }", "start() {\n // initiliaze a time var for the starting time of the invocation\n\n // set the interval\n interval = setInterval(() => {\n // check if the time value is greater than 60 if true reset the value to 1\n if (time > 60) time = 1;\n //with invoking setInterval: inkoking the cb as first para\n this.cb(time);\n // increment the time to the next second\n time++;\n // time interval as second para\n }, 1000);\n }", "function runTimer() {\n round1timer = 30;\n intervalId = setInterval(timer, 500);\n}", "function runClock() {\n setInterval(function() {\n let now = new Date();\n updateClockDisplay(now);\n },60*1000);\n}", "function minuteMon(delay) {\n //setInterval does its first execution only after the required delay\n //meaning the clock, next arrival and minutes will miss for the first minute \n if (!firstTime) {\n retrieveData();\n firstTime += 1;\n } \n setInterval(function() {\n retrieveData();\n }, delay);\n}", "function controlLoop(){\r\n refreshData();\r\n setInterval(refreshData,10000);\r\n}", "start() {\n // Run immediately..\n this.runUpdate();\n\n // .. then schedule 15 min interval\n timers.setInterval(() => {\n this.runUpdate();\n }, 900000);\n }", "function startTimer() {\n stopTimer();\n if (timerId == 0) {\n timerId = setInterval(refresh_myActivity, 700); /* refresh rate in ms */\n }\n}", "function oneShot(firstCallback, callback, interval, context)\n {\n logNow(\"oneShot():\");\n firstCallback(context);\n context.timerIntervalObj = setInterval(callback, interval, context);\n }", "function refreshOn()\n{\n refreshInterval = setInterval(function () {refresh()}, 1000);\n}", "start() {\r\n this.update();\r\n setInterval(this.update.bind(this), 60000);\r\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 }", "scheduleRefresh() {}", "scheduleRefresh() {}", "function start30SecTimer(){\r\n\t\tconsole.log( new Date());\r\n\t\t//setTimeout(function(){ console.log( new Date()) }, 30000);\r\n\t\tconsole.log(\"START TIMER!!!!!!\");\r\n\t\tfor(var x = 6; x>1; x--){\r\n\t\t\tsetTimeout(function(){\r\n\t\t\t\t//sendOutCount(x);\r\n\t\t\t\tDom.emit('count',data={count:count});\r\n\t\t\t\tcount++;\r\n\t\t\t\t}, 2000);\r\n\t\t\t\r\n\t\t}\r\n\t\t//it just does console log and then comes back and do what it has left to do\r\n\t\t//console.log( new Date());\r\n\t}", "start() {\r\n this.update();\r\n setInterval(this.update.bind(this), 30 * 1000);\r\n }", "function startTime() {\n xCount = setInterval(getRandomQuote, 7500); \n}", "start() {\r\n this.update();\r\n setInterval(this.update.bind(this), 30000);\r\n }", "function runTimer () {\n CLOCK.innerHTML = Clock.printClock();\n millisecondsCounter += 10; //interval runs every 10 milliseconds\n secondsCounter = millisecondsCounter / 1000;\n Clock.updateTime();\n}", "startLoop() {\n this.intervalID = setInterval(() => {\n this.nextPhoto();\n }, 5000);\n }", "function runTimer(){\n var minutes = 1, the_interval = minutes * 60 * 1000;\n console.log(\"Running check every 1 minute ...\")\n checkStock();\n setInterval(function() {\n console.log(\"1 minute check\");\n checkStock();\n }, the_interval);\n}", "function timerola (){\n\tsetInterval(startGame,1000/60);\n}", "function startRefreshTimer() {\n // Stop the current timer\n stopRefreshTimer();\n\n // Determine the refresh delay, based on the connection state\n var connectionTimeout = GUESSES_REFRESH_TIMEOUT_CONNECTED;\n\n // Use a connection timer of 5 seconds if the last connection failed\n if(!lastRefreshState)\n connectionTimeout = GUESSES_REFRESH_TIMEOUT_DISCONNECTED;\n\n // Set up the timer\n guessesRefreshTimer = setInterval(function() {\n refreshGuessesLate();\n }, connectionTimeout);\n }", "function refreshClock() {\n $now = new Date($localTime.format('YYYY'), $localTime.format('M') - 1, $localTime.format('DD'), $localTime.format('hh'), $localTime.format('mm'), $localTime.format('ss'));\n $diff = Math.round(Math.abs($now.getTime() - $startTime.getTime()) / 1000);\n $degS = ($startS + $diff) / 60 * 360;\n $degM = ($startM + $diff) / 3600 * 360;\n $degH = ($startH + $diff) / 43200 * 360;\n\n $this.find('.hour').css(rotate($degH));\n $this.find('.minute').css(rotate($degM));\n $this.find('.second').css(rotate($degS));\n\n setTimeout(refreshClock, 1000);\n }", "loopUpdate(){\n setInterval(()=>{\n this.updateNow();\n },updateSecs*1000);\n }", "function startClock(){\n seconds++;\n}", "function mainLoop( ) {\n\n\n let segundos = 5;\n let tiempo = segundos * 1000;\n\n\n console.log('Intervalo de '+ segundos );\n console.log('Perioodo: ');\n\n\n REALTIME.actualizarREALTIME( );\n\n setInterval((tiempo) => {\n console.log('-------------------------------------------------------');\n console.log('Intervalo de REALTIME '+ segundos );\n console.log('PERIODO');\n REALTIME.actualizarREALTIME( );\n }, tiempo )\n\n}", "function increaseIntervalTime(){\n intervalTime = intervalTime + 1000;\n}", "static get schedule() {\n // once every hour\n return '* */1 * * *';\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}", "run() {\n this.fillSportListAndTick();\n this.timerID = setInterval(() => {\n this.tick();\n console.log(\"ctr = \"+this.ctr);\n if (this.ctr < (ONE_DAY_IN_MS / LIVE_TICK_INTERVAL)) {\n this.ctr = this.ctr + 1;\n } else {\n this.ctr = 1;\n }\n }, LIVE_TICK_INTERVAL);\n }", "function countup() {\n setTimeout('Increment()', 60);\n}", "function _doInterval() {\n _gcBlocksCache();\n\n if (_driver) {\n var pkg = system.DOWN.ARANGE;\n _driver.send(protocol.serialize(pkg));\n }\n}", "function coreTimer()\n{\n\t// If the document.hidden property doesn't work, this timer doesn't function\n\tif(typeof(document.hidden) != \"undefined\")\n\t{\n\t\tif(document.hidden != true)\n\t\t{\n\t\t\tcoreTimeCount++;\n\t\t}\n\t}\n\t\n\t// If you're logged in, run the user's update handlers\n\tif(typeof(JSUser) == \"string\")\n\t{\n\t\t// Notifications Updater\n\t\tif(coreTimeCount >= timers.notifications.next)\n\t\t{\n\t\t\ttimers.notifications.next = coreTimeCount + timers.notifications.interval;\n\t\t\trunNotifications();\n\t\t}\n\t\t\n\t\t// Friend Updater\n\t\tif(coreTimeCount >= timers.friends.next)\n\t\t{\n\t\t\ttimers.friends.next = coreTimeCount + timers.friends.interval;\n\t\t\trunFriendList();\n\t\t}\n\t\t\n\t\t// User Chat Updater\n\t\tif(coreTimeCount >= timers.userchat.next)\n\t\t{\n\t\t\ttimers.userchat.next = coreTimeCount + timers.userchat.interval;\n\t\t\trunUserChat();\n\t\t}\n\t}\n\t\n\t// Chat Updater\n\tif(coreTimeCount >= timers.chat.next)\n\t{\n\t\ttimers.chat.next = coreTimeCount + timers.chat.interval;\n\t\trunChatUpdate();\n\t}\n}", "runTimers() {\n\t\tfor (var timer in this.Vars._Timers) {\n\t\t\tif (this.Vars._timerMod % this.Vars._Timers[timer].freq === 0) {\n\t\t\t\tthis.Vars._Timers[timer].func.call()\n\t\t\t}\n\t\t}\n\t\tthis.Vars._timerMod++\n\t}", "init() {\n this.hrtimer = setInterval(this.hourTime, this.hourlyMs);\n this.daytimer = setInterval(this.dayTime, 24000);\n }", "componentDidMount() {\r\n this.getHeartRateData();\r\n this.getTime();\r\n\r\n this.timerID = setInterval(() => this.tick(),3000); // call every second\r\n }", "reset() {\n this.interval = 1000;\n }", "function loop(){\n Jobs.getAndDraw();\n setTimeout(function(){loop()}, 30000)\n }", "function startGameInterval() {\n drawCard();\n gameInterval = setInterval(drawCard, 3000);\n }", "componentDidMount() {\n this.update();\n setInterval(this.update.bind(this), 60000);\n }", "function setInterval() {\n esterification, 200\n}", "doGameTick() {\n setInterval(() => {\n this.incrementCatsFromCatladies();\n this.incrementCatsFromCatnip();\n console.log(\"Cats: \" + this.state.cats);\n }, 1000 / this.state.ticksPerSeconds)\n }", "tick() {\n let prevSecond = this.createDigits(this.vDigits(this.timeString()));\n\n this.checkAlarm();\n\n setTimeout(() => {\n this.get();\n this.update(cacheDOM.timeDisplay, this.createDigits(this.vDigits(this.timeString())), prevSecond);\n this.tick();\n }, 1000)\n }", "set interval(interval) {\n this.interval_ = interval < 17 ? 17 : interval; // 17 ~ 60fps\n }", "componentDidMount() {\n this.checkTimeInterval = setInterval(\n () => this.checkTime(),\n 1000 * 60\n )\n }", "function ten_second_interval( last_song_id ) {\n // Reload the number of days since the last discrepancy log\n // was filed\n daysSinceLastIncident();\n\n // Reload the number of web stream listeners\n $.getJSON( \"https://stream.wmtu.mtu.edu:8000/status-json.xsl\", undefined, czech_listeners );\n\n // Load new items into the trackback feed\n last_song_id = load_trackback( false, last_song_id );\n\n // Load new items into the Twitter request feed\n $.getJSON( \"./twitter.php?first=false\", function( data ) {\n var i = 0;\n cycleTwitterFeed( i, data, false );\n } );\n\n // Reload the image\n cycleImageFeed();\n\n // Check whether or not songs are being logged\n check_logging();\n\n // Run again in ten seconds\n setTimeout( ten_second_interval, 10000, last_song_id );\n}", "function run() {\n\tintervalId = setInterval(display, 60000);\n}", "function loop() {\n //between 5 and 10 minutes)\n let rand = Math.round(Math.random() * (12000000 - 600000)) + 600000;\n setTimeout(() => {\n createRandomAppointment();\n //get all db entries after creation\n getAppointments();\n loop();\n }, rand);\n}", "function setupUpdate() {\n setInterval(update, 600);\n}", "function startclockTime(){\n clockId = setInterval(() => {\n time++;\n displayTime();\n },1000);\n}", "function runTime() { \n intervalId = setInterval(decrementTime, 1000);\n }", "function updateIntervalTime(number) {\n if ( !isNaN(number) ) {\n // Change interval\n config.interval = Math.max(5, number);\n\n // Update text\n $('#abAutoRefreshText').text(i18n.msg('autoRefresh', config.interval).plain());\n\n // Restart cycle\n loadData();\n }\n }", "start () {\n\t\tthis.updateTask.setRepeating ((callback) => {\n\t\t\tthis.update (callback);\n\t\t}, App.HeartbeatPeriod * 4, App.HeartbeatPeriod * 8);\n\t}", "function init() {\n var interval = setInterval(handleRefresh, 3000);\n handleRefresh();\n}", "function startTimer(){\n\tconsole.log(\"startTimer\")\n interval = setInterval(function(){\n second++;\n if(second == 60){\n minute++;\n second = 0;\n }\n if(minute == 60){\n hour++;\n minute = 0;\n }\n timerClock.innerHTML = formatTime(hour) + \":\" + formatTime(minute) + \":\" + formatTime(second);\n },1000);\n}", "function refresh() {\n deleteCards();\n createNewDeck();\n createStars();\n moves = 0;\n second = 0;\n minute = 0;\n hour = 0;\n matchedCards = 0;\n timer.innerHTML = minute+\" min \"+second+\" sec\";\n}", "startTimer() {\n if (this.onStartCallback) {\n this.onStartCallback(this.timeRemaining);\n }\n\n this.tickWaktu();\n this.intervalId = setInterval(() => {\n this.tickWaktu();\n }, 20);\n }", "function realTime() {\r\n \t$(\"#clock\").html(moment().format(\"HH:mm:ss\"));\r\n \tif(moment().format(\"ss\") == 0) {\r\n \t\t// updates the train times on every minute\r\n \t\tclock();\r\n \t}\r\n}", "function startClock() {\n updateClock();\n setInterval(\"updateClock()\", 1000);\n}", "function callAtInterval() {\n apiSrvc.getData($rootScope.apiUrl + '/Default.aspx?remotemethodaddon=heartbeat').then(function (response) {\n });\n }", "function startCaching () {\n cachingInterval = setInterval(getBogPrice, CACHING_TIME)\n}", "tick() {\n if (this._rocketIntervalCount < 0) {\n this.launchRocket();\n\n this._rocketIntervalCount = this._rocketInterval;\n }\n\n this._rocketIntervalCount -=1;\n }", "componentDidMount() {\n this.callBackId = setInterval(this.setCallBackTime, 1000);\n this.promiseId = setInterval(this.setPromiseTime, 1000);\n this.awaitId = setInterval(this.setAwaitTime, 1000);\n }", "function timeTrack() {\r\n timer++;\r\n }", "function setTimers()\n{\n\ttimeID = window.setTimeout( \"updateAll()\", refreshRate );\n}", "function tickTheClock(){\n\n \n \n}", "function heartbeat(){\n setTimeout(function(){\n $.ajax({ url: \"/thumpthump\", cache: false,\n success: function(data){\n //Next beat\n heartbeat();\n }, dataType: \"json\"});\n }, 10000);//10secs\n}", "function updateCanvasTimer() {\r\n\r\n updateCanvas(timeHandler.getTimePeriods());\r\n setTimeout(updateCanvasTimer, 60000);\r\n\r\n}", "function startTimer() {\n if( started === false ) {\n\n // how to call a function every Nth seconds https://stackoverflow.com/questions/2170923/whats-the-easiest-way-to-call-a-function-every-5-seconds-in-jquery\n // for displaying milliseconds see https://codepen.io/_Billy_Brown/pen/dbJeh\n interval = setInterval(function() {\n //debugger\n time++;\n timer.innerHTML = calculateTime();\n }, 10);\n\n // toggle started as timer has been kicked off\n started = true;\n\n } else {\n stopTimer();\n\n }\n }", "function updateRSS () {\n setInterval(initialize, 1000 * 60 * 60 * 4); // runs Initialize ever 4 hours from first load\n}", "function increment() {\n\t\t// setActive(false);\n\t\t// this floor logic allows the adding of minutes to always round down the seconds\n\t\tconst newTimer = Math.floor((sessionTime + 60000) / 60000) * 60000;\n\t\t// setTimer(newTimer);\n\t\tsetSessionTime(newTimer);\n\t}", "start () {\n\t\tthis.updateTask.setRepeating ((callback) => {\n\t\t\tthis.update (callback);\n\t\t}, App.HeartbeatPeriod, App.HeartbeatPeriod * 2);\n\t}", "componentDidMount() {\n this._interval = setInterval(() => {\n this.webCall();\n }, 1000);\n }", "timer() {\n\t\tlet minutes = 20;\n\t\tlet minInMs = minutes * 60 * 1000;\n\n\t\tlet chrono = setInterval(() => {\n\n\t\t\tlet time = Date.now() - Number(sessionStorage.getItem(\"count\"));\n\n\t\t\tlet timeRemain = minInMs - time;\n\n\t\t\tlet minuteRemain = Math.floor(timeRemain / 1000 / 60)\n\t\t\tlet secondsRemain = Math.floor(timeRemain / 1000 % 60);\n\n\t\t\tif (String(secondsRemain).length === 1) {\n\t\t\t\tsecondsRemain = \"0\" + secondsRemain;\n\t\t\t}\n\t\t\tif (time < minInMs) {\n\t\t\t\t$(\"#time\").text(minuteRemain + \"min \" + secondsRemain + \"s\");\n\t\t\t} else {\n\t\t\t\tclearInterval(chrono);\n\t\t\t\tsessionStorage.clear();\n\t\t\t\t$(\"#booking-details\").hide();\n\t\t\t}\n\t\t}, 1000);\n\t}", "init() {\n return setInterval(() => {\n // Update loop for room\n // Not using at the moment, arbitrary interval time\n }, 1000); \n }", "_fbTimer() {\n this._timerPointer = setTimeout(() => {\n this._fbTimer();\n if (this._firstFrameReceived && !this._processingFrame && this._fps > 0) {\n this.requestFrameUpdate();\n }\n }, this._timerInterval)\n }", "function startInterval() {\n let collectionInterval = setInterval(calcAutoUpgrade, 3000);\n\n}", "_startScoreLoop() {\n\t\t\n\t\tthis._timer= setInterval(()=> {\n\n\t\t\tthis._addScore(this.pointsIncr.TIME[0]);\n\n\t\t}, this.pointsIncr.TIME[1]);\n\t}", "function reload_functions(){\n get_heart_rate();\n setTimeout(reload_functions, 1000);\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 mytick() {\n\t//console.log(\"from timer tick: \"+new Date() + \", and current count: \"+appTimer.currentCount);\n\tmyTime = moment().format(\"hh:mm:ss A\");\n\tmyDate = moment().format(\"dddd, MMMM DD, YYYY\");\n\n\tdocument.getElementById(\"timeDiv\").innerHTML = myTime;\n\tdocument.getElementById(\"dateDiv\").innerHTML = myDate;\n\tdocument.getElementById(\"timeLeft\").innerHTML = \"Seconds left until next refresh: \" + (secondsToNextRefresh--);\n\t//console.log(myDate+\" \"+myTime+\" timer current count: \"+appTimer.currentCount);\n\tif (appTimer.currentCount == dataRefreshInterval_seconds) {\n\n\t\t//refresh the MIM data\n\t\t//console.log('refreshing data');\n\t\t//proxy.getSegmentsMedianTravelTimes(\"00:15:00\", new Async(travelTimeDataSuccess, travelTimeDataError));\n\n\t\tgetTranscomLinkData();\n\t\tgetWifiLinkData();\n\n\t\t//reset the timer so the current count resets as well\n\t\tappTimer.Reset();\n\t\tdocument.getElementById(\"disclaimerDateTime\").innerHTML = moment().format('MMMM Do YYYY, h:mm:ss a');\n\t\tsecondsToNextRefresh = dataRefreshInterval_seconds;\n\t}\n\n}", "function schedulePulls() {\n interval = setInterval(postNew, routineFrequency);\n}", "setupTimer() {\n this.stopTimer();\n const secs = parseInt( this._options.interval );\n if ( !secs ) return;\n this._interval = setInterval( () => {\n if ( !this._options.enabled ) return;\n this.fetchNextHandler();\n }, 1000 * secs );\n }", "function startInterval() {\n setInterval(collectAutoUpgrades, 1000);\n}", "function timedRefresh() {\n if (!MAPP.refreshTimer) {\n MAPP.refreshTimer = setTimeout(insertHtml, 300);\n }\n}", "function shotclockTimer() {\n\tif(TIMER_SHOTCLOCK_STOPPED == false) {\n\t\tTIMER_SHOTCLOCK--;\n\t\tif(TIMER_SHOTCLOCK == 0) {\n\t\t\tTIMER_SHOTCLOCK_STOPPED = true;\n\t\t}\n\n\t\tsetShotclockTimer(TIMER_SHOTCLOCK);\n\t}\n}", "function startTimer(){\n timer= setInterval('updatePosts()',10000);\n\n }", "function startTimer() {\n /* The \"interval\" variable here using \"setInterval()\" begins the recurring increment of the\n secondsElapsed variable which is used to check if the time is up */\n interval = setInterval(function () {\n secondsElapsed--;\n // So renderTime() is called here once every second.\n renderTime();\n }, 1000);\n}", "startTick(){\n this.loop = setInterval(() => {\n this.tickEvent();\n }, 1000/this.tickPerSec);\n this.isTickStarted = true;\n }", "componentDidMount() {\n this.setUserList();\n this.setEmojiList();\n this.setMessages();\n this.setChannels();\n setInterval(() => this.setMessages(), 1000 * 30);\n setInterval(() => this.setUserList(), 1000 * 60 * 60 * 2);\n }" ]
[ "0.6989338", "0.6910424", "0.6772006", "0.67140764", "0.66397476", "0.6564741", "0.6493163", "0.64645714", "0.64138275", "0.6410152", "0.63766956", "0.6360742", "0.6347203", "0.6343222", "0.6321748", "0.63145185", "0.6313648", "0.63086504", "0.6308331", "0.6290789", "0.6255445", "0.62320864", "0.62320864", "0.6211207", "0.61980104", "0.6196302", "0.6188786", "0.6185845", "0.6180616", "0.6169582", "0.6148073", "0.6145622", "0.61379516", "0.6134436", "0.61330724", "0.6114985", "0.61134076", "0.611058", "0.6101777", "0.6101777", "0.609364", "0.6087753", "0.6076356", "0.6070271", "0.6063195", "0.6060738", "0.60489005", "0.6044766", "0.6044189", "0.60418093", "0.6037729", "0.6028539", "0.60271204", "0.6026904", "0.6025506", "0.60136825", "0.6013357", "0.6010187", "0.60056543", "0.5991473", "0.5985509", "0.5982945", "0.5978391", "0.5961667", "0.5960594", "0.59578377", "0.5955395", "0.59531", "0.5951455", "0.59437996", "0.5941528", "0.59388465", "0.5937423", "0.5932771", "0.5920689", "0.5919066", "0.59184206", "0.59094274", "0.590617", "0.5905485", "0.5905431", "0.5903209", "0.59018105", "0.59016055", "0.5900246", "0.58989316", "0.58954823", "0.5894194", "0.58931106", "0.58916616", "0.5881544", "0.587706", "0.587478", "0.5873643", "0.5867796", "0.58667725", "0.5866602", "0.5851582", "0.58498925", "0.58484066", "0.58480316" ]
0.0
-1
Scrambles the given array
function scramble(arr) { let scrambled = []; let maxI = arr.length; for (let i = 0; i < maxI; i++) { // Appends the value at a random index in arr to the scrambled array and deletes it from arr let randomIndex = Math.floor(Math.random() * arr.length); scrambled.push(arr.splice(randomIndex, 1)[0]); } return scrambled; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scramble(arr) {\n for (let i = arr.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * i);\n const temp = arr[i];\n arr[i] = arr[j];\n arr[j] = temp;\n }\n return arr;\n }", "function getScramble() {\n var moves = new Array();\n moves['r'] = new Array(\"R\", \"R'\", \"R2\");\n moves['l'] = new Array(\"L\", \"L'\", \"L2\");\n moves['u'] = new Array(\"U\", \"U'\", \"U2\");\n moves['d'] = new Array(\"D\", \"D'\", \"D2\");\n moves['f'] = new Array(\"F\", \"F'\", \"F2\");\n moves['b'] = new Array(\"B\", \"B'\", \"B2\");\n\n var limit = 25;\n var last = \"\";\n var scramble = \"\";\n var keys = \"\";\n\n for (var i = 1; i <= limit; i++) {\n keys = new Array(\"r\", \"l\", \"u\", \"d\", \"f\", \"b\");\n shuffle(keys);\n while (last == keys[0]) {\n shuffle(keys);\n }\n shuffle(moves[keys[0]]);\n move = moves[keys[0]][0];\n scramble += move + \" \";\n last = keys[0];\n } \n \n $$('.scramble .scramble-text').html( scramble);\n\n}", "function scrambleWord(word) {\n\t\n var charIndex = 0;\n //array of characters from the word\n wordArray = word.split(\"\");\n //empty array for scrambled word\n var scrambledArray = [];\n \n //scramble word\n while(wordArray.length > 0) {\n charIndex = Math.floor(Math.random()*wordArray.length);\n scrambledArray += wordArray[charIndex];\n wordArray.splice(charIndex,1);\n }\n\tscrambled = scrambledArray.toString();\n\n\tif (scrambled === word) {\n\t\tscrambleWord(word);\n\t}\n\n}", "function shufflePassword(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 shuffleCharacters(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 return array;\n}", "function scramble(){\n\tvar i,j,nameImage=0;\n\tvar tiles=new Array();\n\tfor(i=0;i<=numTiles;i++) tiles[i]=i;\n\ttiles[numTiles-1]=-1;tiles[numTiles-2]=-1;\n\tfor(i=0;i<height;i++){\n\t\tfor(j=0;j<wid;j++){\n\t\t\tk=Math.floor(Math.random()*tiles.length);\n\t\t\tposition[nameImage]=tiles[k];\n\t\t\tif(tiles[k]==numTiles) { blankx=j; blanky=i; }\n\t\t\ttiles[k]=tiles[tiles.length-1];\n\t\t\ttiles.length--;\n\t\t\tnameImage++;\n\t\t}\n\t}\n\tmode=1;\n\tfilltwo();\n}", "function mixCharacters(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 return array;\n}", "function rotateScramble (scramble) {\r\n const rotated = [\"R\", \"B\", \"L\", \"F\"];\r\n const rotation = Math.floor(Math.random()*4);\r\n for (let i = 0; i < scramble.length; i++) {\r\n let c = scramble.charAt(i);\r\n for (let j = 0; j < rotated.length; j++) {\r\n let r = rotated[j];\r\n if (c === r) {\r\n scramble = scramble.substring(0, i) + rotated[(j + rotation) % 4] + scramble.substring(i+1, scramble.length);\r\n }\r\n }\r\n }\r\n return scramble.replace(/^U./g, \"\").replace(/U.?$/g, \"\").trim();\r\n}", "function forceScrambleUpdate() {\n self.generateScramble();\n }", "function ramdomize(array) {\n var i, j, k;\n for (i = array.length - 1; i > 0; i--) {\n j = Math.floor(Math.random() * i);\n k = array[i];\n array[i] = array[j];\n array[j] = k;\n }\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 }", "unscramble( scrambled ) {\n this.target = scrambled;\n console.log( this.target );\n\n for (var i=this.rules.length-1; i >= 0; i--) {\n var rule = this.rules[i];\n this.useRuleToScramble( rule, true );\n }\n return this.target;\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 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}", "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) {\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 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 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 shuffle(wordArray) {\n let currentIndex = wordArray.length, temporaryValue, randomIndex;//for this example = 4\n while (0 !== currentIndex) {\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n temporaryValue = wordArray[currentIndex];\n wordArray[currentIndex] = wordArray[randomIndex];\n wordArray[randomIndex] = temporaryValue;\n }\n return wordArray;\n }", "function shuffle(array) {\n\n let currentIndex = array.length, temporaryValue, randomIndex;\n // While there remain elements to shuffle...\n while (0 !== currentIndex) {\n\n // Pick a remaining element...\n randomIndex = Math.floor(Math.random() * currentIndex);\n currentIndex -= 1;\n\n // And swap it with the current element.\n temporaryValue = array[currentIndex];\n array[currentIndex] = array[randomIndex];\n array[randomIndex] = temporaryValue;\n }\n\n // add slashes with every word\n let slashes = array.join(' / ');\n // make all words lowercase\n let lowerSlashes = slashes.toLowerCase()\n // console.log(typeof slashes)\n return '( ' + lowerSlashes + ' )'\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 const j = Math.floor(Math.random() * i);\n const 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) {\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 (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 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 shuffle(array) {\n let ran = Math.floor(Math.random() * array.length);\n for (let i = 0; i < array.length - 1; i++) {\n swap(array, i, ran);\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 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)\n const temp = array[i]\n array[i] = array[j]\n array[j] = temp\n }\n}", "function shuffle(array) {\n if(!(array instanceof Array)) {return 'Please pass an array.'}\n let temp;\n for(let i = 0; i < array.length; i++) {\n let toIndex = Math.floor(Math.random() * array.length);\n temp = array[toIndex];\n array[toIndex] = array[i];\n array[i] = 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)); //round down --> get cur position in array + 1 (next position)\n [array[i], array[j]] = [array[j], array[i]]; //swap those positions \n }\n return array;\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 }", "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 shuffleAnswers(array) { //just a function to shuffle elements of an array, found on stackoverflow\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) {\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 }", "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 (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 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 shuffleInplace (arr) {\n var j, tmp;\n for (var i = arr.length - 1; i > 0; i--) {\n j = baseRandInt(i + 1);\n tmp = arr[i];\n arr[i] = arr[j];\n arr[j] = tmp;\n }\n }", "function shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n let j = Math.floor(Math.random() * (i + 1)); // random index from 0 to i\n [array[i], array[j]] = [array[j], array[i]]; // swap elements\n }\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}", "function shuffle(array) {\r\n let currentIndex = array.length, temporaryValue, randomIndex;\r\n \r\n while (0 !== currentIndex) {\r\n randomIndex = Math.floor(Math.random() * currentIndex);\r\n currentIndex -= 1;\r\n \r\n temporaryValue = array[currentIndex];\r\n array[currentIndex] = array[randomIndex];\r\n array[randomIndex] = temporaryValue;\r\n }\r\n}", "function knuth_shuffle(array) {\t// https://github.com/coolaj86/knuth-shuffle\n\tvar currentIndex = array.length, temporaryValue, randomIndex;\n\t// While there rem\tain elements to shuffle...\n\twhile (0 !== currentIndex) {\n\t\t// Pick a remaining element...\n\t\trandomIndex = Math.floor(Math.random() * currentIndex);\n\t\tcurrentIndex -= 1;\n\t\t// And swap it with the current element.\n\t\ttemporaryValue = array[currentIndex];\n\t\tarray[currentIndex] = array[randomIndex];\n\t\tarray[randomIndex] = temporaryValue;\n\t}\n\treturn array;\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(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}", "function shuffle(){\n for (let i = char.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * i);\n const temp = char[i];\n char[i] = char[j];\n char[j] = temp;\n }\n}", "function shuffleWordOptions(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}", "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}", "function scramble(haystack, needle) {\n const needleSeen = {};\n \n for (let i = 0; i < needle.length; i++) {\n needleSeen[needle[i]] = needleSeen[needle[i]] >= 1 ?\n needleSeen[needle[i]] + 1 :\n 1;\n }\n \n for (let j = 0; j < haystack.length; j++) {\n if (needleSeen[haystack[j]]) {\n needleSeen[haystack[j]] -= 1;\n }\n }\n \n return Object.keys(needleSeen).every(letter => needleSeen[letter] === 0);\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 }", "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(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 applyShuffle (array) {\n const deck = document.querySelector('.deck');\n removeElements(array, deck);\n for(const index of array) {\n deck.appendChild(index)\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 }\n }", "setScrambleKey(_key) {}", "function shuffle(array) {\n for (let i = array.length - 1; i > 0; --i) {\n let rand = Math.floor(Math.random() * (i + 1));\n array = swap(array, i, rand);\n }\n return array;\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 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 slv_shuffle(a) {\n for (var i = a.length - 1; i >= 1; i--) {\n var j = Math.floor(Math.random() * (i + 1));\n if (j < i) {\n var tmp = a[j];\n a[j] = a[i];\n a[i] = tmp;\n }\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 return array;\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 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 }", "function getpyraoptscramble(mn) {\n var j = 1, b = [], g = [], f = [], d = [], e = [], k = [], h = [], i = [];\n\n function u() {\n var c, p, q, l, m;\n for (p = 0; p < 720; p++) {\n g[p] = -1;\n d[p] = [];\n for (m = 0; m < 4; m++)d[p][m] = w(p, m)\n }\n g[0] = 0;\n for (l = 0; l <= 6; l++)for (p = 0; p < 720; p++)if (g[p] == l)for (m = 0; m < 4; m++) {\n q = p;\n for (c = 0; c < 2; c++) {\n q = d[q][m];\n if (g[q] == -1)g[q] = l + 1\n }\n }\n for (p = 0; p < 2592; p++) {\n f[p] = -1;\n e[p] = [];\n for (m = 0; m < 4; m++)e[p][m] = x(p, m)\n }\n f[0] = 0;\n for (l = 0; l <= 5; l++)for (p = 0; p < 2592; p++)if (f[p] == l)for (m = 0; m < 4; m++) {\n q = p;\n for (c = 0; c < 2; c++) {\n q = e[q][m];\n if (f[q] == -1)f[q] = l + 1\n }\n }\n for (c = 0; c < j; c++) {\n k = [];\n var t = 0, s = 0;\n q = 0;\n h = [0, 1, 2, 3, 4, 5];\n for (m = 0; m < 4; m++) {\n p = m + n(6 - m);\n l = h[m];\n h[m] = h[p];\n h[p] = l;\n if (m != p)s++\n }\n if (s % 2 == 1) {\n l = h[4];\n h[4] = h[5];\n h[5] = l\n }\n s = 0;\n i = [];\n for (m = 0; m < 5; m++) {\n i[m] = n(2);\n s += i[m]\n }\n i[5] = s % 2;\n for (m = 6; m < 10; m++) {\n i[m] = n(3)\n }\n for (m = 0; m < 6; m++) {\n l = 0;\n for (p = 0; p < 6; p++) {\n if (h[p] == m)break;\n if (h[p] > m)l++\n }\n q = q * (6 - m) + l\n }\n for (m = 9; m >= 6; m--)t = t * 3 + i[m];\n for (m = 4; m >= 0; m--)t = t * 2 + i[m];\n if (q != 0 || t != 0)for (m = mn; m < 99; m++)if (v(q, t, m, -1))break;\n b[c] = \"\";\n for (p = 0; p < k.length; p++)b[c] += [\"U\", \"L\", \"R\", \"B\"][k[p] & 7] + [\"\", \"'\"][(k[p] & 8) / 8] + \" \";\n var a = [\"l\", \"r\", \"b\", \"u\"];\n for (p = 0; p < 4; p++) {\n q = n(3);\n if (q < 2)b[c] += a[p] + [\"\", \"'\"][q] + \" \"\n }\n }\n }\n\n function v(q, t, l, c) {\n if (l == 0) {\n if (q == 0 && t == 0)return true\n } else {\n if (g[q] > l || f[t] > l)return false;\n var p, s, a, m;\n for (m = 0; m < 4; m++)if (m != c) {\n p = q;\n s = t;\n for (a = 0; a < 2; a++) {\n p = d[p][m];\n s = e[s][m];\n k[k.length] = m + 8 * a;\n if (v(p, s, l - 1, m))return true;\n k.length--\n }\n }\n }\n return false\n }\n\n function w(p, m) {\n var a, l, c, s = [], q = p;\n for (a = 1; a <= 6; a++) {\n c = Math.floor(q / a);\n l = q - a * c;\n q = c;\n for (c = a - 1; c >= l; c--)s[c + 1] = s[c];\n s[l] = 6 - a\n }\n if (m == 0)y(s, 0, 3, 1);\n if (m == 1)y(s, 1, 5, 2);\n if (m == 2)y(s, 0, 2, 4);\n if (m == 3)y(s, 3, 4, 5);\n q = 0;\n for (a = 0; a < 6; a++) {\n l = 0;\n for (c = 0; c < 6; c++) {\n if (s[c] == a)break;\n if (s[c] > a)l++\n }\n q = q * (6 - a) + l\n }\n return q\n }\n\n function x(p, m) {\n var a, l, c, t = 0, s = [], q = p;\n for (a = 0; a <= 4; a++) {\n s[a] = q & 1;\n q >>= 1;\n t ^= s[a]\n }\n s[5] = t;\n for (a = 6; a <= 9; a++) {\n c = Math.floor(q / 3);\n l = q - 3 * c;\n q = c;\n s[a] = l\n }\n if (m == 0) {\n s[6]++;\n if (s[6] == 3)s[6] = 0;\n y(s, 0, 3, 1);\n s[1] ^= 1;\n s[3] ^= 1\n }\n if (m == 1) {\n s[7]++;\n if (s[7] == 3)s[7] = 0;\n y(s, 1, 5, 2);\n s[2] ^= 1;\n s[5] ^= 1\n }\n if (m == 2) {\n s[8]++;\n if (s[8] == 3)s[8] = 0;\n y(s, 0, 2, 4);\n s[0] ^= 1;\n s[2] ^= 1\n }\n if (m == 3) {\n s[9]++;\n if (s[9] == 3)s[9] = 0;\n y(s, 3, 4, 5);\n s[3] ^= 1;\n s[4] ^= 1\n }\n q = 0;\n for (a = 9; a >= 6; a--)q = q * 3 + s[a];\n for (a = 4; a >= 0; a--)q = q * 2 + s[a];\n return q\n }\n\n function y(p, a, c, t) {\n var s = p[a];\n p[a] = p[c];\n p[c] = p[t];\n p[t] = s\n }\n\n function n(c) {\n return Math.floor(Math.random() * c)\n }\n\n u();\n ss[0] += b[0];\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(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(a) {\n\t\tfor (let i = a.length; i; i--) {\n\t\t\t// The next semicolon is due to a bug in babel es2015 presets\n\t\t\t// https://github.com/babel/babel/issues/2304\n\t\t\t// which seems closed and unresolved\n\t\t\tlet j = Math.floor(Math.random() * i);\n\t\t\t[a[i - 1], a[j]] = [a[j], a[i - 1]]\n\t\t}\n\t return a\n\t}", "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}", "_shufflePieces(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 scramble1(str, arr) {\n let my_object = {}\n let answer = []\n let str_array = str.split('')\n for (i = 0; i < arr.length; i++) { \n my_object[arr[i]] = str_array[i]\n }\n //const object_keys = Object.keys(my_object)\n for (key in my_object) {\n answer.push(my_object[key])\n }\nreturn answer.join('')\n}", "function scramble() { //MESMA COISA QUE\n divs.forEach(element => { // randomize(\"azul\");\n randomize(element); // randomize(\"vermelho\");\n }); // randomize(\"verde\");\n} //randomize (\"amarelo\");", "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\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 shuffle(array, i0 = 0, i1 = array.length) {\n var m = i1 - (i0 = +i0),\n t,\n i;\n\n while (m) {\n i = Math.random() * m-- | 0;\n t = array[m + i0];\n array[m + i0] = array[i + i0];\n array[i + i0] = t;\n }\n\n return array;\n}", "function shuffle(array, i0 = 0, i1 = array.length) {\n var m = i1 - (i0 = +i0),\n t,\n i;\n\n while (m) {\n i = Math.random() * m-- | 0;\n t = array[m + i0];\n array[m + i0] = array[i + i0];\n array[i + i0] = t;\n }\n\n return 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 }", "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 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(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 // 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(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() {\n for (let i = warArray.length - 1; i > 0; i--) {\n const shuffle = Math.floor(Math.random() * (i + 1));\n [warArray[i], warArray[shuffle]] = [warArray[shuffle], warArray[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 let temp = array[i];\n array[i] = array[j];\n array[j] = temp;\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}", "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 }", "function shuffleArray(array) {\n\tfor (let i = array.length - 1; i > 0; i--) {\n\t\tlet j = Math.floor(Math.random() * (i + 1));\n\t\t[array[i], array[j]] = [array[j], array[i]];\n\t}\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 }", "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 scramble(msg) {\n\tvar s = \"\";\n\tvar msgLength = msg.length\n\tfor (var i = 0; i < msgLength; i++) {\n\t\tvar randIndex = Math.round(Math.random() * msg.length);\n\t\tconsole.log(\"index of\" + randIndex);\n\t\ts += msg.substring(randIndex, randIndex + 1);\n\t\tmsg = spliceSlice(msg, randIndex, 1);\n\t}\n\treturn s;\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 }" ]
[ "0.7952491", "0.722264", "0.6984794", "0.6961692", "0.6949615", "0.6908133", "0.681594", "0.67960477", "0.6733211", "0.658768", "0.65754473", "0.656906", "0.6533714", "0.65197945", "0.6506822", "0.64934915", "0.64804894", "0.645834", "0.645834", "0.645834", "0.6449667", "0.6447131", "0.6441504", "0.6441504", "0.6441504", "0.6434835", "0.6434835", "0.64288604", "0.6425803", "0.6424359", "0.6414165", "0.6414165", "0.64119536", "0.640844", "0.6407359", "0.64007634", "0.63985413", "0.63966775", "0.63938856", "0.6389349", "0.63865936", "0.6378849", "0.63738114", "0.6373778", "0.6368851", "0.6366374", "0.63659877", "0.63642335", "0.63636947", "0.6361592", "0.63564837", "0.6343711", "0.6340834", "0.63305986", "0.63293785", "0.6327944", "0.63276565", "0.6325967", "0.6315951", "0.6314029", "0.63099945", "0.6302037", "0.63014376", "0.6295139", "0.6292898", "0.6291823", "0.6279848", "0.62749314", "0.62729836", "0.6271909", "0.62688315", "0.62677926", "0.6262451", "0.62618965", "0.6259419", "0.625693", "0.6254928", "0.6253276", "0.6252556", "0.6251897", "0.624516", "0.6237582", "0.6237582", "0.62373513", "0.6233325", "0.623089", "0.6229451", "0.6226284", "0.622154", "0.62196434", "0.6219578", "0.62193966", "0.62144315", "0.621393", "0.6213507", "0.62134355", "0.620695", "0.6205969", "0.6201654", "0.6201654" ]
0.7307965
1
check if quality params (min, max, etc) are correct & change to correct values
function checkParamsCorrect(wObj, mode) { var val = wObj.val().replace('+', ''); var wParent = wObj.parents('.sub_row.txt'); var check_name = wObj.attr('name').toString(); var input_val = parseFloat(val).toFixed(1); //check if input value is float or if value is negative, otherwise return saved correct value if((!checkCorrectFloat(val) || parseFloat(val) < 0 && wObj.parents('.quality-param-intro.percent_block').length == 0) && checkCorrectFloat(wObj.attr('data-tempval'))) { wObj.val(wObj.attr('data-tempval')); return; } //check where were changes if(check_name.length != check_name.replace('BASE', '').length) {//base parameter was changed //remove dump value wParent.find('.quality-dump-table-item').remove(); wParent.find('.quality-dump-table-intro').removeClass('active'); wParent.find('.add-dump-table, .add_straight_or').removeClass('inactive'); //change min & max values var minObj = wParent.find('input[name*="MIN"]'); if(minObj.length == 1 && parseFloat(minObj.val()) > input_val) {//if base val < min -> change min minObj.val(input_val); } var maxObj = wParent.find('input[name*="MAX"]'); if(maxObj.length == 1 && parseFloat(maxObj.val()) < input_val) {//if base val > max -> change max maxObj.val(input_val); } } else { if(check_name.length != check_name.replace('DUMP', '').length) {//dump parameter was changed var min_el = wParent.find('input[name*="MIN"]:first'); var max_el = wParent.find('input[name*="MAX"]:first'); var kb_check = true; if(mode == true && check_name.length != check_name.replace('MIN', '').length) {//keyboard input & input is dump min //check if input is in first & unused section kb_check = false; var min_check_val = parseFloat(min_el.val()); if(min_check_val > input_val) { kb_check = false; input_val = min_check_val; wObj.val(input_val); } else { wObj.parents('.quality-dump-table-item').siblings('.quality-dump-table-item').each(function(temp_ind, temp_c_obj){ var temp_check = parseFloat($(temp_c_obj).find('input[type="text"][name*="MIN"]').val()); if(temp_check < input_val) {//founded section lefter than input value kb_check = true; } }); } if(kb_check == false) {//new value is ok -> change this section right margin var right_min_margins_list = wObj.parents('.quality-dump-table-item').siblings('.quality-dump-table-item'); if(right_min_margins_list.length > 0) { var temp_lowest_max_val = 1000000; right_min_margins_list.each(function(temp_ind, temp_c_obj){ var temp_chk_val = parseFloat($(temp_c_obj).find('input[type="text"][name*="MIN"]').val()); if(temp_lowest_max_val > temp_chk_val) { temp_lowest_max_val = temp_chk_val; } }); if(temp_lowest_max_val < 1000000) { wObj.parents('.quality-dump-table-item').find('input[name*="MAX"]').val(temp_lowest_max_val); } } else { kb_check = true; } } } if(kb_check) {//interface input or keyboard input need check if(check_name.length != check_name.replace('MIN', '').length) {//dump min parameter was changed var compare_max_val = -1000000; //get other dump max values to prevent intersections (highest of dump maximums that lower than check value) var compare_max_val_higher = 1000000; //get other dump max values to prevent intersections (lowest of dump maximums that higher than check value) var max_dump_el = wObj.parents('.quality-dump-table-item').find('input[name*="MAX"]'); var all_min_equal_check = 0; var old_val = 0; var step_val = parseFloat(wObj.parents('.quality-dump-table-intro').attr('data-step')); //looking for larger of dump maximums that lower than check value wObj.parents('.quality-dump-table-item').siblings('.quality-dump-table-item').each(function(temp_ind, temp_c_obj){ $(temp_c_obj).find('input[type="text"][name*="MAX"]').each(function(ind, cObj){ if(parseFloat($(cObj).val()) < input_val && compare_max_val < parseFloat($(cObj).val()) && Math.round(parseFloat($(cObj).val()) * 100) <= Math.round(parseFloat(max_dump_el.val()) * 100)) { compare_max_val = parseFloat($(cObj).val()); all_min_equal_check++; } if(parseFloat($(cObj).val()) > input_val && compare_max_val_higher > parseFloat($(cObj).val()) && Math.round(parseFloat($(cObj).val()) * 100) < Math.round(parseFloat(max_dump_el.val()) * 100)) { compare_max_val_higher = parseFloat($(cObj).val()); } }); //check if all dump minimiums are same as dump maximums -> then set user's value (or min if user value is not correct) if(all_min_equal_check == 1) {//all maximums are equal -> check minimums old_val = compare_max_val; $(temp_c_obj).find('input[type="text"][name*="MIN"]').each(function(ind, cObj){ if(old_val != $(cObj).val()) { old_val = $(cObj).val(); all_min_equal_check++; return; } }); } }); if(all_min_equal_check == 1) {//if all dump minimiums are same as dump maximums -> set user's value (if user value is correct) if(input_val < parseFloat(min_el.val())) { wObj.val(min_el.val()); } else if(input_val > parseFloat(max_el.val())) { wObj.val(max_el.val()); } else if(parseFloat(max_dump_el.val()) < input_val) { wObj.val(max_dump_el.val()); } } else if(compare_max_val >= input_val) {//reset value if intersects with other dumps wObj.val(compare_max_val); } else if(min_el.length == 1 && input_val < parseFloat(min_el.val())) {//compare value with min value wObj.val(min_el.val()); } else if(compare_max_val_higher != 1000000 && checkCorrectFloat(wObj.attr('data-tempval')) && parseFloat(wObj.attr('data-tempval')) >= compare_max_val_higher && input_val < compare_max_val_higher ) {//check intersect with other section (new section contain other sections) wObj.val(compare_max_val_higher); } else if(compare_max_val == -1000000 && compare_max_val_higher < 100000 && compare_max_val_higher > input_val || compare_max_val_higher < 100000 && compare_max_val_higher == (input_val + step_val) ) { wObj.val(compare_max_val_higher); } else { if(parseFloat(max_dump_el.val()) < input_val) {//compare with dump max parameter (check if dump min > dump max) wObj.val(max_dump_el.val()); } else if(input_val + step_val == max_dump_el.val()) {//need check next section (if exists that have same dump maximum and other dump minimum -> prevent intersection) wObj.parents('.quality-dump-table-item').siblings('.quality-dump-table-item').each(function(temp_ind, temp_c_obj){ if(max_dump_el.val() == $(temp_c_obj).find('input[type="text"][name*="MAX"]').val() && max_dump_el.val() != $(temp_c_obj).find('input[type="text"][name*="MIN"]').val() ) {//found intersection wObj.val(max_dump_el.val()); return; } }); } } } else if(check_name.length != check_name.replace('MAX', '').length) {//dump max parameter was changed var compare_min_val = 1000000;//get other dump min values to prevent intersections (lowest of dump minimums that higher than check value) var compare_min_val_lower = -1000000;//get other dump min values to prevent intersections (highest of dump minimums that lower than check value) var min_dump_el = wObj.parents('.quality-dump-table-item').find('input[name*="MIN"]'); var all_min_equal_check = 0; var old_val = 0; var step_val = parseFloat(wObj.parents('.quality-dump-table-intro').attr('data-step')); //looking for lower of dump minimums that higher than check value wObj.parents('.quality-dump-table-item').siblings('.quality-dump-table-item').each(function(temp_ind, temp_c_obj){ $(temp_c_obj).find('input[type="text"][name*="MIN"]').each(function(ind, cObj){ if(compare_min_val > parseFloat($(cObj).val()) && Math.round(parseFloat($(cObj).val()) * 100) > Math.round(parseFloat(min_dump_el.val()) * 100)) { compare_min_val = $(cObj).val(); all_min_equal_check++; } if(parseFloat($(cObj).val()) < input_val && compare_min_val_lower < parseFloat($(cObj).val()) && Math.round(parseFloat($(cObj).val()) * 100) > Math.round(parseFloat(min_dump_el.val()) * 100)) { compare_min_val_lower = parseFloat($(cObj).val()); } }); //check if all dump minimiums are same as dump maximums -> then set user's value (if user value is correct) if(all_min_equal_check == 1) {//all minimiums are equal -> check maximums old_val = compare_min_val; $(temp_c_obj).find('input[type="text"][name*="MAX"]').each(function(ind, cObj){ if(old_val != $(cObj).val()) { old_val = $(cObj).val(); all_min_equal_check++; return; } }); } }); if(all_min_equal_check == 1) {//if all dump minimiums are same as dump maximums -> set user's value (if user value is correct) if(input_val < parseFloat(min_el.val())) { wObj.val(min_el.val()); } else if(input_val > parseFloat(max_el.val())) { wObj.val(max_el.val()); } else if(parseFloat(min_dump_el.val()) > input_val) { wObj.val(min_dump_el.val()); } } else if(parseFloat(compare_min_val) < input_val) {//reset value if intersects with other dumps wObj.val(compare_min_val); } else if(max_el.length == 1 && input_val > parseFloat(max_el.val())) {//compare value with max value wObj.val(max_el.val()); } // else if(compare_min_val == 1000000 && compare_min_val_lower > -1000000 && compare_min_val_lower < input_val) // { // console.log('1'); // } // else if(compare_min_val_lower > -1000000 && compare_max_val_higher == (input_val - step_val)) // { // console.log('2'); // } else {//compare with dump min parameter (check if dump max < dump min) if(parseFloat(min_dump_el.val()) > input_val) { wObj.val(min_dump_el.val()); } else if(Math.round((input_val - step_val) * 100) == Math.round(parseFloat(min_dump_el.val()) * 100)) {//need check next section (if exists that have same dump maximum and other dump minimum -> prevent intersection) wObj.parents('.quality-dump-table-item').siblings('.quality-dump-table-item').each(function(temp_ind, temp_c_obj){ if(min_dump_el.val() == $(temp_c_obj).find('input[type="text"][name*="MIN"]').val() && min_dump_el.val() != $(temp_c_obj).find('input[type="text"][name*="MAX"]').val() ) {//found intersection wObj.val(min_dump_el.val()); return; } }); } } } else if(check_name.length != check_name.replace('DISCOUNT', '').length) {//if percent value if(input_val < -100) { wObj.val(-100); } else if(input_val > 100) { wObj.val(100); } else {//check if input_val value is not 0.5 var temp_val = val.toString(); if(temp_val.length != temp_val.replace('.', '').length) {//there is dot in float value -> check last value var precision_val = temp_val.split('.'); var check_precision_int = parseInt(precision_val[1].substr(0, 1)); var plus_val = (check_precision_int < 8 ? 0 : (input_val < 0 ? -1 : 1)); var res_val = plus_val + parseInt(precision_val[0]); if(check_precision_int > 2 && check_precision_int < 8) { res_val = (input_val < 0 && res_val == 0 ? '-' : '') + res_val + '.5'; } input_val = res_val; wObj.val(input_val); } } } } } else if(check_name.length != check_name.replace('MIN', '').length) {//min parameter was changed //compare value with base value var base_el = wParent.find('input[name*="BASE"]'); if(base_el.length == 1 && input_val > parseFloat(base_el.val())) {//change if min < base wObj.val(base_el.val()); } else {//change dump min values wParent.find('.quality-dump-table-item .quality-param-intro input[name*=MIN]').each(function(ind, cObj){ if(parseFloat($(cObj).val()) < input_val) { $(cObj).val(input_val); //check dump max value (change if dump min > dump max) var temp_dump_max = $(cObj).parents('.quality-dump-table-item').find('input[name*=MAX]'); if(temp_dump_max.length == 1 && input_val > parseFloat(temp_dump_max.val())) { temp_dump_max.val(input_val); } } }); } } else if(check_name.length != check_name.replace('MAX', '').length) {//max parameter was changed //compare value with base value var base_el = wParent.find('input[name*="BASE"]'); if(base_el.length == 1 && input_val < parseFloat(base_el.val())) {//change if max > base wObj.val(base_el.val()); } else {//change dump max values wParent.find('.quality-dump-table-item .quality-param-intro input[name*=MAX]').each(function(ind, cObj){ if(parseFloat($(cObj).val()) > input_val) { $(cObj).val(input_val); //check dump min value (change if dump max < dump min) var temp_dump_min = $(cObj).parents('.quality-dump-table-item').find('input[name*=MIN]'); if(temp_dump_min.length == 1 && input_val < parseFloat(temp_dump_min.val())) { temp_dump_min.val(input_val); } } }); } } } //correct result val if it have > 1 digits after dot var res_val = val.toString(); var temp_val = res_val.split('.'); if(typeof temp_val[1] != 'undefined' && temp_val[1].toString().length > 1) { wObj.val(parseFloat(val).toFixed(1)); } else { wObj.val(parseFloat(val)); } //set correct data as temporary wObj.attr('data-tempval', val); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "set quality(value) {}", "function isQuality(spec){return spec.q>0;}", "function isQuality(spec){return spec.q>0;}", "function isQuality(spec){return spec.q>0;}", "function isQuality(spec){return spec.q>0;}", "get quality() {}", "function isQuality(spec) {\n\t return spec.q > 0;\n\t}", "function isQuality(spec) {\n\t return spec.q > 0;\n\t}", "function isQuality(spec) {\n\t return spec.q > 0;\n\t}", "function isQuality(spec) {\n\t return spec.q > 0;\n\t}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "function isQuality(spec) {\n return spec.q > 0;\n}", "validateResolutions() {\n // Note: These min/max checks happen in the SafeScaleManager constructor.\n // However because we don't create a new safe scale manager, we need to manually\n // do these checks when the demo resolutions change.\n\n const maxWidth = Math.max(this.resolutions.maxWidth, this.resolutions.safeWidth);\n const maxHeight = Math.max(this.resolutions.maxHeight, this.resolutions.safeHeight);\n const minWidth = Math.min(this.resolutions.maxWidth, this.resolutions.safeWidth);\n const minHeight = Math.min(this.resolutions.maxHeight, this.resolutions.safeHeight);\n\n this.resolutions.maxWidth = maxWidth;\n this.resolutions.maxHeight = maxHeight;\n this.resolutions.safeWidth = minWidth;\n this.resolutions.safeHeight = minHeight;\n }", "function setQuality(\r\n quality_)\r\n {\r\n quality = quality_;\r\n }", "function isQuality$1(spec) {\n return spec.q > 0;\n}", "function isQuality$1(spec) {\n return spec.q > 0;\n}", "function isQuality$2(spec) {\n return spec.q > 0;\n}", "function isQuality$2(spec) {\n return spec.q > 0;\n}", "function validateScale()\n{\n var fMin = parseFloat($('scaleMin').value);\n var fMax = parseFloat($('scaleMax').value);\n if (isNaN(fMin))\n {\n alert('Scale limits must be set to valid numbers');\n // Reset to the old value\n $('scaleMin').value = scaleMinVal;\n }\n else if (isNaN(fMax))\n {\n alert('Scale limits must be set to valid numbers');\n // Reset to the old value\n $('scaleMax').value = scaleMaxVal;\n }\n else if (fMin >= fMax)\n {\n alert('Minimum scale value must be less than the maximum');\n // Reset to the old values\n $('scaleMin').value = scaleMinVal;\n $('scaleMax').value = scaleMaxVal;\n }\n else \n {\n $('scaleMin').value = fMin;\n $('scaleMax').value = fMax;\n scaleMinVal = fMin;\n scaleMaxVal = fMax;\n updateMap();\n }\n}", "function validateScale()\n{\n var fMin = parseFloat($('scaleMin').value);\n var fMax = parseFloat($('scaleMax').value);\n if (isNaN(fMin))\n {\n alert('Scale limits must be set to valid numbers');\n // Reset to the old value\n $('scaleMin').value = scaleMinVal;\n }\n else if (isNaN(fMax))\n {\n alert('Scale limits must be set to valid numbers');\n // Reset to the old value\n $('scaleMax').value = scaleMaxVal;\n }\n else if (fMin >= fMax)\n {\n alert('Minimum scale value must be less than the maximum');\n // Reset to the old values\n $('scaleMin').value = scaleMinVal;\n $('scaleMax').value = scaleMaxVal;\n }\n else \n {\n $('scaleMin').value = fMin;\n $('scaleMax').value = fMax;\n scaleMinVal = fMin;\n scaleMaxVal = fMax;\n updateMap();\n }\n}", "function isQuality$3(spec) {\n return spec.q > 0;\n}", "function isQuality$3(spec) {\n return spec.q > 0;\n}", "function $Lk2d$var$isQuality(spec) {\n return spec.q > 0;\n}", "function getQuality()\r\n {\r\n return quality;\r\n }", "function setQual(val) {\n RTG_VCF_RECORD.setQuality(val);\n }", "function changeQuality(element, player) {\n var val = element.value / 100;\n var QUAL_MUL = 30;\n freqFilter_player[player].Q.value = val * QUAL_MUL;\n}", "function getQuality(quality)\n{\n\tquality=decodeURIComponent(quality);\n\tif(quality.toLowerCase()==\"small\")\n\t\treturn \"240p\";\n\tif(quality.toLowerCase()==\"medium\")\n\t\treturn \"360p\";\n\tif(quality.toLowerCase()==\"large\")\n\t\treturn \"480p\";\n\tif(quality.toLowerCase()==\"hd720\")\n\t\treturn \"720p\";\n\tif(quality.toLowerCase()==\"hd1080\")\n\t\treturn \"1080p\";\n}", "function $lTqt$var$isQuality(spec) {\n return spec.q > 0;\n}", "function setRenderQuality(quality) {\r try {\r var proj = app.project;\r\r // Get the control comp\r var controlComp;\r for (var i=1; i<=proj.items.length; i++) {\r if (app.project.items[i].name == \"_Global_Controls\") {\r $.writeln(\"Found comp\");\r controlComp = proj.items[i];\r }\r }\r\r // Get the Render Quality Layer\r var qualityLayer;\r for (var l=1; l<=controlComp.layers.length; l++) {\r if (controlComp.layers[l].name == \"RenderQuality\") {\r $.writeln(\"Found layer\");\r qualityLayer = controlComp.layers[l];\r }\r }\r\r //Set the quality\r qualityLayer.property(\"Effects\").property(\"RenderQuality\").property(\"Slider\").setValue(quality); \r } catch(error) {\r this.log_file.writeln(\"WARNING: Unable to set render quality.\");\r }\r}", "function $liTQ$var$isQuality(spec) {\n return spec.q > 0;\n}", "function mapQuality(qualClassName) {\r\n\tswitch (qualClassName) {\r\n\t\tcase 'very high': return (8);\r\n\t\tcase 'high': return (7);\r\n\t\tcase 'med': return (6);\r\n\t\tcase 'low': return (5);\r\n\t\tcase 'very low': return (4);\r\n\t\tcase 'corrupted': return (3);\r\n\t\tcase 'eyecancer': return (2);\r\n\t\tcase 'unknown': return (1);\r\n\t\t}\r\n\treturn (1);\r\n}", "function setQuality(quality) {\n spriteLoader.switchQuality(quality)\n .then(()=>{\n // We call this outside of spriteLoader as not all games will use reels, but all should be using CustomSprites\n Reel.redraw();\n });\n}" ]
[ "0.76522565", "0.685296", "0.685296", "0.685296", "0.685296", "0.6773027", "0.6488042", "0.6488042", "0.6488042", "0.6488042", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.646591", "0.6459096", "0.63917786", "0.62790567", "0.62790567", "0.62592536", "0.62592536", "0.6192253", "0.6192253", "0.6137807", "0.6137807", "0.6131401", "0.6116904", "0.6069341", "0.6066816", "0.606378", "0.60074335", "0.596038", "0.5902191", "0.5895014", "0.5890464" ]
0.602445
95
This function check the message is empty or not
function checkMessage(){ //get the message from the text field var message=document.getElementById("message").value; //when the message is empty, show the error message in the div which id is invalidmessage and return false if(message.length==0) { document.getElementById("invalidmessage").innerHTML="This field is required"; return false; } //when the message is not empty, return true if(message.length!=0) { document.getElementById("invalidmessage").innerHTML=""; return true; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "messageIsValid(messageText) {\n return messageText.length > 0;\n }", "function check_message_content()\n {\n var val = $(\"#sms_content\").val();\n if(val.trim().length == 0 )\n {\n alert(\"Please Enter Message\");\n return false;\n }\n else\n {\n return true;\n }\n }", "function isValidMessage(message) {\n return (\n message.name &&\n message.name.toString().trim() !== \"\" &&\n message.content &&\n message.content.toString().trim() !== \"\"\n );\n}", "function checkMessage(inputMsg) {\n if(inputMsg == undefined){\n return \"\";\n }\n else{\n return inputMsg;\n }\n }", "checkEmptyMessage() {\n if (this.emptyMessage && this.emptyMessageContainer) {\n if (this.recordCount === 0) {\n this.emptyMessageContainer.show();\n this.element.addClass('is-empty');\n } else {\n this.emptyMessageContainer.hide();\n this.element.removeClass('is-empty');\n }\n }\n }", "function check_field_empty(field, name, message) {\n if (message != undefined)\n var msg = message;\n else\n var msg = 'Please enter ' + name;\n\n if (is_field_empty(field)) {\n set_message('error', msg);\n clear_message();\n return true;\n } else\n return false;\n}", "function checkMessage() {\n // Start isValid as false\n let isValid = false;\n // Min/max character count\n const min = 5,\n max = 200;\n // Trim the email input value\n const message = messageInput.value.trim();\n\n // Check if message input is empty\n if (isEmpty(message)) {\n showError(messageInput, 'Message cannot be blank');\n // Check if message input is at least 3 characters and no more than 200 characters\n } else if (!isBetween(message.length, min, max)) {\n showError(\n messageInput,\n `Message must be between ${min} and ${max} characters`\n );\n // Otherwise, clear the error and set isValid to true\n } else {\n clearError(messageInput);\n isValid = true;\n }\n return isValid;\n}", "validateContent() {\n const content = this.state.content.trim();\n if(content.length === 0) {\n return 'At least one character is required'\n }\n }", "function cusBotPreChatEleIsEmpty(domElement, errMessage) {\n cusBotPreChatErrorMsgPlaceholder(domElement, errMessage);\n return false;\n}", "function validateInputs(inputMessage){\n // Check if a User is selected to Chat with\n if (sentTo === '') {\n alert('Please select a User to Chat with');\n return false;\n }\n\n // Check if empty Text is being sent\n if (inputMessage.trim() === '') {\n alert('Please provide input text for Chat');\n return false;\n }\n\n return true;\n}", "function check() {\n\tif (messageContainer.innerHTML.indexOf(0) < 0) {\n\t\tclearButton.disabled = true;\n\t}\n}", "function isEmpty(){console.log(\"ERROR\");return (wordLen === 0)}", "function fieldsEmpty() {\n var isEmpty = false;\n\n if (!r.value) {\n r.style.borderBottom = \"1px solid red\";\n $('#messageR').text(\"Это поле обязательно для заполнения\");\n isEmpty = true;\n } else $('#messageR').text(\"\");\n\n if (!x.value) {\n x.style.borderBottom = \"1px solid red\";\n $('#messageX').text(\"Это поле обязательно для заполнения\");\n isEmpty = true;\n } else $('#messageX').text(\"\");\n\n if (!y.value) {\n y.style.borderBottom = \"1px solid red\";\n $('#messageY').text(\"Это поле обязательно для заполнения\");\n isEmpty = true;\n } else $('#messageY').text(\"\");\n return isEmpty;\n}", "function validate(message) {\n\t\treturn message.type === \"message\" && message.text !== undefined && message.text.indexOf(bot.mention) > -1;\n\t}", "notEmpty (value, msg) {\n assert(!lodash.isEmpty(value), msg || `params must be not empty, but got ${value}`);\n }", "function checkEmptyAll(id_d,message)\r\n{\r\n\tvar data_d = getValue(id_d);\r\n\t\r\n\tif(data_d=='')\r\n\t{\r\n\t\ttakeCareOfMsg(message);\r\n\t\treturn false;\r\n\t}\r\n\telse\r\n\t{\r\n\t\treturn true;\r\n\t}\r\n}", "function catchEmpty(input){\n\n if(input===\"\"){\n return \"Please enter required information.\"\n } \n else{ \n return true};\n\n}", "function cusPreChatEleIsEmpty(domElement, requiredValue) {\n cusPreChatErrorMsgPlaceholder(domElement, requiredValue);\n return false;\n}", "function emptyString (data) {\n return data === '';\n }", "function sendMessage(){\n //Gets the message that will be sent to the server and put it into variable\n var msgToSend = g.messageBox.value.trim()\n \n //Checks whethers it is null, does not want to send empty string\n if(msgToSend != \"\"){\n //Stops the script from updating every 5 seconds, makes it synchronous,\n //then sends messages and finally makes it asynchronous again.\n clearInterval(g.updateInterval);\n serverRequest(getParams(msgToSend),false);\n g.updateInterval = setInterval(getMessages, 5000); \n g.messageBox.value = \"\"; //clear message box\n }\n}", "function validateMessage()\n{\n\tvar message= document.forms[\"contactForm\"][\"message\"];\n\tvar span = document.getElementById('messageSpan');\n\n  if (message.value == \"\") \n  {\n \tspan.innerHTML = \"*message must be filled\";\n \tmessage.style.border = \"1px solid red\";\n \treturn false; \n  }\n else\n {\n\n \tmessage.style.border = \"1px solid green\";\n \tspan.innerHTML = \"\";\n \treturn true; \n }\n}", "function checkIfEmpty(field)\n{\n if(isEmpty(field.value.trim())){\n setInvalid(field, `Este campo no puede ser vacio`);\n return true;\n }else{\n setValid(field);\n return false;\n }\n}", "get _isEmpty() {\n return this._notifContainerElem.children(\".notif:first\").length === 0;\n }", "isEmpty() {\n const text = this.editorState.getCurrentContent().getPlainText();\n return !text || _.trim(text).length === 0;\n }", "function checkIfEmpty(field) {\n \t\n \tif (isEmpty(field.val().trim())) {\n \tsetInvalid(field, `${field.attr('name')} no puede estar vacio.`);\n \treturn true;\n \t} else {\n\t\tsetValid(field);\n\t\treturn false;\n \t}\n}", "function IsTexboxEmpty(thisObj, sErrorMsg, bDisplayAsterisk, iTabID) {\n\n var c = (thisObj instanceof jQuery) ? thisObj : $('#' + thisObj);\n if (c.length == 0) return true;\n\n ResetError(c);\n if (jQuery.trim(c.val()).length == 0) {\n AddMsgInQueue(c, sErrorMsg, bDisplayAsterisk, iTabID);\n return true;\n }\n else {\n return false;\n }\n}", "validateForm() {\n const { body } = this.state;\n return (\n body.length > 0\n );\n }", "validateForm() {\r\n return (this.state.mission.missionDesc.trim().length > 0)\r\n }", "isEmpty (value, msg) {\n assert(lodash.isEmpty(value), msg || `params must be empty, but got ${value}`);\n }", "function isAValidMessage(message){\n // your code\n const str = message.split(/[0-9]/g).filter((elm) => elm !== '');\n const num = message.split(/[a-zA-Z]/g).filter((elm) => elm !== '');\n let result;\n\n if (message === \"\") {\n return true;\n }\n \n if (/\\s/.test(message)) {\n return false;\n }\n \n if (/[a-zA-Z]/.test(message[0])) {\n return false;\n }\n \n const mathMin = Math.min(num.length, num.length);\n for (let i = 0; i < mathMin; i += 1) {\n if (\n // str[i].length == 'undefined' || \n str[i].length !== +num[i]\n || num.length !== str.length\n ) {\n // console.log('str[i]=> ', str[i]);\n // console.log('str[i].length=> ', str[i].length);\n // console.log('str[i].length=> +num[i] ', str[i].length, +num[i]);\n // console.log('num=> ', num);\n // console.log('+num[i]=> ', +num[i]);\n // console.log('num.length=> ', num.length);\n // console.log('str.length=> ', str.length);\n result = false;\n return result;\n } else {\n // console.log('str[i]=> ', str[i]);\n // console.log('str[i].length=> ', str[i].length);\n // console.log('str[i].length=> +num[i] ', str[i].length, +num[i]);\n // console.log('num=> ', num);\n // console.log('+num[i]=> ', +num[i]);\n // console.log('num.length=> ', num.length);\n // console.log('str.length=> ', str.length);\n result = true;\n }\n }\n // console.log(message)\n // console.log('result=> ', result)\n return result;\n}", "function empty () {\n return !line || !line.trim()\n }", "function sendChatMessage() {\n\t// trim the message\n\tvar msg = inputEl.value.replace(/^\\s+/, '').replace(/\\s+$/, '');\n\tif (msg) {\n\t\tsendMessage({\n\t\t\tp: viewerId,\n\t\t\tmsg: msg\n\t\t});\n\t}\n\t\n\t// reset the input box\n\tinputEl.value = \"\";\n\treturn false;\n}", "function validatedPredefinedMessage(frmName)\n{\n\tif(document.forms[frmName].messages.value == ''){\n\t\treturn false;\n\t}\n\treturn true;\n}", "getEmptyMessage(){\n\t\treturn this.emptyMessage;\n\t}", "function chkmessage(event) {\r\n\t\r\n var mymessage = event.currentTarget;\r\n var valmessage = mymessage.value.trim();\r\n \r\n if (valmessage == \"\") {\r\n alert(\"The field cannot be left blank\");\r\n mymessage.focus();\r\n mymessage.select();\r\n\treturn false;\r\n } \r\n\r\n}", "function checkMessage(e){\n resetInnerHTML('errMessage');\n document.getElementById('message').removeAttribute('class');\n var message = document.getElementById('message').value.trim();\n var errorMsg = \"\";\n\n if(message.length > 1000){\n errorMsg += '* Message should be shorter than 1000 chars';\n }\n\n if(errorMsg.length > 0){\n if(e){\n e.preventDefault();\n }\n document.getElementById('errMessage').innerHTML = errorMsg;\n setAttribute('message', 'class', 'errorBorder');\n }\n}", "function submitMessage() {\n var email = $('#inputEmail').val().trim();\n var subject = $('#inputSubject').val().trim();\n var message = $('#inputMessage').val().trim();\n $.each($(\".email-form\"), function() {\n $(this).removeClass('empty-field');\n if($(this).val() === '') {\n console.log('empty')\n $(this).addClass('empty-field');\n // $('#messageSubmit').attr('disabled', true);\n }\n });\n if(email && subject && message) {\n $('#messageSubmit').attr('disabled', false);\n }\n }", "function messageFormTest () {\n if (document.forms['message-user'].search.value === \"\" ||\n document.forms['message-user'].messageUser.value === \"\")\n// display error messages if user isn’t selected or message field is EMPTY\n\n {\n alert(\"All fields must be filled in to submit form\");\n }\n\n// display message when message sent correctly\n else {\n alert(\"Your message has been sent!\");\n }\n}", "get empty() {\n return this.addValidator({\n message: (value, label) => `Expected ${label} to be empty, got \\`${value}\\``,\n validator: value => value === ''\n });\n }", "function validTweet() {\n const tweet = $('#composer').val();\n const maxTweetLength = 140;\n if (tweet.length > maxTweetLength) {\n $('.invalid-tweet-error').text('Maximum character length is 140').slideDown('fast');\n return false;\n }\n if (tweet.length === 0) {\n $('.invalid-tweet-error').text('Please enter a message.').slideDown('fast');\n return false;\n }\n return true;\n }", "messageAssertions(message){\n if(message==\"error\"){\n pass\n }else{\n pass\n }\n }", "isValid() {\n return (\n trim(this.state.title).length > 1\n && trim(this.state.content).length > 1\n );\n }", "is_empty()\n\t{\n\t\tconst { value } = this.props\n\t\treturn !value || !value.trim()\n\t}", "function validateNotEmpty(data){\n if (data == ''){\n return true;\n }else{\n return false;\n }\n}", "isEmpty () {\n return (!this || this.length === 0 || !this.trim());\n }", "function validateMessage(e){\n if(message.value == \"\" || message.value == \"null\" ){\n console.log(\"The message is empty\");\n errors.push(\"<li>Please write a comment</li>\");\n //With prevent default I make sure that the form will not be submitted until it is validated\n e.preventDefault();\n }\n}", "function send() {\r\n\tvar message = $('#input_message').val();\r\n\r\n\tif (message.trim().length > 0) {\r\n\t\tsendMessageToServer('message', message);\r\n\t} else {\r\n\t\talert('Please enter message to send!');\r\n\t}\r\n\r\n}", "function checkPlaceholder() {\n\t\"use strict\";\n\tif (messageBox.value === \"\") {\n\t\tmessageBox.value = messageBox.placeholder;\n\t}\n}", "function emptyValidation(control, msgBox) {\n\n var control_len = control.value.length;\n if (control_len === 0) {\n document.getElementById(msgBox).innerHTML = '<font style=\"color: red;\">Field should not be empty.</font><br>';\n control.focus();\n return false;\n }\n document.getElementById(msgBox).innerHTML = '';\n return true;\n}", "function nonEmptyString (data) {\n return string(data) && data !== '';\n }", "function checkInputLength(){\n if(inputField.value == ''){\n responseText.style.color = '#721c24'\n responseText.style.backgroundColor = '#f8d7da'\n clearActionResponse()\n throw new Error(responseText.textContent = responses[0])\n }\n \n}", "function isEmpty(inputId, inputDiv, pId) {\n //inpui id, input error message wrapper, input text (p)\n let compname = document.getElementById(inputId).value; //get compnum value\n let indiv = document.getElementById(inputDiv);//get input div\n let pid = document.getElementById(pId);//get the eror message (text)\n let text = \"\"; //initiate empty string\n\n if (compname.length == 0) {\n //if not correct\n text = \"يجب تعبئه هذا الصندوق\";\n indiv.style.visibility = \"unset\"; //unset div visibilty\n pid.innerHTML = text; //concatate the comment\n } else {\n //if correct\n indiv.style.visibility = \"hidden\"; //hide div\n }\n}", "function validateInput(input){\n if(input == \"\" || input == undefined){\n message(\"Lén verður að vera strengur\");\n return false;\n }\n return true;\n }", "function checkforblank(){\n \n var errormessage = \"\";\n\n if(document.getElementById(\"txtname\").value == \"\")\n {\n \n errormessage += \"Enter your full Name \\n\";\n \n }\n\n if(document.getElementById(\"txtuname\").value == \"\")\n {\n \n errormessage += \"Enter your UserName \\n\";\n }\n\n if(document.getElementById(\"txtemail1\").value == \"\")\n {\n errormessage += \"Please Enter your Email \\n\";\n }\n \n if(document.getElementById(\"password1\").value == \"\")\n {\n errormessage += \"Please Enter a Suitable Password \\n\";\n }\n\n if(document.getElementById(\"txtno\").value == \"\")\n {\n errormessage += \"Please Enter a Phone Number with 10 Digits \\n\";\n }\n \n if(document.getElementById(\"txtaddress\").value == \"\")\n {\n errormessage += \"Please Enter an Address for us to Deliver \\n\";\n }\n\n if(errormessage != \"\")\n {\n alert(errormessage);\n return false;\n }\n\n }", "function allFilled() {\n\t\t$userTypeMessage = $(\"#user-type-message\").text()\n\t\t$nameMessage = $(\"#name-message\").text()\n\t\t$idMessage = $(\"#id-message\").text()\n\t\t$emailMessage = $(\"#email-message\").text()\n\t\tif ($userTypeMessage == '' && $nameMessage == '' && $idMessage == ''\n\t\t\t\t&& $emailMessage == '' && $(\"#userType\").val() != 'Select'\n\t\t\t\t&& $(\"#name\").val() != '' && $(\"#userId\").val() != ''\n\t\t\t\t&& $(\"#emailText\").val() != '') {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\n\t}", "function isEmpty( element ) {\n\tif( element.length < 1 ) {\n\t\treturn \"This field is required.\";\n\t}\n\treturn \"\";\n}", "handleSubmit() {\r\n const message = this.inputMessage.value;\r\n if (message !== '') {\r\n this.messageToSend(message);\r\n this.inputMessage.value = '';\r\n }\r\n }", "function messageValidate(messageForm){\n\nvar validationVerified=true;\nvar errorMessage=\"\";\n\nif (messageForm.subject.value==\"\")\n{\nerrorMessage+=\"Bạn chưa điền chủ đề!\\n\";\nvalidationVerified=false;\n}\nif (messageForm.txtmessage.value==\"\")\n{\nerrorMessage+=\"Bạn chưa điền nội dung!\\n\";\nvalidationVerified=false;\n}\nif(!validationVerified)\n{\nalert(errorMessage);\n}\nreturn validationVerified;\n}", "function isEmpty() {\n return this.toString().length === 0;\n }", "function podPress_is_emptystr( val ) {\r\n\t\tvar str = String(val);\r\n\t\tvar str_trim = str.replace(/\\s+$/, '');\r\n\t\tstr_trim = str_trim.replace(/^\\s+/, '');\r\n\t\tif (str_trim.length > 0) {\r\n\t\t\treturn false;\r\n\t\t} else {\r\n\t\t\treturn true;\r\n\t\t}\r\n\t}", "function validateForm() {\n return content.length > 0;\n }", "function isBlank(a) {\n\n var result;\n\n if(typeof a !== \"string\"){\n\n result = \"Input in not a string\";\n }\n else{\n result = a.length === 0;\n }\n return result;\n}", "function validateNotEmpty(data) {\n if (data == '') {\n return true;\n } else {\n return false;\n }\n}", "get nonEmpty() {\n return this.addValidator({\n message: (_, label) => `Expected ${label} to not be empty`,\n validator: value => value !== ''\n });\n }", "function required(inputtx) \n {\n if (inputtx.value.length == 0)\n { \n alert(\"message\"); \t\n return false; \n } \t\n return true; \n }", "function validateInput() {\n // Get the users vales from the DOM\n const nameInput = document.getElementById(\"name-input\").value;\n const emailInput = document.getElementById(\"email-input\").value;\n const messageInput = document.getElementById(\"message-box\").value;\n\n // If any of them are blank show an error message\n if (!nameInput) userMessage(\"Please fill out the name field\", true);\n else if (!emailInput) userMessage(\"Please fill out the email field\", true);\n else if (!emailInput.includes('@')) userMessage(\"Please enter a valid email address\", true);\n else if (!emailInput.includes('.')) userMessage(\"Please enter a valid email address\", true);\n else if (!messageInput) userMessage(\"Please fill out the message field\", true);\n else userMessage(\"<p>Thank you for your message!</p> <p>You have instantly become a member of our cooking community!</p>\", false);\n}", "function isInputEmpty(input) {\n //deleting white spaces\n let clear = input.replace(/\\s/g, '');\n if (clear.length > 0) {\n return false;\n } else {\n alert('Empty inputs or only white spaces are not allowed!');\n return true;\n }\n}", "function emptyCheck(inputPara){\n if(!empty(inputPara)){\n return inputPara;\n }\n else{\n return \"\";\n }\n}", "function is_Blank(input){\n if (input.length === 0)\n return true;\n else \n return false;\n}", "function isOkEmail() {\n\n //The program looks there is the right format.\n let indexOfAt = emailUser.value.indexOf('@');\n let textBeforeAt = emailUser.value.slice(0, indexOfAt);\n let textAfterAt = emailUser.value.slice(indexOfAt+1, emailUser.value.length);\n let indexOfDot = textAfterAt.indexOf('.');\n let textBeforeDot = textAfterAt.slice(0, indexOfDot);\n let textAfterDot = textAfterAt.slice(indexOfDot+1, emailUser.value.length);\n\n //fThe program that there are all the elements and later the right format\n if (emailUser.value === \"\") {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_mailEmpty_EM');\n okEmail = false;\n } else if (!emailUser.value.includes('@')) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_no_At_EM');\n return false;\n } else if(textAfterAt.length == 0 || (textAfterAt.length == 1 && indexOfDot == 0)) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_no_domain_EM');\n return false;\n } else if (!emailUser.value.includes('.')) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_no_dot_EM');\n return false;\n } else if (emailUser.value.includes(' ')) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_blank_Space_EM');\n return false;\n } else if (textBeforeAt.length === 0) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_bad_Format_EM');\n return false;\n } else if (textBeforeDot.length === 0) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_bad_Format_EM');\n return false;\n } else if (textAfterDot.length === 0) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_bad_Format_EM');\n return false;\n } else {\n clearAllEmailErrors();\n return true;\n }\n }", "validateMessageInfo(message)\n {\n const validationResult = MessageValidation.validateMessageInfo(message);\n if(validationResult !== \"pass\")\n return {error:\"Error: \"+validationResult};\n }", "fonevalidate(input, minValue) {\n let inputLength = input.value.length;\n \n let errorMessage = `Insira o telefone no padrão (00)00000-0000`;\n \n \n if(inputLength != minValue){\n this.printMessage(input, errorMessage);\n } \n }", "function getEmptyMsg(){\n\t\t\treturn \"There are no items in your cart\";\n\t\t}", "sendMessage () {\n console.log('send msg')\n let msg = this.inputField.value\n if (msg !== '') { // message can not be empty\n this.webSocket.send(JSON.stringify({\n 'type': 'message',\n 'data': msg, // the message of the user\n 'username': this.userName, // users nickname , which is stored\n 'channel': 'my, not so secret, channel',\n 'key': 'eDBE76deU7L0H9mEBgxUKVR0VCnq0XBd' // 1dv525 API-key\n }))\n this.inputField.value = '' // removing the message from the input field after sending\n }\n }", "function sendMessage() {\n\n const message = inputRef.current.value;\n inputRef.current.value = \"\";\n if (message === \"\") {\n alert(\"empty field...\");\n }\n else {\n user.socket.current.emit(\"sendMessageToVideoRoom\", { to: videoRoom['videoRoom'], name: user.name, message: message, roomName: videoRoom['videoRoom'] });\n user.socket.current.emit(\"sendMessageToRoom\", {to: videoRoom['videoRoom'], name: user.name, message: message, roomName: videoRoom['videoRoom']});\n dispatch(addChat(\"room\", videoRoom['videoRoom'], user.id, user.name, message)); \n }\n\n }", "sendMessage() {\n\n // get the message from the messaging input\n const message = App.elements.input.val();\n\n // make sure the message is not empty or just spaces.\n if (message.trim().length > 0) {\n\n // do a POST request with the message\n App.requests.sendMessage(message).done(() => {\n\n // clear the message box.\n App.dom.clearMessageBox();\n });\n }\n }", "function isEmpty(elem)\n {\n /* getting the text */\n var str = elem.value;\n\n /* defining a regular expression for non-empty string */\n var regExp = /.+/;\n return !regExp.test(str);\n }", "validateMessage (message) {\n\t\tmessage = message.message;\n\t\tconst { type, data } = message;\n\t\tif (type !== 'track') {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst expectedMessage = {\n\t\t\tuserId: this.currentUser.user.id,\n\t\t\tevent: 'Unsubscribed',\n\t\t\tproperties: {\n\t\t\t\t$created: new Date(this.currentUser.user.registeredAt).toISOString(),\n\t\t\t\t$email: this.currentUser.user.email,\n\t\t\t\tname: this.currentUser.user.fullName,\n\t\t\t\t'Join Method': 'Created Team',\n\t\t\t\tdistinct_id: this.currentUser.user.id,\n\t\t\t\t'Email Type': 'Notification'\n\t\t\t}\n\t\t};\n\n\t\tif (this.unifiedIdentityEnabled) {\n\t\t\texpectedMessage.properties['NR User ID'] = this.currentUser.user.nrUserId;\n\t\t\texpectedMessage.properties['NR Tier'] = 'full_user_tier';\t\t\t\n\t\t}\n\n\t\tAssert.deepStrictEqual(data, expectedMessage, 'tracking data not correct');\n\t\treturn true;\n\t}", "function notEmpty(value) {\n\treturn isDefined(value) && value.toString().trim().length > 0;\n}", "function valiNotEmpty (text) {\n\t\t\treturn /\\S/.test(text);\n\t\t}", "function sendMsg() {\r\n if (form.msg.value) {\r\n //Do not send empty message\r\n socket.emit('chat message', form.msg.value);\r\n message_box.appendChild(createMsg(form.msg.value, my_name));\r\n form.msg.value = \"\";\r\n }\r\n}", "function FFString_checkBlank( obj , objname , showmsg){\n\tif(this.isBlank(obj.value)){\n\t\tif(showmsg == null || showmsg) {\n\t\t\talert(objname + \"을 입력하세요.\");\n\t\t\tobj.focus();\n\t\t}\n\t\treturn true;\n\t}else{\n\t\treturn false;\n\t}\n}", "function isNotEmpty(inputName, errorContent, errorMessage) {\n errorContent.innerText = '';\n if (inputName.value == \"\") {\n errorContent.innerText = errorMessage;\n return false;\n }\n else\n return true;\n }", "function verifMessage(champ)\r\n{\r\nif(champ.value.length < 2 || champ.value.lenght > 300)\r\n {\r\n surligne(champ, true);\r\n return false;\r\n }\r\n else\r\n {\r\n surligne(champ, false);\r\n return true;\r\n }\r\n}", "function checkLength()\n {\n var txt=$('txtWelcomeMsg'); \n if(txt.value.length<=300) \n {\n $('txtCharacterRemaining').value=300-txt.value.length; \n return true;\n }\n else\n {\n return false;\n }\n \n }", "function isEmpty(input) {\n\treturn !input.replace(/^\\s+/g, '').length;\n}", "function shouldRespond(message) {\n return message.type === MESSAGE && message.text;\n}", "function FieldIsEmpty(strInput) {\n\treturn TrimString(strInput).length == 0;\n}", "get isText(): boolean {\n return this.isMessage && typeof (this.message: any).text === 'string';\n }", "validateBankerName() {\n let bankerName = this.loby.bankerName;\n bankerName = bankerName.trim();\n let error = false;\n let message = '';\n\n if (bankerName) {\n if (bankerName.length < 3) {\n error = true;\n message = \"El nombre es demasiado corto\";\n }\n } else {\n error = true;\n message = \"Este campo es obligatorio\";\n }\n\n this.loby.bankerNameState.hasError = error;\n this.loby.bankerNameState.message = message;\n }", "function _validateRequestBody() {\n //Get req.body size\n var size = Object.keys(user).length;\n if (!user || size <= 0) {\n //send response\n res.status(400).send({\n error_code: \"ERROR_SIGN_IN_0002\",\n message: \"Content can not be empty!\",\n success: false,\n });\n return false;\n }\n return true;\n }", "function checkError(body) {\n var result = JSON.parse(body)\n if(utils.existInObj('Message', result)){\n return true\n }\n return false\n}", "function checkEmail() {\n formMail = document.getElementById(\"inputMail\").value;\n if (formMail == \"\") {\n checkMessage += \"\\n\" + \"Renseigner votre adresse mail afin de valider la commande\";\n } else if (checkMail.test(formMail) == false) {\n checkMessage += \"\\n\" + \"Adresse mail invalide, vérifier votre adresse mail\";\n }\n}", "function checkIfEmpty(field) {\n if (isEmpty(field.value.trim())) {\n //set valid as invalid\n setInvalid(field , `${field.name} must not be empty`);\n return true;\n } else {\n //set field valid\n setValid(field);\n return false;\n }\n}", "function unemptyString (data) {\n return string(data) && data !== '';\n }", "function isMessage(arg) {\n return arg && arg.content && typeof (arg.content) == 'string' && arg.timestamp && arg.timestamp instanceof Date && arg.author && typeof (arg.author) == 'string';\n}", "function isNoteEmptyStringInput(input) {\n return input.value != \"\";\n}", "function checkField(){\n \n //Check text length and not empty\n checkLength(this);\n\n //Check email\n if(this.type === 'email'){\n validateEmail(this);\n }\n\n let errors = document.querySelectorAll('error');\n\n if(email.value !== '' && subject.value !== '' && message.value !== ''){\n if(errors.length === 0) {\n btnSend.disabled = false;\n }\n \n }\n\n}", "function ValidarCamposVacios(texto) {\n var retorno = false;\n if (texto.length > 0) {\n if (texto != \"\") {\n retorno = true;\n }\n }\n return retorno;\n}", "function submitForm() {\n const searchUser = document.getElementById('user-search').value;\n const userMessage = document.getElementById('message-textarea').value;\n if(searchUser == \"\" || searchUser == null || searchUser == \"Search for User\") {\n alert('please choose a user');\n return false;\n } else if(userMessage == \"\" || userMessage == null || userMessage == \"Message for User\") {\n alert('please write your message');\n return false;\n } else if(userMessage && searchUser != null || userMessage && searchUser != \"\") {\n alert('thank you for your message');\n }\n}" ]
[ "0.8118761", "0.7435108", "0.7228619", "0.71116185", "0.67072123", "0.66997784", "0.66961217", "0.66620976", "0.6633871", "0.6633401", "0.65545267", "0.64940137", "0.64691967", "0.64190483", "0.6411557", "0.6346142", "0.63197523", "0.63104206", "0.6288672", "0.6267536", "0.62266105", "0.62171584", "0.61746097", "0.6163313", "0.6154969", "0.61473405", "0.6141163", "0.6130372", "0.6126889", "0.61116475", "0.6106081", "0.61030596", "0.6101415", "0.60956246", "0.60881025", "0.6075863", "0.6067957", "0.6057621", "0.605722", "0.60476786", "0.6047337", "0.6044041", "0.6033378", "0.60233176", "0.60153055", "0.6001559", "0.5977987", "0.59742296", "0.5968093", "0.59579176", "0.5955193", "0.5944015", "0.5938381", "0.5937757", "0.59366494", "0.5932713", "0.59255457", "0.5922398", "0.5903992", "0.58867663", "0.5874601", "0.58735037", "0.58636475", "0.58617467", "0.5860292", "0.58473885", "0.5846129", "0.5844159", "0.5835306", "0.5835138", "0.58330834", "0.5829605", "0.5829484", "0.5829221", "0.5829027", "0.58284837", "0.58270717", "0.58249474", "0.58205396", "0.5820495", "0.58184963", "0.58156526", "0.5812401", "0.58098173", "0.58044225", "0.5803037", "0.5802911", "0.58016545", "0.57950777", "0.57917583", "0.5791155", "0.5780353", "0.57793236", "0.5773524", "0.57732666", "0.57677025", "0.5760112", "0.5758944", "0.5758183", "0.5757094" ]
0.6403483
15
This function check the email format and is empty or not
function checkEmail() { //get the email from the text field var email=document.getElementById("email").value; //when the email is empty, show the error message in the div which id is invalidemail and return false if(email.length==0) { document.getElementById("invalidemail").innerHTML="This field is required"; return false; } //when the email is not empty, check the email format if(email.length!=0) { document.getElementById("invalidemail").innerHTML=""; /* check the email format, if it is a valid address which should contain a single @ symbol with at least 2 characters before it, and contain a single . with at least 2 characters after it. The . must be after the @. When the format is wrong, return false and show the error message in the div which id is invalidemail*/ if(!/^([0-9a-zA-Z\-]{2,})+@([0-9A-Za-z])+\.([0-9a-zA-Z]{2,})+$/.test(email)) { document.getElementById("invalidemail").innerHTML="Please enter a valid email address"; return false; } //when the email format is right, return true if(/^([0-9a-zA-Z\-]{2,})+@([0-9A-Za-z])+\.([0-9a-zA-Z]{2,})+$/.test(email)) { document.getElementById("invalidemail").innerHTML=""; return true; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isEmail(src){\r\n src = lrtrim(src);\r\n if(isEmpty(src)){ //????????\r\n return true;\r\n }\r\n\r\n if((src.indexOf(\"@\")<=0) || (src.indexOf(\".\")<=0) || (src.indexOf(\".\")==src.length-1)){\r\n return false;\r\n }\r\n if((src.indexOf(\"@\")>src.indexOf(\".\")) || (src.indexOf(\"@\")+1==src.indexOf(\".\"))){\r\n return false;\r\n }\r\n return true;\r\n}", "function checkEmail(email) {\n if (email === \"null\");\n return \"\";\n }", "checkEmail(value) {\n\t\tif (value.includes('@') && value.includes('.') && !value.includes(' ')) {\n\t\t\treturn '';\n\t\t} else {\n\t\t\treturn 'Invalid email address'\n\t\t}\n\t}", "function isOkEmail() {\n\n //The program looks there is the right format.\n let indexOfAt = emailUser.value.indexOf('@');\n let textBeforeAt = emailUser.value.slice(0, indexOfAt);\n let textAfterAt = emailUser.value.slice(indexOfAt+1, emailUser.value.length);\n let indexOfDot = textAfterAt.indexOf('.');\n let textBeforeDot = textAfterAt.slice(0, indexOfDot);\n let textAfterDot = textAfterAt.slice(indexOfDot+1, emailUser.value.length);\n\n //fThe program that there are all the elements and later the right format\n if (emailUser.value === \"\") {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_mailEmpty_EM');\n okEmail = false;\n } else if (!emailUser.value.includes('@')) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_no_At_EM');\n return false;\n } else if(textAfterAt.length == 0 || (textAfterAt.length == 1 && indexOfDot == 0)) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_no_domain_EM');\n return false;\n } else if (!emailUser.value.includes('.')) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_no_dot_EM');\n return false;\n } else if (emailUser.value.includes(' ')) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_blank_Space_EM');\n return false;\n } else if (textBeforeAt.length === 0) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_bad_Format_EM');\n return false;\n } else if (textBeforeDot.length === 0) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_bad_Format_EM');\n return false;\n } else if (textAfterDot.length === 0) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_bad_Format_EM');\n return false;\n } else {\n clearAllEmailErrors();\n return true;\n }\n }", "function checkEmail() {\r\n const emailValue = email.value.trim();\r\n\r\n var mailformat = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$/;\r\n if (emailValue === '' || !emailValue.match(mailformat)) {\r\n isValid &= false;\r\n setErrorFor(email, 'Email not valid');\r\n return;\r\n }\r\n\r\n isValid &= true;\r\n}", "function checkEmailFormat(email) {\n const regEx = /\\S+@\\S+\\.\\S+/;\n const emailFormat = regEx.test(email);\n return emailFormat;\n}", "function checkEmailFormat(localEmail) {\n let isEmpty = localEmail.trim().length == 0;\n let hasAt = localEmail.indexOf(\"@\") > 0;\n if(!isEmpty && hasAt) {\n let str = localEmail.substring(localEmail.indexOf(\"@\"));\n return str.indexOf(\".\") > 0;\n } else {\n return false;\n }\n }", "function checkEmail() {}", "function isValidEmail(email){\n if(email==''){\n return false;\n }\n // ....\n return true;\n}", "verifyEmail() {\n const { questionEmail: email } = this.state;\n let formatted = false;\n const asterisk = email.indexOf('@');\n const period = email.lastIndexOf('.');\n if (email[asterisk - 1] && email[asterisk + 1] !== '.' && asterisk < period && email[period + 1]) {\n formatted = true;\n }\n return formatted;\n }", "function emailFormatCheck(input) {\r\n var i = 0;\r\n do {\r\n if (i === input.length) {\r\n return false;\r\n }\r\n i++;\r\n } while (input.charAt(i) != '@');\r\n do {\r\n i++;\r\n if (i === input.length) {\r\n return false;\r\n }\r\n } while (input.charAt(i) != '.');\r\n return true;\r\n}", "function isValidMail(email){\n\tvar Temp = email;\n\tif ((Temp==null)||(Temp==\"\")){\t\t\t\t\n\t\treturn false;\n\t}\n\telse{\n\t\tvar AtSym = Temp.indexOf('@');\n\t\tvar Period = Temp.lastIndexOf('.');\n\t\tvar Space = Temp.indexOf(' ');\n\t\tvar Length = Temp.length - 1 ; // Array is from 0 to length-1\n\t\t\tif ((AtSym < 1) || // '@' cannot be in first position\n\t \t\t(Period <= AtSym+1) || // Must be atleast one valid char btwn '@' and '.'\n\t\t \t(Period == Length ) || // Must be atleast one valid char after '.'\n\t\t\t (Space != -1)) // No empty spaces permitted\n\t\t { \n\t\t\t\t return false;\n\n\t \t\t}\n\t\treturn true;\n\t\t}\t\t\n}", "function validate_email() {\n return email.length > 0 && email.length < 50;\n }", "function checkEmail(element) {\n\t\tvar thisRow = element.parent().parent();\n\t\tvar title = thisRow.children().get(0).innerText;\n\t\tvar str = element.val().trim();\n\n\t\tvar regex = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n\t\tif (!regex.test(str)) {\n\t\t\tif (thisRow.children().get(2) == undefined) {\n\t\t\t\tthisRow.append(\"<td class='validate'>\" + title + \" Wrong email format.</td>\");\n\t\t\t} else {\n\t\t\t\tthisRow.children().get(2).remove();\n\t\t\t\tthisRow.append(\"<td class='validate'>\" + title + \" Wrong email format.</td>\");\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "function checkMail(email)\n{\n var str1=email;\n var arr=str1.split('@');\n var eFlag=true;\n if(arr.length != 2)\n {\n eFlag = false;\n }\n else if(arr[0].length <= 0 || arr[0].indexOf(' ') != -1 || arr[0].indexOf(\"'\") != -1 || arr[0].indexOf('\"') != -1 || arr[1].indexOf('.') == -1)\n {\n eFlag = false;\n }\n else\n {\n var dot=arr[1].split('.');\n if(dot.length < 2)\n {\n eFlag = false;\n }\n else\n {\n if(dot[0].length <= 0 || dot[0].indexOf(' ') != -1 || dot[0].indexOf('\"') != -1 || dot[0].indexOf(\"'\") != -1)\n {\n eFlag = false;\n }\n\n for(i=1;i < dot.length;i++)\n {\n if(dot[i].length <= 0 || dot[i].indexOf(' ') != -1 || dot[i].indexOf('\"') != -1 || dot[i].indexOf(\"'\") != -1 || dot[i].length > 4)\n {\n eFlag = false;\n }\n }\n }\n }\n return eFlag;\n}", "function checkMail(email)\n{\n var str1=email;\n var arr=str1.split('@');\n var eFlag=true;\n if(arr.length != 2)\n {\n eFlag = false;\n }\n else if(arr[0].length <= 0 || arr[0].indexOf(' ') != -1 || arr[0].indexOf(\"'\") != -1 || arr[0].indexOf('\"') != -1 || arr[1].indexOf('.') == -1)\n {\n eFlag = false;\n }\n else\n {\n var dot=arr[1].split('.');\n if(dot.length < 2)\n {\n eFlag = false;\n }\n else\n {\n if(dot[0].length <= 0 || dot[0].indexOf(' ') != -1 || dot[0].indexOf('\"') != -1 || dot[0].indexOf(\"'\") != -1)\n {\n eFlag = false;\n }\n\n for(i=1;i < dot.length;i++)\n {\n if(dot[i].length <= 0 || dot[i].indexOf(' ') != -1 || dot[i].indexOf('\"') != -1 || dot[i].indexOf(\"'\") != -1 || dot[i].length > 4)\n {\n eFlag = false;\n }\n }\n }\n }\n return eFlag;\n}", "function emailValidation()\n {\n let re = /\\S+@\\S+\\.\\S+/;\n if (re.test(emailText)==false)\n {\n setErrorEmail(\"אנא הזן אימייל תקין\");\n setValidEmail(false);\n }\n else\n {\n setErrorEmail(\"\");\n setValidEmail(true);\n } \n }", "function validateEmailFormat()\n{\n var status;\n var x = $(\"#email\").val();\n var atpos = x.indexOf(\"@\");\n var dotpos = x.lastIndexOf(\".\");\n if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= x.length)\n {\n status = \"invalid\";\n }\n return status;\n}", "isEmail(val) {\n if (!this.isString(val))\n return false;\n\n return val.match(/^\\S+@\\S+\\.\\S+$/) !== null;\n }", "function checkEmail(email) \n{ \n var mailformat = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/; \n if(email.match(mailformat)) \n return true; \n else \n return false;\n}", "function emailValid(){\n if(/\\S+@\\S+\\.\\S+/g.test(email)){\n setErrors('')\n return true\n }else{\n setErrors('Email is not valid!')\n }\n return false\n }", "function ValidateEmail(inputText){\n var mailformat = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/;\n if(inputText.match(mailformat))\n return true;\n else\n return false;\n }", "function emailIsValid(email) {\n return /\\S+@\\S+\\.\\S+/.test(email);\n }", "function validate_email_format(email){\n /// Returns true if email is valid, false otherwise ///\n var re = /^\\w+([-+.'][^\\s]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$/;\n return re.test(email)\n}", "function checkmail(){\r\n\tif((/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(compMail.val())))\r\n\t\treturn true;\r\n\treturn false;\r\n}", "function isEmail(value) {\n if (notEmpty(value)) {\n if (typeof value !== 'string')\n value = value.toString();\n return regexpr_1.email.test(value);\n }\n return false;\n}", "function checkmail(){\r\n\tif((/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(email.val())))\r\n\t\treturn true;\r\n\treturn false;\r\n}", "function checkEmail (theField, emptyOK)\r\n{ if (checkEmail.arguments.length == 1) emptyOK = defaultEmptyOK;\r\n if ((emptyOK == true) && (isEmpty(theField.value))) return true;\r\n else if (!isEmail(theField.value, false))\r\n return warnInvalid (theField, iEmail);\r\n else return true;\r\n}", "function emailCheck(email) {\n\tatSplit = email.split('@');\n\tif (atSplit.length == 2 && alphaNumCheck(atSplit[0])) {\n\t\tperiodSplit = atSplit[1].split('.')\n\t\tif (periodSplit.length == 2 && alphaNumCheck(periodSplit[0] + periodSplit[1])) {\n\t\t\treturn true;\n\t\t}\n\t}\n\tvalCheck = false;\n\treturn false;\n}", "function validateEmailField(email) {\n if (email.indexOf(\"@\") > -1) {\n if (email.split(\"@\").length == 2 && email.split(\"@\")[1] != \"\") {\n return true;\n }\n return false;\n }\n return false;\n}", "function emailCheck(inputText)\n{\n\tif(inputText.includes(\"@\"))\n\t{\n\t\tif(inputText.includes(\".\"))\n\t\t{\n\t\t\tvar checkText = inputText.replace(\"@\", \"\");\n\t\t\tcheckText = checkText.replace(\".\", \"\");\n\t\t\tif(textCheck(checkText))\n\t\t\t{\n\t\t\t\tvar checkArray = inputText.split(\".\");\n\t\t\t\tif(checkArray[1].length === 3)\n\t\t\t\t{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\treturn false;\n\t\t}\n\t}\n\telse\n\t{\n\t\treturn false;\n\t}\n}", "function email(){\n var emailReg =/[a-z].*(@)[a-z]*(.)[a-z]{2,}$/;\n var validEmail = document.getElementById('email').value;\n if (emailReg.test(validEmail) === false)\n {\n throw \"invalid email address\";\n }\n }", "function checkEmail(input){\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if(re.test(input.value.trim())){\nshowSuccess(input);\n }else{\nshowError(input,\"Email is not valid\");\n }\n}", "function checkEmail(input){\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if(re.test(input.value.trim())){\n showSuccess(input);\n }\n else{\n showError(input, \"Email is not valid\");\n }\n}", "isEmail(sRawValue) {\n\t\treturn true;\n\t}", "function checkFormatting(inputText){\n var mailformat = new RegExp(/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/);\n if(inputText.match(mailformat)){\n if (checkEdu(inputText)) {\n return true;\n }\n else {\n return false;\n }\n }\n else{\n window.alert(\"Error: You have entered an invalid email address\");\n return false;\n }\n}", "function checkEmail (theField, emptyOK)\r\n{ if (checkEmail.arguments.length == 1) emptyOK = defaultEmptyOK;\r\n if ((emptyOK == true) && (isEmpty(theField.value))) return true;\r\n else if (!isEmail(theField.value, false)) {\r\n\t\treturn warnInvalid (theField, iEmail);\r\n\t}\r\n else return true;\r\n}", "function validateEmailReset() {\n if (checkIfEmpty(email)) return;\n if (!containsCharacters(email, 5)) return;\n if (!CheckFieldInDbReset(email, form_j, dataUrlEmail)) return;\n return true;\n}", "validateEmail(val) {\n\t\tconst email = _.trim(val);\n\t\tif (_.isEmpty(email)) {\n\t\t\treturn new Error('Email cannot be empty');\n\t\t}\n\t\tif (!email.includes('@')) {\n\t\t\treturn new Error('Please enter a valid email');\n\t\t}\n\t}", "function isEmail(){\n // get form data\n const emailFormat = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$/;\n if(!(input.value.match(emailFormat))){\n $(\"#notEmail\").removeClass('hidden');\n $(\"#noRecords\").addClass('hidden');\n return false;\n }\n else{\n $(\"#notEmail\").addClass('hidden');\n return true;\n }\n\n }", "function isEmail( field )\r\n {\r\n\ttext = field.value;\r\n\t//alert('inside isEmail');\r\n\tif(isEmpty(field))\r\n\t {\r\n\t\t//alert('Empty Text Box');\r\n\t\treturn true;\r\n\t }\r\n\telse\r\n\t{\r\n\t\t\tvar i;\r\n\t\t\tvar index;\r\n\t\t\tfor( i = 0; i < text.length; i++ )\r\n\t\t\t{\r\n\t\t\t oneChar = text.charAt( i );\r\n\t\t\t if ( ! isCharValid( oneChar, PERIOD|ALPHA|NUMERICS|EMAILAT|DASH|UNDERSCORE|PLUS ) )\r\n\t\t\t {\r\n\t\t\t\treturn false;\r\n\t\t\t }\r\n\t\t\t}\r\n\t\t\tif( ( index = text.indexOf( '@' ) ) == -1 ) \r\n\t\t\t {\r\n\t\t\t\treturn false;\r\n\t\t\t }\r\n\t\t\tvar user = text.substring( 0, index );\r\n\t\t\tvar domain = text.substring( index, text.length );\r\n\t\t\tif ( domain.indexOf( '@', 1 ) != -1 ) \r\n\t\t\t {\r\n\t\t\t\treturn false;\r\n\t\t\t }\r\n\t\t\tif ( ( ( index = domain.indexOf( '.' ) ) == -1 ) ||( user == \"\" ) )\r\n\t\t\t{\r\n\t\t\t return false ;\r\n\t\t\t}\r\n\t\t\tvar suffix = domain.substring(domain.lastIndexOf('.') +1);\r\n\t\t\t//if(! isTLD(suffix) ){\r\n\t\t\t//\talert(BADEMAIL);\r\n\t\t\t// field.focus();\r\n\t\t\t//\tfield.select();\r\n\t\t\t// return false;\r\n\t\t//\t}\r\n\t\t\twhile( index != -1 )\r\n\t\t\t{\r\n\t\t\t if ( ( index == 0 ) || ( index == domain.length - 1 ) )\r\n\t\t\t {\r\n\t\t\t\treturn false;\r\n\t\t\t }\r\n\t\t\t if ( domain.charAt( index + 1 ) == '.' )\r\n\t\t\t {\r\n\t\t\t\treturn false;\r\n\t\t\t }\r\n\t\t\t index++;\r\n\t\t\t index = domain.indexOf( '.', index );\r\n\t\t\t}\r\n\t\t\t //alert('Valid Email Id');\r\n\t\t\t return true;\r\n\t}\r\n }", "function validEmailFormat(email) { \n var re = /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n return re.test(email);\n}", "isEmail(value) {\n return new RegExp(\"^\\\\S+@\\\\S+[\\\\.][0-9a-z]+$\").test(\n String(value).toLowerCase()\n );\n }", "function isEmail(fld)\n{\n if(!fld.value.length || fld.disabled)\n return true; // blank fields are the domain of requireValue\n\n var emailfmt = /(^['_A-Za-z0-9-]+(\\.['_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*\\.(([A-Za-z]{2,3})|(aero|coop|info|museum|name))$)|^$/;\n if(!emailfmt.test(fld.value))\n return false;\n\n return true;\n}", "function checkEmail(n)\r\n{\r\n\treturn n.search(/^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$/)!=-1?!0:!1\r\n\t\r\n}", "static vEmail(field) {\n return !Validate.mailformat.test(field);\n }", "function checkEmail() {\n\tvar email = document.getElementById(\"email\").value;\n\tvar emailCheck = new RegExp(/\\S+\\S+\\.([a-z]|[A-Z]){1,5}/g);\n\t\n\tif (email == \"\"){\t\n\t} else {\n\t\tif (emailCheck.test(email)) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\talert(\"Not at valid email!\");\n\t\t\treturn false;\n\t\t}\n\t}\n}", "function checkEmail(email) {\n var re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if(re.test(email.value.trim())){\n showSuccess(email);\n } else {\n showError(email, 'Email is not valid');\n }\n\n}", "function checkEmail(input){\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if( re.test(input.value.trim())) {\n showSuccess(input.value);\n } else {\n showError(input, 'Email is not Valid');\n }\n}", "function checkEmail() {\n\t\tvar email=document.sform.eml.value;\n\t\tif (email==\"\") {\n\t\t\talert (\"Please enter a valid email.\");\n\t\t\tdocument.sform.eml.focus();\n\t\t\treturn false;\n\t\t} \n\t\telse if (!(email.includes(\"@\"))) {\n\t\t\talert (\"Please enter a valid email.\");\n\t\t\tdocument.sform.eml.value=\"\";\n\t\t\tdocument.sform.eml.focus();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "function validateEmail(anEmail) {\n var mailFormat = /^\\W+([\\.-]?\\W+)*@\\W+([\\.-]?\\W+)*(\\.\\W{2,3})+$/;\n if (anEmail.value.match(mailFormat)) {\n return true;\n } else {\n alert(\"The email format is wrong\");\n anEmail.style.border = \"2px solid red\";\n anEmail.focus();\n return false;\n }\n }", "function emailFormat(element) {\n var str = element.value;\n var patt = /^(([^<>()\\[\\]\\.,;:\\s@\\\"]+(\\.[^<>()\\[\\]\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@(([^<>()[\\]\\.,;:\\s@\\\"]+\\.)+[^<>()[\\]\\.,;:\\s@\\\"]{2,})$/i;\n var res = patt.test(String(str).toLowerCase());\n if (element.value === \"\") {\n $(element).next().remove();\n var value = $(element).closest('.form__group').find('.form__label').text();\n $(element).after(`<span class=\"form-error-msg\">${value} is required</span>`\n );\n return true;\n } else if (res === false) {\n $(element).next().remove();\n $(element).after(\n `<span class=\"form-error-msg\">Incorrect email format. Please check and try again.</span>`\n );\n return true;\n } else {\n $(element).next().remove();\n return false;\n }\n}", "function validateEmail(){\n\tvar re = /^([\\w-]+(?:\\.[\\w-]+)*)@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$/i;\n var result = re.test($.txtfieldMail.value);\n if(result == 0){\n \t$.txtfieldMail.value = \"\";\n \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.invalidmail,function(){});\n }\n}", "function checkEmail(input){\r\n var re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\r\n if(re.test(input.value.trim())){\r\n showSuccess(input);\r\n }else{\r\n showError(input, ' email is not valid');\r\n }\r\n}", "function ValidEmail(field)\n{\n\t\t\t\tif(field.value == \"\")\n\t\t\t\t\t return true;\n\t\tif ((field.value.indexOf(\"@\") < 1) || (field.value.indexOf(\".\") < 1))\n\t\t{\n\t\t\t\t\tDspAlert(field,Message[29]);\n\t\t\t\t\treturn false;\n\n\t\t}\n\t\treturn true;\n\n}", "function checkEmail(email) {\n //check email\n let lastAtPos = email.lastIndexOf('@');\n let lastDotPos = email.lastIndexOf('.');\n if (!(lastAtPos < lastDotPos && lastAtPos > 0 && email.indexOf('@@') === -1 && lastDotPos > 2 && (email.length - lastDotPos) > 2)) {\n return false;\n }\n else{\n return true;\n }\n}", "function validarEmail(email){expr=/^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;if(!expr.test(email)) return false;else return true;}", "function validarEmail(email) {\n\n var patronArroba = /[@]/;\n\n if (patronArroba.test(email)) { //reviso que exista una @\n\n var dominio = email.split(\"@\")[1]; //divido donde halla una @\n if (dominio == 'gmail.com') {\n return 'success';\n } else {\n return 'dominio';\n }\n\n } else {\n return 'formato';\n }\n\n}", "function checkEmail(input){\n const re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if (re.test(input.value.trim())) {\n showSuccess(input);\n } else {\n showError(input);\n }\n}", "function isValidEmail(email){\n\t/*the part befor @ can't have <>()....*/\n\t/*and the email need to have format of [email protected]*/\n \tvar re = /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,})$/;\n \treturn re.test(email);\n}", "function isnotVlaidEmail(str){\n\t\t\t strmail=str;\n\t\t\t firstat = strmail.indexOf(\"@\");\n\t\t\t lastat = strmail.lastIndexOf(\"@\");\n\t\t\t strmain=strmail.substring(0,firstat);\n\t\t\t strsub=strmail.substring(firstat,str.length);\n\t\t\t flag=false;\n\t\t\t if(strmail.length>120)\n\t\t\t { flag=true;//alert(\"1\");\n\t\t\t }\n\t\t\t if(strmain.indexOf(' ')!=-1 || firstat==0 || firstat!=lastat || strsub.indexOf(' ')!=-1 )\n\t\t\t {flag=true;}\n\n\t\t\tstringMailCheck1=\"!#$%^&*()+|<>?/=~,;:][{}\"+\"\\\\\"+\"\\'\"+\"\\\"\";\n\t\t\tf3=1;\n\t\t\tfor(j=0;j<strsub.length;j++)\n\t\t\t{if(stringMailCheck1.indexOf(strsub.charAt(j))!=-1)\n\t\t\t{f3=0;}}\n\t\t\tif(f3==0)\n\t\t\t{flag=true;}\n\n\t\t\tstringMailCheck2=\"!@#$%^&*()+|<>?/=~,;:][{}\"+\"\\\\\"+\"\\'\"+\"\\\"\";\n\t\t\tf4=1;\n\t\t\tfor(j=0;j<strmain.length;j++)\n\t\t\t{if(stringMailCheck2.indexOf(strmain.charAt(j))!=-1)\n\t\t\t{f4=0;}}\n\t\t\tif(f4==0)\n\t\t\t{flag=true;}\n\t\t\t\n\t\t\t k=0;\n\t\t\t strlen=strsub.length;\n\t\t\t for(i=0;i<strlen-1;i++)\n\t\t\t { if(strsub.charAt(i)=='.')\n\t\t\t {k=k+1;}}\n\t\t\t if(k>3)\n\t\t\t { flag=true;}\n\t\t\t if(firstat==-1 || lastat==-1)\n\t\t\t {flag=true;}\n\t\t\t if(Number(strmain))\n\t\t\t {flag=true;}\n\t\t\t if(firstat != lastat )\n\t\t\t {flag=true;}\n\t\t\t firstdot=strmail.indexOf(\".\",firstat);\n\t\t\t lastdot=strmail.lastIndexOf(\".\");\n\t\t\t if(firstdot == -1 || lastdot == -1 || lastdot==strmail.length-1)\n\t\t\t {flag=true;}\n\t\t\t\n\t\t\treturn flag;\n}", "function isValidEmail(input) {\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n\n if(re.test(input.value.trim())) {\nsuccessStyle(input);\n } else {\n errorStyle(input, 'Email is not valid');\n }\n}", "function regExpEmail() {\n // Récupération des données saisies\n const emailValid = contact.email;\n // Injection du HTML\n const checkEmail = document.querySelector(\"#emailErrorMsg\");\n\n // Indication de la bonne saisie ou l'erreur dans le HTML\n if (/^[a-zA-Z0-9.-_]+[@]{1}[a-zA-Z0-9.-_]+[.]{1}[a-z]{2,10}$/.test(emailValid)) {\n checkEmail.innerHTML = \"<i class='fas fa-check-circle form'></i>\";\n return true;\n } else {\n checkEmail.innerHTML = \"<i class='fas fa-times-circle form'></i> format incorrect\";\n }\n }", "function emailValidate(email) {\n let mailFormat = /^([A-Za-z0-9_\\-\\.]+)@([A-Za-z0-9-]+).([A-Za-z]{2,8})(.[A-Za-z]{2,8})?$/; \n if (mailFormat.test(email)) /* (email.value.match(mailFormat)) */ {\n return true;\n }\n else {\n alert('Invalid Email Address');\n return false;\n }\n}", "function emailChecker(email) {\n\tvar x = email.toLowerCase;\n\tvar y = x.split(\"\");\n\tvar alphabet = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z];\n\tif ( y[0] ) {}\n}", "function isValidEmailAddress(email) {\n return emailFormat.test(email);\n}", "function fEMail(o) {\n if (fFldStringEmpty(o)) return true;\n if (typeof o.rawValue === \"string\") {\n // Set the regular expression to look for an email address in general form\n // Test the rawValue of the current object to see if it fits the general form of an email address\n var result = emailPatt.test(fTrim(o.rawValue));\n return result;\n }\n return false;\n}", "function isnotVlaidEmail(str){\n\t\t\t strmail=str;\n\t\t\t firstat = strmail.indexOf(\"@\");\n\t\t\t lastat = strmail.lastIndexOf(\"@\");\n\t\t\t strmain=strmail.substring(0,firstat);\n\t\t\t strsub=strmail.substring(firstat,str.length);\n\t\t\t flag=false;\n\t\t\t if(strmail.length>120)\n\t\t\t { flag=true;alert(\"1\");}\n\t\t\t if(strmain.indexOf(' ')!=-1 || firstat==0 || firstat!=lastat || strsub.indexOf(' ')!=-1 )\n\t\t\t {flag=true;}\n\n\t\t\tstringMailCheck1=\"!#$%^&*()_+|<>?/=-~,;:][{}\"+\"\\\\\"+\"\\'\"+\"\\\"\";\n\t\t\tf3=1;\n\t\t\tfor(j=0;j<strsub.length;j++)\n\t\t\t{if(stringMailCheck1.indexOf(strsub.charAt(j))!=-1)\n\t\t\t{f3=0;}}\n\t\t\tif(f3==0)\n\t\t\t{flag=true;}\n\n\t\t\tstringMailCheck2=\"!@#$%^&*()+|<>?/=-~,;:][{}\"+\"\\\\\"+\"\\'\"+\"\\\"\";\n\t\t\tf4=1;\n\t\t\tfor(j=0;j<strmain.length;j++)\n\t\t\t{if(stringMailCheck2.indexOf(strmain.charAt(j))!=-1)\n\t\t\t{f4=0;}}\n\t\t\tif(f4==0)\n\t\t\t{flag=true;}\n\t\t\t\n\t\t\t k=0;\n\t\t\t strlen=strsub.length;\n\t\t\t for(i=0;i<strlen-1;i++)\n\t\t\t { if(strsub.charAt(i)=='.')\n\t\t\t {k=k+1;}}\n\t\t\t if(k>2)\n\t\t\t { flag=true;}\n\t\t\t if(firstat==-1 || lastat==-1)\n\t\t\t {flag=true;}\n\t\t\t if(Number(strmain))\n\t\t\t {flag=true;}\n\t\t\t if(firstat != lastat )\n\t\t\t {flag=true;}\n\t\t\t firstdot=strmail.indexOf(\".\",firstat);\n\t\t\t lastdot=strmail.lastIndexOf(\".\");\n\t\t\t if(firstdot == -1 || lastdot == -1 || lastdot==strmail.length-1)\n\t\t\t {flag=true;}\n\t\t\t\n\t\t\treturn flag;\n}", "handleEmailCheck(email){\n return /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$/.test(email)\n }", "function check_email() {\n\n\t\tvar pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/i);\n\t\n\t\tif(pattern.test($(\"#email\").val())) {\n\t\t\t$(\"#erroremail\").hide();\n\t\t} else {\n\t\t\t$(\"#erroremail\").html(\"Direccion inválida\");\n\t\t\t$(\"#erroremail\").show();\n\t\t\terror_email = true;\n\t\t}\n\t\n\t}", "function comprobar_mail(email){\n\tvar filter=/^[A-Za-z0-9][A-Za-z0-9_\\.]*@[A-Za-z0-9_]+.[A-Za-z0-9_.]+[A-za-z]$/;\n\tvar aux = filter.test(email);\n\tif(aux == true)\n\t\treturn false;\n\treturn true;\n}", "function checkEmail(input) {\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if (re.test(input.value.trim())) {\n showSuccess(input);\n } else {\n showError(input, 'Emmail is not valid');\n }\n}", "_emailValidation(emailString) {\n console.log(emailString)\n if (/(.+)@(.+){2,}\\.(.+){2,}/.test(emailString)) {\n return true\n } else {\n return false\n }\n }", "function validateEmail () {\n let emailAddress = emailInput.value;\n\n if (/^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/i.test(emailAddress)) {\n isValid(emailInput);\n isEmailValid = true;\n emailError.textContent = '';\n } else if (!(emailAddress.length > 0)) {\n isInvalid(emailInput);\n isEmailValid = false;\n emailError.textContent = 'Field is empty.';\n } else {\n isInvalid(emailInput);\n isEmailValid = false;\n emailError.textContent = 'Email is not a valid format.';\n }\n}", "function checkEmail(email)\n { \n let passed = false;\n for (let i = 0; i < email.length; ++i) {\n if (email[i] == \"@\" && i != 0 && i != email.length-1) {\n passed = true;\n }\n }\n return passed;\n }", "function validateEmail (email) {\n return /\\S+@\\S+\\.\\S+/.test(email)\n}", "function checkEmail(input) { \n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if (re.test(input.value.trim())) {\n showSuccess(input);\n } else {\n showError(input, 'Email is not valid');\n }\n}", "function checkEmail() {\n var pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/i);\n \n if (pattern.test(emailInput.val())) {\n emailInput.removeClass(\"error\");\n $(\"#email_error_message\").hide();\n }\n else {\n $(\"#email_error_message\").html(\"Enter valid email address\");\n $(\"#email_error_message\").show();\n emailInput.addClass(\"error\");\n error_email = true;\n }\n }", "function isValidEmail(address) {\n if (address != '' && address.search) {\n if (address.search(/^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$/) != -1) return true;\n else return false;\n }\n \n // allow empty strings to return true - screen these with either a 'required' test or a 'length' test\n else return true;\n}", "function checkMail() {\n if (getMail().length > 0) {\n if (isSignExist() && isSignSame() && isCharbefSign() && isDotExist() && isDotSame() && isCharbefDotAfSign() && isAfterDot()) {\n return true;\n }\n else {\n return false;\n }\n }\n //nothing put in mail box\n else {\n document.eMail.uMail.style.borderColor = \"grey\";\n document.getElementById(\"errMail\").style.display = \"none\";\n return false;\n }\n}", "function simpleEmailValidation(emailAddress) {\n\n}", "function validEmail(check){\n return /^\\w+@\\w+(\\.(\\w)+)$/i.test(check.value);\n}", "function isEmail() {\r\n\tvar email = document.getElementById(\"email\");\r\n\tvar result = document.getElementById(\"email-error\");\r\n\tresult.innerHTML = \"\";\r\n\tvar regexEmail = new RegExp(\"^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\\\.[a-zA-Z]{2,6}$\");\r\n\tif(email.value === \"\") {\r\n\t\tresult.innerHTML = \"Please input your email\";\r\n\t\treturn false;\r\n\t}\r\n\tif(!regexEmail.test(email.value)) {\r\n\t\tresult.innerHTML = \"Email wrong format\";\r\n\t\treturn false;\r\n\t}\r\n\treturn true;\r\n}", "function validateEmail(email) {\n email.value == null ? email.value = \" \" : email.value\n var atpos = email.value.indexOf(\"@\");\n var dotpos = email.value.lastIndexOf(\".\");\n if (atpos<1 || dotpos<atpos+2 || dotpos+2>=email.value.length) {\n document.querySelector('.email-error').style.display = \"inline\";\n return false;\n }\n document.querySelector('.email-error').style.display = \"none\";\n return true;\n}", "function emailValidate(email){\n const emailCorrect = /\\S+@\\S+\\.\\S+/;\n if((email.charAt(0)===\".\")||(email===\"\")){\n return \"your email is invalid\" \n }\n else if(email.match(emailCorrect)){\n return true\n }\n else{\n return \"your email is invalid\"\n }\n\n}", "function validateEmail(email) \r\n{\r\n var re = /\\S+@\\S+\\.\\S+/;\r\n return re.test(email);\r\n}", "email(email) {\n\n \n if (email === \"\") {\n\n obj.error = \"Enter an valid email\",\n obj.boolval = true\n }\n else if ((pattern.test(email)) === false) {\n\n\n obj.error = \"wrong Email please enter valid email\",\n obj.boolval = true\n }else{\n obj.error = \"\",\n obj.boolval = false\n }\n\n return obj\n }", "validateEmail(email) {\n if(email.length > 0) {\n const regex = /^([a-zA-Z0-9_\\-.]+)@([a-zA-Z0-9_\\-.]+)\\.([a-zA-Z]{2,5})$/;\n return regex.test(email);\n }\n return false;\n }", "function isValidEmail($form) {\r\n // If email is empty, show error message.\r\n // contains just one @\r\n var email = $form.find(\"input[type='email']\").val();\r\n if (!email || !email.length) {\r\n return false;\r\n } else if (email.indexOf(\"@\") == -1) {\r\n return false;\r\n }\r\n return true;\r\n }", "function mightBeEmail(s) {\n // There's no point trying to validate rfc822 fully, just look for ...@...\n return typeof s === 'string' && s.indexOf('@') !== -1;\n}", "function checkMail()\n {\n email = $('#ftven_formabo_form_email').val();\n var emailPattern = /^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n return (emailPattern.test(email));\n }", "function email() {\n var errors = document.querySelector(\"#errors\");\n var email = document.querySelector(\"#email\");\n var string = email.value.trim();\n var patt = /^[a-z0-9_\\-\\.]+\\@[a-z]+\\.[a-z]{2,4}$/i;\n if(!patt.test(string)) {\n errorMessage(\"<p>Please enter a valid Email address</p>\");\n return false;\n } else {\n return true;\n }\n}", "function validEmail(email){\r\n // const re = /\\S+@\\S+\\.\\S+/; \r\n //const re2= /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,1}))$/;\r\n\r\n\r\n return re2.test(string(email).toLowerCase());\r\n}", "function emailValidation(email){\n const regEx = /\\S+@\\S+\\.\\S+/;\n const patternMatch = regEx.test(email);\n return patternMatch;\n}", "function emailCheck(){\n return false;\n }", "function validate_email(field,alerttxt)\r\n{\r\n\tif (/^\\w+([\\+\\.-]?\\w+)*@\\w+([\\+\\.-]?\\w+)*(\\.\\w{2,6})+$/.test(field.value))\r\n\t{\r\n\t\treturn true;\r\n\t}\r\n\telse \r\n\t{\r\n\t\tshow_it(field,alerttxt)\r\n\t\treturn false;\r\n\t}\r\n}", "function validateEmail(email) {\n const validFormat = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email);\n if (!validFormat) {\n // alert('Please enter a valid email');\n return false;\n }\n return true;\n}", "function validateEmail(email) {\n\tvar valid \n\treturn valid = /\\S+@\\S+\\.\\S+/.test(email);\n}", "function mightBeEmail(s) {\n // There's no point trying to validate rfc822 fully, just look for ...@...\n return (/[^@]+@[^@]+/.test(s)\n );\n}", "function mightBeEmail(s) {\n // There's no point trying to validate rfc822 fully, just look for ...@...\n return (/[^@]+@[^@]+/.test(s)\n );\n}", "function mightBeEmail(s) {\n // There's no point trying to validate rfc822 fully, just look for ...@...\n return /[^@]+@[^@]+/.test(s);\n}" ]
[ "0.74725217", "0.74389255", "0.7394451", "0.7300666", "0.7287701", "0.7226614", "0.719154", "0.7173728", "0.7171827", "0.71708316", "0.7139826", "0.7138879", "0.71083045", "0.710582", "0.70877147", "0.70877147", "0.70768815", "0.7073165", "0.7050943", "0.7050357", "0.703677", "0.7034708", "0.70220476", "0.70133466", "0.70133275", "0.69734764", "0.69468695", "0.69261014", "0.6917039", "0.6898192", "0.6889292", "0.6873868", "0.68706", "0.6870314", "0.68687075", "0.6868491", "0.68660456", "0.6857971", "0.6857241", "0.68436265", "0.6837617", "0.6837265", "0.6835686", "0.6834842", "0.6827708", "0.68207955", "0.6816735", "0.6805784", "0.6790687", "0.6789532", "0.67847145", "0.67828745", "0.6777703", "0.6770887", "0.67653537", "0.67606825", "0.67596567", "0.6751291", "0.67453206", "0.6744692", "0.67382693", "0.6734505", "0.6734105", "0.67310274", "0.6730267", "0.67291486", "0.6728615", "0.6726301", "0.6723991", "0.67221844", "0.67169255", "0.6714932", "0.6714843", "0.6713177", "0.67118204", "0.67112565", "0.6699551", "0.6695438", "0.6692866", "0.6688637", "0.6686149", "0.668414", "0.66791195", "0.6676801", "0.667449", "0.66744626", "0.6673746", "0.6666022", "0.6663353", "0.66631997", "0.66582423", "0.6657864", "0.6653043", "0.66528165", "0.66445076", "0.66372114", "0.66308343", "0.6630379", "0.66259724", "0.66259724", "0.662586" ]
0.0
-1
This function is check name, message and email are all correct or not
function send() { checkName(); checkMessage(); checkEmail(); //when all are right, show the successful message in the div which id is sendsuccessfully and return true if(checkName()==true && checkMessage()==true && checkEmail()==true) { document.getElementById("sendsuccessfully").innerHTML="Message successfully sent"; return true; } //if one of name, message and email is not right, return false return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkForm() {\n // set empty string to make it easy to return + boolean to check whether it's successful\n var isSuccess = true;\n var message = \"\";\n\n var patt = new RegExp(\"@\")\n if (!patt.test(this.email)) {\n isSuccess = false;\n message += \"Email\\n\"\n }\n\n // return it with appropriate message\n if (isSuccess) {\n return \"Successfully Submitted!\";\n }\n else {\n return \"You must correct:\\n\" + message;\n }\n }", "function checkEmail() {}", "function isOkEmail() {\n\n //The program looks there is the right format.\n let indexOfAt = emailUser.value.indexOf('@');\n let textBeforeAt = emailUser.value.slice(0, indexOfAt);\n let textAfterAt = emailUser.value.slice(indexOfAt+1, emailUser.value.length);\n let indexOfDot = textAfterAt.indexOf('.');\n let textBeforeDot = textAfterAt.slice(0, indexOfDot);\n let textAfterDot = textAfterAt.slice(indexOfDot+1, emailUser.value.length);\n\n //fThe program that there are all the elements and later the right format\n if (emailUser.value === \"\") {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_mailEmpty_EM');\n okEmail = false;\n } else if (!emailUser.value.includes('@')) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_no_At_EM');\n return false;\n } else if(textAfterAt.length == 0 || (textAfterAt.length == 1 && indexOfDot == 0)) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_no_domain_EM');\n return false;\n } else if (!emailUser.value.includes('.')) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_no_dot_EM');\n return false;\n } else if (emailUser.value.includes(' ')) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_blank_Space_EM');\n return false;\n } else if (textBeforeAt.length === 0) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_bad_Format_EM');\n return false;\n } else if (textBeforeDot.length === 0) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_bad_Format_EM');\n return false;\n } else if (textAfterDot.length === 0) {\n clearAllEmailErrors();\n errorIndication(emailUser, 'email_bad_Format_EM');\n return false;\n } else {\n clearAllEmailErrors();\n return true;\n }\n }", "function email(){\n var emailReg =/[a-z].*(@)[a-z]*(.)[a-z]{2,}$/;\n var validEmail = document.getElementById('email').value;\n if (emailReg.test(validEmail) === false)\n {\n throw \"invalid email address\";\n }\n }", "function emailValid(){\n if(/\\S+@\\S+\\.\\S+/g.test(email)){\n setErrors('')\n return true\n }else{\n setErrors('Email is not valid!')\n }\n return false\n }", "function checkRegData(name, email, password, confPass) {\r\n\tcount = 0;\r\n\tvar nameRegEx = /^[a-zA-Z][a-zA-Z0-9-_\\.]{2,20}$/;\r\n\tvar emailRegEx = /^[-\\w.]+@([A-z0-9][-A-z0-9]+\\.)+[A-z]{2,4}$/;\r\n\tvar passRegEx = /^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\\s).*$/;\r\n\tvar confPassRegEx = /^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\\s).*$/;\r\n\tif(!nameRegEx.test(name)){\r\n\t\tcheckNameMessage = \"invalid name\";\r\n\t\tcount++;\r\n\t}else{\r\n\t\tcheckNameMessage = empty;\r\n\t}\r\n\tif(!emailRegEx.test(email)){\r\n\t\tcheckMailMessage = \"invalid email\";\r\n\t\tcount++;\r\n\t}else{\r\n\t\tcheckMailMessage = empty;\r\n\t}\r\n\tif(!passRegEx.test(password)){\r\n\t\tcheckPassMessage = \"invalid password\";\r\n\t\tcount++;\r\n\t}else{\r\n\t\tcheckPassMessage = empty;\r\n\t}\r\n\tif((!confPassRegEx.test(confPass)) || (confPass != password)){\r\n\t\tcheckConfPassMessage = \"invalid confirm password\";\r\n\t\tcount++;\r\n\t}else{\r\n\t\tcheckConfPassMessage = empty;\r\n\t}\r\n}", "function emailTest(email){ // create function emailTest assign email parameter\n var userName = /(^[a-zA-Z])[a-zA-Z0-9_]+@[a-zA-Z0-9]+\\.[a-zA-Z]{1,}$/ // var userName tests the email to verify the input. ^ checks that the first characters are letters. then it tests that the \n \t\t\t\t\t// letters can be capital or lower case, that there is an @ sign, that the next charcters are letters (capital and lower)\n if (check.test(email)){ //next checks that there is a dot, then letters (again capital and lower) the 1 makes sure there is a least letter after the dot\n \talert(\"true\"); \t\t// check.test varifies the email input by user, if it \n } else{\t\t\t\t\t// email address has all of input varified, an alert will \n \talert(\"false\"); \t// display true, if not, the alert will says false\n }\n}", "function emailValidation()\n {\n let re = /\\S+@\\S+\\.\\S+/;\n if (re.test(emailText)==false)\n {\n setErrorEmail(\"אנא הזן אימייל תקין\");\n setValidEmail(false);\n }\n else\n {\n setErrorEmail(\"\");\n setValidEmail(true);\n } \n }", "function validate(){\n var nameVal = document.getElementById(\"name\").value;\n var emailVal = document.getElementById(\"email\").value;\n var messageVal = document.getElementById(\"message\").value;\n \n var nameFlag = true;\n var emailFlag = true;\n var messageFlag = true;\n \n var filter = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n var result = filter.test(emailVal);\n console.log(result);\n \n if(nameVal == null || nameVal == \"\"){\n $(\"#require-name\").css(\"visibility\",\"visible\");\n nameFlag = false;\n console.log(\"no name\");\n }\n else{\n $(\"#require-name\").css(\"visibility\",\"hidden\");\n }\n \n if(emailVal == null || emailVal == \"\" || !filter.test(emailVal)) {\n $(\"#require-email\").css(\"visibility\", \"visible\");\n emailFlag = false;\n }\n\n else{\n $(\"#require-email\").css(\"visibility\", \"hidden\");\n }\n \n if(messageVal == null || messageVal == \"\"){\n $(\"#require-message\").css(\"visibility\", \"visible\");\n messageFlag = false;\n }\n else{\n $(\"#require-message\").css(\"visibility\", \"hidden\");\n }\n \n if(!nameFlag || !emailFlag || !messageFlag){\n return false;\n }\n \n}", "function validateEmail(){\n\tvar re = /^([\\w-]+(?:\\.[\\w-]+)*)@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$/i;\n var result = re.test($.txtfieldMail.value);\n if(result == 0){\n \t$.txtfieldMail.value = \"\";\n \tutilities.showAlert(Alloy.Globals.selectedLanguage.forgotUsername,Alloy.Globals.selectedLanguage.invalidmail,function(){});\n }\n}", "function checkEmail(input){\r\n var errors = [], warns = [], invalidChars = [], email = input.value, atAt = email.indexOf('@'),\r\n localPart = email.slice(0, atAt > -1 ? atAt : email.length), errorText = '',\r\n domain = atAt == -1 ? '' : email.slice(atAt + 1), ats = 0, domainName = domain,\r\n domainDots = 0,\r\n validDomainChars = '-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0124356789',\r\n validLocalChars = '!#$%&*+/=?^_`{|}~' + validDomainChars;\r\n //Whole email\r\n if(email == '') warns.push('Ingresa tu correo electrónico.');\r\n if(atAt == 0) errors.push('El correo no puede comenzar con una arroba.');\r\n // Local part\r\n if(atAt == -1) warns.push('El correo debe contener una arroba.');\r\n if(localPart.indexOf('.') == 0)\r\n errors.push('La parte local no puede empezar con un punto.');\r\n else if(localPart.lastIndexOf('.') == atAt - 1 && localPart.lastIndexOf('.') > -1)\r\n errors.push('La parte local no puede terminar con un punto.');\r\n for(var i = 0; i < localPart.length; i++){\r\n if(validLocalChars.indexOf(localPart.charAt(i)) == -1)\r\n invalidChars.push(localPart.charAt(i) == ' ' ? 'espacio' : localPart.charAt(i));\r\n if(localPart.charAt(i) == '.' && i < localPart.length - 1)\r\n if(localPart.charAt(i+1) == '.')\r\n errors.push('La parte local no puede contener dos o más puntos consecutivos.');\r\n }\r\n if(invalidChars.length){\r\n for(i in invalidChars){\r\n errorText += invalidChars[i];\r\n }\r\n errors.push((invalidChars.length > 1 ? 'Los caracteres' : 'El caracter') + ' <b>' + errorText + '</b> no ' + (invalidChars.length > 1 ? 'están permitidos' : 'está permitido') + ' en la parte local.');\r\n invalidChars = [];\r\n }\r\n if(localPart.length > 64) errors.push('La parte local no puede tener más de 64 caracteres.');\r\n // Domain\r\n if(domain == '') warns.push('Ingresa el dominio.');\r\n else{\r\n if(domain.lastIndexOf('.') == domain.length - 1){\r\n warns.push('Ingresa un subdominio.');\r\n errors.push('El dominio no puede terminar con un punto.')\r\n }\r\n if(domain.indexOf('.') == 0) errors.push('El dominio no puede empezar con un punto.');\r\n for(var i = 0; i < domain.length; i++){\r\n if(validDomainChars.indexOf(domain.charAt(i)) == -1)\r\n invalidChars.push(domain.charAt(i) == ' ' ? 'espacio' : domain.charAt(i));\r\n if(domain.charAt(i) == '.' && i < domain.length){\r\n if(domain.charAt(i+1) == '.') errors.push('El dominio no puede tener dos o más puntos consecutivos.');\r\n domainDots++;\r\n }\r\n }\r\n if(invalidChars.length){\r\n for(i in invalidChars){\r\n errorText += invalidChars[i];\r\n }\r\n errors.push((invalidChars.length > 1 ? 'Los caracteres' : 'El caracter') + ' <b>' + errorText + '</b> no ' + (invalidChars.length > 1 ? 'están permitidos' : 'está permitido') + ' en el dominio.');\r\n }\r\n for(var i = 0; i < domainDots + 1; i++) {\r\n for(var ind = 0; ind < i; ind++){\r\n domainName = domainName.slice(domainName.indexOf('.') + 1);\r\n }\r\n domainName = domainName.slice(0, domainName.indexOf('.') > -1 ? domainName.indexOf('.') : domainName.length);\r\n if(domainName.length > 63 && domainDots)\r\n errors.push('El subdominio ' + domainName + ' no debe contener mas de 63 caracteres.');\r\n if(domainName.indexOf('-') == 0)\r\n errors.push('El ' + (domainDots == 0 ? 'dominio' : 'subdominio \"' + domainName + '\"') + ' no puede empezar con un guión.');\r\n if(domainName.lastIndexOf('-') == domainName.length - 1 && domainName)\r\n errors.push('El ' + (domainDots == 0 ? 'dominio' : 'subdominio \"' + domainName + '\"') + ' no puede terminar con un guión.');\r\n domainName = domain;\r\n }\r\n if(domain.length > 255) errors.push(\"El dominio no puede contener mas de 255 caracteres.\");\r\n }\r\n //Whole email\r\n for(var i = 0; i < email.length; i++){\r\n if(email.charAt(i) == '@') ats++;\r\n }\r\n if(ats > 1) errors.push('El correo no puede contener mas de una arroba.');\r\n if(email.length > 320) errors.push('El correo no debe contener mas de 320 caracteres.');\r\n for(i in warns){\r\n console.log(warns[i]);\r\n }\r\n}", "function validateUser(name, email) {\n if (name === \"\" || name.length < 2) {\n return \"Username is too short (minimum 2 characters)\"\n }\n if (email === \"\" || !email.includes(\"@\")) {\n return \"Please enter a valid email\"\n }\n return true\n}", "function checkmail(){\r\n\tif((/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(compMail.val())))\r\n\t\treturn true;\r\n\treturn false;\r\n}", "function checkEmail() {\n\t\tvar email=document.sform.eml.value;\n\t\tif (email==\"\") {\n\t\t\talert (\"Please enter a valid email.\");\n\t\t\tdocument.sform.eml.focus();\n\t\t\treturn false;\n\t\t} \n\t\telse if (!(email.includes(\"@\"))) {\n\t\t\talert (\"Please enter a valid email.\");\n\t\t\tdocument.sform.eml.value=\"\";\n\t\t\tdocument.sform.eml.focus();\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "function validation() {\n var name = document.getElementById(\"name\").value;\n var email = document.getElementById(\"email\").value;\n var emailReg = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if (name === '' || email === '') {\n alert(\"Please fill all fields...!!!!!!\");\n return false;\n } else if (!(email).match(emailReg)) {\n alert(\"Invalid Email...!!!!!!\");\n return false;\n } else {\n return true;\n }\n}", "function validateEmail() {\n $scope.errorEmail = false;\n\t\t\tif(!/^([\\da-z_\\.-]+)@([\\da-z\\.-]+)\\.([a-z\\.]{2,6})$/.test($scope.email)) {\n\t\t\t\t$scope.errorEmail = true;\n $scope.messageEmail = 'E-mail address has a wrong format.';\n\t\t\t}\n\t\t\telse {\n\t\t\t\tvar data = {\n\t\t\t\t\taction: \"validateEmail\",\n\t\t\t\t\temail: $scope.email\n\t\t\t\t};\n\n // Calls the validate e-mail method in the registration factory.\n RegistrationFactory.validateEmail(data)\n .then(function(response) {\n if(typeof(response) == 'string') {\n $scope.errorEmail = true;\n $scope.messageEmail = 'An unexpected error occurred while e-mail address is validated. Please try again.';\n }\n else if (response[0]) {\n $scope.errorEmail = true;\n $scope.messageEmail = 'E-mail address is already registered.';\n }\n });\n\t\t\t}\n }", "function checkmail(){\r\n\tif((/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(email.val())))\r\n\t\treturn true;\r\n\treturn false;\r\n}", "function validateContact() {\n var valid = true;\n $(\".info\").html(\"\");\n if (\n !$(\"#userName\").val() ||\n !$(\"#userEmail\").val() ||\n !$(\"#contactReason\").val() ||\n !$(\"#content\").val()\n ) {\n $(\"#mail-status\").html(\"<p class='mailError'>All fields required!</p>\");\n $(\"#mail-status\").fadeIn(500);\n valid = false;\n }\n if (\n !$(\"#userEmail\")\n .val()\n .match(/^([\\w-\\.]+@([\\w-]+\\.)+[\\w-]{2,4})?$/)\n ) {\n $(\"#mail-status\").html(\"<p class='mailError'>Email invalid!</p>\");\n $(\"#mail-status\").fadeIn(500);\n valid = false;\n }\n return valid;\n }", "function regExpEmail() {\n // Récupération des données saisies\n const emailValid = contact.email;\n // Injection du HTML\n const checkEmail = document.querySelector(\"#emailErrorMsg\");\n\n // Indication de la bonne saisie ou l'erreur dans le HTML\n if (/^[a-zA-Z0-9.-_]+[@]{1}[a-zA-Z0-9.-_]+[.]{1}[a-z]{2,10}$/.test(emailValid)) {\n checkEmail.innerHTML = \"<i class='fas fa-check-circle form'></i>\";\n return true;\n } else {\n checkEmail.innerHTML = \"<i class='fas fa-times-circle form'></i> format incorrect\";\n }\n }", "function isEmailValid (body) {\n if ('email' in body &&\n validator.isEmail(body['email'] + '') &&\n validator.isLength(body['email'] + '', { min: 5, max: parseInt(maxEmailVarcharAmount) })) {\n console.log('email ' + body['email'] + ' pass')\n return true\n } else {\n console.log('email ' + body['email'] + ' fail')\n return false\n }\n}", "email(email) {\n\n \n if (email === \"\") {\n\n obj.error = \"Enter an valid email\",\n obj.boolval = true\n }\n else if ((pattern.test(email)) === false) {\n\n\n obj.error = \"wrong Email please enter valid email\",\n obj.boolval = true\n }else{\n obj.error = \"\",\n obj.boolval = false\n }\n\n return obj\n }", "function checkEmail(input){\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if(re.test(input.value.trim())){\nshowSuccess(input);\n }else{\nshowError(input,\"Email is not valid\");\n }\n}", "function validateInput() {\n // Get the users vales from the DOM\n const nameInput = document.getElementById(\"name-input\").value;\n const emailInput = document.getElementById(\"email-input\").value;\n const messageInput = document.getElementById(\"message-box\").value;\n\n // If any of them are blank show an error message\n if (!nameInput) userMessage(\"Please fill out the name field\", true);\n else if (!emailInput) userMessage(\"Please fill out the email field\", true);\n else if (!emailInput.includes('@')) userMessage(\"Please enter a valid email address\", true);\n else if (!emailInput.includes('.')) userMessage(\"Please enter a valid email address\", true);\n else if (!messageInput) userMessage(\"Please fill out the message field\", true);\n else userMessage(\"<p>Thank you for your message!</p> <p>You have instantly become a member of our cooking community!</p>\", false);\n}", "function checkMail(em) \r{\r\tvar error = \"\";\r\t\r\t// Valida el email\r\treg = /^(.+)@(.+)\\.(.{2,3})$/;\r\r\tif (!reg.test(em)) \r\t{\r\t\tdocument.getElementById(\"maillabel\").className = \"error\";\r\t\terror = \"<b>Invalid e-mail</b>\";\r\t}\r\r\treturn error;\r}", "function checkforblank(){\n \n var errormessage = \"\";\n\n if(document.getElementById(\"txtname\").value == \"\")\n {\n \n errormessage += \"Enter your full Name \\n\";\n \n }\n\n if(document.getElementById(\"txtuname\").value == \"\")\n {\n \n errormessage += \"Enter your UserName \\n\";\n }\n\n if(document.getElementById(\"txtemail1\").value == \"\")\n {\n errormessage += \"Please Enter your Email \\n\";\n }\n \n if(document.getElementById(\"password1\").value == \"\")\n {\n errormessage += \"Please Enter a Suitable Password \\n\";\n }\n\n if(document.getElementById(\"txtno\").value == \"\")\n {\n errormessage += \"Please Enter a Phone Number with 10 Digits \\n\";\n }\n \n if(document.getElementById(\"txtaddress\").value == \"\")\n {\n errormessage += \"Please Enter an Address for us to Deliver \\n\";\n }\n\n if(errormessage != \"\")\n {\n alert(errormessage);\n return false;\n }\n\n }", "function sendContact() {\n let name = document.getElementById(\"inputInfo\").elements.item(0).value;\n let email = document.getElementById(\"inputInfo\").elements.item(1).value;\n let message = document.getElementById(\"inputInfo\").elements.item(2).value;\n let nameCapital = name[0].toUpperCase() + name.slice(1);\n \n if (nameCapital.length >= 2) {\n alert(\"Thank you \" + nameCapital + \" for reaching out, we will get back to you shortly @ \" + email);\n }\n else {\n alert(\"Please enter a valid name.\");\n }\n \n if (email.length < 5) {\n alert(\"Please enter a valid e-mail\")\n }\n }", "function checkForm(){\n\t\t\tvar usrname = document.getElementById(\"usrname\").value;\n\t\t\tvar pwd = document.getElementById(\"pwd\").value;\n\t\t\tvar repwd = document.getElementById(\"repwd\").value;\n\t\t\tvar email = document.getElementById(\"email\").value;\n\t\t\tvar reg1 = new RegExp('^([a-zA-Z0-9]{5,10})$');\n\t\t\tvar reg2 = new RegExp('^([a-zA-Z0-9]{1,15})+@([a-zA-Z0-9])+\\.([a-zA-Z]{2,4})$');\n\t\t\t\n\t\t\t if(($.trim(usrname).length == 0) ||\n\t\t\t ($.trim(pwd).length == 0) ||\t\n\t\t\t ($.trim(repwd).length == 0) ||\t\n\t\t\t ($.trim(email).length == 0)) {\n\t\t\t\n\t\t\t\t$(\"#msg\").get(0).innerHTML = \"Please do not leave section blank\";\n\t\t\t\t$(\"#usrname\").select();\n\t\t\t\t$(\"#usrname\").focus();\n\t\t\t\treturn false;\n\t\t\t} else if(pwd != repwd){\n\t\t\t\t$(\"#msg\").get(0).innerHTML = \"Your password doesn't match\";\n\t\t\t\t$(\"#usrname\").select();\n\t\t\t\t$(\"#usrname\").focus();\n\t\t\t\t return false;\n\t\t\t} else if(!(reg1.test(usrname) && reg1.test(pwd))) {\n\t\t\t\t$(\"#msg\").get(0).innerHTML = \"Not appropriate username or password, must be five to ten digits consisting of letters or numbers only\"\n\t\t\t\t$(\"#usrname\").select();\n\t\t\t\t$(\"#usrname\").focus();\n\t\t\t\treturn false;\n\t\t\t} else if(!reg2.test(email)){\n\t\t\t\t$(\"#msg\").get(0).innerHTML = \"Not appropriate form of email address\"\n\t\t\t\t$(\"#email\").select();\n\t\t\t\t$(\"#email\").focus();\n\t\t\t} else {\n\t\t\t\t$(\"#registerForm\").submit();\t\n\t\t\t}\t\t\t\n\t\t}", "function email() {\n var errors = document.querySelector(\"#errors\");\n var email = document.querySelector(\"#email\");\n var string = email.value.trim();\n var patt = /^[a-z0-9_\\-\\.]+\\@[a-z]+\\.[a-z]{2,4}$/i;\n if(!patt.test(string)) {\n errorMessage(\"<p>Please enter a valid Email address</p>\");\n return false;\n } else {\n return true;\n }\n}", "function validiraj_mail(){\n\n var pattern = /^[a-zA-Z0-9]+@[a-z]{2,10}\\.[a-z]{2,4}$/;\n var tekst = document.getElementById(\"forma\").mail_input.value;\n var test = tekst.match(pattern);\n\n if (test == null) {\n document.getElementById(\"mail_error\").classList.remove(\"hidden\");\n valid_test = false;\n } else{\n console.log(\"validiran mail\");\n document.getElementById(\"mail_error\").classList.add(\"hidden\");\n }\n }", "function validate_email(field,alerttxt)\r\n{\r\n\tif (/^\\w+([\\+\\.-]?\\w+)*@\\w+([\\+\\.-]?\\w+)*(\\.\\w{2,6})+$/.test(field.value))\r\n\t{\r\n\t\treturn true;\r\n\t}\r\n\telse \r\n\t{\r\n\t\tshow_it(field,alerttxt)\r\n\t\treturn false;\r\n\t}\r\n}", "function Form20_Validator(theForm)\n{\n// allow ONLY alphanumeric keys, no symbols or punctuation\n// this can be altered for any \"checkOK\" string you desire\n\n// check if first_name field is blank\nif ((theForm.name.value.replace(' ','') == \"\") || (theForm.name.value.replace(' ','') == \"Name\"))\n{\nalert(\"You must enter Your Name.\");\ntheForm.name.focus();\nreturn (false);\n}\n\n\n// check if email field is blank\nvar emailStructure = \"\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\";\n\nif ((theForm.emailfrom.value.replace(' ','') == \"\") || (theForm.emailfrom.value.replace(' ','') == \"Email\"))\n{\nalert(\"Please enter a value for the \\\"Email\\\" field.\");\ntheForm.emailfrom.focus();\nreturn (false);\n}\nelse\n {\n\t if (!emailStructure.test(theForm.emailfrom.value))\n\t {\n\t\talert(\"Email Id: Enter complete Email Id like [email protected]\");\n\t\ttheForm.emailfrom.focus();\n\t\treturn false;\n\t }\n }\n\n// test if valid email address, must have @ and .\n/*var checkEmail = \"@.\";\nvar checkStr = theForm.emailfrom.value;\nvar EmailValid = false;\nvar EmailAt = false;\nvar EmailPeriod = false;\nfor (i = 0; i < checkStr.length; i++)\n{\nch = checkStr.charAt(i);\nfor (j = 0; j < checkEmail.length; j++)\n{\nif (ch == checkEmail.charAt(j) && ch == \"@\")\nEmailAt = true;\nif (ch == checkEmail.charAt(j) && ch == \".\")\nEmailPeriod = true;\n\t if (EmailAt && EmailPeriod)\n\t\tbreak;\n\t if (j == checkEmail.length)\n\t\tbreak;\n\t}\n\t// if both the @ and . were in the string\nif (EmailAt && EmailPeriod)\n{\n\t\tEmailValid = true\n\t\tbreak;\n\t}\n}\nif (!EmailValid)\n{\nalert(\"The \\\"email\\\" field must contain an \\\"@\\\" and a \\\".\\\".\");\ntheForm.emailfrom.focus();\nreturn (false);\n}*/\n\n// check if company field is blank\n\nif ((theForm.company.value.replace(' ','') == \"\") || (theForm.company.value.replace(' ','') == \"Company\"))\n{\nalert(\"You must enter Company Name.\");\ntheForm.company.focus();\nreturn (false);\n}\n\n\n//check if Title is blank\n\nif ((theForm.title.value.replace(' ','') == \"\") || (theForm.title.value.trim() == \"report title\"))\n{\nalert(\"Please enter a value for the Report Title field.\");\ntheForm.title.focus();\nreturn (false);\n}\n\n\n\n\n// test if valid email address, must have @ and .\n/*var checkEmail = \"@.\";\nvar checkStr = theForm.emailfrom.value;\nvar EmailValid = false;\nvar EmailAt = false;\nvar EmailPeriod = false;\nfor (i = 0; i < checkStr.length; i++)\n{\nch = checkStr.charAt(i);\nfor (j = 0; j < checkEmail.length; j++)\n{\nif (ch == checkEmail.charAt(j) && ch == \"@\")\nEmailAt = true;\nif (ch == checkEmail.charAt(j) && ch == \".\")\nEmailPeriod = true;\n\t if (EmailAt && EmailPeriod)\n\t\tbreak;\n\t if (j == checkEmail.length)\n\t\tbreak;\n\t}\n\t// if both the @ and . were in the string\nif (EmailAt && EmailPeriod)\n{\n\t\tEmailValid = true\n\t\tbreak;\n\t}\n}\nif (!EmailValid)\n{\nalert(\"The \\\"email\\\" field must contain an \\\"@\\\" and a \\\".\\\".\");\ntheForm.emailfrom.focus();\nreturn (false);\n}*/\n\n}", "function checkEmail(input){\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if(re.test(input.value.trim())){\n showSuccess(input);\n }\n else{\n showError(input, \"Email is not valid\");\n }\n}", "function isValidData(field) {\n // validation result\n var res = true;\n // Email validation\n var regex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]{2,}$/;\n\n\n // Clear global error message\n vm.messages.error = null;\n\n // Validate Name\n if ((field && field === 'name') || !field) {\n if ((typeof vm.credentials.name !== 'undefined') && (vm.credentials.name.trim() !== '')) {\n res &= true;\n vm.messages.name = null;\n } else {\n res &= false;\n vm.messages.name = 'Please insert your name';\n }\n }\n\n // Validate Email\n if ((field && field === 'email') || !field) {\n if (regex.exec(vm.credentials.email) !== null) {\n res &= true;\n vm.messages.email = null;\n } else {\n res &= false;\n vm.messages.email = 'Please insert a valid email address';\n }\n }\n\n // Validate Password\n if ((field && field === 'password') || !field) {\n if ((typeof vm.credentials.password !== 'undefined') &&\n (vm.credentials.password.trim() !== '')) {\n res &= true;\n vm.messages.password = null;\n } else {\n res &= false;\n vm.messages.password = 'Please insert your account password';\n }\n }\n\n return res;\n }", "function checkRegistrationEmail(email) {\n var blank = isBlank(email);\n if(blank) {\n\tvar element = document.getElementById('email');\n\tvar existence = false;\n\tinputFeedback(element, existence, blank);\n } else {\n\tvar element = document.getElementById('email');\n\tvar existence = checkMailExistence(email);\n\tinputFeedback(element, existence, blank);\n }\n}", "function validarEmail(email) {\n\n expr = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n if ( !expr.test(email) )\n swal(\"Error: Correo Incorrecto\", \"\", \"info\");\n \n\n }//end function validarEmail", "function Form60_Validator(theForm)\n{\n// allow ONLY alphanumeric keys, no symbols or punctuation\n// this can be altered for any \"checkOK\" string you desire\n\n// check if first_name field is blank\nif ((theForm.name.value.replace(' ','') == \"\") || (theForm.name.value.replace(' ','') == \"Name\"))\n{\nalert(\"You must enter Your Name.\");\ntheForm.name.focus();\nreturn (false);\n}\nelse\n{\nif (!isProper(theForm.name,\"Name\"))\nreturn false;\n}\n\n\n// check if email field is blank\n\nif ((theForm.emailfrom.value.replace(' ','') == \"\") || (theForm.emailfrom.value.replace(' ','') == \"Email\"))\n{\nalert(\"Please enter a value for the \\\"Email\\\" field.\");\ntheForm.emailfrom.focus();\nreturn (false);\n}\nelse\n {\n\t if (!theForm.emailfrom.value.test(\"\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*\"))\n\t {\n\t\talert(\"Email Id: Enter complete Email Id like [email protected]\");\n\t\ttheForm.emailfrom.focus();\n\t\treturn false;\n\t }\n }\n\n// test if valid email address, must have @ and .\n/*var checkEmail = \"@.\";\nvar checkStr = theForm.emailfrom.value;\nvar EmailValid = false;\nvar EmailAt = false;\nvar EmailPeriod = false;\nfor (i = 0; i < checkStr.length; i++)\n{\nch = checkStr.charAt(i);\nfor (j = 0; j < checkEmail.length; j++)\n{\nif (ch == checkEmail.charAt(j) && ch == \"@\")\nEmailAt = true;\nif (ch == checkEmail.charAt(j) && ch == \".\")\nEmailPeriod = true;\n\t if (EmailAt && EmailPeriod)\n\t\tbreak;\n\t if (j == checkEmail.length)\n\t\tbreak;\n\t}\n\t// if both the @ and . were in the string\nif (EmailAt && EmailPeriod)\n{\n\t\tEmailValid = true\n\t\tbreak;\n\t}\n}\nif (!EmailValid)\n{\nalert(\"The \\\"email\\\" field must contain an \\\"@\\\" and a \\\".\\\".\");\ntheForm.emailfrom.focus();\nreturn (false);\n}*/\n\n// check if company field is blank\nif ((theForm.job_title.value.replace(' ','') == \"\") || (theForm.job_title.value.replace(' ','') == \"report title\"))\n{\nalert(\"Please enter your Designation.\");\ntheForm.job_title.focus();\nreturn (false);\n}\nelse\n{\nif (!isProper(theForm.job_title,\"Designation\"))\nreturn false;\n}\n\nif ((theForm.company.value.replace(' ','') == \"\") || (theForm.company.value.replace(' ','') == \"Company\"))\n{\nalert(\"You must enter Company Name.\");\ntheForm.company.focus();\nreturn (false);\n}\nelse\n{\nif (!isProper(theForm.company,\" Company Name\"))\nreturn false;\n}\n\n\n//check if Title is blank\n\nif ((theForm.phone_no.value.replace(' ','') == \"\") || (theForm.phone_no.value.replace(' ','') == \"report title\"))\n{\nalert(\"Please enter your Phone Number.\");\ntheForm.phone_no.focus();\nreturn (false);\n}\nelse\n{\nif (!isProper(theForm.phone_no,\"Phone Number\"))\nreturn false;\n}\n\n\n\n// test if valid email address, must have @ and .\nvar checkOK = \"0123456789\";\nvar checkStr = theForm.phone_no.value;\nvar allValid = true;\nvar allNum = \"\";\nfor (i = 0; i < checkStr.length; i++)\n{\nch = checkStr.charAt(i);\nfor (j = 0; j < checkOK.length; j++)\nif (ch == checkOK.charAt(j))\nbreak;\nif (j == checkOK.length)\n{\nallValid = false;\nbreak;\n}\nif (ch != \",\")\nallNum += ch;\n}\nif (!allValid)\n{\nalert(\"Please enter only digit characters in the \\\"Phone\\\" field.\");\ntheForm.phone_no.focus();\nreturn (false);\n}\n\nif ((theForm.country.value.replace(' ','') == \"\") || (theForm.country.value.replace(' ','') == \"company\"))\n{\nalert(\"Please enter your Country Name.\");\ntheForm.country.focus();\nreturn (false);\n}\nelse\n{\nif (!isProper(theForm.country,\"Country Name\"))\nreturn false;\n}\n\n\nif ((theForm.title.value.replace(' ','') == \"\") || (theForm.title.value.trim() == \"report title\"))\n{\nalert(\"Please enter the title of the report you are interested.\");\ntheForm.title.focus();\nreturn (false);\n}\nelse\n{\nif (!isProper(theForm.country,\"Report Interested in\"))\nreturn false;\n}\nif (!isProper(theForm.comments,\"comments\"))\nreturn false;\n\n}", "function checkForm() {\n if (!charactersOK(\"flavor\", \"pizza flavor name\", \n \t\t\t\"`!@#$%^&*()+=[]\\\\\\';,./{}|\\\":<>?\"))\n\treturn false;\n if (!charactersOK(\"desc\", \"flavor description\", \n \t\t\t\"`!@#$%^&*()+=[]\\\\\\';,./{}|\\\":<>?\"))\n\treturn false;\n if (!charactersOK(\"mail\", \"email address\", \"$`\\\\\"))\n\treturn false;\n\tvar x=document.forms[\"pizza\"][\"mail\"].value;\n\tvar atpos=x.indexOf(\"@\");\n\tvar dotpos=x.lastIndexOf(\".\");\n\tif (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)\n\t{\n\t\talert(\"Missing or not a valid email address\");\n\t\treturn false;\n\t}\n}", "function checkInputs() {\n const nameValue = name.value.trim();\n const emailValue = email.value.trim();\n const ageValue = age.value.trim();\n const messageValue = message.value.trim();\n\n let isSuccessful = true;\n if(isNameValid(nameValue)) {\n setSuccessFor(name);\n } else {\n isSuccessful = false;\n setErrorFor(name, 'Name cannot be less that 2 charachters');\n }\n\n if(isEmailValid(emailValue)) {\n setSuccessFor(email);\n } else {\n isSuccessful = false;\n setErrorFor(email, 'Email is not valid');\n }\n\n if(isAgeValid(ageValue)) {\n setSuccessFor(age);\n } else {\n isSuccessful = false;\n setErrorFor(age, 'You must be 18 or over to send this contact form');\n }\n\n if(isMessageValid(messageValue)) {\n setSuccessFor(message);\n } else {\n isSuccessful = false;\n setErrorFor(message, 'Message must be between 10 and 200 characters');\n }\n\n return isSuccessful;\n}", "validateEmail() {\n const len = this.state.email.length;\n if (len>8) return \"success\";\n else if(len>3) return \"warning\";\n else if(len>0) return \"error\";\n }", "function validar() {\n var expresion2 = /\\w+@\\w+\\.+[a-z]/;\n var NU = document.getElementById(NU).value;\n var NC = document.getElementById(NC).value;\n var CC = document.getElementById(CC).value;\n var CE = document.getElementById(CE).value;\n if (NU === \"\" || NC === \"\" || CC === \"\" || CE === \"\") {\n alert(\"Todos los campos son obligatorios\");\n return false;\n } else if (!expresion2.test(CE)) {\n alert(\"El correo no es válido. Ej: [email protected]\");\n return false;\n }\n\n}", "function validate(){\n\tvar firstName = wordCheck('#firstName','#error_firstname');\n\tvar lastName = wordCheck('#lastName','#error_lastname');\n\tvar email = emailCheck('#email','#error_email');\n\tvar phoneNumber = numberCheck('#contactNumber','#error_contactnumber');\n\tif ($('#subject').length != 0){\n\t\tvar sub = wordCheck('#subject','#error_subject');\n\t}\n\tif (firstName && lastName && email && phoneNumber){\n\t\tif ($('#subject').length != 0){\n\t\t\tif (sub)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\telse{\n\t\t\treturn true;\n\t\t}\n\t}\n\telse\n\t\treturn false;\n}", "function validateUser()\n\t{\n\t\tvar msg = '';\n\t\tif($scope.password != $scope.confirm_password){\n\t\t\tmsg = msg + \"\\n\"+$i18next.t(\"validate_confirm_password\");\n\t\t}\n\t\tif($scope.password.length < 8){\n\t\t\tmsg = msg + \"\\n\"+$i18next.t(\"validate_password\");\n\t\t}\n\t\tif($scope.username.length <4){\n\t\t\tmsg = msg + \"\\n\"+$i18next.t(\"validate_username\");\n\t\t}\n\t\tif (!/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test($scope.email)){\n\t\t\tmsg = msg + \"\\n\"+$i18next.t(\"validate_email\");\n\t\t}\n\t\treturn msg;\n\t}", "function validateForm() {\n let userName = document.forms[\"contact-form\"][\"user_name\"].value;\n let userEmail = document.forms[\"contact-form\"][\"user_email\"].value;\n let userMessage = document.forms[\"contact-form\"][\"user_message\"].value;\n\n if (userName === \"\" || userEmail === \"\" || userMessage === \"\") {\n alert(\"Please complete all section of the form.\");\n return false;\n } else {\n alert(\"Thank you. Your message has been sent and we will be in touch as soon as possible\");\n return true;\n }\n }", "function checkEmail() {\n formMail = document.getElementById(\"inputMail\").value;\n if (formMail == \"\") {\n checkMessage += \"\\n\" + \"Renseigner votre adresse mail afin de valider la commande\";\n } else if (checkMail.test(formMail) == false) {\n checkMessage += \"\\n\" + \"Adresse mail invalide, vérifier votre adresse mail\";\n }\n}", "function checkEmail(input){\n const re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if (re.test(input.value.trim())) {\n showSuccess(input);\n } else {\n showError(input);\n }\n}", "function contactErrorCheck(){\n var errorFlag=0;\n clearContactErrors();\n if((jQuery(\"#c-name\").val() == null || jQuery(\"#c-name\").val() == \"\") ){\n jQuery(\".pappaya-c-name\").fadeIn().html(\"Enter your name\");\n errorFlag=1;\n }\n if((jQuery(\"#c-email\").val() == null || jQuery(\"#c-email\").val() == \"\") ){\n jQuery(\".pappaya-c-email\").fadeIn().html(\"Enter your email\");\n errorFlag=1;\n }\n if((jQuery(\"#c-message\").val() == null || jQuery(\"#c-message\").val() == \"\") ){\n jQuery(\".pappaya-c-message\").fadeIn().html(\"Enter your message\");\n errorFlag=1;\n }\n return errorFlag;\n }", "function checkFields()\n\t\t{\n\t\t\t\n\t\t\tvar fill = jQuery(\"input[name=fill]\").val();\n\t\t\tif (fill==\"EMAIL\"){\n\t\t\t\tvar cc = jQuery(\"input[name=cc]\").val();\n\t\t\t\tvar bcc = jQuery(\"input[name=bcc]\").val();\n\t\t\t\tvar i;\n\t\t\t\t//check cc email format\n\t\t\t\tvar ccs = cc.split(\",\");\n\t\t\t\tvar filter = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n\t\t\t\tfor(i=0;i<ccs.length;i++){\n\t\t\t\t\tif(!filter.test(jQuery.trim(ccs[i]))){\n\t\t\t\t\t\tif (jQuery.trim(ccs[i])!=\"\"){\n\t\t\t\t\t\t\talert(\"One of the email used in cc is invalid. Please try again.\");\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar bccs = bcc.split(\",\");\n\t\t\t\t//console.log(bccs);\n\t\t\t\tfor(i=0;i<bccs.length;i++){\n\t\t\t\t\tif(!filter.test(jQuery.trim(bccs[i]))){\n\t\t\t\t\t\tif (jQuery.trim(bccs[i])!=\"\"){\n\t\t\t\t\t\t\talert(\"One of the email used in bcc is invalid. Please try again.\");\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tif(document.form.star.selectedIndex==0)\n\t\t\t{\n\t\t\t\tmissinginfo = \"\";\n\t\t\t\tif(document.form.txt.value==\"\")\n\t\t\t\t{\n\t\t\t\t\tmissinginfo += \"\\n - There is no message or details to be save or send \\t \\n Please enter details.\";\n\t\t\t\t}\n\t\t\t\tif (document.form.mode.value ==\"\")\n\t\t\t\t{\n\t\t\t\t\tif (document.form.fill.value==\"\" )\n\t\t\t\t\t{\n\t\t\t\t\t\tmissinginfo += \"\\n - Please choose actions.\";\n\t\t\t\t\t}\n\t\t\t\t\tif (document.form.fill.value==\"EMAIL\" )\n\t\t\t\t\t{\n\t\t\t\t\t\tif (document.form.subject.value==\"\" )\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmissinginfo += \"\\n - Please enter a subject in your Email.\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (document.form.templates[0].checked==false && document.form.templates[1].checked==false && document.form.templates[2].checked==false)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmissinginfo += \"\\n - Please choose email templates.\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\t\n\t\t\t\t//if (missinginfo != \"\")\n\t\t\t\t//{\n\t\t\t\t\t//missinginfo =\" \" + \"You failed to correctly fill in the required information:\\n\" +\n\t\t\t\t\t//missinginfo + \"\\n\\n\";\n\t\t\t\t\t//alert(missinginfo);\n\t\t\t\t\t//return false;\n\t\t\t\t//}\n\t\t\t\t//else return true;\n\t\t\t}\n\t\t}", "function checkMail()\n {\n email = $('#ftven_formabo_form_email').val();\n var emailPattern = /^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n return (emailPattern.test(email));\n }", "function checkEmail(input){\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if( re.test(input.value.trim())) {\n showSuccess(input.value);\n } else {\n showError(input, 'Email is not Valid');\n }\n}", "function validateForm() {\n if($('.recipient input').val() === \"\") {\n return \"recipient\";\n }else if($('.first-name input').val() === \"\") {\n return \"first name\";\n }else if(emailAvailable === \"taken\") {\n return \"email\";\n }else if($('.password input').val().length < 4){\n return \"password\";\n }else{\n return \"success\";\n }\n }", "function checkEmail(cl, form) {\n var userEmail = form.getElementsByClassName(cl)[0].value,\n email_pattern = /[0-9a-z_]+@[0-9a-z]+\\.[a-z]{2,5}/i;\n\n if (!email_pattern.test(userEmail) && userEmail !== \"\") {\n showError(cl, \"Email is not valid\", form);\n }\n }", "function validate() {\n if (validateEmail(email)) {\n $error.fadeOut();\n } else {\n $error.fadeIn();\n $error.text(email + \" E-mail не корректен\");\n }\n }", "function checkValidForgotFormEmail() {\n let isValid = /^\\w+([.-]?\\w+)*@\\w+([.-]?\\w+)*(\\.\\w{2,3})+$/.test(\n ForgotForm.elements[\"email-forgot\"].value\n );\n\n if (!isValid) {\n let errMes = ForgotFormEmail.parentElement.querySelector(\n \".error-message\"\n );\n if (errMes) return;\n\n let p = document.createElement(\"p\");\n p.classList.add(\"error-message\");\n\n let img = document.createElement(\"img\");\n img.src = \"./images/popup/exclamation.svg\";\n img.alt = \"icon\";\n\n let span = document.createElement(\"span\");\n span.innerText = \"Địa chỉ email không hợp lệ\";\n\n p.appendChild(img);\n p.appendChild(span);\n\n ForgotFormEmail.parentElement.appendChild(p);\n ForgotFormError.push(\"error\");\n } else {\n let errMes = ForgotFormEmail.parentElement.querySelector(\n \".error-message\"\n );\n if (!errMes) return;\n\n ForgotFormEmail.parentElement.removeChild(errMes);\n ForgotFormError.pop();\n }\n}", "function checkEmail(input) {\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if (re.test(input.value.trim())) {\n showSuccess(input);\n } else {\n showError(input, 'Emmail is not valid');\n }\n}", "function checkEmail(element) {\n\t\tvar thisRow = element.parent().parent();\n\t\tvar title = thisRow.children().get(0).innerText;\n\t\tvar str = element.val().trim();\n\n\t\tvar regex = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/;\n\t\tif (!regex.test(str)) {\n\t\t\tif (thisRow.children().get(2) == undefined) {\n\t\t\t\tthisRow.append(\"<td class='validate'>\" + title + \" Wrong email format.</td>\");\n\t\t\t} else {\n\t\t\t\tthisRow.children().get(2).remove();\n\t\t\t\tthisRow.append(\"<td class='validate'>\" + title + \" Wrong email format.</td>\");\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "function checkEmail() {\n var pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/i);\n \n if (pattern.test(emailInput.val())) {\n emailInput.removeClass(\"error\");\n $(\"#email_error_message\").hide();\n }\n else {\n $(\"#email_error_message\").html(\"Enter valid email address\");\n $(\"#email_error_message\").show();\n emailInput.addClass(\"error\");\n error_email = true;\n }\n }", "function validate(email, password, name) {\n\tlet strongRegex = new RegExp(\"^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*])(?=.{8,})\")\n // true means invalid, so our conditions got reversed\n\n return {\n email: email.length === 0 || !email.includes('@') || !email.includes('.', email.indexOf('@')),\n password: password.length < 8 || !strongRegex.test(password),\n name: name.length < 3\n };\n}", "emailvalidade(input) {\n\n // utilizar rejex para validar email\n\n // ex: [email protected]\n let re = /\\S+@\\S+\\.\\S/;\n let email = input.value;\n let errorMessage = `Insira um email no padrão [email protected]`;\n // \"!\"= se nao for ()\n if (!re.test(email)) {\n this.printMessage(input, errorMessage);\n\n }\n\n }", "function checkemail(input){\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n // return re.test(String(email).toLowerCase());\n if(re.test(input.value)){\n showsuccess(input);\n }else{\n showerror(input,'Email is not valid');\n }\n }", "validate(){\n let isError = false;\n let check = /^.+@.+\\..+$/\n const error = {\n err:\"\",\n spawn:\"\"\n };\n if (!check.test(this.state.email)) {\n isError = true;\n error.err = \"Email Format is Wrong\";\n error.spawn = \" spawn\";\n }\n if (this.state.email === \"\") {\n isError = true; \n error.err = \"the column is empty, please fill the column first!!!\";\n error.spawn = \" spawn\"; \n }\n\n \n this.setState(error);\n return isError\n\n }", "function validateEmail(){\n if (!formValue.email) {\n setErrors({...errors,email:'Email is required'})\n } else if (!/^[\\w-.]+@([\\w-]+.)+[\\w-]{2,4}$/.test(formValue.email)) {\n setErrors({...errors,email:'Email address is invalid'})\n }\n \n else setErrors({...errors,email:undefined}); \n \n }", "function validateSuportFields()\n{\n var userFullName = document.getElementById(\"name\").value;\n if(userFullName.length == 0) { alert(\"Please fill your name\"); return false;}\n var userMail = document.getElementById(\"email\");\n if(!userMail.validity.valid) { alert(\"Invalid Email Address\"); return false;}\n var selectedSubject = document.getElementById(\"subject\").value;\n if(selectedSubject == \"Select Subject\") {alert(\"Please select subject\"); return false;}\n var userComment = document.getElementById(\"comment\").value;\n if(userComment.length == 0) { alert(\"Please fill your message\"); return false;}\n else { alert(userFullName + \"\\n\" + userMail.value + \"\\n\" + selectedSubject + \"\\n\" + userComment); return true; }\n}", "function check_email() {\n\n\t\tvar pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$/i);\n\t\n\t\tif(pattern.test($(\"#email\").val())) {\n\t\t\t$(\"#erroremail\").hide();\n\t\t} else {\n\t\t\t$(\"#erroremail\").html(\"Direccion inválida\");\n\t\t\t$(\"#erroremail\").show();\n\t\t\terror_email = true;\n\t\t}\n\t\n\t}", "function checkEmail() {\r\n const emailValue = email.value.trim();\r\n\r\n var mailformat = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$/;\r\n if (emailValue === '' || !emailValue.match(mailformat)) {\r\n isValid &= false;\r\n setErrorFor(email, 'Email not valid');\r\n return;\r\n }\r\n\r\n isValid &= true;\r\n}", "function isValidEmail($form) {\r\n // If email is empty, show error message.\r\n // contains just one @\r\n var email = $form.find(\"input[type='email']\").val();\r\n if (!email || !email.length) {\r\n return false;\r\n } else if (email.indexOf(\"@\") == -1) {\r\n return false;\r\n }\r\n return true;\r\n }", "function checkEmail(input) { \n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if (re.test(input.value.trim())) {\n showSuccess(input);\n } else {\n showError(input, 'Email is not valid');\n }\n}", "function checkEmail(input) {\n const re =\n /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if (re.test(input.value.trim())) {\n showSuccess(input);\n return true;\n } else {\n showError(input, \"유효하지 않은 Email입니다.\");\n return false;\n }\n}", "function emailValid() {\n\tvar domain = new RegExp(/^[A-z0-9.]{1,}@(?=(my.bcit.ca$|bcit.ca$|gmail.com$))/i); //checks email for single occurrence of @ and valid domain containing only valid characters.\n\tvar email = document.getElementById(\"email\").value;\n\tif (domain.test(email))\n\t{\n\t\t/*if (email exists in database) {\n\t\t\tdocument.getElementById(\"email\").value = \"Email already exists\"\n\t\t} else {whatever value to let form submit}*/\n\t\tdocument.getElementById(\"emailErrorField\").innerHTML = \"Email valid\"\n\t\treturn true;\n\t}\n\telse\n\t{\n\t\tdocument.getElementById(\"emailErrorField\").innerHTML = \"Email invalid.\"\n\t\treturn false;\n\t}\n}", "function validate_email() {\n return email.length > 0 && email.length < 50;\n }", "function usernames(value) {\n var mailformat = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$/;\n\n if (value.length < 3) {\n return 'Must be at least 3 characters long';\n }\n if (value.length > 20) {\n return 'Cannot be more than 20 characters long'\n }\n if (value.match(mailformat)) {\n return '';\n }\n else{\n return 'Not a valid email'\n }\n}", "function validEmail(field, name){\n\tvar value_field = $(field).val().trim();\n\tvar retorno;\n if ((/^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/.test(value_field)) || (!value_field)) {\n retorno=true;\n } else {\n $('.alert.bg-danger span').html('O campo ' + name + ' deve ser um email válido.');\n\t\t$('.alert.bg-danger').show('fast');\n $(field).focus();\n retorno=false;\n\t}\n\treturn retorno;\n}", "function validateEmail(e) { \n\t\texpr = /^([a-zA-Z0-9_\\.\\-])+\\@(([a-zA-Z0-9\\-])+\\.)+([a-zA-Z0-9]{2,4})+$/; //This is a regular expression that help us validate e-mail format//\n\t\tif (email.value == \"\" || email.value == null) {\n\t\t\tconsole.log(\"Empty e-mail\");\n\t\t\terrors.push(\"<li>Please write your email correctly</li>\");\n\t\t\te.preventDefault();\n\t\t}else {\n\t\t\tif (!expr.test(email.value)) {\n\t\t\t\tconsole.log(\"Invalid e-mail format\");\n\t\t\t\terrors.push(\"<li>Please write your email correctly</li>\");\n\t\t\t\te.preventDefault();\n\t\t\t}else{\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n \n} //End validateEmail//", "function emailVerification(myForm) {\r\n\tre = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/\r\n\tif (re.test(myForm.emailAddr.value)) {\r\n\t\tdocument.getElementById(\"email\").innerHTML= \"Thanks \"+myForm.emailAddr.value;\t\r\n\t}\r\n\telse{\r\n\t\talert(\"Invalid email address\")\r\n\t}\r\n}", "function validateForm(){\nvar x=document.forms[\"contact\"][\"email\"].value;\nvar atpos=x.indexOf(\"@\");\nvar dotpos=x.lastIndexOf(\".\");\n\nif (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length || x == \"[email protected]\"){\n document.getElementById('messageInsert').innerHTML = \"Your email appears invalid!\";\n return false;\n }\nvar y=document.forms[\"contact\"][\"name\"].value;\nif (y==null || y==\"\" || y == \"Your name\"){\n document.getElementById('messageInsert').innerHTML = \"Something seems wrong with your name!\";\n return false;\n }\nvar z=document.forms[\"contact\"][\"message\"].value;\nif (z==null || z==\"\" || z == \"Type your message\"){\n document.getElementById('messageInsert').innerHTML = \"Please type your message!\";\n return false;\n }\n if(atpos>1 || dotpos>=atpos+2 || dotpos+2<x.length || y!=null || y!=\"\" || z!=null || z!=\"\"){\n alert(\"Thanks for getting in touch. We'll get back to you shortly.\");\n }\n}", "function emailQualifies(){\n\t\t\n\t\t// Get the ID of the email holder and store it in emailOption.\n\t\tvar emailOption = document.getElementById(\"email\").value;\n\t\t\n\t\t// Store the email regex checker in a var.\n\t\tvar emailRegex = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$/;\n\t\t\n\t\t// Test if the email entered passes the regex test.\n\t\tvar emailValid = emailRegex.test(emailOption);\n\t\t\n\t\t// If its a valid email.. continue,\n\t\tif(emailValid){\n\t\t\treturn true;\n\t\t}\n\t\t// else return an error.\n\t\telse{\n\t\t\treturn false;\n\t\t}\n\t} // End emailQualifies.", "function checkMail() {\n if (getMail().length > 0) {\n if (isSignExist() && isSignSame() && isCharbefSign() && isDotExist() && isDotSame() && isCharbefDotAfSign() && isAfterDot()) {\n return true;\n }\n else {\n return false;\n }\n }\n //nothing put in mail box\n else {\n document.eMail.uMail.style.borderColor = \"grey\";\n document.getElementById(\"errMail\").style.display = \"none\";\n return false;\n }\n}", "function checkEmail(input){\r\n var re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\r\n if(re.test(input.value.trim())){\r\n showSuccess(input);\r\n }else{\r\n showError(input, ' email is not valid');\r\n }\r\n}", "function isInputError(name, tel, email) {\n if (name.length == 0) {\n alert(\"Empty name!\");\n }\n // check for empty fields\n else if (tel.length == 0 && email.length == 0) {\n alert(\"Provide tel or email!\");\n }\n // check for valid tel no\n else if (tel.length > 0 && !isValidTel(tel)) {\n alert(\"Invalid telephone number!\");\n }\n // check for valid email\n else if (email.length > 0 && !isValidEmail(email)) {\n alert(\"Invalid email address!\");\n }\n // no error\n else { \n \treturn false;\n }\n return true;\n}", "function msg() {\n\tvar name = document.getElementById(\"name\").value;\n\tvar n = /^[A-Za-z\\s]+$/;\n\tvar mob = document.getElementById(\"number\").value;\n\tvar m = /^[0-9]{10}$/;\n\tvar email = document.getElementById(\"email\").value;\n\tvar e = /^([A-Za-z0-9\\.\\_])+\\@(([A-za-z0-9\\_]+\\.)+([A-Za-z]{2,3}))$/;\n\tvar fb = document.getElementById(\"fb_descp\").value;\n\tif (!name.match(n)) {\n\t\talert('Enter valid name');\n\t\treturn false;\n\t}\n\telse if (!mob.match(m)) {\n\t\talert('Invalid mobile number');\n\t\treturn false;\n\t}\n\telse if (!email.match(e)) {\n\t\talert('Enter valid email');\n\t\treturn false;\n\t}\n\telse if (fb == '') {\n\t\talert('Feedback cannot be empty');\n\t\treturn false;\n\t}\n\telse {\n\t\treturn true;\n\t}\n}", "function emailValidation(){\n if (/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(emailNode.value)){\n return true;\n }\n alert(\"You have entered an invalid email address!\");\n return false;\n }", "function checkNewForm(){\n let formElement = document.querySelector(\"#checkNewForm\");\n let fornavn = formElement.fornavn;\n let efternavn = formElement.efternavn;\n let email = formElement.email;\n let postnr = formElement.postnr;\n let by_navn = formElement.by;\n\n //Tjek fornavn\n if(fornavn.value === \"\"){\n console.log(\"Tjekker navn\");\n failtext(\"#namefail\", \"Du skal indtaste dit navn\");\n return false;\n }else if (!/^[a-zA-Z]*$/){\n failtext(\"#namefail\", \"Du kan kun bruge bogstaver i dit navn\");\n return false;\n }else{\n clear(\"#namefail\");\n }\n\n //Tjek efternavn\n if(efternavn.value === \"\"){\n console.log(\"Tjekker efternavn\");\n failtext(\"#enamefail\", \"Du skal indtaste dit efternavn\");\n return false;\n } else if (!/^[a-zA-Z]*$/) {\n failtext(\"#enamefail\", \"Du kan kun bruge bogstaver i dit efternavn\");\n return false;\n } else{\n clear(\"#enamefail\");\n }\n\n //Tjek email\n if(email.value === \"\"){\n console.log(\"tjekker email\");\n failtext(\"#emailfail\", \"Du skal indtaste en email\");\n return false;\n }else if (!/([a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?: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]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])/){\n failtext(\"#emailfail\", \"Du skal skrive en valid email\");\n return false;\n }else {\n clear(\"#emailfail\");\n }\n\n //Tjek postnr\n if(postnr.value === \"\"){\n console.log(\"tjekker postnr\");\n failtext(\"#postfail\", \"Du skal indtaste dit postnummer\");\n return false;\n }else if (postnr.value.length != 4){\n failtext(\"#postfail\", \"Dit postnummer skal bestå af 4 cifre\");\n return false;\n }else {\n clear(\"#postfail\");\n }\n\n //Tjek by\n if(by_navn.value === \"\"){\n console.log(\"tjekker bynavn\");\n failtext(\"#byfail\", \"Du skal indtaste den by du bor i\");\n return false;\n }else if (!/^[a-zA-ZæøåÆØÅ]*$/){\n failtext(\"#byfail\", \"Du kan kun bruge bogstaver i by navnet\");\n return false;\n }else if(by_navn.value.length < 2){\n failtext(\"#byfail\", \"Du skal indtaste et valideret bynavn\");\n return false;\n }else{\n clear(\"#byfail\");\n }\n}", "function validateBioPerson(){\n\tvar boo = true;\n\tvar name=$('input[name=BP-name]');\n\tif (name[0].value==null || name[0].value==\"\"){\n\t\tsetErrorOnBox(name);\n\t//\tname.focus();\n\t\tboo = false;\n\t} else{\n\t\tsetValidOnBox(name);\n\t}\n \n\tvar mail=$('input[name=BP-mail]');\n\t\n\tif (!validateEmail(mail)){\n\t\tsetErrorOnBox(mail);\n\t//\tmail.focus();\n\t\tboo = false;\n\t} else{\n\t\tsetValidOnBox(mail);\n\t}\n\t\n\treturn boo;\n}", "function checkEmail(email) {\n var re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if(re.test(email.value.trim())){\n showSuccess(email);\n } else {\n showError(email, 'Email is not valid');\n }\n\n}", "function simpleEmailValidation(emailAddress) {\n\n}", "function validateMail() {\r\n\t// empty field\r\n\tif (email.value == \"\") {\r\n\t\talertEmail.textContent = \"Email cannot be blank.\";\r\n\t\temail.focus();\r\n\t\treturn false;\r\n\t}\r\n\r\n\t// valid email\r\n\tif (!(/^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/.test(email.value))) {\r\n\t\talertEmail.textContent = \"Enter a valid email address.\";\r\n\t\temail.focus();\r\n\t\treturn false;\r\n\t}\r\n}", "function validate() {\n\t //pattern for name\n\t var reName = /^[a-zA-Z][a-zA-Z0-9]*$/\n\t // pattern for phone number\n\t var rePhone = /^\\d{3}-\\d{3}-\\d{4}$/;\n\t // pattern for email\n\t var reEmail = /^\\S+@\\S+\\.\\S+$/;\n\t // pattern for zipcode\n\t var reZip = /(^\\d{5}$)|(^\\d{5}-\\d{4}$)/;\n\t // save all missed items\n\t var missedStr = \"\";\n\t if (newName.value!=\"\" && newName.value!=null && !reName.test(newName.value)) {\n\t \tmissedStr = \"Account name is not valid. Account name can only be upper or lower case letters and numbers, but may not start with a number.\\n\" + missedStr;\n\t }\n\t if (newEmail.value!=\"\" && newEmail.value!=null && !reEmail.test(newEmail.value)) {\n\t \tmissedStr = missedStr + \"The email is not valid.\\n\"\n\t }\n\t if (newZipcode.value!=\"\" && newZipcode.value!=null &&!reZip.test(newZipcode.value)) {\n\t \tmissedStr = \"Zipcode is not valid and the format should be xxxxx or xxxxx-xxxx.\\n\" + missedStr;\n\t }\n\t \n\t\tif (newPhone.value!=\"\" && newPhone.value!=null &&!rePhone.test(newPhone.value)) {\n\t \tmissedStr = \"The phone number format should be xxx-xxx-xxxx.\\n\" + missedStr;\n\t }\n\n\t if (newPassword.value != newPwconfirm.value) {\n\t \tmissedStr = missedStr + \"The password is not the same as password confirmation.\\n\";\t\n\t }\n\t if (missedStr != \"\") {\n\t \talert(missedStr);\n\t \treturn false;\n\t }\n\t return true;\n\t}", "function validateEmail() {\n let reg = /^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/;\n if (reg.test(state.email) === false) {\n isError = true;\n errors.emailError = \"Enter valid Email\";\n }\n else {\n isError = false;\n }\n if(isError){\n setState({\n ...state,\n ...errors})\n}\n }", "function validateEmail(){\r\n\t\tvar x = document.survey_form.email.value; //get the value\r\n\t\tvar emailPattern = /^[a-zA-Z._-]{1,25}[@][a-zA-Z]{1,25}[.][a-zA-Z]{3}$/; //variable storing the pattern\r\n\t\tvar emailPattern2 = /^[a-zA-Z._-]{1,25}[@][a-zA-Z]{1,25}[.][a-zA-Z]{1,25}[.][a-zA-Z]{3}$/; //variable storing the pattern\r\n\t\tif(emailPattern.test(x) ||emailPattern2.test(x)){;}\r\n\t\telse{alert(\"Please enter an email address. For example: [email protected]\")}\r\n\t}", "function validEmail(check){\n return /^\\w+@\\w+(\\.(\\w)+)$/i.test(check.value);\n}", "function validateFields() {\n\tlname = document.getElementById(\"lname\").value;\n\tfname = document.getElementById(\"fname\").value;\n\tusername = document.getElementById(\"uname\").value;\n\t\n\tif (true) {\n\t\tvalidatePassword();\n\t}\n\tif(valForm.pwd.value != valForm.con_pwd.value){\n\t\talert(\"Error: Password MISMATCH !\");\n\t}\n\t\n\tif (fname.length <=8 ) {\n\t\talert(\"Error: First Name must contain at least 8 characters!\");\n\t}\n\tif (!validateEmail()) {\n\t\talert(\"Not a valid e-mail address ..\");\n\t}\n}", "function validateEmail()\n {\n \n var x=document.forms[\"profile\"][\"email\"].value;\nvar atpos=x.indexOf(\"@\");\nvar dotpos=x.lastIndexOf(\".\");\nif (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)\n {\n alert(\"e-mail address is not valid\");\n return false;\n }\n \n }", "function ValidateForm_Email(user_new, user_email){\n var reg = /^([A-Za-z0-9_\\-\\.])+\\@([A-Za-z0-9_\\-\\.])+\\.([A-Za-z]{2,4})$/;\n var address = document.forms[user_new].elements[user_email].value;\n if(reg.test(address) == false) {\n alert('Invalid Email Address');\n return false;\n }\n else if($(\"#user_first_name\").val() == \"\") {\n alert('Please Enter First Name.');\n return false;\n }\n else if($(\"#user_last_name\").val() == \"\") {\n alert('Please Enter Last Name.');\n return false;\n }\n}", "function emailIsValid(email) {\n return /\\S+@\\S+\\.\\S+/.test(email);\n }", "function validEmail(value) {\n const addy = /\\S+@\\S+\\.\\S+/;\n if (value.match(addy)) return true;\n else return \"Please enter a valid email address.\";\n}", "function checkEmail(input) {\n const re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if (re.test(input.value.trim())) {\n showSuccess(input);\n } else {\n showError(input, `${getFieldId(input)} is not a valid email`)\n }\n}", "function emailSend(){\n var email = document.getElementById('email_submission');\n var name = document.getElementById('name_submission');\n var message = document.getElementById('message_submission');\n var successOrNot = document.getElementById('success_email');\n\n if (!email.value || !name.value || !message.value){\n /* This will print an error because there is nothing in those fields */\n successOrNot.innerHTML = \"You didn't fill everything out!\";\n } else {\n successOrNot.innerHTML = \"Success! Email sent!\";\n }\n\n}", "function validate_text() {\n console.log(\"I am calling this function\");\n // Gets value of name input and stores it in the text_input variable\n let text_input = document.getElementById(\"f_name\").value;\n\n // Removes spaces from the text input to aid the validation process\n text_input = text_input.split(\" \").join(\"\");\n\n // Gets value of email input and stores it in the email_input variable\n let email_input = document.getElementById(\"e_name\").value;\n\n // Logic to validate that neither the name box not the email address box is left blank\n if (text_input.trim() === \"\" || email_input.trim() === \"\") {\n alert(\"Blank values are not allowed for the Name and email categories\");\n return false;\n }\n\n // Logic to validate that text entered in the name segment is part of the valid set as described in the assignment.\n let valid_text = new Set(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '-']);\n for (let i = 0; i < text_input.length ; i++){\n if (!valid_text.has(text_input[i].toLowerCase())){\n alert(\"Name box only accepts valid english alphabets and hyphens\");\n return false;\n }\n }\n\n // Logic to validate that email structure is standard and not invalid\n let valid_email = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if (!valid_email.test(String(email_input).toLowerCase())){\n alert(\"Email address is not valid. Please enter a valid address\");\n return false;\n }\n alert(\"Thank you for your inquiry! You would be contacted within the next three days.\");\n return true;\n}", "function checkEmail(input) {\n const re = /^(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if(re.test(input.value.trim())) {\n showSuccess(input);\n } else {\n showError(input, 'Email is not valid');\n }\n }", "function validateEmail(){\r\n\r\n \t\tvar email=document.getElementById(\"email\").value;\r\n\r\n\r\n \tif(email.length==0){\r\n\r\n \t\t\tprintError(\"email required\",\"emailError\",\"red\");\r\n\t\ttextboxBorder(\"email\");\r\n\t\treturn false;\r\n\r\n \t}\r\n \tif(!email.match(/^[a-z0-9](\\.?[a-z0-9_-]){0,}@[a-z0-9-]+\\.([a-z]{1,6}\\.)?[a-z]{2,6}$/)){\r\n \t\tprintError(\"enter Valid email\",\"emailError\",\"red\");\r\n\t\ttextboxBorder(\"email\");\r\n\t\treturn false;\r\n\r\n \t}\r\n\r\n\r\n\tprintSuccess(\"email\",\"green\",\"emailError\");\r\nreturn true;\r\n\r\n\r\n \t}", "function validateUsername(username){\n var result = true;\n if (username == \"\")\n {\n message = \"Username is required\";\n result = false;\n console.log(message);\n }\n else if(!(/^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$/.test(username)))\n {\n message = \"Please enter a valid email address\";\n result = false;\n console.log(message);\n }\n return result;\n}", "function checkEmail (input) {\n const re = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n if (re.test(input.value.trim())) {\n showSuccess(input);\n } else {\n showError(input, 'Email is not valid');\n }\n}" ]
[ "0.72876227", "0.72092676", "0.7138774", "0.6939998", "0.68874925", "0.68563795", "0.6844679", "0.68276906", "0.67909074", "0.67764115", "0.673086", "0.67229444", "0.6699208", "0.66854614", "0.66806394", "0.66806203", "0.66764474", "0.6672204", "0.66700214", "0.66590005", "0.6644767", "0.66403824", "0.65958", "0.65956175", "0.65945745", "0.65807086", "0.65797013", "0.65765", "0.6569793", "0.65662533", "0.65478706", "0.65400636", "0.6526181", "0.6525394", "0.6519536", "0.6516061", "0.6509672", "0.65080804", "0.6506318", "0.6489775", "0.6487849", "0.6486485", "0.64820963", "0.64783233", "0.64771175", "0.6475167", "0.6473671", "0.64715165", "0.6470919", "0.6468945", "0.6463484", "0.64626443", "0.6461223", "0.6460241", "0.64543045", "0.64519876", "0.64485466", "0.64421606", "0.6439432", "0.6437383", "0.6426967", "0.64267755", "0.6418567", "0.641803", "0.64168984", "0.64162594", "0.6412824", "0.64113986", "0.64082044", "0.63983417", "0.63862216", "0.63827705", "0.6381943", "0.6380991", "0.63795894", "0.637578", "0.63731766", "0.6369606", "0.6365007", "0.6364957", "0.6363263", "0.6362401", "0.63576835", "0.6348303", "0.634225", "0.6342115", "0.6340927", "0.6335019", "0.6333379", "0.6326247", "0.6326117", "0.6325163", "0.6319929", "0.6318551", "0.6318064", "0.6315583", "0.631442", "0.63131016", "0.6305649", "0.6303507", "0.6296273" ]
0.0
-1
representa al car de proveedor que va a estar insertado en el contenedor
function DatProveedor(id, nom, cor, cel) { return '<div class="row padding-0">' + ' <div class="col">' + ' <div class="card">' + ' <div class="card-header" id="headingOne">' + ' <h2 class="row mb-0">' + ' <div class="col-8" data-toggle="collapse"' + ' data-target="#collapseExample' + id + '" aria-expanded="false"' + ' aria-controls="collapseExample' + id + '">' + ' <div >' + ' <h5>' + nom + '</h5>' + ' </div>' + ' </div>' + ' <div class="col-4">' + ' <button type="button" onclick="deleProvee(' + id + ')" id="NewProdut"' + ' class="btn btn-outline-danger btn-block rounded-pill">Eliminar</button>' + ' </div>' + ' </h2>' + ' </div>' + ' <div class="collapse" id="collapseExample' + id + '">' + ' <div class="card card-body">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text"' + ' id="basic-addon1">👷</span>' + ' </div>' + ' <input type="text" id="ProveeNombre' + id + '" value="' + nom + '" class="form-control"' + ' placeholder="Nombre del prodcuto"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text"' + ' id="basic-addon1">📧</span>' + ' </div>' + ' <input type="text" id="ProveeCorreoElectonico' + id + '" value="' + cor + '" class="form-control"' + ' placeholder="Correo electronico"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' <div class="col">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text"' + ' id="basic-addon1">📱</span>' + ' </div>' + ' <input type="text" id="ProveeCelular' + id + '" value="' + cel + '" class="form-control"' + ' placeholder="Celular"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <button type="button" onclick="ActuProvee(' + id + ')" id="NewProdut"' + ' class="btn btn-success btn-block">Actualizar' + ' Proveedor</button>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertarNodoP(proceso,nombre, tiempo, quantum,tll, tf, tr, pr,rar,ne,contenido){\r\n\tvar nuevo = new nodo();\r\n\tnuevo.proceso = proceso;\r\n\tnuevo.nombre=nombre;\r\n\tnuevo.tiempo = tiempo;\r\n\tnuevo.quantum = quantum;\r\n\tnuevo.Tllegada=tll;\r\n\tnuevo.Tfinalizacion=tf;\r\n\tnuevo.Turnarround=tr;\r\n\t\r\n\tnuevo.prioridad=pr;\r\n\tnuevo.rafagareal=rar;\r\n\tnuevo.numEjecucion=ne;\r\n\tnuevo.contenido=contenido;\r\n\tnuevo.sig = null;\r\n\t\r\n\tnuevo.sig = null;\r\n\r\n\tif(this.vacia()){\r\n\t\tthis.raiz = nuevo;\r\n this.fondo = nuevo;\r\n\t}else{\r\n\t\tthis.raiz = nuevo;\r\n\t\tthis.raiz.sig = this.fondo;\r\n\t\tthis.fondo = this.raiz;\r\n\t}\r\n}", "@action\n insert() {\n this.error = undefined;\n const { participants, absentees } = this.collectParticipantsAndAbsentees();\n const info = {\n chairman: this.chairman,\n secretary: this.secretary,\n participants,\n absentees,\n };\n if (absentees.includes(this.chairman)) {\n this.error = this.intl.t(\n 'participation-list-modal.chairman-absent-error',\n );\n return;\n }\n this.args.onSave(info);\n this.args.onCloseModal();\n }", "insertarPersona (persona) {\n let valores = `${ persona.getNombre() }, ${ persona.getApellido() }, ${ persona.getDireccion() }, ${ persona.getEdad() }, ${ persona.getTelefono() }, ${ persona.getCorreo() }`;\n let r = this.db.push(valores);\n if (r) {\n console.log( \"PERSONA_INSERTADA\" );\n } else {\n console.log( \"ERROR_PERSONA_INSERTADA\" );\n }\n }", "function insertAnuncio(anuncio) {\n\n // Calcula novo Id a partir do último código existente no array para novo cadastro. Se edição, retorna valor salvo\n if (edicao != 1) {\n novoId = (dados.livros.length)+1;\n }\n else {\n novoId = idAtual;\n }\n \n // Organiza os dados na forma do registro\n let novoAnuncio = {\n \"user_id\": usuario_logado,\n \"id\": novoId,\n \"fotAn\": anuncio.fotAn,\n \"titAn\": anuncio.titAn,\n \"descAn\": anuncio.descAn,\n \"locAn\": anuncio.locAn,\n \"contAn\": anuncio.contAn\n };\n\n // Insere o novo objeto no array para novos cadastros, ou atualiza em caso de edição\n if (edicao != 1) {\n dados.livros.push(novoAnuncio);\n displayMessage(\"Anuncio inserido com sucesso!\");\n }\n else {\n dados.livros[novoId-1] = novoAnuncio;\n displayMessage(\"Anuncio atualizado com sucesso!\");\n }\n\n // Atualiza os dados no Local Storage\n localStorage.setItem('dados', JSON.stringify(dados));\n\n // Altera \"edicao\" para diferente de 1, considerando que a próxima tarefa seja novo cadastro\n edicao = 0;\n}", "function insertarNodoU(proceso,nombre, tiempo, quantum,tll, tf, tr, pr,rar, ne,contenido){\r\n\tvar nuevo = new nodo();\r\n\tvar colaTemp = new cola();\r\n\tnuevo.proceso = proceso;\r\n\tnuevo.nombre=nombre;\r\n\tnuevo.tiempo = tiempo;\r\n\tnuevo.quantum = quantum;\r\n\tnuevo.Tllegada=tll;\r\n\tnuevo.Tfinalizacion=tf;\r\n\tnuevo.Turnarround=tr;\r\n\tnuevo.numEjecucion=ne;\r\n\t\r\n\t\r\n\tnuevo.prioridad=pr;\r\n\tnuevo.rafagareal=rar;\r\n\tnuevo.contenido=contenido;\r\n\tnuevo.sig = null;\r\n\t\r\n\tif(this.vacia()){\r\n\t\tthis.raiz = nuevo;\r\n this.fondo = nuevo;\r\n\t}else{\r\n\t\twhile(!this.vacia()){\t\r\n\t\t\tvar temp = new nodo();\t\t\r\n\t\t\ttemp = this.extraerPrimero();\r\n\t\t\tcolaTemp.insertarPrimero(temp.proceso,temp.nombre, temp.tiempo, temp.quantum,temp.Tllegada,\r\n\t\t\t\ttemp.Tfinalizacion,temp.Turnarround,temp.prioridad,temp.rafagareal,temp.numEjecucion,temp.contenido); \t\t\r\n\t\t}\r\n\t\tthis.insertarPrimero(proceso,nombre, tiempo, quantum,tll, tf, tr, pr,rar,ne,contenido);\t\t\r\n\t\twhile(!colaTemp.vacia()){\r\n\t\t\tvar temp = new nodo();\t\t\r\n\t\t\ttemp = colaTemp.extraerPrimero();\r\n\t\t\tthis.insertarPrimero(temp.proceso,temp.nombre, temp.tiempo, temp.quantum,temp.Tllegada,\r\n\t\t\t\ttemp.Tfinalizacion,temp.Turnarround,temp.prioridad,temp.rafagareal,temp.numEjecucion,temp.contenido); \t\r\n\t\t}\r\n\t}\r\n}", "function insertar_comprobantes()\r\n\t\t\t{\r\n\t\t\t\t\t\r\n\t\t\t\tvar id_tipo_comprobantes=document.getElementById('id_tipo_comprobantes').value;\r\n\t\t\t\tvar fecha_ccomprobantes=document.getElementById('fecha_ccomprobantes').value;\r\n\t\t\t\tvar concepto_ccomprobantes=document.getElementById('concepto_ccomprobantes').value;\r\n\t\t\t\t\r\n\t\t\t\tvar error=\"TRUE\";\r\n\t\t\t\t\r\n\t\t\t\tif (id_tipo_comprobantes == 0)\r\n\t\t \t{\r\n\t\t\t \t\r\n\t\t \t\t$(\"#mensaje_id_tipo_comprobantes\").text(\"Seleccione Tipo\");\r\n\t\t \t\t$(\"#mensaje_id_tipo_comprobantes\").fadeIn(\"slow\"); //Muestra mensaje de error\r\n\t\t \r\n\t\t \t\terror =\"TRUE\";\r\n\t\t \t\treturn false;\r\n\t\t\t }\r\n\t\t \telse \r\n\t\t \t{\r\n\t\t \t\t$(\"#mensaje_id_tipo_comprobantes\").fadeOut(\"slow\"); //Oculta mensaje de error\r\n\t\t \t\terror =\"FALSE\";\r\n\t\t\t\t}\r\n\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}", "function insertarglobal(tbl,arreglo,v=0){\n var base;\n\n if(tbl==\"paquete\"){\n base = firebase.database().ref(\"Productos\");\n }else{\n if(tbl==\"Foto\"){\n base = firebase.database().ref(\"Ventas\");\n }else{\n base = firebase.database().ref(tbl);\n }\n \n }\n var vacio=false;\n if(tbl==\"Ventas\" || tbl==\"Foto\"){\n\n }else{\n \nfor(var k=0;k<arreglo.length;k++){\n if(obtener(arreglo[k]).length==0 ){\n vacio=true;\n return nowuiDashboard.showNotification('top','center',\"<b>rellene todos los campos!</b>\",\"warning\");\n }\n}\n }\n\n\nvar obj = new Object;\nconsole.log(\"insertando\");\nfor(var i=0;i<arreglo.length;i++){\n \n if(v==1 && arreglo[i]==\"detalle\"){\n console.log(\"una venta agregandose\");\n var n = document.getElementById(\"dettable\").rows.length;\n var det = \"\";\n var detax ;\n for(var j =1;j<n;j++){\n console.log(\"producto N \"+j);\n detax = document.getElementById(\"d\"+j).options.selectedIndex;\n det+= document.getElementById(\"d\"+j).options.item(detax).text;\n //alert(detax+\" \"+document.getElementById(\"d\"+j).options.item(detax).text);\n det+=\" *\"+obtener(\"c\"+j)+\" : $\"+obtener(\"s\"+j);\n det+=\";\";\n if(tbl==\"Ventas\"){\n // alert(\"actualizar existencias\");\n existencias(document.getElementById(\"d\"+j).value,obtener(\"c\"+j));\n }\n }\n obj[arreglo[i]]=det;\n console.log(\"se acabo la venta\");\n }else if(arreglo[i]==\"cliente\" || arreglo[i]==\"vendedor\"){\n var det=\"\";\n var detax;\n detax = document.getElementById(arreglo[i]).options.selectedIndex;\n det= document.getElementById(arreglo[i]).options.item(detax).text;\n obj[arreglo[i]]=det;\n }else if (arreglo[i]==\"detalle\" && tbl!=\"paquete\"){\n var sel = document.getElementById(arreglo[i]).selectedOptions;\n var det=\"\";\n for(var j=0;j<sel.length;j++){\n det+=sel[i].label;\n if(j!=sel.length-1){\n det+=\",\";\n }\n }\n obj[arreglo[i]]=det;\n }else{\n obj[arreglo[i]]=obtener(arreglo[i]);\n }\n \n}\nbase.once(\"value\",function(snap){\n var aux = snap.val();\n var n = 1;\n if(tbl==\"paquete\"){\n id=\"Paqu\";\n }else{\n if(tbl==\"Foto\"){\n id=\"Foto\";\n }else{\n id=tbl.substring(0,4);\n }\n \n }\n\n for(var documento in aux){ \n if(tbl==\"paquete\"){\n if(documento.substring(0,4)==\"Paqu\"){\n n++;\n }\n }else{\n if(tbl==\"Foto\"){\n if(documento.substring(0,4)==\"Foto\"){\n n++;\n }\n }else if(tbl==\"Productos\"){\n if(documento.substring(0,4)==\"Prod\"){\n n++;\n }\n }else if(tbl==\"Ventas\"){\n if(documento.substring(0,4)==\"Vent\"){\n n++;\n }\n }\n else{\n n++;\n }\n }\n \n}\nif(n>=10000){\n id+=\"0\"+n;\n}else if(n>=1000){\n id+=\"00\"+n;\n}else if(n>=100){\n id+=\"000\"+n;\n}\nelse if(n>=10){\n id+=\"0000\"+n;\n}\nelse{\n id+=\"00000\"+n;\n}\nbase.child(id).set(obj);\nnowuiDashboard.showNotification('top','center',\"<b>REGISTRO EXITOSO!</b>\",\"success\");\nsetTimeout(function(){location.reload()},3000);\nif(tbl==\"Ventas\"){\n imp(id,1);\n}else if(tbl==\"Foto\"){\n imp(id,1,1);\n}\n});\n\n}", "function ajoutContrat_prestataire(contrat_prestataire,suppression)\n {\n if (NouvelItemContrat_prestataire==false)\n {\n apiFactory.getAPIgeneraliserREST(\"contrat_prestataire/index\",'menus',\"getcontrat_mpevalideById\",'id_contrat_mpe',contrat_prestataire.id).then(function(result)\n {\n var contrat_prestataire_valide = result.data.response;\n if (contrat_prestataire_valide.length !=0)\n {\n var confirm = $mdDialog.confirm()\n .title('cette modification n\\'est pas autorisé. Les données sont déjà validées!')\n .textContent('')\n .ariaLabel('Lucky day')\n .clickOutsideToClose(true)\n .parent(angular.element(document.body))\n .ok('Fermer')\n \n $mdDialog.show(confirm).then(function()\n { \n vm.allcontrat_prestataire = contrat_prestataire_valide;\n vm.stepattachement = false;\n }, function() {\n //alert('rien');\n });\n }\n else\n {\n test_existanceContrat_prestataire (contrat_prestataire,suppression); \n }\n }); \n } \n else\n {\n insert_in_baseContrat_prestataire(contrat_prestataire,suppression);\n }\n }", "function insert_in_baseContrat_prestataire(contrat_prestataire,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemContrat_prestataire==false)\n {\n getId = vm.selectedItemContrat_prestataire.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n description: contrat_prestataire.description,\n num_contrat: contrat_prestataire.num_contrat,\n cout_batiment: contrat_prestataire.cout_batiment,\n cout_latrine: contrat_prestataire.cout_latrine,\n cout_mobilier:contrat_prestataire.cout_mobilier,\n //date_signature:convertionDate(contrat_prestataire.date_signature),\n id_prestataire:contrat_prestataire.id_prestataire,\n // paiement_recu: 0,\n id_convention_entete: vm.selectedItemConvention_entete.id,\n validation : 0 \n });\n console.log(datas);\n //factory\n apiFactory.add(\"contrat_prestataire/index\",datas, config).success(function (data)\n { \n var pres= vm.allprestataire.filter(function(obj)\n {\n return obj.id == contrat_prestataire.id_prestataire;\n });\n\n if (NouvelItemContrat_prestataire == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n {\n vm.selectedItemContrat_prestataire.prestataire = pres[0];\n \n vm.selectedItemContrat_prestataire.$selected = false;\n vm.selectedItemContrat_prestataire.$edit = false;\n vm.selectedItemContrat_prestataire ={};\n vm.showbuttonNouvContrat_prestataire= false;\n }\n else \n { \n vm.allcontrat_prestataire = vm.allcontrat_prestataire.filter(function(obj)\n {\n return obj.id !== vm.selectedItemContrat_prestataire.id;\n });\n vm.showbuttonNouvContrat_prestataire= true;\n }\n \n }\n else\n {\n contrat_prestataire.prestataire = pres[0];\n contrat_prestataire.validation = 0;\n contrat_prestataire.id = String(data.response); \n NouvelItemContrat_prestataire=false;\n vm.showbuttonNouvContrat_prestataire= false;\n } \n vm.validation_contrat_prestataire = 0; \n // vm.showbuttonValidationcontrat_prestataire = false;\n contrat_prestataire.$selected = false;\n contrat_prestataire.$edit = false;\n vm.selectedItemContrat_prestataire = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function insert_in_baseContrat_prestataire(contrat_prestataire,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemContrat_prestataire==false)\n {\n getId = vm.selectedItemContrat_prestataire.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n description: contrat_prestataire.description,\n num_contrat: contrat_prestataire.num_contrat,\n cout_batiment: contrat_prestataire.cout_batiment,\n cout_latrine: contrat_prestataire.cout_latrine,\n cout_mobilier:contrat_prestataire.cout_mobilier,\n //date_signature:convertionDate(contrat_prestataire.date_signature),\n id_prestataire:contrat_prestataire.id_prestataire,\n // paiement_recu: 0,\n id_convention_entete: vm.selectedItemConvention_entete.id,\n validation : 0 \n });\n console.log(datas);\n //factory\n apiFactory.add(\"contrat_prestataire/index\",datas, config).success(function (data)\n { \n var pres= vm.allprestataire.filter(function(obj)\n {\n return obj.id == contrat_prestataire.id_prestataire;\n });\n\n if (NouvelItemContrat_prestataire == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n {\n vm.selectedItemContrat_prestataire.prestataire = pres[0];\n \n vm.selectedItemContrat_prestataire.$selected = false;\n vm.selectedItemContrat_prestataire.$edit = false;\n vm.selectedItemContrat_prestataire ={};\n vm.showbuttonNouvContrat_prestataire= false;\n }\n else \n { \n vm.allcontrat_prestataire = vm.allcontrat_prestataire.filter(function(obj)\n {\n return obj.id !== vm.selectedItemContrat_prestataire.id;\n });\n vm.showbuttonNouvContrat_prestataire= true;\n }\n \n }\n else\n {\n contrat_prestataire.prestataire = pres[0];\n contrat_prestataire.validation = 0;\n contrat_prestataire.id = String(data.response); \n NouvelItemContrat_prestataire=false;\n vm.showbuttonNouvContrat_prestataire= false;\n } \n vm.validation_contrat_prestataire = 0; \n // vm.showbuttonValidationcontrat_prestataire = false;\n contrat_prestataire.$selected = false;\n contrat_prestataire.$edit = false;\n vm.selectedItemContrat_prestataire = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function inserir(){\n\n\t\t\tvm.obj.ordem = vm.lista.length + 1;\n\n\t\t\treturn CRUDService.categoria().inserir(vm.obj).then(function(data) {\n\n\t\t\t\tif(data.success){\n\n\t\t\t\t\tvm.lista.push(angular.copy(vm.obj));\n\t\t\t\t\talert('Inserido');\n\t\t\t\t\t\n\n\t\t\t\t}else{\n\n\t\t\t\t\talert('Erro');\n\n\t\t\t\t};\n\n\t\t\t\treturn data;\n\n\t\t\t});\n\n\t\t}", "function ajoutContrat_prestataire(contrat_prestataire,suppression)\n {\n if (NouvelItemContrat_prestataire==false)\n {\n if (vm.session==\"AAC\")\n {\n apiFactory.getAPIgeneraliserREST(\"contrat_prestataire/index\",'menus',\"getcontrat_mpevalideById\",'id_contrat_mpe',contrat_prestataire.id).then(function(result)\n {\n var contrat_prestataire_valide = result.data.response;\n if (contrat_prestataire_valide.length !=0)\n {\n var confirm = $mdDialog.confirm()\n .title('cette modification n\\'est pas autorisé. Les données sont déjà validées!')\n .textContent('')\n .ariaLabel('Lucky day')\n .clickOutsideToClose(true)\n .parent(angular.element(document.body))\n .ok('Fermer')\n \n $mdDialog.show(confirm).then(function()\n { \n vm.allcontrat_prestataire = contrat_prestataire_valide;\n vm.stepattachement = false;\n }, function() {\n //alert('rien');\n });\n }\n else\n {\n test_existanceContrat_prestataire (contrat_prestataire,suppression); \n }\n });\n }\n else\n {\n test_existanceContrat_prestataire (contrat_prestataire,suppression);\n }\n \n } \n else\n {\n insert_in_baseContrat_prestataire(contrat_prestataire,suppression);\n }\n }", "function preenche(){\n if(comentario.comentario==\"\"){\n c.email.innerText = \"user: \" + comentario.usuario.email;\n c.textoComentario.innerHTML = 'comentario apagado';\n c.botaoEnviarComentario = c.botoes.children[0];\n }else{\n c.email.innerText = \"user: \" + comentario.usuario.email;\n c.textoComentario.innerHTML = comentario.comentario;\n c.botaoEnviarComentario = c.botoes.children[0];\n }\n }", "function insertarCarrito(curso){\n //se inserta dentro de la tag tbody\n\n const row = document.createElement(\"tr\");\n row.innerHTML = `\n <td> \n \n <img src=\"${curso.imagen}\"> \n \n </td>\n <td>${curso.titulo}</td>\n <td>${curso.precio}</td>\n <td>\n <a href=\"#\" class=\"borrar-curso\" data-id=\"${curso.id}\">X</a>\n </td>\n `;\n listaCursos.appendChild(row);\n //a la tabla donde van los cursos > agrega un hijo > el row \n\n guardarCursoLocalStorage(curso);\n}", "function inserirDeletarDisponibilidadeProduto(produto) {\n\n var objDisponibilidadeProduto = {};\n $scope.nomeProduto = produto.DescProduto;\n\n objDisponibilidadeProduto = {\n DisponibilidadeId: 0,\n FornecedorId: 0,\n ProdutoId: produto.Id\n };\n\n\n if (produto.selected) {\n\n SweetAlert.swal({\n title: \"Deseja realmente indisponibilizar este produto?\",\n text: \"Clique em 'SIM' e adicione uma data de INÍCIO e FIM, caso seja temporariamente.\",\n type: \"warning\",\n showCancelButton: true,\n confirmButtonColor: \"#DD6B55\",\n confirmButtonText: \"SIM\",\n cancelButtonText: \"NÃO\",\n closeOnConfirm: true,\n closeOnCancel: true\n },\n function (isConfirm) {\n\n if (isConfirm) {\n $modal.open({\n templateUrl: 'scripts/SPAFornecedor/produtos/modalDataIndisponibilidade.html',\n controller: 'modalDataIndisponibilidadeCtrl',\n backdrop: 'static',\n scope: $scope,\n resolve: {\n items: function() {\n return objDisponibilidadeProduto;\n } \n },\n size: ''\n });\n } else {\n $scope.inserirDeletarDisponibilidadeProd(true, objDisponibilidadeProduto);\n\n }\n });\n\n } else {\n $scope.inserirDeletarDisponibilidadeProd(false, objDisponibilidadeProduto);\n }\n\n }", "function insertar_carrito(curso){\n const row = document.createElement(\"tr\");\n // Siempre haslo mediante template\n row.innerHTML = \n `\n <td>\n <img src= \"${curso.imagen}\" width=100> \n </td>\n <td>${curso.titulo}</td>\n <td>${curso.precio}</td>\n <td>\n <ahref=\"#\" class=\"borrar-curso\" data-id=\"${curso.id}\">X</a>\n </td>\n `;\n lista_cursos.appendChild(row);\n guardar_curso_local_storage(curso);\n}", "insertRepair(repair) {\n // agregar un dato al final de la lista, como recibe un objeto del tipo Product , puede acceder a sus propiedades\n this.repairList.push({\n name: repair.name,\n dui: repair.dui,\n vehicle: repair.vehicle,\n price: repair.price\n });\n }", "function insert_in_basePv_consta_entete_travaux(pv_consta_entete_travaux,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemPv_consta_entete_travaux==false)\n {\n getId = vm.selectedItemPv_consta_entete_travaux.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n numero: pv_consta_entete_travaux.numero,\n date_etablissement:convertionDate(pv_consta_entete_travaux.date_etablissement),\n montant_travaux:pv_consta_entete_travaux.montant_travaux,\n avancement_global_cumul:pv_consta_entete_travaux.avancement_global_cumul,\n avancement_global_periode: pv_consta_entete_travaux.avancement_global_periode,\n id_contrat_prestataire: vm.selectedItemContrat_prestataire.id \n });\n //factory\n apiFactory.add(\"pv_consta_entete_travaux/index\",datas, config).success(function (data)\n {\n\n if (NouvelItemPv_consta_entete_travaux == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n { \n vm.selectedItemPv_consta_entete_travaux.$selected = false;\n vm.selectedItemPv_consta_entete_travaux.$edit = false;\n vm.selectedItemPv_consta_entete_travaux ={};\n }\n else \n { \n vm.allpv_consta_entete_travaux = vm.allpv_consta_entete_travaux.filter(function(obj)\n {\n return obj.id !== vm.selectedItemPv_consta_entete_travaux.id;\n });\n\n NouvelItemPv_consta_entete_travaux = false;\n }\n \n }\n else\n { \n pv_consta_entete_travaux.id = String(data.response);\n\n NouvelItemPv_consta_entete_travaux = false;\n }\n //vm.showboutonValider = false;\n\n pv_consta_entete_travaux.$selected = false;\n pv_consta_entete_travaux.$edit = false;\n vm.selectedItemPv_consta_entete_travaux = {};\n vm.step_tranche_batiment_mpe = false; \n vm.step_tranche_latrine_mpe = false;\n vm.step_tranche_mobilier_mpe = false;\n\n vm.steprubriquebatiment_mpe = false;\n vm.steprubriquelatrine_mpe = false; \n vm.steprubriquemobilier_mpe = false;\n vm.stepdecompte =false;\n vm.stepfacture_mpe = false;\n vm.stepjusti_pv_consta_entete_travaux_mpe = false;\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function addItemsPuertasItemsMotorizacion(k_coditem_motorizacion,o_descripcion,v_clasificacion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO puertas_items_motorizacion (k_coditem_motorizacion, o_descripcion, v_clasificacion) VALUES (?,?,?)\";\n tx.executeSql(query, [k_coditem_motorizacion,o_descripcion,v_clasificacion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items motorización...Espere\");\n });\n}", "function GuardarFondoPagina(){\n\n var Pagina;\n\n $('.actual').each(function () {\n var id = $(this)[0].id.split('_')[1];\n Pagina = {ID:parseInt($(this)[0].id.split('_')[1]),CuentoID:parseInt(CuentoActual.ID.split('_')[1]), Fondo:parseInt(getFondo($(this)[0].id).split('_')[1])};\n });\n\n db.transaction(InsertFondo,errorinsertFondo, successinsertFondo);\n\n var sql = \"INSERT OR REPLACE INTO `Fondos`(`ID_Cuento`, `ID_Paginas`, `Tipo_Fondo`)\";\n sql += \" VALUES (\" + Pagina.CuentoID + \",\" + Pagina.ID + \",\" + Pagina.Fondo + \") \";\n \n function InsertFondo(tx) {\n tx.executeSql(sql);\n }\n\n function errorinsertFondo(tx, err) {\n alert(\"Error al guardar fondo: \"+err);\n }\n\n function successinsertFondo() {\n }\n}", "function addItemsPuertasItemsElectrica(k_coditem_electrica,o_descripcion,v_clasificacion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO puertas_items_electrica (k_coditem_electrica, o_descripcion, v_clasificacion) VALUES (?,?,?)\";\n tx.executeSql(query, [k_coditem_electrica,o_descripcion,v_clasificacion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items eléctrica...Espere\");\n });\n}", "static insertNew(to,t,p,cb){\n\t\tquery.execute(conn, 'echec','insert data {:cell'+to+' rdf:type <'+t+'> . :cell'+to+' rdf:type <'+p+'>}',\n\t\t'application/sparql-results+json', {\n\t\t\toffset:0,\n\t\t\treasoning: true\n\t\t}).then(res =>{\n\n\t\t\t//On lance l affichage\n\t\t\tinit.run(cb);\n\t\t}).catch(e=> {console.log(e);});\n\t}", "function insert_in_basePv_consta_rubrique_phase_bat_mpe(pv_consta_rubrique_phase_bat_mpe,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemPv_consta_rubrique_phase_bat_mpe==false)\n {\n getId = vm.selectedItemPv_consta_rubrique_phase_bat_mpe.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n periode: pv_consta_rubrique_phase_bat_mpe.periode,\n observation: pv_consta_rubrique_phase_bat_mpe.observation,\n id_pv_consta_entete_travaux: vm.selectedItemPv_consta_entete_travaux.id,\n id_rubrique_phase:pv_consta_rubrique_phase_bat_mpe.id_phase \n });\n console.log(datas);\n //factory\n apiFactory.add(\"pv_consta_detail_bat_travaux/index\",datas, config).success(function (data)\n { \n\n if (NouvelItemPv_consta_rubrique_phase_bat_mpe == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n { \n //vm.selectedItemPv_consta_rubrique_phase_bat_mpe.convention = conve[0];\n \n vm.selectedItemPv_consta_rubrique_phase_bat_mpe.$selected = false;\n vm.selectedItemPv_consta_rubrique_phase_bat_mpe.$edit = false;\n vm.selectedItemPv_consta_rubrique_phase_bat_mpe ={};\n }\n else \n { \n vm.selectedItemPv_consta_rubrique_phase_bat_mpe.observation='';\n \n }\n }\n else\n {\n //avenant_convention.convention = conve[0];\n pv_consta_rubrique_phase_bat_mpe.id = String(data.response); \n NouvelItemPv_consta_rubrique_phase_bat_mpe=false;\n }\n pv_consta_rubrique_phase_bat_mpe.$selected = false;\n pv_consta_rubrique_phase_bat_mpe.$edit = false;\n vm.selectedItemPv_consta_rubrique_phase_bat_mpe = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function insert_in_baseContrat_partenaire_relai(contrat_partenaire_relai,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemContrat_partenaire_relai==false)\n {\n getId = vm.selectedItemContrat_partenaire_relai.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n intitule: contrat_partenaire_relai.intitule,\n ref_contrat: contrat_partenaire_relai.ref_contrat,\n montant_contrat: contrat_partenaire_relai.montant_contrat,\n date_signature:convertionDate(contrat_partenaire_relai.date_signature),\n id_partenaire_relai:contrat_partenaire_relai.id_partenaire_relai,\n id_convention_entete: vm.selectedItemConvention_entete.id,\n validation : 0 \n });\n console.log(datas);\n //factory\n apiFactory.add(\"contrat_partenaire_relai/index\",datas, config).success(function (data)\n { \n var pres= vm.allpartenaire_relai.filter(function(obj)\n {\n return obj.id == contrat_partenaire_relai.id_partenaire_relai;\n });\n\n /*var conv= vm.allconvention_entete.filter(function(obj)\n {\n return obj.id == contrat_partenaire_relai.id_convention_entete;\n });*/\n\n if (NouvelItemContrat_partenaire_relai == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n {\n //vm.selectedItemContrat_partenaire_relai.convention_entete= conv[0];\n vm.selectedItemContrat_partenaire_relai.partenaire_relai = pres[0];\n \n vm.selectedItemContrat_partenaire_relai.$selected = false;\n vm.selectedItemContrat_partenaire_relai.$edit = false;\n vm.selectedItemContrat_partenaire_relai ={};\n vm.showbuttonNouvcontrat_pr= false;\n }\n else \n { \n vm.allcontrat_partenaire_relai = vm.allcontrat_partenaire_relai.filter(function(obj)\n {\n return obj.id !== vm.selectedItemContrat_partenaire_relai.id;\n });\n vm.showbuttonNouvcontrat_pr= true;\n }\n \n }\n else\n {\n //contrat_partenaire_relai.convention_entete= conv[0];\n contrat_partenaire_relai.partenaire_relai = pres[0];\n contrat_partenaire_relai.validation = 0;\n contrat_partenaire_relai.id = String(data.response); \n NouvelItemContrat_partenaire_relai=false;\n vm.showbuttonNouvcontrat_pr = false;\n } \n vm.showbuttonValidation = false;\n vm.showbuttonNouvContrat_partenaire_relai = 1;\n contrat_partenaire_relai.$selected = false;\n contrat_partenaire_relai.$edit = false;\n vm.selectedItemContrat_partenaire_relai = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function insert_in_baseContrat_partenaire_relai(contrat_partenaire_relai,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemContrat_partenaire_relai==false)\n {\n getId = vm.selectedItemContrat_partenaire_relai.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n intitule: contrat_partenaire_relai.intitule,\n ref_contrat: contrat_partenaire_relai.ref_contrat,\n montant_contrat: contrat_partenaire_relai.montant_contrat,\n date_signature:convertionDate(contrat_partenaire_relai.date_signature),\n id_partenaire_relai:contrat_partenaire_relai.id_partenaire_relai,\n id_convention_entete: vm.selectedItemConvention_entete.id,\n validation : 0 \n });\n console.log(datas);\n //factory\n apiFactory.add(\"contrat_partenaire_relai/index\",datas, config).success(function (data)\n { \n var pres= vm.allpartenaire_relai.filter(function(obj)\n {\n return obj.id == contrat_partenaire_relai.id_partenaire_relai;\n });\n\n /*var conv= vm.allconvention_entete.filter(function(obj)\n {\n return obj.id == contrat_partenaire_relai.id_convention_entete;\n });*/\n\n if (NouvelItemContrat_partenaire_relai == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n {\n //vm.selectedItemContrat_partenaire_relai.convention_entete= conv[0];\n vm.selectedItemContrat_partenaire_relai.partenaire_relai = pres[0];\n \n vm.selectedItemContrat_partenaire_relai.$selected = false;\n vm.selectedItemContrat_partenaire_relai.$edit = false;\n vm.selectedItemContrat_partenaire_relai ={};\n vm.showbuttonNouvcontrat_pr= false;\n }\n else \n { \n vm.allcontrat_partenaire_relai = vm.allcontrat_partenaire_relai.filter(function(obj)\n {\n return obj.id !== vm.selectedItemContrat_partenaire_relai.id;\n });\n vm.showbuttonNouvcontrat_pr= true;\n }\n \n }\n else\n {\n //contrat_partenaire_relai.convention_entete= conv[0];\n contrat_partenaire_relai.partenaire_relai = pres[0];\n contrat_partenaire_relai.validation = 0;\n contrat_partenaire_relai.id = String(data.response); \n NouvelItemContrat_partenaire_relai=false;\n vm.showbuttonNouvcontrat_pr = false;\n } \n vm.showbuttonValidation = false;\n vm.showbuttonNouvContrat_partenaire_relai = 1;\n contrat_partenaire_relai.$selected = false;\n contrat_partenaire_relai.$edit = false;\n vm.selectedItemContrat_partenaire_relai = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function adicionar() {\r\n \t\t\t$scope.view.selectedItem.tituloC = $scope.titulo.id;\r\n \t\t\tif($scope.result != null)\r\n \t\t\t\t$scope.view.selectedItem.imagem = $scope.result.substr(22, $scope.result.length);\r\n \t\t\tCapituloCCreateFactory.create($scope.view.selectedItem).$promise.then(function(data) {\r\n \t \t\t$scope.view.dataTable.push(data);\r\n \t\t\t\t$mdDialog.hide('O capitulo adicionado com sucesso.');\r\n \t \t}, function() {\r\n \t \t\t$mdDialog.hide('O capitulo já foi gravado ou ocorreu algum erro.');\r\n \t \t});\t \t\r\n \t\t}", "function exceso_agua(exceso, costo_exceso, uid_condominio, uid_condomino) {\n\n var newCobro = movimientosref.child(uid_condominio).child(uid_condomino).child('EXCESO').push();\n newCobro.set({\n valor: costo_exceso,\n tipo: true,\n detalle: \"Cobro por exceso de agua: \" + exceso,\n fecha: Date.now()\n })\n //Agregar a saldo\n var newSaldo = saldosref.child(uid_condominio).child(uid_condomino).child('EXCESO').push();\n newSaldo.set({\n valor: costo_exceso,\n tipo: true,\n detalle: \"Cobro por exceso de agua: \" + exceso,\n fecha: Date.now()\n })\n\n\n }", "function insert_in_baseAvenant_partenaire(avenant_partenaire,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemAvenant_partenaire==false)\n {\n getId = vm.selectedItemAvenant_partenaire.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n description: avenant_partenaire.description,\n montant: avenant_partenaire.montant,\n ref_avenant: avenant_partenaire.ref_avenant,\n date_signature:convertionDate(avenant_partenaire.date_signature),\n id_contrat_partenaire_relai: vm.selectedItemContrat_partenaire_relai.id,\n validation:0 \n });\n console.log(datas);\n //factory\n apiFactory.add(\"avenant_partenaire_relai/index\",datas, config).success(function (data)\n { \n /*var conve= vm.allcontrat_partenaire_relai.filter(function(obj)\n {\n return obj.id == avenant_partenaire.id_contrat_partenaire_relai;\n });*/\n\n if (NouvelItemAvenant_partenaire == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n { \n //vm.selectedItemAvenant_partenaire.contrat_partenaire_relai = conve[0];\n \n vm.selectedItemAvenant_partenaire.$selected = false;\n vm.selectedItemAvenant_partenaire.$edit = false;\n vm.selectedItemAvenant_partenaire ={};\n }\n else \n { \n vm.allavenant_partenaire = vm.allavenant_partenaire.filter(function(obj)\n {\n return obj.id !== vm.selectedItemAvenant_partenaire.id;\n });\n vm.showbuttonNouvavenant_partenaire = true;\n \n }\n }\n else\n {\n //avenant_partenaire.partenaire = conve[0];\n avenant_partenaire.validation =0\n avenant_partenaire.id = String(data.response); \n NouvelItemAvenant_partenaire=false;\n vm.showbuttonNouvavenant_partenaire = false;\n }\n vm.showbuttonValidation_avenant_partenaire = false;\n vm.validation_avenant_partenaire = 0\n avenant_partenaire.$selected = false;\n avenant_partenaire.$edit = false;\n vm.selectedItemAvenant_partenaire = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function insert_in_baseAvenant_partenaire(avenant_partenaire,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemAvenant_partenaire==false)\n {\n getId = vm.selectedItemAvenant_partenaire.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n description: avenant_partenaire.description,\n montant: avenant_partenaire.montant,\n ref_avenant: avenant_partenaire.ref_avenant,\n date_signature:convertionDate(avenant_partenaire.date_signature),\n id_contrat_partenaire_relai: vm.selectedItemContrat_partenaire_relai.id,\n validation:0 \n });\n console.log(datas);\n //factory\n apiFactory.add(\"avenant_partenaire_relai/index\",datas, config).success(function (data)\n { \n /*var conve= vm.allcontrat_partenaire_relai.filter(function(obj)\n {\n return obj.id == avenant_partenaire.id_contrat_partenaire_relai;\n });*/\n\n if (NouvelItemAvenant_partenaire == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n { \n //vm.selectedItemAvenant_partenaire.contrat_partenaire_relai = conve[0];\n \n vm.selectedItemAvenant_partenaire.$selected = false;\n vm.selectedItemAvenant_partenaire.$edit = false;\n vm.selectedItemAvenant_partenaire ={};\n }\n else \n { \n vm.allavenant_partenaire = vm.allavenant_partenaire.filter(function(obj)\n {\n return obj.id !== vm.selectedItemAvenant_partenaire.id;\n });\n vm.showbuttonNouvavenant_partenaire = true;\n \n }\n }\n else\n {\n //avenant_partenaire.partenaire = conve[0];\n avenant_partenaire.validation =0\n avenant_partenaire.id = String(data.response); \n NouvelItemAvenant_partenaire=false;\n vm.showbuttonNouvavenant_partenaire = false;\n }\n vm.showbuttonValidation_avenant_partenaire = false;\n vm.validation_avenant_partenaire = 0\n avenant_partenaire.$selected = false;\n avenant_partenaire.$edit = false;\n vm.selectedItemAvenant_partenaire = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function ajoutContrat_partenaire_relai(contrat_partenaire_relai,suppression)\n {\n if (NouvelItemContrat_partenaire_relai==false)\n { \n \n if (vm.session==\"AAC\")\n {\n apiFactory.getAPIgeneraliserREST(\"contrat_partenaire_relai/index\",'menus','getcontratvalideById','id_contrat_partenaire',contrat_partenaire_relai.id).then(function(result)\n { \n var contrat_pr_valide = result.data.response;\n if (contrat_pr_valide.length !=0)\n {\n var confirm = $mdDialog.confirm()\n .title('cette modification n\\'est pas autorisé. Les données sont déjà validées!')\n .textContent('')\n .ariaLabel('Lucky day')\n .clickOutsideToClose(true)\n .parent(angular.element(document.body))\n .ok('Fermer')\n \n $mdDialog.show(confirm).then(function()\n { \n vm.allcontrat_partenaire_relai = contrat_pr_valide;\n }, function() {\n //alert('rien');\n });\n }\n else\n {\n test_existanceContrat_partenaire_relai (contrat_partenaire_relai,suppression); \n }\n });\n }\n else\n {\n test_existanceContrat_partenaire_relai (contrat_partenaire_relai,suppression); \n }\n \n } \n else\n {\n insert_in_baseContrat_partenaire_relai(contrat_partenaire_relai,suppression);\n }\n }", "function ajoutContrat_partenaire_relai(contrat_partenaire_relai,suppression)\n {\n if (NouvelItemContrat_partenaire_relai==false)\n {\n apiFactory.getAPIgeneraliserREST(\"contrat_partenaire_relai/index\",'menus','getcontratvalideById','id_contrat_partenaire',contrat_partenaire_relai.id).then(function(result)\n { \n var contrat_pr_valide = result.data.response;\n if (contrat_pr_valide.length !=0)\n {\n var confirm = $mdDialog.confirm()\n .title('cette modification n\\'est pas autorisé. Les données sont déjà validées!')\n .textContent('')\n .ariaLabel('Lucky day')\n .clickOutsideToClose(true)\n .parent(angular.element(document.body))\n .ok('Fermer')\n \n $mdDialog.show(confirm).then(function()\n { \n vm.allcontrat_partenaire_relai = contrat_pr_valide;\n vm.showbuttonValidationcontrat_pr = false;\n }, function() {\n //alert('rien');\n });\n }\n else\n {\n test_existanceContrat_partenaire_relai (contrat_partenaire_relai,suppression); \n }\n }); \n } \n else\n {\n insert_in_baseContrat_partenaire_relai(contrat_partenaire_relai,suppression);\n }\n }", "function addVeiculo(dados, usuario){\n return new Promise((resolve,reject) => {\n let stm = db.prepare(\"INSERT INTO tbInfoVeiculo (usuarioCadastro, idmontadora, nomemodelo,anofabricacao,cores,tipoChassi,suspensaodianteira,suspensaotraseira,pneusdianteiro,pneutraseiro,freiodianteiro,freiotraseiro,tipodofreio,qtdcilindros,diametro,curso,cilindrada,potenciamaxima,torquemaximo,sistemadepartida,tipodealimentacao,combustivel,sistemadetransmissao,cambio,bateria,taxadecompessao,comprimento,largura,altura,distanciaentreeixos,distanciadosolo,alturadoassento,tanquedecombustivel,peso,arqFoto) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)\")\n let p = dados;\n stm.run([usuario, p.montadora,p.nomeModelo,p.anoFabricacao,p.cores,p.tipoChassi,p.suspDianteira,p.suspTraseira,p.pnDianteiro,p.pnTraseiro,p.frDianteiro,p.frTraseiro,p.tpFreio,p.qtdCilindros,p.diametro,p.curso,p.cilindrada,p.potMax,p.tqMax,p.stPartida,p.tpAlimentacao,p.combustivel,p.stTransmissao,p.cambio,p.bateria,p.txCompress,p.comprimento,p.largura,p.altura,p.distEixos,p.distSolo,p.altAs,p.tqComb,p.peso,p.arqFoto], (err) => {\n if(err) {\n reject(err);\n }\n resolve(p.nomeModelo);//Confirmar veiculos\n })\n })\n}", "function User_Insert_Produits_Comptes_généraux_11(Compo_Maitre)\n{\n\n/*\n***** INFOS ******\n\nNbr d'esclaves = 2\n\nId dans le tab: 178;\nsimple\nNbr Jointure: 1;\n Joint n° 0 = comptegen,cg_numero,cg_numero\n\nId dans le tab: 179;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\n******************\n*/\n\n var Table=\"compteproduit\";\n var CleMaitre = TAB_COMPO_PPTES[175].NewCle;\n var NomCleMaitre = DePrefixerChamp(Compo_Maitre.getCle());\n /* COMPOSANT LISTE AVEC JOINTURE SIMPLE */\n var cg_numero=GetValAt(178);\n if (cg_numero==\"-1\")\n cg_numero=\"null\";\n if (!ValiderChampsObligatoire(Table,\"cg_numero\",TAB_GLOBAL_COMPO[178],cg_numero,true))\n \treturn -1;\n var ci_actif=GetValAt(179);\n if (!ValiderChampsObligatoire(Table,\"ci_actif\",TAB_GLOBAL_COMPO[179],ci_actif,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ci_actif\",TAB_GLOBAL_COMPO[179],ci_actif))\n \treturn -1;\n var Req=\"insert into \"+Table+\" \";\nvar TabInsertionEnPlus=new Array();\n Req+=\"(\"+NomCleMaitre+\",pd_numero,cg_numero,ci_actif\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[0]:\"\")+\")\";\n Req+=\" values (\"+CleMaitre+\",\"+TAB_COMPO_PPTES[158].NewCle+\",\"+cg_numero+\",\"+(ci_actif==\"true\" ? \"true\" : \"false\")+\"\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[1]:\"\")+\")\";\n\n if (pgsql_update(Req)==0)\n\talert(\"Echec lors de l'insertion\");\nreturn CleMaitre;\n\n}", "function insert_in_baseTransfert_reliquat(transfert_reliquat,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemTransfert_reliquat ==false)\n {\n getId = vm.selectedItemTransfert_reliquat.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n id_convention_entete: vm.selectedItemConvention_entete.id,\n date_transfert: convertionDate(new Date(transfert_reliquat.date_transfert)),\n intitule_compte: transfert_reliquat.intitule_compte,\n montant: transfert_reliquat.montant,\n objet_utilisation: transfert_reliquat.objet_utilisation,\n situation_utilisation: transfert_reliquat.situation_utilisation,\n observation: transfert_reliquat.observation,\n rib: transfert_reliquat.rib,\n validation: 0 \n });\n //console.log(convention.pays_id);\n console.log(datas);\n //factory\n apiFactory.add(\"transfert_reliquat/index\",datas, config).success(function (data)\n {\n \n var conv = vm.allconvention_entete.filter(function(obj)\n {\n return obj.id == transfert_reliquat.id_convention_entete;\n });\n\n if (NouvelItemTransfert_reliquat == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n {\n vm.selectedItemTransfert_reliquat.convention_entete = conv[0];\n vm.selectedItemTransfert_reliquat.$selected = false;\n vm.selectedItemTransfert_reliquat.$edit = false;\n vm.selectedItemTransfert_reliquat ={};\n vm.showbuttonNouvTransfert_reliquat = false;\n\n\n }\n else \n { \n vm.alltransfert_reliquat = vm.alltransfert_reliquat.filter(function(obj)\n {\n return obj.id !== vm.selectedItemTransfert_reliquat.id;\n });\n vm.showbuttonNouvTransfert_reliquat= true;\n }\n }\n else\n {\n \n transfert_reliquat.convention_entete = conv[0];\n transfert_reliquat.id = String(data.response);\n NouvelItemTransfert_reliquat = false;\n vm.showbuttonNouvTransfert_reliquat= false;\n }\n vm.validation_transfert_reliquat = 0; \n vm.showbuttonValidationtransfert_reliquat = false;\n transfert_reliquat.$selected = false;\n transfert_reliquat.$edit = false;\n vm.selectedItemTransfert_reliquat = {};\n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function insertarCarrito(curso) {\n const row = document.createElement('tr');\n row.innerHTML = `\n <td>\n <img src=\"${ curso.imagen }\" width=100>\n </td>\n <td>${ curso.titulo }</td>\n <td>${ curso.precio }</td>\n <td>\n <a href=\"#\" class=\"borrar-curso\" data-id=\"${curso.id}\">X</a>\n </td>\n `;\n\n listaCursosCarrito.appendChild(row);\n guardarCusoLocalStorage(curso);\n\n}", "function insertarCarrito(curso) {\n const row = document.createElement(\"tr\");\n row.innerHTML = `\n <td> \n <img src=\"${curso.imagen}\" width=100>\n </td>\n <td>${curso.titulo}</td>\n <td>${curso.precio}</td>\n <td>\n <a href=\"#\" class=\"borrar-curso\" data-id=\"${curso.id}\">X</a>\n </td>\n `;\n listaCursos.appendChild(row);\n guardarCursoLocalStorage(curso);\n}", "function User_Insert_TVA_Liste_des_T_V_A_0(Compo_Maitre)\n{\n\n/*\n***** INFOS ******\n\nNbr d'esclaves = 4\n\nId dans le tab: 154;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 155;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 156;\nsimple\nNbr Jointure: 1;\n Joint n° 0 = comptegen,cg_numero,cg_numero\n\nId dans le tab: 157;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\n******************\n*/\n\n var Table=\"tva\";\n var CleMaitre = TAB_COMPO_PPTES[150].NewCle;\n var NomCleMaitre = DePrefixerChamp(Compo_Maitre.getCle());\n var tv_taux=GetValAt(154);\n if (!ValiderChampsObligatoire(Table,\"tv_taux\",TAB_GLOBAL_COMPO[154],tv_taux,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"tv_taux\",TAB_GLOBAL_COMPO[154],tv_taux))\n \treturn -1;\n var tv_code=GetValAt(155);\n if (!ValiderChampsObligatoire(Table,\"tv_code\",TAB_GLOBAL_COMPO[155],tv_code,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"tv_code\",TAB_GLOBAL_COMPO[155],tv_code))\n \treturn -1;\n var cg_numero=GetValAt(156);\n if (cg_numero==\"-1\")\n cg_numero=\"null\";\n if (!ValiderChampsObligatoire(Table,\"cg_numero\",TAB_GLOBAL_COMPO[156],cg_numero,true))\n \treturn -1;\n var tv_actif=GetValAt(157);\n if (!ValiderChampsObligatoire(Table,\"tv_actif\",TAB_GLOBAL_COMPO[157],tv_actif,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"tv_actif\",TAB_GLOBAL_COMPO[157],tv_actif))\n \treturn -1;\n var Req=\"insert into \"+Table+\" \";\nvar TabInsertionEnPlus=new Array();\n Req+=\"(\"+NomCleMaitre+\",tv_taux,tv_code,cg_numero,tv_actif\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[0]:\"\")+\")\";\n Req+=\" values (\"+CleMaitre+\",\"+(tv_taux==\"\" ? \"null\" : \"'\"+ValiderChaine(tv_taux)+\"'\" )+\",\"+(tv_code==\"\" ? \"null\" : \"'\"+ValiderChaine(tv_code)+\"'\" )+\",\"+cg_numero+\",\"+(tv_actif==\"true\" ? \"true\" : \"false\")+\"\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[1]:\"\")+\")\";\n\n if (pgsql_update(Req)==0)\n\talert(\"Echec lors de l'insertion\");\nreturn CleMaitre;\n\n}", "function insertarCarrito(curso) { //paso2\n const row = document.createElement('tr');\n row.innerHTML = `\n <td>\n <img src=\"${curso.imagen}\" width=\"100\">\n </td>\n <td>${curso.titulo}</td>\n <td>${curso.precio}</td>\n <td>\n <a href=\"#\" class=\"borrar-curso\" data-id=\"${curso.id}\">X<a/>\n </td>\n `;\n //agregamos la variable listaCursos y le agregamos el html que guardamos en la variable row\n listaCursos.appendChild(row);\n guardarCursoLocalStorage(curso); //parte4\n}", "function User_Insert_Villes_Liste_des_villes0(Compo_Maitre)\n{\n\n/*\n***** INFOS ******\n\nNbr d'esclaves = 2\n\nId dans le tab: 126;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 127;\nsimple\nNbr Jointure: 1;\n Joint n° 0 = canton,ct_numero,ct_numero\n\n******************\n*/\n\n var Table=\"ville\";\n var CleMaitre = TAB_COMPO_PPTES[123].NewCle;\n var NomCleMaitre = DePrefixerChamp(Compo_Maitre.getCle());\n var vi_nom=GetValAt(126);\n if (!ValiderChampsObligatoire(Table,\"vi_nom\",TAB_GLOBAL_COMPO[126],vi_nom,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"vi_nom\",TAB_GLOBAL_COMPO[126],vi_nom))\n \treturn -1;\n var ct_numero=GetValAt(127);\n if (ct_numero==\"-1\")\n ct_numero=\"null\";\n if (!ValiderChampsObligatoire(Table,\"ct_numero\",TAB_GLOBAL_COMPO[127],ct_numero,true))\n \treturn -1;\n var Req=\"insert into \"+Table+\" \";\nvar TabInsertionEnPlus=new Array();\n Req+=\"(\"+NomCleMaitre+\",vi_nom,ct_numero\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[0]:\"\")+\")\";\n Req+=\" values (\"+CleMaitre+\",\"+(vi_nom==\"\" ? \"null\" : \"'\"+ValiderChaine(vi_nom)+\"'\" )+\",\"+ct_numero+\"\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[1]:\"\")+\")\";\n\n if (pgsql_update(Req)==0)\n\talert(\"Echec lors de l'insertion\");\nreturn CleMaitre;\n\n}", "function ajoutContrat_moe(contrat_moe,suppression)\n { \n if (NouvelItemContrat_moe==false)\n {\n apiFactory.getAPIgeneraliserREST(\"contrat_be/index\",'menus','getcontratvalideById','id_contrat_moe',contrat_moe.id).then(function(result)\n {\n var contrat_moe_valide = result.data.response;\n if (contrat_moe_valide.length !=0)\n {\n var confirm = $mdDialog.confirm()\n .title('cette modification n\\'est pas autorisé. Les données sont déjà validées!')\n .textContent('')\n .ariaLabel('Lucky day')\n .clickOutsideToClose(true)\n .parent(angular.element(document.body))\n .ok('Fermer')\n \n $mdDialog.show(confirm).then(function()\n {\n vm.stepcalendrier_paie_moe=false;\n vm.allcontrat_moe = contrat_moe_valide; \n vm.selectedItemContrat_moe ={};\n }, function() {\n //alert('rien');\n });\n }\n else\n {\n test_existanceContrat_moe (contrat_moe,suppression); \n }\n }); \n } \n else\n {\n insert_in_baseContrat_moe(contrat_moe,suppression);\n }\n }", "function User_Insert_Cantons_Liste_des_cantons0(Compo_Maitre)\n{\n\n/*\n***** INFOS ******\n\nNbr d'esclaves = 2\n\nId dans le tab: 140;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 141;\ncomplexe\nNbr Jointure: 1;\n Joint n° 0 = ville,ct_numero,ct_numero\n\n******************\n*/\n\n var Table=\"canton\";\n var CleMaitre = TAB_COMPO_PPTES[137].NewCle;\n var NomCleMaitre = DePrefixerChamp(Compo_Maitre.getCle());\n var ct_nom=GetValAt(140);\n if (!ValiderChampsObligatoire(Table,\"ct_nom\",TAB_GLOBAL_COMPO[140],ct_nom,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ct_nom\",TAB_GLOBAL_COMPO[140],ct_nom))\n \treturn -1;\n var Req=\"insert into \"+Table+\" \";\nvar TabInsertionEnPlus=new Array();\n Req+=\"(\"+NomCleMaitre+\",ct_nom\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[0]:\"\")+\")\";\n Req+=\" values (\"+CleMaitre+\",\"+(ct_nom==\"\" ? \"null\" : \"'\"+ValiderChaine(ct_nom)+\"'\" )+\"\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[1]:\"\")+\")\";\n\n if (pgsql_update(Req)==0)\n\talert(\"Echec lors de l'insertion\");\nreturn CleMaitre;\n\n}", "function insertVol(id, preference){\n db.transaction(tx => {\n tx.executeSql(\n 'INSERT INTO volunteer_role_t (person_id, preference) VALUES (?,?)',\n [id, preference],\n (tx, results) => {\n console.log('Results', results.rowsAffected);\n if (results.rowsAffected > 0) {\n\n } else {\n alert('Registration Failed');\n }\n }\n );\n });\n}", "'ofertas.insert'(oferta) {\n \n // Seguridad para la acción.\n if (! this.userId) {\n throw new Meteor.Error('[Ofertas] Usuario No Autorizado');\n }\n\n let o_id = new Meteor.Collection.ObjectID();\n oferta[\"_id\"] = o_id;\n\n //Ejecutar la accion en la base de datos sobre la colleccion.\n Ofertas.insert(oferta);\n }", "insertarCarrito(producto){\n const row = document.createElement('tr');\n row.innerHTML = `\n <td>\n <img src=\"${producto.imagen}\" width=100>\n </td>\n <td>${producto.titulo}</td>\n <td>${producto.precio}</td>\n <td>\n <a href=\"#\" class=\"borrar-producto fas fa-times-circle\" data-id=\"${producto.id}\"></a>\n </td>\n `;\n listaProductos.appendChild(row);\n this.guardarProductosLocalStorage(producto);\n }", "function insert_in_baseParticipant_odc(participant_odc,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemParticipant_odc==false)\n {\n getId = vm.selectedItemParticipant_odc.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId, \n nom: participant_odc.nom,\n prenom: participant_odc.prenom,\n sexe: participant_odc.sexe,\n id_situation_participant_odc: participant_odc.id_situation_participant_odc,\n id_module_odc: vm.selectedItemModule_odc.id \n });\n //console.log(feffi.pays_id);\n //factory\n apiFactory.add(\"participant_odc/index\",datas, config).success(function (data)\n { \n\n var situ= vm.allsituation_participant_odc.filter(function(obj)\n {\n return obj.id == participant_odc.id_situation_participant_odc;\n });\n\n if (NouvelItemParticipant_odc == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n { \n vm.selectedItemParticipant_odc.situation_participant_odc= situ[0];\n \n\n if(currentItemParticipant_odc.sexe == 1 && currentItemParticipant_odc.sexe !=vm.selectedItemParticipant_odc.sexe)\n {\n vm.selectedItemModule_odc.nbr_reel_fem_parti = parseInt(vm.selectedItemModule_odc.nbr_reel_fem_parti)+1; \n }\n\n if(currentItemParticipant_odc.sexe == 2 && currentItemParticipant_odc.sexe !=vm.selectedItemParticipant_odc.sexe)\n {\n vm.selectedItem.nbr_reel_fem_parti = parseInt(vm.selectedItem.nbr_reel_fem_parti)-1; \n }\n vm.selectedItemParticipant_odc.$selected = false;\n vm.selectedItemParticipant_odc.$edit = false;\n vm.selectedItemParticipant_odc ={};\n \n }\n else \n { \n vm.allparticipant_odc = vm.allparticipant_odc.filter(function(obj)\n {\n return obj.id !== vm.selectedItemParticipant_odc.id;\n });\n \n vm.selectedItemModule_odc.nbr_parti = parseInt(vm.selectedItemModule_odc.nbr_parti)-1;\n \n if(parseInt(participant_odc.sexe) == 2)\n {\n vm.selectedItemModule_odc.nbr_reel_fem_parti = parseInt(vm.selectedItemModule_odc.nbr_reel_fem_parti)-1;\n }\n }\n }\n else\n {\n participant_odc.situation_participant_odc = situ[0];\n participant_odc.id = String(data.response); \n NouvelItemParticipant_odc=false;\n\n vm.selectedItemModule_odc.nbr_parti = parseInt(vm.selectedItemModule_odc.nbr_parti)+1;\n if(parseInt(participant_odc.sexe) == 2)\n {\n vm.selectedItemModule_odc.nbr_reel_fem_parti = parseInt(vm.selectedItemModule_odc.nbr_reel_fem_parti)+1;\n }\n }\n participant_odc.$selected = false;\n participant_odc.$edit = false;\n vm.selectedItemParticipant_odc = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function insert_in_baseParticipant_odc(participant_odc,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemParticipant_odc==false)\n {\n getId = vm.selectedItemParticipant_odc.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId, \n nom: participant_odc.nom,\n prenom: participant_odc.prenom,\n sexe: participant_odc.sexe,\n id_situation_participant_odc: participant_odc.id_situation_participant_odc,\n id_module_odc: vm.selectedItemModule_odc.id \n });\n //console.log(feffi.pays_id);\n //factory\n apiFactory.add(\"participant_odc/index\",datas, config).success(function (data)\n { \n\n var situ= vm.allsituation_participant_odc.filter(function(obj)\n {\n return obj.id == participant_odc.id_situation_participant_odc;\n });\n\n if (NouvelItemParticipant_odc == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n { \n vm.selectedItemParticipant_odc.situation_participant_odc= situ[0];\n \n\n if(currentItemParticipant_odc.sexe == 1 && currentItemParticipant_odc.sexe !=vm.selectedItemParticipant_odc.sexe)\n {\n vm.selectedItemModule_odc.nbr_reel_fem_parti = parseInt(vm.selectedItemModule_odc.nbr_reel_fem_parti)+1; \n }\n\n if(currentItemParticipant_odc.sexe == 2 && currentItemParticipant_odc.sexe !=vm.selectedItemParticipant_odc.sexe)\n {\n vm.selectedItem.nbr_reel_fem_parti = parseInt(vm.selectedItem.nbr_reel_fem_parti)-1; \n }\n vm.selectedItemParticipant_odc.$selected = false;\n vm.selectedItemParticipant_odc.$edit = false;\n vm.selectedItemParticipant_odc ={};\n \n }\n else \n { \n vm.allparticipant_odc = vm.allparticipant_odc.filter(function(obj)\n {\n return obj.id !== vm.selectedItemParticipant_odc.id;\n });\n \n vm.selectedItemModule_odc.nbr_parti = parseInt(vm.selectedItemModule_odc.nbr_parti)-1;\n \n if(parseInt(participant_odc.sexe) == 2)\n {\n vm.selectedItemModule_odc.nbr_reel_fem_parti = parseInt(vm.selectedItemModule_odc.nbr_reel_fem_parti)-1;\n }\n }\n }\n else\n {\n participant_odc.situation_participant_odc = situ[0];\n participant_odc.id = String(data.response); \n NouvelItemParticipant_odc=false;\n\n vm.selectedItemModule_odc.nbr_parti = parseInt(vm.selectedItemModule_odc.nbr_parti)+1;\n if(parseInt(participant_odc.sexe) == 2)\n {\n vm.selectedItemModule_odc.nbr_reel_fem_parti = parseInt(vm.selectedItemModule_odc.nbr_reel_fem_parti)+1;\n }\n }\n participant_odc.$selected = false;\n participant_odc.$edit = false;\n vm.selectedItemParticipant_odc = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "insertarCarrito(producto){\n const row = document.createElement('tr');\n row.innerHTML = `\n <td><img src=\"${producto.imagen}\" width=100></td> \n <td>${producto.titulo}</td>\n <td>${producto.precio}</td> \n <td><a href=\"#\" class=\"borrar-producto fas fa-times-circle\" data-id=\"${producto.titulo}\"></a></td>\n `;\n listaProductos.appendChild(row);\n this.guardarProductosLocalStorage(producto);\n }", "function insert_in_baseContrat_moe(contrat_moe,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemContrat_moe==false)\n {\n getId = vm.selectedItemContrat_moe.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n intitule: contrat_moe.intitule,\n ref_contrat: contrat_moe.ref_contrat,\n montant_contrat: contrat_moe.montant_contrat,\n date_signature:convertionDate(contrat_moe.date_signature),\n id_bureau_etude:contrat_moe.id_moe,\n id_convention_entete: vm.selectedItemConvention_entete.id,\n validation : 0 \n });\n console.log(datas);\n //factory\n apiFactory.add(\"contrat_be/index\",datas, config).success(function (data)\n { \n var pres= vm.allmoe.filter(function(obj)\n {\n return obj.id == contrat_moe.id_moe;\n });\n\n if (NouvelItemContrat_moe == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n {\n vm.selectedItemContrat_moe.bureau_etude = pres[0];\n vm.selectedItemContrat_moe.validation = 0;\n vm.selectedItemContrat_moe.$selected = false;\n vm.selectedItemContrat_moe.$edit = false;\n vm.selectedItemContrat_moe ={};\n vm.showbuttonNouvcontrat_moe= false;\n console.log(data);\n }\n else \n { \n vm.allcontrat_moe = vm.allcontrat_moe.filter(function(obj)\n {\n return obj.id !== vm.selectedItemContrat_moe.id;\n });\n vm.showbuttonNouvcontrat_moe= true;\n }\n \n }\n else\n {\n contrat_moe.bureau_etude = pres[0];\n contrat_moe.validation = 0;\n contrat_moe.id = String(data.response); \n NouvelItemContrat_moe=false;\n vm.showbuttonNouvcontrat_moe= false;\n }\n contrat_moe.$selected = false;\n contrat_moe.$edit = false;\n vm.selectedItemContrat_moe = {};\n vm.stepcalendrier_paie_moe=false;\n vm.allmoe = [];\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function insert_in_baseContrat_moe(contrat_moe,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemContrat_moe==false)\n {\n getId = vm.selectedItemContrat_moe.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n intitule: contrat_moe.intitule,\n ref_contrat: contrat_moe.ref_contrat,\n montant_contrat: contrat_moe.montant_contrat,\n date_signature:convertionDate(contrat_moe.date_signature),\n id_bureau_etude:contrat_moe.id_moe,\n id_convention_entete: vm.selectedItemConvention_entete.id,\n validation : 0 \n });\n console.log(datas);\n //factory\n apiFactory.add(\"contrat_be/index\",datas, config).success(function (data)\n { \n var pres= vm.allmoe.filter(function(obj)\n {\n return obj.id == contrat_moe.id_moe;\n });\n\n if (NouvelItemContrat_moe == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n {\n vm.selectedItemContrat_moe.bureau_etude = pres[0];\n vm.selectedItemContrat_moe.validation = 0;\n vm.selectedItemContrat_moe.$selected = false;\n vm.selectedItemContrat_moe.$edit = false;\n vm.selectedItemContrat_moe ={};\n vm.showbuttonNouvcontrat_moe= false;\n console.log(data);\n }\n else \n { \n vm.allcontrat_moe = vm.allcontrat_moe.filter(function(obj)\n {\n return obj.id !== vm.selectedItemContrat_moe.id;\n });\n vm.showbuttonNouvcontrat_moe= true;\n }\n \n }\n else\n {\n contrat_moe.bureau_etude = pres[0];\n contrat_moe.validation = 0;\n contrat_moe.id = String(data.response); \n NouvelItemContrat_moe=false;\n vm.showbuttonNouvcontrat_moe= false;\n }\n contrat_moe.$selected = false;\n contrat_moe.$edit = false;\n vm.selectedItemContrat_moe = {};\n vm.stepcalendrier_paie_moe=false;\n vm.allmoe = [];\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function insert_in_basePv_consta_rubrique_phase_lat_mpe(pv_consta_rubrique_phase_lat_mpe,suppression)\n{\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemPv_consta_rubrique_phase_lat_mpe==false)\n {\n getId = vm.selectedItemPv_consta_rubrique_phase_lat_mpe.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n periode: pv_consta_rubrique_phase_lat_mpe.periode,\n observation: pv_consta_rubrique_phase_lat_mpe.observation,\n id_pv_consta_entete_travaux: vm.selectedItemPv_consta_entete_travaux.id,\n id_rubrique_phase:pv_consta_rubrique_phase_lat_mpe.id_phase \n });\n console.log(datas);\n //factory\n apiFactory.add(\"pv_consta_detail_lat_travaux/index\",datas, config).success(function (data)\n { \n\n if (NouvelItemPv_consta_rubrique_phase_lat_mpe == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n { \n //vm.selectedItemPv_consta_rubrique_phase_lat_mpe.convention = conve[0];\n \n vm.selectedItemPv_consta_rubrique_phase_lat_mpe.$selected = false;\n vm.selectedItemPv_consta_rubrique_phase_lat_mpe.$edit = false;\n vm.selectedItemPv_consta_rubrique_phase_lat_mpe ={};\n }\n else \n { \n vm.selectedItemPv_consta_rubrique_phase_lat_mpe.observation='';\n \n }\n }\n else\n {\n //avenant_convention.convention = conve[0];\n pv_consta_rubrique_phase_lat_mpe.id = String(data.response); \n NouvelItemPv_consta_rubrique_phase_lat_mpe=false;\n }\n pv_consta_rubrique_phase_lat_mpe.$selected = false;\n pv_consta_rubrique_phase_lat_mpe.$edit = false;\n vm.selectedItemPv_consta_rubrique_phase_lat_mpe = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n}", "function eventInsertOne(e){\n\t\te.preventDefault();\n\t\tlet container = document.querySelector(\"tbody\"); \n\t\tlet colTr = insertarFilaVacia(null, 0, 1);\n\t\tcontainer.appendChild(colTr);\n\t}", "function guardar(){\n\n\tif(validateFields()){\n\t\tvar publicacion = new Publicacion(getValue('nombreID'), getValue('contactoID'), \n\t\tgetValue('estadoID'), getValue('ciudadID'), \n\t\tgetValue('shortDesc'), getValue('longDesc'));\n\n\t\tvar item = Object.assign({}, publicacion);\n\t\tdb.collection(COL_ORG).add(item).then(\n\t\tdata => {\n\t\t\talert('Guardado');\n\t\t\tconsole.log(\"Datos guardados exitosamente!!!\", data);\n\t\t\twindow.close();\n\t\t},\n\t\terror => {\n\t\t\talert('Error');\n\t\t\tconsole.error(\"Ocurrio un error al guardar los datos!!!\", error);\n\t\t});\n\t}else{\n\t\talert('Error: llena todos los campos.');\n\t}\n\n\n\t\n}", "function insert_in_baseAvenant_mpe(avenant_mpe,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemAvenant_mpe==false)\n {\n getId = vm.selectedItemAvenant_mpe.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n description: avenant_mpe.description,\n cout_batiment: avenant_mpe.cout_batiment,\n cout_latrine: avenant_mpe.cout_latrine,\n cout_mobilier: avenant_mpe.cout_mobilier,\n ref_avenant: avenant_mpe.ref_avenant,\n date_signature:convertionDate(avenant_mpe.date_signature),\n id_contrat_prestataire: vm.selectedItemContrat_prestataire.id,\n validation:0 \n });\n console.log(datas);\n //factory\n apiFactory.add(\"avenant_prestataire/index\",datas, config).success(function (data)\n { \n var conve= vm.allcontrat_prestataire.filter(function(obj)\n {\n return obj.id == avenant_mpe.id_contrat_prestataire;\n });\n\n if (NouvelItemAvenant_mpe == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n { \n //vm.selectedItemAvenant_mpe.contrat_prestataire = conve[0];\n \n vm.selectedItemAvenant_mpe.$selected = false;\n vm.selectedItemAvenant_mpe.$edit = false;\n vm.selectedItemAvenant_mpe ={};\n }\n else \n { \n vm.allavenant_mpe = vm.allavenant_mpe.filter(function(obj)\n {\n return obj.id !== vm.selectedItemAvenant_mpe.id;\n });\n \n }\n }\n else\n {\n // avenant_mpe.contrat_prestataire = conve[0];\n avenant_mpe.validation =0\n avenant_mpe.id = String(data.response); \n NouvelItemAvenant_mpe=false;\n }\n vm.showbuttonValidation_avenant_mpe = false;\n vm.validation_avenant_mpe = 0\n avenant_mpe.$selected = false;\n avenant_mpe.$edit = false;\n vm.selectedItemAvenant_mpe = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function insert_in_baseAvenant_mpe(avenant_mpe,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemAvenant_mpe==false)\n {\n getId = vm.selectedItemAvenant_mpe.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n description: avenant_mpe.description,\n cout_batiment: avenant_mpe.cout_batiment,\n cout_latrine: avenant_mpe.cout_latrine,\n cout_mobilier: avenant_mpe.cout_mobilier,\n ref_avenant: avenant_mpe.ref_avenant,\n date_signature:convertionDate(avenant_mpe.date_signature),\n id_contrat_prestataire: vm.selectedItemContrat_prestataire.id,\n validation:0 \n });\n console.log(datas);\n //factory\n apiFactory.add(\"avenant_prestataire/index\",datas, config).success(function (data)\n { \n var conve= vm.allcontrat_prestataire.filter(function(obj)\n {\n return obj.id == avenant_mpe.id_contrat_prestataire;\n });\n\n if (NouvelItemAvenant_mpe == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n { \n //vm.selectedItemAvenant_mpe.contrat_prestataire = conve[0];\n \n vm.selectedItemAvenant_mpe.$selected = false;\n vm.selectedItemAvenant_mpe.$edit = false;\n vm.selectedItemAvenant_mpe ={};\n }\n else \n { \n vm.allavenant_mpe = vm.allavenant_mpe.filter(function(obj)\n {\n return obj.id !== vm.selectedItemAvenant_mpe.id;\n });\n \n }\n }\n else\n {\n // avenant_mpe.contrat_prestataire = conve[0];\n avenant_mpe.validation =0\n avenant_mpe.id = String(data.response); \n NouvelItemAvenant_mpe=false;\n }\n vm.showbuttonValidation_avenant_mpe = false;\n vm.validation_avenant_mpe = 0\n avenant_mpe.$selected = false;\n avenant_mpe.$edit = false;\n vm.selectedItemAvenant_mpe = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function insertarCarrito(infoCurso){\n\t// Crear fila con información para los elementos agregados al carrito\n\tconst row = document.createElement('tr');\n\trow.innerHTML = `\n\t\t<td><img src=\"${infoCurso.imagen}\" width=\"100\"></td>\n\t\t<td>${infoCurso.titulo}</td>\n\t\t<td>${infoCurso.precio}</td>\n\t\t<td>\n\t\t\t<a href=\"#\" class=\"borrar-curso\" data-id=\"${infoCurso.id}\">X</a>\n\t\t</td>\n\t`;\n\n\t// console.log(row);\n\t// Agregar elemento procesado a la lista de elementos en el carrito\n\tcursosCarrito.appendChild(row);\n\n\t// Almacenar los cursos agregados al carrito en Local Storage\n\tguardarCursoLocalStorage(infoCurso);\n}", "function insertarCarrito(curso){\n const row = document.createElement('tr');\n row.innerHTML = `\n <td>\n <img src=\"${curso.imagen}\" width=100>\n </td>\n <td>${curso.titulo}</td>\n <td>${curso.precio}</td>\n <td>\n <a href=\"#\" class=\"borrar-curso\" data-id=\"${curso.id}\">X</a>\n </td>\n `;\n listaCursos.appendChild(row);\n\n guardarCursoLocalStorage(curso);\n}", "function insertarCarrito(curso){\n const row = document.createElement('tr');\n row.innerHTML=`\n <td>\n <img src=\"${curso.imagen}\" width=100>\n </td>\n <td>${curso.titulo}</td>\n <td>${curso.precio}</td>\n <td>\n <a href=\"#\" class=\"borrar-curso\" data-id=\"${curso.id}\">X</a>\n </td>\n `;\n listaCursos.appendChild(row);\n guardarCursoLocalStorage(curso);\n}", "function insert_in_basePv_consta_rubrique_phase_mob_mpe(pv_consta_rubrique_phase_mob_mpe,suppression)\n{\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemPv_consta_rubrique_phase_mob_mpe==false)\n {\n getId = vm.selectedItemPv_consta_rubrique_phase_mob_mpe.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId,\n periode: pv_consta_rubrique_phase_mob_mpe.periode,\n observation: pv_consta_rubrique_phase_mob_mpe.observation,\n id_pv_consta_entete_travaux: vm.selectedItemPv_consta_entete_travaux.id,\n id_rubrique_phase:pv_consta_rubrique_phase_mob_mpe.id_phase \n });\n console.log(datas);\n //factory\n apiFactory.add(\"pv_consta_detail_mob_travaux/index\",datas, config).success(function (data)\n { \n\n if (NouvelItemPv_consta_rubrique_phase_mob_mpe == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n { \n //vm.selectedItemPv_consta_rubrique_phase_mob_mpe.convention = conve[0];\n \n vm.selectedItemPv_consta_rubrique_phase_mob_mpe.$selected = false;\n vm.selectedItemPv_consta_rubrique_phase_mob_mpe.$edit = false;\n vm.selectedItemPv_consta_rubrique_phase_mob_mpe ={};\n }\n else \n { \n vm.selectedItemPv_consta_rubrique_phase_mob_mpe.observation='';\n \n }\n }\n else\n {\n //avenant_convention.convention = conve[0];\n pv_consta_rubrique_phase_mob_mpe.id = String(data.response); \n NouvelItemPv_consta_rubrique_phase_mob_mpe=false;\n }\n pv_consta_rubrique_phase_mob_mpe.$selected = false;\n pv_consta_rubrique_phase_mob_mpe.$edit = false;\n vm.selectedItemPv_consta_rubrique_phase_mob_mpe = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n}", "function User_Insert_Types_d_attribut_Liste_des_types_d_attribut_de_personne0(Compo_Maitre)\n{\n\n/*\n***** INFOS ******\n\nNbr d'esclaves = 2\n\nId dans le tab: 30;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 31;\ncomplexe\nNbr Jointure: 1;\n Joint n° 0 = categorie,ta_numero,ta_numero\n\n******************\n*/\n\n var Table=\"typeattribut\";\n var CleMaitre = TAB_COMPO_PPTES[28].NewCle;\n var NomCleMaitre = DePrefixerChamp(Compo_Maitre.getCle());\n var ta_nom=GetValAt(30);\n if (!ValiderChampsObligatoire(Table,\"ta_nom\",TAB_GLOBAL_COMPO[30],ta_nom,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ta_nom\",TAB_GLOBAL_COMPO[30],ta_nom))\n \treturn -1;\n var Req=\"insert into \"+Table+\" \";\nvar TabInsertionEnPlus=new Array();\n Req+=\"(\"+NomCleMaitre+\",ta_nom\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[0]:\"\")+\")\";\n Req+=\" values (\"+CleMaitre+\",\"+(ta_nom==\"\" ? \"null\" : \"'\"+ValiderChaine(ta_nom)+\"'\" )+\"\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[1]:\"\")+\")\";\n\n if (pgsql_update(Req)==0)\n\talert(\"Echec lors de l'insertion\");\nreturn CleMaitre;\n\n}", "insertProforma(req, res) {\n sequelize\n .query(\"INSERT INTO proforma_invoice (heading, footer, ref_invoice, date, total_HT,taxe, total_TTC, client_company_id, tva_id) VALUES('\" +\n req.body.heading +\n \"', '\" +\n req.body.footer +\n \"','\" +\n req.body.ref_invoice +\n \"', '\" +\n req.body.date +\n \"', '\" +\n req.body.total_HT +\n \"','\" +\n req.body.taxe +\n \"', '\" +\n req.body.total_TTC +\n \"', '\" +\n req.body.client_company_id +\n \"','\" +\n req.body.tva_id +\n \"')\", { type: sequelize.QueryTypes.INSERT }, {})\n .then(res.status(200).send('proforma added successfully'))\n .catch((error) => res.status(400).send(error));\n }", "function insertData(user,giorno,pasto,menu_giorno,pasto_scelto) {\n //crea un user\n user.create({\n first_name: 'Rossi',\n last_name: 'Mario'\n });\n //crea giorni\n giorno.create({\n nome_giorno: 'lun'\n });\n giorno.create({\n nome_giorno: 'mar'\n });\n giorno.create({\n nome_giorno: 'mer'\n });\n giorno.create({\n nome_giorno: 'gio'\n });\n giorno.create({\n nome_giorno: 'ven'\n });\n giorno.create({\n nome_giorno: 'sab'\n });\n giorno.create({\n nome_giorno: 'dom'\n });\n\n //crea pasti\n //crea parimi\n pasto.create({\n nome_pasto: 'Pasta al pomodoro',\n tipo: 'primo',\n dettagli: 'Scaldate in una casseruola un velo di olio con uno spicchio di aglio sbucciato. Unite i pomodori non appena l\\'aglio comincia a sfrigolare. Aggiungete quindi una generosa presa di sale. Completate con un ciuffetto di basilico e mescolate; cuocete senza coperchio per 10 circa.'\n });\n pasto.create({\n nome_pasto: 'Pasta con la ricotta in bianco',\n tipo: 'primo',\n dettagli: 'La pasta con la ricotta in bianco è un esempio di come possa essere facile e veloce preparare un piatto di pasta veramente buono.'\n });\n pasto.create({\n nome_pasto: 'Minestrone',\n tipo: 'primo',\n dettagli: 'Il minestrone di verdure è un primo piatto salutare, di semplice ma lunga realizzazione, per via della pulizia e del taglio delle molte verdure!'\n });\n pasto.create({\n nome_pasto: 'Risotto',\n tipo: 'primo',\n dettagli: 'Il risotto è un primo piatto tipico della cucina italiana, diffuso in numerose versioni in tutto il paese anche se più consumato al nord.'\n });\n pasto.create({\n nome_pasto: 'Lasagna',\n tipo: 'primo',\n dettagli: 'Le lasagne al forno sono costituite da una sfoglia di pasta madre, oggi quasi sempre all\\'uovo, tagliata in fogli grossolanamente rettangolari (losanghe), dette lasagna le quali, una volta bollite e scolate, vengono disposte in una sequenza variabile di strati, ognuno dei quali separato da una farcitura che varia in relazione alle diverse tradizioni locali.'\n });\n //create secondo\n pasto.create({\n nome_pasto: 'Bistecca alla Fiorentina',\n tipo: 'secondo',\n dettagli: 'La bistecca alla fiorentina è un taglio di carne di vitellone o di scottona che, unito alla specifica preparazione, ne fa uno dei piatti più conosciuti della cucina toscana. Si tratta di un taglio alto comprensivo dell\\'osso, da cuocersi sulla brace o sulla griglia, con grado di cottura \"al sangue\".'\n });\n pasto.create({\n nome_pasto: 'Salmone in crosta',\n tipo: 'secondo',\n dettagli: 'Il salmone in crosta con spinaci è una delle ricette tipiche della vigilia e di Capodanno: durante queste occasioni non potrà di certo mancare il salmone! '\n });\n pasto.create({\n nome_pasto: 'Pollo al forno',\n tipo: 'secondo',\n dettagli: 'Le cosce di pollo al forno sono un tipico secondo piatto della cucina italiana, un classico per gustare il pollo con contorno di patate!'\n });\n pasto.create({\n nome_pasto: 'Arrosto di lonza',\n tipo: 'secondo',\n dettagli: 'Tradizionale, genuino e ricco di gusto. La lonza arrosto al vino bianco è davvero un piatto che non può mancare nella vostra lista dei manicaretti casalinghi. '\n });\n //create contorno\n pasto.create({\n nome_pasto: 'Patatine fritte',\n tipo: 'contorno',\n dettagli: 'Patatine fritte'\n });\n pasto.create({\n nome_pasto: 'Patate al forno',\n tipo: 'contorno',\n dettagli: 'patate al forno'\n });\n pasto.create({\n nome_pasto: 'Carote',\n tipo: 'contorno',\n dettagli: 'Carote'\n });\n pasto.create({\n nome_pasto: 'Fagiolini',\n tipo: 'contorno',\n dettagli: 'Fagiolini'\n });\n pasto.create({\n nome_pasto: 'Insalata',\n tipo: 'contorno',\n dettagli: 'Insalata verde fresca'\n });\n\n //create dolce\n pasto.create({\n nome_pasto: 'Budino',\n tipo: 'dolce',\n dettagli: 'Il budino è composto da una parte liquida, generalmente costituita da latte, da zucchero e da vari ingredienti o aromi che gli danno il gusto desiderato: frutta, cioccolato, nocciole, caramello, liquori, vaniglia ed altri ancora. A questi si uniscono spesso degli ingredienti che servono a legare il composto, cioè a renderlo più corposo e solido.'\n });\n pasto.create({\n nome_pasto: 'Yogurt',\n tipo: 'dolce',\n dettagli: 'Yogurt con tanti gusti'\n });\n pasto.create({\n nome_pasto: 'Frutta',\n tipo: 'dolce',\n dettagli: 'Frutta fresca'\n });\n pasto.create({\n nome_pasto: 'Crostata',\n tipo: 'dolce',\n dettagli: 'La crostata è un dolce tipico italiano basato su un impasto di pasta frolla coperto con confettura, crema o frutta fresca. Dolci simili sono diffusi in tutta Europa.'\n });\n\n //inserire menu_giorno in modo casuale\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 1\n });\n }\n }\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 2\n });\n }\n }\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 3\n });\n }\n }\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 4\n });\n }\n }\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 5\n });\n }\n }\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 6\n });\n }\n }\n random.init(0,18);\n for(var i=0;i<10;i++){\n var num=random.getNum();\n if(num>0){\n menu_giorno.create({\n pasto_id: num,\n giorno_id: 7\n });\n }\n }\n}", "static putInCime(to,t,p,op,couleur,id,cb){\n\t\tconsole.log(couleur);\n\t\tif(couleur == \"N\"){\n\t\t\tquery.execute(conn, 'echec','insert data {:cimeNoir rdf:type <'+op+id+'>}',\n\t\t\t'application/sparql-results+json', {\n\t\t\t\toffset:0,\n\t\t\t\treasoning: true\n\t\t\t}).then(res =>{\n\t\t\t\tthis.insertNew(to,t,p,cb);\n\t\t\t}).catch(e=> {console.log(e);});\t\n\t\t}\n\t\telse{\n\t\t\tquery.execute(conn, 'echec','insert data {:cimeBlanc rdf:type <'+op+id+'>}',\n\t\t\t'application/sparql-results+json', {\n\t\t\t\toffset:0,\n\t\t\t\treasoning: true\n\t\t\t}).then(res =>{\n\t\t\t\tthis.insertNew(to,t,p,cb);\n\t\t\t}).catch(e=> {console.log(e);});\t\t\n\t\t}\n\t}", "function insertarCarrito(curso) {\n const fragment = document.createDocumentFragment();\n const row = document.createElement('tr');\n row.innerHTML = `\n <td> <img src=\"${curso.imagen}\" width=120 /> </td>\n <td class=\"titulo\">${curso.titulo}</td>\n <td>${curso.precio}</td>\n <td> <a href=\"#\" class=\"borrar-curso\" data-id=\"${curso.id}\">x</a> </td>\n `;\n fragment.appendChild(row);\n listaCursos.appendChild(fragment);\n\tguardarCursoLocalStorage(curso);\n\tcantidad(2);\n\talert.textContent=\"Curso agregado\";\n\talert.style.backgroundColor=\"green\";\n\talert.classList.add('alertAnim');\n\tsetTimeout(()=>{\n\t\talert.classList.remove('alertAnim');\n\t}, 1500);\n\treturn true;\n}", "function insert_in_baseParticipant_emies(participant_emies,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemParticipant_emies==false)\n {\n getId = vm.selectedItemParticipant_emies.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId, \n nom: participant_emies.nom,\n prenom: participant_emies.prenom,\n sexe: participant_emies.sexe,\n id_situation_participant_emies: participant_emies.id_situation_participant_emies,\n id_module_emies: vm.selectedItemModule_emies.id \n });\n //console.log(feffi.pays_id);\n //factory\n apiFactory.add(\"participant_emies/index\",datas, config).success(function (data)\n { \n\n var situ= vm.allsituation_participant_emies.filter(function(obj)\n {\n return obj.id == participant_emies.id_situation_participant_emies;\n });\n\n if (NouvelItemParticipant_emies == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n { \n vm.selectedItemParticipant_emies.situation_participant_emies= situ[0];\n \n\n if(currentItemParticipant_emies.sexe == 1 && currentItemParticipant_emies.sexe !=vm.selectedItemParticipant_emies.sexe)\n {\n vm.selectedItemModule_emies.nbr_reel_fem_parti = parseInt(vm.selectedItemModule_emies.nbr_reel_fem_parti)+1; \n }\n\n if(currentItemParticipant_emies.sexe == 2 && currentItemParticipant_emies.sexe !=vm.selectedItemParticipant_emies.sexe)\n {\n vm.selectedItem.nbr_reel_fem_parti = parseInt(vm.selectedItem.nbr_reel_fem_parti)-1; \n }\n vm.selectedItemParticipant_emies.$selected = false;\n vm.selectedItemParticipant_emies.$edit = false;\n vm.selectedItemParticipant_emies ={};\n \n }\n else \n { \n vm.allparticipant_emies = vm.allparticipant_emies.filter(function(obj)\n {\n return obj.id !== vm.selectedItemParticipant_emies.id;\n });\n \n vm.selectedItemModule_emies.nbr_parti = parseInt(vm.selectedItemModule_emies.nbr_parti)-1;\n \n if(parseInt(participant_emies.sexe) == 2)\n {\n vm.selectedItemModule_emies.nbr_reel_fem_parti = parseInt(vm.selectedItemModule_emies.nbr_reel_fem_parti)-1;\n }\n }\n }\n else\n {\n participant_emies.situation_participant_emies = situ[0];\n participant_emies.id = String(data.response); \n NouvelItemParticipant_emies=false;\n\n vm.selectedItemModule_emies.nbr_parti = parseInt(vm.selectedItemModule_emies.nbr_parti)+1;\n if(parseInt(participant_emies.sexe) == 2)\n {\n vm.selectedItemModule_emies.nbr_reel_fem_parti = parseInt(vm.selectedItemModule_emies.nbr_reel_fem_parti)+1;\n }\n }\n participant_emies.$selected = false;\n participant_emies.$edit = false;\n vm.selectedItemParticipant_emies = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function insert_in_baseParticipant_emies(participant_emies,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItemParticipant_emies==false)\n {\n getId = vm.selectedItemParticipant_emies.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId, \n nom: participant_emies.nom,\n prenom: participant_emies.prenom,\n sexe: participant_emies.sexe,\n id_situation_participant_emies: participant_emies.id_situation_participant_emies,\n id_module_emies: vm.selectedItemModule_emies.id \n });\n //console.log(feffi.pays_id);\n //factory\n apiFactory.add(\"participant_emies/index\",datas, config).success(function (data)\n { \n\n var situ= vm.allsituation_participant_emies.filter(function(obj)\n {\n return obj.id == participant_emies.id_situation_participant_emies;\n });\n\n if (NouvelItemParticipant_emies == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n { \n vm.selectedItemParticipant_emies.situation_participant_emies= situ[0];\n \n\n if(currentItemParticipant_emies.sexe == 1 && currentItemParticipant_emies.sexe !=vm.selectedItemParticipant_emies.sexe)\n {\n vm.selectedItemModule_emies.nbr_reel_fem_parti = parseInt(vm.selectedItemModule_emies.nbr_reel_fem_parti)+1; \n }\n\n if(currentItemParticipant_emies.sexe == 2 && currentItemParticipant_emies.sexe !=vm.selectedItemParticipant_emies.sexe)\n {\n vm.selectedItem.nbr_reel_fem_parti = parseInt(vm.selectedItem.nbr_reel_fem_parti)-1; \n }\n vm.selectedItemParticipant_emies.$selected = false;\n vm.selectedItemParticipant_emies.$edit = false;\n vm.selectedItemParticipant_emies ={};\n \n }\n else \n { \n vm.allparticipant_emies = vm.allparticipant_emies.filter(function(obj)\n {\n return obj.id !== vm.selectedItemParticipant_emies.id;\n });\n \n vm.selectedItemModule_emies.nbr_parti = parseInt(vm.selectedItemModule_emies.nbr_parti)-1;\n \n if(parseInt(participant_emies.sexe) == 2)\n {\n vm.selectedItemModule_emies.nbr_reel_fem_parti = parseInt(vm.selectedItemModule_emies.nbr_reel_fem_parti)-1;\n }\n }\n }\n else\n {\n participant_emies.situation_participant_emies = situ[0];\n participant_emies.id = String(data.response); \n NouvelItemParticipant_emies=false;\n\n vm.selectedItemModule_emies.nbr_parti = parseInt(vm.selectedItemModule_emies.nbr_parti)+1;\n if(parseInt(participant_emies.sexe) == 2)\n {\n vm.selectedItemModule_emies.nbr_reel_fem_parti = parseInt(vm.selectedItemModule_emies.nbr_reel_fem_parti)+1;\n }\n }\n participant_emies.$selected = false;\n participant_emies.$edit = false;\n vm.selectedItemParticipant_emies = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "saveProduct(productData) {\r\n let nuevoProducto = new Product(productData);\r\n let indice = this._checkExist(productData.code);\r\n console.log(indice);\r\n this._inventory[this._inventory.length] = nuevoProducto;\r\n console.log(nuevoProducto);\r\n console.log(this._inventory);\r\n }", "function User_Insert_Produits_Prix_5(Compo_Maitre)\n{\n\n/*\n***** INFOS ******\n\nNbr d'esclaves = 5\n\nId dans le tab: 170;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 171;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 172;\nsimple\nNbr Jointure: 1;\n Joint n° 0 = tva,tv_numero,tv_numero\n\nId dans le tab: 173;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 174;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\n******************\n*/\n\n var Table=\"prix\";\n var CleMaitre = TAB_COMPO_PPTES[165].NewCle;\n var NomCleMaitre = DePrefixerChamp(Compo_Maitre.getCle());\n /* COMPOSANT LISTE AVEC JOINTURE SIMPLE */\n var px_tarifht=GetValAt(170);\n if (!ValiderChampsObligatoire(Table,\"px_tarifht\",TAB_GLOBAL_COMPO[170],px_tarifht,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"px_tarifht\",TAB_GLOBAL_COMPO[170],px_tarifht))\n \treturn -1;\n var px_tarifttc=GetValAt(171);\n if (!ValiderChampsObligatoire(Table,\"px_tarifttc\",TAB_GLOBAL_COMPO[171],px_tarifttc,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"px_tarifttc\",TAB_GLOBAL_COMPO[171],px_tarifttc))\n \treturn -1;\n var tv_numero=GetValAt(172);\n if (tv_numero==\"-1\")\n tv_numero=\"null\";\n if (!ValiderChampsObligatoire(Table,\"tv_numero\",TAB_GLOBAL_COMPO[172],tv_numero,true))\n \treturn -1;\n var px_datedebut=GetValAt(173);\n if (!ValiderChampsObligatoire(Table,\"px_datedebut\",TAB_GLOBAL_COMPO[173],px_datedebut,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"px_datedebut\",TAB_GLOBAL_COMPO[173],px_datedebut))\n \treturn -1;\n var px_actif=GetValAt(174);\n if (!ValiderChampsObligatoire(Table,\"px_actif\",TAB_GLOBAL_COMPO[174],px_actif,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"px_actif\",TAB_GLOBAL_COMPO[174],px_actif))\n \treturn -1;\n var Req=\"insert into \"+Table+\" \";\nvar TabInsertionEnPlus=new Array();\n Req+=\"(\"+NomCleMaitre+\",pd_numero,px_tarifht,px_tarifttc,tv_numero,px_datedebut,px_actif\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[0]:\"\")+\")\";\n Req+=\" values (\"+CleMaitre+\",\"+TAB_COMPO_PPTES[158].NewCle+\",\"+(px_tarifht==\"\" ? \"null\" : \"'\"+ValiderChaine(px_tarifht)+\"'\" )+\",\"+(px_tarifttc==\"\" ? \"null\" : \"'\"+ValiderChaine(px_tarifttc)+\"'\" )+\",\"+tv_numero+\",\"+(px_datedebut==\"\" ? \"null\" : \"'\"+ValiderChaine(px_datedebut)+\"'\" )+\",\"+(px_actif==\"true\" ? \"true\" : \"false\")+\"\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[1]:\"\")+\")\";\n\n if (pgsql_update(Req)==0)\n\talert(\"Echec lors de l'insertion\");\nreturn CleMaitre;\n\n}", "function agregarOrden(){\r\n let compra = document.getElementById('tit1')\r\n let precio = document.getElementById('pre1')\r\n pedido.push(new vehiculo(compra.textContent, precio.textContent));\r\n crearPedido(); \r\n}", "function addItemsPuertasItemsProteccion(k_coditem,o_descripcion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO puertas_items_proteccion (k_coditem, o_descripcion) VALUES (?,?)\";\n tx.executeSql(query, [k_coditem,o_descripcion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items protección...Espere\");\n });\n}", "async function insertProducto(obj) {\n try {\n // {stock_p : \"palabra\"}\n const rows = await query (\"insert into producto set ?\",obj);\n // undefined insertId es una propiedad que nos devuelve el primary A_I con el que se inserto el ultimo producto de esta peticion. \n\n return rows.insertId;\n } catch(err) {\n console.log(\"Entro al catch del model\")\n throw err;\n // console.log(err);\n }\n}", "function ajoutContrat_moe(contrat_moe,suppression)\n {\n if (NouvelItemContrat_moe==false)\n { \n if (vm.session==\"AAC\")\n {\n apiFactory.getAPIgeneraliserREST(\"contrat_be/index\",'menus','getcontratvalideById','id_contrat_moe',contrat_moe.id).then(function(result)\n {\n var contrat_moe_valide = result.data.response;\n if (contrat_moe_valide.length !=0)\n {\n var confirm = $mdDialog.confirm()\n .title('cette modification n\\'est pas autorisé. Les données sont déjà validées!')\n .textContent('')\n .ariaLabel('Lucky day')\n .clickOutsideToClose(true)\n .parent(angular.element(document.body))\n .ok('Fermer')\n \n $mdDialog.show(confirm).then(function()\n {\n vm.stepcalendrier_paie_moe=false;\n vm.allcontrat_moe = contrat_moe_valide; \n vm.selectedItemContrat_moe ={};\n }, function() {\n //alert('rien');\n });\n }\n else\n {\n test_existanceContrat_moe (contrat_moe,suppression); \n }\n });\n }\n else\n {\n test_existanceContrat_moe (contrat_moe,suppression);\n }\n \n } \n else\n {\n insert_in_baseContrat_moe(contrat_moe,suppression);\n }\n }", "Insert() {\n\n }", "function agregarDetalle(){\r\n if(!validarCamposDetalle()){\r\n return;\r\n }\r\n cargarDetalles();\r\n let temp;\r\n let correlativo = detallesOrden.length;\r\n if(existeEnOrden(document.getElementById(\"CodigoProd\").value,document.getElementById(\"Cantidad\").value, document.getElementById(\"Precio\").value,2)){\r\n guardarDetalles();\r\n poblarDetalle();\r\n limpiarDetalles();\r\n return;\r\n }\r\n temp = new detalle(\r\n correlativo+1,\r\n document.getElementById(\"CodigoProd\").value,\r\n document.getElementById(\"Descripcion\").value,\r\n document.getElementById(\"Cantidad\").value,\r\n document.getElementById(\"Precio\").value\r\n );\r\n \r\n detallesOrden.push(temp);\r\n guardarDetalles();\r\n poblarDetalle();\r\n limpiarDetalles();\r\n}", "function User_Insert_Agents_Liste_des_agents0(Compo_Maitre)\n{\n\n/*\n***** INFOS ******\n\nNbr d'esclaves = 10\n\nId dans le tab: 110;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 111;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 112;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 113;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 114;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 115;\nsimple\nNbr Jointure: 1;\n Joint n° 0 = equipe,eq_numero,eq_numero\n\nId dans le tab: 116;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 117;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 118;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 119;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\n******************\n*/\n\n var Table=\"agent\";\n var CleMaitre = TAB_COMPO_PPTES[104].NewCle;\n var NomCleMaitre = DePrefixerChamp(Compo_Maitre.getCle());\n var ag_nom=GetValAt(110);\n if (!ValiderChampsObligatoire(Table,\"ag_nom\",TAB_GLOBAL_COMPO[110],ag_nom,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ag_nom\",TAB_GLOBAL_COMPO[110],ag_nom))\n \treturn -1;\n var ag_prenom=GetValAt(111);\n if (!ValiderChampsObligatoire(Table,\"ag_prenom\",TAB_GLOBAL_COMPO[111],ag_prenom,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ag_prenom\",TAB_GLOBAL_COMPO[111],ag_prenom))\n \treturn -1;\n var ag_initiales=GetValAt(112);\n if (!ValiderChampsObligatoire(Table,\"ag_initiales\",TAB_GLOBAL_COMPO[112],ag_initiales,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ag_initiales\",TAB_GLOBAL_COMPO[112],ag_initiales))\n \treturn -1;\n var ag_actif=GetValAt(113);\n if (!ValiderChampsObligatoire(Table,\"ag_actif\",TAB_GLOBAL_COMPO[113],ag_actif,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ag_actif\",TAB_GLOBAL_COMPO[113],ag_actif))\n \treturn -1;\n var ag_role=GetValAt(114);\n if (!ValiderChampsObligatoire(Table,\"ag_role\",TAB_GLOBAL_COMPO[114],ag_role,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ag_role\",TAB_GLOBAL_COMPO[114],ag_role))\n \treturn -1;\n var eq_numero=GetValAt(115);\n if (eq_numero==\"-1\")\n eq_numero=\"null\";\n if (!ValiderChampsObligatoire(Table,\"eq_numero\",TAB_GLOBAL_COMPO[115],eq_numero,true))\n \treturn -1;\n var ag_telephone=GetValAt(116);\n if (!ValiderChampsObligatoire(Table,\"ag_telephone\",TAB_GLOBAL_COMPO[116],ag_telephone,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ag_telephone\",TAB_GLOBAL_COMPO[116],ag_telephone))\n \treturn -1;\n var ag_mobile=GetValAt(117);\n if (!ValiderChampsObligatoire(Table,\"ag_mobile\",TAB_GLOBAL_COMPO[117],ag_mobile,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ag_mobile\",TAB_GLOBAL_COMPO[117],ag_mobile))\n \treturn -1;\n var ag_email=GetValAt(118);\n if (!ValiderChampsObligatoire(Table,\"ag_email\",TAB_GLOBAL_COMPO[118],ag_email,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ag_email\",TAB_GLOBAL_COMPO[118],ag_email))\n \treturn -1;\n var ag_commentaire=GetValAt(119);\n if (!ValiderChampsObligatoire(Table,\"ag_commentaire\",TAB_GLOBAL_COMPO[119],ag_commentaire,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ag_commentaire\",TAB_GLOBAL_COMPO[119],ag_commentaire))\n \treturn -1;\n var Req=\"insert into \"+Table+\" \";\nvar TabInsertionEnPlus=new Array();\n Req+=\"(\"+NomCleMaitre+\",ag_nom,ag_prenom,ag_initiales,ag_actif,ag_role,eq_numero,ag_telephone,ag_mobile,ag_email,ag_commentaire\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[0]:\"\")+\")\";\n Req+=\" values (\"+CleMaitre+\",\"+(ag_nom==\"\" ? \"null\" : \"'\"+ValiderChaine(ag_nom)+\"'\" )+\",\"+(ag_prenom==\"\" ? \"null\" : \"'\"+ValiderChaine(ag_prenom)+\"'\" )+\",\"+(ag_initiales==\"\" ? \"null\" : \"'\"+ValiderChaine(ag_initiales)+\"'\" )+\",\"+(ag_actif==\"true\" ? \"true\" : \"false\")+\",\"+(ag_role==\"\" ? \"null\" : \"'\"+ValiderChaine(ag_role)+\"'\" )+\",\"+eq_numero+\",\"+(ag_telephone==\"\" ? \"null\" : \"'\"+ValiderChaine(ag_telephone)+\"'\" )+\",\"+(ag_mobile==\"\" ? \"null\" : \"'\"+ValiderChaine(ag_mobile)+\"'\" )+\",\"+(ag_email==\"\" ? \"null\" : \"'\"+ValiderChaine(ag_email)+\"'\" )+\",\"+(ag_commentaire==\"\" ? \"null\" : \"'\"+ValiderChaine(ag_commentaire)+\"'\" )+\"\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[1]:\"\")+\")\";\n\n if (pgsql_update(Req)==0)\n\talert(\"Echec lors de l'insertion\");\nreturn CleMaitre;\n\n}", "function accionCrear()\n\t{\n\n//\t\talert(\"accionCrear\");\n\t\tif(listado1.datos.length != 0)\n\t\t{\n\t\t\tvar orden = listado1.codSeleccionados();\n//\t\t\talert(\"Linea seleccionada \" + orden);\n\t\t\tset('frmPBuscarTiposError.hidOidCabeceraMatrizSel', orden);\n\t\t\tset('frmPBuscarTiposError.accion', 'crear');\n\t\t\tenviaSICC('frmPBuscarTiposError');\n\n\t\t}else\n\t\t{\n\t\t\talert(\"no hay seleccion: \" + listado1.datos.length);\n\t\t}\n\t}", "function insert_in_base(travaux_preparatoire,suppression)\n {\n //add\n var config =\n {\n headers : {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;'}\n };\n \n var getId = 0;\n if (NouvelItem==false)\n {\n getId = vm.selectedItem.id; \n } \n \n var datas = $.param({\n supprimer: suppression,\n id: getId, \n designation: travaux_preparatoire.designation,\n unite: travaux_preparatoire.unite,\n qt_prevu: travaux_preparatoire.qt_prevu,\n numero: travaux_preparatoire.numero \n });\n console.log(datas);\n //factory\n apiFactory.add(\"travaux_preparatoire/index\",datas, config).success(function (data)\n {\n if (NouvelItem == false)\n {\n // Update or delete: id exclu \n if(suppression==0)\n {\n vm.selectedItem.$selected = false;\n vm.selectedItem.$edit = false;\n vm.selectedItem ={};\n }\n else \n { \n vm.alltravaux_preparatoire = vm.alltravaux_preparatoire.filter(function(obj)\n {\n return obj.id !== vm.selectedItem.id;\n });\n }\n }\n else\n {\n travaux_preparatoire.id = String(data.response); \n NouvelItem=false;\n }\n travaux_preparatoire.$selected = false;\n travaux_preparatoire.$edit = false;\n vm.selectedItem = {};\n \n }).error(function (data){vm.showAlert('Error','Erreur lors de l\\'insertion de donnée');});\n\n }", "function User_Insert_Etats_de_personne_Liste_des_états_de_personne0(Compo_Maitre)\n{\n\n/*\n***** INFOS ******\n\nNbr d'esclaves = 1\n\nId dans le tab: 52;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\n******************\n*/\n\n var Table=\"etatpersonne\";\n var CleMaitre = TAB_COMPO_PPTES[50].NewCle;\n var NomCleMaitre = DePrefixerChamp(Compo_Maitre.getCle());\n var ep_libelle=GetValAt(52);\n if (!ValiderChampsObligatoire(Table,\"ep_libelle\",TAB_GLOBAL_COMPO[52],ep_libelle,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ep_libelle\",TAB_GLOBAL_COMPO[52],ep_libelle))\n \treturn -1;\n var Req=\"insert into \"+Table+\" \";\nvar TabInsertionEnPlus=new Array();\n Req+=\"(\"+NomCleMaitre+\",ep_libelle\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[0]:\"\")+\")\";\n Req+=\" values (\"+CleMaitre+\",\"+(ep_libelle==\"\" ? \"null\" : \"'\"+ValiderChaine(ep_libelle)+\"'\" )+\"\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[1]:\"\")+\")\";\n\n if (pgsql_update(Req)==0)\n\talert(\"Echec lors de l'insertion\");\nreturn CleMaitre;\n\n}", "function successInsert() {\n console.info(\"Success: Create table: friend successful.\");\n }", "function addPratoSelecionado() {\n let qntMedidas = medidas.length;\n let qntValorSelecionado = arrayValores.length;\n\n if (qntValorSelecionado != qntMedidas) {\n alert(\"Selecione Um valor pra cada medidas ou escolha \\\"desativado\\\"\")\n } else {\n const criaArray = (array) => {\n const arr = [];\n for (const item of array) {\n arr.push(item.prato)\n }\n return arr;\n }\n\n let arrayPratos = criaArray(listaPratosDia);\n let existeItem = arrayPratos.findIndex(i => i == valueListaPrato);\n\n if (existeItem == -1) {\n listaPratosDia.push({\n prato: valueListaPrato,\n info: arrayValores\n });\n\n setctx_SP(listaPratosDia);\n } else {\n alert('Este prato já está na lista!');\n }\n /* console.log('-------------------------------------------------------------------------')\n console.log(ctx_SP);\n //console.log(listaPratosDia);\n console.log('-------------------------------------------------------------------------') */\n }\n }", "static add(cours) {\r\n // cours.id = nextId++;\r\n // coursExtent.push(cours);\r\n // return cours;\r\n return db.execute('insert into Kurs (Nazwa, Opis, Cena, Wykladowca_Id_wykladowca) values (?, ?, ?, ?)', [cours.name, cours.description, cours.price, cours.id_instructor]);\r\n // return db.execute(\r\n // 'insert into Klient (imie, nazwisko, plec,email, data_urodzenia) values (?, ?, ?, ?, ?)',\r\n // [user.firstName, user.lastName, user.sex, user.email, user.dateOfBirth]\r\n // );\r\n }", "incluiClientes(Cliente) {\n return new Promise((resolve,reject) => {\n var sqlInsCliente = \"INSERT INTO Cliente (nomeCliente, cpfCliente, emailCliente, senhaCliente) VALUES('\" + Cliente.NOME + \"','\" + Cliente.CPF + \"','\" + Cliente.EMAIL + \"','\" + Cliente.SENHA + \"')\";\n console.log(\"INSERT MONTADO = \" + sqlInsCliente);\n this._db.query(sqlInsCliente, function (erro) {\n if (erro) {\n console.log(erro);\n return reject('ERRO NA INCLUSÃO DO NOVO REGISTRO NA TAB CLIENTES NO BD');\n }\n else { return resolve(); }\n }) \n })\n }", "function insertTempObra(x) {\n //code Insertando avances fisicos\n \n if (AOTI && x >= AOTI.length) {\n //code\n console.log(\"Todas las inserciones terminadas:::::::::::::::::::::::::::::::::\");\n location.href=\"mapa_proyectos.html\";\n // insertarAvanceFinancieroProyectos(0);\n }\n \n else if (AOTI && AOTI.length > 0) {\n console.log(\"Cargando datos espere un momento ::: 4 X=\" + x + \" Avances: \"+ AOTI.length);\n \n \n \n db.transaction(function(tx) {\n \n tx.executeSql('INSERT INTO TempAvanceObras(idAvanceFinanciero, idAvanceFisico, idObra)' +\n ' VALUES (?, ?, ?)',\n [AOTI.item(x).idAvanceFinanciero, AOTI.item(x).idAvanceFisico, AOTI.item(x).idObraFisico]);\n console.log(\"Avance Temp en Proyectos: \" + AOTI.item(x).idObraFisico);\n \n \n }, errorCB, function (){\n console.log(\"Se inserto correctamente el avance temporal: \" + AOTI.item(x).idObraFisico);\n \n x++;\n insertTempObra(x);\n \n }); \n \n } else {\n console.log(\"No hay avances temporales de obra :::::::::::::::::::::::\");\n // insertarAvanceFinancieroProyectos(0);\n }\n}", "function crearTablaAscensorValoresProteccion(){\n db.transaction(function (tx) {\n tx.executeSql('CREATE TABLE ascensor_valores_proteccion (k_codusuario,k_codinspeccion,k_coditem,v_sele_inspector,v_sele_empresa,o_observacion)');\n }, function (error) {\n console.log('transaction error: ' + error.message);\n }, function () {\n $('#texto_carga').text(\"Creando valores protección...Espere\");\n console.log('transaction creada ok');\n });\n}", "function GuardarObjectPagina(){\n var Objetos;\n var PaginaID;\n var CuentoID;\n\t\n $('.actual').each(function () {\n var id = $(this)[0].id.split('_')[1];\n Objetos = getObjetos(id);\n \n PaginaID= parseInt($(this)[0].id.split('_')[1]);\n CuentoID= parseInt(CuentoActual.ID.split('_')[1]);\n\n });\n\n db.transaction(InsertObject, errorinsertObject, successinsertObject);\n\n function InsertObject(tx) {\n for(var i = 0; i < Objetos.length; i++) {\n var sql = \"INSERT OR REPLACE INTO `Objetos`(`ID`, `Posx`, `Posy`, `Zoom`, `Angulo`, `ID_Paginas`, `ID_Tipo`, `ID_Cuento`)\";\n sql += \" VALUES (\"+Objetos[i].id+\",\"+Objetos[i].x+\",\"+Objetos[i].y+\",\"+Objetos[i].zoom+\",\"+Objetos[i].angulo+\",\"+PaginaID+\",\"+Objetos[i].tipo+\",\"+CuentoID+\")\";\n tx.executeSql(sql);\n }\n }\n\n function errorinsertObject(tx, err) {\n alert(\"Error al guardar objeto de pagina: \"+err);\n }\n\n function successinsertObject() {\n \t//alert(\"Guardo el Objeto bien\");\n }\n\n\n}", "function addItemsAscensorItemsProteccion(k_coditem,o_descripcion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO ascensor_items_proteccion (k_coditem, o_descripcion) VALUES (?,?)\";\n tx.executeSql(query, [k_coditem,o_descripcion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items protección...Espere\");\n });\n}", "function ajoutPv_consta_entete_travaux(pv_consta_entete_travaux,suppression)\n {\n if (NouvelItemPv_consta_entete_travaux==false)\n {\n apiFactory.getAPIgeneraliserREST(\"pv_consta_entete_travaux/index\",'menu',\"getpv_consta_entete_travauxvalideById\",'id_pv_consta_entete_travaux',pv_consta_entete_travaux.id).then(function(result)\n {\n var pv_consta_entete_travaux_valide = result.data.response;\n if (pv_consta_entete_travaux_valide.length !=0)\n {\n var confirm = $mdDialog.confirm()\n .title('cette modification n\\'est pas autorisé.')\n .textContent(' Les données sont déjà validées ou rejetée')\n .ariaLabel('Lucky day')\n .clickOutsideToClose(true)\n .parent(angular.element(document.body))\n .ok('Fermer')\n \n $mdDialog.show(confirm).then(function()\n { \n vm.allpv_consta_entete_travaux = vm.allpv_consta_entete_travaux.filter(function(obj)\n {\n return obj.id !== pv_consta_entete_travaux.id;\n });\n vm.step_tranche_batiment_mpe = false; \n vm.step_tranche_latrine_mpe = false;\n vm.step_tranche_mobilier_mpe = false;\n\n vm.steprubriquebatiment_mpe = false;\n vm.steprubriquelatrine_mpe = false; \n vm.steprubriquemobilier_mpe = false;\n vm.stepdecompte =false;\n vm.steppv_consta_recap_travaux = false;\n\n vm.steppv_consta_batiment_travaux = false;\n vm.steppv_consta_latrine_travaux = false;\n vm.steppv_consta_mobilier_travaux = false;\n\n }, function() {\n //alert('rien');\n });\n }\n else\n {\n test_existancePv_consta_entete_travaux (pv_consta_entete_travaux,suppression); \n }\n }); \n } \n else\n {\n insert_in_basePv_consta_entete_travaux(pv_consta_entete_travaux,suppression);\n }\n }", "createComic(newComic){\n newComic.id = 'default';\n this.Comic.create(newComic)\n .then(comic=>{\n this.addComicLocalStore(newComic);\n Materialize.toast('Se ha creado el comic correctamente', 5000);\n $('#newComicModal').closeModal();\n })\n .catch((err) => {\n console.log(err);\n });\n }", "function crearActividad() {\n\tvar name = document.getElementById(\"nombreActividad\").value;\n\tvar duracion = document.getElementById(\"duracion\").value;\n\tvar selectorSala = document.getElementById(\"selectorSala\");\n\tvar sala = selectorSala.options[selectorSala.selectedIndex].value;\n\n\tif (name == \"\" || duracion == \"\" || sala == \"\"){ // Si falta algun dato no creamos la actividad\n\t\talert(\"Rellene todos los campos de la actividad\");\n\t\treturn false;\n\t}\n\t\t\n\n\tvar actividad = new Actividad(name, duracion, sala);\n\tvectorActividades.push(actividad);\n\talert(\"Actividad creada correctamente\");\n\n\t// reseteamos los controles\t\n\tvar inputNombre = document.getElementById(\"nombreActividad\");\n\tinputNombre.value = \"\";\n\n\tvar inputDuracion = document.getElementById(\"duracion\");\n\tinputDuracion.value = \"\";\n\n\tvar tablaActividades = document.getElementById(\"actividades\");\n\n\tvar nuevaActividad = tablaActividades.insertRow(-1);\n\t\tnuevaActividad.innerHTML = \"<td>\" + actividad.nombre + \"</td><td>\" \n\t\t+ actividad.duracion + \"</td>\"\n\t\t+ \"<td>\" + actividad.sala + \"</td>\";\n\n\treturn true;\n}", "function insertarCarrito(curso) {\n const row = document.createElement(\"tr\");\n row.innerHTML = `\n <td>\n <img src=\"${curso.image}\" width=100>\n </td>\n <td>${curso.titulo}</td>\n <td>${curso.precio}</td>\n <td>\n <a href=\"#\" class=\"borrar-curso\" data-id=\"${curso.id}\">X</a>\n </td>\n `;\n listaCursos.appendChild(row);\n}", "function ajoutAvenant_partenaire(avenant_partenaire,suppression)\n {\n if (NouvelItemAvenant_partenaire==false)\n { \n apiFactory.getAPIgeneraliserREST(\"avenant_partenaire_relai/index\",'menu','getavenantvalideById','id_avenant_partenaire',avenant_partenaire.id).then(function(result)\n { \n var avenant_pr_valide = result.data.response;\n if (avenant_pr_valide.length !=0)\n {\n var confirm = $mdDialog.confirm()\n .title('cette modification n\\'est pas autorisé. Les données sont déjà validées!')\n .textContent('')\n .ariaLabel('Lucky day')\n .clickOutsideToClose(true)\n .parent(angular.element(document.body))\n .ok('Fermer')\n \n $mdDialog.show(confirm).then(function()\n { \n vm.allavenant_partenaire = vm.allavenant_partenaire.filter(function(obj)\n {\n return obj.id !== avenant_partenaire.id;\n });\n }, function() {\n //alert('rien');\n });\n }\n else\n {\n test_existanceAvenant_partenaire (avenant_partenaire,suppression); \n }\n }); \n } \n else\n {\n insert_in_baseAvenant_partenaire(avenant_partenaire,suppression);\n }\n }", "async save(isCreated){\n \n let sql = '';\n // insert\n if(isCreated){\n \n sql = `INSERT INTO ${this.tableName} (tenTheLoai,moTa) VALUES ('${this.columns.tenTheLoai}','${this.columns.moTa}')`;\n try {\n let results = await database.excute(sql);\n this.id = results.insertId;\n } catch (error) {\n throw error;\n }\n }\n\n // update\n else{\n sql = `UPDATE ${this.tableName} SET moTa='${this.columns.moTa}',tenTheLoai='${this.columns.tenTheLoai}' `+\n `WHERE id = ${this.id}`;\n try {\n let rs = await database.excute(sql);\n this.id = rs.id; \n } catch (error) {\n throw error;\n }\n }\n }", "function User_Insert_Ecritures_Liste_des_écritures_comptables0(Compo_Maitre)\n{\n\n/*\n***** INFOS ******\n\nNbr d'esclaves = 6\n\nId dans le tab: 93;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 94;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 95;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 96;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 97;\nsimple\nNbr Jointure: 1;\n Joint n° 0 = pointage,pt_numero,pt_numero\n\nId dans le tab: 98;\nsimple\nNbr Jointure: 1;\n Joint n° 0 = lettrage,lt_numero,lt_numero\n\n******************\n*/\n\n var Table=\"ecriture\";\n var CleMaitre = TAB_COMPO_PPTES[88].NewCle;\n var NomCleMaitre = DePrefixerChamp(Compo_Maitre.getCle());\n var ec_libelle=GetValAt(93);\n if (!ValiderChampsObligatoire(Table,\"ec_libelle\",TAB_GLOBAL_COMPO[93],ec_libelle,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ec_libelle\",TAB_GLOBAL_COMPO[93],ec_libelle))\n \treturn -1;\n var ec_compte=GetValAt(94);\n if (!ValiderChampsObligatoire(Table,\"ec_compte\",TAB_GLOBAL_COMPO[94],ec_compte,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ec_compte\",TAB_GLOBAL_COMPO[94],ec_compte))\n \treturn -1;\n var ec_debit=GetValAt(95);\n if (!ValiderChampsObligatoire(Table,\"ec_debit\",TAB_GLOBAL_COMPO[95],ec_debit,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ec_debit\",TAB_GLOBAL_COMPO[95],ec_debit))\n \treturn -1;\n var ec_credit=GetValAt(96);\n if (!ValiderChampsObligatoire(Table,\"ec_credit\",TAB_GLOBAL_COMPO[96],ec_credit,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"ec_credit\",TAB_GLOBAL_COMPO[96],ec_credit))\n \treturn -1;\n var pt_numero=GetValAt(97);\n if (pt_numero==\"-1\")\n pt_numero=\"null\";\n if (!ValiderChampsObligatoire(Table,\"pt_numero\",TAB_GLOBAL_COMPO[97],pt_numero,true))\n \treturn -1;\n var lt_numero=GetValAt(98);\n if (lt_numero==\"-1\")\n lt_numero=\"null\";\n if (!ValiderChampsObligatoire(Table,\"lt_numero\",TAB_GLOBAL_COMPO[98],lt_numero,true))\n \treturn -1;\n var Req=\"insert into \"+Table+\" \";\nvar TabInsertionEnPlus=new Array();\nvar Asso11=false;\nvar TabAsso11=new Array();\nvar CompoLie = GetSQLCompoAt(132);\nvar CompoLieMaitre = CompoLie.my_Affichable.my_MaitresLiaison.getAttribut().GetComposant();\nvar CleLiasonForte = CompoLieMaitre.getCleVal();\nif (CleLiasonForte!=-1)\n{\n\tAsso11=GenererAssociation11(CompoLie,CleMaitre,CleLiasonForte,TabAsso11);\n}\nelse\n{\n\talert(\"Vous devez d'abord valider \"+CompoLieMaitre.getLabel()+\" puis mettre à jour.\");\n\treturn -1;\n}\n Req+=\"(\"+NomCleMaitre+\",ec_libelle,ec_compte,ec_debit,ec_credit,pt_numero,lt_numero\"+(Asso11?\",\"+TabAsso11[0]:\"\")+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[0]:\"\")+\")\";\n Req+=\" values (\"+CleMaitre+\",\"+(ec_libelle==\"\" ? \"null\" : \"'\"+ValiderChaine(ec_libelle)+\"'\" )+\",\"+(ec_compte==\"\" ? \"null\" : \"'\"+ValiderChaine(ec_compte)+\"'\" )+\",\"+(ec_debit==\"\" ? \"null\" : \"'\"+ValiderChaine(ec_debit)+\"'\" )+\",\"+(ec_credit==\"\" ? \"null\" : \"'\"+ValiderChaine(ec_credit)+\"'\" )+\",\"+pt_numero+\",\"+lt_numero+\"\"+(Asso11?\",\"+TabAsso11[1]:\"\")+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[1]:\"\")+\")\";\n\n if (pgsql_update(Req)==0)\n\talert(\"Echec lors de l'insertion\");\nif (CleLiasonForte!=-1 && !Asso11)\n{\n\tAjouterAssociation(CompoLie,CleMaitre,CleLiasonForte);\n}\nelse\n{\n\tif (CleLiasonForte==-1)\n\t{\n\t\talert(\"Attention votre enregistrement ne peux être relié à \"+CompoLieMaitre.getLabel()+\". Vous devez d'abord ajouter un enregistrement à \"+CompoLieMaitre.getLabel()+\" puis le mettre à jour\");\n\t\treturn -1;\n\t}\n}\nreturn CleMaitre;\n\n}", "function addItemsEscalerasItemsProteccion(k_coditem,o_descripcion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO escaleras_items_proteccion (k_coditem, o_descripcion) VALUES (?,?)\";\n tx.executeSql(query, [k_coditem,o_descripcion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items protección...Espere\");\n });\n}", "function addItemsPuertasItemsManiobras(k_coditem_maniobras,o_descripcion,v_clasificacion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO puertas_items_maniobras (k_coditem_maniobras, o_descripcion, v_clasificacion) VALUES (?,?,?)\";\n tx.executeSql(query, [k_coditem_maniobras,o_descripcion,v_clasificacion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items maniobras...Espere\");\n });\n}", "function User_Insert_Types_de_lien_Liste_des_types_de_lien_entre_personne0(Compo_Maitre)\n{\n\n/*\n***** INFOS ******\n\nNbr d'esclaves = 2\n\nId dans le tab: 45;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 46;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\n******************\n*/\n\n var Table=\"typelien\";\n var CleMaitre = TAB_COMPO_PPTES[43].NewCle;\n var NomCleMaitre = DePrefixerChamp(Compo_Maitre.getCle());\n var tl_libelle=GetValAt(45);\n if (!ValiderChampsObligatoire(Table,\"tl_libelle\",TAB_GLOBAL_COMPO[45],tl_libelle,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"tl_libelle\",TAB_GLOBAL_COMPO[45],tl_libelle))\n \treturn -1;\n var tl_description=GetValAt(46);\n if (!ValiderChampsObligatoire(Table,\"tl_description\",TAB_GLOBAL_COMPO[46],tl_description,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"tl_description\",TAB_GLOBAL_COMPO[46],tl_description))\n \treturn -1;\n var Req=\"insert into \"+Table+\" \";\nvar TabInsertionEnPlus=new Array();\n Req+=\"(\"+NomCleMaitre+\",tl_libelle,tl_description\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[0]:\"\")+\")\";\n Req+=\" values (\"+CleMaitre+\",\"+(tl_libelle==\"\" ? \"null\" : \"'\"+ValiderChaine(tl_libelle)+\"'\" )+\",\"+(tl_description==\"\" ? \"null\" : \"'\"+ValiderChaine(tl_description)+\"'\" )+\"\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[1]:\"\")+\")\";\n\n if (pgsql_update(Req)==0)\n\talert(\"Echec lors de l'insertion\");\nreturn CleMaitre;\n\n}", "insertTva(req, res) {\n sequelize\n .query(\"INSERT INTO tva (taux) VALUES('\" + req.body.taux + \"')\", { type: sequelize.QueryTypes.INSERT }, {})\n .then(res.status(200).send('tva added successfully'))\n .catch((error) => res.status(400).send(error));\n }", "function addTramite(){\n var fullname = vm.name + \" \" + vm.surnames;\n var date = dateFormat(vm.date);\n firebase.database().ref('rh/tramitesProceso/').push({\n usuario: fullname,\n rfc: vm.rfc,\n tramite: vm.tramite.nombreTramite,\n fecha: date,\n estatus: vm.estatus,\n oficina: vm.usuarioOficina,\n usuarioOficina: vm.usuarioTramites \n }).then(function(){\n vm.modalAddTramite.dismiss();\n swal('Tramite agregado!','','success');\n vm.name = \"\";\n vm.surnames = \"\";\n vm.rfc = \"\";\n vm.tramite = \"\";\n });\n }", "function ajoutAvenant_partenaire(avenant_partenaire,suppression)\n {\n if (NouvelItemAvenant_partenaire==false)\n { \n if (vm.session==\"AAC\")\n {\n apiFactory.getAPIgeneraliserREST(\"avenant_partenaire_relai/index\",'menu','getavenantvalideById','id_avenant_partenaire',avenant_partenaire.id).then(function(result)\n { \n var avenant_pr_valide = result.data.response;\n if (avenant_pr_valide.length !=0)\n {\n var confirm = $mdDialog.confirm()\n .title('cette modification n\\'est pas autorisé. Les données sont déjà validées!')\n .textContent('')\n .ariaLabel('Lucky day')\n .clickOutsideToClose(true)\n .parent(angular.element(document.body))\n .ok('Fermer')\n \n $mdDialog.show(confirm).then(function()\n { \n vm.allavenant_partenaire = vm.allavenant_partenaire.filter(function(obj)\n {\n return obj.id !== avenant_partenaire.id;\n });\n }, function() {\n //alert('rien');\n });\n }\n else\n {\n test_existanceAvenant_partenaire (avenant_partenaire,suppression); \n }\n }); \n }\n else\n {\n test_existanceAvenant_partenaire (avenant_partenaire,suppression); \n } \n \n } \n else\n {\n insert_in_baseAvenant_partenaire(avenant_partenaire,suppression);\n }\n }", "crearUsuario() {\n if (this.lista_usuario.findIndex(usuario => usuario.id == this.usuario.id) === -1) {\n let calculo = (this.usuario.peso / (this.usuario.estatura * this.usuario.estatura)) * 10000;\n this.x = calculo.toFixed(2)\n this.usuario.IMC = this.x\n this.lista_usuario.push(this.usuario)\n this.usuario = {\n tipoidentificacion: \"\",\n id: \"\",\n nombres: \"\",\n apellidos: \"\",\n correo: \"\",\n peso: \"\",\n estatura: \"\",\n IMC: \"\",\n acciones: true\n };\n this.saveLocalStorage();\n this.estado = \"\"\n }\n else {\n alert('Este usuario ya se encuentra Registrado')\n }\n }", "function addItemsAscensorItemsCabina(k_coditem_cabina,v_item,o_descripcion,v_clasificacion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO ascensor_items_cabina (k_coditem_cabina, v_item, o_descripcion, v_clasificacion) VALUES (?,?,?,?)\";\n tx.executeSql(query, [k_coditem_cabina,v_item,o_descripcion,v_clasificacion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items cabina...Espere\");\n });\n}", "function addItemConsecutivoPuertas(codigo, consecutivo) {\n var inspeccion = \"PUT\"+codigo+\"-00\"+consecutivo+\"-\"+anio;\n db.transaction(function (tx) {\n var query = \"INSERT INTO consecutivo_puertas (k_codusuario, k_consecutivo, n_inspeccion) VALUES (?,?,?)\";\n tx.executeSql(query, [codigo, \"00\"+consecutivo, inspeccion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n if(navigator.notification && navigator.notification.alert){\n navigator.notification.alert(\"Inspector creado con éxito!\", null, \"Montajes & Procesos M.P SAS\", \"Ok\");\n window.location='../index.html';\n }else{\n alert(\"Inspector creado con éxito!\");\n window.location='../index.html'; //despues de haber creado el inspector y las tablas correspondientes de consecutivos en la BD\n } \n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n });\n}" ]
[ "0.6409173", "0.6152649", "0.61303747", "0.59899956", "0.59842926", "0.5980979", "0.58879983", "0.5838787", "0.5826788", "0.5826788", "0.57586384", "0.5756563", "0.5740777", "0.57175094", "0.5716188", "0.5716019", "0.5715275", "0.56862587", "0.56861013", "0.5677974", "0.567411", "0.5668833", "0.56622255", "0.5652052", "0.5652052", "0.5650816", "0.5636117", "0.5629625", "0.5629625", "0.5620563", "0.5618508", "0.5615012", "0.5612772", "0.56070095", "0.5602245", "0.56003624", "0.5598962", "0.5591381", "0.5589195", "0.558378", "0.5583613", "0.5579956", "0.5579693", "0.55792904", "0.55772066", "0.55772066", "0.55758923", "0.5570168", "0.5570168", "0.5568239", "0.5566554", "0.55571806", "0.5551818", "0.5551818", "0.55459654", "0.5545828", "0.55408937", "0.5537436", "0.5528115", "0.5525093", "0.55243003", "0.5503996", "0.5501307", "0.5498755", "0.5498755", "0.5496698", "0.54896206", "0.54878736", "0.5487267", "0.54847026", "0.5482379", "0.548021", "0.54787266", "0.54781276", "0.5473333", "0.5469601", "0.5468139", "0.5466726", "0.5464037", "0.54636014", "0.54629254", "0.54536074", "0.5450145", "0.5448105", "0.5439066", "0.54357934", "0.5424629", "0.5424562", "0.54138386", "0.54132205", "0.541027", "0.54101217", "0.54074824", "0.540686", "0.54047215", "0.54027", "0.54024786", "0.5400179", "0.5397681", "0.5391491", "0.5390977" ]
0.0
-1
Cart de categorias que va a ser insertado en el contenedor
function DatCategoriMP(id, Nombre) { return '<option value="' + id + '">' + Nombre + '</option>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pesquisarCategoria() {\n apiService.get('/api/produtopromocional/fornecedorcategoria', null,\n categoriaLoadCompleted,\n categoriaLoadFailed);\n }", "function addProductCategory(){\r\n\t var categoryId = 0;\r\n\t var categoryName,categoryOptions ;\r\n\r\n\t productCategoriesArray.push(new ProductCategory(categoryId,categoryName,categoryOptions));\r\n iterateProductCategoriesArray();\r\n }", "function addToCateg () {\n\n\t\tfor(var i=0;i<whichCateg;i++){\n\t\t\tif(cathegory == Object.getOwnPropertyNames(categ.categName)[i])\n\t\t\t\t{console.log(\"this is working BUT\");\n\t\t\t\t\tconsole.log(\"cathegory \" + cathegory);\n\t\t\t\t\t// BUT CANT AUTOMATED////////\n\t\t\t\t\tObject.keys(categ.categName[cathegory].push(Name));\t\n\t\t\t\t}\n\t\t}\n\t}", "function saveListNewProduct() {\n\n // event.preventDefault();\n\n let idcateg = document.querySelectorAll('.displayCat')[0].getAttribute('idcat');\n let nbc = document.querySelectorAll('.contratCat').length;\n for (a = 0; a < nbc; a++) {\n\n let yu = document.querySelectorAll('.contratCat')[a];\n // let ol = document.querySelectorAll('.contratCat')[a].children[0];\n // let re = ol.getAttribute('idcat');\n let re = yu.children[0].attributes[3].value;\n console.log(re);\n\n if (re == idcateg) {\n\n yu.remove(yu);\n console.log('fait !');\n }\n }\n \n\n // enregistrement du contrat list\n\n let nbrecontratCat = document.querySelectorAll('.contratCat').length;\n\n let saveDonnees = [];\n let saveDats = [];\n let saveCheques = [];\n\n for (let p = 0; p < nbrecontratCat; p++) {\n\n let contr = document.querySelectorAll('.contratCat')[p];\n let nbPdt = contr.childElementCount - 2;\n let nbCheq = contr.lastElementChild.children[0].children[0].children[0].children[1].childElementCount - 2;\n\n if (saveDonnees != 0) {\n saveDats.push({\n 'categorie': saveDonnees,\n 'Cheques': saveCheques\n })\n }\n\n saveDonnees = [];\n saveCheques = [];\n\n let nomBq = '';\n let noCheq = '';\n let mtCheq = 0;\n\n for (let k = 0; k < nbPdt; k++) {\n\n let nomSupCat = contr.children[k].getAttribute('nomSupCat');\n let nomCat = contr.children[k].getAttribute('nomCat');\n let idCat = contr.children[k].getAttribute('idCat');\n let nCheque = contr.children[k].getAttribute('ncheque');\n\n let qtite = contr.children[k].children[0].children[0].children[0].textContent;\n let nomPdt = contr.children[k].children[0].children[0].children[0].getAttribute('namePdt');\n\n let idPdt = contr.children[k].children[0].children[0].children[0].getAttribute('idPdt');\n let totalCat = contr.children[k].children[0].children[0].children[2].children[0].value;\n // console.log(totalCat);\n\n saveDonnees.push({\n\n 'Nom_user': userName,\n 'Id_user': userId,\n 'Nom_SuperCategorie': nomSupCat,\n 'Nom_Categorie': nomCat,\n 'id_Categorie': idCat,\n 'Nbre_cheque': nCheque,\n 'quantite': qtite,\n 'nom_produit': nomPdt,\n 'id_produit': idPdt,\n 'total': parseFloat(totalCat).toFixed(2)\n })\n }\n\n for (let v = 0; v < nbCheq; v++) {\n\n nomBq = contr.lastElementChild.children[0].children[0].children[0].children[1].children[v].children[1].value;\n noCheq = contr.lastElementChild.children[0].children[0].children[0].children[1].children[v].children[2].value;\n mtCheq = parseFloat(contr.lastElementChild.children[0].children[0].children[0].children[1].children[v].children[3].value).toFixed(2);\n\n saveCheques.push({\n 'nom_Bq': nomBq,\n 'no_Cheq': noCheq,\n 'montant_Cheq': mtCheq\n })\n }\n \n }\n if (saveDonnees != 0) {\n\n saveDats.push({\n 'categorie': saveDonnees,\n 'Cheques': saveCheques\n })\n localStorage.setItem('contrats', JSON.stringify(saveDats));\n }\n else {\n localStorage.removeItem('contrats');\n}\n\n //############ enregistrer : ######### \n\n\n let nbCat = document.querySelectorAll('.displayCat').length;\n let nc = document.querySelectorAll('.displayCat')[0].getAttribute('nbrecheque');\n\n let saveDat = [];\n let saveData = [];\n let Cheques =[];\n let nameUser = document.querySelector('#header').getAttribute('nameuser');\n let idUser = document.querySelector('#header').getAttribute('iduser');\n\n\n if (saveData != 0) {\n saveDat.push({\n 'categorie': saveData,\n 'Cheques': Cheques\n })\n }\n \n saveData = [];\n Cheques = [];\n \n for (let l = 0; l < nbCat; l++) {\n \n let ncheque = document.querySelector('.displayCat').getAttribute('nbrecheque');\n let qte = document.querySelectorAll('.displayCat > td.qtite > input.Qt')[l].value;\n let nomSuperCat = document.querySelector('.displayCat').getAttribute('nomsupcat');\n let nomCat = document.querySelector('.displayCat').getAttribute('nomcat');\n let catId = document.querySelector('.displayCat').getAttribute('idcat');\n let pdtId = document.querySelectorAll('.displayCat > td.nomPdt')[l].getAttribute('idpdt');\n let nom = document.querySelectorAll('.displayCat > td.nomPdt')[l].textContent;\n let Total = parseFloat(document.querySelectorAll('.displayCat > td > input.Tot')[l].value);\n if (Total > 0) {\n \n saveData.push({\n 'Nom_user': nameUser,\n 'Id_user': idUser,\n 'Nom_SuperCategorie': nomSuperCat,\n 'Nom_Categorie': nomCat,\n 'id_Categorie': catId,\n 'Nbre_cheque': ncheque,\n 'quantite': qte,\n 'nom_produit': nom,\n 'id_produit': pdtId,\n 'total': parseFloat(Total).toFixed(2) \n });\n }\n }\n\n for (e = 0; e < nc; e++) {\n\n Cheques.push({\n 'nom_Bq': '',\n 'no_Cheq': '',\n 'montant_Cheq': 0\n })\n }\n\n if (saveData != 0) {\n saveDat.push({\n 'categorie': saveData,\n 'Cheques': Cheques\n })\n }\n \n if (localStorage.getItem('contrats') != null) {\n let ajoutContrat = JSON.parse(localStorage.getItem('contrats'));\n \n ajoutContrat.push({\n 'categorie': saveData,\n 'Cheques': Cheques\n })\n\n if (saveData != 0)\n \n localStorage.setItem('contrats', JSON.stringify(ajoutContrat));\n \n } else {\n \n localStorage.setItem('contrats', JSON.stringify(saveDat));\n }\n \n // ############ shutdown window products #######\n\n shutDownWin(event);\n\n // document.querySelector('.noDisplayPdt').style.display = 'none';\n \n // document.querySelector('#container').style.opacity = 1;\n // document.querySelector('footer').style.opacity = 1;\n\n // document.querySelectorAll('.list-categorie').forEach((elmt) => {\n // elmt.classList.remove('noDisplay');\n // elmt.classList.remove('displayCat');\n // })\n\n // let globalT = document.querySelector('.globalTotal');\n // globalT.value = 0;\n\n // let NbreLigne = document.querySelectorAll('.list-categorie').length;\n\n // for (let k = 0; k < NbreLigne; k++) {\n // let Tot = document.querySelectorAll('input.Tot')[k];\n // let Qte = document.querySelectorAll('input.Qt')[k];\n // Tot.value = 0;\n // Qte.value = 0;\n // } \n\n\n // window.location.href = '//127.0.0.1:4600/contrats';\n // const GetContratAjPdt = new GetLocalStorage(JSON.parse(localStorage.getItem('contrats')));\n // (getContratList())();\n }", "function insertCategory(category){\n var newId=getMaxId(_categoryProducts)+1;\n var newcategory = {\n id:newId,\n category:category,\n products:[]\n }\n _categoryProducts.push(newcategory); \n return newId;\n}", "function addtocart(t) {\r\n var i = t.parentNode.rowIndex;\r\n var arr = productParts[i - 1];\r\n var carProduct = new Product(arr.productName, arr.Price, arr.Inventory, arr.Supplier, arr.Description, arr.img);\r\n productcart.push(carProduct);\r\n localStorage.setItem(\"productcart\", JSON.stringify(productcart));\r\n displaycartProduct(productcart);\r\n}", "function addItem(product) {\n // Recuperer les donnees dans le localstorage\n let cart = JSON.parse(localStorage.getItem(\"cart\")) || [];\n // Creation d'une variable avec les elements que je souhaite afficher\n let newProduct = {\n id: id,\n name: product.name,\n imageUrl: product.imageUrl,\n price: product.price / 100,\n color: color.value,\n qty: parseInt(select.value)\n };\n console.log(newProduct);\n //console.log(select);\n //console.log(color);\n\n // Creation d'une variable pour que mon produit ne soit pas doubler\n let productAlReadyInCart = false;\n // Je boucle tout les produits\n for (let i = 0; i < cart.length; i++) {\n //Si l'id = \"newPoduct.id\" et color = newProduct.color,un nouveau produit se crée si l'id et la couleur changent\n if (cart[i].id === newProduct.id && cart[i].color === newProduct.color) {\n console.log(\"le produit existe deja\");\n productAlReadyInCart = true;\n // On ajoute la quantité au produit qui existe deja\n cart[i].qty += newProduct.qty;\n cart[i].price = newProduct.price;\n }\n }\n //Si le produit n'existe pas , on rajoute un nouveau au panier\n if (productAlReadyInCart === false) {\n // J'ajoute l'element \"cart\" à l'element \"newProduct\"\n cart.push(newProduct);\n }\n //Je stock les nouvelles donnees\n localStorage.setItem(\"cart\", JSON.stringify(cart));\n //une fenêtre alert apparait lorsqu'on ajoute un produit dans le panier\n alert(\"Vous avez ajouté ce produit dans votre panier: \" + product.name)\n //console.log(cart)\n}", "function addToCart() {\n console.log(\"toto\");\n let productsInCart = JSON.parse(localStorage.getItem(\"identifiants\"));\n /*Si le panier est vide*/\n if (productsInCart === null) {\n productsInCart = new Array();\n localStorage.setItem(\"identifiants\", JSON.stringify(productsInCart));\n }\n /*Récupère la quantité de l'objet */\n let selectQuantity = document.getElementById(\"productQuantity\");\n let selectedQuantity = selectQuantity.options[selectQuantity.selectedIndex].value;\n /*Créé un objet contenant la quantité et l'idée de l'objet*/\n let item = {\n \"id\": name,\n \"quantity\": selectedQuantity,\n };\n /*Permet de modifier la quantité d'un article donné sans ajouter le même identifiant*/\n if (canAddItem(productsInCart, name)) {\n productsInCart.push(item);\n } else {\n for (item in productsInCart) {\n if (productsInCart[item].id == name) {\n productsInCart[item].quantity = parseInt(productsInCart[item].quantity) + parseInt(selectedQuantity);\n }\n }\n }\n localStorage.setItem(\"identifiants\", JSON.stringify(productsInCart));\n}", "function valorEstoqueCategoria(database) {\n \n //inicializacao de uma array de objeto 'estoque', onde cada objeto representa uma categoria e recebe valor do estoque do primeiro produto\n let estoque = [{\n categoria: database[0].category,\n valEstoque: database[0].quantity * database[0].price \n }],\n index = 0;\n \n //loop para passar por todos os objetos da array de produtos\n for(i = 1; i < database.length; i++) {\n \n //caso seja uma categoria diferente, inicializa novo objeto estoque, atribui o nome e o valor de estoque \n if (estoque[index].categoria != database[i].category) {\n \n index++;\n estoque.push({\n categoria: database[i].category,\n valEstoque: database[i].quantity * database[i].price\n })\n \n } else {\n \n //sendo a mesma categoria do produto atual, apenas acumular o valor de estoque\n estoque[index].valEstoque += database[i].quantity * database[i].price; \n } \n }\n \n console.table(estoque);\n}", "function displayProductsInCart() {\n for (let i = 0; i < productInCart.length; i ++) {\n const templateCart = document.getElementById('templateCart');\n const cloneElement = document.importNode(templateCart.content, true);\n \n cloneElement.getElementById(\"basket__image\").src = productInCart[i].image;\n cloneElement.getElementById(\"basket__name\").textContent = productInCart[i].name;\n cloneElement.getElementById(\"basket__id\").textContent = `Réf : ` + productInCart[i].id;\n cloneElement.getElementById(\"basket__price\").textContent = (productInCart[i].price).toLocaleString(\"fr-FR\", {style:\"currency\", currency:\"EUR\"});\n cloneElement.getElementById(\"basket__option\").textContent = productInCart[i].option;\n cloneElement.getElementById(\"basket__quantity\").textContent = productInCart[i].quantity;\n \n document.getElementById(\"basketTable\").appendChild(cloneElement);\n }\n // Contrôle des boutons \"Quantité\"\n reduceQuantity();\n increaseQuantity();\n deleteProduct();\n}", "function addCart(id){\n const check = data.items.every(item => {\n return item.id !== id\n })\n\n \n\n if(check){\n\n // Verifico si el ID del producto es el mismo del clickeado\n data.items.filter(product => {\n return product.id === id\n })\n\n // Atualizo el context\n setData(\n {...data,\n cantidad: data.cantidad + counter,\n items: [...data.items, item],\n total: data.total + (item.precio * counter)\n }\n ) \n\n // Mensaje de confirmación \n setMessage(Swal.fire({\n position: 'center',\n icon: 'success',\n title: 'Producto agregado',\n text: \"Tu producto fue agregado al carrito\",\n showDenyButton: false,\n showCancelButton: true,\n showConfirmButton: true,\n confirmButtonText: `Ir al carrito`,\n cancelButtonText: `Seguir comprando`,\n }).then(res =>{\n if(res.isConfirmed){\n setRedirect(true)\n }\n })\n )\n\n }else{\n // // Mensaje de que el producto ya se agrego al carrito\n setMessage(Swal.fire({\n position: 'center',\n icon: 'warning',\n title: 'El producto ya fue agregado al carrito',\n }))\n }\n \n }", "function storeCategories(data){\n return {\n type: STORE_CATEGORIES,\n data\n };\n}", "function modalInsertProduct() {\n var contenedor = $(\"#insertProduct\").find(\"form\")[0]; //Cogemos el formulario\n var type = $(\"#tipos\").val(); //Cogemos el valor del select para saber el tipo de producto\n var select = $(\"#categorias\")[0]; //Cogemos el select de categorias\n var groups = $(\"#insertProduct\").find(\".form-group\"); //Cogemos los grupos ya creados para saber donde tenemos que insertar los nuevos\n var group, label, div, input, option, p;\n\n if (contenedor.children.length > 6) { //Si el formulario ha sido alterado lo restauramos\n restoreModal(\"insertProduct\");\n }\n\n switch (type) { //Segun el tipo creamos los campos necesarios\n case \"Bass\":\n\n group = document.createElement(\"div\");\n $(group).attr(\"class\", \"form-group\");\n\n label = document.createElement(\"label\");\n $(label).attr({\n \"class\": \"col-md-12\",\n \"for\": \"strings\"\n });\n $(label).text(\"Cuerdas*\");\n $(group).append(label);\n\n div = document.createElement(\"div\");\n $(div).attr(\"class\", \"col-md-12\");\n\n input = document.createElement(\"input\");\n $(input).attr({\n \"type\": \"text\",\n \"name\": \"strings\",\n \"id\": \"strings\",\n \"class\": \"form-control\",\n \"placeholder\": \"4, 5 o 6\"\n });\n $(div).append(input);\n\n p = document.createElement(\"p\");\n $(p).attr(\"class\", \"col-md-12 error\");\n $(div).append(p);\n\n $(group).append(div);\n $(\"#imgNP\").parent().parent().before(group);\n\n group = document.createElement(\"div\");\n $(group).attr(\"class\", \"form-group\");\n\n label = document.createElement(\"label\");\n $(label).attr({\n \"class\": \"col-md-12\",\n \"for\": \"electronic\"\n });\n $(label).text(\"Electronica*\");\n $(group).append(label);\n\n div = document.createElement(\"div\");\n $(div).attr(\"class\", \"col-md-12\");\n\n input = document.createElement(\"input\");\n $(input).attr({\n \"type\": \"text\",\n \"name\": \"electronic\",\n \"id\": \"electronic\",\n \"class\": \"form-control\",\n \"placeholder\": \"pasiva o activa\"\n });\n $(div).append(input);\n\n p = document.createElement(\"p\");\n $(p).attr(\"class\", \"col-md-12 error\");\n $(div).append(p);\n\n $(group).append(div);\n $(\"#imgNP\").parent().parent().before(group);\n break;\n\n case \"Drums\":\n group = document.createElement(\"div\");\n $(group).attr(\"class\", \"form-group\");\n\n label = document.createElement(\"label\");\n $(label).attr({\n \"class\": \"col-md-12\",\n \"for\": \"type\"\n });\n $(label).text(\"Tipo*\");\n $(group).append(label);\n\n div = document.createElement(\"div\");\n $(div).attr(\"class\", \"col-md-12\");\n\n input = document.createElement(\"input\");\n $(input).attr({\n \"type\": \"text\",\n \"name\": \"type\",\n \"id\": \"type\",\n \"class\": \"form-control\",\n \"placeholder\": \"acustica o electronica\"\n });\n $(div).append(input);\n\n p = document.createElement(\"p\");\n $(p).attr(\"class\", \"col-md-12 error\");\n $(div).append(p);\n\n $(group).append(div);\n $(\"#imgNP\").parent().parent().before(group);\n\n group = document.createElement(\"div\");\n $(group).attr(\"class\", \"form-group\");\n\n label = document.createElement(\"label\");\n $(label).attr({\n \"class\": \"col-md-12\",\n \"for\": \"toms\"\n });\n $(label).text(\"Medidas de los toms\");\n $(group).append(label);\n\n div = document.createElement(\"div\");\n $(div).attr(\"class\", \"col-md-12\");\n\n input = document.createElement(\"input\");\n $(input).attr({\n \"type\": \"text\",\n \"name\": \"toms\",\n \"id\": \"toms\",\n \"class\": \"form-control\",\n \"placeholder\": \"Ej: 22x18,12x08,13x09,16x16,14x5.5\"\n });\n $(div).append(input);\n\n p = document.createElement(\"p\");\n $(p).attr(\"class\", \"col-md-12 error\");\n $(div).append(p);\n\n $(group).append(div);\n $(\"#imgNP\").parent().parent().before(group);\n break;\n\n case \"Amplifier\":\n group = document.createElement(\"div\");\n $(group).attr(\"class\", \"form-group\");\n\n label = document.createElement(\"label\");\n $(label).attr({\n \"class\": \"col-md-12\",\n \"for\": \"watts\"\n });\n $(label).text(\"Potencia*\");\n $(group).append(label);\n\n div = document.createElement(\"div\");\n $(div).attr(\"class\", \"col-md-12\");\n\n input = document.createElement(\"input\");\n $(input).attr({\n \"type\": \"text\",\n \"name\": \"watts\",\n \"id\": \"watts\",\n \"class\": \"form-control\",\n \"placeholder\": \"Ej: 150\"\n });\n $(div).append(input);\n\n p = document.createElement(\"p\");\n $(p).attr(\"class\", \"col-md-12 error\");\n $(div).append(p);\n\n $(group).append(div);\n $(\"#imgNP\").parent().parent().before(group);\n\n group = document.createElement(\"div\");\n $(group).attr(\"class\", \"form-group\");\n\n label = document.createElement(\"label\");\n $(label).attr({\n \"class\": \"col-md-12\",\n \"for\": \"type\"\n });\n $(label).text(\"Tipo*\");\n $(group).append(label);\n\n div = document.createElement(\"div\");\n $(div).attr(\"class\", \"col-md-12\");\n\n input = document.createElement(\"input\");\n $(input).attr({\n \"type\": \"text\",\n \"name\": \"type\",\n \"id\": \"type\",\n \"class\": \"form-control\",\n \"placeholder\": \"transistores o valvulas\"\n });\n $(div).append(input);\n\n p = document.createElement(\"p\");\n $(p).attr(\"class\", \"col-md-12 error\");\n $(div).append(p);\n\n $(group).append(div);\n $(\"#imgNP\").parent().parent().before(group);\n break;\n }\n\n if (select.children.length == 0) { //Si el campo select está vacio cargamos las categorias\n var categories = StoreHouse.getInstance().categories;\n var category = categories.next();\n var objectCategory;\n\n while (category.done !== true) {\n objectCategory = category.value.category;\n $(select).append(\"<option value='\"+objectCategory.title+\"'>\"+objectCategory.title+\"</option>\");\n\n category = categories.next();\n }\n }\n $(\"#insertProduct\").find(\".btn-primary\").click(insertProduct); //Asignamos el evento onclick al boton guardar\n}", "addItems(categories) {\n this.items.push({\n [categories]: 1\n })\n //return this.items\n }", "[consts.CATEGORY_ADD](state, catObj) {\n let insCategoryObj = {\n id: catObj[\"id\"],\n pid: catObj[\"pid\"],\n dt: catObj[\"dt\"],\n idleaf: catObj[\"idleaf\"],\n kwrds: catObj[\"keyWords\"][\"keyWords\"],\n kwrdson: catObj[\"keyWords\"][\"keyWordsSelfOn\"],\n orderby: catObj[\"order\"][\"orderby\"],\n auto_numerate: catObj[\"order\"][\"autoNumerate\"],\n user_fields_on: catObj[\"userFields\"][\"userFieldsOn\"],\n uflds: catObj[\"uflds\"],\n num: parseInt(catObj[\"num\"]),\n chkd: false\n };\n for (let itm in catObj[\"names\"])\n insCategoryObj[\"name_\" + itm] = catObj[\"names\"][itm].name;\n\n //Categories add 1\n state.itemsCount++;\n\n //Set leaf id if it is root category\n if (catObj[\"pid\"] == -1) state.idLeaf = catObj[\"idleaf\"];\n\n Vue.set(state.list, state.list.length, insCategoryObj);\n }", "function formulario_enviar_logistica_categoria() {\n // crear icono de la categoria (si no existe) y luego guardar\n logistica_categoria_crear_icono();\n}", "async store({request, response}){\n const data = request.body;\n let cat = null;\n\n if(data.name.length && data.status)\n cat = await Categoria.create(data)\n\n return response.json({\"category\": cat})\n }", "function formCategorias(tipo){\n\t//Selecciona la zona debajo del menu horizontal de edicion y la oculta\n\tvar contenidoCentral = document.getElementById(\"contenidoCentral\");\n\tcontenidoCentral.setAttribute(\"class\",\"d-none\");\n\t//Selecciona la zona para poner los formularios\n\tvar contenidoFormularios = document.getElementById(\"contenidoFormularios\");\n\tcontenidoFormularios.setAttribute(\"class\",\"d-block\");\n\t//QUITA TODO EL CONTENIDO PREVIO POR SI HAY OTROS FORMULARIOS\n\twhile (contenidoFormularios.firstChild) {\n\t\tcontenidoFormularios.removeChild(contenidoFormularios.firstChild);\n\t}\n\n\tif (tipo == \"add\") {\n\t\t//Se limpia el array\n\t\twhile(arrayProducciones.length != 0){\n\t\t\tarrayProducciones.shift();\n\t\t}\n\t\tvar formulario = document.createElement(\"form\");\n\t\tformulario.setAttribute(\"name\",\"addCategory\");\n\t\tformulario.setAttribute(\"action\",\"\");\n\t\tformulario.setAttribute(\"onsubmit\",\"validarCategorias(); return false\");\n\t\tformulario.setAttribute(\"method\",\"post\");\n\t\tvar leyenda = document.createElement(\"legend\");\n\t\tleyenda.appendChild(document.createTextNode(\"Añadir categoria\"));\n\t\tvar grupo1 = document.createElement(\"div\");\n\t\tgrupo1.setAttribute(\"class\",\"form-group\");\n\t\tvar label1 = document.createElement(\"label\");\n\t\tlabel1.setAttribute(\"for\",\"nombreCat\");\n\t\tlabel1.appendChild(document.createTextNode(\"Nombre de la categoria\"));\n\t\tvar input1 = document.createElement(\"input\");\n\t\tinput1.setAttribute(\"type\",\"text\");\n\t\tinput1.setAttribute(\"class\",\"form-control\");\n\t\tinput1.setAttribute(\"id\",\"nombreCat\");\n\t\tinput1.setAttribute(\"onblur\",\"validarCampoTexto(this)\");\n\t\tinput1.setAttribute(\"placeholder\",\"Nombre de la categoria\");\n\t\tvar mal1 = document.createElement(\"small\");\n\t\tmal1.setAttribute(\"class\",\"form-text text-muted\");\n\t\tmal1.setAttribute(\"id\",\"nombreMal\");\n\t\tvar grupo2 = document.createElement(\"div\");\n\t\tgrupo2.setAttribute(\"class\",\"form-group\");\n\t\tvar label2 = document.createElement(\"label\");\n\t\tlabel2.setAttribute(\"for\",\"descripCat\");\n\t\tlabel2.appendChild(document.createTextNode(\"Descripcion de la categoria\"));\n\t\tvar input2 = document.createElement(\"input\");\n\t\tinput2.setAttribute(\"type\",\"text\");\n\t\tinput2.setAttribute(\"class\",\"form-control\");\n\t\tinput2.setAttribute(\"id\",\"descripCat\");\n\t\tinput2.setAttribute(\"onblur\",\"validarCampoTexto(this)\");\n\t\tinput2.setAttribute(\"placeholder\",\"Descripcion de la categoria\");\n\t\tvar mal2 = document.createElement(\"small\");\n\t\tmal2.setAttribute(\"id\",\"descMal\");\n\t\tmal2.setAttribute(\"class\",\"form-text text-muted\");\n\t\t//SE CREA EL BUSCADOR \n\t\tvar grupo3 = document.createElement(\"div\");\n\t\tgrupo3.setAttribute(\"class\",\"form-group\");\n\t\tvar label3 = document.createElement(\"label\");\n\t\tlabel3.setAttribute(\"for\",\"produccionesCat\");\n\t\tlabel3.appendChild(document.createTextNode(\"Asignar producciones a la nueva categoria\"));\n\t\tvar divInputBtn = document.createElement(\"div\");\n\t\tdivInputBtn.setAttribute(\"class\",\"input-group\");\n\t\tvar divBtn = document.createElement(\"div\");\n\t\tdivBtn.setAttribute(\"class\",\"input-group-prepend\");\n\t\tvar botonRemover = document.createElement(\"button\");\n\t\tbotonRemover.setAttribute(\"type\",\"button\");\n\t\tbotonRemover.setAttribute(\"class\",\"btn btn-sm btn-outline-secondary\");\n\t\tbotonRemover.appendChild(document.createTextNode(\"Remover\"));\n\t\t//añade el evento al hacer click al boton de remover\n\t\tbotonRemover.addEventListener(\"click\",function(){\n\t\t\tvar input = document.forms[\"addCategory\"][\"producciones\"];\n\t\t\t\t//Quita el ultimo elemento del array\n\t\t\t\tarrayProducciones.pop();\n\t\t\t\tinput.value = arrayProducciones.toString();\n\n\t\t});\n\t\tvar produc = document.createElement(\"input\");\n\t\tproduc.setAttribute(\"class\",\"form-control \");\n\t\tproduc.setAttribute(\"type\",\"text\");\n\t\tproduc.setAttribute(\"id\",\"producciones\");\n\t\tproduc.readOnly = true;\n\t\tvar malProduc = document.createElement(\"small\");\n\t\tmalProduc.setAttribute(\"class\",\"form-text text-muted\");\n\t\tmalProduc.setAttribute(\"id\",\"producMal\");\n\t\tvar buscador = document.createElement(\"input\");\n\t\tbuscador.setAttribute(\"class\",\"form-control my-3\");\n\t\tbuscador.setAttribute(\"type\",\"text\");\n\t\tbuscador.setAttribute(\"id\",\"buscador\");\n\t\tbuscador.setAttribute(\"placeholder\",\"Buscar...\");\n\t\t//SE CREA LA TABLA DE LAS PRODUCCIONES\n\t\tvar tabla = document.createElement(\"table\");\n\t\ttabla.setAttribute(\"class\",\"table table-bordered\");\n\t\ttabla.setAttribute(\"name\",\"produccion\");\n\t\ttabla.setAttribute(\"id\",\"produccion\");\n\t\tvar thead = document.createElement(\"thead\");\n\t\tvar tr = document.createElement(\"tr\");\n\t\tvar thVacio = document.createElement(\"th\");\n\t\tvar ocultar = document.createElement(\"button\");\n\t\tocultar.setAttribute(\"type\",\"button\");\n\t\tocultar.setAttribute(\"class\",\"btn btn-secondary\");\n\t\tocultar.appendChild(document.createTextNode(\"Mostrar/Ocultar\"));\n\t\tocultar.addEventListener(\"click\", function(){\n\t\t\tvar cont = document.getElementById(\"tablaProducciones\");\n\t\t\tif(cont.style.display==\"table-row-group\"){\n\t\t\t\tcont.style.display = \"none\";\n\t\t\t}else{\n\t\t\t\tcont.style.display = \"table-row-group\";\n\t\t\t}\n\t\t});\n\t\tthVacio.appendChild(ocultar);\n\t\tvar thNombre = document.createElement(\"th\");\n\t\tthNombre.appendChild(document.createTextNode(\"Nombre\"));\n\t\tvar thDesc = document.createElement(\"th\");\n\t\tthDesc.appendChild(document.createTextNode(\"Tipo\"));\n\t\tvar tbody = document.createElement(\"tbody\");\n\t\ttbody.setAttribute(\"id\",\"tablaProducciones\");\n\t\t//Abre la conexion con la base de datos categorias\n\t\tvar produccionesDB = indexedDB.open(nombreDB);\n\t\t//Si ha salido bien\n\t\tproduccionesDB.onsuccess = function(event) { \n\t\t\tvar db = event.target.result; \n\t\t\tvar objectStore = db.transaction([\"producciones\"],\"readonly\").objectStore(\"producciones\");\n\t\t\t//Abre un cursor para recorrer todos los objetos de la base de datos \n\t\t\tobjectStore.openCursor().onsuccess = function(event) {\n\t\t\t\tvar produccion = event.target.result;\n\t\t\t\t//Si el cursor devuelve un valor \n\t\t\t\tif (produccion) {\n\t\t\t\t\tvar trPro = document.createElement(\"tr\");\n\t\t\t\t\tvar tdAdd = document.createElement(\"td\");\n\t\t\t\t\tvar add = document.createElement(\"button\");\n\t\t\t\t\tadd.setAttribute(\"type\",\"button\");\n\t\t\t\t\tadd.setAttribute(\"class\",\"btn btn-danger\");\n\t\t\t\t\tadd.setAttribute(\"value\",produccion.value.title);\n\t\t\t\t\tadd.appendChild(document.createTextNode(\"Añadir\"));\n\t\t\t\t\tvar tdTitulo = document.createElement(\"td\");\n\t\t\t\t\ttdTitulo.appendChild(document.createTextNode(produccion.value.title));\n\t\t\t\t\tvar tdTipo = document.createElement(\"td\");\n\t\t\t\t\tvar nomTipo = \"\";\n\t\t\t\t\tif (produccion.value.tipo == \"Movie\") {\n\t\t\t\t\t\tnomTipo = \"Pelicula\";\n\t\t\t\t\t}else{\n\t\t\t\t\t\tnomTipo = \"Serie\";\n\t\t\t\t\t}\n\t\t\t\t\ttdTipo.appendChild(document.createTextNode(nomTipo));\n\t\t\t\t\ttdAdd.appendChild(add);\n\t\t\t\t\ttrPro.appendChild(tdAdd);\n\t\t\t\t\ttrPro.appendChild(tdTitulo);\n\t\t\t\t\ttrPro.appendChild(tdTipo);\n\t\t\t\t\ttbody.appendChild(trPro);\n\t\t\t\t\t//Añade una funcion a cada boton de añadir\n\t\t\t\t\tadd.addEventListener(\"click\", function(){\n\t\t\t\t\t\tvar input = document.forms[\"addCategory\"][\"producciones\"];\n\t\t\t\t\t\t//Añade al array el nomnbre de boton\n\t\t\t\t\t\tarrayProducciones.push(this.value);\n\t\t\t\t\t\tinput.value = arrayProducciones.toString();\n\t\t\t\t\t});\n\t\t\t\t\t//Pasa a la siguiente categoria\n\t\t\t\t\tproduccion.continue();\n\t\t\t\t}//Fin del if\n\t\t\t};//Fin de objectStore.openCursor().onsuccess\n\t\t};//Fin de request.onsuccess\n\t\tvar grupoBtn = document.createElement(\"div\");\n\t\tgrupoBtn.setAttribute(\"class\",\"form-group d-flex justify-content-around\");\n\t\tvar aceptar = document.createElement(\"button\");\n\t\taceptar.setAttribute(\"type\",\"submit\");\n\t\taceptar.setAttribute(\"class\",\"btn btn-primary \");\n\t\taceptar.appendChild(document.createTextNode(\"Guardar\"));\n\t\tvar cancelar = document.createElement(\"button\");\n\t\tcancelar.setAttribute(\"type\",\"button\");\n\t\tcancelar.setAttribute(\"class\",\"btn btn-primary\");\n\t\tcancelar.appendChild(document.createTextNode(\"Cancelar\"));\n\t\t\t\n\t\t//Añade eventos al hacer click sobre los botones del formulario creado\n\t\t$(document).ready(function(){\n\t\t\t$(\"#buscador\").on(\"keyup\", function() {\n\t\t\t var value = $(this).val().toLowerCase();\n\t\t\t $(\"#tablaProducciones tr\").filter(function() {\n\t\t\t\t$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)\n\t\t\t });\n\t\t\t});\n\t\t});\n\n\t\tcancelar.addEventListener(\"click\", showHomePage);\n\t\tcancelar.addEventListener(\"click\", function(){\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontenidoCentral.setAttribute(\"class\",\"d-block\");\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontenidoFormularios.setAttribute(\"class\",\"d-none\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t//Se limpia el array\n\t\t\t\t\t\t\t\t\t\t\t\t\twhile(arrayProducciones.length != 0){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayProducciones.shift();\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t//Crea el formulario\n\t\tgrupo1.appendChild(label1);\n\t\tgrupo1.appendChild(input1);\n\t\tgrupo1.appendChild(mal1);\n\t\tgrupo2.appendChild(label2);\n\t\tgrupo2.appendChild(input2);\n\t\tgrupo2.appendChild(mal2);\n\t\tgrupo3.appendChild(label3);\n\t\tdivInputBtn.appendChild(divBtn);\n\t\tdivBtn.appendChild(botonRemover);\n\t\tdivInputBtn.appendChild(produc);\n\t\tgrupo3.appendChild(divInputBtn);\n\t\tgrupo3.appendChild(malProduc);\n\t\tgrupo3.appendChild(buscador);\n\t\tgrupo3.appendChild(tabla);\n\t\ttabla.appendChild(thead);\n\t\ttabla.appendChild(tbody);\n\t\tthead.appendChild(tr);\n\t\ttr.appendChild(thVacio);\n\t\ttr.appendChild(thNombre);\n\t\ttr.appendChild(thDesc);\n\t\tgrupoBtn.appendChild(aceptar);\n\t\tgrupoBtn.appendChild(cancelar);\n\t\tformulario.appendChild(leyenda);\n\t\tformulario.appendChild(grupo1);\n\t\tformulario.appendChild(grupo2);\n\t\tformulario.appendChild(grupo3);\n\t\tformulario.appendChild(grupoBtn);\n\t\tcontenidoFormularios.appendChild(formulario);\n\t\t/* FIN DEL FORMULARIO DE AÑADIR CATEGORIA */\n\t}else if (tipo == \"delete\") {\n\t\tvar formulario = document.createElement(\"form\");\n\t\tformulario.setAttribute(\"name\",\"deleteCategory\");\n\t\tformulario.setAttribute(\"action\",\"\");\n\t\tformulario.setAttribute(\"onsubmit\",\"return false\");\n\t\tformulario.setAttribute(\"method\",\"post\");\n\t\tvar leyenda = document.createElement(\"legend\");\n\t\tvar grupo = document.createElement(\"div\");\n\t\tgrupo.setAttribute(\"class\",\"form-group\");\n\t\tleyenda.appendChild(document.createTextNode(\"Eliminar categoria\"));\n\t\t//SE CREA EL BUSCADOR \n\t\tvar buscador = document.createElement(\"input\");\n\t\tbuscador.setAttribute(\"class\",\"form-control mb-3\");\n\t\tbuscador.setAttribute(\"type\",\"text\");\n\t\tbuscador.setAttribute(\"id\",\"buscador\");\n\t\tbuscador.setAttribute(\"placeholder\",\"Buscar...\");\n\t\t//SE CREA LA TABLA DE LAS CATEGORIAS\n\t\tvar tabla = document.createElement(\"table\");\n\t\ttabla.setAttribute(\"class\",\"table table-bordered\");\n\t\ttabla.setAttribute(\"name\",\"categoria\");\n\t\ttabla.setAttribute(\"id\",\"categoria\");\n\t\tvar thead = document.createElement(\"thead\");\n\t\tvar tr = document.createElement(\"tr\");\n\t\tvar thVacio = document.createElement(\"th\");\n\t\tvar ocultar = document.createElement(\"button\");\n\t\tocultar.setAttribute(\"type\",\"button\");\n\t\tocultar.setAttribute(\"class\",\"btn btn-secondary\");\n\t\tocultar.appendChild(document.createTextNode(\"Mostrar/Ocultar\"));\n\t\tocultar.addEventListener(\"click\", function(){\n\t\t\tvar cont = document.getElementById(\"tablaCategorias\");\n\t\t\tif(cont.style.display==\"table-row-group\"){\n\t\t\t\tcont.style.display = \"none\";\n\t\t\t}else{\n\t\t\t\tcont.style.display = \"table-row-group\";\n\t\t\t}\n\t\t});\n\t\tthVacio.appendChild(ocultar);\n\t\tvar thNombre = document.createElement(\"th\");\n\t\tthNombre.appendChild(document.createTextNode(\"Nombre\"));\n\t\tvar thDesc = document.createElement(\"th\");\n\t\tthDesc.appendChild(document.createTextNode(\"Descripcion\"));\n\t\tvar tbody = document.createElement(\"tbody\");\n\t\ttbody.setAttribute(\"id\",\"tablaCategorias\");\n\t\t//Abre la conexion con la base de datos categorias\n\t\tvar categoriasDB = indexedDB.open(nombreDB);\n\t\t//Si ha salido bien\n\t\tcategoriasDB.onsuccess = function(event) { \n\t\t\tvar db = event.target.result; \n\t\t\tvar objectStore = db.transaction([\"categorias\"],\"readonly\").objectStore(\"categorias\");\n\t\t\t//Abre un cursor para recorrer todos los objetos de la base de datos \n\t\t\tobjectStore.openCursor().onsuccess = function(event) {\n\t\t\t\tvar categoria = event.target.result;\n\t\t\t\t//Si el cursor devuelve un valor \n\t\t\t\tif (categoria) {\n\t\t\t\t\tvar trCat = document.createElement(\"tr\");\n\t\t\t\t\tvar tdEliminar = document.createElement(\"td\");\n\t\t\t\t\tvar eliminar = document.createElement(\"button\");\n\t\t\t\t\teliminar.setAttribute(\"type\",\"button\");\n\t\t\t\t\teliminar.setAttribute(\"class\",\"btn btn-danger\");\n\t\t\t\t\teliminar.setAttribute(\"value\",categoria.value.name);\n\t\t\t\t\teliminar.appendChild(document.createTextNode(\"Eliminar\"));\n\t\t\t\t\teliminar.addEventListener(\"click\", deleteCategory);\n\t\t\t\t\tvar tdCat = document.createElement(\"td\");\n\t\t\t\t\ttdCat.appendChild(document.createTextNode(categoria.value.name));\n\t\t\t\t\tvar tdDesc = document.createElement(\"td\");\n\t\t\t\t\ttdDesc.appendChild(document.createTextNode(categoria.value.description));\n\t\t\t\t\ttdEliminar.appendChild(eliminar);\n\t\t\t\t\ttrCat.appendChild(tdEliminar);\n\t\t\t\t\ttrCat.appendChild(tdCat);\n\t\t\t\t\ttrCat.appendChild(tdDesc);\n\t\t\t\t\ttbody.appendChild(trCat);\n\t\t\t\t\t//Pasa a la siguiente categoria\n\t\t\t\t\tcategoria.continue();\n\t\t\t\t}//Fin del if\n\t\t\t};//Fin de objectStore.openCursor().onsuccess\n\t\t};//Fin de request.onsuccess\n\t\tvar grupoBtn = document.createElement(\"div\");\n\t\tgrupoBtn.setAttribute(\"class\",\"form-group d-flex justify-content-around\");\n\t\tvar cancelar = document.createElement(\"button\");\n\t\tcancelar.setAttribute(\"type\",\"button\");\n\t\tcancelar.setAttribute(\"class\",\"btn btn-primary\");\n\t\tcancelar.appendChild(document.createTextNode(\"Cancelar\"));\n\t\t//Añade eventos al hacer click sobre los botones del formulario creado y el buscador\n\t\t$(document).ready(function(){\n\t\t\t$(\"#buscador\").on(\"keyup\", function() {\n\t\t\t var value = $(this).val().toLowerCase();\n\t\t\t $(\"#tablaCategorias tr\").filter(function() {\n\t\t\t\t$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)\n\t\t\t });\n\t\t\t});\n\t\t});\n\t\tcancelar.addEventListener(\"click\", showHomePage);\n\t\tcancelar.addEventListener(\"click\", function(){\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontenidoCentral.setAttribute(\"class\",\"d-block\");\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontenidoFormularios.setAttribute(\"class\",\"d-none\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\n\t\t//se crea el formulario de borrado\n\t\tformulario.appendChild(leyenda);\n\t\tgrupo.appendChild(buscador);\n\t\tgrupo.appendChild(tabla);\n\t\tformulario.appendChild(grupo);\n\t\ttabla.appendChild(thead);\n\t\ttabla.appendChild(tbody);\n\t\tthead.appendChild(tr);\n\t\ttr.appendChild(thVacio);\n\t\ttr.appendChild(thNombre);\n\t\ttr.appendChild(thDesc);\n\t\tgrupoBtn.appendChild(cancelar);\n\t\tformulario.appendChild(grupoBtn);\n\t\tcontenidoFormularios.appendChild(formulario);\n\t}else if (tipo == \"update\") {\n\t\tvar formulario = document.createElement(\"form\");\n\t\tformulario.setAttribute(\"name\",\"modCategory\");\n\t\tformulario.setAttribute(\"action\",\"\");\n\t\tformulario.setAttribute(\"onsubmit\",\"return false\");\n\t\tformulario.setAttribute(\"method\",\"post\");\n\t\tvar leyenda = document.createElement(\"legend\");\n\t\tleyenda.appendChild(document.createTextNode(\"Modificar categoria\"));\n\t\t//SE CREA EL BUSCADOR \n\t\tvar divModificar = document.createElement(\"div\");\n\t\tdivModificar.setAttribute(\"id\",\"divModificar\");\n\t\tvar grupo1 = document.createElement(\"div\");\n\t\tgrupo1.setAttribute(\"class\",\"form-group mt-3\");\n\t\tvar label1 = document.createElement(\"label\");\n\t\tlabel1.setAttribute(\"for\",\"produccionesCat\");\n\t\tlabel1.appendChild(document.createTextNode(\"Selecciona una categoria\"));\n\t\tvar divInputBtn = document.createElement(\"div\");\n\t\tdivInputBtn.setAttribute(\"class\",\"input-group\");\n\t\tvar divBtn = document.createElement(\"div\");\n\t\tdivBtn.setAttribute(\"class\",\"input-group-prepend\");\n\t\tvar botonRemover = document.createElement(\"button\");\n\t\tbotonRemover.setAttribute(\"type\",\"button\");\n\t\tbotonRemover.setAttribute(\"class\",\"btn btn-sm btn-outline-secondary\");\n\t\tbotonRemover.appendChild(document.createTextNode(\"Remover\"));\n\t\t//añade el evento al hacer click al boton de remover\n\t\tbotonRemover.addEventListener(\"click\",function(){\n\t\t\tvar input = document.forms[\"modCategory\"][\"categoria\"];\n\t\t\t\tinput.value = \"\";\n\t\t\t\t//muestra la tabla\n\t\t\t\tdocument.getElementById(\"divTabla\").style.display = \"block\";\n\t\t\t\t//oculta los campos de la categoria para modificar\n\t\t\t\tdivModificar.removeChild(divModificar.firstChild);\n\t\t});\n\t\tvar inputCat = document.createElement(\"input\");\n\t\tinputCat.setAttribute(\"class\",\"form-control \");\n\t\tinputCat.setAttribute(\"type\",\"text\");\n\t\tinputCat.setAttribute(\"id\",\"categoria\");\n\t\tinputCat.readOnly = true;\n\t\tvar divTabla = document.createElement(\"div\");\n\t\tdivTabla.setAttribute(\"id\",\"divTabla\");\n\t\tvar buscador = document.createElement(\"input\");\n\t\tbuscador.setAttribute(\"class\",\"form-control my-3\");\n\t\tbuscador.setAttribute(\"type\",\"text\");\n\t\tbuscador.setAttribute(\"id\",\"buscador\");\n\t\tbuscador.setAttribute(\"placeholder\",\"Buscar...\");\n\t\t//SE CREA LA TABLA DE LAS CATEGORIAS\n\t\tvar tabla = document.createElement(\"table\");\n\t\ttabla.setAttribute(\"class\",\"table table-bordered\");\n\t\ttabla.setAttribute(\"name\",\"tablaCategorias\");\n\t\ttabla.setAttribute(\"id\",\"tablaCategorias\");\n\t\tvar thead = document.createElement(\"thead\");\n\t\tvar tr = document.createElement(\"tr\");\n\t\tvar thVacio = document.createElement(\"th\");\n\t\tvar ocultar = document.createElement(\"button\");\n\t\tocultar.setAttribute(\"type\",\"button\");\n\t\tocultar.setAttribute(\"class\",\"btn btn-secondary\");\n\t\tocultar.appendChild(document.createTextNode(\"Mostrar/Ocultar\"));\n\t\tocultar.addEventListener(\"click\", function(){\n\t\t\tvar cont = document.getElementById(\"tablaBody\");\n\t\t\tif(cont.style.display==\"table-row-group\"){\n\t\t\t\tcont.style.display = \"none\";\n\t\t\t}else{\n\t\t\t\tcont.style.display = \"table-row-group\";\n\t\t\t}\n\t\t});\n\t\tthVacio.appendChild(ocultar);\n\t\tvar thNombre = document.createElement(\"th\");\n\t\tthNombre.appendChild(document.createTextNode(\"Nombre completo\"));\n\t\tvar tbody = document.createElement(\"tbody\");\n\t\ttbody.setAttribute(\"id\",\"tablaBody\");\n\t\t//Abre la conexion con la base de datos categorias\n\t\tvar categoriasDB = indexedDB.open(nombreDB);\n\t\t//Si ha salido bien\n\t\tcategoriasDB.onsuccess = function(event) { \n\t\t\tvar db = event.target.result; \n\t\t\tvar objectStore = db.transaction([\"categorias\"],\"readonly\").objectStore(\"categorias\");\n\t\t\t//Abre un cursor para recorrer todos los objetos de la base de datos \n\t\t\tobjectStore.openCursor().onsuccess = function(event) {\n\t\t\t\tvar categoria = event.target.result;\n\t\t\t\t//Si el cursor devuelve un valor \n\t\t\t\tif (categoria) {\n\t\t\t\t\tvar trCat = document.createElement(\"tr\");\n\t\t\t\t\tvar tdAdd = document.createElement(\"td\");\n\t\t\t\t\tvar add = document.createElement(\"button\");\n\t\t\t\t\tadd.setAttribute(\"type\",\"button\");\n\t\t\t\t\tadd.setAttribute(\"class\",\"btn btn-danger\");\n\t\t\t\t\tadd.setAttribute(\"value\",categoria.value.name);\n\t\t\t\t\tadd.appendChild(document.createTextNode(\"Modificar\"));\n\t\t\t\t\tvar tdNombre = document.createElement(\"td\");\n\t\t\t\t\ttdNombre.appendChild(document.createTextNode(categoria.value.name));\n\t\t\t\t\ttdNombre.setAttribute(\"class\",\"col-8\");\n\t\t\t\t\ttdAdd.appendChild(add);\n\t\t\t\t\ttrCat.appendChild(tdAdd);\n\t\t\t\t\ttrCat.appendChild(tdNombre);\n\t\t\t\t\ttbody.appendChild(trCat);\n\t\t\t\t\t//Añade una funcion a cada boton de añadir\n\t\t\t\t\tadd.addEventListener(\"click\", function(){\n\t\t\t\t\t\tvar input = document.forms[\"modCategory\"][\"categoria\"];\n\t\t\t\t\t\tinput.value = this.value;\n\t\t\t\t\t\t//oculta la tabla\n\t\t\t\t\t\tdocument.getElementById(\"divTabla\").style.display = \"none\";\n\t\t\t\t\t\t//muestra los campos de la categoria para modificar\n\t\t\t\t\t\tmodifyCategory(this.value);\n\t\t\t\t\t});\n\t\t\t\t\t//Pasa a la siguiente categoria\n\t\t\t\t\tcategoria.continue();\n\t\t\t\t}//Fin del if\n\t\t\t};//Fin de objectStore.openCursor().onsuccess\n\t\t};//Fin de request.onsuccess\n\t\t//Añade los eventos de la tabla\n\t\t$(document).ready(function(){\n\t\t\t$(\"#buscador\").on(\"keyup\", function() {\n\t\t\t var value = $(this).val().toLowerCase();\n\t\t\t $(\"#tablaCategorias tr\").filter(function() {\n\t\t\t\t$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)\n\t\t\t });\n\t\t\t});\n\t\t});\n\t\tgrupo1.appendChild(label1);\n\t\tdivInputBtn.appendChild(divBtn);\n\t\tdivBtn.appendChild(botonRemover);\n\t\tdivInputBtn.appendChild(inputCat);\n\t\tgrupo1.appendChild(divInputBtn);\n\t\tdivTabla.appendChild(buscador);\n\t\tdivTabla.appendChild(tabla);\n\t\tgrupo1.appendChild(divTabla);\n\t\ttabla.appendChild(thead);\n\t\ttabla.appendChild(tbody);\n\t\tthead.appendChild(tr);\n\t\ttr.appendChild(thVacio);\n\t\ttr.appendChild(thNombre);\n\t\tformulario.appendChild(grupo1);\n\t\tformulario.appendChild(divModificar);\n\t\tcontenidoFormularios.appendChild(formulario);\n\t}//Fin de los if\n}//Fin de formCategorias", "function showCategorie2(dd) {\n var i = 0;\n $(\".promohtml\").html(\"\");\n //append the articles by categories\n for (index = 0; index < promoArticle.length; index++) {\n if (promoArticle[index].idcategorie == dd.id) {\n $(\".promohtml\").append(\n \"<li class='span3'>\" +\n \" <div class='thumbnail'>\" +\n \" <a href='product_details.php?id=\" +\n promoArticle[index].reference +\n \"'><img style='height:100px' src='AdminLogin/images/\" +\n promoArticle[index].imageArt +\n \"' alt='' /></a>\" +\n \" <div class='caption'><h5>\" +\n promoArticle[index].designation +\n \"</h5>\" +\n \" <h4 style='text-align:center'><a class='btn zoom' id='\" +\n promoArticle[index].reference +\n \"' href='product_details.php?id=\" +\n promoArticle[index].reference +\n \"'> <i\" +\n \" class='icon-zoom-in'></i></a> <a class='btn' onclick='addTocart(this,\" +\n promoArticle[index].Nouveauxprix +\n \")' id='\" +\n promoArticle[index].reference +\n \"'><span class='languageAddTo'>Add to</span> <i class='icon-shopping-cart'></i></a>\" +\n \"<br><button class='btn btn-warning' disabled id='\" +\n promoArticle[index].reference +\n \"' >DH \" +\n promoArticle[index].Nouveauxprix +\n \"</button></h4></div></div></li>\"\n );\n i = i + 1;\n }\n }\n //message if there's no article in the selected categorie\n if (i == 0) {\n $(\".promohtml\").append(\n \"<div class='alert alert-danger languageNoItemToDisplay' role='alert'>\" +\n \"No Items To Display! </div>\"\n );\n }\n changeLanguage();\n}", "function User_Insert_Types_d_attribut_Catégories_2(Compo_Maitre)\n{\n\n/*\n***** INFOS ******\n\nNbr d'esclaves = 2\n\nId dans le tab: 33;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\nId dans le tab: 34;\nsimple\nNbr Jointure: PAS DE JOINTURE;\n\n******************\n*/\n\n var Table=\"categorie\";\n var CleMaitre = TAB_COMPO_PPTES[31].NewCle;\n var NomCleMaitre = DePrefixerChamp(Compo_Maitre.getCle());\n /* COMPOSANT LISTE AVEC JOINTURE SIMPLE */\n var cr_libelle=GetValAt(33);\n if (!ValiderChampsObligatoire(Table,\"cr_libelle\",TAB_GLOBAL_COMPO[33],cr_libelle,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"cr_libelle\",TAB_GLOBAL_COMPO[33],cr_libelle))\n \treturn -1;\n var cr_description=GetValAt(34);\n if (!ValiderChampsObligatoire(Table,\"cr_description\",TAB_GLOBAL_COMPO[34],cr_description,false))\n \treturn -1;\n if (!ValiderChampsType(Table,\"cr_description\",TAB_GLOBAL_COMPO[34],cr_description))\n \treturn -1;\n var Req=\"insert into \"+Table+\" \";\nvar TabInsertionEnPlus=new Array();\n Req+=\"(\"+NomCleMaitre+\",ta_numero,cr_libelle,cr_description\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[0]:\"\")+\")\";\n Req+=\" values (\"+CleMaitre+\",\"+TAB_COMPO_PPTES[28].NewCle+\",\"+(cr_libelle==\"\" ? \"null\" : \"'\"+ValiderChaine(cr_libelle)+\"'\" )+\",\"+(cr_description==\"\" ? \"null\" : \"'\"+ValiderChaine(cr_description)+\"'\" )+\"\"+(TabInsertionEnPlus.length!=0?\",\"+TabInsertionEnPlus[1]:\"\")+\")\";\n\n if (pgsql_update(Req)==0)\n\talert(\"Echec lors de l'insertion\");\nreturn CleMaitre;\n\n}", "function addProductToCart(index) {\n\tvar row = document.createElement('tr');\n\n\tfor(var item in appData.selectedItems[index]) {\n\t\tvar column = document.createElement('td');\n\t\tcolumn.setAttribute('class', item);\n\t\t\n\t\tvar columnText;\n\t\tif(item !== 'quantity') {\n\t\t\tcolumnText = document.createTextNode(appData.selectedItems[index][item]);\n\t\t} else {\n\t\t\tvar columnText = document.createElement('div');\n\t\t\tcolumnText.innerHTML = '<input onkeyup=\"changeQuantityByTyping(event, this, '+index+')\" class=\"input-quantity\" type=\"text\" name=\"quantity\" value=\"'+appData.selectedItems[index][item]+'\">'+\n\t\t\t\t'<span class=\"operator\"><span class=\"incrementer\">+</span>'+\n\t\t\t\t'<span class=\"decrementer\">-</span></span';\n\t\t}\n\t\trow.appendChild(column).appendChild(columnText);\n\t}\n\tvar column = document.createElement('td');\n\tvar image = document.createElement('img');\n\timage.setAttribute('src', 'bin.png');\n\timage.setAttribute('class', 'remove-btn');\n\trow.appendChild(column).appendChild(image);\n\tdocument.getElementById('selectedItems').appendChild(row);\n}", "function addProduct(){\n var returnedItem = chooseProduct(this);\n for(var i = 0; i < bowlarray.length; i++){\n if(bowlarray[i]._id === returnedItem._id){\n $(DOMvariables.alertheader).text(\"Выбранный вами продукт уже есть в миске\");\n return;\n }\n }\n $(DOMvariables.alertheader).text(defaulttext);\n bowlarray.push(returnedItem);\n $(DOMvariables.bowlcolumn).render({bowllist: bowlarray}, bowlRender);\n $(\"#bowlcolumn\").find(\"header\").text(\"Итог: \" + sum + \" кал.\");\n }", "function saveEquips() {\r\n\tvar cat = catList[$(\"#cat-id\").val()];\r\n\tvar equips = [\"tool\", \"head\", \"body\", \"arms\", \"legs\", \"feet\", \"other\"];\r\n\tfor (var i=0;i<7;i++) {\r\n\t\tvar type = equips[i];\r\n\t\tvar item = $(\"#sel-\"+type).val();\r\n\t\tcat[type]= item; //save selected item to cat\r\n\t\tif (type==\"tool\" && item!=\"none\") {\r\n\t\t\ttoolList[item][1]++; //incease \"equipped\" number\r\n\t\t}\r\n\t\telse if (item !=\"none\") {\r\n\t\t\tequipmentList[item][1]++; //incease \"equipped\" number\r\n\t\t}\r\n\t\t\r\n\t}\r\n\tcat[\"atk\"] = parseInt($(\"#temp-atk\").text());\r\n\tcat[\"def\"] = parseInt($(\"#temp-def\").text());\r\n\tcat[\"name\"] = $(\"#catName\").val();\r\n\tloadCatList(\"all\");\r\n\tfillCatDropdown();\r\n}", "function addToCart(dishId, quantity = 1) {\n const menues = JSON.parse(data);\n\n let selectedDish = menues.find(x => x.id == dishId);\n\n console.log(\"selected Dish:\", selectedDish);\n\n //Is it already in cart\n //then increase the quantity then update the cart\n if (cart.length > 0) {\n let cartSelectedDish = cart.find(x => x.id == dishId);\n if (cartSelectedDish != undefined) {\n quantity = cartSelectedDish.quantity + quantity;\n cart = cart.filter(x => x.id != dishId);\n }\n }\n var cartItem = new CartItem(selectedDish.id, selectedDish.name,\n selectedDish.price, quantity, selectedDish.price * quantity);\n\n cart.push(cartItem);\n console.log(\"My Cart\", cart);\n\n saveCartInSession(cart);\n}", "function addCart(nome, valor, info){\n let list = {\n nome: nome,\n valor: valor,\n informacao: info\n };\n setPedido(oldArray => [...oldArray, list])\n setAcao(!acao)\n //await AsyncStorage.setItem('@pedido', JSON.stringify(pedido));\n }", "function addConeToCart(e) {\n var variation=\"\";\n var mods=[];\n document.querySelectorAll(`#config.cone-builder .cb-options .selected`).forEach((e, i) => {\n if (!i) {\n variation=e.getAttribute('data-id');\n } else {\n if (e.getAttribute('data-id')) mods.push(e.getAttribute('data-id'));\n }\n })\n \n document.getElementById('cone-builder').classList.add('flyout');\n hideConfig();\n cart.add(variation, mods)\n updateCart();\n}", "function addToCart(id){\n var res = id.split(\"-\");\n $.ajax({\n url: \"categories.json\",\n dataType: \"json\",\n success: function(data) {\n var prodTitle = data[res[0]].products[res[1]].title\n var prodPrice = data[res[0]].products[res[1]].price\n // alert(prodTitle + \" has been added to the cart with price: \"+prodPrice)\n var cart = JSON.parse(localStorage.getItem('cart'));\n cart.push(data[res[0]].products[res[1]]);\n localStorage.setItem('cart',JSON.stringify(cart));\n updateCartIcon();\n }\n });\n}", "function quanitityToCart(product) {\n let value = parseInt($(\"#amountOfBeer\").val());\n let isProductInCart = 0;\n for (let i = 0; i < cart.length; i++) {\n if (product.id === cart[i].id) {\n cart[i].inCart += value;\n isProductInCart++;\n }\n }\n if (isProductInCart == 0) {\n product.inCart = value;\n cart.push(product);\n }\n saveToLS();\n renderCart();\n}", "function preencherCategoria ( dados ) {\n $(\"#msg\").html(\"\");\n $(\".split\").prepend(\"<div class='navbar-dark text-center bg-dark p-4'><a href='index.html' class='btn btn-primary'>Início</a><a href='#'' class='btn btn-danger'>Sair</a></div>\");\n $.each( dados, function ( key, val ) {\n $(\".navbar-nav\").prepend(\"<li><a class='text-light' style='font-size: 15px;' href='categorias.html?id=\"+val.catcodigo+\"'>\"+val.catdescricao+\"</a></li>\");\n })\n }", "function addProductCart(product_id) {\n\n $.ajax({\n url: super_path + '/select2cart',\n method: 'GET',\n data: { 'product_id' : product_id },\n success: function(data) {\n console.log(data)\n },\n error: function(err) {\n\n }\n })\n var defaultIngredients = preCartItem.ingredients;\n $( \".ingredientsCheck\" ).each(function(index) {\n if (!$(this).is(':checked')) {\n for(var i=0;i < defaultIngredients.length; i++){\n if(defaultIngredients[i].id == $(this).val()){\n defaultIngredients.splice(i,1);\n }\n }\n }\n });\n preCartItem.ingredients = defaultIngredients;\n populateProductCart(preCartItem);\n}", "function insertCartPurchase(product,cart,index){\r\n\tlet id = cart._id;\r\n\t$('#divCartProduct').append('<div class=\"product\" id=\"cartProduct' + id + '\"></div>');\t\r\n\t$('#cartProduct'+id).append('<img alt=\"Foto do Produto\" class=\"postImage\" src=\"' + product.obj.picture + '\">');\r\n\t$('#cartProduct'+id).append('<h3>' + product.obj.name + '</h3>');\r\n\t$('#cartProduct'+id).append('<h3>' + 'R$' + product.obj.price + '</h3>');\r\n\t$('#cartProduct'+id).append('<input class=\"inputStyle1 removeProduct\" onclick=\"remove('+id+');\" type=\"submit\" value=\"Remover produto\">');\r\n\t$('#cartProduct'+id).append('<input class=\"inputStyle2\" type=\"text\" id=\"text'+id+'\" value=\"'+ cart.obj.qtd + '\">');\r\n\t$('#cartProduct'+id).append('<input class=\"inputStyle1 addProduct\" onclick=\"changeAmountLess('+id+');\" type=\"submit\" value=\"<\">');\r\n\t$('#cartProduct'+id).append('<input class=\"inputStyle1 addProduct\" onclick=\"changeAmountMore('+id+');\" type=\"submit\" value=\">\">');\r\n}", "function addCategory(data) {\n console.log(` Adding category: ${data.name}`);\n Categories.insert(data);\n}", "function addItemToCart() {}", "function addItemToCart() {}", "function addCart() {\n\n let sameItems = stylishStorage.cart.list.filter( el => \n el.id === details_product_id.textContent &&\n el.color.code === currentColor && \n el.size === currentSize); \n\n if (sameItems.length > 0){\n stylishStorage.cart.list.forEach( item => {\n if ( item.id === details_product_id.textContent &&\n item.color.code === currentColor &&\n item.size === currentSize ){\n item.qty = quantity_count_value.textContent;\n }\n })\n \n }else{\n newItem ={\n id: details_product_id.textContent,\n name: details_product_name.textContent,\n main_image: main_img,\n price: product_price,\n color: {\n name: currentColorName,\n code: currentColor\n },\n size: currentSize,\n qty: quantity_count_value.textContent,\n stock: stock_qty\n }\n\n stylishStorage.cart.list.push(newItem);\n }\n\n localStorage.setItem('cart', JSON.stringify(stylishStorage.cart));\n}", "function addSelectedItemToCart() {\n // TODO: suss out the item picked from the select list\n // TODO: get the quantity\n // TODO: using those, add one item to the Cart\n var suss = document.getElementById('cartContents');\n var print = document.createElement('p');\n suss.appendChild(print);\n var selectedItem = document.getElementById('items');\n var quantityItem = document.getElementById('quantity');\n print.textContent= `${quantityItem.value} quantities of ${selectedItem.value}`;\n var x =new cart(selectedItem.value,quantityItem.value);\n counter++;\n console.log(counter);\n var setLocalStorage = JSON.stringify(cartArray);\n localStorage.setItem('cartItems', setLocalStorage);\n \n}", "function addToCart(prod_id) {\n console.log(products.data);\n let product = products.find((item) => {\n return item.prod_id == prod_id;\n });\n \n cart.push(product);\n \n localStorage.setItem(\"cart\", JSON.stringify(cart));\n renderCart(storedCartitems);\n \n console.log(prod_id);\n \n \n}", "addToCart(itemOptions) {\n this.store.cart.products.push({\n product_id: itemOptions.item,\n price: itemOptions.price || 0,\n total: itemOptions.price || 0,\n quantity: itemOptions.quantity || 1,\n offer: itemOptions.offer || null,\n materials: itemOptions.config ? itemOptions.config.split(',') : [],\n description: \"\",\n comment: itemOptions.comment\n });\n }", "function addCart(id_articulo) {\n let arr_tmp = [];\n\n /**** ALMACENAR EN UN ARREGLO LOS DATOS QUE TENEMOS EN EL localStorage ****/\n if(in_storage) {\n arr_tmp.push(JSON.parse(localStorage.getItem(\"articulo\")));\n }\n\n /* CON EL METODO find DEL ARREGLO BUSCAMOS EL ARTICULO, ESTE METODO RECIBE COMO PARAMETRO UNA FUNCION,\n EN ESTE CASO LE ESTAMOS PASANDO UNA FUNCION DE FLECHA Y LE PASMOS UN PARAMETRO (id_find)\n ESTE METODO GUARDARA EN FORMATO JSON LOS DATOS ENCONTRADOS EN LA CONSTANTE resultado, ESTA BUSQUEDA\n SE HARA MEDIANTE EL ID (VARIABLE id_articulo), EN CASO DE QUE EL ID QUE BUSQUEMOS NO EXISTA NOS REGRESARÁ\n EL VALOR DE undefined */\n const resultado = articulos.find(id_find => id_find.id == id_articulo );\n\n /**** ANTES DE AGREGAR AL ARREGLO EL CONTENIDO DE LA CONSTANT resultado USA UN IF PARA COMPROBAR\n QUE ESTA NO SEA undefined ****/\n arr_tmp.push(resultado);\n\n localStorage.setItem(\"articulo\", JSON.stringify(arr_tmp));\n}", "function addNewCateg(){\n\tvar addCategText = document.getElementById('NewCathegoryField').value;\n\tcateg.categName[addCategText]= [];\n\tconsole.log(\"categ.categName + \" + Object.getOwnPropertyNames(categ.categName));\n\n\tvar addToOptionList=document.getElementById('cathegoryOption');\n\tvar option = document.createElement('option');\n\toption.text=addCategText;\n\taddToOptionList.add(option);\n\t\n\t//categ.categName.asd.push('Kaan');\n\t\n}", "afegirCistella(id, quant, preu, decimalsPreu, decimalsPreuSenseIva, descripcio, desc, codi,imatge, ivaId, preuCataleg, preuSenseIvaCataleg, preuSenseIva ) {\n\n\n if (localStorage.getItem(\"productesCart\") === null) {\n const productes = [{\"codi\" : id, \"unitats\" : quant, \"preu\" : preu, \"decimalsPreuCataleg\" : decimalsPreu, \"decimalsPreuSenseIva\" : decimalsPreuSenseIva , \"descripcio\": descripcio,\"descripcioCurta\" : desc , \"id\" : codi , \"imatge\" : imatge , \"ivaId\" : ivaId, \"preuCataleg\" : preuCataleg , \"preuSenseIvaCataleg\" : preuSenseIvaCataleg, \"preuSenseIva\" : preuSenseIva}];\n localStorage.setItem(\"productesCart\", JSON.stringify(productes));\n } else {\n\n const productesCart = JSON.parse(localStorage.getItem(\"productesCart\"));\n const trobat = this.trobarArticleCart(productesCart, id);\n\n if (trobat >= 0) {\n productesCart[trobat][\"unitats\"] += quant;\n\n } else {\n productesCart.push({\"codi\" : id, \"unitats\" : quant, \"preu\" : preu, \"decimalsPreuCataleg\" : decimalsPreu, \"decimalsPreuSenseIva\" : decimalsPreuSenseIva , \"descripcio\": descripcio,\"descripcioCurta\" : desc , \"id\" : codi , \"imatge\" : imatge , \"ivaId\" : ivaId, \"preuCataleg\" : preuCataleg , \"preuSenseIvaCataleg\" : preuSenseIvaCataleg, \"preuSenseIva\" : preuSenseIva});\n\n }\n\n localStorage.setItem(\"productesCart\", JSON.stringify(productesCart));\n \n }\n\n const contador = this.contarArticles();\n this.setState({ carritoCount: contador })\n localStorage.setItem(\"count\", contador);\n this.calcularTotal();\n\n\n }", "function addBasket(data) {\n cameraButton.addEventListener('click', () => {\n //Création du panier dans le localStorage s'il n'existe pas déjà\n if (typeof localStorage.getItem(\"basket\") !== \"string\") {\n let basket = [];\n localStorage.setItem(\"basket\", JSON.stringify(basket));\n }\n //récupération des info du produit\n let produit = {\n 'image' : data.imageUrl,\n 'id' : data._id,\n 'name' : data.name,\n 'lense' : document.querySelector(\"option:checked\").innerText,\n 'price' : data.price,\n 'description' : data.description,\n 'quantity' : cameraQuantity.value,\n }\n console.log(produit);\n //création d'une variable pour manipuler le panier\n let basket = JSON.parse(localStorage.getItem(\"basket\"));\n //Vérification que l'item n'existe pas déjà dans le panier\n let isThisItemExist = false;\n let existingItem;\n for (let i = 0; i < basket.length; i++) {\n if (produit.id === basket[i].id && produit.lense === basket[i].lense) {\n isThisItemExist = true;\n existingItem = basket[i];\n }\n }\n //Ajouter la caméra au panier\n if (isThisItemExist === false) {\n basket.push(produit);\n localStorage.setItem(\"basket\", JSON.stringify(basket));\n alert(\"Votre article à bien été mis au panier\")\n } else {\n existingItem.quantity = parseInt(existingItem.quantity, 10) + parseInt(produit.quantity, 10);\n localStorage.setItem(\"basket\", JSON.stringify(basket));\n alert(\"La quantité du produit à bien été mise à jour\")\n }\n displayBasket();\n })\n}", "function addtoCart(id,price,name){\r\r\r\r\r\r\n ///obtememos la cantidad a agregar al carrito\r\r\r\r\r\r\n var cantidad = $(\"#eitem\"+id).val();\r\r\r\r\r\r\n console.log(cantidad);\r\r\r\r\r\r\n if(cantidad>0){\r\r\r\r\r\r\n $.post('/officium/web/ecar/addToCart',\r\r\r\r\r\r\n {\r\r\r\r\r\r\n 'id_producto':id,////id del producto\r\r\r\r\r\r\n 'cantidad':cantidad,/// cantidad\r\r\r\r\r\r\n 'price':price,\r\r\r\r\r\r\n 'name':name\r\r\r\r\r\r\n },\r\r\r\r\r\r\n function(result){ ////verificamos el resultado\r\r\r\r\r\r\n if(result>0){\r\r\r\r\r\r\n ////recontamos los productos en el carrito de compras\r\r\r\r\r\r\n console.log('Item agregado al carrito');\r\r\r\r\r\r\n ////cambiamos la cantidad de productos en el carrito\r\r\r\r\r\r\n ecarCount();\r\r\r\r\r\n floatcarDisplay();\r\r\r\r\r\r\n }else{\r\r\r\r\r\r\n alert('Error al agregar el producto. Contacte a su asesor de ventas'+result);\r\r\r\r\r\r\n }\r\r\r\r\r\r\n });\r\r\r\r\r\r\n }\r\r\r\r\r\r\n}///end of function", "function showCat() {\n categories.forEach(elements => {\n\n elements.onclick = function () {\n\n document.querySelector('.row').innerHTML = '';\n\n // on filtre le tableau entier pour ne garder que la catégorie 'starters'\n productsCat = products.filter(property => property.category == elements.id);\n\n // on boucle sur le nouveau tableau pour afficher le contenu\n productsCat.forEach(item => {\n\n // on récupère l'id la card\n // et on la stocke dans une variable\n let colCard = document.querySelector('#colCard');\n\n // on clone la card\n let colCardClone = colCard.cloneNode(true);\n\n // on incrémente les ids des éléments html de la card\n // et on ajoute le contenu\n colCardClone.id = 'colCardClone' + newId;\n document.querySelector('.row').appendChild(colCardClone);\n // on affiche l'image du produit\n colCardClone.querySelector('#cardImg').id = 'cardImg' + newId;\n colCardClone.querySelector('#cardImg' + newId).src = `assets/img/${item.img}`;\n // on affiche le nom du produit\n colCardClone.querySelector('#cardTitle').id = 'cardTitle' + newId;\n colCardClone.querySelector('#cardTitle' + newId).innerHTML = item.name;\n // on affiche le prix du produit\n colCardClone.querySelector('#cardPrice').id = 'cardPrice' + newId;\n colCardClone.querySelector('#cardPrice' + newId).innerHTML = item.price + ' €';\n // on affiche le descrition du produit\n colCardClone.querySelector('#cardContent').id = 'cardContent' + newId;\n colCardClone.querySelector('#cardContent' + newId).innerHTML = item.infos;\n // on ajoute la référence sur le bouton grâce au data-id\n colCardClone.querySelector('#cardBtn').id = 'cardBtn' + newId;\n colCardClone.querySelector('#cardBtn' + newId).setAttribute('data-id', item.ref);\n\n //\n // Ajout au tableau panier\n //\n // on récupère les id des boutons 'Ajouter' + nouvel id\n let addToCartBtn = document.querySelectorAll('#cardBtn' + newId);\n\n // on parcours le tableau renvoyé par querySelectorAll\n addToCartBtn.forEach(element => {\n element.onclick = function () {\n\n // et à chaque itération, on récupére la référence produit dans data-id\n item = element.getAttribute('data-id');\n\n // on test le tableau pour trouver le bon produit avec la bonne référence\n addedItem = products.filter(product => product.ref == item);\n\n // on ajoute le produit dans le nouveau tableau cart\n addedItem[0].count = 1;\n cart.push(addedItem[0]);\n };\n });\n\n // on incrémente l'id\n newId++;\n\n\n });\n };\n });\n}", "function addSelectedItemToCart() {\n // TODO: suss out the item picked from the select list\n let selectedItem = event.target.items.value;\n console.log(selectedItem);\n // TODO: get the quantity\n let quantity = event.target.quantity.value;\n // TODO: using those, add one item to the Cart\n \n \n carts.addItem(selectedItem,quantity); \n console.log(carts.items);\n \n}", "function setCoffeeProducts(items) {\n let cartProduct = localStorage.getItem(\"coffeeInCart\");\n cartProduct = JSON.parse(cartProduct);\n\n if (cartProduct !== null) {\n if (cartProduct[items.name] == undefined) {\n cartProduct = {\n ...cartProduct,\n [items.name]: items\n };\n }\n cartProduct[items.name].insideCart += 1;\n } else {\n items.insideCart = 1;\n cartProduct = {\n [items.name]: items\n };\n }\n\n localStorage.setItem(\"coffeeInCart\", JSON.stringify(cartProduct));\n}", "add() {\n\t\torinoco.cart.add({ imageUrl: this.imageUrl, name: this.name, price: this.price, _id: this._id });\n\t}", "function addSelectedItemToCart() {\n // TODO: suss out the item picked from the select list\n var product = event.target.items.value;\n var quantity = event.target.quantity.value;\n cart.addItem(product, quantity);\n counter++;\n console.log(counter);\n // TODO: get the quantity\n // TODO: using those, add one item to the Cart\n}", "function agregarCant() {\r\n const seleccionado = productos.find(producto => producto.id == this.id);\r\n seleccionado.agregarCantidad(1);\r\n let registroUI = $(this).parent().children();\r\n registroUI[2].innerHTML = seleccionado.cantidad;\r\n registroUI[3].innerHTML = seleccionado.subtotal();\r\n $(\"#totalCarrito\").html(`TOTAL ${totalCarrito(carrito)}`);\r\n localStorage.setItem(\"carrito\", JSON.stringify(carrito));\r\n}", "function insertarOpciones(L){\n //si no le ponemos var dentro de una funcion es global\n //para hacerla global si no estas en una funcion es con var\n Prod2ID = {}\n //para cada producto creamos un elemento opcion con el nombre del producto y\n // lo almacenamos con su id en Prod2ID, luego lo añadimos a la pagina\n L.forEach(x => {\n let n = document.createElement('option');\n n.value = x.nombre;\n Prod2ID[x.nombre] = x.produc_id;\n document.getElementById('prendas').appendChild(n);\n })\n}", "function addCategories(categories) {\n categories.forEach(element => {\n $(\".menu__container\").append(\n `<div id=\"category-${element.id}\" class=\"category\">\n <h3>${element.name}</h3>\n </div>`\n );\n })\n}", "function addToBasket(selectedProduct) {\n // 1. Pick up the button element from HTML.\n const button = document.getElementById(\"add-to-basket\");\n // 2. Create click event.\n button.addEventListener(\"click\", function (event) {\n event.preventDefault();\n // 3. Add an alert if color is not selected.\n const selectedColor = getSelectedColor();\n if (selectedColor === \"Sélectionner la couleur\") {\n alert(\"Veuillez sélectionner une couleur.\");\n } else {\n // 4. Otherwise, declare a variable called basket which is an empty object {key:value}.\n let basket = {};\n // 5. Get data from the local storage.\n // 5.1. First check if there is already an item called 'localStorageBasket' in the local storage.\n if (localStorage.getItem(\"localStorageBasket\")) {\n // 5.2. If so, get the item 'localStorageBasket' which is in string format then convert it into a JavaScript object stored in the object basket.\n basket = JSON.parse(localStorage.getItem(\"localStorageBasket\"));\n }\n // 6. Check if the newly selected product is already in the basket.\n // If so, we only increment the quantity otherwise we add a new {key:value} pair to the object basket.\n // 6.1. Create the key corresponding to the selected product.\n const basketKey = selectedProduct._id + selectedColor;\n // 6.2. does the key already exist?\n if (basketKey in basket) {\n // 6.3. Access to the value of the key and store it in a variable.\n let productAlreadyInBasket = basket[basketKey];\n // 6.4. Increment the quantity.\n productAlreadyInBasket.productQuantity++;\n } else {\n // 6.5. Create new object key:value pair defining the selected product. This will be the value of the key to be added to basket objet.\n let selectedProductInBasket = {\n productName: selectedProduct.name,\n productId: selectedProduct._id,\n productColor: selectedColor,\n productPrice: selectedProduct.price / 100,\n productQuantity: 1,\n };\n // 7. Add new {key:value} pair into the object basket.\n basket[basketKey] = selectedProductInBasket;\n }\n // 8. Convert the JavaScript object into a string and store it creating a new {key:value} pair into the local storage.\n localStorage.setItem(\"localStorageBasket\", JSON.stringify(basket));\n // 9. Redirect to basket page.\n redirectToBasketPage();\n }\n });\n}", "function modalAddProductInShop(shop) {\n var select = $(\"#addProduct\").find(\"select\")[0]; //Cogemos el select\n var option;\n\n if (select.children.length == 0) { //Si el desplegable esta vacio cargamos los productos\n var categories = StoreHouse.getInstance().categories;\n var category = categories.next();\n var products;\n\n while (category.done !== true) {\n products = category.value.products;\n\n for (let i = 0; i < products.length; i++) {\n option = document.createElement(\"option\");\n $(option).val(products[i].serialNumber);\n $(option).text(products[i].name);\n $(select).append(option);\n }\n category = categories.next();\n }\n }\n $(\"#addProduct\").find(\".btn-primary\").click(callAddProductInShop(shop)); //Asignamos el evento\n}", "function addToCart(newItem) {\n console.log(newItem);\n const index = findCartItem(\n newItem.product.id,\n newItem.toppings,\n newItem.remark\n );\n\n if (index === -1) {\n setCart([...cart, { ...newItem, id: uuidV4() }]);\n } else {\n return -1;\n }\n }", "function addProduct(event) {\n const productId = event.currentTarget.id;\n const selectedProduct = products.data.find(myProduct => myProduct.id === parseInt(productId))\n const productsCardString = localStorage.getItem(\"productsCart\");\n let productsCardArray = JSON.parse(productsCardString);\n\n if (productsCardArray === null || productsCardArray === undefined || productsCardArray.length === 0) {\n productsCardArray = [selectedProduct];\n } else {\n productsCardArray.push(selectedProduct);\n }\n\n localStorage.setItem(\"productsCart\", JSON.stringify(productsCardArray));\n}", "function addToShoppingBasket() {\n\n //Si l'item \"teddies_basket\" n'existe pas et que l'user a sélectionné une couleur. On créé un nouveau tableau \"teddies_basket\", on y ajoute le currentTeddy modifié par l'user, on stringify le tableau pour l'envoyer au localStorage\n if (localStorage.getItem('teddies_basket') == null && selectOption.selected === false) {\n let teddies_basket = [] \n teddies_basket.push(currentTeddy)\n let teddies_basketString = JSON.stringify(teddies_basket)\n localStorage.setItem('teddies_basket', `${teddies_basketString}`)\n\n //Sinon si \"teddies_basket\" existe et que l'user a sélectionné une couleur. On attrape l'item du localStorage, on le parse pour obtenir le tableau \"teddies_basket\".\n } else if (localStorage.getItem('teddies_basket') != null && selectOption.selected === false) {\n\n let getTeddyArray = localStorage.getItem('teddies_basket')\n let parseArray = JSON.parse(getTeddyArray)\n let teddyIndex = null\n let teddyFound = null\n //On parcours le tableau pour chaque élément à l'intérieur de celui-ci. On attrape les données ID et Color. \n // eslint-disable-next-line no-unused-vars\n parseArray.forEach((elementTeddy, index, array) => {\n\n let teddyID = elementTeddy.id\n let teddyColor = elementTeddy.color\n //Si l'ID et la couleur du teddy user correspond au teddy dans le tableau alors on assigne les valeurs suivantes.\n if (teddyID === currentTeddy.id && teddyColor === currentTeddy.color) {\n teddyFound = elementTeddy\n teddyIndex = index\n }\n })\n //Si un teddy dans le panier correspond avec un nouvel objet currentTeddy. On créé une variable pour la nouvelle quantité. On supprime du tableau l'ancien teddy qui sera remplacé par le nouveau avec la mise à jour de sa quantité avec la fonction splice().\n //On converti le tableau en string puis on l'envoi dans le localStorage.\n if (teddyFound != null) {\n\n let newTeddyQuantity = currentTeddy.quantity + teddyFound.quantity \n teddyFound.quantity = newTeddyQuantity\n parseArray.splice(teddyIndex, 1, teddyFound)\n let teddyString = JSON.stringify(parseArray)\n localStorage.setItem('teddies_basket', `${teddyString}`)\n //Sinon on ajoute le currentTeddy au tableau, on converti le tableau puis on l'envoi dans le localStorage. \n } else {\n\n parseArray.push(currentTeddy)\n let teddyString = JSON.stringify(parseArray)\n localStorage.setItem('teddies_basket', `${teddyString}`)\n\n }\n\n } else {\n\n console.log(\"ERROR\")\n\n }\n}", "function category_add() {\n let category_code = $('#category-code').val();\n let category_name = $('#category-name').val();\n if (validate_category()) {\n $.ajax({\n url: '/ajax/category',\n method: 'POST',\n contentType: 'application/json; charset=UTF-8',\n dataType: 'json',\n data: JSON.stringify({\n category_code: category_code,\n category_name: category_name\n }),\n success: function (data) {\n if (data['status'] === 'OK') {\n // hide modal\n $('#modal-category_add').modal('hide');\n // refresh table category\n table_category.ajax.reload()\n // push notification\n toastr['success']('Berhasil menambah kategori baru!');\n } else {\n console.log('Error add new category!')\n }\n }\n });\n }\n }", "function addItemsToCart(button, products) {\n button.innerText = 'Added to Bag'; // change button text\n let productId = button.dataset.id; // get the id of the button that was clicked\n let product = products.find(product => { // compare if the array id and the returned id are the same\n return product.id === productId;\n });\n product['quantity'] = 1;\n product['discount'] = 0;\n product['total'] = product.price;\n product['discountedTotal'] = product.price;\n\n //add items to local storage\n let items;\n let cartItems = localStorage.getItem('cartItems');\n if (cartItems) {\n items = JSON.parse(cartItems);\n let itemExists = items.find(item => item.id === product.id);\n if (!itemExists) {\n items.push(product);// add product to the array\n }\n localStorage.setItem('cartItems', JSON.stringify(items));\n } else {\n items = [product];\n localStorage.setItem('cartItems', JSON.stringify(items));// put it in local storage\n }\n //send items to cart ui\n sendItemsToCartUI(items);\n grandTotals(items);\n document.querySelector('.cart-items').innerText = items.length;\n // show cart on the screen\n openCart();\n}", "addProduct(data) {\n\t\tlet product = {\n\t\t\tid: '',\n\t\t\tprice: '',\n\t\t\tnumber: 0,\n\t\t\ttotal: 0\n\t\t}\n\t\tlet array = this.products\n\n\t\t//Trouve l'id du produit sélectionné dans le tableau\n\t\tlet findIndex = array.findIndex(prod => prod.id === `${data._id}`)\n\t\tlet find = array[findIndex]\n\n\t\t//Si le produit est déjà présent dans l'attribut\n\t\tif (find) {\n\t\t\tfind.number++\n\t\t} else {\n\t\t\tthis.products.push(product)\n\t\t\tproduct.id = `${data._id}`\n\t\t\tproduct.price = `${data.price}`\n\t\t\tproduct.number = 1\n\t\t}\n\t\t//Mise à jour du total\n\t\tthis.calculateTotal()\n\t\tif (find) {\n\t\t\tfind.total = this.total\n\t\t}\n\t\telse {\n\t\t\tproduct.total = this.total\n\t\t}\n\t\t//Mise à jour du storage\n\t\tthis.setBasketStorage(find)\n\t}", "insertProduct(product) {\n // agregar un dato al final de la lista, como recibe un objeto del tipo Product , puede acceder a sus propiedades\n this.productList.push({\n name: product.name,\n category: product.category,\n location: product.location,\n price: product.price\n });\n }", "function addToCart(id) {\n var troba=false;\n if(cart.length==0){\n cart.push(products[id-1]);\n cart[0].quantity=1;\n }\n else if(cart.length>0){\n for(var i=0; i<cart.length; i++){\n if(products[id-1].name==cart[i].name){\n troba=true;}\n if(troba){\n cart[i].quantity++;}\n }\n if(troba==false){\n cart.push(products[id-1]);\n cart[cart.length-1].quantity=1;\n }\n }\n for( let i=0; i<cart.length; i++){\n cart[i].subtotal=cart[i].quantity*cart[i].price;\n }applyPromotionsCart();\n \n}", "function construct_select_categorie() {\n\tvar i;\n\n\tvar sHTML = \"\";\n\tsHTML += \"<select class='input_select_cat' id='input_select_cat' style='width:100%' >\";\n\tsHTML += \"<option value=''>choisir une categorie</option>\";\n\n\n\n\tfor (i = 0; i < aofcategorie.length; i++) {\n\t\tsHTML += \"<option value='\" + aofcategorie[i][\"id_categorie\"] + \"'>\" + aofcategorie[i][\"categorie\"] + \"</option>\";\n\t}\n\n\tsHTML += \"</select>\";\n\n\t$('#select_categorie').html(sHTML);\n}", "saveItem(){\n \n let category = document.getElementById(this.icon).innerHTML\n this.myList.push({label : this.myModel, price :this.price, icon : this.icon, category : category});\n this.myModel = \"\";\n this.icon = \"\";\n this.price = \"\";\n\n }", "function addCategory(category) {\n categories[category] = []\n originals[category] = []\n}", "function StoreCart() {\n\n\t//get flavor \n\tvar flavor = document.getElementById('flavor').textContent;\n\tflavor = flavor.toLowerCase();\n\t//console.log(flavor);\n\n\t//get glaze selection \n\tvar glaze_list = document.forms[0].value;\n\tvar glaze_choice = document.getElementsByName('glaze');\n\n var glaze;\n\tfor (var i=0; i < (glaze_choice.length); i++) {\n\t\tif (glaze_choice[i].checked) {\n\t\t\tglaze = glaze_choice[i].value;\n\t\t\t//console.log((glaze_choice[i].value));\n\t\t}\n\n\t}\n\n\tvar images = {\n\t\tnone:'images/product1.jpg', \n\t\tstrawberry:'images/strawberry.jpg', \n\t\tchocolate: 'images/choco.jpg', \n\t\tpear:'images/pear.jpg'\n\t};\n\n\t//get corresponding image to glaze\n\tvar img_source = images[glaze];\n\t//console.log(img_source);\n\n\t//get quantity selected\n\tvar qty1 = document.getElementById('qty1').value;\n\tqty1 = parseInt(qty1);\n\t//console.log(qty1);\n\n\t//get price without dollar sign \n\tvar p1 = document.getElementById('price').textContent;\n\tp1 = p1.substring(1);\n\tp1 = parseFloat(p1);\n\ttotal_price = qty1 * p1;\n\t//console.log(p1);\n \n //create new item object for order\n\tvar item = {\n\t\timg_source: img_source,\n\t\tflavor: flavor, \n\t\tglaze: glaze,\n\t\tquantity: qty1,\n\t\tprice: total_price\n\t}\n\n\tvar item_array = [img_source, flavor, glaze, qty1, total_price];\n\n\t//console.log(item);\n\n\tall_items.push(item_array);\n\t//console.log(all_items);\n\n\t//var item_list = \"\";\n\t//item_list += flavor + \" \" + glaze + \" \" + qty1 + \" \" + p1;\n\t//console.log(item_list);\n\n window.localStorage.setItem('item1', JSON.stringify(all_items));\n item1 = window.localStorage.getItem('item1');\n console.log(item1);\n\n}", "function addToCatalogue(product)\r\n{\r\n let column = document.createElement(\"div\");\r\n // Creation de la colonne avec une classe \"col\" + elements responsives + margin\r\n column.classList.add(\"col\", \"col-12\", \"col-lg-\" + BOOTSTRAP_COLUMNS_PER_PRODUCT, \"my-2\");\r\n let card = document.createElement(\"div\");\r\n card.classList.add(\"card\"); // Creation de la colonne avec une classe \"card\"\r\n let cardImg = document.createElement(\"img\");\r\n cardImg.setAttribute(\"src\", product.imageUrl);\r\n cardImg.setAttribute(\"alt\", \"Picture of \" + product.name);\r\n let cardBody = document.createElement(\"div\");\r\n cardBody.classList.add(\"card-body\"); // Creation de la colonne avec une classe \"card-body\"\r\n let productName = document.createElement(\"h3\");\r\n productName.classList.add(\"card-title\");\r\n productName.innerHTML = product.name;\r\n let productDescription = document.createElement(\"p\");\r\n productDescription.classList.add(\"card-text\");\r\n productDescription.innerHTML = product.description;\r\n let productPrice= document.createElement(\"p\");\r\n productPrice.classList.add(\"text-right\",\"font-weight-bold\");\r\n productPrice.innerHTML = priceToEuros(product.price);\r\n let cardLink = document.createElement(\"a\");\r\n cardLink.classList.add(\"stretched-link\");\r\n cardLink.setAttribute(\"href\", \"produit.html?id=\" + product._id);\r\n\r\n column.appendChild(card);\r\n card.appendChild(cardImg);\r\n card.appendChild(cardBody);\r\n cardBody.appendChild(productName);\r\n cardBody.appendChild(productDescription);\r\n cardBody.appendChild(productPrice);\r\n cardBody.appendChild(cardLink);\r\n return column;\r\n}", "function inserir(){\n\n\t\t\tvm.obj.ordem = vm.lista.length + 1;\n\n\t\t\treturn CRUDService.categoria().inserir(vm.obj).then(function(data) {\n\n\t\t\t\tif(data.success){\n\n\t\t\t\t\tvm.lista.push(angular.copy(vm.obj));\n\t\t\t\t\talert('Inserido');\n\t\t\t\t\t\n\n\t\t\t\t}else{\n\n\t\t\t\t\talert('Erro');\n\n\t\t\t\t};\n\n\t\t\t\treturn data;\n\n\t\t\t});\n\n\t\t}", "function addToCart(flavor) {\n thisPrice = document.getElementById(\"rollprice\").value;\n thisGlaze = document.querySelector('input[name=\"glaze\"]:checked').value;\n thisFlavor = flavor;\n\n newItem = new Roll(flavor, thisGlaze, thisPrice);\n cartArray.push(newItem);\n updateCartNum();\n}", "addCarting({commit, state}, products) {\n // verify if the 'product' is or not add in the 'carting'. This 'hasOwnProperty' method returns \n // a boolean indicating whether the object has the specified property\n hasOwnProperty.call(state.carting, products.id) \n ? products.amount = state.carting[products.id].amount + 1\n : products.amount = 1;\n //console.log(products.amount);\n // pushing to \"mutation\"\n commit('setCarting', products);\n }", "function addToCart()\n\t{\n\t\t// avoid adding to cart before the item info is fetched\n\t\t// if( product.ASIN === undefined) return ;\n\t\tif( product === undefined) return ;\n\t\t\n\t\tvar newItem = Object.assign({}, product); \n\t\tnewItem.ID \t\t= Date.now();\n\t\t\n\t\t// console.log( \"product id: \" + newItem.ID );\n\t\tnewProduct = \"<tr>\"\n\t\t\t\t\t\t+ \"<td><img src=\\\"\"+ newItem.Image_url + \"\\\" class=\\\"thumbnail\\\" /> </td>\"\n\t\t\t\t\t\t+ \"<td>\"+ newItem.Color\t\t\t+\"</td>\"\n\t\t\t\t\t\t+ \"<td>\"+ newItem.Size\t\t\t+\"</td>\"\n\t\t\t\t\t\t+ \"<td>\"+ newItem.PriceSAR\t\t+\" ريال</td>\"\t\t\t\t\t\t\n\t\t\t\t\t\t+ \"<td>\"+ newItem.TaxSAR\t\t+\" ريال</td>\"\t\t\t\t\t\t\n\t\t\t\t\t\t+ \"<td>\"+ newItem.ShippingCost\t+\" ريال </td>\"\t\t\t\t\t\t\n\t\t\t\t\t\t+ \"<td> <i class='fi-x removeItem button alert' id='\"+ newItem.ID +\"'></i></td>\"\n\t\t\t\t\t\t+ \"</tr>\";\n\t\t\t\t\t\t\n\t\t$('#items > tbody:last-child').append(newProduct);\n\t\t$(\"#addToCartBtn\").notify(\"تم إضافته لسلة المشتريات\", {className:\"success\"});\n\t\t$(\"#itemsList\").slideDown();\n\t\t\n\t\t// save cart\n\t\tsaveCart(\"add\", newItem.ID);\n\t\t\n\t\t// start observer for remove from cart button\n\t\tobserveRemoveBtn();\n\t\t\n\t\t// add to invoice\n\t\taddToInvoice(newItem);\n\t}", "function indexCatalog() {\n catalog={\n byId: {},\n items: [],\n categories: [],\n discounts: {}\n};\n catalog_raw.forEach((e) => {\n \n if (!catalog.byId[e.id]) catalog.byId[e.id]=e;\n\n if (e.type==\"ITEM\") {\n catalog.items.push(e);\n if (e.item_data.variations) e.item_data.variations.forEach((v) => {\n catalog.byId[v.id]=v;\n })\n }\n if (e.type==\"MODIFIER_LIST\") {\n if (e.modifier_list_data.modifiers) e.modifier_list_data.modifiers.forEach((m) => {\n m.modifier_data.modifier_list_id=e.id;\n console.log(m.modifier_data.modifier_list_id);\n catalog.byId[m.id]=m;\n })\n }\n if (e.type==\"DISCOUNT\") {\n if (e.discount_data.name) {\n catalog.discounts[e.discount_data.name.toLowerCase()]={ id: e.id };\n }\n }\n if (e.type==\"CATEGORY\") {\n catalog.categories.push(e);\n }\n })\n}", "_addItem () { \n\t\tif (this.state.input === '') return \n\t\t\trealm.write(() => {\n\t\t\t\trealm.create('Categories', { name: this.state.input })\n\t\t\t})\n\t\t\tthis.setState({ input: ''})\n\t}", "function removerCategoria() {\n consultarProdutos();\n}", "function getNewCategoryDetails() {\n var category = {};\n var properties = new Array\n category.Name = $('#newCategoryName').val();\n category.Description = $('#newCategoryDescruption').val();\n category.DateModified = $.now()\n category.Email = email;\n count = 0;\n var rowCount = $('#AddCategoryProperties tr').length;\n $('#AddCategoryProperties tr').each(function () {\n properties[count] = $(this).find(\"td > label\").html();\n count++;\n });\n InsertNewCategory(category, properties);\n}", "categ(state,data)\n {\n return state.category=data\n }", "function addCategory(e) {\n if (e.value === 'entree') {\n createCategorySection('Entrees', 'entree', 'Add Entree')\n } else if (e.value === 'appetizer') {\n createCategorySection('Appetizers', 'appetizer', 'Add Appetizer')\n } else if (e.value === 'dessert') {\n createCategorySection('Desserts', 'dessert', 'Add Dessert')\n } else if (e.value === 'sides') {\n createCategorySection('Sides', 'sides', 'Add Side')\n } else if (e.value === 'addOn') {\n createCategorySection('Add-On', 'addOn', 'Add Add-On')\n } else if (e.value === 'soupOrSalad') {\n createCategorySection('Soups & Salads', 'soupOrSalad', 'Add Soup or Salad')\n } else if (e.value === 'kidsMenu') {\n createCategorySection('Kids Menu Item', 'kidsMenuItem', 'Add Kids Item')\n } else if (e.value === 'otherFood') {\n createCategorySection('Other Food', 'otherFood', 'Add Other Food')\n } else if (e.value === 'wine') {\n createCategorySection('Wine', 'wine', 'Add Wine')\n } else if (e.value === 'beer') {\n createCategorySection('Beer', 'beer', 'Add Beer')\n } else if (e.value === 'cocktails') {\n createCategorySection('Cocktails', 'cocktail', 'Add Cocktail')\n } else if (e.value === 'nonAlcoholic') {\n createCategorySection('Non-Alcoholic', 'nonAlcoholic', 'Add Non-Alcoholic')\n } else if (e.value === 'afterDinnerDrink') {\n createCategorySection('After Dinner Drinks', 'afterDinnerDrink', 'Add After Dinner Drink')\n } else if (e.value === 'otherDrink') {\n createCategorySection('Other Drinks', 'otherDrink', 'Add Other Drink')\n }\n $(\".categorySelector option[value='\" + e.value + \"']\").remove();\n $('select').material_select();\n //Found this line from stackoverflow and it fixed the \"need to click dropdown twice\" bug so I'm gonna keep it\n document.querySelectorAll('.select-wrapper').forEach(t => t.addEventListener('click', e=>e.stopPropagation()))\n}", "function addCart(camera) {\n // CHECK SI UN PANIER EXISTE DEJA\n const cart = JSON.parse(sessionStorage.getItem(\"panier\"))\n ? JSON.parse(sessionStorage.getItem(\"panier\"))\n : [];\n\n let newProduct = {\n id: camera._id,\n img: camera.imageUrl,\n name: camera.name,\n price: camera.price,\n totalProduct: 1,\n };\n\n //AJOUT PRODUIT AU PANIER - INCREMENTE SI DEJA EN PANIER\n document.getElementById(\"add-button\").addEventListener(\"click\", () => {\n const productIsInCart = cart.findIndex(\n (product) => product.name == newProduct.name\n );\n if (productIsInCart != -1) {\n cart[productIsInCart].totalProduct += 1;\n sessionStorage.setItem(\"panier\", JSON.stringify(cart));\n } else {\n cart.push(newProduct);\n sessionStorage.setItem(\"panier\", JSON.stringify(cart));\n }\n document.location.reload();\n });\n}", "function insertInCart(course){\n const row = document.createElement('tr');\n row.innerHTML = `\n <td>\n <img src = \"${course.image}\">\n </td>\n <td>\n ${course.title}\n </td>\n <td>\n ${course.price}\n </td>\n <td class=\"cross\">\n <a href = \"#\" class = \"deleteCourse\" data-id = \"${course.id}\">x</a>\n </td>\n ` ;\n listCourses.appendChild(row);\n saveCourseLocalStorage(course);\n}", "setCategories(cat) {\n for (let c of cat) {\n this.allCategories.push({\n id: c.id,\n title: c.title,\n toggle: false\n });\n }\n }", "imprimirCategorias(){\n eventbrite.obtenerCategorias()\n .then(data => {\n const categorias = data.resultado.categories;\n\n console.log(categorias)\n\n // Obtener el select de categorias\n const selectCateg = document.getElementById('listado-categorias');\n\n // Recorremos el arreglo e imprimimos los options\n categorias.map(categ => {\n const option = document.createElement('option');\n option.value = categ.id;\n option.appendChild(document.createTextNode(categ.name_localized));\n\n selectCateg.appendChild(option);\n });\n });\n }", "function addItem(id){\n\n let item = produtos[id];\n poeCarrinho(item);\n console.log(arrayCarrinho)\n\n localStorage.setItem(\"carrinho\", JSON.stringify(arrayCarrinho));\n}//addItem", "function onClickActionAddCartItem(e){\n\t\t\n\t\tvar html = '';\n\t\tlet itemId = parseInt(e.currentTarget.dataset.itemid);\n\t\tvar it = DB.getItemInfo( itemId );\n\t\tvar content = CashShop.ui.find('.container-cart');\n\t\tconst itemCart = CashShop.cartItem.find(i => i.itemId === itemId);\n\t\tvar item = [];\n\t\tvar tab = 0;\n\t\tif(CashShop.activeCashMenu !== 'SEARCH_RESULT'){\n\t\t\titem = CashShop.cashShopListItem[CashShop.activeCashMenu].items.find(i => i.itemId === itemId);\n\t\t\ttab = CashShop.cashShopListItem[CashShop.activeCashMenu].tabNum;\n\t\t} else {\n\t\t\titem = CashShop.csListItemSearchResult.find(i => i.itemId === itemId);\n\t\t\ttab = item.tab;\n\t\t}\n\n\t\tif(content.find('#cart-list .items .no-items').length > 0){\n\t\t\tcontent.find('#cart-list .items .no-items').remove();\n\t\t}\n\n\t\tif(CashShop.cartItem.length > 4 && typeof itemCart === 'undefined'){\n\t\t\t//only 5 item can store in cart\n\t\t\tUIManager.showMessageBox( '5 Item can only stored in cart!', 'ok');\n\t\t\treturn;\n\t\t}\n\n\t\tif(item.amount >= 99){\n\t\t\tUIManager.showMessageBox( 'Max Quantity 99!', 'ok');\n\t\t\tChatBox.addText( 'Max Quantity 99!', ChatBox.TYPE.ERROR);\n\t\t\treturn;\n\t\t}\n\n\t\tif(typeof itemCart === 'undefined'){\n\t\t\titem.amount = 1;\n\t\t\titem.tab = tab;\n\t\t\tCashShop.cartItem.push(item);\n\t\t\thtml = `<li class=\"item\" data-index=\"${itemId}\">\n\t\t\t\t\t<div class=\"inner-item-dt\">\n\t\t\t\t\t\t<div class=\"delete-item\"><button>x</button></div>\n\t\t\t\t\t\t<div class=\"item-dt-img\"></div>\n\t\t\t\t\t\t<div class=\"item-dt-desc\">\n\t\t\t\t\t\t\t<div class=\"item-desc-top\">${it.identifiedDisplayName}</div>\n\t\t\t\t\t\t\t<div class=\"item-counter\">\n\t\t\t\t\t\t\t\t<div class=\"item-cnt\">${item.amount}</div>\n\t\t\t\t\t\t\t\t<button class=\"counter-btn item-cnt-up\" data-index=\"up\"></button>\n\t\t\t\t\t\t\t\t<button class=\"counter-btn item-cnt-down\" data-index=\"down\"></button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class=\"item-desc-price\">\n\t\t\t\t\t\t\t\t<div class=\"icon-gold-coin\"></div>\n\t\t\t\t\t\t\t\t<span>${item.price}</span>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</li>`;\n\t\t\tcontent.find('.items').append(html);\n\t\t\tClient.loadFile( DB.INTERFACE_PATH + 'collection/' + ( it.identifiedResourceName ) + '.bmp', function(data){\n\t\t\t\tcontent.find('.item[data-index=\"'+ itemId +'\"] .item-dt-img').css('backgroundImage', 'url('+ data +')');\n\t\t\t});\n\n\t\t\tClient.loadFile( DB.INTERFACE_PATH + 'cashshop/img_shop_itemBg2.bmp', function(data){\n\t\t\t\tcontent.find('.item-counter').css('backgroundImage', 'url('+ data +')');\n\t\t\t});\n\t\t} else {\n\t\t\titemCart.amount += 1;\n\t\t\tcontent.find('.items .item[data-index=\"'+itemId+'\"] .item-cnt').html(itemCart.amount);\n\t\t}\n\t\tCashShop.cartItemTotalPrice = CashShop.cartItem.map(item => item.price * item.amount).reduce((prev, next) => prev + next);\n\t\tCashShop.ui.find('.container-cart-footer .item-desc-price span').html(CashShop.cartItemTotalPrice);\n\t}", "function addSelectedItemToCart() {\n // suss out the item picked from the select list\n let product = document.getElementById('items').value;\n let quantity = document.getElementById('quantity').value;\n cart.addItem(product, quantity);\n\n // console.log(newCartItem);\n // console.log(cart);\n\n // get the quantity\n // using those, add one item to the Cart\n}", "function handleInputChangeCa(event) {\n\n var cat = product.categories\n cat.push(allCategories.find(c => c.id == Number(event.target.value)).id)\n\n if (boolean) {\n dispatch(editProductCategory(product.id, event.target.value))\n }\n\n //borra los repetidos\n cat = cat.filter((arg, pos) => cat.indexOf(arg) == pos)\n setProduct({ ...product, [event.target.name]: cat })\n }", "function addToCart() {\n var itemID = $(this).attr(\"id\");\n var alreadyInCart = false;\n for (var i = 0; i < cartItems.length; i++) {\n if (itemID == cartItems[i][0]) {\n alreadyInCart = true;\n cartItems[i][3] += 1;\n }\n }\n if (alreadyInCart == false) {\n for (var i = 0; i < shopItems.length; i++) {\n if (itemID == shopItems[i][0]) {\n var applianceID = shopItems[i][0];\n var applianceName = shopItems[i][1];\n var appliancePrice = shopItems[i][2];\n var applianceQuantity = 1;\n itemID = [\n applianceID,\n applianceName,\n appliancePrice,\n applianceQuantity,\n ];\n }\n }\n cartItems.push(itemID);\n }\n\n updateCartDetails();\n}", "function agregarProductoAlCarrito(evento3) {\n console.log(evento3.target.parentNode.parentNode.parentNode.getAttribute('id'));\n let IdProducto = evento3.target.parentNode.parentNode.parentNode.getAttribute('id');\n productosDeMiCarrito.forEach((producto) =>{\n if(producto.id == IdProducto){\n productosCarrito.push(producto);\n console.log(productosCarrito);\n actualizarElCarrito()\n }\n\n localStorage.setItem('productosCarrito', JSON.stringify(productosCarrito));\n })\n}", "function addToCart(cInfo) {\n //creat <tr> tag\n const row = document.createElement(\"tr\");\n\n //Build HTML template\n row.innerHTML = `\n <tr>\n <td>\n <img src=\"${cInfo.image}\" width=\"100px\">\n </td>\n <td>${cInfo.title}</td>\n <td>${cInfo.price}</td>\n <td>\n <a href=\"#\" class=\"remove\" data-id=\"${cInfo.id}\">X</a>\n </td>\n </tr>\n `\n shoppingCartContent.appendChild(row);\n\n //adding courses to the localStorage\n saveToLocalStorage(cInfo);\n}", "function entregaCategoriaSeleccionada() {\n\t//divide lista palabras en 4 para elegir entre 4 categorias\n\tvar palabrasClaveCuartosLength = palabrasClave.length/4;\n\n\t//cuartos para bloques de palabras\n\tvar primerCuarto = palabrasClaveCuartosLength * 1;\n\tvar segundoCuarto = palabrasClaveCuartosLength * 2;\n\tvar tercerCuarto = palabrasClaveCuartosLength * 3;\n\tvar cuartoCuarto = palabrasClaveCuartosLength * 4;\n\t\n\t//se divide array para ir contando secuencias de palabras\n\t//variables creadas en esta funcion sin var para q sean globales. \t\n\tpalabrasClave1\t=\tpalabrasClave.slice(0, primerCuarto); // (0,3) para pruebas\n\tpalabrasClave2\t=\tpalabrasClave.slice(primerCuarto, segundoCuarto); // (3,6) para pruebas\n\tpalabrasClave3\t=\tpalabrasClave.slice(segundoCuarto, tercerCuarto); // (6,9) para pruebas\n\tpalabrasClave4\t=\tpalabrasClave.slice(tercerCuarto, cuartoCuarto); // (9,12) para pruebas\n\t\n\t// for(i = 0; i<palabrasClave1.length; i++) {\n\t// \t\tif (palabrasClave1[i] == \"aba\") {\n\t// \t\tcategoriaSeleccionada = categoria1;\n\t// \t\t}\n\t// \t}\n\n\t//Selecciona en que tramo esta la palabra, y seleciona categoria\n\tvar encontrada = false;\n\tfor (i = 0; i < palabrasClave1.length && !encontrada; i++) {\n \t\tif (palabrasClave1[i] === getPalabra) {\n\t \tencontrada = true;\n\t \tcategoriaSeleccionada = categoria1;\n \t \t}\n \t} \t\n\tfor (j = 0; j < palabrasClave2.length && !encontrada; j++) {\n \t\tif (palabrasClave2[j] === getPalabra) {\n\t \tencontrada = true;\n\t \tcategoriaSeleccionada = categoria2;\n \t \t}\n\t}\n\tfor (k = 0; k < palabrasClave3.length && !encontrada; k++) {\n \t\tif (palabrasClave3[k] === getPalabra) {\n\t \tencontrada = true;\n\t \tcategoriaSeleccionada = categoria3;\n \t \t}\n\t}\n\tfor (l = 0; l < palabrasClave4.length && !encontrada; l++) {\n \t\tif (palabrasClave4[l] === getPalabra) {\n\t \tencontrada = true;\n\t \tcategoriaSeleccionada = categoria4;\n \t \t}\n\t}\n\t//si no encuentra la palabra clave, elije al azar entre las 4 categorias\n// \tif (encontrada === false) {\n// \t\t \tcategoriaSeleccionada = categoria1; \n// \t}\n\n\n//Con esto se puede elegir palabra a mostrar categoriaSeleccionada[0][x]\n//document.getElementById(\"xxx\").innerHTML = categoriaSeleccionada[0];\n\n\n}", "saveItem(id, price, urlImg, name) {\n //obtiene la cantidad escogida del producto selecccionado\n var cantidad =\n document.getElementById(\"quantity\" + id).value === \"\"\n ? 1\n : document.getElementById(\"quantity\" + id).value;\n //obtiene el estado de carrito de compra\n const arreglo = this.state.cartDetails;\n\n if (arreglo.length === 0) {\n //SI el carrito viene vacio...\n //crea el objeto...\n var objeto = {\n quantity: cantidad,\n unitValue: price,\n idVarianteProducto: id,\n urlImg: urlImg,\n name: name,\n };\n //y lo ingresa al arreglo del carrito\n arreglo.push(objeto);\n } else {\n //SI el carrito no viene vacio\n //crea booleano que verifica que el nuevo dato no existe en el actual arreglo\n var flag = true;\n //se revisa el arreglo para comprobar que el nuevo producto existe en el carrito\n arreglo.forEach(function (elemento) {\n if (elemento.idVarianteProducto === id) {\n //si encuentra el producto...\n elemento.quantity = cantidad; //actualiza a cantidad...\n flag = false; //y el booleano se cambia a false pues el nuevo dato si existe en el actual arreglo\n }\n });\n if (flag === true) {\n //si el booleano no cambio, significa que el nuevo dato no existia en el actual arreglo\n //crea el objeto...\n var objeto1 = {\n quantity: cantidad,\n unitValue: price,\n idVarianteProducto: id,\n urlImg: urlImg,\n name: name,\n };\n //y lo ingresa al arreglo del carrito\n arreglo.push(objeto1);\n }\n }\n //renueva el estado cartDetail con el nuevo carrito recien modificado\n this.setState({ cartDetails: arreglo });\n //porcede a contar la cantidad total de productos para mostrarlo en el Badge del boton carrito\n this.contarCantidadTotal();\n }", "addItemsToCart() {\n\n Model.addItemsToCart(this.currentItems);\n }", "function mostrarProductos() {\n data.forEach(function (element, index) {\n contenedorDeProductos.append(`\n <article class=\"search-item\">\n <div class=\"col-4-12\">\n <img src=${element.img} class=\"imagenes\">\n </div>\n <div class=\"col-8-12\">\n <h2 id=\"${element.id}\">${element.marca} ${element.modelo} </h2>\n <p>$${element.precio}</p>\n <div>\n <input type=\"button\" id = \"cart-btn\" data-id=\"${index}\" class=\"btn -secondary -button\" value=\"Agregar al carrito\" >\n </div>\n </div>\n </article>\n </div>`)\n })\n //evento que agrega los items al carrito segun posicion en su array\n botonAgregarOrdenes = $(\".-button\");\n botonAgregarOrdenes.click(function (event) {\n var indexSelected = $(event.target).data(\"id\");\n agregarYMostrarOrdenes(indexSelected);\n });\n function agregarYMostrarOrdenes(indexSelected) {\n let cartList = document.getElementById('cart-list');\n cartList.insertAdjacentHTML('beforeend', `<li>${data[indexSelected].marca} ${data[indexSelected].modelo}</li>`);\n selected.push(data[indexSelected]);\n localStorage.setItem('selected', JSON.stringify(this.selected));\n }\n console.log(selected);\n}", "function addToCart(){\n var productDiv = this.parentNode;\n var productDetails = productDiv.querySelectorAll('span');\n var productName = productDetails[0].textContent;\n var productPrice = Number(productDetails[1].textContent);\n var productImage = productDetails[2].textContent;\n\n if( !productAlreadyInCart(productName) ){\n var product = new Product(productName, productPrice, productImage);\n cart.push(product);\n console.log('added to cart')\n // Set cart in localStorage\n localStorage.setItem('cart', JSON.stringify(cart));\n }\n else{\n alert('product already in cart')\n } \n}", "aggiungiSopra (c) { \n if (!Carta.isCarta(c)) throw {name:\"Mazzo()->aggiungiSopra(c)\", message:\"invalid argument, typeof is not Carta() \" };\n return this._carte.push(c);\n }", "function addProduct() {\n el('cart').style.display = 'inline-block';\n el('order').style.display = 'none';\n const title = el('products').value;\n const quantity = parseFloat(el('quantity').value);\n cart[title] = (cart[title] || 0) + quantity;\n saveCart();\n showCart();\n}", "OnAddCart(product) {\n // this.flashMessageService.show('Product added to cart!', {cssClass:'alert-success', timeout: 4000});\n console.log(product);\n this.productAddedToCart = this.getProductFromCart();\n\n if (this.productAddedToCart == null) {\n console.log(\"This array is empty\");\n this.productAddedToCart = [];\n this.productAddedToCart.push(product);\n this.addProductToCart(this.productAddedToCart);\n console.log('Product added to cart');\n } else {\n let tempProduct = this.productAddedToCart.find(p => p.product_Name == product.product_Name);\n\n if (tempProduct == null) {\n this.productAddedToCart.push(product);\n this.addProductToCart(this.productAddedToCart);\n console.log('Product added to cart.');\n } else {\n tempProduct.product_Quantity++; // this.productAddedToCart.find(p=>p.id==product.id).product_Quantity = product.product_Quantity +1;\n\n this.addProductToCart(this.productAddedToCart);\n }\n }\n }", "addToShoppingCart() {\n\n // units is greater than zero\n if (this.state.units != 0){\n\n // validate stock\n if (this.state.units <= this.state.product.saleFormats[this.state.formatIndex].stock) {\n \n // get shpping cart\n var productsArrayCart = JSON.parse(localStorage.getItem('productsArrayCart'));\n \n // console.log(productsArrayCart);\n if (productsArrayCart == null) {\n productsArrayCart = [];\n };\n \n \n // validate if product with specific format already is in cart\n var productIsInCart = false;\n var formatIsInCart = false;\n var indexProduct = 0;\n productsArrayCart.forEach((product, idx) => {\n // validate if product is in array\n if (product.product.id == this.state.product.id) {\n productIsInCart=true;\n indexProduct= idx;\n\n // validate if format is in array\n if (product.formatIndexList.includes(this.state.formatIndex)) {\n formatIsInCart = true;\n }\n }\n });\n\n // if product is not\n // add product to cart\n if (!productIsInCart) {\n\n // alert(\"Product isn't in cart\");\n\n // add new product\n productsArrayCart.push({\n \"product\": this.state.product,\n \"formatIndexList\": [this.state.formatIndex],\n \"unitsList\": [this.state.units],\n });\n \n // console.log(productsArrayCart);\n \n // save new array\n localStorage.setItem('productsArrayCart', JSON.stringify(productsArrayCart));\n \n // console.log(productsArrayCart);\n \n // console.log(localStorage);\n alert(\"Producto agregado al carrito de compra\");\n \n // redirect\n this.props.history.push('/store/' + this.props.match.params.store_id);\n }\n\n // if product is in cart but no format\n // add format to product cart\n else if (productIsInCart & !formatIsInCart) {\n\n // alert(\"Product is in cart but format is not\");\n\n // add format index to list\n var formatIndexList = productsArrayCart[indexProduct][\"formatIndexList\"];\n formatIndexList.push(this.state.formatIndex);\n\n // add units\n var unitsList = productsArrayCart[indexProduct][\"unitsList\"];\n unitsList.push(this.state.units);\n\n // update item on product cart array\n productsArrayCart[indexProduct][\"formatIndexList\"] = formatIndexList\n productsArrayCart[indexProduct][\"unitsList\"] = unitsList;\n\n // save new array\n localStorage.setItem('productsArrayCart', JSON.stringify(productsArrayCart));\n\n // console.log(productsArrayCart);\n\n // console.log(localStorage);\n alert(\"Producto agregado al carrito de compra\");\n\n // redirect\n this.props.history.push('/store/' + this.props.match.params.store_id);\n\n\n }\n\n // if product and format is in cart\n else if (productIsInCart & formatIsInCart) {\n\n // get index of format index\n const indexFormatIndex = productsArrayCart[indexProduct][\"formatIndexList\"].indexOf(this.state.formatIndex);\n\n // get product format stock\n const productFormatStock = this.state.product.saleFormats[this.state.formatIndex].stock;\n\n // get products availables (dif between stock and units )\n const availableProducts = productFormatStock - productsArrayCart[indexProduct][\"unitsList\"][indexFormatIndex]\n\n // if it can add all units, so add to the cart\n if (this.state.units <= availableProducts) {\n\n\n // alert(\"product is in car and can add these units\");\n\n // add units to element in units array\n productsArrayCart[indexProduct][\"unitsList\"][indexFormatIndex] = productsArrayCart[indexProduct][\"unitsList\"][indexFormatIndex] + this.state.units;\n\n // save new array\n localStorage.setItem('productsArrayCart', JSON.stringify(productsArrayCart));\n\n // console.log(productsArrayCart);\n\n // console.log(localStorage);\n alert(\"Producto agregado al carrito de compra\");\n\n // redirect\n this.props.history.push('/store/' + this.props.match.params.store_id);\n\n \n }\n \n else if (availableProducts == 0) {\n // alert(\"product is in car but cann't add more units\");\n\n alert(\"Ya has agregado el máximo de unidades de este formato. Revisa tu carrito de compra para confirmar\");\n }\n // else, alert message with differecen available\n else {\n // alert(\"product is in cart but cann't add that number of units\");\n alert(\"Solo puedes agregar hasta \" + availableProducts + \" unidades de este formato\");\n };\n\n }\n\n }\n \n else{\n alert(\"Sólo puedes ordenar \" + this.state.product.saleFormats[this.state.formatIndex].stock + \" unidades de este formato\");\n };\n }\n \n else {\n alert(\"Debes elegir al menos una unidad de este producto\");\n };\n\n }", "function add_cats(){\n\tget_all_cats.done(function(data){\n\t var cats = \"<select name='select_cat' class='add-cat' >\";\n\t for(var i = 0; i < data.length; i++){\n\t\tcats += \"<option class='cat_option' value=\" +data[i].categoryId +\">\";\n\t\tcats += data[i].categoryName;\n\t\tcats += \"</option>\";\n\t }\n\t cats += \"</select>\";\n\t $(\"#add_cats\").append(cats);\n\t});\n }", "function addSelectedItemToCart() {\n // TODO: suss out the item picked from the select list\n // TODO: get the quantity\n // TODO: using those, add one item to the Cart\n const product = selectElement.options[selectElement.selectedIndex].text;\n const quantity = parseInt(document.getElementById('quantity').value);\n cart.addItem(product, quantity);\n}", "function pushProductIntoCart({ id_product, option, quantity }) {\n this.state.guestcart.push({\n id_product: id_product,\n option: option,\n quantity: quantity,\n });\n}", "function addProductToShoppingCart(index) {\r\n let getLocalStorageData = localStorage.getItem(\"groceryListItem\");\r\n groceryListItem = JSON.parse(getLocalStorageData);\r\n const found = groceryListItem.splice(index,1);\r\n\r\n let getLocalStoragee = localStorage.getItem(\"shoppingCartListItem\");\r\n if(getLocalStoragee == null) {\r\n shoppingCartListItem = [];\r\n } else {\r\n shoppingCartListItem = JSON.parse(getLocalStoragee);\r\n }\r\n let x, y;\r\n Object.values(found).forEach(s => {\r\n x = s.name;});\r\n Object.values(found).forEach(s => {\r\n y = s.price;});\r\n let temp = {\r\n id: Date.now(),\r\n name: x,\r\n price: y\r\n };\r\n shoppingCartListItem.unshift(temp);\r\n localStorage.setItem(\"shoppingCartListItem\", JSON.stringify(shoppingCartListItem));\r\n showShoppingCartList();\r\n}", "function storeItem(a = \"Dummy\", b = \"$99.00\", c = \"img/image01.jpg\", d = 1) {\n //name, cost, quantity --> plz pass in this order\n let item;\n item = {\n name: a,\n cost: b,\n img: c,\n quantity: d,\n };\n for (let a = 0; a < arr.length; a++) {\n if (arr[a].name == item.name) {\n arr[a].quantity++;\n localStorage.setItem(\"CartItem\", JSON.stringify(arr));\n return;\n }\n }\n arr.push(item);\n localStorage.setItem(\"CartItem\", JSON.stringify(arr));\n}" ]
[ "0.6485429", "0.6356314", "0.6313848", "0.62323105", "0.61262023", "0.60931385", "0.6025986", "0.60150266", "0.6000567", "0.5921758", "0.5843933", "0.5839238", "0.5836382", "0.5816684", "0.5801649", "0.5798945", "0.57898134", "0.5787598", "0.57755375", "0.57716054", "0.57624453", "0.575848", "0.5747356", "0.57465595", "0.57462823", "0.5737996", "0.5733575", "0.57087874", "0.56987345", "0.5689505", "0.56853193", "0.5677818", "0.56628567", "0.56628567", "0.565434", "0.56524056", "0.56523615", "0.56464", "0.563768", "0.56343335", "0.56268746", "0.5622101", "0.5612298", "0.56081724", "0.5603464", "0.5592695", "0.5586407", "0.55859923", "0.5585767", "0.55673796", "0.55661523", "0.5565214", "0.5549548", "0.5546437", "0.5546231", "0.5544639", "0.55437267", "0.5539406", "0.5537674", "0.5535949", "0.5535219", "0.5532378", "0.55315197", "0.55299777", "0.5529829", "0.5513866", "0.54986703", "0.54865533", "0.548587", "0.54849404", "0.54837215", "0.5483133", "0.548126", "0.5476778", "0.5475704", "0.54753774", "0.5472225", "0.54707247", "0.54658705", "0.54570025", "0.54559195", "0.5447267", "0.54458857", "0.54365575", "0.54258174", "0.54208475", "0.5420358", "0.54194283", "0.5417489", "0.54160935", "0.5413361", "0.54133123", "0.54132617", "0.5410279", "0.5408976", "0.5407858", "0.54050964", "0.5403716", "0.53952676", "0.53945684", "0.5391385" ]
0.0
-1
Cart de proveedor que va a ser insertado en el contenedor
function DatProveMP(id, nombre) { return '<option value="' + id + '">' + nombre + '</option>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addCart(nome, valor, info){\n let list = {\n nome: nome,\n valor: valor,\n informacao: info\n };\n setPedido(oldArray => [...oldArray, list])\n setAcao(!acao)\n //await AsyncStorage.setItem('@pedido', JSON.stringify(pedido));\n }", "function insertCartPurchase(product,cart,index){\r\n\tlet id = cart._id;\r\n\t$('#divCartProduct').append('<div class=\"product\" id=\"cartProduct' + id + '\"></div>');\t\r\n\t$('#cartProduct'+id).append('<img alt=\"Foto do Produto\" class=\"postImage\" src=\"' + product.obj.picture + '\">');\r\n\t$('#cartProduct'+id).append('<h3>' + product.obj.name + '</h3>');\r\n\t$('#cartProduct'+id).append('<h3>' + 'R$' + product.obj.price + '</h3>');\r\n\t$('#cartProduct'+id).append('<input class=\"inputStyle1 removeProduct\" onclick=\"remove('+id+');\" type=\"submit\" value=\"Remover produto\">');\r\n\t$('#cartProduct'+id).append('<input class=\"inputStyle2\" type=\"text\" id=\"text'+id+'\" value=\"'+ cart.obj.qtd + '\">');\r\n\t$('#cartProduct'+id).append('<input class=\"inputStyle1 addProduct\" onclick=\"changeAmountLess('+id+');\" type=\"submit\" value=\"<\">');\r\n\t$('#cartProduct'+id).append('<input class=\"inputStyle1 addProduct\" onclick=\"changeAmountMore('+id+');\" type=\"submit\" value=\">\">');\r\n}", "function quanitityToCart(product) {\n let value = parseInt($(\"#amountOfBeer\").val());\n let isProductInCart = 0;\n for (let i = 0; i < cart.length; i++) {\n if (product.id === cart[i].id) {\n cart[i].inCart += value;\n isProductInCart++;\n }\n }\n if (isProductInCart == 0) {\n product.inCart = value;\n cart.push(product);\n }\n saveToLS();\n renderCart();\n}", "function addItem(product) {\n // Recuperer les donnees dans le localstorage\n let cart = JSON.parse(localStorage.getItem(\"cart\")) || [];\n // Creation d'une variable avec les elements que je souhaite afficher\n let newProduct = {\n id: id,\n name: product.name,\n imageUrl: product.imageUrl,\n price: product.price / 100,\n color: color.value,\n qty: parseInt(select.value)\n };\n console.log(newProduct);\n //console.log(select);\n //console.log(color);\n\n // Creation d'une variable pour que mon produit ne soit pas doubler\n let productAlReadyInCart = false;\n // Je boucle tout les produits\n for (let i = 0; i < cart.length; i++) {\n //Si l'id = \"newPoduct.id\" et color = newProduct.color,un nouveau produit se crée si l'id et la couleur changent\n if (cart[i].id === newProduct.id && cart[i].color === newProduct.color) {\n console.log(\"le produit existe deja\");\n productAlReadyInCart = true;\n // On ajoute la quantité au produit qui existe deja\n cart[i].qty += newProduct.qty;\n cart[i].price = newProduct.price;\n }\n }\n //Si le produit n'existe pas , on rajoute un nouveau au panier\n if (productAlReadyInCart === false) {\n // J'ajoute l'element \"cart\" à l'element \"newProduct\"\n cart.push(newProduct);\n }\n //Je stock les nouvelles donnees\n localStorage.setItem(\"cart\", JSON.stringify(cart));\n //une fenêtre alert apparait lorsqu'on ajoute un produit dans le panier\n alert(\"Vous avez ajouté ce produit dans votre panier: \" + product.name)\n //console.log(cart)\n}", "function addtocart(t) {\r\n var i = t.parentNode.rowIndex;\r\n var arr = productParts[i - 1];\r\n var carProduct = new Product(arr.productName, arr.Price, arr.Inventory, arr.Supplier, arr.Description, arr.img);\r\n productcart.push(carProduct);\r\n localStorage.setItem(\"productcart\", JSON.stringify(productcart));\r\n displaycartProduct(productcart);\r\n}", "function addToCart() {\n console.log(\"toto\");\n let productsInCart = JSON.parse(localStorage.getItem(\"identifiants\"));\n /*Si le panier est vide*/\n if (productsInCart === null) {\n productsInCart = new Array();\n localStorage.setItem(\"identifiants\", JSON.stringify(productsInCart));\n }\n /*Récupère la quantité de l'objet */\n let selectQuantity = document.getElementById(\"productQuantity\");\n let selectedQuantity = selectQuantity.options[selectQuantity.selectedIndex].value;\n /*Créé un objet contenant la quantité et l'idée de l'objet*/\n let item = {\n \"id\": name,\n \"quantity\": selectedQuantity,\n };\n /*Permet de modifier la quantité d'un article donné sans ajouter le même identifiant*/\n if (canAddItem(productsInCart, name)) {\n productsInCart.push(item);\n } else {\n for (item in productsInCart) {\n if (productsInCart[item].id == name) {\n productsInCart[item].quantity = parseInt(productsInCart[item].quantity) + parseInt(selectedQuantity);\n }\n }\n }\n localStorage.setItem(\"identifiants\", JSON.stringify(productsInCart));\n}", "function addCart(camera) {\n // CHECK SI UN PANIER EXISTE DEJA\n const cart = JSON.parse(sessionStorage.getItem(\"panier\"))\n ? JSON.parse(sessionStorage.getItem(\"panier\"))\n : [];\n\n let newProduct = {\n id: camera._id,\n img: camera.imageUrl,\n name: camera.name,\n price: camera.price,\n totalProduct: 1,\n };\n\n //AJOUT PRODUIT AU PANIER - INCREMENTE SI DEJA EN PANIER\n document.getElementById(\"add-button\").addEventListener(\"click\", () => {\n const productIsInCart = cart.findIndex(\n (product) => product.name == newProduct.name\n );\n if (productIsInCart != -1) {\n cart[productIsInCart].totalProduct += 1;\n sessionStorage.setItem(\"panier\", JSON.stringify(cart));\n } else {\n cart.push(newProduct);\n sessionStorage.setItem(\"panier\", JSON.stringify(cart));\n }\n document.location.reload();\n });\n}", "function displayProductsInCart() {\n for (let i = 0; i < productInCart.length; i ++) {\n const templateCart = document.getElementById('templateCart');\n const cloneElement = document.importNode(templateCart.content, true);\n \n cloneElement.getElementById(\"basket__image\").src = productInCart[i].image;\n cloneElement.getElementById(\"basket__name\").textContent = productInCart[i].name;\n cloneElement.getElementById(\"basket__id\").textContent = `Réf : ` + productInCart[i].id;\n cloneElement.getElementById(\"basket__price\").textContent = (productInCart[i].price).toLocaleString(\"fr-FR\", {style:\"currency\", currency:\"EUR\"});\n cloneElement.getElementById(\"basket__option\").textContent = productInCart[i].option;\n cloneElement.getElementById(\"basket__quantity\").textContent = productInCart[i].quantity;\n \n document.getElementById(\"basketTable\").appendChild(cloneElement);\n }\n // Contrôle des boutons \"Quantité\"\n reduceQuantity();\n increaseQuantity();\n deleteProduct();\n}", "function addCart(id_articulo) {\n let arr_tmp = [];\n\n /**** ALMACENAR EN UN ARREGLO LOS DATOS QUE TENEMOS EN EL localStorage ****/\n if(in_storage) {\n arr_tmp.push(JSON.parse(localStorage.getItem(\"articulo\")));\n }\n\n /* CON EL METODO find DEL ARREGLO BUSCAMOS EL ARTICULO, ESTE METODO RECIBE COMO PARAMETRO UNA FUNCION,\n EN ESTE CASO LE ESTAMOS PASANDO UNA FUNCION DE FLECHA Y LE PASMOS UN PARAMETRO (id_find)\n ESTE METODO GUARDARA EN FORMATO JSON LOS DATOS ENCONTRADOS EN LA CONSTANTE resultado, ESTA BUSQUEDA\n SE HARA MEDIANTE EL ID (VARIABLE id_articulo), EN CASO DE QUE EL ID QUE BUSQUEMOS NO EXISTA NOS REGRESARÁ\n EL VALOR DE undefined */\n const resultado = articulos.find(id_find => id_find.id == id_articulo );\n\n /**** ANTES DE AGREGAR AL ARREGLO EL CONTENIDO DE LA CONSTANT resultado USA UN IF PARA COMPROBAR\n QUE ESTA NO SEA undefined ****/\n arr_tmp.push(resultado);\n\n localStorage.setItem(\"articulo\", JSON.stringify(arr_tmp));\n}", "add() {\n\t\torinoco.cart.add({ imageUrl: this.imageUrl, name: this.name, price: this.price, _id: this._id });\n\t}", "function addToCart(id) {\n var troba=false;\n if(cart.length==0){\n cart.push(products[id-1]);\n cart[0].quantity=1;\n }\n else if(cart.length>0){\n for(var i=0; i<cart.length; i++){\n if(products[id-1].name==cart[i].name){\n troba=true;}\n if(troba){\n cart[i].quantity++;}\n }\n if(troba==false){\n cart.push(products[id-1]);\n cart[cart.length-1].quantity=1;\n }\n }\n for( let i=0; i<cart.length; i++){\n cart[i].subtotal=cart[i].quantity*cart[i].price;\n }applyPromotionsCart();\n \n}", "function addTeddyToCart() {\n \n let teddyCart = getCart()\n \n teddyCart.push(teddyChoisi)\n\n localStorage.setItem('teddyCart', JSON.stringify(teddyCart))\n localStorage.getItem('teddyCart')\n window.location.assign('page3.html')\n}", "displayCart() {\n const productsInCart = JSON.parse(localStorage.getItem('cart'));\n if (productsInCart) {\n // Si le panier n'est pas vide\n let productsToDisplay = [];\n const request = new Request();\n request.getJson(\"/api/cameras/\")\n .then(camerasFromDatabase => {\n productsInCart.map(product => {\n // Pour chaque item dans le panier, on cherche la caméra correspondante dans la base de données\n const matchingCamera = camerasFromDatabase.filter(camera => camera._id == product.id)[0];\n // On ajoute les bonnes infos à afficher\n productsToDisplay.push({\n \"id\": product.id,\n \"name\": matchingCamera.name,\n \"lenseId\": product.lenseId,\n \"lenseName\": matchingCamera.lenses[product.lenseId],\n \"quantity\": product.quantity,\n \"price\": matchingCamera.price\n })\n })\n // Construction du tableau html\n const build = new BuildHtml();\n build.cart(productsToDisplay);\n // Ajout de l'event listener pour la suppression de 1 produit\n const deleteBtns = document.querySelectorAll(\"#cartTableBody td:last-child\");\n for (const deleteBtn of deleteBtns) {\n deleteBtn.addEventListener('click', function() {\n const cart = new Cart();\n cart.delete1Item(this);\n });\n }\n // Ajout de la liste des id qui sera envoyée pour la commande\n let idList = []\n productsToDisplay.map(product => {\n for (let i = 0; i < product.quantity; i++) {\n idList.push(product.id) \n }\n })\n build.addProductListToForm(idList);\n })\n .catch(error => {\n const build = new BuildHtml();\n const errorDiv = build.errorMessage();\n const targetDiv = document.getElementById('cartTable');\n targetDiv.innerText = \"\";\n targetDiv.appendChild(errorDiv);\n })\n document.querySelector(\".cart--btn__purchase\").disabled = false;\n\n } else {\n // Si le panier est vide\n document.getElementById(\"cartTable\").innerHTML = '<p class=\"cart--empty-cart\">Votre panier est vide !</p>';\n document.querySelector(\".cart--btn__purchase\").disabled = true;\n }\n }", "async createCart_Of_User(req, res, next){\n // try {\n // const {userId} = req.value.params\n // // tạo mới 1 hóa đơn \n // const newHoaDon = new hoaDon(req.body)\n // // lấy thông tin user sở hữu cái hóa đơn đó.\n // const user = await User.findById(userId)\n\n // // gán cái hóa đơn đó cho thằng user đã lấy id\n // newHoaDon.user = user \n\n // // Save hóa đơn đó lại \n // await newHoaDon.save()\n\n // // đẩy cái id hóa đơn đó vào cho thằng user.\n // user.hoaDon.push(newHoaDon._id)\n // // sau khi push giá trị mới vào thì ta phải lưu lại cho nó\n // await user.save()\n // return res.json(newHoaDon)\n\n // } catch (error) {\n // next(error)\n // }\n }", "saveItem(id, price, urlImg, name) {\n //obtiene la cantidad escogida del producto selecccionado\n var cantidad =\n document.getElementById(\"quantity\" + id).value === \"\"\n ? 1\n : document.getElementById(\"quantity\" + id).value;\n //obtiene el estado de carrito de compra\n const arreglo = this.state.cartDetails;\n\n if (arreglo.length === 0) {\n //SI el carrito viene vacio...\n //crea el objeto...\n var objeto = {\n quantity: cantidad,\n unitValue: price,\n idVarianteProducto: id,\n urlImg: urlImg,\n name: name,\n };\n //y lo ingresa al arreglo del carrito\n arreglo.push(objeto);\n } else {\n //SI el carrito no viene vacio\n //crea booleano que verifica que el nuevo dato no existe en el actual arreglo\n var flag = true;\n //se revisa el arreglo para comprobar que el nuevo producto existe en el carrito\n arreglo.forEach(function (elemento) {\n if (elemento.idVarianteProducto === id) {\n //si encuentra el producto...\n elemento.quantity = cantidad; //actualiza a cantidad...\n flag = false; //y el booleano se cambia a false pues el nuevo dato si existe en el actual arreglo\n }\n });\n if (flag === true) {\n //si el booleano no cambio, significa que el nuevo dato no existia en el actual arreglo\n //crea el objeto...\n var objeto1 = {\n quantity: cantidad,\n unitValue: price,\n idVarianteProducto: id,\n urlImg: urlImg,\n name: name,\n };\n //y lo ingresa al arreglo del carrito\n arreglo.push(objeto1);\n }\n }\n //renueva el estado cartDetail con el nuevo carrito recien modificado\n this.setState({ cartDetails: arreglo });\n //porcede a contar la cantidad total de productos para mostrarlo en el Badge del boton carrito\n this.contarCantidadTotal();\n }", "function addCart(id){\n const check = data.items.every(item => {\n return item.id !== id\n })\n\n \n\n if(check){\n\n // Verifico si el ID del producto es el mismo del clickeado\n data.items.filter(product => {\n return product.id === id\n })\n\n // Atualizo el context\n setData(\n {...data,\n cantidad: data.cantidad + counter,\n items: [...data.items, item],\n total: data.total + (item.precio * counter)\n }\n ) \n\n // Mensaje de confirmación \n setMessage(Swal.fire({\n position: 'center',\n icon: 'success',\n title: 'Producto agregado',\n text: \"Tu producto fue agregado al carrito\",\n showDenyButton: false,\n showCancelButton: true,\n showConfirmButton: true,\n confirmButtonText: `Ir al carrito`,\n cancelButtonText: `Seguir comprando`,\n }).then(res =>{\n if(res.isConfirmed){\n setRedirect(true)\n }\n })\n )\n\n }else{\n // // Mensaje de que el producto ya se agrego al carrito\n setMessage(Swal.fire({\n position: 'center',\n icon: 'warning',\n title: 'El producto ya fue agregado al carrito',\n }))\n }\n \n }", "addOrder() {\n\n /* order musi mit user _id, a veci v cart */\n const db = getDb();\n\n return this.getCart().then(products => {\n\n const order = {\n items: products,\n user: {\n _id: new ObjectId(this._id),\n name: this.username,\n }\n };\n \n /* vytvorime v orders novy zaznam - cart */\n return db.collection('orders').insertOne(order)\n })\n .then(result => {\n /* vysypeme cart zde v js */\n this.cart = {items: []};\n\n /* vymazeme cart v db pro daneho usera */\n return db\n .collection('users')\n .updateOne(\n {_id: new ObjectId(this._id)}, \n { $set: { cart: {items: []} } });\n });\n\n }", "function addItemToCart() {}", "function addItemToCart() {}", "function addtoCart(id,price,name){\r\r\r\r\r\r\n ///obtememos la cantidad a agregar al carrito\r\r\r\r\r\r\n var cantidad = $(\"#eitem\"+id).val();\r\r\r\r\r\r\n console.log(cantidad);\r\r\r\r\r\r\n if(cantidad>0){\r\r\r\r\r\r\n $.post('/officium/web/ecar/addToCart',\r\r\r\r\r\r\n {\r\r\r\r\r\r\n 'id_producto':id,////id del producto\r\r\r\r\r\r\n 'cantidad':cantidad,/// cantidad\r\r\r\r\r\r\n 'price':price,\r\r\r\r\r\r\n 'name':name\r\r\r\r\r\r\n },\r\r\r\r\r\r\n function(result){ ////verificamos el resultado\r\r\r\r\r\r\n if(result>0){\r\r\r\r\r\r\n ////recontamos los productos en el carrito de compras\r\r\r\r\r\r\n console.log('Item agregado al carrito');\r\r\r\r\r\r\n ////cambiamos la cantidad de productos en el carrito\r\r\r\r\r\r\n ecarCount();\r\r\r\r\r\n floatcarDisplay();\r\r\r\r\r\r\n }else{\r\r\r\r\r\r\n alert('Error al agregar el producto. Contacte a su asesor de ventas'+result);\r\r\r\r\r\r\n }\r\r\r\r\r\r\n });\r\r\r\r\r\r\n }\r\r\r\r\r\r\n}///end of function", "function addToCart(prod_id) {\n console.log(products.data);\n let product = products.find((item) => {\n return item.prod_id == prod_id;\n });\n \n cart.push(product);\n \n localStorage.setItem(\"cart\", JSON.stringify(cart));\n renderCart(storedCartitems);\n \n console.log(prod_id);\n \n \n}", "function saveCart(){\n sessionStorage.setItem('revonicCart', JSON.stringify(cart)); // saving data after converting it to JSON strings using JSON stingify. \n \n }", "function addToCart()\n\t{\n\t\t// avoid adding to cart before the item info is fetched\n\t\t// if( product.ASIN === undefined) return ;\n\t\tif( product === undefined) return ;\n\t\t\n\t\tvar newItem = Object.assign({}, product); \n\t\tnewItem.ID \t\t= Date.now();\n\t\t\n\t\t// console.log( \"product id: \" + newItem.ID );\n\t\tnewProduct = \"<tr>\"\n\t\t\t\t\t\t+ \"<td><img src=\\\"\"+ newItem.Image_url + \"\\\" class=\\\"thumbnail\\\" /> </td>\"\n\t\t\t\t\t\t+ \"<td>\"+ newItem.Color\t\t\t+\"</td>\"\n\t\t\t\t\t\t+ \"<td>\"+ newItem.Size\t\t\t+\"</td>\"\n\t\t\t\t\t\t+ \"<td>\"+ newItem.PriceSAR\t\t+\" ريال</td>\"\t\t\t\t\t\t\n\t\t\t\t\t\t+ \"<td>\"+ newItem.TaxSAR\t\t+\" ريال</td>\"\t\t\t\t\t\t\n\t\t\t\t\t\t+ \"<td>\"+ newItem.ShippingCost\t+\" ريال </td>\"\t\t\t\t\t\t\n\t\t\t\t\t\t+ \"<td> <i class='fi-x removeItem button alert' id='\"+ newItem.ID +\"'></i></td>\"\n\t\t\t\t\t\t+ \"</tr>\";\n\t\t\t\t\t\t\n\t\t$('#items > tbody:last-child').append(newProduct);\n\t\t$(\"#addToCartBtn\").notify(\"تم إضافته لسلة المشتريات\", {className:\"success\"});\n\t\t$(\"#itemsList\").slideDown();\n\t\t\n\t\t// save cart\n\t\tsaveCart(\"add\", newItem.ID);\n\t\t\n\t\t// start observer for remove from cart button\n\t\tobserveRemoveBtn();\n\t\t\n\t\t// add to invoice\n\t\taddToInvoice(newItem);\n\t}", "createCart() {\n return this.getAccountDetails().then(\n (accountDetails) =>\n this.OvhApiOrderCart.post({\n ovhSubsidiary: accountDetails.ovhSubsidiary,\n }).$promise,\n );\n }", "function addCart(id) {\n //info productos\n let data = localStorage.getItem(\"products\");\n let cart = JSON.parse(data);\n let inCart = [...cart];\n modalContainer.innerHTML = \"\";\n modal();\n //info cart\n\n inCart.map((e) => {\n if (id === e.id) {\n console.log(\"stock producto\", e.stock);\n\n //SI NO HAY STOCK\n if (e.stock === 0) {\n console.log(\"no hay stock\");\n return;\n }\n //SI HAY STOCK\n if (e.stock >= 1) {\n //RESTAR 1 AL STOCK\n e.stock = e.stock - 1;\n let actualStock = e.stock - 1;\n //GUARDAR EN LOCAL STORAGE\n localStorage.setItem(\"products\", JSON.stringify(inCart));\n\n if (localStorage.getItem(\"newProducts\")) {\n sumQuantity(id, actualStock, e);\n }\n\n console.log(\"old\", inCart);\n\n containerProducts.innerHTML = \"\";\n showProduct(cart);\n exist = false;\n }\n }\n });\n}", "addCarting({commit, state}, products) {\n // verify if the 'product' is or not add in the 'carting'. This 'hasOwnProperty' method returns \n // a boolean indicating whether the object has the specified property\n hasOwnProperty.call(state.carting, products.id) \n ? products.amount = state.carting[products.id].amount + 1\n : products.amount = 1;\n //console.log(products.amount);\n // pushing to \"mutation\"\n commit('setCarting', products);\n }", "OnAddCart(product) {\n // this.flashMessageService.show('Product added to cart!', {cssClass:'alert-success', timeout: 4000});\n console.log(product);\n this.productAddedToCart = this.getProductFromCart();\n\n if (this.productAddedToCart == null) {\n console.log(\"This array is empty\");\n this.productAddedToCart = [];\n this.productAddedToCart.push(product);\n this.addProductToCart(this.productAddedToCart);\n console.log('Product added to cart');\n } else {\n let tempProduct = this.productAddedToCart.find(p => p.product_Name == product.product_Name);\n\n if (tempProduct == null) {\n this.productAddedToCart.push(product);\n this.addProductToCart(this.productAddedToCart);\n console.log('Product added to cart.');\n } else {\n tempProduct.product_Quantity++; // this.productAddedToCart.find(p=>p.id==product.id).product_Quantity = product.product_Quantity +1;\n\n this.addProductToCart(this.productAddedToCart);\n }\n }\n }", "afegirCistella(id, quant, preu, decimalsPreu, decimalsPreuSenseIva, descripcio, desc, codi,imatge, ivaId, preuCataleg, preuSenseIvaCataleg, preuSenseIva ) {\n\n\n if (localStorage.getItem(\"productesCart\") === null) {\n const productes = [{\"codi\" : id, \"unitats\" : quant, \"preu\" : preu, \"decimalsPreuCataleg\" : decimalsPreu, \"decimalsPreuSenseIva\" : decimalsPreuSenseIva , \"descripcio\": descripcio,\"descripcioCurta\" : desc , \"id\" : codi , \"imatge\" : imatge , \"ivaId\" : ivaId, \"preuCataleg\" : preuCataleg , \"preuSenseIvaCataleg\" : preuSenseIvaCataleg, \"preuSenseIva\" : preuSenseIva}];\n localStorage.setItem(\"productesCart\", JSON.stringify(productes));\n } else {\n\n const productesCart = JSON.parse(localStorage.getItem(\"productesCart\"));\n const trobat = this.trobarArticleCart(productesCart, id);\n\n if (trobat >= 0) {\n productesCart[trobat][\"unitats\"] += quant;\n\n } else {\n productesCart.push({\"codi\" : id, \"unitats\" : quant, \"preu\" : preu, \"decimalsPreuCataleg\" : decimalsPreu, \"decimalsPreuSenseIva\" : decimalsPreuSenseIva , \"descripcio\": descripcio,\"descripcioCurta\" : desc , \"id\" : codi , \"imatge\" : imatge , \"ivaId\" : ivaId, \"preuCataleg\" : preuCataleg , \"preuSenseIvaCataleg\" : preuSenseIvaCataleg, \"preuSenseIva\" : preuSenseIva});\n\n }\n\n localStorage.setItem(\"productesCart\", JSON.stringify(productesCart));\n \n }\n\n const contador = this.contarArticles();\n this.setState({ carritoCount: contador })\n localStorage.setItem(\"count\", contador);\n this.calcularTotal();\n\n\n }", "insertarCarrito(producto){\n const row = document.createElement('tr');\n row.innerHTML = `\n <td>\n <img src=\"${producto.imagen}\" width=100>\n </td>\n <td>${producto.titulo}</td>\n <td>${producto.precio}</td>\n <td>\n <a href=\"#\" class=\"borrar-producto fas fa-times-circle\" data-id=\"${producto.id}\"></a>\n </td>\n `;\n listaProductos.appendChild(row);\n this.guardarProductosLocalStorage(producto);\n }", "function addToCartClicked(e){\n const button = e.target;\n const item = button.closest(\".detalle__compra\");\n const itemPrecio = Number(item.querySelector(\".precio\").textContent.replace(\"$\",\"\"));\n const itemProdId = Number(item.querySelector(\".idProdCarrito\").textContent);\n const precios = item.querySelector(\"#precios\");\n const cantidad = item.querySelector(\"#cantidad\");\n itemCantidad= Number(cantidad.value)+1;\n cantidad.value = itemCantidad;\n nuevasub = nuevasub +itemPrecio;\n sumaItem(itemProdId,itemCantidad);\n precios.innerHTML = `<p>\n $${cantidad.value * itemPrecio}\n </p>`\n subTotal.innerHTML = `<h3>Subtotal</h3>\n <p>$${nuevasub}</p>`\n total.innerHTML = `<h2>Total</h2>\n <p>$${nuevasub}</p>`\n}", "function displayCart(teddies) {\n\n // Selection de la classe ou je vais injecter le code HTML\n const positionPanier = document.querySelector(\"#table-produits-panier\")\n\n let html = \"\";\n teddies.forEach(teddy => \n html += `\n <tbody id=\"cart-tablebody\" class=\"font-weight-bold\">\n <tr class=\"\">\n <td class=\"text-center\">\n <span class=\"text-danger font-weight-bold text-center\">${teddy.name}\n </td>\n <td class=\"text-center\">\n ${teddy.qty}\n </td>\n <td class=\"text-center price-teddy\">\n ${price(teddy.price * teddy.qty)}\n </td>\n <td class=\"text-center\">\n <button class=\"btn btn-danger btnDelete\">Supprimer</button>\n </td>\n </tr>\n </tbody>\n `\n )\n \n\n //Injection html dans la page panier\n positionPanier.innerHTML = html \n deleteProduct()\n deleteAllProduct()\n priceTotal(teddies)\n sendForm()\n}", "function applyPromotionsCart() {\n for( let i=0; i<cart.length;i++){\n if(cart[i].name=='cooking oil'&cart[i].quantity>=3){\n cart[i].subtotalWithDiscount=cart[i].quantity*10; //afegim l'atribut subtotalWithDiscount per l'oferta a l'oli\n }else if(cart[i].name=='Instant cupcake mixture'&cart[i].quantity>=10){\n cart[i].subtotalWithDiscount=(cart[i].subtotal*2)/3; //afegim l'atribut subtotalWithDiscount per l'oferta a la mescla per pastís\n }else{cart[i].subtotalWithDiscount='No discount'} //afegim l'atribut subtotalWithDiscount sense discount per a la resta de productes \n }\n console.log(cart);\n \n}", "addToCart (productt) {\n checkRepeated(productt) \n added()\n console.log(productt)\n }", "function addSelectedItemToCart() { \n var itemsEl = document.getElementById('items').value;\n var quantityEl = document.getElementById('quantity').value;\n cart.addItem(itemsEl, parseInt(quantityEl));\n // console.log(cart.items[0].product);\n // console.log(cart.items[0].quantity); \n}", "function displayCart() {\n\n if (localStorage.getItem('cartProducts') !== null) {\n let products = JSON.parse(localStorage.getItem('cartProducts'));\n total = 0; // Réinitialisation du total à 0\n\n section.insertAdjacentHTML(\"afterbegin\", `\n <h2>Panier</h2>\n <table class=\"cart-section__table\" style=\"margin-top:50px;display:flex;flex-direction:column;align-items:center;\">\n <thead>\n <tr>\n <th>Image</th> \n <th>Désignation</th>\n <th>Lense</th>\n <th>Quantité</th>\n <th>Prix</th>\n <th>Supprimer</th>\n </tr>\n </thead>\n <tbody class=\"cart-section__commande\">\n </tbody>\n </table>\n \n `);\n\n let commande = document.querySelector(\".cart-section__commande\");\n\n products.forEach( (product, index) => {\n \n total = total + (product.price * product.quantity);\n\n \n commande.insertAdjacentHTML(\"beforeend\", `\n <tr>\n <td><img src=\"${product.imageUrl}\" alt=\"photo camera\" style=\"width:70px;border: 2px solid black;\"></td>\n <td>${product.name}</td>\n <td>${product.selectedLense}</td>\n <td><button class=\"cart-section__remove product-${index}\">-</button>${product.quantity}<button class=\"cart-section__add product-${index}\">+</button></td>\n <td>${(product.price * product.quantity/100).toFixed(2).replace(\".\",\",\")} €</td>\n <td><button class=\"cart-section__delete product-${index}\">X</button></td>\n </tr>\n \n `);\n })\n\n \n section.insertAdjacentHTML(\"beforeend\", `\n <div class=\"total\">\n <p class=\"cart-section__total\">Total : ${(total/100).toFixed(2).replace(\".\",\",\")} €</p>\n <button class=\"cart-section__cancelCart\">Annuler le panier</button>\n </div>\n `);\n\n\n\n/*formulaire de contact pour valider la commande*/\n section.insertAdjacentHTML(\"beforeend\", `\n <div class=\"formulaire\" style=\"text-align:start;\">\n <p class=\"\">Formulaire à remplir pour valider la commande : </p>\n <form class=\"cart-form\" action=\"post\" type=\"submit\">\n <div class=\"cart-form__group\">\n <label for=\"firstname\">Prénom : </label>\n <input id=\"firstname\" type=\"text\" placeholder=\"Votre prénom\" maxlength=\"30\" pattern=\"[A-Za-z]{2,}\" required />\n </div>\n <div class=\"cart-form__group\">\n <label for=\"name\">Nom : </label>\n <input id=\"name\" type=\"text\" placeholder=\"Votre nom\" maxlength=\"50\" pattern=\"[A-Za-z]{2,}\" required />\n </div>\n <div class=\"cart-form__group\">\n <label for=\"address\">Adresse : </label>\n <input id=\"address\" type=\"text\" placeholder=\"Votre adresse\" maxlength=\"200\" required />\n </div>\n <div class=\"cart-form__group\">\n <label for=\"city\">Ville : </label>\n <input id=\"city\" type=\"text\" placeholder=\"Votre ville\" maxlength=\"30\" required />\n </div>\n <div class=\"cart-form__group\">\n <label for=\"email\">Email : </label>\n <input id=\"email\" type=\"email\" pattern=\"[a-z0-9._%+-]+@[a-z0-9.-]+[.][a-z]{2,4}\" placeholder=\"[email protected]\" maxlength=\"30\" required />\n </div>\n <button id=\"submit-btn\" style=\"border:2 solid black;border-radius:2rem;padding:2px;margin:10px;background-color:#c20aa3;color:#fff;\">Valider le panier</button>\n </form>\n </div>\n `);\n\n \n const removeOneBtn = document.querySelectorAll(\".cart-section__remove\");\n removeOneBtn.forEach((btn) => {\n btn.addEventListener('click', e => {\n removeOneProduct(e, products);\n })\n })\n\n const addOneBtn = document.querySelectorAll(\".cart-section__add\");\n addOneBtn.forEach((btn) => {\n btn.addEventListener('click', e => {\n addOneProduct(e, products);\n })\n })\n \n const deleteBtn = document.querySelectorAll(\".cart-section__delete\");\n deleteBtn.forEach((btn) => {\n btn.addEventListener('click', e => {\n deleteProduct(e, products);\n });\n });\n\n const cancelCartBtn = document.querySelector(\".cart-section__cancelCart\");\n cancelCartBtn.addEventListener('click', () => {\n cancelCart();\n });\n \n const form = document.querySelector(\".cart-form\");\n form.addEventListener('submit', e => {\n e.preventDefault();\n submitForm();\n });\n\n } else {\n section.insertAdjacentHTML(\"afterbegin\", `\n <h2>Panier</h2>\n <p class=\"cart-section__vide\">\n Votre panier est vide ! \n <br/>\n <a href=\"./index.html\">Revenir à la page d'accueil</a>\n </p>\n `)\n }\n}", "function generarCarta() {\n carta = cartaRandom();\n let existencia = 0;\n for (prueba in cartas) {\n if (carta.numero === prueba.numero && carta.palo === prueba.palo) {\n existencia += 1;\n }\n }\n if (existencia === 0) {\n return carta;\n }\n else {\n carta = generarCarta();\n }\n }", "function contendor(cardinfo) {\n const contentCart = document.getElementById('shoppingCart');\n const divsubpadre = document.createElement('div');\n divsubpadre.setAttribute('class', 'shoppingCart__content clearfix');\n const shoppingCartcontentimg = document.createElement('div');\n shoppingCartcontentimg.setAttribute('class', 'shoppingCart__content--img');\n const img = document.createElement('img');\n img.setAttribute('src', `img/${cardinfo.img}.png`);\n img.setAttribute('alt', `${cardinfo.name}`);\n const shoppingCartcontenttitle = document.createElement('div');\n shoppingCartcontenttitle.setAttribute('class', 'shoppingCart__content--title');\n const parrafo = document.createElement('p');\n parrafo.innerHTML = `${cardinfo.name}`;\n const shoppingCartcontentinfo = document.createElement('div');\n shoppingCartcontentinfo.setAttribute('class', 'shoppingCart__content--info');\n const parrafoinfo = document.createElement('p');\n parrafoinfo.setAttribute('class','info--amount');\n parrafoinfo.innerHTML = '1';\n const parrafocost = document.createElement('p');\n parrafocost.setAttribute('class','info--cost');\n parrafocost.innerHTML = `${cardinfo.priceProduct}`;\n const boton = document.createElement('button');\n boton.setAttribute('id', `delete-${cardinfo.id}`);\n boton.setAttribute('class', 'info--button');\n boton.dataset.taskId = cardinfo.id;\n boton.innerHTML = 'X';\n\n shoppingCartcontentimg.appendChild(img);\n divsubpadre.appendChild(shoppingCartcontentimg);\n shoppingCartcontenttitle.appendChild(parrafo);\n divsubpadre.appendChild(shoppingCartcontenttitle);\n shoppingCartcontentinfo.appendChild(parrafoinfo);\n shoppingCartcontentinfo.appendChild(parrafocost);\n shoppingCartcontentinfo.appendChild(boton);\n divsubpadre.appendChild(shoppingCartcontentinfo);\n contentCart.appendChild(divsubpadre);\n boton.addEventListener('click', (event) => {\n const taskId = event.currentTarget.dataset.taskId;\n deleteproduct(taskId);\n event.currentTarget.parentNode.parentNode.remove();\n });\n}", "insertRepair(repair) {\n // agregar un dato al final de la lista, como recibe un objeto del tipo Product , puede acceder a sus propiedades\n this.repairList.push({\n name: repair.name,\n dui: repair.dui,\n vehicle: repair.vehicle,\n price: repair.price\n });\n }", "function addToCart() {\n let cameraOnPage = {\n name: cameraName.innerText,\n option: cameraSelectOption.value,\n price: cameraPrice.innerText,\n id: cameraId,\n count: 1,\n };\n\n //recuperation du local storage ou creation d'un array vide contenant les cameras\n const cameras = JSON.parse(localStorage.getItem(\"cameras\")) || [];\n\n //verification et recuperation d'une camera en particulier si elle existe deja (option + nom ) dans l'array cameras\n let cameraOnPagePresentInLocalStorage = cameras.find((camera) => {\n if (\n camera.name === cameraOnPage.name &&\n camera.option === cameraOnPage.option\n )\n return true;\n });\n // incrementation du \"count\" de la camera recuperee au-dessus\n if (cameraOnPagePresentInLocalStorage !== undefined) {\n cameraOnPagePresentInLocalStorage.count += 1;\n } else {\n cameras.push(cameraOnPage);\n }\n localStorage.setItem(\"cameras\", JSON.stringify(cameras));\n console.log(cameras);\n }", "plainAddToCart(payload){\n this.$store.dispatch('cart/create', payload)\n .then(() => {\n this.inCart.push(this.product.id)\n this.product.InCart = true\n })\n }", "function addProductToCart(product) {\n let cart = getCart();\n cart.items.push(product);\n\n setCart(cart);\n alert(product.name + ' added to cart, Total is R' + getTotal(cart));\n}", "function addToCart(newItem) {\n console.log(newItem);\n const index = findCartItem(\n newItem.product.id,\n newItem.toppings,\n newItem.remark\n );\n\n if (index === -1) {\n setCart([...cart, { ...newItem, id: uuidV4() }]);\n } else {\n return -1;\n }\n }", "insertarCarrito(producto){\n const row = document.createElement('tr');\n row.innerHTML = `\n <td><img src=\"${producto.imagen}\" width=100></td> \n <td>${producto.titulo}</td>\n <td>${producto.precio}</td> \n <td><a href=\"#\" class=\"borrar-producto fas fa-times-circle\" data-id=\"${producto.titulo}\"></a></td>\n `;\n listaProductos.appendChild(row);\n this.guardarProductosLocalStorage(producto);\n }", "function addAnotherProductToCart(event) {\n let productname = event.dataset.productname;\n let product = myCart.find(element => element.product === productname);\n product.amount++;\n //update the amount html\n updateProductAmountHtml(productname, product.amount);\n //also update the storage\n saveToStorage(productname, JSON.stringify(product));\n}", "addToCart(itemOptions) {\n this.store.cart.products.push({\n product_id: itemOptions.item,\n price: itemOptions.price || 0,\n total: itemOptions.price || 0,\n quantity: itemOptions.quantity || 1,\n offer: itemOptions.offer || null,\n materials: itemOptions.config ? itemOptions.config.split(',') : [],\n description: \"\",\n comment: itemOptions.comment\n });\n }", "function insertarElemento(producto) {\r\n const {\r\n nombre,\r\n imagen,\r\n precio,\r\n cantidad,\r\n id\r\n } = producto;\r\n const divcard = document.createElement('div');\r\n\r\n divcard.innerHTML = `\r\n <div class=\"row mb-3 mt-3\">\r\n <div class=\"col-3\">\r\n <div class=\"\">\r\n <h6>${nombre}</h6>\r\n \r\n </div>\r\n </div>\r\n <div class=\"col-3\">\r\n <div class=\" \">\r\n <img src=\"${imagen}\" width=\"100\" alt=\"\" class=\"rounded\" > \r\n \r\n </div>\r\n </div>\r\n <div class=\"col-2\">\r\n <div class=\"\">\r\n <h6 class=\"\">$${precio}</h6>\r\n </div>\r\n </div>\r\n <div class=\"col-2\">\r\n \r\n <div class=\"\">\r\n \r\n \r\n <a type=\"button\" onclick=\"restarProducto(${id})\" href=\"#\" class=\"restar-producto btn btn-danger\" data-id=\"${id}\"> - </a>\r\n <span>${cantidad}</span>\r\n <a type= \"button\" onclick=\"sumarProducto(${id})\" href=\"#\" class=\"sumar-producto btn btn-success\" data-id=\"${id}\"> + </a>\r\n \r\n\r\n \r\n </div>\r\n </div>\r\n \r\n <div class=\"col-2\">\r\n <div>\r\n <a type=\"button\" href=\"#\" class=\"borrar-producto btn botonborrar\" data-id=\"${id}\">✘</a>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n `\r\n\r\n contenedorCarrito.appendChild(divcard)\r\n}", "function addConeToCart(e) {\n var variation=\"\";\n var mods=[];\n document.querySelectorAll(`#config.cone-builder .cb-options .selected`).forEach((e, i) => {\n if (!i) {\n variation=e.getAttribute('data-id');\n } else {\n if (e.getAttribute('data-id')) mods.push(e.getAttribute('data-id'));\n }\n })\n \n document.getElementById('cone-builder').classList.add('flyout');\n hideConfig();\n cart.add(variation, mods)\n updateCart();\n}", "addToCart({commit}, product) {\n api.addToCart(product.id)\n .then((response) => {\n console.log(response)\n })\n }", "function saveCart() {\n sessionStorage.setItem('shoppingCart', JSON.stringify(productsInCart));\n }", "function transferOrder() {\n var plateName, platePrice, numberOfEachPlate;\n var totalNumberOfPlates = $('#tabelaPedidos tr').length;\n \n\n //cria a tabela da conta e guarda nela os pedidos efetuados\n for (i = 0; i < ordered_plates.length; i++) {\n plateName = ordered_plates[i].name;\n platePrice = ordered_plates[i].price;\n numberOfEachPlate = parseInt(sessionStorage.getItem(plateName));\n \n while(numberOfEachPlate > 0) {\n $(\"#tabelaConta\").append($('<tr>')\n .append($('<td>')\n .text(plateName)\n .addClass(\"tabelaConta\")\n )\n .append($('<td>')\n .text(platePrice +\"€\")\n .addClass(\"tabelaConta\")\n )\n );\n \n //$(\"#tabelaConta\").append(\"<tr><td>\" + plateName + \"</td><td>\" + platePrice + \"€</td></tr>\");\n numberOfEachPlate--;\n totalPrice += platePrice; \n }\n \n sessionStorage.setItem(plateName, 0); //elimina todos os pedidos no menu dos pedidos (internamente)\n $('#pricePlacePersonalizado').text(\"\"+totalPrice);\n\n }\n \n //remove a tabela dos pedidos\n while(totalNumberOfPlates > 0) {\n document.getElementById(\"tabelaPedidos\").deleteRow(totalNumberOfPlates - 1);\n totalNumberOfPlates--;\n }\n }", "function addNew(name, quant, stock) {\n if (!checkStock(quant, stock)) {\n console.log('El stock no es suficiente')\n } else {\n let newItem = {\n product: prod,\n quantity: quant\n };\n cart.push(newProduct);\n jsonCart = {\n \"products\": cart,\n \"total\": cart.length,\n \"inCart\": cant\n };\n localStorage.setItem(\"jsonCart\", JSON.stringify(jsonCart));\n console.log(\"Tu producto fue agregado al carro\");\n }\n}", "function addToCart(newProduct){\n let exist = false;\n\n cart.forEach(product => {\n if(product.product.id == newProduct.product.id){ \n exist = true;\n product.quantity += newProduct.quantity;\n \n }\n })\n if(!exist){ \n \n cart.push(newProduct);\n appendProduct(newProduct);\n }\n\n let $amount = document.getElementById(\"amount\");\n $amount.value = 0; \n}", "function updateCartPreview() {\n // TODO: Get the item and quantity from the form\n let quantity1 = document.getElementById('quantity');\n let iteam1 = document.getElementById('items');\n\n \n // TODO: Add a new element to the cartContents div with that information\n let cartContent = document.getElementById('cartContents');\n let pEle= document.createElement('p');\n pEle.textContent= quantity1.value +\" : \"+ iteam1.value; \n cartContent.appendChild(pEle);\n}", "function addProduit (id, nom, prix) {\n\tlet detailProduit = [id, nom, prix];\n\tcontenuPanier.push(detailProduit);\n\tlocalStorage.panier = JSON.stringify(contenuPanier);\n\tcountProduits();\n}", "saveProduct(productData) {\r\n let nuevoProducto = new Product(productData);\r\n let indice = this._checkExist(productData.code);\r\n console.log(indice);\r\n this._inventory[this._inventory.length] = nuevoProducto;\r\n console.log(nuevoProducto);\r\n console.log(this._inventory);\r\n }", "function insertInCart(course){\n const row = document.createElement('tr');\n row.innerHTML = `\n <td>\n <img src = \"${course.image}\">\n </td>\n <td>\n ${course.title}\n </td>\n <td>\n ${course.price}\n </td>\n <td class=\"cross\">\n <a href = \"#\" class = \"deleteCourse\" data-id = \"${course.id}\">x</a>\n </td>\n ` ;\n listCourses.appendChild(row);\n saveCourseLocalStorage(course);\n}", "function pushProductIntoCart({ id_product, option, quantity }) {\n this.state.guestcart.push({\n id_product: id_product,\n option: option,\n quantity: quantity,\n });\n}", "function ajoutCartes(produits) {\n let artCameras = document.querySelector(\"#article-produits\");\n\n // boucle forEach pour parcourir le tableau recuperé\n\n produits.forEach((item) => {\n let carte = document.createElement(\"article\");\n let image = document.createElement(\"img\");\n let divCarte = document.createElement(\"div\");\n let nomCarte = document.createElement(\"h2\");\n let lienCarte = document.createElement(\"a\");\n\n carte.classList.add(\"card\", \"mx-auto\", \"m-2\");\n carte.style = \"width: 18rem\";\n\n carte.id = item._id;\n image.classList.add(\"card-img\");\n image.alt = \"photo du produit\";\n image.src = item.imageUrl;\n divCarte.classList.add(\"card-body\");\n nomCarte.classList.add(\"card-title\", \"text-center\");\n nomCarte.textContent = item.name;\n lienCarte.classList.add(\"btn\", \"stretched-link\");\n lienCarte.id = \"link\";\n\n //recuperation de l id du produit\n\n lienCarte.href = `/front-end/html/produit.html?${item._id}`;\n lienCarte.textContent = \" Detail de \" + item.name;\n console.log(item._id);\n artCameras.appendChild(carte);\n carte.appendChild(image);\n carte.appendChild(divCarte);\n divCarte.appendChild(nomCarte);\n carte.appendChild(lienCarte);\n });\n}", "function agregarProductoAlCarrito(evento3) {\n console.log(evento3.target.parentNode.parentNode.parentNode.getAttribute('id'));\n let IdProducto = evento3.target.parentNode.parentNode.parentNode.getAttribute('id');\n productosDeMiCarrito.forEach((producto) =>{\n if(producto.id == IdProducto){\n productosCarrito.push(producto);\n console.log(productosCarrito);\n actualizarElCarrito()\n }\n\n localStorage.setItem('productosCarrito', JSON.stringify(productosCarrito));\n })\n}", "function deleteAllCart() {\n if(Object.keys(productInCart).length === 0) return alert('Tidak ada produk di dalam cart!')\n\n // Update database (stok ditambahin ke database lagi)\n for(let id in productInCart) {\n databaseProduct[id].stokProduk += productInCart[id]\n }\n \n productInCart = {} // object kosong\n\n renderCart() // update tampilan cart\n renderProductList() // update product list => stok berubah atau produk hilang\n updateTotal() // update tampilan total\n\n return productInCart\n}", "function renderizarProductos(){\n document.querySelectorAll(\".contenedorDeClase\").forEach(el => el.remove());\n\n for (const Clase of listaCompletaClases) {\n let contenedor = document.createElement(\"div\");\n contenedor.classList.add(\"contenedorDeClase\");\n //--> PLANTILLA LITERAL para mostrar las clases\n contenedor.innerHTML = `<img src=\"images/${Clase.imagen}.png\">\n <h3> ${Clase.disciplina}</h3>\n <h6> Días: ${Clase.dia}</h6>\n <h6> Horario: ${Clase.horario}</h6> \n <h6> Lugares: ${Clase.lugares}</h6>\n <button id=btn${Clase.id} class=\"mi-btn btn btn-danger addToCart\">RESERVAR</button>`;\n cursosDestacados.appendChild(contenedor);\n //--> EVENTO para cada boton\n $(`#btn${Clase.id}`).on(\"click\", function() {\n //Sumar clases al numero de clases\n sumarAlCarrito();\n //Sumar al carrito\n carrito.push(Clase);\n //Informar clase reservada\n console.log(`Reservaste ${Clase.disciplina}`);\n //Guardar en local storage\n localStorage.setItem(\"carrito\", JSON.stringify(carrito));\n //Informar que fue reservada al usuario\n Swal.fire(\n '¡CLASE RESERVADA!',\n 'Reservaste ' + Clase.disciplina + ' ' + Clase.dia + ' a las ' + Clase.horario,\n 'success'\n );\n //Descontar lugares \n if (lugaresDisponibles != 0) {\n lugaresRestantes = Clase.lugares - 1;\n console.log(\"Su lugar fue reservado, quedan \" + lugaresRestantes + \" lugares restantes\");\n }\n //Mostrar info por consola\n console.log(\"El valor es de \" + totalClase);\n //Calcular monto de descuento\n calcularMontoDescontar();\n //Aplicar descuento\n aplicarDescuento();\n //Crear lista de reservas en modal\n $(\"#listaTabla\").append(\n `<table class=\"table table-striped table-hover\">\n <tbody>\n <tr class=\"d-flex justify-content-between align-items-bottom\">\n <td class=\"table text-start fs-5 fw-bold\">${Clase.disciplina}</td>\n <td class=\"table text-center fs-4 fw-bold\"><b>${Clase.dia}</b></td>\n <td class=\"table text-center fs-4 fw-bold\"><b>${Clase.horario}</b></td>\n <!-- <td class=\"table text-center\">\n <button class=\"btn btn-dark type=\"submit\" id=\"eliminar${Clase.id}\">X</button>\n </td>\n --> \n </tr>\n </tbody>\n </table>\n `);\n //Mostrar por consola el total de clases reservadas\n console.log(carrito);\n \n //CIERRE\n });\n }\n \n }", "function addItemsPuertasItemsProteccion(k_coditem,o_descripcion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO puertas_items_proteccion (k_coditem, o_descripcion) VALUES (?,?)\";\n tx.executeSql(query, [k_coditem,o_descripcion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items protección...Espere\");\n });\n}", "function showCart() {\n // TODO: Find the table body\n\n // TODO: Iterate over the items in the cart\n // Done\n for(var ItemRow = 0 ; ItemRow < cart.items.length ; ItemRow++ ){\n // TODO: Create a TR\n // Done\n var tr = document.createElement('tr');\n tbody[0].appendChild(tr);\n // TODO: Create a TD for the delete link, quantity, and the item\n // Done\n var td = document.createElement('td');\n // var aLink = document.createElement('a');\n td.textContent = 'X';\n // td.appendChild(aLink);\n tr.appendChild(td);\n\n td = document.createElement('td');\n tr.appendChild(td);\n\n // td.textContent = Product.name;\n console.log('cart.items : ', cart.items);\n\n\n\n\n // for(var itemContent = 1 ; itemContent < 3 ; itemContent++ ){\n // td = document.createElement('td');\n // tr.appendChild(td);\n // td.innerHTML = '' + cart.items[itemContent];\n // }\n\n }\n \n \n // TODO: Add the TR to the TBODY and each of the TD's to the TR\n\n}", "function darCarta() {\n sumaTotal = 0;\n cartaEntregaPalo = palo[Math.floor(Math.random()*(4))]; \n cartaEntregaCarta = carta[Math.floor(Math.random()*(carta.length))]; \n cartaEntregaCarta = Number.parseInt(cartaEntregaCarta);\n \n if(cartaEntregaCarta>=2 && cartaEntregaCarta<11){\n valorCarta = cartaEntregaCarta;\n alert(valorCarta);\n } else if(cartaEntregaCarta>=11 && cartaEntregaCarta<=13){\n valorCarta = 10;\n }else if(cartaEntregaCarta == 1){\n if(confirm('¿Quieres que el valor de tu carta sea igual a uno?'+nombre)){\n valorCarta = 1;\n }else{\n valorCarta = 10;\n }\n \n }\n arrayValorCartas.push(valorCarta);\n for(var i = 0; i<arrayValorCartas.length;i++){\n sumaTotal += arrayValorCartas[i];\n } \n cartasSacadas.push(cartaEntregaCarta+cartaEntregaPalo); \n\n }", "function saveCart() {\n localStorage.setItem('shoppingCart', JSON.stringify(cart));\n }", "function saveCart() { \n localStorage.setItem(\"userCart\", JSON.stringify(cart));\n }", "function ajoutPanier() {\n //verifie si le client à choisi une lentille\n if (!productLense) {\n alert(\"Vous devez choisir une lentille\");\n return;\n }\n\n //créer l'objet\n let panierObj = ({\n id: Request.response[\"_id\"],\n lense: productLense,\n quantity: productQty\n });\n const productKey = `${Request.response._id}-${productLense}`;\n console.log(\"productKey\", productKey);\n console.log('panierObj', panierObj);\n\n //verifie si le produit est déjà dans le localStorage, si oui mets à jour la quantité\n if (!localStorage.getItem(productKey)) {\n localStorage.setItem(productKey, JSON.stringify(panierObj));\n } else {\n let tmpProduct = JSON.parse(localStorage.getItem(productKey));\n let tmpQty = panierObj.quantity + tmpProduct.quantity;\n panierObj.quantity = tmpQty;\n localStorage.setItem(productKey, JSON.stringify(panierObj));\n };\n}", "addToCart(product) {\n // prvo trazim postoji li vec ovaj atikal na listi\n const cartProductIndex = this.cart.items.findIndex((cp) => {\n return cp.productId.toString() === product._id.toString();\n });\n console.log('cartProductIndex='.red, cartProductIndex);\n let newQuantity = 1;\n const updatedCartItems = [...this.cart.items];\n console.log(updatedCartItems);\n \n\n // ako je pronasao zapis..\n if (cartProductIndex >= 0) {\n newQuantity = this.cart.items[cartProductIndex].quantity + 1;\n updatedCartItems[cartProductIndex].quantity = newQuantity;\n } else {\n // prvi zapis\n updatedCartItems.push({\n productId: new mongodb.ObjectId(product._id),\n quantity: newQuantity,\n });\n }\n\n const updatedCart = {\n items: updatedCartItems,\n };\n // const updatedCart = {\n // items: [{...product, quantity:1 }],\n // };\n\n const db = getDb();\n return db\n .collection('users')\n .updateOne(\n { _id: new mongodb.ObjectId(this._id) },\n { $set: { cart: updatedCart } }\n );\n }", "function addSelectedItemToCart() {\n // TODO: suss out the item picked from the select list\n let selectedItem = event.target.items.value;\n console.log(selectedItem);\n // TODO: get the quantity\n let quantity = event.target.quantity.value;\n // TODO: using those, add one item to the Cart\n \n \n carts.addItem(selectedItem,quantity); \n console.log(carts.items);\n \n}", "function addProduct(event) {\n const productId = event.currentTarget.id;\n const selectedProduct = products.data.find(myProduct => myProduct.id === parseInt(productId))\n const productsCardString = localStorage.getItem(\"productsCart\");\n let productsCardArray = JSON.parse(productsCardString);\n\n if (productsCardArray === null || productsCardArray === undefined || productsCardArray.length === 0) {\n productsCardArray = [selectedProduct];\n } else {\n productsCardArray.push(selectedProduct);\n }\n\n localStorage.setItem(\"productsCart\", JSON.stringify(productsCardArray));\n}", "async function addToCart(root, {\n productId\n}, context) {\n console.log('ADDING TO CART!!'); // 1 query the current user and see if signed in\n\n const sesh = context.session;\n\n if (!sesh.itemId) {\n throw new Error('You must be logged in to do this');\n } // 2 query the current users cart\n\n\n const allCartItems = await context.lists.CartItem.findMany({\n where: {\n user: {\n id: sesh.itemId\n },\n product: {\n id: productId\n }\n },\n resolveFields: 'id,quantity' // what you want back\n\n });\n const [existingCartItem] = allCartItems; // destructures first item in array of allCartItems\n // 3 see if item being added is already in cart\n\n if (existingCartItem) {\n console.log(`there are already ${existingCartItem.quantity}, increment by 1`); // 4 if it is increment by 1\n\n return await context.lists.CartItem.updateOne({\n id: existingCartItem.id,\n data: {\n quantity: existingCartItem.quantity + 1\n }\n });\n } // 5 if it isnt create new cart item\n\n\n return await context.lists.CartItem.createOne({\n data: {\n product: {\n connect: {\n id: productId\n }\n },\n user: {\n connect: {\n id: sesh.itemId\n }\n }\n }\n });\n}", "addProduct(product) {\n let productClone = JSON.parse(JSON.stringify(product));\n\n // Check if product exists in shopping cart already\n let productInCart = this.products.find((p) => {\n return p.id == product.id;\n });\n\n if (productInCart) {\n // Just refresh amount\n productInCart.amount = productInCart.amount + productClone.amount;\n } else {\n // Regulary add selected product to cart\n shoppingCart.products.push(productClone);\n }\n }", "function agregar_carrito(e) {\r\n const boton = e.target;\r\n const item = boton.closest('.card');\r\n const item_titulo = item.querySelector('.card-title').textContent;\r\n const item_precio = item.querySelector('.precio').textContent;\r\n const item_img = item.querySelector('.card-img-top').src;\r\n const item_nuevo = {\r\n nombre: item_titulo,\r\n precio: item_precio,\r\n foto: item_img,\r\n cantidad: 1,\r\n };\r\n agregar_nuevo_producto(item_nuevo);\r\n}", "function addToInvoice( newItem ){\n\t\t\n\t\t// console.log( \"adding newItem: \" + newItem.ID);\n\t\t// add product to cart\n\t\tcart.push(newItem);\n\t\t\n\t\t// items total cost\n\t\tcart.itemsCost \t+= parseFloat(newItem.PriceSAR, 10);\n\t\tcart.itemsCost\t= parseFloat(cart.itemsCost.toFixed(4)) ;\n\t\t\n\t\tcart.itemsTax\t+= parseFloat(newItem.TaxSAR, 10) ;\n\t\tcart.itemsTax\t= parseFloat(cart.itemsTax.toFixed(4)) ;\n\t\t\n\t\t// items total shipping cost\n\t\tcart.shippingCost \t+= parseFloat(newItem.ShippingCost, 10);\n\t\tcart.shippingCost\t= parseFloat(cart.shippingCost.toFixed(4)) ;\n\t\t// console.log( cart.totalCost)\n\t\t\n\t\t// item tax\n\t\tcart.invoiceCost\t= cart.itemsCost + cart.shippingCost + cart.itemsTax;\n\t\tcart.invoiceCost\t= parseFloat(cart.invoiceCost.toFixed(4));\n\t\t\n\t\t// update invoice\n\t\tupdateInvoice();\n\t\t\n\t\tmycart = cart;\n\t}", "function addItemsPuertasItemsOtras(k_coditem_otras,o_descripcion,v_clasificacion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO puertas_items_otras (k_coditem_otras, o_descripcion, v_clasificacion) VALUES (?,?,?)\";\n tx.executeSql(query, [k_coditem_otras,o_descripcion,v_clasificacion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Finalizando...Espere\");\n });\n}", "function addBasket(data) {\n cameraButton.addEventListener('click', () => {\n //Création du panier dans le localStorage s'il n'existe pas déjà\n if (typeof localStorage.getItem(\"basket\") !== \"string\") {\n let basket = [];\n localStorage.setItem(\"basket\", JSON.stringify(basket));\n }\n //récupération des info du produit\n let produit = {\n 'image' : data.imageUrl,\n 'id' : data._id,\n 'name' : data.name,\n 'lense' : document.querySelector(\"option:checked\").innerText,\n 'price' : data.price,\n 'description' : data.description,\n 'quantity' : cameraQuantity.value,\n }\n console.log(produit);\n //création d'une variable pour manipuler le panier\n let basket = JSON.parse(localStorage.getItem(\"basket\"));\n //Vérification que l'item n'existe pas déjà dans le panier\n let isThisItemExist = false;\n let existingItem;\n for (let i = 0; i < basket.length; i++) {\n if (produit.id === basket[i].id && produit.lense === basket[i].lense) {\n isThisItemExist = true;\n existingItem = basket[i];\n }\n }\n //Ajouter la caméra au panier\n if (isThisItemExist === false) {\n basket.push(produit);\n localStorage.setItem(\"basket\", JSON.stringify(basket));\n alert(\"Votre article à bien été mis au panier\")\n } else {\n existingItem.quantity = parseInt(existingItem.quantity, 10) + parseInt(produit.quantity, 10);\n localStorage.setItem(\"basket\", JSON.stringify(basket));\n alert(\"La quantité du produit à bien été mise à jour\")\n }\n displayBasket();\n })\n}", "function resToCartClicked(e){\n const button = e.target;\n const item = button.closest(\".detalle__compra\");\n const itemPrecio = Number(item.querySelector(\".precio\").textContent.replace(\"$\",\"\"));\n const itemProdId = Number(item.querySelector(\".idProdCarrito\").textContent);\n const precios = item.querySelector(\"#precios\");\n const cantidad = item.querySelector(\"#cantidad\");\n itemCantidad= Number(cantidad.value)-1;\n if(cantidad.value >= 1 & nuevasub > 0){\n cantidad.value = itemCantidad;\n }\n if(itemCantidad >= 0){\n sumaItem(itemProdId,itemCantidad);\n nuevasub = nuevasub - itemPrecio;\n precios.innerHTML = `<p>\n $${cantidad.value * itemPrecio}\n </p>`\n \n subTotal.innerHTML = `<h3>Subtotal</h3>\n <p>$${nuevasub}</p>`\n total.innerHTML = `<h2>Total</h2>\n <p>$${nuevasub}</p>`\n };\n}", "function addItemsEscalerasItemsProteccion(k_coditem,o_descripcion) {\n db.transaction(function (tx) {\n var query = \"INSERT INTO escaleras_items_proteccion (k_coditem, o_descripcion) VALUES (?,?)\";\n tx.executeSql(query, [k_coditem,o_descripcion], function(tx, res) {\n console.log(\"insertId: \" + res.insertId + \" -- probably 1\");\n console.log(\"rowsAffected: \" + res.rowsAffected + \" -- should be 1\");\n },\n function(tx, error) {\n console.log('INSERT error: ' + error.message);\n });\n }, function(error) {\n console.log('transaction error: ' + error.message);\n }, function() {\n console.log('transaction ok');\n $('#texto_carga').text(\"Creando items protección...Espere\");\n });\n}", "function populateProductCart(product) {\n products_cart.items.push(product);\n updateCart();\n clearAddItemModal();\n}", "onPay(){\n \t//on créer une list vide\n\t let checkout_products = [];\n\t // on remplit la list avec les id_Stripe et les quantité du panier\n\t for(let product of this.list_panier){\n\t checkout_products.push({\n\t price : product.fields.id_stripe,\n\t quantity : parseInt(product.quantit),\n\t })\n\t }\n\t onPayPni(checkout_products);\n\n\n }", "function addToCart(dishId, quantity = 1) {\n const menues = JSON.parse(data);\n\n let selectedDish = menues.find(x => x.id == dishId);\n\n console.log(\"selected Dish:\", selectedDish);\n\n //Is it already in cart\n //then increase the quantity then update the cart\n if (cart.length > 0) {\n let cartSelectedDish = cart.find(x => x.id == dishId);\n if (cartSelectedDish != undefined) {\n quantity = cartSelectedDish.quantity + quantity;\n cart = cart.filter(x => x.id != dishId);\n }\n }\n var cartItem = new CartItem(selectedDish.id, selectedDish.name,\n selectedDish.price, quantity, selectedDish.price * quantity);\n\n cart.push(cartItem);\n console.log(\"My Cart\", cart);\n\n saveCartInSession(cart);\n}", "function datosVenta() {\n let total = 0;\n let iva = 0;\n for (let i = 0; i < listaProductos.length; i++) {\n total += listaProductos[i].precio * listaProductos[i].cantidad;\n iva += ((listaProductos[i].precio * listaProductos[i].cantidad) * 0.16);\n }\n puntoVenta.registrarVenta(iva, total, listaProductos);\n}", "function cartBtn(){\n var ordd=document.querySelector(\".order-product\");\n var productClone=ordd.cloneNode(true);\n ordd.appendChild(productClone);\n alert(\"성공햇다!!\")\n \n }", "function initAddToCart() {\n \n let formsEl = document.querySelectorAll(\".addToCart\");\n\n for (let index = 0; index < formsEl.length; index++) {\n const formEl = formsEl[index];\n\n formEl.addEventListener('submit', function(e) {\n // Permet de bloquer la requete http\n e.preventDefault();\n\n // Permet de recuperer les champs du formulaire\n const data = new FormData(e.target);\n\n // Convertis les champs en json\n let newProductJson = Object.fromEntries(data.entries());\n newProductJson.quantity = 1;\n\n let cartJson = getCart();\n\n let productFound = false;\n\n // Boucle permettant d'ajouter l'article au panier ou d'augmenter la quantité\n for (let index = 0; index < cartJson.length; index++) {\n if (newProductJson.id === cartJson[index].id && newProductJson.varnish === cartJson[index].varnish) {\n cartJson[index].quantity += 1;\n productFound = true;\n }\n }\n // Si l'article n'est pas trouvé ajouté au panier\n if (productFound == false) {\n cartJson.push(newProductJson)\n }\n\n // Ajout des data au localstorage\n localStorage.setItem(\"cart\", JSON.stringify(cartJson))\n\n renderHtmlTotalArticles(cartJson);\n })\n };\n}", "function showCart() {\n\n // TODO: Find the table body\n let tbody = document.getElementById('tbody');\n let data = localStorage.getItem('cart');\n let parcedArray = JSON.parse(data);\n for (let i = 0; i < parcedArray.length; i++) {\n let tr = document.createElement('tr');\n tbody.appendChild(tr);\n let tdDelete = document.createElement('td');\n tr.appendChild(tdDelete);\n\n let deletebtn = document.createElement('button');\n deletebtn.textContent = 'X';\n deletebtn.id = i; \n tdDelete.appendChild(deletebtn);\n let tdQuantity = document.createElement('td');\n tr.appendChild(tdQuantity);\n tdQuantity.textContent = parcedArray[i].quantity;\n let tdItem = document.createElement('td');\n tr.appendChild(tdItem);\n tdItem.textContent = parcedArray[i].product;\n deletebtn.addEventListener('click', removeItemFromCart);\n }\n}", "function addItemsToCart(button, products) {\n button.innerText = 'Added to Bag'; // change button text\n let productId = button.dataset.id; // get the id of the button that was clicked\n let product = products.find(product => { // compare if the array id and the returned id are the same\n return product.id === productId;\n });\n product['quantity'] = 1;\n product['discount'] = 0;\n product['total'] = product.price;\n product['discountedTotal'] = product.price;\n\n //add items to local storage\n let items;\n let cartItems = localStorage.getItem('cartItems');\n if (cartItems) {\n items = JSON.parse(cartItems);\n let itemExists = items.find(item => item.id === product.id);\n if (!itemExists) {\n items.push(product);// add product to the array\n }\n localStorage.setItem('cartItems', JSON.stringify(items));\n } else {\n items = [product];\n localStorage.setItem('cartItems', JSON.stringify(items));// put it in local storage\n }\n //send items to cart ui\n sendItemsToCartUI(items);\n grandTotals(items);\n document.querySelector('.cart-items').innerText = items.length;\n // show cart on the screen\n openCart();\n}", "function agregarCant() {\r\n const seleccionado = productos.find(producto => producto.id == this.id);\r\n seleccionado.agregarCantidad(1);\r\n let registroUI = $(this).parent().children();\r\n registroUI[2].innerHTML = seleccionado.cantidad;\r\n registroUI[3].innerHTML = seleccionado.subtotal();\r\n $(\"#totalCarrito\").html(`TOTAL ${totalCarrito(carrito)}`);\r\n localStorage.setItem(\"carrito\", JSON.stringify(carrito));\r\n}", "function cargarCarrito(producto){\n //console.log(carrito);\n Swal.fire({\n title: `Agregaste \"${producto.nombreProducto}\" al carrito`,\n text: `Su valor es: $ ${producto.precioProducto},00`,\n toast: true,\n position: 'bottom-end',\n timer: 4000,\n timerProgressBar: true,\n background: \"#56df5d\",\n color: \"white\",\n icon: 'success'\n });\n let existeEnCarrito = false;\n for(let item of carrito){\n if(item.producto.idProducto === producto.idProducto){\n existeEnCarrito = true;\n break;\n }\n else{\n existeEnCarrito = false;\n }\n }\n if(existeEnCarrito == true){\n\n document.getElementById(`cartQuantity${producto.idProducto}`).value = parseInt((document.getElementById(`cartQuantity${producto.idProducto}`).value)) + 1;\n actualizarPrecioCarrito(carrito);\n }\n else{\n const item = new Item(carrito.length,producto,producto.precioProducto,1);\n carrito.push(item);\n addItemToShoppingCart(item);\n }\n}", "function readStoredCart() {\n\n\tlet carrito = sessionStorage.getItem('std_carrito');\n if (carrito == null || typeof carrito == \"undefined\"\n || carrito == \"\") {\n\n carrito = new Array;\n\n } else {\n\n carrito = JSON.parse(carrito);\n\n }\n\n if (Array.isArray(carrito)) {\n \tcarrito.forEach((item)=>{\n \t\taddProductInCart(item.id,item.name,item.price); \n \t});\n }\n\n \n let carritoprice = sessionStorage.getItem('std_importecarrito');\n if (carritoprice == null || typeof carritoprice == \"undefined\"\n || carritoprice == \"\") {\n\n carritoprice = 0.00;\n\n } else {\n\n carritoprice = parseFloat(carritoprice);\n\n }\n $('#importe_total_carrito').html(carritoprice);\n\n\t\n\n let carritoenvio = sessionStorage.getItem('std_enviocarrito');\n if (carritoenvio == null || typeof carritoenvio == \"undefined\"\n || carritoenvio == \"\") {\n\n carritoenvio = 0.00;\n\n } else {\n\n carritoenvio = parseFloat(carritoenvio);\n\n } \n\t$('#gastos_envio_carrito').html(carritoenvio + '€');\n\n}", "function addPrToCarrt() {\n var model = { prid: prid, total: parseInt($(\"#numb\").text()) };\n addToCart(model);\n}", "function addSelectedItemToCart() {\n // TODO: suss out the item picked from the select list\n // TODO: get the quantity\n // TODO: using those, add one item to the Cart\n var suss = document.getElementById('cartContents');\n var print = document.createElement('p');\n suss.appendChild(print);\n var selectedItem = document.getElementById('items');\n var quantityItem = document.getElementById('quantity');\n print.textContent= `${quantityItem.value} quantities of ${selectedItem.value}`;\n var x =new cart(selectedItem.value,quantityItem.value);\n counter++;\n console.log(counter);\n var setLocalStorage = JSON.stringify(cartArray);\n localStorage.setItem('cartItems', setLocalStorage);\n \n}", "function agregarAlCarrito(producto) {\n let splitPrecio = producto.precio.split(\" \");\n producto.precio = splitPrecio[1] * producto.cantidad;\n const row =document.createElement('tr');\n row.innerHTML = `\n <td>\n <img src=\"${producto.img}\" width=100px>\n </td>\n <td>\n ${producto.titulo}\n </td>\n <td>\n ${producto.cantidad}\n </td>\n <td>\n $ ${producto.precio} \n </td>\n <td>\n <a href=\"#\" style=\"color:black;\" data-id=\"${producto.id}\"><i class=\"fas fa-trash-alt eliminar-producto\"></i></a>\n </td>\n `;\n listaCarrito.appendChild(row);\n guardarLocalStorage(producto);\n}", "static saveCart(cart){\n localStorage.setItem('cart',JSON.stringify(cart));\n }", "function add2Cart(goods) {\n var _arr = loadCart();\n _arr.push(goods);\n wecache.put(CART_KEY, _arr,-1);\n}", "addToCart(data) {\n const { sequelize, models: { Product, Cart } } = Schemas.getInstance();\n\n const { userId, productId, qty } = data;\n\n return sequelize.transaction(transaction => {\n\n return Product.findOne({ where : { id: productId } }, { transaction })\n .then(product => {\n if (product.qty <= 0) throw new Error('Sorry, requested quantity of products not available in the stock');\n\n const productQty = Number(product.qty) - Number(qty);\n return product.update({ qty: productQty }, { transaction })\n .then(() => {\n\n return Cart.findOne({ where: { id: 1 } }, { transaction })\n .then(cartItem => {\n if (cartItem === null) {\n return Cart.create({ userId, productId, qty }, { transaction });\n } else {\n const itemQty = Number(cartItem.qty) + Number(qty);\n return cartItem.update({ qty: itemQty }, { transaction });\n }\n });\n });\n });\n })\n .then(() => {\n return { status: 'success' };\n })\n .catch(error => {\n Logger.LOG_ERROR('CartModel', { status: 'Error occurred while adding item to cart', error });\n return { status: 'error', error: error.message };\n });\n }", "function addCartItem(prod) {\n const inCart = cart.find(i => i.id === prod.id);\n\n if (!inCart) {\n changeOfAmountAndAvailableInProductList(prod);\n addProductToCart(prod);\n }\n\n if (inCart) {\n changeOfAmountAndAvailableInProductList(prod);\n changeOfAmountAndAvailableInCart(prod);\n }\n }", "function generateCart(){//afegit el paràmetre cartlist a la funció per poder probar-la amb un altre array sense modificar el codi\n let set= new Set(cartList.map( JSON.stringify ))//convertits els objectes a cadena de text per comprobar repetits\n cart = Array.from( set ).map( JSON.parse );//afegim a cart els resultats únics i convertim els strings d'abans a objectes\n \n for( let i=0; i<cart.length;i++){\n cart[i].quantity=0;// reset del camp a 0 per anar sumant els que venen de cartList\n for( let j=0; j<cartList.length; j++ ){\n \n if(cart[i].name==cartList[j].name){\n cart[i].quantity++;\n cart[i].subtotal=(cart[i].quantity*cart[i].price);\n }\n }\n }console.log(cart);\n}", "async function addCart(){\n //alert success\n let success = document.getElementById('success');\n //alert failure\n let failure = document.getElementById('failure');\n //input cu attribute\n let input = document.getElementById('cantitate');\n //id\n var id = input.getAttribute('data-product');\n let qty = Number(input.value);\n let stoc = Number(input.getAttribute('data-stoc'));\n //cartProduct contine produsele\n var cartProducts = new Object();\n //verificam daca exista cart in localStorage\n if(localStorage.getItem(id) === null){\n if(qty <= stoc){\n //append la cartProducts\n cartProducts = {qty: qty};\n //salvam ca string cartProducts\n localStorage.setItem(id, JSON.stringify(cartProducts));\n success.classList.remove('hidden_');\n setTimeout(function(){\n success.classList.add('hidden_');\n }, 2000)\n return;\n } else {\n failure.classList.remove('hidden_');\n setTimeout(function(){\n failure.classList.add('hidden_');\n }, 2000)\n return;\n }\n } else {\n //preluam localstorage ca object pentru ca exista\n cartProducts = localStorage.getItem(id);\n cartProducts = JSON.parse(cartProducts);\n let qtyTemp = cartProducts.qty + qty;\n //verificam daca exista produsul in cos\n if(qtyTemp <= stoc){\n cartProducts.qty = qtyTemp;\n localStorage.setItem(id, JSON.stringify(cartProducts));\n success.classList.remove('hidden_');\n setTimeout(function(){\n success.classList.add('hidden_');\n }, 2000);\n return;\n } else {\n failure.classList.remove('hidden_');\n setTimeout(function(){\n failure.classList.add('hidden_');\n }, 2000)\n return;\n }\n }\n \n}", "function showCart() {\n\n const cartItems = JSON.parse(localStorage.getItem('cart')) || [];\n cart = new Cart(cartItems);\n // TODO: Find the table body\n let tableBody= document.querySelector('tbody');\n // TODO: Iterate over the items in the cart\n // TODO: Create a TR\n // TODO: Create a TD for the delete link, quantity, and the item\n // TODO: Add the TR to the TBODY and each of the TD's to the TR\n for (let i =0;i<this.cartItems.length;i++){\n let tableRow=document.createElement('tr');\n tbody.appendChild(tableRow);\n let deleteLink=document.createElement('td');\n deleteLink.textContent='x';\n deleteLink.appendChild(tableRow);\n let quantityTable =document.createElement('td');\n quantityTable.textContent=cartItems[0];\n quantityTable.appendChild(tableRow);\n let itemTable =document.createElement('td');\n itemTable.textContent=cartItems[1];\n itemTable.appendChild(tableRow);\n }\n}", "add_item(item){\n this.cart.push(item);\n }", "function agregar(x) {\n let id = x;\n let addProducto = productos.find((item)=>{ return item.id == id})\n console.log(addProducto)\n carrito.push(addProducto)\n console.log(carrito)\n renderCarrito()\n saveCarrito()\n}" ]
[ "0.68824446", "0.68560034", "0.6795127", "0.67779076", "0.6773141", "0.66966105", "0.6679588", "0.66137606", "0.6580311", "0.6567401", "0.65085727", "0.65066904", "0.6482573", "0.64625907", "0.64479834", "0.64133143", "0.6396837", "0.63860077", "0.63860077", "0.6356494", "0.63305044", "0.6296889", "0.62927175", "0.6279795", "0.62783074", "0.626493", "0.62323177", "0.6230723", "0.62294865", "0.622334", "0.6222333", "0.6214421", "0.6207757", "0.62071776", "0.61914647", "0.6183483", "0.61820936", "0.61792046", "0.6176147", "0.6160511", "0.6160236", "0.61565024", "0.61541986", "0.6151593", "0.61438936", "0.6132414", "0.613141", "0.6120739", "0.611745", "0.6114856", "0.6111099", "0.6104061", "0.61026776", "0.6101103", "0.6092663", "0.6083886", "0.607968", "0.6076771", "0.6075457", "0.6069181", "0.605188", "0.60515225", "0.6051158", "0.60493606", "0.6043798", "0.60374266", "0.6029197", "0.60244983", "0.60243493", "0.6010711", "0.6010272", "0.6008129", "0.6006117", "0.6002341", "0.6001398", "0.59951466", "0.5989372", "0.5989167", "0.59869313", "0.59854424", "0.59841746", "0.59796715", "0.59762317", "0.5976094", "0.59758586", "0.59748924", "0.59739596", "0.59711134", "0.59710795", "0.5967439", "0.5966", "0.59644073", "0.59639597", "0.5958976", "0.59545785", "0.595106", "0.5946831", "0.5942979", "0.5934653", "0.5929807", "0.5922409" ]
0.0
-1
Mantenimiento de la categoria de producto
function ManteniCatPro() { return '<div class="row">' + ' <div class="col">' + ' <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">' + ' <li class="nav-item" role="presentation">' + ' <a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pills-home"' + ' role="tab" aria-controls="pills-home" aria-selected="true">Insertar' + ' Categoria</a>' + ' </li>' + ' <li class="nav-item" role="presentation">' + ' <a class="nav-link" id="pills-profile-tab" data-toggle="pill" href="#pills-profile"' + ' role="tab" aria-controls="pills-profile" aria-selected="false">Actualizar' + ' Categoria</a>' + ' </li>' + ' </ul>' + ' <div class="tab-content" id="pills-tabContent">' + ' <div class="tab-pane fade show active" id="pills-home" role="tabpanel"' + ' aria-labelledby="pills-home-tab">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col-4">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text" id="basic-addon1">📋</span>' + ' </div>' + ' <select class="custom-select" id="inputGroupSelect01">' + ' <option selected>Icono</option>' + DatIcont() + ' </select>' + ' </div>' + ' </div>' + ' <div class="col-8">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text" id="basic-addon1">📺</span>' + ' </div>' + ' <input type="text" class="form-control" id="cateText"' + ' placeholder="Nombre de la Categoria" aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <button type="button" id="AgregCat"' + ' class="btn btn-success btn-block">Agregar' + ' Catehoria</button>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' <div class="tab-pane fade" id="pills-profile" role="tabpanel"' + ' aria-labelledby="pills-profile-tab">' + '<div' + 'style="background: #eceff1; width: 100%; height: 400px; display: grid;grid-template-columns:100% ;grid-row: 5; ;grid-row-gap: 1px; overflow:scroll;overflow-x: hidden;">' + '<div class="accordion" id="ContentCategori" style="width: 100%; height: 400px;overflow:scroll;overflow-x: hidden;">' + '</div>' + '<!------------------------------------>' + '</div>' + ' </div>' + ' </div>' + ' </div>' + '</div>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pesquisarCategoria() {\n apiService.get('/api/produtopromocional/fornecedorcategoria', null,\n categoriaLoadCompleted,\n categoriaLoadFailed);\n }", "function categType (category){\n if(category == 1){\n category = \"Limpeza\";\n } else if(category == 2) {\n category = \"Alimentação\";\n } else if(category == 3){\n category = \"Vestuário\";\n } else {\n throw new Error(`\n O código digitado não corresponde à nenhuma categoria de produto! \n Digite 1 - Limpeza, 2 - Alimentação, 3 - Vestuário.\n `);\n }\n return category;\n}", "function selecionarCategoria(){\n\tlet itensAtuais = []\n\tlet i = 0\n\tlivro.map((livro) =>{ \n\t\tif(itensAtuais.indexOf(livro.categoria) === -1){\n\t\t\titensAtuais[i] = livro.categoria\n\t\t\ti++\n\t\t}\n\t})\n\n\tresp = prompt(`Essas sao as categorias disponiveis\n\n\t\t${itensAtuais}\n\n\t\tQual categoria deseja visualizar?`)\n\n\tconst escolha = livro.filter(livro=>livro.categoria === resp)\n\n\tcriarTabela(escolha)\n\n}", "function entregaCategoriaSeleccionada() {\n\t//divide lista palabras en 4 para elegir entre 4 categorias\n\tvar palabrasClaveCuartosLength = palabrasClave.length/4;\n\n\t//cuartos para bloques de palabras\n\tvar primerCuarto = palabrasClaveCuartosLength * 1;\n\tvar segundoCuarto = palabrasClaveCuartosLength * 2;\n\tvar tercerCuarto = palabrasClaveCuartosLength * 3;\n\tvar cuartoCuarto = palabrasClaveCuartosLength * 4;\n\t\n\t//se divide array para ir contando secuencias de palabras\n\t//variables creadas en esta funcion sin var para q sean globales. \t\n\tpalabrasClave1\t=\tpalabrasClave.slice(0, primerCuarto); // (0,3) para pruebas\n\tpalabrasClave2\t=\tpalabrasClave.slice(primerCuarto, segundoCuarto); // (3,6) para pruebas\n\tpalabrasClave3\t=\tpalabrasClave.slice(segundoCuarto, tercerCuarto); // (6,9) para pruebas\n\tpalabrasClave4\t=\tpalabrasClave.slice(tercerCuarto, cuartoCuarto); // (9,12) para pruebas\n\t\n\t// for(i = 0; i<palabrasClave1.length; i++) {\n\t// \t\tif (palabrasClave1[i] == \"aba\") {\n\t// \t\tcategoriaSeleccionada = categoria1;\n\t// \t\t}\n\t// \t}\n\n\t//Selecciona en que tramo esta la palabra, y seleciona categoria\n\tvar encontrada = false;\n\tfor (i = 0; i < palabrasClave1.length && !encontrada; i++) {\n \t\tif (palabrasClave1[i] === getPalabra) {\n\t \tencontrada = true;\n\t \tcategoriaSeleccionada = categoria1;\n \t \t}\n \t} \t\n\tfor (j = 0; j < palabrasClave2.length && !encontrada; j++) {\n \t\tif (palabrasClave2[j] === getPalabra) {\n\t \tencontrada = true;\n\t \tcategoriaSeleccionada = categoria2;\n \t \t}\n\t}\n\tfor (k = 0; k < palabrasClave3.length && !encontrada; k++) {\n \t\tif (palabrasClave3[k] === getPalabra) {\n\t \tencontrada = true;\n\t \tcategoriaSeleccionada = categoria3;\n \t \t}\n\t}\n\tfor (l = 0; l < palabrasClave4.length && !encontrada; l++) {\n \t\tif (palabrasClave4[l] === getPalabra) {\n\t \tencontrada = true;\n\t \tcategoriaSeleccionada = categoria4;\n \t \t}\n\t}\n\t//si no encuentra la palabra clave, elije al azar entre las 4 categorias\n// \tif (encontrada === false) {\n// \t\t \tcategoriaSeleccionada = categoria1; \n// \t}\n\n\n//Con esto se puede elegir palabra a mostrar categoriaSeleccionada[0][x]\n//document.getElementById(\"xxx\").innerHTML = categoriaSeleccionada[0];\n\n\n}", "getCategories() {\n return ['Snacks', 'MainDishes', 'Desserts', 'SideDishes', 'Smoothies', 'Pickles', 'Dhal', 'General']\n }", "function filtro(categoria) {\n setCat(categoria)\n }", "function buildCategories() {\n const selectCategories = {};\n\n for (let i = 0; i < skills.length; i++) {\n const category = skills[i].category;\n // Make array for each category\n if (!selectCategories[category]) {\n selectCategories[category] = [];\n }\n\n let skill = skills[i];\n if (skill.comp === 1) {\n selectCategories[category].push({\n 'value': i,\n 'label': skill.name,\n // Custom attrs on Select Options\n 'tariff': skill.tariff.toFixed(1),\n 'startPosition': skill.startPosition,\n 'endPosition': skill.endPosition,\n 'makeDim': false\n });\n }\n }\n return selectCategories;\n}", "function getCatCategory() {\n\tvar categories = \"\";\n\tvar listValues = getCategoryValues([\"catVinRouge\", \"catVinBlanc\", \"catVinGrappa\", \"catVinMousseuxRose\", \"catVinPineau\", \"catVinAromatise\"]);\n\tif (listValues != \"\")\n\t\tcategories = \"(@tpcategorie==(\" + listValues + \"))\";\n\t\n\treturn categories;\n}", "function valorEstoqueCategoria(database) {\n \n //inicializacao de uma array de objeto 'estoque', onde cada objeto representa uma categoria e recebe valor do estoque do primeiro produto\n let estoque = [{\n categoria: database[0].category,\n valEstoque: database[0].quantity * database[0].price \n }],\n index = 0;\n \n //loop para passar por todos os objetos da array de produtos\n for(i = 1; i < database.length; i++) {\n \n //caso seja uma categoria diferente, inicializa novo objeto estoque, atribui o nome e o valor de estoque \n if (estoque[index].categoria != database[i].category) {\n \n index++;\n estoque.push({\n categoria: database[i].category,\n valEstoque: database[i].quantity * database[i].price\n })\n \n } else {\n \n //sendo a mesma categoria do produto atual, apenas acumular o valor de estoque\n estoque[index].valEstoque += database[i].quantity * database[i].price; \n } \n }\n \n console.table(estoque);\n}", "function disneyCategories(){\n //fetch get index for attractions\n \n byCategory()\n}", "function formulario_enviar_logistica_categoria() {\n // crear icono de la categoria (si no existe) y luego guardar\n logistica_categoria_crear_icono();\n}", "function categorify(cat) {\n var ret;\n if(typeof cat == \"string\")\n ret = cat\n ;\n else ret = d3.entries(cat) // Overview pseudo-phase\n .filter(function(e) { return e.value === \"Yes\"; })\n .map(function(k) { return k.key.trim(); })\n [0]\n ;\n return ret || \"Not Applicable\";\n } // categorify()", "function addProductCategory(){\r\n\t var categoryId = 0;\r\n\t var categoryName,categoryOptions ;\r\n\r\n\t productCategoriesArray.push(new ProductCategory(categoryId,categoryName,categoryOptions));\r\n iterateProductCategoriesArray();\r\n }", "categ(state,data)\n {\n return state.category=data\n }", "function categorySelect() {\n\t//카테고리 선택 안했을때 -> hamburger\n\tmenus.forEach((menu) => {\n\t\tif (menu.dataset.type !== \"hamburger\") {\n\t\t\t// console.log(menu.dataset.type);\n\t\t\tmenu.classList.add(\"invisible\");\n\t\t}\n\t});\n\n\t//카테고리 선택시\n\tcategory.addEventListener(\"click\", (event) => {\n\t\tconst filter = event.target.dataset.filter;\n\t\tif (filter == null) {\n\t\t\treturn;\n\t\t}\n\n\t\t//선택 카테고리 색상 변경\n\t\tconst active = document.querySelector(\".category_btn.selected\");\n\t\tactive.classList.remove(\"selected\");\n\t\tevent.target.classList.add(\"selected\");\n\n\t\t//메뉴 선별\n\t\tmenus.forEach((menu) => {\n\t\t\tif (filter === menu.dataset.type) {\n\t\t\t\tmenu.classList.remove(\"invisible\");\n\t\t\t} else {\n\t\t\t\tmenu.classList.add(\"invisible\");\n\t\t\t}\n\t\t});\n\t});\n}", "function nCategory(t){this.category=new category(t),this.built=!1,this.build=null}", "function handleInputChangeCa(event) {\n\n var cat = product.categories\n cat.push(allCategories.find(c => c.id == Number(event.target.value)).id)\n\n if (boolean) {\n dispatch(editProductCategory(product.id, event.target.value))\n }\n\n //borra los repetidos\n cat = cat.filter((arg, pos) => cat.indexOf(arg) == pos)\n setProduct({ ...product, [event.target.name]: cat })\n }", "function clickCategories(e) {\n setList(PRODUCTS[e.target.dataset.category]);\n }", "filterByActiveCategory(product) {\n return !this.props.activeCategory\n ? product\n : product.categories\n .filter(c => c.id === this.props.activeCategory)\n .length\n }", "function getCategory()\n{\n\tvar category = new Array([111,'server'], [222,'switcher'], [333,'storage'], [444,'workstation']);\n\treturn category;\n}", "function myProductOfCOmputing(products) {\n\tlet array = [];\n\tfor (const product of products) {\n\t\tif (product.category === 'computing') {\n\t\t\tarray.push(product);\n\t\t}\n\t}\n\treturn array;\n}", "function removerCategoria() {\n consultarProdutos();\n}", "function imprimirCategory(arrObjetos){\n \n var option = document.createElement(\"option\"); //creacion elemento option\n option.setAttribute(\"value\", \"Selecciona categoria\") //el valor que va a ser \"seleccionar categoria\"\n option.setAttribute(\"selected\",true); //salga seleccionado por defecto\n option.setAttribute(\"disabled\",true); //desabilitado para que no lo puedan marcar\n var nodoOption=document.createTextNode(\"Selecciona categoria\"); //el texto de la opcion\n option.appendChild(nodoOption); \n document.getElementById(\"categ\").appendChild(option); \n \n for(var i=0; i<arrObjetos.length; i++){\n option = document.createElement(\"option\"); //creacion elemento option\n option.setAttribute(\"value\", arrObjetos[i].nombre) //el valor sea el nombre de la categoria\n nodoOption = document.createTextNode(arrObjetos[i].nombre); //muestro el nombre\n option.appendChild(nodoOption); \n document.getElementById(\"categ\").appendChild(option); //aparezca dentro del select\n \n }\n}", "getCategories() {\n return this.$node.attr('data-category').split(/\\s*,\\s*/g);\n }", "function addToCateg () {\n\n\t\tfor(var i=0;i<whichCateg;i++){\n\t\t\tif(cathegory == Object.getOwnPropertyNames(categ.categName)[i])\n\t\t\t\t{console.log(\"this is working BUT\");\n\t\t\t\t\tconsole.log(\"cathegory \" + cathegory);\n\t\t\t\t\t// BUT CANT AUTOMATED////////\n\t\t\t\t\tObject.keys(categ.categName[cathegory].push(Name));\t\n\t\t\t\t}\n\t\t}\n\t}", "function getCategoryId (id) {\n window.categoriaid = id //Guardo el id de la categoria en global\n }", "function init_inpt_formulario_cargar_categoria() {\n // input para el icono\n init_inpt_formulario_cargar_categoria_icono();\n\n // input para el color\n init_inpt_formulario_cargar_categoria_color();\n}", "get type() {\n\t\treturn \"category\";\n\t}", "onClickBilleteras() {\n const billeteras = this.props.products.filter((producto) => {\n return producto.category === \"Billeteras\";\n });\n \n this.setState({ products: billeteras });\n }", "getAllKpisWithCategory() {\n return this.kpis[0].kpiCategories;\n }", "function obtenerCategoriasSemanticas(listadoconceptos) {\n\tlet categoriasSemanticas = []; //array donde voy a almacenar las categorias semanticas\n\t//Recorro todos los conceptos y me quedo con las categorias semanticas\n\tfor (let index = 0; index < listaConceptos.length; index++) {\n\t\tcategoriasSemanticas.push(listaConceptos[index].categoria_semantica);\n\t}\n\tcategoriasSemanticas = [...new Set(categoriasSemanticas)]; //elimino los elementos repetidos\n\treturn categoriasSemanticas;\n}", "investmentCategories(filter) {\n\t\tconst categories = [\n\t\t\t{id: \"Buy\", name: \"Buy\"},\n\t\t\t{id: \"Sell\", name: \"Sell\"},\n\t\t\t{id: \"DividendTo\", name: \"Dividend To\"},\n\t\t\t{id: \"AddShares\", name: \"Add Shares\"},\n\t\t\t{id: \"RemoveShares\", name: \"Remove Shares\"},\n\t\t\t{id: \"TransferTo\", name: \"Transfer To\"},\n\t\t\t{id: \"TransferFrom\", name: \"Transfer From\"}\n\t\t];\n\n\t\treturn filter ? this.filterFilter(categories, {name: filter}) : categories;\n\t}", "function getCategories(){\n return _categoryProducts;\n}", "function crearObjetoCategorias(xml){\n \n //array con las categorias\n var arrCategory=[];\n //coger los datos del xml que nos interesan (name e id)\n var categoria=xml.getElementsByTagName(\"category\");\n //variables \n var nombre;\n \n for(var i=0; i<categoria.length; i++){ //se recorren las categorias\n\n nombre=categoria[i].getElementsByTagName(\"name\")[0].childNodes[0].nodeValue; //se coga el nombre de la categoria\n \n var objetoCategoria = new datosCategorias(nombre);\n arrCategory.push(objetoCategoria);\n } \n return arrCategory; //array nombre categoria\n}", "imprimirCategorias(){\n eventbrite.obtenerCategorias()\n .then(data => {\n const categorias = data.resultado.categories;\n\n console.log(categorias)\n\n // Obtener el select de categorias\n const selectCateg = document.getElementById('listado-categorias');\n\n // Recorremos el arreglo e imprimimos los options\n categorias.map(categ => {\n const option = document.createElement('option');\n option.value = categ.id;\n option.appendChild(document.createTextNode(categ.name_localized));\n\n selectCateg.appendChild(option);\n });\n });\n }", "function createGameCategories(){\n\tGameCategories = new Set();\n\tGames.map(game => game.categories).flat().forEach(function(subcategory){\n\t\tGameCategories.add(subcategory);\n\t});\n\tGameCategories = Array.from(GameCategories); //turn the set into an array\n}", "function initializeProductSet() {\n product.push(new Product('bag', 'img/bag.jpg'));\n product.push(new Product('banana', 'img/banana.jpg'));\n product.push(new Product('bathroom', 'img/bathroom.jpg'));\n product.push(new Product('boots', 'img/boots.jpg'));\n product.push(new Product('breakfast', 'img/breakfast.jpg'));\n product.push(new Product('bubblegum', 'img/bubblegum.jpg'));\n product.push(new Product('chair', 'img/chair.jpg'));\n product.push(new Product('cthulhu', 'img/cthulhu.jpg'));\n product.push(new Product('dog-duck', 'img/dog-duck.jpg'));\n product.push(new Product('dragon', 'img/dragon.jpg'));\n product.push(new Product('pen', 'img/pen.jpg'));\n product.push(new Product('pet-sweep', 'img/pet-sweep.jpg'));\n product.push(new Product('scissors', 'img/scissors.jpg'));\n product.push(new Product('shark', 'img/shark.jpg'));\n product.push(new Product('sweep', 'img/sweep.png'));\n product.push(new Product('tauntaun', 'img/tauntaun.jpg'));\n product.push(new Product('unicorn', 'img/unicorn.jpg'));\n product.push(new Product('usb', 'img/usb.gif'));\n product.push(new Product('water-can', 'img/water-can.jpg'));\n product.push(new Product('wine-glass', 'img/wine-glass.jpg'));\n}", "function categorizeMenu(arr, cat){\r\n var categorized = [];\r\n for(var x=0; x<arr.length; x++){\r\n arr[x]['category'] == cat ? categorized.push(arr[x]) : true;\r\n }\r\n if(categorized.length == 0){\r\n $('.warning-text').show();\r\n return categorized;\r\n }\r\n $('.warning-text').hide();\r\n return categorized;\r\n }", "getProducts() {\n return this.catProduct;\n }", "supCategory(v) {\n\t\tthis.setState({\n\t\t\tspecfic: v\n\t\t});\n\t}", "function _predictCategory(description, shop) {\r\n let key = null;\r\n\r\n if (shop) { // the most of known shops have 1 category of goods\r\n key = _findInList(SCROOGE.CATEGORY_BY_SHOP, shop);\r\n }\r\n\r\n if (!key) { // if that didn't help, try to analyse purchase description\r\n // get separate words from description (that are usually things purchased)\r\n const keywordMatch = description.match(/([a-zа-я\\-]+)/gi);\r\n\r\n // and use them as keywords to search for the categories they belong to\r\n if (keywordMatch) {\r\n for (let i = 0; i < keywordMatch.length; i++) {\r\n key = key || _findInList(SCROOGE.CATEGORY_BY_KEYWORD, keywordMatch[i]);\r\n }\r\n }\r\n }\r\n\r\n return key ? SCROOGE.CATEGORY[key] : '';\r\n }", "constructor() {\n\t\tthis.categories = [];\n\t}", "async function setProductArguments() {\n const groupedData = await Object.values(groupBy(products, \"categoryId\"));\n let resp = [];\n for (let p = 0; p < groupedData.length; p++) {\n const selectedCategory = await getCategoryName(\n groupedData[p][0].categoryId\n );\n if (selectedCategory) {\n const obj = {\n name: selectedCategory.name,\n value: groupedData[p].length,\n };\n resp.push(obj);\n }\n }\n setResData(resp);\n setActiveIndex(0);\n }", "renderCategories() {\n return (\n <React.Fragment>\n\t\t\t\t<option value=\"\" />\n\t\t\t\t{this.props.categories.map((category, index) => {\n\t\t\t\t\tif (category.kategoriAdi !== 'Hazir PC') {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<option key={index} value={category.kategoriID+'.'+category.kategoriAdi}>\n\t\t\t\t\t\t\t\t{category.kategoriAdi}\n\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t})}\n\t\t\t</React.Fragment>\n );\n\t}", "function showCategorie2(dd) {\n var i = 0;\n $(\".promohtml\").html(\"\");\n //append the articles by categories\n for (index = 0; index < promoArticle.length; index++) {\n if (promoArticle[index].idcategorie == dd.id) {\n $(\".promohtml\").append(\n \"<li class='span3'>\" +\n \" <div class='thumbnail'>\" +\n \" <a href='product_details.php?id=\" +\n promoArticle[index].reference +\n \"'><img style='height:100px' src='AdminLogin/images/\" +\n promoArticle[index].imageArt +\n \"' alt='' /></a>\" +\n \" <div class='caption'><h5>\" +\n promoArticle[index].designation +\n \"</h5>\" +\n \" <h4 style='text-align:center'><a class='btn zoom' id='\" +\n promoArticle[index].reference +\n \"' href='product_details.php?id=\" +\n promoArticle[index].reference +\n \"'> <i\" +\n \" class='icon-zoom-in'></i></a> <a class='btn' onclick='addTocart(this,\" +\n promoArticle[index].Nouveauxprix +\n \")' id='\" +\n promoArticle[index].reference +\n \"'><span class='languageAddTo'>Add to</span> <i class='icon-shopping-cart'></i></a>\" +\n \"<br><button class='btn btn-warning' disabled id='\" +\n promoArticle[index].reference +\n \"' >DH \" +\n promoArticle[index].Nouveauxprix +\n \"</button></h4></div></div></li>\"\n );\n i = i + 1;\n }\n }\n //message if there's no article in the selected categorie\n if (i == 0) {\n $(\".promohtml\").append(\n \"<div class='alert alert-danger languageNoItemToDisplay' role='alert'>\" +\n \"No Items To Display! </div>\"\n );\n }\n changeLanguage();\n}", "get categoryMapping() {\n let categoryMapping = {};\n this.domain.forEach(d => {\n this.currentCategories.forEach(f => {\n if (f.categories.includes(d.toString())) {\n categoryMapping[d] = f.name;\n }\n });\n });\n return categoryMapping;\n }", "function setCategory(id){\n var category = document.getElementById(id);\n\n //Se è un campo della modifica imposto la variabile di controllo\n if(id.substr(0, 3) == \"mod\"){\n checkModify = true;\n }\n\n //Elimino l'ultimo valore se ce ne sono più di 2\n var length = category.length;\n if(length >= 2){\n category.remove(1);\n }\n //Creo una nuova option\n var option = document.createElement(\"option\");\n\n //prendo il tag del negozio selezionato\n var li = document.getElementsByClassName(\"selected\")[0];\n\n //Inserisco all'interno della variabile il valore del paragrafo creato alla selezione della categoria\n option.setAttribute(\"value\", li.innerHTML);\n\n //Inserisco l'option creata e la seleziono\n category.appendChild(option);\n category.getElementsByTagName('option')[1].setAttribute(\"selected\", true);\n\n confirmMod();\n}", "function populatePreferentialCategory() {\n $('#preferentialCategory-label, #preferentialCategory-element').show();\n // junto las categorias\n var categories = [];\n $('#category').children().each(function() {\n if ($(this).attr('selected') === 'selected') {\n categories.push({value: $(this).attr('value'), text: $(this).text()});\n }\n });\n // me fijo que categoria esta seleccionada en este momento\n var previousElements = [];\n var previousSelectedElement = null;\n $('#preferentialCategory').children().each(function() {\n if ($(this).attr('selected') === 'selected') {\n previousSelectedElement = $(this).attr('value');\n }\n });\n var categoryExists = false;\n // si el elemento previamente seleccionado no esta en las categorias actuales, marcamos el primero\n for (var i in categories) {\n if (categories[i].value == previousSelectedElement) {\n categoryExists = true;\n }\n }\n // agrego las categorias\n $('#preferentialCategory').empty();\n for (var i = 0, count = categories.length; i < count; i++) {\n var selected = '';\n if (categories[i].value == previousSelectedElement) {\n selected = ' selected=\"selected\"';\n }\n $('#preferentialCategory').append('<option value=\"' + categories[i].value + '\"' + selected + '>' + categories[i].text + '</option>');\n }\n if ($('#preferentialCategory').children().length === 1 || !categoryExists) {\n $($('#preferentialCategory option')[0]).attr('selected', 'selected');\n }\n }", "function construct_select_categorie() {\n\tvar i;\n\n\tvar sHTML = \"\";\n\tsHTML += \"<select class='input_select_cat' id='input_select_cat' style='width:100%' >\";\n\tsHTML += \"<option value=''>choisir une categorie</option>\";\n\n\n\n\tfor (i = 0; i < aofcategorie.length; i++) {\n\t\tsHTML += \"<option value='\" + aofcategorie[i][\"id_categorie\"] + \"'>\" + aofcategorie[i][\"categorie\"] + \"</option>\";\n\t}\n\n\tsHTML += \"</select>\";\n\n\t$('#select_categorie').html(sHTML);\n}", "function formCategorias(tipo){\n\t//Selecciona la zona debajo del menu horizontal de edicion y la oculta\n\tvar contenidoCentral = document.getElementById(\"contenidoCentral\");\n\tcontenidoCentral.setAttribute(\"class\",\"d-none\");\n\t//Selecciona la zona para poner los formularios\n\tvar contenidoFormularios = document.getElementById(\"contenidoFormularios\");\n\tcontenidoFormularios.setAttribute(\"class\",\"d-block\");\n\t//QUITA TODO EL CONTENIDO PREVIO POR SI HAY OTROS FORMULARIOS\n\twhile (contenidoFormularios.firstChild) {\n\t\tcontenidoFormularios.removeChild(contenidoFormularios.firstChild);\n\t}\n\n\tif (tipo == \"add\") {\n\t\t//Se limpia el array\n\t\twhile(arrayProducciones.length != 0){\n\t\t\tarrayProducciones.shift();\n\t\t}\n\t\tvar formulario = document.createElement(\"form\");\n\t\tformulario.setAttribute(\"name\",\"addCategory\");\n\t\tformulario.setAttribute(\"action\",\"\");\n\t\tformulario.setAttribute(\"onsubmit\",\"validarCategorias(); return false\");\n\t\tformulario.setAttribute(\"method\",\"post\");\n\t\tvar leyenda = document.createElement(\"legend\");\n\t\tleyenda.appendChild(document.createTextNode(\"Añadir categoria\"));\n\t\tvar grupo1 = document.createElement(\"div\");\n\t\tgrupo1.setAttribute(\"class\",\"form-group\");\n\t\tvar label1 = document.createElement(\"label\");\n\t\tlabel1.setAttribute(\"for\",\"nombreCat\");\n\t\tlabel1.appendChild(document.createTextNode(\"Nombre de la categoria\"));\n\t\tvar input1 = document.createElement(\"input\");\n\t\tinput1.setAttribute(\"type\",\"text\");\n\t\tinput1.setAttribute(\"class\",\"form-control\");\n\t\tinput1.setAttribute(\"id\",\"nombreCat\");\n\t\tinput1.setAttribute(\"onblur\",\"validarCampoTexto(this)\");\n\t\tinput1.setAttribute(\"placeholder\",\"Nombre de la categoria\");\n\t\tvar mal1 = document.createElement(\"small\");\n\t\tmal1.setAttribute(\"class\",\"form-text text-muted\");\n\t\tmal1.setAttribute(\"id\",\"nombreMal\");\n\t\tvar grupo2 = document.createElement(\"div\");\n\t\tgrupo2.setAttribute(\"class\",\"form-group\");\n\t\tvar label2 = document.createElement(\"label\");\n\t\tlabel2.setAttribute(\"for\",\"descripCat\");\n\t\tlabel2.appendChild(document.createTextNode(\"Descripcion de la categoria\"));\n\t\tvar input2 = document.createElement(\"input\");\n\t\tinput2.setAttribute(\"type\",\"text\");\n\t\tinput2.setAttribute(\"class\",\"form-control\");\n\t\tinput2.setAttribute(\"id\",\"descripCat\");\n\t\tinput2.setAttribute(\"onblur\",\"validarCampoTexto(this)\");\n\t\tinput2.setAttribute(\"placeholder\",\"Descripcion de la categoria\");\n\t\tvar mal2 = document.createElement(\"small\");\n\t\tmal2.setAttribute(\"id\",\"descMal\");\n\t\tmal2.setAttribute(\"class\",\"form-text text-muted\");\n\t\t//SE CREA EL BUSCADOR \n\t\tvar grupo3 = document.createElement(\"div\");\n\t\tgrupo3.setAttribute(\"class\",\"form-group\");\n\t\tvar label3 = document.createElement(\"label\");\n\t\tlabel3.setAttribute(\"for\",\"produccionesCat\");\n\t\tlabel3.appendChild(document.createTextNode(\"Asignar producciones a la nueva categoria\"));\n\t\tvar divInputBtn = document.createElement(\"div\");\n\t\tdivInputBtn.setAttribute(\"class\",\"input-group\");\n\t\tvar divBtn = document.createElement(\"div\");\n\t\tdivBtn.setAttribute(\"class\",\"input-group-prepend\");\n\t\tvar botonRemover = document.createElement(\"button\");\n\t\tbotonRemover.setAttribute(\"type\",\"button\");\n\t\tbotonRemover.setAttribute(\"class\",\"btn btn-sm btn-outline-secondary\");\n\t\tbotonRemover.appendChild(document.createTextNode(\"Remover\"));\n\t\t//añade el evento al hacer click al boton de remover\n\t\tbotonRemover.addEventListener(\"click\",function(){\n\t\t\tvar input = document.forms[\"addCategory\"][\"producciones\"];\n\t\t\t\t//Quita el ultimo elemento del array\n\t\t\t\tarrayProducciones.pop();\n\t\t\t\tinput.value = arrayProducciones.toString();\n\n\t\t});\n\t\tvar produc = document.createElement(\"input\");\n\t\tproduc.setAttribute(\"class\",\"form-control \");\n\t\tproduc.setAttribute(\"type\",\"text\");\n\t\tproduc.setAttribute(\"id\",\"producciones\");\n\t\tproduc.readOnly = true;\n\t\tvar malProduc = document.createElement(\"small\");\n\t\tmalProduc.setAttribute(\"class\",\"form-text text-muted\");\n\t\tmalProduc.setAttribute(\"id\",\"producMal\");\n\t\tvar buscador = document.createElement(\"input\");\n\t\tbuscador.setAttribute(\"class\",\"form-control my-3\");\n\t\tbuscador.setAttribute(\"type\",\"text\");\n\t\tbuscador.setAttribute(\"id\",\"buscador\");\n\t\tbuscador.setAttribute(\"placeholder\",\"Buscar...\");\n\t\t//SE CREA LA TABLA DE LAS PRODUCCIONES\n\t\tvar tabla = document.createElement(\"table\");\n\t\ttabla.setAttribute(\"class\",\"table table-bordered\");\n\t\ttabla.setAttribute(\"name\",\"produccion\");\n\t\ttabla.setAttribute(\"id\",\"produccion\");\n\t\tvar thead = document.createElement(\"thead\");\n\t\tvar tr = document.createElement(\"tr\");\n\t\tvar thVacio = document.createElement(\"th\");\n\t\tvar ocultar = document.createElement(\"button\");\n\t\tocultar.setAttribute(\"type\",\"button\");\n\t\tocultar.setAttribute(\"class\",\"btn btn-secondary\");\n\t\tocultar.appendChild(document.createTextNode(\"Mostrar/Ocultar\"));\n\t\tocultar.addEventListener(\"click\", function(){\n\t\t\tvar cont = document.getElementById(\"tablaProducciones\");\n\t\t\tif(cont.style.display==\"table-row-group\"){\n\t\t\t\tcont.style.display = \"none\";\n\t\t\t}else{\n\t\t\t\tcont.style.display = \"table-row-group\";\n\t\t\t}\n\t\t});\n\t\tthVacio.appendChild(ocultar);\n\t\tvar thNombre = document.createElement(\"th\");\n\t\tthNombre.appendChild(document.createTextNode(\"Nombre\"));\n\t\tvar thDesc = document.createElement(\"th\");\n\t\tthDesc.appendChild(document.createTextNode(\"Tipo\"));\n\t\tvar tbody = document.createElement(\"tbody\");\n\t\ttbody.setAttribute(\"id\",\"tablaProducciones\");\n\t\t//Abre la conexion con la base de datos categorias\n\t\tvar produccionesDB = indexedDB.open(nombreDB);\n\t\t//Si ha salido bien\n\t\tproduccionesDB.onsuccess = function(event) { \n\t\t\tvar db = event.target.result; \n\t\t\tvar objectStore = db.transaction([\"producciones\"],\"readonly\").objectStore(\"producciones\");\n\t\t\t//Abre un cursor para recorrer todos los objetos de la base de datos \n\t\t\tobjectStore.openCursor().onsuccess = function(event) {\n\t\t\t\tvar produccion = event.target.result;\n\t\t\t\t//Si el cursor devuelve un valor \n\t\t\t\tif (produccion) {\n\t\t\t\t\tvar trPro = document.createElement(\"tr\");\n\t\t\t\t\tvar tdAdd = document.createElement(\"td\");\n\t\t\t\t\tvar add = document.createElement(\"button\");\n\t\t\t\t\tadd.setAttribute(\"type\",\"button\");\n\t\t\t\t\tadd.setAttribute(\"class\",\"btn btn-danger\");\n\t\t\t\t\tadd.setAttribute(\"value\",produccion.value.title);\n\t\t\t\t\tadd.appendChild(document.createTextNode(\"Añadir\"));\n\t\t\t\t\tvar tdTitulo = document.createElement(\"td\");\n\t\t\t\t\ttdTitulo.appendChild(document.createTextNode(produccion.value.title));\n\t\t\t\t\tvar tdTipo = document.createElement(\"td\");\n\t\t\t\t\tvar nomTipo = \"\";\n\t\t\t\t\tif (produccion.value.tipo == \"Movie\") {\n\t\t\t\t\t\tnomTipo = \"Pelicula\";\n\t\t\t\t\t}else{\n\t\t\t\t\t\tnomTipo = \"Serie\";\n\t\t\t\t\t}\n\t\t\t\t\ttdTipo.appendChild(document.createTextNode(nomTipo));\n\t\t\t\t\ttdAdd.appendChild(add);\n\t\t\t\t\ttrPro.appendChild(tdAdd);\n\t\t\t\t\ttrPro.appendChild(tdTitulo);\n\t\t\t\t\ttrPro.appendChild(tdTipo);\n\t\t\t\t\ttbody.appendChild(trPro);\n\t\t\t\t\t//Añade una funcion a cada boton de añadir\n\t\t\t\t\tadd.addEventListener(\"click\", function(){\n\t\t\t\t\t\tvar input = document.forms[\"addCategory\"][\"producciones\"];\n\t\t\t\t\t\t//Añade al array el nomnbre de boton\n\t\t\t\t\t\tarrayProducciones.push(this.value);\n\t\t\t\t\t\tinput.value = arrayProducciones.toString();\n\t\t\t\t\t});\n\t\t\t\t\t//Pasa a la siguiente categoria\n\t\t\t\t\tproduccion.continue();\n\t\t\t\t}//Fin del if\n\t\t\t};//Fin de objectStore.openCursor().onsuccess\n\t\t};//Fin de request.onsuccess\n\t\tvar grupoBtn = document.createElement(\"div\");\n\t\tgrupoBtn.setAttribute(\"class\",\"form-group d-flex justify-content-around\");\n\t\tvar aceptar = document.createElement(\"button\");\n\t\taceptar.setAttribute(\"type\",\"submit\");\n\t\taceptar.setAttribute(\"class\",\"btn btn-primary \");\n\t\taceptar.appendChild(document.createTextNode(\"Guardar\"));\n\t\tvar cancelar = document.createElement(\"button\");\n\t\tcancelar.setAttribute(\"type\",\"button\");\n\t\tcancelar.setAttribute(\"class\",\"btn btn-primary\");\n\t\tcancelar.appendChild(document.createTextNode(\"Cancelar\"));\n\t\t\t\n\t\t//Añade eventos al hacer click sobre los botones del formulario creado\n\t\t$(document).ready(function(){\n\t\t\t$(\"#buscador\").on(\"keyup\", function() {\n\t\t\t var value = $(this).val().toLowerCase();\n\t\t\t $(\"#tablaProducciones tr\").filter(function() {\n\t\t\t\t$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)\n\t\t\t });\n\t\t\t});\n\t\t});\n\n\t\tcancelar.addEventListener(\"click\", showHomePage);\n\t\tcancelar.addEventListener(\"click\", function(){\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontenidoCentral.setAttribute(\"class\",\"d-block\");\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontenidoFormularios.setAttribute(\"class\",\"d-none\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t//Se limpia el array\n\t\t\t\t\t\t\t\t\t\t\t\t\twhile(arrayProducciones.length != 0){\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tarrayProducciones.shift();\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\t\t//Crea el formulario\n\t\tgrupo1.appendChild(label1);\n\t\tgrupo1.appendChild(input1);\n\t\tgrupo1.appendChild(mal1);\n\t\tgrupo2.appendChild(label2);\n\t\tgrupo2.appendChild(input2);\n\t\tgrupo2.appendChild(mal2);\n\t\tgrupo3.appendChild(label3);\n\t\tdivInputBtn.appendChild(divBtn);\n\t\tdivBtn.appendChild(botonRemover);\n\t\tdivInputBtn.appendChild(produc);\n\t\tgrupo3.appendChild(divInputBtn);\n\t\tgrupo3.appendChild(malProduc);\n\t\tgrupo3.appendChild(buscador);\n\t\tgrupo3.appendChild(tabla);\n\t\ttabla.appendChild(thead);\n\t\ttabla.appendChild(tbody);\n\t\tthead.appendChild(tr);\n\t\ttr.appendChild(thVacio);\n\t\ttr.appendChild(thNombre);\n\t\ttr.appendChild(thDesc);\n\t\tgrupoBtn.appendChild(aceptar);\n\t\tgrupoBtn.appendChild(cancelar);\n\t\tformulario.appendChild(leyenda);\n\t\tformulario.appendChild(grupo1);\n\t\tformulario.appendChild(grupo2);\n\t\tformulario.appendChild(grupo3);\n\t\tformulario.appendChild(grupoBtn);\n\t\tcontenidoFormularios.appendChild(formulario);\n\t\t/* FIN DEL FORMULARIO DE AÑADIR CATEGORIA */\n\t}else if (tipo == \"delete\") {\n\t\tvar formulario = document.createElement(\"form\");\n\t\tformulario.setAttribute(\"name\",\"deleteCategory\");\n\t\tformulario.setAttribute(\"action\",\"\");\n\t\tformulario.setAttribute(\"onsubmit\",\"return false\");\n\t\tformulario.setAttribute(\"method\",\"post\");\n\t\tvar leyenda = document.createElement(\"legend\");\n\t\tvar grupo = document.createElement(\"div\");\n\t\tgrupo.setAttribute(\"class\",\"form-group\");\n\t\tleyenda.appendChild(document.createTextNode(\"Eliminar categoria\"));\n\t\t//SE CREA EL BUSCADOR \n\t\tvar buscador = document.createElement(\"input\");\n\t\tbuscador.setAttribute(\"class\",\"form-control mb-3\");\n\t\tbuscador.setAttribute(\"type\",\"text\");\n\t\tbuscador.setAttribute(\"id\",\"buscador\");\n\t\tbuscador.setAttribute(\"placeholder\",\"Buscar...\");\n\t\t//SE CREA LA TABLA DE LAS CATEGORIAS\n\t\tvar tabla = document.createElement(\"table\");\n\t\ttabla.setAttribute(\"class\",\"table table-bordered\");\n\t\ttabla.setAttribute(\"name\",\"categoria\");\n\t\ttabla.setAttribute(\"id\",\"categoria\");\n\t\tvar thead = document.createElement(\"thead\");\n\t\tvar tr = document.createElement(\"tr\");\n\t\tvar thVacio = document.createElement(\"th\");\n\t\tvar ocultar = document.createElement(\"button\");\n\t\tocultar.setAttribute(\"type\",\"button\");\n\t\tocultar.setAttribute(\"class\",\"btn btn-secondary\");\n\t\tocultar.appendChild(document.createTextNode(\"Mostrar/Ocultar\"));\n\t\tocultar.addEventListener(\"click\", function(){\n\t\t\tvar cont = document.getElementById(\"tablaCategorias\");\n\t\t\tif(cont.style.display==\"table-row-group\"){\n\t\t\t\tcont.style.display = \"none\";\n\t\t\t}else{\n\t\t\t\tcont.style.display = \"table-row-group\";\n\t\t\t}\n\t\t});\n\t\tthVacio.appendChild(ocultar);\n\t\tvar thNombre = document.createElement(\"th\");\n\t\tthNombre.appendChild(document.createTextNode(\"Nombre\"));\n\t\tvar thDesc = document.createElement(\"th\");\n\t\tthDesc.appendChild(document.createTextNode(\"Descripcion\"));\n\t\tvar tbody = document.createElement(\"tbody\");\n\t\ttbody.setAttribute(\"id\",\"tablaCategorias\");\n\t\t//Abre la conexion con la base de datos categorias\n\t\tvar categoriasDB = indexedDB.open(nombreDB);\n\t\t//Si ha salido bien\n\t\tcategoriasDB.onsuccess = function(event) { \n\t\t\tvar db = event.target.result; \n\t\t\tvar objectStore = db.transaction([\"categorias\"],\"readonly\").objectStore(\"categorias\");\n\t\t\t//Abre un cursor para recorrer todos los objetos de la base de datos \n\t\t\tobjectStore.openCursor().onsuccess = function(event) {\n\t\t\t\tvar categoria = event.target.result;\n\t\t\t\t//Si el cursor devuelve un valor \n\t\t\t\tif (categoria) {\n\t\t\t\t\tvar trCat = document.createElement(\"tr\");\n\t\t\t\t\tvar tdEliminar = document.createElement(\"td\");\n\t\t\t\t\tvar eliminar = document.createElement(\"button\");\n\t\t\t\t\teliminar.setAttribute(\"type\",\"button\");\n\t\t\t\t\teliminar.setAttribute(\"class\",\"btn btn-danger\");\n\t\t\t\t\teliminar.setAttribute(\"value\",categoria.value.name);\n\t\t\t\t\teliminar.appendChild(document.createTextNode(\"Eliminar\"));\n\t\t\t\t\teliminar.addEventListener(\"click\", deleteCategory);\n\t\t\t\t\tvar tdCat = document.createElement(\"td\");\n\t\t\t\t\ttdCat.appendChild(document.createTextNode(categoria.value.name));\n\t\t\t\t\tvar tdDesc = document.createElement(\"td\");\n\t\t\t\t\ttdDesc.appendChild(document.createTextNode(categoria.value.description));\n\t\t\t\t\ttdEliminar.appendChild(eliminar);\n\t\t\t\t\ttrCat.appendChild(tdEliminar);\n\t\t\t\t\ttrCat.appendChild(tdCat);\n\t\t\t\t\ttrCat.appendChild(tdDesc);\n\t\t\t\t\ttbody.appendChild(trCat);\n\t\t\t\t\t//Pasa a la siguiente categoria\n\t\t\t\t\tcategoria.continue();\n\t\t\t\t}//Fin del if\n\t\t\t};//Fin de objectStore.openCursor().onsuccess\n\t\t};//Fin de request.onsuccess\n\t\tvar grupoBtn = document.createElement(\"div\");\n\t\tgrupoBtn.setAttribute(\"class\",\"form-group d-flex justify-content-around\");\n\t\tvar cancelar = document.createElement(\"button\");\n\t\tcancelar.setAttribute(\"type\",\"button\");\n\t\tcancelar.setAttribute(\"class\",\"btn btn-primary\");\n\t\tcancelar.appendChild(document.createTextNode(\"Cancelar\"));\n\t\t//Añade eventos al hacer click sobre los botones del formulario creado y el buscador\n\t\t$(document).ready(function(){\n\t\t\t$(\"#buscador\").on(\"keyup\", function() {\n\t\t\t var value = $(this).val().toLowerCase();\n\t\t\t $(\"#tablaCategorias tr\").filter(function() {\n\t\t\t\t$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)\n\t\t\t });\n\t\t\t});\n\t\t});\n\t\tcancelar.addEventListener(\"click\", showHomePage);\n\t\tcancelar.addEventListener(\"click\", function(){\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontenidoCentral.setAttribute(\"class\",\"d-block\");\n\t\t\t\t\t\t\t\t\t\t\t\t\tcontenidoFormularios.setAttribute(\"class\",\"d-none\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t});\n\n\t\t//se crea el formulario de borrado\n\t\tformulario.appendChild(leyenda);\n\t\tgrupo.appendChild(buscador);\n\t\tgrupo.appendChild(tabla);\n\t\tformulario.appendChild(grupo);\n\t\ttabla.appendChild(thead);\n\t\ttabla.appendChild(tbody);\n\t\tthead.appendChild(tr);\n\t\ttr.appendChild(thVacio);\n\t\ttr.appendChild(thNombre);\n\t\ttr.appendChild(thDesc);\n\t\tgrupoBtn.appendChild(cancelar);\n\t\tformulario.appendChild(grupoBtn);\n\t\tcontenidoFormularios.appendChild(formulario);\n\t}else if (tipo == \"update\") {\n\t\tvar formulario = document.createElement(\"form\");\n\t\tformulario.setAttribute(\"name\",\"modCategory\");\n\t\tformulario.setAttribute(\"action\",\"\");\n\t\tformulario.setAttribute(\"onsubmit\",\"return false\");\n\t\tformulario.setAttribute(\"method\",\"post\");\n\t\tvar leyenda = document.createElement(\"legend\");\n\t\tleyenda.appendChild(document.createTextNode(\"Modificar categoria\"));\n\t\t//SE CREA EL BUSCADOR \n\t\tvar divModificar = document.createElement(\"div\");\n\t\tdivModificar.setAttribute(\"id\",\"divModificar\");\n\t\tvar grupo1 = document.createElement(\"div\");\n\t\tgrupo1.setAttribute(\"class\",\"form-group mt-3\");\n\t\tvar label1 = document.createElement(\"label\");\n\t\tlabel1.setAttribute(\"for\",\"produccionesCat\");\n\t\tlabel1.appendChild(document.createTextNode(\"Selecciona una categoria\"));\n\t\tvar divInputBtn = document.createElement(\"div\");\n\t\tdivInputBtn.setAttribute(\"class\",\"input-group\");\n\t\tvar divBtn = document.createElement(\"div\");\n\t\tdivBtn.setAttribute(\"class\",\"input-group-prepend\");\n\t\tvar botonRemover = document.createElement(\"button\");\n\t\tbotonRemover.setAttribute(\"type\",\"button\");\n\t\tbotonRemover.setAttribute(\"class\",\"btn btn-sm btn-outline-secondary\");\n\t\tbotonRemover.appendChild(document.createTextNode(\"Remover\"));\n\t\t//añade el evento al hacer click al boton de remover\n\t\tbotonRemover.addEventListener(\"click\",function(){\n\t\t\tvar input = document.forms[\"modCategory\"][\"categoria\"];\n\t\t\t\tinput.value = \"\";\n\t\t\t\t//muestra la tabla\n\t\t\t\tdocument.getElementById(\"divTabla\").style.display = \"block\";\n\t\t\t\t//oculta los campos de la categoria para modificar\n\t\t\t\tdivModificar.removeChild(divModificar.firstChild);\n\t\t});\n\t\tvar inputCat = document.createElement(\"input\");\n\t\tinputCat.setAttribute(\"class\",\"form-control \");\n\t\tinputCat.setAttribute(\"type\",\"text\");\n\t\tinputCat.setAttribute(\"id\",\"categoria\");\n\t\tinputCat.readOnly = true;\n\t\tvar divTabla = document.createElement(\"div\");\n\t\tdivTabla.setAttribute(\"id\",\"divTabla\");\n\t\tvar buscador = document.createElement(\"input\");\n\t\tbuscador.setAttribute(\"class\",\"form-control my-3\");\n\t\tbuscador.setAttribute(\"type\",\"text\");\n\t\tbuscador.setAttribute(\"id\",\"buscador\");\n\t\tbuscador.setAttribute(\"placeholder\",\"Buscar...\");\n\t\t//SE CREA LA TABLA DE LAS CATEGORIAS\n\t\tvar tabla = document.createElement(\"table\");\n\t\ttabla.setAttribute(\"class\",\"table table-bordered\");\n\t\ttabla.setAttribute(\"name\",\"tablaCategorias\");\n\t\ttabla.setAttribute(\"id\",\"tablaCategorias\");\n\t\tvar thead = document.createElement(\"thead\");\n\t\tvar tr = document.createElement(\"tr\");\n\t\tvar thVacio = document.createElement(\"th\");\n\t\tvar ocultar = document.createElement(\"button\");\n\t\tocultar.setAttribute(\"type\",\"button\");\n\t\tocultar.setAttribute(\"class\",\"btn btn-secondary\");\n\t\tocultar.appendChild(document.createTextNode(\"Mostrar/Ocultar\"));\n\t\tocultar.addEventListener(\"click\", function(){\n\t\t\tvar cont = document.getElementById(\"tablaBody\");\n\t\t\tif(cont.style.display==\"table-row-group\"){\n\t\t\t\tcont.style.display = \"none\";\n\t\t\t}else{\n\t\t\t\tcont.style.display = \"table-row-group\";\n\t\t\t}\n\t\t});\n\t\tthVacio.appendChild(ocultar);\n\t\tvar thNombre = document.createElement(\"th\");\n\t\tthNombre.appendChild(document.createTextNode(\"Nombre completo\"));\n\t\tvar tbody = document.createElement(\"tbody\");\n\t\ttbody.setAttribute(\"id\",\"tablaBody\");\n\t\t//Abre la conexion con la base de datos categorias\n\t\tvar categoriasDB = indexedDB.open(nombreDB);\n\t\t//Si ha salido bien\n\t\tcategoriasDB.onsuccess = function(event) { \n\t\t\tvar db = event.target.result; \n\t\t\tvar objectStore = db.transaction([\"categorias\"],\"readonly\").objectStore(\"categorias\");\n\t\t\t//Abre un cursor para recorrer todos los objetos de la base de datos \n\t\t\tobjectStore.openCursor().onsuccess = function(event) {\n\t\t\t\tvar categoria = event.target.result;\n\t\t\t\t//Si el cursor devuelve un valor \n\t\t\t\tif (categoria) {\n\t\t\t\t\tvar trCat = document.createElement(\"tr\");\n\t\t\t\t\tvar tdAdd = document.createElement(\"td\");\n\t\t\t\t\tvar add = document.createElement(\"button\");\n\t\t\t\t\tadd.setAttribute(\"type\",\"button\");\n\t\t\t\t\tadd.setAttribute(\"class\",\"btn btn-danger\");\n\t\t\t\t\tadd.setAttribute(\"value\",categoria.value.name);\n\t\t\t\t\tadd.appendChild(document.createTextNode(\"Modificar\"));\n\t\t\t\t\tvar tdNombre = document.createElement(\"td\");\n\t\t\t\t\ttdNombre.appendChild(document.createTextNode(categoria.value.name));\n\t\t\t\t\ttdNombre.setAttribute(\"class\",\"col-8\");\n\t\t\t\t\ttdAdd.appendChild(add);\n\t\t\t\t\ttrCat.appendChild(tdAdd);\n\t\t\t\t\ttrCat.appendChild(tdNombre);\n\t\t\t\t\ttbody.appendChild(trCat);\n\t\t\t\t\t//Añade una funcion a cada boton de añadir\n\t\t\t\t\tadd.addEventListener(\"click\", function(){\n\t\t\t\t\t\tvar input = document.forms[\"modCategory\"][\"categoria\"];\n\t\t\t\t\t\tinput.value = this.value;\n\t\t\t\t\t\t//oculta la tabla\n\t\t\t\t\t\tdocument.getElementById(\"divTabla\").style.display = \"none\";\n\t\t\t\t\t\t//muestra los campos de la categoria para modificar\n\t\t\t\t\t\tmodifyCategory(this.value);\n\t\t\t\t\t});\n\t\t\t\t\t//Pasa a la siguiente categoria\n\t\t\t\t\tcategoria.continue();\n\t\t\t\t}//Fin del if\n\t\t\t};//Fin de objectStore.openCursor().onsuccess\n\t\t};//Fin de request.onsuccess\n\t\t//Añade los eventos de la tabla\n\t\t$(document).ready(function(){\n\t\t\t$(\"#buscador\").on(\"keyup\", function() {\n\t\t\t var value = $(this).val().toLowerCase();\n\t\t\t $(\"#tablaCategorias tr\").filter(function() {\n\t\t\t\t$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)\n\t\t\t });\n\t\t\t});\n\t\t});\n\t\tgrupo1.appendChild(label1);\n\t\tdivInputBtn.appendChild(divBtn);\n\t\tdivBtn.appendChild(botonRemover);\n\t\tdivInputBtn.appendChild(inputCat);\n\t\tgrupo1.appendChild(divInputBtn);\n\t\tdivTabla.appendChild(buscador);\n\t\tdivTabla.appendChild(tabla);\n\t\tgrupo1.appendChild(divTabla);\n\t\ttabla.appendChild(thead);\n\t\ttabla.appendChild(tbody);\n\t\tthead.appendChild(tr);\n\t\ttr.appendChild(thVacio);\n\t\ttr.appendChild(thNombre);\n\t\tformulario.appendChild(grupo1);\n\t\tformulario.appendChild(divModificar);\n\t\tcontenidoFormularios.appendChild(formulario);\n\t}//Fin de los if\n}//Fin de formCategorias", "renderSpecialProducts() {\n const {\n foodMenu,\n languageCode\n } = this.props;\n\n if (!foodMenu || !foodMenu.length) {\n return (\n <div\n className=\"Skeleton-Wrapper\"\n >\n <Skeleton />\n <Skeleton />\n </div>\n );\n }\n\n return foodMenu.map((product) => {\n const {\n _id = '',\n category: {\n title\n } = {},\n language = ''\n } = product;\n\n if (title !== SPECIAL || languageCode !== language) {\n return null;\n }\n\n return <Product key={ _id } product={ product } />;\n });\n }", "getSubCategoriaSelecionado() {\n return this.SubCategoriaSelecionado;\n }", "function getCategories() {\n\tvar categories = getCatDisponibility() + \" \" + getCatCategory() + \" \" + getCatCountries();\n\t\n\treturn categories;\n}", "function Categorias(props){\n return(\n <div className=\"listings-grid-element\">\n <div className=\"image\">\n <img src={props.Image} alt=\"Type image\"></img>\n </div>\n <div className=\"text\">\n <div className=\"text-title\">\n <h3>{props.title}</h3>\n </div>\n </div>\n </div>\n );\n}", "function createProducts() {\n new Product('bag', './img/bag.jpg');\n new Product('banana', './img/banana.jpg');\n new Product('bathroom', './img/bathroom.jpg');\n new Product('boots', './img/boots.jpg');\n new Product('breakfast', './img/breakfast.jpg');\n new Product('bubblegum', './img/bubblegum.jpg');\n new Product('chair', './img/chair.jpg');\n new Product('cthulhu', './img/cthulhu.jpg');\n new Product('dog-duck', './img/dog-duck.jpg');\n new Product('dragon', './img/dragon.jpg');\n new Product('pen', './img/pen.jpg');\n new Product('pet-sweep', './img/pet-sweep.jpg');\n new Product('scissors', './img/scissors.jpg');\n new Product('shark', './img/shark.jpg');\n new Product('sweep', './img/sweep.png');\n new Product('tauntaun', './img/tauntaun.jpg');\n new Product('unicorn', './img/unicorn.jpg');\n new Product('water-can', './img/water-can.jpg');\n new Product('wine-glass', './img/wine-glass.jpg');\n}", "function randomCategory() {\n const keys = Object.keys(originals)\n return keys[Math.floor(Math.random() * keys.length)]\n}", "getCategories() {\n return this.categories;\n }", "function Category() {\n}", "function inicializacaoClasseProduto() {\r\n VETORDEPRODUTOSCLASSEPRODUTO = [];\r\n VETORDEINGREDIENTESCLASSEPRODUTO = [];\r\n VETORDECATEGORIASCLASSEPRODUTO = [];\r\n}", "get category() {\n const value = Number(this.getAttribute('category'))\n if (!Number.isNaN(value)) {\n return value\n } else {\n return ''\n }\n }", "onClickRemeras() {\n const remeras = this.props.products.filter((producto) => {\n return producto.category === \"Remeras\";\n });\n \n this.setState({ products: remeras });\n }", "function jogosDaDesenvolvedora(desenvolvedora){\n let jogos = [];\n\n for (let categoria of jogosPorCategoria) {\n for ( let jogo of categoria.jogos ) {\n if (jogo.desenvolvedora === desenvolvedora){\n jogos.push(jogo.titulo)\n } \n }\n }\n console.log(\"Os jogos da \" + desenvolvedora + \" são: \" + jogos)\n}", "function exibir_categoria(categoria) {\n \n let elementos = document.getElementsByClassName(\"produtos_imagens\");\n console.log(elementos);\n\n for (var i=0; i < elementos.length; i++) {\n console.log(elementos[i].id);\n\n if (categoria == elementos[i].id)\n elementos[i].style = \"display:inline\";\n\n else\n (elementos[i].style = \"display:none\")\n }\n}", "function livrosAugustoCury() {\n let livros = [];\n for (let categoria of livrosPorCategoria) {\n for (let livro of categoria.livros) {\n if (livro.autor === 'Augusto Cury') {\n livros.push(livro.titulo);\n }\n }\n }\n console.log('Livros do Augusto Cury: ' , livros);\n}", "function chooseCategory(input) {\n\t var category = data[input];\n\t return category;\n\t }", "function whatIsTheCatAndTypeId(category, type) {\n if(category === type) {\n console.log(type)\n\n // print products which have type id === type\n }\n}", "function getCategoria(request, response) {\r\n let id = request.params.id;\r\n\r\n Categoria.find({ id: id }).exec((err, categoria) => {\r\n if (err) return response.status(500).send({\r\n status: 500,\r\n message: 'Error en el servidor'\r\n });\r\n\r\n if (!categoria || categoria.length === 0) {\r\n return response.status(404).send({\r\n status: 404,\r\n message: `No se encontró ningún registro con el id: ${id}`\r\n });\r\n }\r\n\r\n response.status(200).send({\r\n status: 200,\r\n categoria: categoria\r\n })\r\n });\r\n}", "getCategories() {\n if (this._categories && this._categories.length > 0) return this._categories;\n return [this.getId().series];\n }", "function borrarCategoria(codigo) {\n borrarRegistro(\"Category\", codigo);\n}", "step_1_categories() {\n let inputs = document.querySelector(\"form\").firstElementChild.querySelectorAll(\"input\")\n let categories = []\n inputs.forEach(input => {\n if (input.checked === true) {\n categories.push(input.parentElement.querySelector(\".description\").innerText)\n }\n })\n return categories\n }", "function catPiloto(id) {\n document.getElementById(\"categorias\").style.display = \"none\";\n \n ecraPilotosCat(catPilotos(id));\n\n}", "getcategory(state){\n return state.category\n }", "_hideCategories(button){\n\t\tif(this._isFocoCategory('Solo_Montura') || this._isFocoCategory('Neutra')){\n\t\t\treturn;\n\t\t}\n\t\tvar button_category = button.dataset['category'];\n\t\tif(button.className == 'button-blue' && (button_category != 'graduacion1' || (button_category == 'graduacion1' && this._isFillInPrescription(button)))){\n\t\t\t\tvar cat_position = this.t_categories.indexOf(button_category);\n\t\t\t\tvar\tobject = this.objects_hash\n\t\t\t\tvar cat_to_hide = this.t_categories[cat_position]\n\t\t\t\tvar object = this.objects_hash[cat_to_hide];\n\t\t\t\tobject.hideCategory();\n\t\t}\n\t\t\n\t}", "function Featurescars (marca, transmision, precio, color, year, modelo, motor){\n this.brand = marca;\n this.transmision = transmision;\n this.precio = precio;\n this.color_car = color;\n this.year = year;\n this.modelo = modelo;\n this.engine = motor;\n this.getPriceTon = function(){\n return (this.precio + ' ' + this.transmision)\n }\n}", "function createCat(category,parentId=null){\r\n const categoryList = [];\r\n let cat;\r\n let mat;\r\n if(parentId === null){\r\n cat = category.filter(item=>item.parentId == undefined)\r\n }\r\n else{\r\n mat = category.filter(item=>item.parentId == parentId)\r\n }\r\n\r\n if(cat!=null){\r\n for(let product of cat){\r\n categoryList.push({\r\n _id:product._id,\r\n name:product.name,\r\n slug:product.slug,\r\n type:product.type,\r\n children:createCat(category,product._id)\r\n })\r\n }\r\n }\r\n \r\n if(mat!=null){\r\n for(let product of mat){\r\n categoryList.push({\r\n _id:product._id,\r\n name:product.name,\r\n parentId:product.parentId,\r\n type:product.type,\r\n slug:product.slug,\r\n children:createCat(category,product._id)\r\n })\r\n }\r\n }\r\n return categoryList\r\n}", "async getCategories() {\n // Consultar las categorias a la REST API de event brite\n const responseCategories = await fetch\n (`https://www.eventbriteapi.com/v3/categories/?token=${this.token_auth}`);\n\n // Esperar la respuesta de las categorias y devolver un JSON\n const categories = await responseCategories.json();\n // Devolvemos el resultado\n return {\n categories\n }\n }", "getCategory(_parameters) {\n\t\treturn new Category(_parameters);\n\t}", "function getCatDisponibility() {\n\tvar categories = \"\";\n\tvar listValues = getCategoryValues([\"catDispoSuccursale\", \"catDispoEnLigne\"]);\n\tif (listValues != \"\")\n\t\tcategories = \"(@tpdisponibilite==(\" + listValues + \"))\";\n\t\n\treturn categories;\n}", "function saveListNewProduct() {\n\n // event.preventDefault();\n\n let idcateg = document.querySelectorAll('.displayCat')[0].getAttribute('idcat');\n let nbc = document.querySelectorAll('.contratCat').length;\n for (a = 0; a < nbc; a++) {\n\n let yu = document.querySelectorAll('.contratCat')[a];\n // let ol = document.querySelectorAll('.contratCat')[a].children[0];\n // let re = ol.getAttribute('idcat');\n let re = yu.children[0].attributes[3].value;\n console.log(re);\n\n if (re == idcateg) {\n\n yu.remove(yu);\n console.log('fait !');\n }\n }\n \n\n // enregistrement du contrat list\n\n let nbrecontratCat = document.querySelectorAll('.contratCat').length;\n\n let saveDonnees = [];\n let saveDats = [];\n let saveCheques = [];\n\n for (let p = 0; p < nbrecontratCat; p++) {\n\n let contr = document.querySelectorAll('.contratCat')[p];\n let nbPdt = contr.childElementCount - 2;\n let nbCheq = contr.lastElementChild.children[0].children[0].children[0].children[1].childElementCount - 2;\n\n if (saveDonnees != 0) {\n saveDats.push({\n 'categorie': saveDonnees,\n 'Cheques': saveCheques\n })\n }\n\n saveDonnees = [];\n saveCheques = [];\n\n let nomBq = '';\n let noCheq = '';\n let mtCheq = 0;\n\n for (let k = 0; k < nbPdt; k++) {\n\n let nomSupCat = contr.children[k].getAttribute('nomSupCat');\n let nomCat = contr.children[k].getAttribute('nomCat');\n let idCat = contr.children[k].getAttribute('idCat');\n let nCheque = contr.children[k].getAttribute('ncheque');\n\n let qtite = contr.children[k].children[0].children[0].children[0].textContent;\n let nomPdt = contr.children[k].children[0].children[0].children[0].getAttribute('namePdt');\n\n let idPdt = contr.children[k].children[0].children[0].children[0].getAttribute('idPdt');\n let totalCat = contr.children[k].children[0].children[0].children[2].children[0].value;\n // console.log(totalCat);\n\n saveDonnees.push({\n\n 'Nom_user': userName,\n 'Id_user': userId,\n 'Nom_SuperCategorie': nomSupCat,\n 'Nom_Categorie': nomCat,\n 'id_Categorie': idCat,\n 'Nbre_cheque': nCheque,\n 'quantite': qtite,\n 'nom_produit': nomPdt,\n 'id_produit': idPdt,\n 'total': parseFloat(totalCat).toFixed(2)\n })\n }\n\n for (let v = 0; v < nbCheq; v++) {\n\n nomBq = contr.lastElementChild.children[0].children[0].children[0].children[1].children[v].children[1].value;\n noCheq = contr.lastElementChild.children[0].children[0].children[0].children[1].children[v].children[2].value;\n mtCheq = parseFloat(contr.lastElementChild.children[0].children[0].children[0].children[1].children[v].children[3].value).toFixed(2);\n\n saveCheques.push({\n 'nom_Bq': nomBq,\n 'no_Cheq': noCheq,\n 'montant_Cheq': mtCheq\n })\n }\n \n }\n if (saveDonnees != 0) {\n\n saveDats.push({\n 'categorie': saveDonnees,\n 'Cheques': saveCheques\n })\n localStorage.setItem('contrats', JSON.stringify(saveDats));\n }\n else {\n localStorage.removeItem('contrats');\n}\n\n //############ enregistrer : ######### \n\n\n let nbCat = document.querySelectorAll('.displayCat').length;\n let nc = document.querySelectorAll('.displayCat')[0].getAttribute('nbrecheque');\n\n let saveDat = [];\n let saveData = [];\n let Cheques =[];\n let nameUser = document.querySelector('#header').getAttribute('nameuser');\n let idUser = document.querySelector('#header').getAttribute('iduser');\n\n\n if (saveData != 0) {\n saveDat.push({\n 'categorie': saveData,\n 'Cheques': Cheques\n })\n }\n \n saveData = [];\n Cheques = [];\n \n for (let l = 0; l < nbCat; l++) {\n \n let ncheque = document.querySelector('.displayCat').getAttribute('nbrecheque');\n let qte = document.querySelectorAll('.displayCat > td.qtite > input.Qt')[l].value;\n let nomSuperCat = document.querySelector('.displayCat').getAttribute('nomsupcat');\n let nomCat = document.querySelector('.displayCat').getAttribute('nomcat');\n let catId = document.querySelector('.displayCat').getAttribute('idcat');\n let pdtId = document.querySelectorAll('.displayCat > td.nomPdt')[l].getAttribute('idpdt');\n let nom = document.querySelectorAll('.displayCat > td.nomPdt')[l].textContent;\n let Total = parseFloat(document.querySelectorAll('.displayCat > td > input.Tot')[l].value);\n if (Total > 0) {\n \n saveData.push({\n 'Nom_user': nameUser,\n 'Id_user': idUser,\n 'Nom_SuperCategorie': nomSuperCat,\n 'Nom_Categorie': nomCat,\n 'id_Categorie': catId,\n 'Nbre_cheque': ncheque,\n 'quantite': qte,\n 'nom_produit': nom,\n 'id_produit': pdtId,\n 'total': parseFloat(Total).toFixed(2) \n });\n }\n }\n\n for (e = 0; e < nc; e++) {\n\n Cheques.push({\n 'nom_Bq': '',\n 'no_Cheq': '',\n 'montant_Cheq': 0\n })\n }\n\n if (saveData != 0) {\n saveDat.push({\n 'categorie': saveData,\n 'Cheques': Cheques\n })\n }\n \n if (localStorage.getItem('contrats') != null) {\n let ajoutContrat = JSON.parse(localStorage.getItem('contrats'));\n \n ajoutContrat.push({\n 'categorie': saveData,\n 'Cheques': Cheques\n })\n\n if (saveData != 0)\n \n localStorage.setItem('contrats', JSON.stringify(ajoutContrat));\n \n } else {\n \n localStorage.setItem('contrats', JSON.stringify(saveDat));\n }\n \n // ############ shutdown window products #######\n\n shutDownWin(event);\n\n // document.querySelector('.noDisplayPdt').style.display = 'none';\n \n // document.querySelector('#container').style.opacity = 1;\n // document.querySelector('footer').style.opacity = 1;\n\n // document.querySelectorAll('.list-categorie').forEach((elmt) => {\n // elmt.classList.remove('noDisplay');\n // elmt.classList.remove('displayCat');\n // })\n\n // let globalT = document.querySelector('.globalTotal');\n // globalT.value = 0;\n\n // let NbreLigne = document.querySelectorAll('.list-categorie').length;\n\n // for (let k = 0; k < NbreLigne; k++) {\n // let Tot = document.querySelectorAll('input.Tot')[k];\n // let Qte = document.querySelectorAll('input.Qt')[k];\n // Tot.value = 0;\n // Qte.value = 0;\n // } \n\n\n // window.location.href = '//127.0.0.1:4600/contrats';\n // const GetContratAjPdt = new GetLocalStorage(JSON.parse(localStorage.getItem('contrats')));\n // (getContratList())();\n }", "function createGameCategoryAll(){\n\tGames.forEach(game => game.categories.push(\"Games\"));\n\tGameCategories.push(\"Games\");\n}", "function WR_Shortcode_Product_Categories() {\n\t \tvar button = $( '.sc-cat-list[data-expand=\"true\"]' ).children( 'a' );\n\t \t$( '.sc-cat-list[data-expand=\"true\"] ul' ).hide();\n\n\t \tbutton.on( 'click', function() {\n\t \t\t$( this ).next().slideToggle();\n\t \t} );\n\t }", "get category () {\n\t\treturn this._category;\n\t}", "get category () {\n\t\treturn this._category;\n\t}", "get category () {\n\t\treturn this._category;\n\t}", "get category () {\n\t\treturn this._category;\n\t}", "function categoriesSerialzers(catgeories) {\n var keys = [];\n _.forEach(categories, function(current) {\n var obj = {};\n var id = Object.keys(current)[0];\n if (current[id]) {\n obj['id'] = id;\n obj['name'] = current[id];\n obj['icon'] = iconsArray[current[id].toUpperCase()];\n keys.push(obj);\n }\n });\n return keys;\n }", "async function getcategaries() {\n const response = await fetch(\"http://localhost:8000/api/categaries\");\n const body = await response.json();\n console.log(\"response from api : \", body);\n setCategories(\n body.plantCategories.map(({ category, id }) => ({\n label: category,\n value: id,\n }))\n );\n }", "function storeCategories(data){\n return {\n type: STORE_CATEGORIES,\n data\n };\n}", "function setShop(id){\n var category = document.getElementById(id);\n\n //Se è un campo della modifica imposto la variabile di controllo\n if(id.substr(0, 3) == \"mod\"){\n checkModify = true;\n }\n\n //Elimino l'ultimo valore se ce ne sono più di 2\n var length = category.length;\n if(length >= 2){\n category.remove(1);\n }\n //Creo una nuova option\n var option = document.createElement(\"option\");\n\n //prendo il tag del negozio selezionato\n var li = document.getElementsByClassName(\"selected\")[document.getElementsByClassName(\"selected\").length - 1];\n\n //Inserisco all'interno della variabile il valore del paragrafo creato alla selezione della categoria\n option.setAttribute(\"value\", li.id);\n\n //Inserisco l'option creata e la seleziono\n category.appendChild(option);\n category.getElementsByTagName('option')[1].setAttribute(\"selected\", true);\n\n confirmMod();\n}", "function agregarAlCarrito() {\n /* Función que agrega un producto al carrito. utiliza el atributo \"alt\" del botón clickeado para obtener el código del producto a agregar. Cada vez que se agrega un producto se vuelve a generar la tabla que se muestra en pantalla.*/\n var elCodigo = $(this).attr(\"alt\");\n var laPosicion = buscarCodigoProducto(elCodigo);\n var productoAgregar = listadoProductos[laPosicion];\n carrito[carrito.length] = productoAgregar;\n armarTablaCarrito();\n }", "function preencherCategoria ( dados ) {\n $(\"#msg\").html(\"\");\n $(\".split\").prepend(\"<div class='navbar-dark text-center bg-dark p-4'><a href='index.html' class='btn btn-primary'>Início</a><a href='#'' class='btn btn-danger'>Sair</a></div>\");\n $.each( dados, function ( key, val ) {\n $(\".navbar-nav\").prepend(\"<li><a class='text-light' style='font-size: 15px;' href='categorias.html?id=\"+val.catcodigo+\"'>\"+val.catdescricao+\"</a></li>\");\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}", "function cateFilter() {\r\n var brandVal = document.querySelectorAll('input[name=\"category\"]:checked');\r\n var brandData = [];\r\n brandVal.forEach((elem) => {\r\n elem.checked ? brandData.push(elem.value) : null ;\r\n })\r\n var resultBrand = []; \r\n brandData.forEach((val) => {\r\n resultBrand = resultBrand.concat(productData.filter((product) => product.category.includes(val)))\r\n \r\n })\r\n brandData.length!==0? cards(resultBrand):cards(productData)\r\n \r\n}", "function addCategory(e) {\n if (e.value === 'entree') {\n createCategorySection('Entrees', 'entree', 'Add Entree')\n } else if (e.value === 'appetizer') {\n createCategorySection('Appetizers', 'appetizer', 'Add Appetizer')\n } else if (e.value === 'dessert') {\n createCategorySection('Desserts', 'dessert', 'Add Dessert')\n } else if (e.value === 'sides') {\n createCategorySection('Sides', 'sides', 'Add Side')\n } else if (e.value === 'addOn') {\n createCategorySection('Add-On', 'addOn', 'Add Add-On')\n } else if (e.value === 'soupOrSalad') {\n createCategorySection('Soups & Salads', 'soupOrSalad', 'Add Soup or Salad')\n } else if (e.value === 'kidsMenu') {\n createCategorySection('Kids Menu Item', 'kidsMenuItem', 'Add Kids Item')\n } else if (e.value === 'otherFood') {\n createCategorySection('Other Food', 'otherFood', 'Add Other Food')\n } else if (e.value === 'wine') {\n createCategorySection('Wine', 'wine', 'Add Wine')\n } else if (e.value === 'beer') {\n createCategorySection('Beer', 'beer', 'Add Beer')\n } else if (e.value === 'cocktails') {\n createCategorySection('Cocktails', 'cocktail', 'Add Cocktail')\n } else if (e.value === 'nonAlcoholic') {\n createCategorySection('Non-Alcoholic', 'nonAlcoholic', 'Add Non-Alcoholic')\n } else if (e.value === 'afterDinnerDrink') {\n createCategorySection('After Dinner Drinks', 'afterDinnerDrink', 'Add After Dinner Drink')\n } else if (e.value === 'otherDrink') {\n createCategorySection('Other Drinks', 'otherDrink', 'Add Other Drink')\n }\n $(\".categorySelector option[value='\" + e.value + \"']\").remove();\n $('select').material_select();\n //Found this line from stackoverflow and it fixed the \"need to click dropdown twice\" bug so I'm gonna keep it\n document.querySelectorAll('.select-wrapper').forEach(t => t.addEventListener('click', e=>e.stopPropagation()))\n}", "function filterCategory(cat) {\n //if all is selected, displays all products\n if (cat.toLowerCase() === \"all\") {\n Products(products);\n }\n //filters products depending on category selected\n else {\n let filteredProducts = products.filter(\n prod => prod.category === cat.toLowerCase()\n );\n Products(filteredProducts);\n }\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}", "setCategories(cat) {\n for (let c of cat) {\n this.allCategories.push({\n id: c.id,\n title: c.title,\n toggle: false\n });\n }\n }", "getSizeCategory() {\n return this.cl_.getSizeCategory();\n }", "get category() {\n\t\treturn this.__category;\n\t}", "function getCategory(id){\n return _categoryProducts.filter(category=>category.id===id*1)[0];\n}", "function Categorical(chart, exclusions) {\n var categories = {};\n var categoriesValues = {};\n var valueSets = [];\n var valueMap = {}\n\n chart.selectedFieldNames.map(function(field) {\n var values = {};\n chart.chartData.map(function(datum, i) {\n var value = datum[field];\n\t var key = field + \":\" + value;\n\t values[key] = true;\n\t if (!(key in categories)) categories[key] = [];\n\n\t categories[key].push(i);\n });\n values = Object.keys(values);\n\n /*\n if (values.length > 20)\n throw new Error(\"Diagram is too complex: Field \" + field + \n\t \" has too many values\" + values.legnth + \n\t \"(20 max) please simplify by choosing different fields\"); \n */\n\n valueMap[field] = values;\n valueSets.push(values);\n });\n\n cartesianProductOf(valueSets).map(function(intersectKeys) {\n var categoryLists = intersectKeys.map(function(c) { return categories[c]; });\n var compoundKey = intersectKeys.sort().join(\";\");\n categories[compoundKey] = _.intersection.apply(null, categoryLists);\n });\n\n // Update the chart object\n Charts.direct.update(chart._id, {$set: {valueMap: valueMap, categories: categories}});\n}" ]
[ "0.6824172", "0.62069243", "0.61706656", "0.6168234", "0.6161641", "0.6113012", "0.6080224", "0.6078219", "0.60684687", "0.60113174", "0.6008036", "0.59902835", "0.59564185", "0.59369546", "0.5920561", "0.5902915", "0.5897361", "0.584797", "0.5830665", "0.57977146", "0.57916737", "0.5787711", "0.5785655", "0.5770195", "0.5759812", "0.5753389", "0.574412", "0.56989354", "0.564374", "0.56394273", "0.56248015", "0.5624752", "0.56100315", "0.56084925", "0.5585443", "0.55824333", "0.5573156", "0.555586", "0.55529875", "0.554345", "0.5542381", "0.55324256", "0.5516198", "0.5490683", "0.54779136", "0.5473479", "0.5470036", "0.54678494", "0.5460911", "0.5460587", "0.54517055", "0.5450522", "0.5436808", "0.54346967", "0.54335666", "0.541887", "0.5416488", "0.54118234", "0.54111344", "0.539966", "0.5392496", "0.537612", "0.53613836", "0.534987", "0.5346257", "0.53409475", "0.5340673", "0.53345156", "0.5324651", "0.53199476", "0.5302854", "0.5301463", "0.5283572", "0.5282117", "0.52779007", "0.5276888", "0.52766305", "0.52747667", "0.527178", "0.52698606", "0.52691895", "0.52639323", "0.52639323", "0.52639323", "0.52639323", "0.52527595", "0.5252415", "0.5251586", "0.525142", "0.5251161", "0.5245474", "0.5241764", "0.5240148", "0.5232449", "0.52296054", "0.5227432", "0.5226942", "0.5223995", "0.52231646", "0.5210521", "0.5193718" ]
0.0
-1
Cart de datos de los iconos que se van a mostrar el en contenedor
function DatIcont() { return '<option value="1">👕</option>' + '<option value="2">👟</option>' + '<option value="3">👞</option>' + '<option value="4">👖</option>' + '<option value="5">💻</option>' + '<option value="6">📱</option>' + '<option value="7">🔫</option>' + '<option value="8">👙</option>' + '<option value="9">🎮</option>' + '<option value="10">🎸</option>' + '<option value="11">♟</option>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cargarIconos(){\n // iconos para mostrar puntos\n estilosMarcadores[\"carga\"] = styles.marcadorCarga();\n estilosMarcadores[\"traslado\"] = styles.marcadorTraslado();\n }", "function cargarIconos(){\n // iconos para mostrar puntos\n estilosActuales[\"carga\"] = styles.marcadorCarga();\n //corregir esto\n estilosActuales[\"Taxi/Remis\"] = styles.marcadorTraslado();\n // default\n estilosActuales[\"default\"] = styles.marcadorDefault();\n }", "function cargarIconos(table) {\n styleCheckbox(table);\n updateActionIcons(table);\n updatePagerIcons(table);\n enableTooltips(table);\n}", "function printIcons(icons, contenitoreIcone) {\r\n icons.forEach((icon)=>{\r\n const {family, prefix, name, color} = icon;\r\n const html =//parte di html\r\n `<div class=\"icon\">\r\n <i class=\"${family} ${prefix}${name}\"\r\n style=\"color: ${color}\"></i>\r\n <div class=\"nomeIcona\">${name}</div>\r\n </div>\r\n `\r\n contenitoreIcone.append(html);\r\n return\r\n });\r\n\r\n\r\n}", "function escribirCantidadIconCarrito(cantidadcarrito){\n iconcarrito.textContent=cantidadcarrito;\n}", "function icons() {\r\n var arr = [], style = 'style=\"width:18px\"';\r\n if (iconMapper.map(link)) add(iconMapper.map(link));\r\n if (iconMapper.map(obj.Type)) add(iconMapper.map(obj.Type));\r\n if (reg !== 'Message' && iconMapper.map(reg)) add(iconMapper.map(reg));\r\n if (detail.contains('email')) add(iconMapper.map('email'));\r\n if (detail.contains('SMS')) add(iconMapper.map('sms'));\r\n\r\n //make sure there is exactly 2 icons\r\n arr.first(2);\r\n while (arr.length < 2) {\r\n arr.push('icon-blank');\r\n }\r\n\r\n if (arr.length) {\r\n return '<i ' + style + ' class=\"' + arr.join(' icon-large muted disp-ib\"></i> <i ' + style + ' class=\"') + ' icon-large muted disp-ib\"></i> ';\r\n } else {\r\n return '';\r\n }\r\n function add(i) {\r\n if (!arr.contains(i)) arr.push(i);\r\n }\r\n }", "function updateIcons() {\n if (vm.buttons) {\n for (var i = 0 , length = vm.buttons.length; i < length ; i++) {\n constructIconObject(vm.buttons[i]);\n }\n }\n }", "generateIcons() {\n const terminalBase = Core.atlas.find(this.name);\n const terminalDisplay = Core.atlas.find(this.name + \"-display-icon\");\n return [terminalBase, terminalDisplay];\n }", "function showIcons(data) {\n\t\tvar names = [];\n\t\tvar all = [];\n\n\t\tfor(var x in data) {\n\t\t\tnames.push(data[x].name);\n\t\t\tvar obj = {name: data[x].name, id: data[x].id, key: data[x].key};\n\t\t\tall.push(obj);\n\t\t}\n\t\tnames.sort();\n\t\tfor (var i=0; i < names.length; i++) {\n\t\t\tfor (var x in all) {\n\t\t\t\tif (names[i] == all[x].name) {\n\t\t\t\t\tchampionsNames.push(all[x].name);\n\t\t\t\t\tchampionsKeys.push(all[x].key);\n\t\t\t\t\tchampionsIds.push(all[x].id);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (var i=0; i < championsKeys.length; i++) {\n\t\t\tcreateImage(championsKeys[i], championsIds[i], championsNames[i]);\n\t\t}\n\t}", "buildIcons(){\n for(var i=0; i<this.popUpFltImgs.length; i++){\n this.buildIcon(i, false);\n }\n }", "function agregarContadorAlCarrito(cantidadDeProductosEnStorage){\n\n let numContadorCarrito = cantidadDeProductosEnStorage;\n \n //vista\n carritoIcon.style.position=\"relative\";\n contadorCarrito.style.borderRadius=\"50px\";\n contadorCarrito.style.backgroundColor=\"#6F5CF3\";\n contadorCarrito.style.width=\"17px\";\n contadorCarrito.style.height=\"17px\";\n contadorCarrito.style.position=\"absolute\";\n contadorCarrito.style.top=\"22px\";\n contadorCarrito.style.left=\"22px\";\n contadorCarrito.style.color=\"white\";\n contadorCarrito.style.textAlign=\"center\";\n contadorCarrito.style.fontSize=\"12px\";\n contadorCarrito.style.display=\"inline-block\";\n contadorCarrito.textContent=numContadorCarrito;\n \n if(numContadorCarrito > 5){\n\n contadorCarrito.style.fontSize=\"11px\";\n \n contadorCarrito.textContent=5+\"+\";\n \n }\n\n if(localStorage.length == 0){\n\n contadorCarrito.style.display=\"none\";\n\n }\n\n carritoIcon.append(contadorCarrito);\n \n}", "function IconData(){\n var iconData = {\n \"01d\":\"☀️\",\n \"01n\":\"🌙\",\n \"02d\":\"🌤️\", \n \"02n\":\"🌤️\",\n \"03d\":\"⛅\",\n \"03n\":\"⛅\",\n \"04d\":\"☁️\",\n \"04n\":\"☁️\",\n \"09d\":\"🌦️\",\n \"09n\":\"🌧️\",\n \"10d\":\"🌦️\",\n \"10n\":\"🌧️\",\n \"11d\":\"🌩️\",\n \"11n\":\"🌩️\",\n \"13d\":\"❄️\",\n \"13n\":\"❄️️\",\n \"50d\":\"🌫️\",\n \"50n\":\"🌫️\",\n };\n \n\nreturn iconData;\n}", "function setBartenderIcon() {\n const orderContainers = document.querySelectorAll(\".order-container\");\n\n orderContainers.forEach((order) => {\n const icon = document.createElement(\"img\");\n icon.classList.add(\"bartender-icon\");\n\n // finde sourcen fra DOM fordi parcel laver filnavne om\n const dSource = document.querySelector(\".d-bartender-icon\").getAttribute(\"src\");\n const pSource = document.querySelector(\".p-bartender-icon\").getAttribute(\"src\");\n const jSource = document.querySelector(\".j-bartender-icon\").getAttribute(\"src\");\n\n if (order.classList.contains(\"peter\")) {\n // add peter icon\n icon.src = pSource;\n } else if (order.classList.contains(\"jonas\")) {\n // add jonas icon\n icon.src = jSource;\n } else if (order.classList.contains(\"dannie\")) {\n // add dannie icon\n icon.src = dSource;\n }\n order.appendChild(icon);\n });\n}", "function cargaImagenes() {\n for (var i = 0; i < 12; i++) {\n fuentesNotas[i] = p.loadImage(\"fuentes/\" + i + \".png\");\n }\n }", "function printIcons(array, container) {\r\n //rimuovo tutti i figli del DOM -> ripulisco il container\r\n container.html('');\r\n\r\n //ciclo forEach di icons per trovare le info che ho definito\r\n array.forEach((info) => {\r\n //destracturing per ricavare le info che voglio\r\n const {color, family, name, prefix} = info;\r\n \r\n //template literal\r\n const elementHTML =`\r\n <div>\r\n <div class=\"box\">\r\n <i class=\"${family} ${prefix}${name}\" style=\"color: ${color}\"></i>\r\n <div style=\"color: ${color}\" class=\"title\">${name.toUpperCase()}</div>\r\n </div>\r\n </div>\r\n `\r\n //inserisco l'elemento nell'HTML \r\n container.append(elementHTML);\r\n });\r\n}", "addIcons(){\n\n // Icon sizes make the icon smaller as the stone moves in\n this.iconSizes = ['32px','30px','28px','26px','24px','22px']\n\n // Add elements for all the icons\n var iconConifer = $('<div class=\"well-icon-wrapper\"><span class=\"well-icon fas fa-tree\" id=\"icon-conifer\"></span></div>')\n var iconScissors = $('<div class=\"well-icon-wrapper\"><span class=\"well-icon fas fa-cut\" id=\"icon-scissors\"></span></div>')\n var iconBell = $('<div class=\"well-icon-wrapper\"><span class=\"well-icon fas fa-bell\" id=\"icon-bell\"></span></div>')\n var iconCamera = $('<div class=\"well-icon-wrapper\"><span class=\"well-icon fas fa-camera\" id=\"icon-camera\"></span></div>')\n var iconFlag = $('<div class=\"well-icon-wrapper\"><span class=\"well-icon fas fa-flag\" id=\"icon-flag\"></span></div>')\n var iconHeadphones = $('<div class=\"well-icon-wrapper\"><span class=\"well-icon fas fa-headphones\" id=\"icon-headphones\"></span></div>')\n var iconSuitcase = $('<div class=\"well-icon-wrapper\"><span class=\"well-icon fas fa-lock\" id=\"icon-suitcase\"></span></div>')\n var iconClock = $('<div class=\"well-icon-wrapper\"><span class=\"well-icon fas fa-clock\" id=\"icon-clock\"></span></div>')\n var iconMusic = $('<div class=\"well-icon-wrapper\"><span class=\"well-icon fas fa-music\" id=\"icon-music\"></span></div>')\n var iconPencil = $('<div class=\"well-icon-wrapper\"><span class=\"well-icon fas fa-pen\" id=\"icon-pencil\"></span></div>')\n var iconEnvelope = $('<div class=\"well-icon-wrapper\"><span class=\"well-icon fas fa-envelope\" id=\"icon-envelope\"></span></div>')\n var iconHeart = $('<div class=\"well-icon-wrapper\"><span class=\"well-icon fas fa-heart\" id=\"icon-heart\"></span></div>')\n\n // Create a list of all their icons and positions\n this.iconsList = [{icon:iconConifer,id:\"icon-conifer\", col:1,row:51},\n {icon:iconScissors,id:\"icon-scissors\", col:3,row:7},\n {icon:iconBell,id:\"icon-bell\", col:1,row:49},\n {icon:iconCamera,id:\"icon-camera\", col:4,row:36},\n {icon:iconFlag,id:\"icon-flag\", col:0,row:30},\n {icon:iconHeadphones,id:\"icon-headphones\", col:3,row:59},\n {icon:iconSuitcase,id:\"icon-suitcase\", col:2,row:26},\n {icon:iconClock,id:\"icon-clock\", col:0,row:13},\n {icon:iconMusic,id:\"icon-music\", col:1,row:73},\n {icon:iconPencil,id:\"icon-pencil\", col:1,row:74},\n {icon:iconEnvelope,id:\"icon-envelope\", col:4,row:55},\n {icon:iconHeart,id:\"icon-heart\", col:0,row:67}\n ]\n\n // Loop through all icons and add them \n for (var icon of this.iconsList) {\n\n // Get the row and column to add it to from the list of icons\n var iconRow = icon.row\n var iconCol = icon.col\n\n // Select the right stone\n var stone = $('.well-grid-cell-wrapper[data-grid-row=\"'+icon.row+'\"][data-grid-col=\"'+icon.col+'\"]')\n\n // Append the icon to the stone\n stone.append(icon.icon)\n \n // Set the font size of the icons\n $('.well-icon').css({\"font-size\":\"32px\"})\n\n }\n\n }", "function iconize() {\n var lists = $(\"#show-data > li\");\n $(lists).has(\"span:contains('ARTICLE')\").prepend('<i style=\"font-size:15px;color:rgba(80, 80, 80, 0.97);padding-right:5px;cursor:pointer;margin-left:-18px;\" class=\"fa fa-plus\" ></i>').wrap('<div class=\"icon\"></div>');\n $(lists).has(\"span:contains('TOPIC')\").wrap('<div class=\"maintopic\"></div>');\n if ($(\"div.icon + div.icon\").length) {\n $(\"div.icon + div.icon\").prev().find('i').css('display', 'none');\n }\n if ($(\"div.icon + div.maintopic\").length) {\n $(\"div.icon + div.maintopic\").prev().find('i').css('display', 'none');\n }\n\n if ($('#show-data div.icon:last-child + div').length > -1) {\n $('#show-data div.icon:last-child').find('i').css('display', 'none');\n }\n\n $(\"#show-data li\").find(\"i\").click(function() {\n if ($(this).hasClass('fa-minus')) {\n $(this).attr('class', 'fa fa-plus');\n var next = $(this).parent(\"li.treeline\").closest(\"div.icon\").nextUntil(\"div\");\n next.slideUp();\n } else {\n $(this).attr('class', 'fa fa-minus');\n var next = $(this).parent(\"li.treeline\").closest(\"div.icon\").nextUntil(\"div\");\n next.slideDown();\n }\n });\n }", "function obtenerCabezalNoticia(categoria, resultado, i)\n{\n titulo = resultado.data[i].attributes.title;\n\n // Esta parte carga la primera imagen de la noticia que vamos a usar como\n // representante en la cabecera, si no tiene imagen entonces usamos la por defecto//\n var str = resultado.data[i].attributes.body.value;\n var ele = document.createElement(\"div\");\n ele.innerHTML = str;\n var imagen = ele.querySelector(\"img\");\n\n if (imagen === null)\n {\n ele.innerHTML = \"<img src='img/logo.png'></img>\";\n imagen = ele.querySelector(\"img\");\n }\n\n // Esta parte arma la pieza y la retorna\n pieza = \"<li><a href='#PaginaDetalleNoticia' data-idprod='\" +\n resultado.data[i].attributes.uuid +\n \"' data-cat='\" + categoria + \"' onclick='cargarDetalle($(this))'>\" +\n imagen.outerHTML +\n resultado.data[i].attributes.title +\n \"</a> <a class='ui-btn ui-btn-icon-right'href='#'</a></li>\"\n\n return pieza;\n}", "function imagen_cartas(carta,clase) {\n \n var palo;\n var denominacion;\n var imagen = '<img src=\\\"/images/cards/';\n var id=\"\";\n \n if (carta.denominacion === '10') {\n denominacion = 't';\n }else{\n denominacion = carta.denominacion.toLowerCase();\n }\n \n imagen += denominacion;\n \n switch (carta.palo) {\n case 'CORAZON':\n palo = \"h\"\n break;\n \n case 'DIAMANTE':\n palo = \"d\"\n break;\n case 'TREBOL':\n palo = \"c\"\n break\n \n case 'PICA':\n palo = \"s\"\n break;\n }\n var id= carta.palo + \"_\" + carta.denominacion;\n \n return imagen + palo + '.gif\\\" class =\\\"' + clase + '\\\" id=\\\"' + id + '\\\"/>';\n }", "function init_inpt_formulario_cargar_categoria_icono() {\n var selectIcono = mdc.select.MDCSelect.attachTo(document.querySelector('#slc-icono'));\n\n selectIcono.listen('MDCSelect:change', () => {\n $(\"#slc-icono .mdc-select__selected-text\").css(\"display\", \"none\");\n $(\"#slc-icono .mdc-select__selected-text\").empty();\n\n var indexOfChild = selectIcono.foundation_.selectedIndex_ + 1;\n var liSelected = $(\"#slc-icono li[name='categoria-icono']:nth-child(\" + indexOfChild + \")\");\n var icono = liSelected.find(\"i:first\")[0];\n var newIcono = $(icono).clone();\n\n newIcono.css(\"color\", $(\"#slc-color\").css(\"background-color\"));\n newIcono.appendTo(\"#slc-icono .mdc-select__selected-text\");\n\n $(\"#slc-icono .mdc-select__selected-text\").css(\"display\", \"block\");\n });\n\n // icono seleccionado\n var icono_seleccionado = $('#slc-icono').attr('data-icono');\n var iIconoSelected = $(\"#slc-icono i[name='\" + icono_seleccionado + \"']\");\n iIconoSelected.closest(\"li\").attr('aria-selected', 'true');\n selectIcono.foundation_.selectedIndex_ = parseInt(iIconoSelected.attr(\"data-index\"));\n selectIcono.foundation_.adapter_.notifyChange();\n}", "function cartasToScreen(numero, figura, posicion, condicional) {\n let listaCartas = document.querySelector(`.${posicion}`);\n if (condicional == 2) {\n listaCartas.innerHTML = \"\";\n document.getElementById(\"prueba\").innerHTML = \"\";\n } else {\n console.log(\"\");\n }\n for (let x = 0; x < numero.length; x++) {\n // Crear div\n let newDivDemoClass = document.createElement(\"div\");\n let subDivFiguraIzquierda = document.createElement(\"div\");\n let subDivFiguraDerecha = document.createElement(\"div\");\n let subDivNumero = document.createElement(\"div\");\n //\n let textForFiguraIzquierda = document.createTextNode(`${figura[x]}`);\n let textForFiguraDerecha = document.createTextNode(`${figura[x]}`);\n let textForNumero = document.createTextNode(`${numero[x]}`);\n let att = document.createAttribute(\"class\");\n let attFiguraIzquierda = document.createAttribute(\"class\");\n let attNumero = document.createAttribute(\"class\");\n let attFiguraDerecha = document.createAttribute(\"class\");\n att.value = `${posicion}`;\n attFiguraIzquierda.value = \"izquierda\";\n attNumero.value = \"numero\";\n attFiguraDerecha.value = \"derecha\";\n // Agregando text a SubDiv\n subDivFiguraIzquierda.appendChild(textForFiguraIzquierda);\n subDivFiguraDerecha.appendChild(textForFiguraDerecha);\n subDivNumero.appendChild(textForNumero);\n\n if (retornoFigura[x] == \"♠\" || retornoFigura[x] == \"♣\") {\n console.log(retornoFigura[x]);\n console.log(subDivFiguraDerecha);\n subDivFiguraDerecha.style = \"color:black\";\n subDivFiguraIzquierda.style = \"color:black\";\n subDivNumero.style = \"color:black\";\n }\n\n //\n listaCartas.appendChild(newDivDemoClass);\n newDivDemoClass.appendChild(subDivFiguraIzquierda);\n newDivDemoClass.appendChild(subDivNumero);\n newDivDemoClass.appendChild(subDivFiguraDerecha);\n listaCartas.setAttributeNode(att);\n //listaCartas.classList.add(\"row\");\n //Agregar div todos\n subDivFiguraIzquierda.setAttributeNode(attFiguraIzquierda);\n subDivNumero.setAttributeNode(attNumero);\n subDivFiguraDerecha.setAttributeNode(attFiguraDerecha);\n }\n prueba.style = `grid-template-columns: repeat(${numero.length}, auto)`;\n //prueba2.style = `grid-template-columns: repeat(${figura.lenght}, auto)`;\n}", "function addIcon(name, data) {\n storage[name] = icon.fullIcon(data);\n}", "function printIcons (array , container) {\n\n let selectedIcon = \"\";\n\n array.forEach((element) => {\n\n let {name, prefix, type, family, color} = element\n\n selectedIcon += `\n <div class\"icon-container\">\n <i class=\" ${family} ${prefix}${name}\" style=\"color:${color}\"></i>\n <h4 class\"icon-name\"> ${name} (${type}) </h4>\n </div>\n \n `\n });\n\n container.innerHTML = selectedIcon;\n}", "function colorareIcone (icons, colors) {\r\nconst types = getType(icons);\r\nconsole.log(types);\r\n// creo new array non toccando il primo e iteo con le icone\r\nconst iconeColarate = icons.map((icon) => {\r\n const index = types.indexOf(icon.type);\r\n // copia esatta\r\n return {\r\n ...icon,\r\n color: colors[index]\r\n }\r\n});\r\nreturn iconeColarate;//ritorno risultato\r\n}", "function massageIconData(data) {\r\n return angular.forEach(data, function(d) { \r\n d.thumbUrl = \"http://www.appreciateui.com/api/icon_downloader.php?id=\" + d.url + \"&w=256&h=256&ext=\" + d.ext;\r\n });\r\n}", "function renderizarProductos(){\n document.querySelectorAll(\".contenedorDeClase\").forEach(el => el.remove());\n\n for (const Clase of listaCompletaClases) {\n let contenedor = document.createElement(\"div\");\n contenedor.classList.add(\"contenedorDeClase\");\n //--> PLANTILLA LITERAL para mostrar las clases\n contenedor.innerHTML = `<img src=\"images/${Clase.imagen}.png\">\n <h3> ${Clase.disciplina}</h3>\n <h6> Días: ${Clase.dia}</h6>\n <h6> Horario: ${Clase.horario}</h6> \n <h6> Lugares: ${Clase.lugares}</h6>\n <button id=btn${Clase.id} class=\"mi-btn btn btn-danger addToCart\">RESERVAR</button>`;\n cursosDestacados.appendChild(contenedor);\n //--> EVENTO para cada boton\n $(`#btn${Clase.id}`).on(\"click\", function() {\n //Sumar clases al numero de clases\n sumarAlCarrito();\n //Sumar al carrito\n carrito.push(Clase);\n //Informar clase reservada\n console.log(`Reservaste ${Clase.disciplina}`);\n //Guardar en local storage\n localStorage.setItem(\"carrito\", JSON.stringify(carrito));\n //Informar que fue reservada al usuario\n Swal.fire(\n '¡CLASE RESERVADA!',\n 'Reservaste ' + Clase.disciplina + ' ' + Clase.dia + ' a las ' + Clase.horario,\n 'success'\n );\n //Descontar lugares \n if (lugaresDisponibles != 0) {\n lugaresRestantes = Clase.lugares - 1;\n console.log(\"Su lugar fue reservado, quedan \" + lugaresRestantes + \" lugares restantes\");\n }\n //Mostrar info por consola\n console.log(\"El valor es de \" + totalClase);\n //Calcular monto de descuento\n calcularMontoDescontar();\n //Aplicar descuento\n aplicarDescuento();\n //Crear lista de reservas en modal\n $(\"#listaTabla\").append(\n `<table class=\"table table-striped table-hover\">\n <tbody>\n <tr class=\"d-flex justify-content-between align-items-bottom\">\n <td class=\"table text-start fs-5 fw-bold\">${Clase.disciplina}</td>\n <td class=\"table text-center fs-4 fw-bold\"><b>${Clase.dia}</b></td>\n <td class=\"table text-center fs-4 fw-bold\"><b>${Clase.horario}</b></td>\n <!-- <td class=\"table text-center\">\n <button class=\"btn btn-dark type=\"submit\" id=\"eliminar${Clase.id}\">X</button>\n </td>\n --> \n </tr>\n </tbody>\n </table>\n `);\n //Mostrar por consola el total de clases reservadas\n console.log(carrito);\n \n //CIERRE\n });\n }\n \n }", "renderIcon(data) {\n const e = document.createElement('div');\n e.className = this.createIconClass(data);\n e.appendChild(document.createTextNode(data.iconLabel));\n return e;\n }", "function renderizaInimigos(){\n\tinimigos.forEach(desenhaInimigo);\n\tinimigosAndam();\n}", "function renderizarProductos() {\n baseDeDatos.forEach((info) => {\n // Estructura\n const miNodo = document.createElement('div');\n miNodo.classList.add('card', 'col-sm-4');\n // Body\n const miNodoCardBody = document.createElement('div');\n miNodoCardBody.classList.add('card-body');\n // Titulo\n const miNodoTitle = document.createElement('h5');\n miNodoTitle.classList.add('card-title');\n miNodoTitle.textContent = info.nombre;\n // Imagen\n const miNodoImagen = document.createElement('img');\n miNodoImagen.classList.add('img-fluid');\n miNodoImagen.setAttribute('src', info.imagen);\n // Precio\n const miNodoPrecio = document.createElement('h2');\n miNodoPrecio.classList.add('card-text');\n miNodoPrecio.textContent = '$'+info.precio ;\n\n //Descripción\n const miNodoDescripcion = document.createElement('p');\n miNodoDescripcion.classList.add('card-description');\n miNodoDescripcion.textContent = info.descripcion;\n // Boton \n const miNodoBoton = document.createElement('button');\n miNodoBoton.classList.add('btn', 'btn-primary');\n miNodoBoton.textContent = '+';\n miNodoBoton.setAttribute('marcador', info.id);\n miNodoBoton.addEventListener('click', anyadirProductoAlCarrito);\n // Insertamos\n miNodoCardBody.appendChild(miNodoImagen);\n miNodoCardBody.appendChild(miNodoTitle);\n miNodoCardBody.appendChild(miNodoPrecio);\n miNodoCardBody.appendChild(miNodoDescripcion);\n miNodoCardBody.appendChild(miNodoBoton);\n miNodo.appendChild(miNodoCardBody);\n DOMitems.appendChild(miNodo);\n \n });\n}", "function mostrarCamposExistentes() {\n\t$(\"#contenedorConsulta\").html(\"\");\n\t\n\tfor (var pos = 0; pos < positions.length; pos++) {\n\t\tdivImagen = document.createElement(\"div\");\n\t\tdivImagen.className = \"thumbImg\";\n\t\t\n\t\t\n\t\tdivImagen.innerHTML = \n\t\t\t\"<table>\"+\n\t\t\t\t\"<tr>\"+\n\t\t\t\t\t\"<td><a href='javascript:abrirModificarCampos(\"+pos+\");'>\"+positions[pos][1]+\"</a></td>\"+\n\t\t\t\t\t\"<td width='15'>\"+\n\t\t\t\t\t\t(isBorrarTuplas ? (\"<img src='images/btnCerrar.png' width='12' style='cursor:pointer; position:relative;' onclick='bool_borrar = true; abrirModificarCampos(\"+pos+\");' />\") : \"\")+\n\t\t\t\t\t\"</td>\"+\n\t\t\t\t\"</tr>\"+\n\t\t\t\"</table>\"; \n\t\t\n\t\t$(\"#contenedorConsulta\").append(divImagen);\n\t}\n}", "function fullIcon(data) {\n return { ...exports.iconDefaults, ...data };\n}", "getProductInfo() {\n let infoButtons = [...document.querySelectorAll(\".fa-info-circle\")]; //make an array from the buttons\n infoButtonsList = infoButtons;\n\n infoButtons.forEach(button => {\n let modal = document.getElementById(\"myModal\");\n let closeModal = document.getElementsByClassName(\"fa-window-close\")[0];\n let buttonId = button.dataset.id;\n\n button.addEventListener(\"click\", () => {\n //show modal\n modal.style.display = \"block\";\n\n //display image info into the modal\n let modalInfo = { ...Storage.getProduct(buttonId) };\n this.displayModal(modalInfo);\n });\n\n closeModal.addEventListener(\"click\", () => {\n //close the modal\n modal.style.display = \"none\";\n\n //clear the modal\n this.clearModal();\n });\n });\n }", "getIcons(content) {\n switch (content) {\n case \"Logout\":\n return (\n <>\n <FiLogOut size=\"0.9rem\" />\n </>\n );\n case \"Login\":\n return (\n <>\n <FiLogIn size=\"0.9rem\" />\n </>\n );\n case \"Profile\":\n return (\n <>\n <FiUserPlus size=\"0.9rem\" />\n </>\n );\n case \"Help\":\n return (\n <>\n <FiShoppingCart size=\"0.9rem\" />\n </>\n );\n case \"Home\":\n return (\n <>\n <FiUser size=\"0.9rem\" />\n </>\n );\n case \"About\":\n return (\n <>\n <FiClipboard size=\"0.9rem\" />\n </>\n );\n case \"Contact\":\n return (\n <>\n <BsGift size=\"0.9rem\" />\n </>\n );\n case \"Staff Manager\":\n return (\n <>\n <GrUserSettings size=\"0.9rem\" />\n </>\n );\n default:\n return <></>;\n }\n }", "updateDriveSpecificIcons() {}", "updateDriveSpecificIcons() {}", "function printIcons(iconsArray, container) {\n\tcontainer.html('');\n\n\t//foreach per scrivere le icone nel container\n\t//console.log(iconsArray)\n\n\ticonsArray.forEach((element) => {\n\n\t\t//destrutturiamo element pe rprendere le informazioni\n\t\tconst {name, prefix, family, color} = element;\n\t\tconst nameUpperCase = name.toUpperCase();\n\t\t//console.log(element)\n\t\tconst iconElementHTML = `\n\t\t\t<div class=\"icon\">\n\t\t\t\t<i class=\"${family} ${prefix}${name}\" style=\"color:${color};\"></i>\n\t\t\t\t<div>${nameUpperCase}</div>\n\t\t\t</div> \n\t\t`;\n\n\t\tcontainer.append(iconElementHTML)\n\t});\n}", "function cartProductDrawUi(allProducts = []){\n // if(JSON.parse(localStorage.getItem(\"watchLater\")).length === 0)\n // empty.innerHTML=\"no products here !!\"\n\n let products = JSON.parse(localStorage.getItem(\"watchLater\")) || allProducts\n let productsUi = products.map((item) => {\n return `\n <div class=\"movies\" >\n <div id=\"empty\" > </div> \n <div class=\"title title3\">zaza</div>\n <img src=\".${item.imageUrl}\" alt=\"\">\n <div class=\"info\">\n <h4>${item.title}</h4>\n <ul>\n <li>${item.date}</li>\n <li> ${item.time}</li> \n </ul>\n </div>\n </div> \n `\n });\n \n productsDom.innerHTML = productsUi.join(\"\");\n\n }", "function getCarsImage() {\n //Quantos carros tenho na collecção\n var nCars = hiperCarros.colecao.length;\n var lista = '';\n //Adiciona a primeira imagem de cada carro na minha lista\n for (let index = 0; index < nCars; index++) {\n console.log(hiperCarros.colecao[index].imags[0]);\n lista = lista + '<div class=\"carro-lista\"><img class=\"carro-img\" src=\"../hCarros/' + hiperCarros.colecao[index].imags[0] + '\" />';\n lista = lista + hiperCarros.colecao[index].marcaModelo + ' - ' + hiperCarros.colecao[index].versao + '</div>';\n }\n return lista;\n}", "function showIcons() {\n\t$(this).find(\".upload_button\").show();\n\t$(this).find(\".close_button\").show();\n}", "function dateitypiconermittlung(dateiendung) {\n dateiendung = dateiendung.toLowerCase(); \n switch (dateiendung) {\n // Archive\n case \"7z\": icon = 'Archive/7zip'; break;\n case \"rar\": icon = 'Archive/rar'; break;\n case \"zip\": icon = 'Archive/zip'; break;\n // Audio\n case \"mp3\": icon = 'Audio/mp3'; break;\n case \"mid\": icon = 'Audio/mid'; break;\n case \"ogg\": icon = 'Audio/ogg'; break;\n case \"wav\": icon = 'Audio/wav'; break;\n case \"wma\": icon = 'Audio/wma'; break;\n case \"flac\": icon = 'Audio/flac'; break;\n case \"m4a\": icon = 'Audio/m4a'; break;\n // Bilder\n case \"bmp\": icon = 'Image/bmp'; break;\n case \"gif\": icon = 'Image/gif'; break;\n case \"jpg\": icon = 'Image/jpg'; break;\n case \"jpeg\": icon = 'Image/jpeg'; break;\n case \"png\": icon = 'Image/png'; break;\n case \"tif\": icon = 'Image/tif'; break;\n case \"eps\": icon = 'Image/eps'; break;\n case \"raw\": icon = 'Image/raw'; break;\n case \"psd\": icon = 'Image/psd'; break;\n // Office\n case \"csv\": icon = 'Office/csv'; break;\n case \"doc\": icon = 'Office/doc'; break;\n case \"docx\": icon = 'Office/docx'; break;\n case \"mdb\": icon = 'Office/mdb'; break;\n case \"mdbx\": icon = 'Office/mdbx'; break;\n case \"pdf\": icon = 'Office/pdf'; break;\n case \"ppt\": icon = 'Office/ppt'; break;\n case \"pptx\": icon = 'Office/pptx'; break;\n case \"vsd\": icon = 'Office/vsd'; break;\n case \"xls\": icon = 'Office/xls'; break;\n case \"xlsm\": icon = 'Office/xlsx'; break;\n case \"xlsx\": icon = 'Office/xlsx'; break;\n // Videos \n case \"avi\": icon = 'Video/avi'; break;\n case \"divx\": icon = 'Video/divx'; break;\n case \"flv\": icon = 'Video/flv'; break;\n case \"mkv\": icon = 'Video/mkv'; break;\n case \"mp4\": icon = 'Video/mp4'; break;\n case \"mpg\": icon = 'Video/mpg'; break;\n case \"mpeg\": icon = 'Video/mpeg'; break;\n case \"mov\": icon = 'Video/mov'; break;\n case \"wmv\": icon = 'Video/wmv'; break;\n // System\n case \"asp\": icon = 'System/asp'; break;\n case \"bat\": icon = 'System/bat'; break;\n case \"bin\": icon = 'System/bin'; break;\n case \"css\": icon = 'System/css'; break;\n case \"cue\": icon = 'System/cue'; break;\n case \"exe\": icon = 'System/exe'; break;\n case \"htm\": icon = 'System/htm'; break;\n case \"html\": icon = 'System/html'; break;\n case \"ini\": icon = 'System/ini'; break;\n case \"iso\": icon = 'System/iso'; break;\n case \"nfo\": icon = 'System/nfo'; break;\n case \"txt\": icon = 'System/txt'; break;\n case \"xml\": icon = 'System/xml'; break;\n case \"sln\": icon = 'System/sln'; break;\n case \"vcproj\": icon = 'System/vcproj'; break;\n case \"dll\": icon = 'System/dll'; break;\n default: icon = 'System/default'; break;\n }\n \n return icon;\n }", "function setNewValueCartIcon(){\n\tvar summ = 0;\n\t$('.cart span').remove();\n\tfor(var k in inBasket){\n\t\tinBasket[k] = parseInt(inBasket[k]);\n\t\tsumm += inBasket[k];\n\t} \n\treturn $('.cart').append('<span>' + summ + '</span>');\n}", "function renderItems(){\n for (let info of productos){\n\n\n // tarjeta de producto\n let tarjeta=document.createElement('div');\n tarjeta.classList.add('body-tarjeta');\n\n //Titulo\n let nombre=document.createElement('h3');\n nombre.classList.add('titulo');\n nombre.textContent=info['nombre'];\n\n //Genero\n let genero=document.createElement('p');\n genero.classList.add('genero');\n genero.textContent=info['genero'];\n\n //Imagen\n let imagen=document.createElement('img');\n imagen.classList.add('img');\n imagen.setAttribute('src', info['imagen']);\n\n //Precio\n let precio=document.createElement('h3');\n precio.classList.add('precio');\n precio.textContent=info['precio']+'€';\n\n //Boton\n let boton=document.createElement('button');\n boton.classList.add('boton');\n boton.textContent='Añadir a cesta';\n boton.setAttribute('marcador',info['tag']);\n boton.addEventListener('click', insertarenCesta);\n \n\n //insertar\n tarjeta.appendChild(imagen);\n tarjeta.appendChild(nombre);\n tarjeta.appendChild(genero);\n tarjeta.appendChild(precio);\n tarjeta.appendChild(boton);\n $items.appendChild(tarjeta);\n }\n\n\n}", "function mostrarCarrito() {\n // Limpiamos el HTML\n\n limpiarHTML();\n\n // Recorre el carrito y genera el HTML\n\n articulos_carrito.forEach((curso) => {\n const { img, titulo, precio, cantidad, id } = curso;\n\n const row = document.createElement('tr');\n\n row.innerHTML = `\n <td>\n <img src=\"${img}\">\n </td>\n\n <td>\n ${titulo}\n </td>\n <td>\n ${precio}\n </td>\n <td>\n ${cantidad}\n </td>\n \n <td>\n <a href='#' class=\"borrar-curso\" data-id=\"${id}\"> X </a>\n </td>\n `;\n\n // Agrega el contenido del carrito en el tbody\n contenedor_carrito.appendChild(row);\n });\n\n // Sincronizamos con el localStorage\n\n sincronizarLocalStorage();\n}", "function getType(icons) {\r\nconst types = [];\r\nicons.forEach((icon) => {\r\n // verifico se tipo c'è se no inserisco\r\n if(! types.includes(icon.type)) {\r\n types.push(icon.type);\r\n }\r\n});\r\nreturn types;//faccio ritornare il tipo\r\n}", "function verifExtensionArchIcono(extension) {\n var data = {\n icono: \"fa fa-file\",\n color: \"#95A5A6\",\n descripcion: \"Archivo\"\n };\n var archivos = {\n jpg: \"fa fa-file-image&#F1C40F&Imagen\",\n jpeg: \"fa fa-file-image&#F1C40F&Imagen\",\n png: \"fa fa-file-image&#F1C40F&Imagen\",\n gif: \"fa fa-file-image&#F1C40F&Imagen\",\n tiff: \"fa fa-file-image&#F1C40F&Imagen\",\n psd: \"fa fa-file-image&#F1C40F&Imagen\",\n eps: \"fa fa-file-image&#F1C40F&Imagen\",\n ai: \"fa fa-adobe&#CD6155&Adobe\",\n pdf: \"fa fa-file-pdf&#CB4335&PDF\",\n doc: \"fa fa-file-word&#2980B9&Word\",\n docx: \"fa fa-file-word&#2980B9&Word\",\n xls: \"fa fa-file-excel6#27AE60&Excel\",\n xslx: \"fa fa-file-excel&#27AE60&Excel\",\n ppt: \"fa fa-file-powerpoint&#B9770E&PowerPoint\",\n pot: \"fa fa-file-powerpoint&#B9770E&PowerPoint\",\n pptx: \"fa fa-file-powerpoint&#B9770E&Imagen\",\n txt: \"fa fa-file-alt&#212F3D&Texto\",\n zip: \"fa fa-file-archive&#7D3C98&Zip\",\n rar: \"fa fa-file-archive&#7D3C98&Rar\",\n }\n if (archivos[extension.toLowerCase()] !== undefined) {\n data.icono = archivos[extension.toLowerCase()].split(\"&\")[0];\n data.color = archivos[extension.toLowerCase()].split(\"&\")[1];\n data.descripcion = archivos[extension.toLowerCase()].split(\"&\")[2];\n }\n return data;\n}", "function showCoders(arr, promo) {\n /* if(subImagesContainer)\n imagesContainer.removeChild(subImagesContainer);\n \n subImagesContainer = document.createElement('div');\n imagesContainer.appendChild(subImagesContainer); */\n\n for (var i = 0; i < arr.length; i++)\n createImage(promo, arr[i]);\n}", "function updateCartIcon(arr) {\n const cartIcon = document.querySelector(\".badge\");\n if (arr) {\n cartIcon.innerHTML = arr.length;\n }\n}", "function updateCartIcon(arr) {\n const cartIcon = document.querySelector(\".badge\");\n if (arr) {\n cartIcon.innerHTML = arr.length;\n }\n}", "function showIcon(i) {\n\tvar x = document.getElementById(\"icon\" + i);\n\tif (x.style.display != \"block\"){\n\t\tx.style.display = \"block\";\n\t\tvisible[i] = true;\n\t}\n}", "getDragIcon (items) {\n let icon = new Image();\n let canvas = document.createElement('canvas');\n let imgPanel = canvas.getContext('2d');\n imgPanel.font = 'normal 12px Arial';\n imgPanel.fillStyle = 'white';\n\n let top = 0;\n for ( let i = 0; i < items.length; ++i ) {\n let item = items[i];\n if ( i <= 4 ) {\n // icon\n // NOTE: the icon may be broken, use naturalWidth detect this\n if (\n item.icon &&\n item.icon.naturalWidth !== undefined &&\n item.icon.naturalWidth !== 0\n ) {\n imgPanel.drawImage(item.icon,0,top,16,16);\n }\n // text\n imgPanel.fillText(item.name,20,top + 15);\n top += 15;\n } else {\n imgPanel.fillStyle = 'gray';\n imgPanel.fillText('[more...]',20,top + 15);\n\n break;\n }\n }\n\n icon.src = canvas.toDataURL();\n return icon;\n }", "function initializeIcons() {\n let deleteIcons = qsa('.deleteBox');\n for (let i = 0; i < deleteIcons.length; i ++) {\n deleteIcons[i].addEventListener('click', deleteTask);\n }\n\n let uncheckedCircle = qsa('.checkCircle');\n for (let i = 0; i < uncheckedCircle.length; i ++) {\n uncheckedCircle[i].addEventListener('click', clickCheckCircle);\n }\n }", "function drawIcons() {\n map.data.addGeoJson(geoJSON);\n }", "function display() {\n for (var i = 0; i < arrs.length; i++) {\n //tao the div va dat ten class\n var div = document.createElement(\"div\");\n div.className = \"product\";\n //tao the img\n var img = document.createElement(\"img\");\n img.src = arrs[i].image;\n //tao the p (mo to san pham)\n var px = document.createElement(\"div\");\n px.className = \"dix\"\n px.innerHTML = arrs[i].price + \" đ\";\n var p = document.createElement(\"p\");\n p.innerHTML = \"<div class='showra'>\" + \"<div class='name'>\" + arrs[i].name + \"</div>\" + \"<br>\" + arrs[i].detail + \"<a class='nutmua' href='#'onclick='add(\" + i + \")'><i class='fa fa-shopping-cart' aria-hidden='true' style='font-size:25px'></i></a>\" + \"</div>\";\n //dua vao lam con\n div.appendChild(img);\n div.appendChild(p);\n div.appendChild(px);\n //gan the div vao lam con body\n document.body.appendChild(div);\n }\n}", "function display() {\n for (var i = 0; i < arrs.length; i++) {\n //tao the div va dat ten class\n var div = document.createElement(\"div\");\n div.className = \"product\";\n //tao the img\n var img = document.createElement(\"img\");\n img.src = arrs[i].image;\n //tao the p (mo to san pham)\n var px = document.createElement(\"div\");\n px.className = \"dix\"\n px.innerHTML = arrs[i].price + \" đ\";\n var p = document.createElement(\"p\");\n p.innerHTML = \"<div class='showra'>\" + \"<div class='name'>\" + arrs[i].name + \"</div>\" + \"<br>\" + arrs[i].detail + \"<a class='nutmua' href='#'onclick='add(\" + i + \")'><i class='fa fa-shopping-cart' aria-hidden='true' style='font-size:25px'></i></a>\" + \"</div>\";\n //dua vao lam con\n div.appendChild(img);\n div.appendChild(p);\n div.appendChild(px);\n //gan the div vao lam con body\n document.body.appendChild(div);\n }\n}", "render(){\n\n \tif(this.props.ICOarray === null){\n \t\treturn(\n \t\t\t<p> Cargando... </p>\n \t\t);\n \t}\n\n \t//lista procedente de componente padre\n let lista = [];\n\n \tlista = this.props.ICOarray.map((icoID,index) => {\n \t\treturn(<IcoDetail key={index} ico={icoID} \n instancia={this.props.instancia} \n getID={this.getIDfromDetail} \n navControl={this.navControlList} \n clickedICO={this.clickedICO}\n />);\n\n \t});\n\n var instanciaContrato = this.props.instancia;\n\n \t// devolvemos la lista\n \treturn(\n <div>\n <Table responsive>\n <thead>\n <tr>\n <th>Name</th>\n <th>Opening date</th>\n <th>Closing date</th>\n <th>Token name</th>\n <th>Token price (in ether)</th>\n <th></th>\n </tr>\n </thead>\n <tbody>\n {lista} \n </tbody> \n </Table>\n </div>\n \t);\n }", "function exibeCartaJogador() {\n var divCartaJogador = document.getElementById(\"carta-jogador\")\n var moldura = '<img src=\"https://www.alura.com.br/assets/img/imersoes/dev-2021/card-super-trunfo-transparent.png\" style=\" width: inherit; height: inherit; position: absolute;\">';\n divCartaJogador.style.backgroundImage = `url(${cartaJogador.imagem})`\n var nome = `<p class=\"carta-subtitle\">${cartaJogador.nome}</p>`\n var opcoesTexto = \"\"\n for (var atributo in cartaJogador.atributos) {\n opcoesTexto += \"<input type='radio' name='atributo' value='\" + atributo + \"'>\" + atributo + \" \" + cartaJogador.atributos[atributo] + \"<br>\"\n }\n var html = \"<div id='opcoes' class='carta-status'>\"\n divCartaJogador.innerHTML = moldura + nome + html + opcoesTexto + '</div>'\n}", "function mostrarArreglo() { //carga en la tabla html los elementos que ya se encuentran \"precargados\" en el arreglo\n for (const pedido of pedidos) {\n mostrarItem(pedido);\n }\n}", "setIcon(i) {\n this.icon = i;\n }", "function storeSelectedIconInfo(event) {\n\n // get the class of the selected icon and push it to iconDeck.currentPair\n let tempIconClass = event.target.firstChild.firstChild.classList[1];\n iconDeck.currentPair.push(tempIconClass);\n}", "function penguinIcon() {\n iconType = image[0];\n $('#status').html(\"Selected place icon is \"+'<img src=\"'+iconType+'\">');\n}", "function insertInfoIcon() {\n\n // Get first breakdown table\n const breakdownTable = document.querySelectorAll(\"es-breakdown-table table.breakdown-table\")[0];\n breakdownTable.classList.add(\"im-first-breakdown-table\");\n\n // Get 2nd to 4th row of first breakdown table\n const breakdownInfoPanels = Array.from(breakdownTable.querySelectorAll(\"thead th\")).slice(1, 4);\n\n // Loop over above rows and prepend info-circle icon\n breakdownInfoPanels.forEach((item, index) => {\n if (item.classList.contains('icon-added') === false) {\n\n item.classList.add('icon-added');\n item.insertAdjacentHTML(\n \"beforeend\",\n `<i class=\"fas fa-info-circle c-open-modal\" id=\"im-icon-${index + 1\n }\" tabindex=\"0\"></i>`\n );\n }\n });\n\n }", "function iconDisplay ($serviceText) {\n var iconCode = 'nocost'\n if ($serviceText == 'instrumento') {\n iconCode = 'bags'\n return iconCode\n }else if ($serviceText == 'instrumento') {\n iconCode = 'bike'\n return iconCode\n }else if ($serviceText == 'instrumento') {\n iconCode = 'instrument'\n return iconCode\n }else if ($serviceText == 'instrumento') {\n iconCode = 'pet'\n return iconCode\n }else if ($serviceText == 'instrumento') {\n iconCode = 'secure'\n return iconCode\n }else if ($serviceText == 'instrumento') {\n iconCode = 'car'\n return iconCode\n }else if ($serviceText == 'instrumento') {\n iconCode = 'parking'\n return iconCode\n }else if ($serviceText == 'instrumento') {\n iconCode = 'hotel'\n return iconCode\n }else {\n return iconCode\n }\n }", "function estado_icon(value) {\n var icon = \"TBL TBL-\" + value;\n return (\n '<samp class=\"' +\n icon +\n '\" title=\"' +\n value +\n '\"><p class=\"hidden \">' +\n value +\n \"</p></samp>\"\n );\n}", "function getIconInfo(namespace_name, success) {\n var filter = \"&CQL_FILTER=layer='\" + namespace_name + \"'\"\n var url = jsonUrl(\"iconmaster\") + filter\n getGeoserverTable(url, success)\n }", "function renderCarrito (){\n let boxCarrito = document.getElementById(`box-productos`)\n boxCarrito.innerHTML=\"\";\n carrito.forEach((producto)=>{\n boxCarrito.innerHTML+=`\n <div class=\"col-3 d-flex align-items-center justify-content-center mt-2\">\n <img class=\"img-carrito\" src=\"${producto.img}\" alt=\"${producto.nombre}\" />\n <h3>${producto.nombre}</h3>\n </div>\n <div class=\"col-3 d-flex align-items-center justify-content-center mt-2\">\n <h3>1</h3>\n </div>\n <div class=\"col-3 d-flex align-items-center justify-content-center mt-2\">\n <h3>$${producto.precio}</h3>\n </div>\n <div class=\"col-3 d-flex align-items-center justify-content-center mt-2\">\n <i id=\"deleteProducto\" onclick=\"removeProduct(${producto.id})\" class=\"far fa-trash-alt\"></i>\n </div>\n `\n })\n\n sumarTotal()\n\n}", "function App() {\n let artigos = [\n {\n titulo:'Divórcio',\n id:'divorcio',\n img:'img/divorcio.jpg',\n texto: \"\",\n itens:[\n \"Divórcio Judicial\",\n \"Divórcio Extrajudicial\",\n \"Dissolução de União Estável Consensual\",\n \"Dissolução de União Estável Litigiosa\"\n ]\n },\n {\n id:'guarda',\n titulo:'Guarda',\n img:'img/guarda.jpg',\n texto: \"\",\n itens:[\n \"Guarda Provisória\",\n \"Guarda Alternada\",\n \"Guarda Compartilhada\",\n \"Guarda Unilateral\"\n ]\n \n },\n {\n id:'pensao',\n titulo:'Pensão de Alimentos',\n img:'img/pensao-alimenticia.jpg',\n itens:[\n \"Ação de alimentos\",\n \"Ação de Regualação de visitas\"\n ],\n texto:\"\"\n }\n ];\n let itens = [];\n for (let [key,value] of artigos.entries()) {\n itens.push(<CardTopico key={key} id={value.id} alinhamento='left' titulo={value.titulo} texto={value.texto} img={value.img} itens={value.itens}/>);\n }\n return (\n <div className=\"App \">\n <Navbar artigos={artigos}/>\n <div className='container row'>\n <CardCartaoVisita id='sobre' />\n {itens}\n <Contato id='contato'/>\n </div>\n </div>\n );\n}", "function showallliveicon(statushow) {\r\n\r\n\t//ignore args\r\n\r\n\t//Go through all icons hide/show as needed depending on checkbox status\r\n\tplaceliveicons();\r\n\r\n}", "function mostrarCursos() {\r\n\r\n cursos.forEach((curso) => {\r\n cursosDiv.innerHTML += `\r\n <div class=\"cardestilo\">\r\n <img src=\"https://via.placeholder.com/1600x800\" class=\"card-img-top\" alt=\"...\">\r\n <div class=\"card-body\">\r\n \r\n <h2 class=\"card-title\">${curso.nombre}</h2>\r\n <br>\r\n <p class=\"card-text\">Carga Horaria: ${curso.duracion} en ${curso.diasSemanales} días </p>\r\n <br>\r\n <h3>Fechas</h3>\r\n <br>\r\n <div class=\"row \">\r\n <div class=\"col-md-9 col-sm-7 col-xs-9 col-9\">\r\n <p>${curso.fecha1} </p>\r\n </div>\r\n <div class=\"col-md-3 col-sm-5 col-xs-3 col-3\">\r\n <button onclick=\"agregarCurso(${cursos.indexOf(curso)})\" type=\"submit\" class=\"btn btn-light-blue\"><h5>Comprar</h5></button>\r\n </div>\r\n </div>\r\n \r\n <div class=\"row\">\r\n <div class=\"col-md-9 col-sm-7 col-xs-9 col-9\">\r\n <p>${curso.fecha2} </p>\r\n </div>\r\n <div class=\"col-md-3 col-sm-5 col-xs-3 col-3\">\r\n <button onclick=\"agregarCurso(${cursos.indexOf(curso)})\" type=\"submit\" class=\"btn btn-light-blue\"><h5>Comprar</h5></button>\r\n </div>\r\n </div>\r\n\r\n <div class=\"row\">\r\n <div class=\"col-md-9 col-sm-7 col-xs-9 col-9\">\r\n <p>${curso.fecha3} </p>\r\n </div>\r\n <div class=\"col-md-3 col-sm-5 col-xs-3 col-3\">\r\n <button onclick=\"agregarCurso(${cursos.indexOf(curso)})\" type=\"submit\" class=\"btn btn-light-blue\"><h5>Comprar</h5></button>\r\n </div>\r\n </div>\r\n \r\n \r\n\r\n </div>\r\n \r\n <div class=\"card-footer\">\r\n <small ><h3>Precio: U$s: ${curso.costo} </h3></small>\r\n </div>\r\n </div> \r\n </div> \r\n \r\n \r\n `\r\n // console.log(`${cursos.indexOf(curso)}`);\r\n });\r\n}", "function cargarDatosCabecera() {\n $(\".nombre\").text(nombre)\n $(\".titulo\").text(titulo)\n $(\"#resumen\").text(resumen)\n $(\"#email\").text(contacto.mail)\n $(\"#telefono\").text(contacto.telefono)\n $(\"#direccion\").text(`${contacto.calle} ${contacto.altura}, ${contacto.localidad}`)\n}", "function BotonSeleccionado(jsonLicores) {\n const TodosLosBotones = document.querySelectorAll('.btn-danger');\n TodosLosBotones.forEach(btn => {\n btn.addEventListener('click', () => {\n const xencontrado = jsonLicores.find(item => item.id == btn.dataset.id); //Extraer los Datos del Producto Seleccionado, si existe en BD Jason\n xencontrado.cantidad = 1; //Agregar campo cantidad a xproducto con valor 1\n if (CarritoCompras.hasOwnProperty(xencontrado.id)){ //Verificar si el producto seleccionado ya existe en el carrito\n xencontrado.cantidad= CarritoCompras[xencontrado.id].cantidad + 1; //Si existe en carrito aumentar en 1;\n }\n CarritoCompras[xencontrado.id] = { ...xencontrado}; //Reemplazar registro producto seleccionado en carrito con xproducto\n localStorage.setItem(\"datosCarrito\",JSON.stringify(CarritoCompras))\n MostrarDatosCarrito();\n \n \n })\n })\n}", "function mostrarProductos() {\n data.forEach(function (element, index) {\n contenedorDeProductos.append(`\n <article class=\"search-item\">\n <div class=\"col-4-12\">\n <img src=${element.img} class=\"imagenes\">\n </div>\n <div class=\"col-8-12\">\n <h2 id=\"${element.id}\">${element.marca} ${element.modelo} </h2>\n <p>$${element.precio}</p>\n <div>\n <input type=\"button\" id = \"cart-btn\" data-id=\"${index}\" class=\"btn -secondary -button\" value=\"Agregar al carrito\" >\n </div>\n </div>\n </article>\n </div>`)\n })\n //evento que agrega los items al carrito segun posicion en su array\n botonAgregarOrdenes = $(\".-button\");\n botonAgregarOrdenes.click(function (event) {\n var indexSelected = $(event.target).data(\"id\");\n agregarYMostrarOrdenes(indexSelected);\n });\n function agregarYMostrarOrdenes(indexSelected) {\n let cartList = document.getElementById('cart-list');\n cartList.insertAdjacentHTML('beforeend', `<li>${data[indexSelected].marca} ${data[indexSelected].modelo}</li>`);\n selected.push(data[indexSelected]);\n localStorage.setItem('selected', JSON.stringify(this.selected));\n }\n console.log(selected);\n}", "function prettifyKillicon() {\n var kill = $('.ui-icon.ui-icon-trash');\n kill.empty();\n kill.append('<i class=\"fa fa-lg fa-trash\" aria-hidden=\"true\"></i>');\n console.log(kill);\n }", "function cmDisplayShop9s(){\n var i;\n for(i=0; i<cmShopCounter;i++){\n var cm = new _cm(\"tid\", \"4\", \"vn2\", \"e4.0\");\n cm.at = \"9\";\n cm.pr = cmShopIds[i];\n cm.pm = cmShopProducts[i];\n cm.cg = cmShopCats[i];\n cm.qt = cmShopQtys[i] ;\n cm.bp = cmShopPrices[i];\n cm.cd = cmShopCustomerIds[i];\n cm.on = cmShopOrderIds[i];\n cm.tr = cmShopOrderPrices[i];\n\n if (cmAttributes[i]){\n for (k=0;k<cmAttributes[i].length;k++){\n Attval=\"s_a\"+(k+1);\n cm[Attval]=cmAttributes[i][k];\n }\n }\n cm.sn=(i+1).toString();\n\n cm.pc = \"N\";\n cm.writeImg();\n\n }\n cmShopSKUs = cmGetOSK();\n\n cmShopCounter=0;\n}", "function dibujar_lingas_tier(){\n for(var i=0;i<Linga.length;i++){\n var padre=$(\"#\"+Linga[i].id_tier); // SELECCIONO EL TIER PADRE\n var left=padre.position().left;\n var top=padre.position().top;\n\n // ASIGNAR CLASE RESPECTO A SU GIRO\n if(Linga[i].giro==\"0\"){\n var linga_tier=$(\"<div><p class='cant_unit_sin_giro'>\"+Linga[i].cantidad+\"</p></div>\");\n }else{\n var linga_tier=$(\"<div><p class='cant_unit_con_giro'>\"+Linga[i].cantidad+\"</p></div>\");\n }\n\n // ASIGNAR MARCA SEGUN EMPRE\n\n if(Linga[i].marca==1){\n\n if(Linga[i].company == \"ARAUCO\"){\n var marca=$(\"<img src='../imagenes/marcas/ARAUCO/\"+Linga[i].marca_arauco+\".png' width='18px'>\");\n }\n if(Linga[i].company == \"CMPC\"){\n var marca=$(\"<img src='../imagenes/marcas/CMPC/\"+Linga[i].marca_cmpc+\".png' width='18px'>\");\n }\n }\n // ESTILOS DE LA IMAGEN DE LA MARCA\n $(marca).css({\n \"position\":\"absolute\",\n \"top\":4,\n \"left\":4\n });\n\n // ESTILOS DE A LINGA\n $(linga_tier).css({\n \"position\":\"absolute\", // YA QUE SU POSITION ES ABSOLUTE\n \"top\":(parseFloat(Linga[i].posx)+parseFloat(top))+\"px\", //SE ASIGNA POSICION RESPECTO\n \"left\":(parseFloat(Linga[i].posy)+parseFloat(left))+\"px\", // AL DOCUMENT\n \"width\":Linga[i].ancho,\n \"height\":Linga[i].alto,\n \"text-align\":\"center\",\n \"outline\": \"1px solid\" // BORDE HACIA DENTRO\n });\n linga_tier.append(marca);\n padre.append(linga_tier);\n marca=\"\";\n }\n}", "function makeCrystalButtons () {\n for (var i = 0; i < 4; i++) {\n var crystalImage = $(\"<img>\")\n crystalImage.attr(\"src\", crystals[i].img)\n crystalImage.attr(\"value\", crystals[i].value)\n crystalImage.addClass(\"crystal\")\n $(\"#crystals\").append(crystalImage)\n }\n }", "function mostrarTendencias() {\r\n const found = fetch(\r\n \"https://api.giphy.com/v1/gifs/trending?\" +\r\n \"&api_key=D1S75ra9LrFB5yUfA4KZd0o47LpX3X4T\"\r\n )\r\n .then(response => {\r\n return response.json();\r\n })\r\n .then(data => {\r\n for (i = 0; i < 20; i++) {\r\n gif1 = data.data[i].images.preview_gif.url;\r\n\r\n if (data.data[i].images.preview_gif.url != undefined) {\r\n imageHeight = data.data[i].images.preview_gif.height;\r\n\r\n imageWidth = data.data[i].images.preview_gif.width;\r\n\r\n contGeneralBusquedas = document.getElementById(\r\n \"contGeneralBusquedas\"\r\n );\r\n\r\n imagenCont280 = document.createElement(\"div\");\r\n imagenCont280.classList.add(\"imagenCont280x280V2\");\r\n\r\n // AGREGA URL AL DIV Y FUNCION ONCLICK\r\n imagenCont280.setAttribute(\"data-foo\", data.data[i].url);\r\n imagenCont280.setAttribute(\r\n \"onclick\",\r\n \"abrirGifoUrl('\" + data.data[i].url + \"')\"\r\n );\r\n\r\n contGeneralBusquedas.appendChild(imagenCont280);\r\n\r\n imgBusqueda = document.createElement(\"div\");\r\n\r\n imgBusqueda.style.backgroundImage = \"url(\" + gif1 + \")\";\r\n\r\n imgBusqueda.classList.add(\"divBackground\");\r\n\r\n imagenCont280.appendChild(imgBusqueda);\r\n\r\n // QUE OCUPE DOS COLUMNAS SI LA RELACION DE ASPECTO ES HORIZONTAL\r\n\r\n function aplicarAnchoOcupadoAGuifo() {\r\n if (imageHeight / imageWidth < 0.6) {\r\n imagenCont280.classList.add(\"imagenCont280x280OcupaDosColumnas\");\r\n imgBusqueda.style.paddingBottom = \"50%\";\r\n } else {\r\n imagenCont280.classList.add(\"imagenCont280x280V2OcupaUnaColumna\");\r\n }\r\n }\r\n aplicarAnchoOcupadoAGuifo();\r\n }\r\n }\r\n\r\n return data;\r\n })\r\n .catch(error => {\r\n return error;\r\n });\r\n return found;\r\n}", "function carritoUI(cursosDisponibles){\n //CAMBIAR INTERIOR DEL INDICADOR DE CANTIDAD DE CURSOS\n $('#carritoCantidad').html (cursosDisponibles.length);\n\n //VACIAR EL INTERIOR DEL CUERPO DEL CARRITO\n $('#carritoCursos').empty();\n\n for(const curso of cursosDisponibles){\n $('#carritoCursos').append(registroCarrito(curso));\n }\n\n //AGREGAR TOTAL\n $(\"#carritoCursos\").append(`<p id=\"totalCarrito\"> TOTAL ${totalCarrito(cursosDisponibles)}</p>`);\n \n //FUNCION PARA OBTENER EL PRECIO TOTAL DEL CARRITO\nfunction totalCarrito(carrito) {\n console.log(carrito);\n let total = 0;\n carrito.forEach(p => total += p.subtotal());\n return total.toFixed(2);\n}\n\n //ASOCIAR EVENTOS A LA INTERFAZ GENERADA\n $(\".btn-add\").click(addCantidad);\n $(\".btn-delete\").click(eliminarCarrito);\n $(\".btn-restar\").click(restarCantidad);\n $(\"#btnConfirmar\").click(confirmarCompra);\n}", "function show_imgtxtCinema() {\n backgroundChoose.innerHTML = `<p class=\"info\">\n ${array_ofCinema[index].info.name},<br>\n Lokalizacja: ${array_ofCinema[index].info.localisation},<br>\n Adres: ${array_ofCinema[index].info.adress}</p><img class=\"imgCircle\" style=\"animation: opacity .3s ease-out\" src=\"${array_ofCinema[index].info.imgsrc}\" alt=\"\"></img>`;\n}", "getAttractsIcons(){\n return this.attracts.join('-');\n }", "function showDOMList() {\n console.log('todo', todoList);\n // reset element on every click\n $todoList.innerHTML = \"\";\n\n\n for (var i = 0; i < todoList.length; i++) {\n\n var iconEdit = `<svg width=\"1em\" height=\"1em\" viewBox=\"0 0 16 16\" class=\"bi bi-pencil-fill\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n <path fill-rule=\"evenodd\" d=\"M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708l-3-3zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207l6.5-6.5zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.499.499 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11l.178-.178z\"/>\n</svg>`;\n var iconDelete = `\n<svg width=\"1em\" height=\"1em\" viewBox=\"0 0 16 16\" class=\"bi bi-trash-fill\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n<path fill-rule=\"evenodd\" d=\"M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5a.5.5 0 0 0-1 0v7a.5.5 0 0 0 1 0v-7z\"/>\n</svg>`;\n\n var listDOM = `\n <div class=\"card\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${todoList[i].title}</h5>\n <p class=\"card-text\">${todoList[i].descrp}</p>\n \n <button type=\"button\" class=\"btn btn-primary\" \n data-toggle=\"modal\" data-target=\"#staticBackdrop\"\n onclick=\"getTodoForUpdate(${i},'${todoList[i].title}', '${todoList[i].descrp.trim()}')\">\n ${iconEdit}\n </button>\n\n <button type=\"button\" class=\"btn btn-danger\" onclick=deleteTodo(${i})>\n ${iconDelete}\n </button>\n\n </div>\n </div>\n `;\n\n //new created todo will show\n $todoList.insertAdjacentHTML(\n \"beforeend\",\n listDOM\n );\n }\n\n //store data\n storeTodo();\n}", "function logistica_categoria_crear_icono() {\n var icono = $(\"#slc-icono li[name='categoria-icono'][aria-selected='true'] > i\")[\"0\"].textContent;\n var color = $(\"#slc-color li[name='categoria-color'][aria-selected='true'] > div\").attr(\"data-color\");\n\n $.ajax({\n url: \"index.php?r=categoria/getIconoSvg\",\n data: {\n icono: icono,\n color: color\n },\n dataType: \"JSON\",\n type: \"POST\",\n success: function (respuesta) {\n if (respuesta.estado === 1) {\n var svgText = respuesta.icono_svg;\n var canvas = document.getElementById(\"canvas\");\n var ctxt = canvas.getContext(\"2d\");\n\n drawInlineSVG(ctxt, svgText, function () {\n // png\n var imagenBase64 = canvas.toDataURL();\n logistica_categoria_guardar_icono(imagenBase64, icono, color);\n });\n } else {\n mensaje(respuesta.mensaje, 10000);\n\n // cerrar formulario\n cerrarPanel(formulario_carga_panel_id);\n }\n },\n error: function () {\n mensaje(\"ERROR: AL CREAR ICONO\", 10000);\n\n // cerrar formulario\n cerrarPanel(formulario_carga_panel_id);\n }\n });\n}", "function infoRecursos(){\n\t\tvar casillas = find(\"//img[starts-with(@class, 'mt')]\", XPList);\n\t\tvar areas = find(\"//map[@name='map2']//area[@shape='poly']\", XPList);\n\n\t\tfor (var i = 0; i < casillas.snapshotLength; i++){\n\t\t\tif (casillas.snapshotItem(i).src.match(/\\/(d|t)\\d*.gif$/)){\n\t\t\t\tvar area = areas.snapshotItem(i);\n\t\t\t\tarea.addEventListener(\"mouseover\", crearEventoRecursosCasilla(area.href), 0);\n\t\t\t\tarea.addEventListener(\"mouseout\", function(){ clearTimeout(timeout); timeout = 0; get(\"tb_tooltip\").style.display = 'none'; }, 0);\n\t\t\t}\n\t\t}\n\t}", "function getIcon(type) {\r\n const all_weather = \"<span title='All Weather' class='fa fa-cloud'></span>\";\r\n const tent = \"<span title='Tent' class='glyphicon glyphicon-tent'></span>\";\r\n const caravan = \"<span title='Caravan' class='fas fa-car'></span>\";\r\n const motorhome = \"<span title='Motorhome' class='fas fa-truck'></span>\";\r\n const electrical = \"<span title='Electrical Outlet' class='fas fa-bolt'></span>\";\r\n\r\n switch (type) {\r\n case \"tent\":\r\n return tent;\r\n case \"caravan\":\r\n return caravan + \" \" + all_weather;\r\n case \"motorhome\":\r\n return motorhome + \" \" + all_weather + electrical;\r\n case \"all\":\r\n return tent + \" \" + caravan + \" \" + motorhome + \" \" + electrical;\r\n case \"all-manage\":\r\n return \"<div class='row'>\" + tent + \" \" + caravan + \"</div><div class='row'>\" + motorhome + \" \" + electrical + \"</div>\";\r\n default:\r\n return \"N/A\";\r\n }\r\n}", "function bajarCantidadProducto(e){\n for (let i = 0; i < carrito.length; i++) {\n if(e.target.dataset.id == carrito[i].nombre && carrito[i].cantidad >0){\n carrito[i].cantidad--;\n localStorage.setItem('datos',JSON.stringify(carrito))\n escribirDatosCarrito(carrito);\n \n } \n\n if( carrito[i].cantidad ===0){\n carrito.splice(i,1);\n localStorage.setItem('datos',JSON.stringify(carrito))\n escribirDatosCarrito(carrito);\n escribirCarroVacio()\n iconcarrito.textContent=carrito.length;\n }\n \n }\n}", "function inmueble_imagenInmuebleCampos(posit, datos_json) {\n\tvar contenedorDatos = $(\"#contenedorInmuebleImagenes\");\n\tcontenedorDatos.html(\"\");\n\t\n\tinmueble_positions = Array();\n\tinmueble_pos_comp = -1;\n\t\t\t\n\tfor (var x = 0; x < datos_json.length; x++) {\n\t\tdivImagen = document.createElement(\"div\");\n\t\tdivImagen.className = \"thumbImg\";\n\t\t\n\t\tdivImagen.innerHTML =\n\t\t\t\"<table>\"+\n\t\t\t\t\"<tr>\"+\n\t\t\t\t\t\"<td style='text-align:left;'><a href='javascript:inmueble_subirImagen(\"+x+\");'>Modificar</a></td>\"+\n\t\t\t\t\t\"<td width='\"+$(\"#inmueble_abrirModificarImagenes table tr\").eq(1).find(\"td\").eq(1).width()+\"' style='text-align:center;'><a href='\"+urlArchivos+datos_json[x].campo2+\"' target='_blank'>Imágen \"+(x + 1)+\"</a></td>\"+\n\t\t\t\t\t\"<td width='\"+$(\"#inmueble_abrirModificarImagenes table tr\").eq(1).find(\"td\").eq(2).width()+\"' style='text-align:center;'>\"+(datos_json[x].campo3 == 0 ? \"No\" : \"Si\")+\"</td>\"+\n\t\t\t\t\t\"<td width='15'>\"+\n\t\t\t\t\t\t(isBorrarTuplas ? (\"<img src='images/btnCerrar.png' width='12' style='cursor:pointer; position:relative;' onclick='bool_borrar = true; inmueble_abrirModificarImagenes(\"+posit+\", \"+datos_json[x].campo1+\");' />\") : \"\")+\n\t\t\t\t\t\"</td>\"+\n\t\t\t\t\"</tr>\"+\n\t\t\t\"</table>\";\n\t\t\t\n\t\tcontenedorDatos.append(divImagen);\n\t\tinmueble_positions.push(Array(datos_json[x].campo1, datos_json[x].campo2, datos_json[x].campo3));\n\t}\n}", "function inmueble_imagenInmuebleCampos(posit, datos_json) {\n\tvar contenedorDatos = $(\"#contenedorInmuebleImagenes\");\n\tcontenedorDatos.html(\"\");\n\t\n\tinmueble_positions = Array();\n\tinmueble_pos_comp = -1;\n\t\t\t\n\tfor (var x = 0; x < datos_json.length; x++) {\n\t\tdivImagen = document.createElement(\"div\");\n\t\tdivImagen.className = \"thumbImg\";\n\t\t\n\t\tdivImagen.innerHTML =\n\t\t\t\"<table>\"+\n\t\t\t\t\"<tr>\"+\n\t\t\t\t\t\"<td style='text-align:left;'><a href='javascript:inmueble_subirImagen(\"+x+\");'>Modificar</a></td>\"+\n\t\t\t\t\t\"<td width='\"+$(\"#inmueble_abrirModificarImagenes table tr\").eq(1).find(\"td\").eq(1).width()+\"' style='text-align:center;'><a href='\"+urlArchivos+datos_json[x].campo2+\"' target='_blank'>Imágen \"+(x + 1)+\"</a></td>\"+\n\t\t\t\t\t\"<td width='\"+$(\"#inmueble_abrirModificarImagenes table tr\").eq(1).find(\"td\").eq(2).width()+\"' style='text-align:center;'>\"+(datos_json[x].campo3 == 0 ? \"No\" : \"Si\")+\"</td>\"+\n\t\t\t\t\t\"<td width='15'>\"+\n\t\t\t\t\t\t(isBorrarTuplas ? (\"<img src='images/btnCerrar.png' width='12' style='cursor:pointer; position:relative;' onclick='bool_borrar = true; inmueble_abrirModificarImagenes(\"+posit+\", \"+datos_json[x].campo1+\");' />\") : \"\")+\n\t\t\t\t\t\"</td>\"+\n\t\t\t\t\"</tr>\"+\n\t\t\t\"</table>\";\n\t\t\t\n\t\tcontenedorDatos.append(divImagen);\n\t\tinmueble_positions.push(Array(datos_json[x].campo1, datos_json[x].campo2, datos_json[x].campo3));\n\t}\n}", "function seleccionarJuego(rompecabezas){\n var tablero = [];\n\n for(let i = 1; i < 9; i++) {\n\t tablero.push(document.getElementById('pieza'+i));\n };\n\n var tagStart = \"<img class='pieza-juego' src=\";\n var tagEnd = \" alt='pieza1'>\";\n\n for (pos in rompecabezas) {\n tablero[pos].innerHTML = tagStart + `'../images/${rompecabezas[pos]}.jpg'` + tagEnd;\n }\n\n mezclarPiezas(30);\n mostrarMovimientoInicial();\n mostrarMovimientosEnPantalla();\n capturarTeclas();\n}", "function iconDisplay() {\n let startText = document.getElementById('downTextIcon');\n startText.innerHTML = iconArr[this.id];\n showDropdown(2, 'dropdownContent showing');\n}", "function showDownloadedIcons(itemRes)\n{\n \n var aURL = itemRes.audioUrl;\n var vURL = itemRes.videoUrl;\n var pURL = itemRes.presentationUrl;\n var tURL = itemRes.transcriptUrl;\n \n var appendIconsHTML = '';\n \n if(itemRes.isDownloadedAudio == \"true\" && aURL != \"\")\n {\n appendIconsHTML += \"<img src='images/icon_audio.png' style='height:11px;width:11px;'/>&nbsp;\";\n }\n \n if(itemRes.isDownloadedVideo == \"true\" && vURL != \"\")\n {\n appendIconsHTML += \"<img src='images/icon_video.png' style='height:11px;width:11px;'/>&nbsp;\";\n }\n \n if(itemRes.isDownloadedPresentation == \"true\" && pURL != \"\")\n {\n appendIconsHTML += \"<img src='images/icon_presentation.png' style='height:11px;width:11px;'/>&nbsp;\";\n }\n \n if(itemRes.isDownloadedTranscript == \"true\" && tURL != \"\")\n {\n appendIconsHTML += \"<img src='images/icon_transcript.png' style='height:11px;width:11px;'/>&nbsp;\";\n }\n \n if(itemRes.isDownloaded == \"true\")\n {\n appendIconsHTML += \"<img src='images/icon_document.png' style='height:11px;width:11px;'/>&nbsp;\";\n }\n \n return appendIconsHTML;\n \n}", "function renderizaMunicoes(){\n\tmunicoes.forEach(desenhaMunicao);\n\tmunicoesAndam();\n}", "function interfazCarrito(productos) {\r\n $(\"#cantidadCarrito\").html(carrito.length);\r\n $(\"#productosCarrito\").empty();\r\n for (const producto of productos) {\r\n $(\"#productosCarrito\").append(` <div class=\"productosCarrito__individuales\">\r\n <p>${producto.nombre}</p>\r\n <p>$${producto.precio}</p>\r\n <p>${producto.cantidad}</p>\r\n <p>${producto.subtotal()}</p>\r\n <button id=\"${producto.id}\" class=\"btnAgregar\">+</button>\r\n <button id=\"${producto.id}\" class=\"btnSubstraer\">-</button>\r\n <button id=\"${producto.id}\" class=\"btnBorrar\">x</button>\r\n </div>`)\r\n }\r\n $('#productosCarrito').append(`<p id=\"totalCarrito\"> TOTAL ${totalCarrito(productos)}</p>`)\r\n\r\n\r\n $(\".btnBorrar\").click(eliminarCarrito);\r\n $(\".btnAgregar\").click(agregarCant);\r\n $(\".btnSubstraer\").click(substraerCant);\r\n\r\n}", "function setIcons(options) {\n let icon = `<i class='fas fa-${options.icon_name} fa-fw'></i>`;\n if (options.quantity) {\n icon = icon.repeat(options.quantity);\n }\n return icon;\n}", "async function base64IconConversion() {\t\n\t\t\tlet iconsConverted = 0\n\t\t\tlet iconsNotConverted = 0\n\t\t\tlet iconsBase64 = 0\n\t\t iziToast.show({\n\t\t id: 'base64',\n\t\t\t\ttheme: iziTheme,\n\t\t\t\ttimeout: false,\n\t\t\t\tprogressBar: false,\n\t\t\t\toverlay: true,\n\t\t\t\toverlayClose: true,\n\t\t\t\tanimateInside: true,\n\t\t\t\tcloseOnEscape: true,\n\t\t\t\tclose: false,\n\t\t backgroundColor: bgColor, \n\t\t position: 'center',\n\t\t title: jsonLanguage.settings.dialog_convertIconTitle,\n\t\t titleSize: '22',\n\t\t titleLineHeight: '30',\n\t\t titleColor: '#008200',\n\t\t message: jsonLanguage.settings.dialog_convertIconMsg,\n\t\t\t\tmessageSize: '18',\n\t\t\t\tmessageColor: 'white',\t\t\n\t\t\t\tmessageLineHeight: '20',\n\t\t displayMode: 2,\n\t\t\t\ttransitionIn: 'fadeIn',\n\t\t\t\ttransitionOut: 'fadeOutDown',\n\t\t\t\tlayout: 9,\n\t\t\t\tbuttons: [\n\t\t\t\t\t['<button style=\"background-color: #a70e0e;\">'+jsonLanguage.settings.dialog_Cancel+'</button>', function (instance, toast) {\n\t\t\t\t\t\tinstance.hide({ }, toast)\n\t\t\t\t\t}],\n\t\t\t\t\t['<button style=\"background-color: #38A12A;\"><b>'+jsonLanguage.settings.dialog_Ok+'</b></button>', async function (instance, toast) {\n\t\t\t\t\t\tinstance.hide({ }, toast)\n\t\t\t\t\t\ttoggleOverlay(true)\n\t\t\t\t\t\tlet count = document.getElementById(\"spinner-count\")\n\t\t\t\t\t\tlet jsonData\t\n\t\t\t\t\t\ttry {\n\t\t \t\t\tlet result = await chrome.storage.local.get(\"upStartData\")\n\t\t\t\t\t\t\tjsonData = JSON.parse(result.upStartData)\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tfor (i = 0; i < jsonData['items'].length; i++) {\n\t\t\t\t\t\t\t\tcount.innerHTML = jsonLanguage.settings.dialog_countMsg+'<BR><span class=\"highlight-text\">'+jsonData.items[i].label+'</span>'\n\t\t\t\t\t\t\t\tlet itemIcon = jsonData.items[i].icon\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t//verify url\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif ( (itemIcon == \"\") || (itemIcon == 'undefined') ) {\n\t\t\t\t\t\t\t\t\titemIcon = 'icon/default.svg'\n\t\t\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tif (itemIcon.toLowerCase().match(/^data:image\\/.*/)) { \n\t\t\t\t\t\t\t\t\t\ticonsBase64++\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tlet base64ImageData = await getBase64Image(itemIcon, 128, 128)\n\t\t\t\t\t\t\t\t\t\tjsonData.items[i].icon = base64ImageData\n\t\t\t\t\t\t\t\t\t\ticonsConverted++\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\tcatch (error) {\t\t\n\t\t\t\t\t\t\t\t\tconsole.log(error)\t\t\t\n\t\t\t\t\t\t\t\t\ticonsNotConverted++\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\t\t\ttoggleOverlay(false)\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t\tif (iconsConverted != 0) {\n\t\t\t\t\t\t\t\t//message\n\t\t\t\t\t\t\t\tiziToast.show({\n\t\t\t\t\t\t\t\t\ttheme: iziTheme,\n\t\t\t\t\t\t\t\t\ttimeout: false,\n\t\t\t\t\t\t\t\t\tprogressBar: false,\n\t\t\t\t\t\t\t\t\toverlay: true,\n\t\t\t\t\t\t\t\t\tcloseOnEscape: true,\n\t\t\t\t\t\t\t\t\tclose: false,\n\t\t\t\t\t\t\t\t\tbackgroundColor: bgColor, \n\t\t\t\t\t\t\t\t\tposition: 'center',\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\ttitle: jsonLanguage.settings.dialog_convertIconComplete,\n\t\t\t\t\t\t\t\t\ttitleSize: '22',\n\t\t\t\t\t\t\t\t\ttitleLineHeight: '30',\n\t\t\t\t\t\t\t\t\ttitleColor: '#008200',\n\t\t\t\t\t\t\t\t\tmessage: '<BR><span class=\"highlight-text\">'+iconsConverted+'</span> '+jsonLanguage.settings.dialog_convertIconConverted+\n\t\t\t\t\t\t\t\t\t'<BR><span class=\"highlight-text\">'+iconsNotConverted+'</span> '+jsonLanguage.settings.dialog_convertIconNotConverted+\n\t\t\t\t\t\t\t\t\t'<BR><span class=\"highlight-text\">'+iconsBase64+'</span> '+jsonLanguage.settings.dialog_convertIconAlready64,\n\t\t\t\t\t\t\t\t\tmessageSize: '18',\n\t\t\t\t\t\t\t\t\tmessageColor: 'white',\t\t\n\t\t\t\t\t\t\t\t\tmessageLineHeight: '20',\n\t\t\t\t\t\t\t\t\ttransitionIn: 'fadeIn',\n\t\t\t\t\t\t\t\t\ttransitionOut: 'fadeOutDown',\n\t\t\t\t\t\t\t\t\tdisplayMode: 2,\n\t\t\t\t\t\t\t\t\tlayout: 2,\n\t\t\t\t\t\t\t\t\tbuttons: [\n\t\t\t\t\t\t\t\t\t\t['<button style=\"background-color: #a70e0e;\">'+jsonLanguage.settings.dialog_Cancel+'</button>', function (instance, toast) {\n\t\t\t\t\t\t\t\t\t\t\tinstance.hide({ }, toast)\n\t\t\t\t\t\t\t\t\t\t}],\n\t\t\t\t\t\t\t\t\t\t['<button style=\"background-color: #38A12A;\"><b>'+jsonLanguage.settings.dialog_Apply+'</b></button>', async function (instance, toast) {\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tawait chrome.storage.local.set({\"upStartData\": JSON.stringify(jsonData)})\n\t\t\t\t\t\t\t\t\t\t\tinstance.hide({ }, toast)\n\t\t\t\t\t\t\t\t\t\t\tsuccessMessage(jsonLanguage.settings.message_dataSaved)\n\t\t\t\t\t\t\t\t\t\t},true]\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t//message\n\t\t\t\t\t\t\t\tiziToast.show({\n\t\t\t\t\t\t\t\t\ttheme: iziTheme,\n\t\t\t\t\t\t\t\t\ttimeout: false,\n\t\t\t\t\t\t\t\t\tprogressBar: false,\n\t\t\t\t\t\t\t\t\toverlay: true,\n\t\t\t\t\t\t\t\t\tcloseOnEscape: true,\n\t\t\t\t\t\t\t\t\tclose: false,\n\t\t\t\t\t\t\t\t\tbackgroundColor: bgColor, \n\t\t\t\t\t\t\t\t\tposition: 'center',\n\t\t\t\t\t\t\t\t\ttitle: jsonLanguage.settings.dialog_noIconsConverted, \n\t\t\t\t\t\t\t\t\ttitleSize: '22',\n\t\t\t\t\t\t\t\t\ttitleLineHeight: '30',\n\t\t\t\t\t\t\t\t\ttitleColor: '#008200',\n\t\t\t\t\t\t\t\t\tdisplayMode: 2,\n\t\t\t\t\t\t\t\t\ttransitionIn: 'fadeIn',\n\t\t\t\t\t\t\t\t\ttransitionOut: 'fadeOutDown',\n\t\t\t\t\t\t\t\t\tlayout: 2,\n\t\t\t\t\t\t\t\t\tbuttons: [\n\t\t\t\t\t\t\t\t\t\t['<button style=\"background-color: #38A12A;\">'+jsonLanguage.settings.dialog_Ok+'</button>', function (instance, toast) {\n\t\t\t\t\t\t\t\t\t\t\tinstance.hide({}, toast)\n\t\t\t\t\t\t\t\t\t\t},true]\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\tcatch (error) {\n\t\t\t\t\t\t\tconsole.log(error)\n\t\t\t\t\t\t}\t\t\t\t\n\t\t\t\t\t},true]\t\t\t\t\t\n\t\t\t\t]\n\t\t\t})\n\t\t}", "function afficheProduit(data){\n let nomProduit = data.name;\n let descriptionProduit = data.description;\n let imageProduit = data.imageUrl;\n let prixProduit = data.price;\n \n let titre = document.getElementById('titre').textContent= \"Salut, moi c'est \" .concat(nomProduit, \" !\");\n let titreProduit = document.getElementById('nomProduit').textContent= nomProduit;\n let description = document.getElementById('description').textContent= descriptionProduit;\n let image = document.getElementById('image').src= imageProduit;\n let prix = document.getElementById('prix').textContent= \"\".concat(prixProduit/100, \"€\");\n\n for(let colori of data.colors){\n document.getElementById('listeUl').innerHTML += `\n <option value=\"${colori}\">${colori}</option> `\n }\n\n bouton.addEventListener('click', () =>{\n let initPanier = JSON.parse(localStorage.getItem(\"panierClient\"));\n \n let idPanier = JSON.parse(localStorage.getItem(data._id))\n //Vérifier si le panier existe déjà\n if(localStorage.getItem('panierClient')){\n //Pousser les éléments dans le tableau initPanier qui comprend tous les produits\n initPanier.push(data._id);\n localStorage.setItem(\"panierClient\", JSON.stringify(initPanier));\n \n //Si il n'existe pas, initialisation du panier\n }else{\n //Tableau qui comprendra tous les objets\n let initPanier = [];\n initPanier.push(data._id);\n localStorage.setItem(\"panierClient\", JSON.stringify(initPanier));\n }\n \n //COULEURS\n let liste = document.getElementById('listeUl');\n let valeurSelect = liste.options[liste.selectedIndex].value;\n let couleurStorage = JSON.parse(localStorage.getItem(data._id));\n \n if (couleurStorage.indexOf(valeurSelect) === -1) {\n couleurStorage.push(valeurSelect);\n localStorage.setItem(data._id, JSON.stringify(couleurStorage))\n }\n })\n \n}", "oIcon(properties) {\n properties.tag = \"i\";\n properties.class = this.removeLeadingWhitespace(\n `${this.processContent(properties.class)} far fa-${properties.icon}`\n );\n return this.getElement(properties);\n }", "function addIcon(object) {\n// get icon code from object\nconst iconCode = object.weather[0].icon;\nconst iconUrl = `http://openweathermap.org/img/w/${iconCode}.png`;\nconst newIcon = document.createElement('img');\nnewIcon.setAttribute('src', iconUrl);\nnewIcon.classList.add('conditions');\nconst conditionsText = document.createElement('h2');\nconditionsText.classList.add('conditions');\nconditionsText.textContent = 'Current conditions: '\nweatherDiv.append(conditionsText);\nweatherDiv.append(newIcon);\n}", "function cargarCapas() {\r\n var stylePuntosParadas = new OpenLayers.StyleMap( {\r\n fillOpacity : 0.7,\r\n pointRadius : 9,\r\n idBD : \"${idBD}\",\r\n idOrd : \"${idOrd}\",\r\n label : \"${idOrd}\",\r\n lat : \"${lat}\",\r\n lon : \"${lon}\",\r\n dir : \" ${dir}\",\r\n ref : \"${ref}\",\r\n img : \"${img}\",\r\n fontColor : \"white\",\r\n fillColor : \"#1C5E06\", //verde\r\n strokeColor : \"#FFFFFF\",\r\n strokeOpacity : 0.7,\r\n fontSize : \"12px\",\r\n fontFamily : \"Courier New, monospace\",\r\n fontWeight : \"bold\"\r\n });\r\n\r\n var stylePuntosEstudiante = new OpenLayers.StyleMap( {\r\n fillOpacity : 0.7,\r\n pointRadius : 6,\r\n ci : \"${ci}\",\r\n lat : \"${lat}\",\r\n lon : \"${lon}\",\r\n dir : \"${dir}\",\r\n fontColor : \"white\",\r\n fillColor : \"#DF3A01\", //naranja\r\n strokeColor : \"#FFFFFF\",\r\n strokeOpacity : 0.7,\r\n fontSize : \"12px\",\r\n fontFamily : \"Courier New, monospace\",\r\n fontWeight : \"bold\"\r\n });\r\n\r\n var stylePuntosRutas = new OpenLayers.StyleMap( {\r\n fillOpacity : 0.7,\r\n pointRadius : 9,\r\n label : \"${id}\",\r\n fontColor : \"white\",\r\n fillColor : \"#003DF5\", //black\r\n strokeColor : \"#FFFFFF\",\r\n strokeOpacity : 0.7,\r\n fontSize : \"12px\",\r\n fontFamily : \"Courier New, monospace\",\r\n fontWeight : \"bold\"\r\n });\r\n\r\n lienzoParadas = new OpenLayers.Layer.Vector('Points', {\r\n styleMap: stylePuntosParadas\r\n });\r\n\r\n map.addLayer(lienzoParadas);\r\n\r\n lienzoRutas = new OpenLayers.Layer.Vector('Puntos Rutas', {\r\n styleMap: stylePuntosRutas\r\n });\r\n\r\n map.addLayer(lienzoRutas);\r\n \r\n lienzoEstudiantes = new OpenLayers.Layer.Vector('Puntos Estudiantes', {\r\n styleMap: stylePuntosEstudiante\r\n });\r\n\r\n map.addLayer(lienzoEstudiantes);\r\n\r\n //Comportamiento de los Elementos de la Capa\r\n selectFeatures = new OpenLayers.Control.SelectFeature(\r\n [ lienzoParadas ],\r\n {\r\n clickout : true,\r\n toggle : false,\r\n multiple : false,\r\n hover : false,\r\n onSelect : function(feature){\r\n selectParada( feature );\r\n },\r\n onUnselect : function(feature){\r\n unselectParada( feature );\r\n }\r\n }\r\n );\r\n\r\n map.addControl( selectFeatures );\r\n selectFeatures.activate();\r\n \r\n selectFeaturesEstudiante = new OpenLayers.Control.SelectFeature(\r\n [ lienzoEstudiantes ],\r\n {\r\n clickout : true,\r\n toggle : false,\r\n multiple : false,\r\n hover : false,\r\n onSelect : function(feature){\r\n infoEstudiantePopUp(feature);\r\n },\r\n onUnselect : function(feature){\r\n map.removePopup( feature.popup );\r\n feature.popup.destroy();\r\n feature.attributes.poppedup = false;\r\n feature.popup = null;\r\n }\r\n }\r\n );\r\n\r\n map.addControl( selectFeaturesEstudiante );\r\n \r\n /**\r\n * Inicializa el mapa para que permita graficar los recorridos de los buses\r\n */\r\n capaRecorridos();\r\n permitirArrastrarPuntosRutas();\r\n}", "function generaCard(array){\n iconsContainer.innerHTML = \"\"\n //creo card per ogni...\n for (i = 0; i < array.length; i++){\n\t\tlet {family, prefix, type, color, name} = array[i];\n const content = ` \n <div class=\"icon-card d-flex\">\n <i class=\"${family} ${prefix}${name}\" style= \"color:${color}\"></i>\n <h4>${name}</h4>\n </div>\n `;\n\n iconsContainer.innerHTML += content;\n }\n}", "displayedIcons () {\n let icons = []\n if (this.iconsList) {\n icons = this.filteredIcons\n\n // should the icons be paged?\n if (this.pagination && this.pagination.itemsPerPage !== 0) {\n icons = icons.slice(this.firstItemIndex, this.lastItemIndex)\n }\n }\n return icons\n }", "function print(array,icons){\n icons.html(\"\");\n array.forEach((element) => {\n const {family,prefix,name,color}= element;\n icons.append( `\n <div>\n <i class=\"${family} ${prefix}${name}\"></i>\n <div class=\"title\">${name}</div>\n </div>\n `\n )\n });\n}", "function movimentoBarra(btn) {\n for(let i=0;i<_li.length;i++)\n _li[i].removeAttribute(\"class\"); /*Serve a far tornare le icone allo stato iniziale*/\n btn.classList.add(\"active\"); /*Serve a colorare l'icona che mi interessa*/\n _informazioneDaVisualizzare=btn.id; /*Passo alla function di visualizzazione l'id dell'icona (da cui capisco cosa serve visualizzare)*/\n visualizzaInformazioni(_persone);\n}" ]
[ "0.7962983", "0.7633804", "0.6897386", "0.68852496", "0.66509026", "0.6532745", "0.637194", "0.63657635", "0.6291417", "0.6248317", "0.6210424", "0.61642706", "0.6088295", "0.6083301", "0.6069628", "0.604909", "0.60433394", "0.59284854", "0.5928148", "0.5905255", "0.58991957", "0.5882624", "0.5863578", "0.58543646", "0.58356166", "0.58181286", "0.57901376", "0.5781237", "0.5780981", "0.5767175", "0.5759679", "0.5755363", "0.5749801", "0.57392937", "0.57392937", "0.5737018", "0.57356197", "0.5734207", "0.5731507", "0.5726813", "0.57210755", "0.5717797", "0.5710111", "0.568276", "0.56677157", "0.5637253", "0.5620443", "0.5620443", "0.56179047", "0.5615852", "0.56142825", "0.56056446", "0.56017756", "0.56017756", "0.5595902", "0.5592656", "0.55827206", "0.5579585", "0.5578751", "0.55635655", "0.5557925", "0.5553882", "0.5553278", "0.55524766", "0.55495834", "0.5544612", "0.5543204", "0.5540831", "0.553963", "0.55341476", "0.5532598", "0.55319077", "0.5529616", "0.5528482", "0.5519843", "0.55159706", "0.5515859", "0.5512451", "0.55123305", "0.55073744", "0.55064625", "0.5504057", "0.5501337", "0.549898", "0.54979086", "0.54979086", "0.5493083", "0.5489644", "0.54889613", "0.5488096", "0.5485525", "0.5484027", "0.548263", "0.54800475", "0.54782134", "0.5464789", "0.5464647", "0.54626435", "0.5459167", "0.54543465", "0.5453224" ]
0.0
-1
Car de proveedores que se van a mostrar
function DatCaegor(id, icon, Nombre) { return '<div class="row padding-0">' + ' <div class="col">' + ' <div class="card">' + ' <div class="card-header" id="headingOne">' + ' <h2 class="row mb-0">' + ' <div class="col-8" data-toggle="collapse"' + ' data-target="#collapseExample' + id + '" aria-expanded="false"' + ' aria-controls="collapseExample' + id + '">' + ' <div class="col">' + ' <h5>' + icon + Nombre + '</h5>' + ' </div>' + ' </div>' + ' <div class="col-4">' + ' <a id="NewProdut" onclick="catproDelet(' + id + ')"' + ' class="btn btn-outline-danger btn-block rounded-pill">Eliminar</a>' + ' </div>' + ' </h2>' + ' </div>' + ' <div class="collapse" id="collapseExample' + id + '">' + ' <div class="card card-body">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text"' + ' id="basic-addon1">📋</span>' + ' </div>' + ' <select class="custom-select"' + ' id="catSelet' + id + '">' + ' <option selected>' + icon + '</option>' + DatIcont() + ' </select>' + ' </div>' + ' </div>' + ' <div class="col">' + ' <div class="input-group mb-3">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text"' + ' id="basic-addon1">📺</span>' + ' </div>' + ' <input type="text" class="form-control" id="catTex' + id + '"' + ' placeholder="Nombre de la Categoria" value = "' + Nombre + '"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <button type="button" onclick="catproUp(' + id + ')"' + ' class="btn btn-success btn-block">Agregar' + ' Catehoria</button>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Carro(marca) {\n this.marca = marca;\n this.numPuertas;\n //method set num puertas\n this.setPuertas = function(numPuert) {\n this.numPuertas = numPuert;\n };\n this.getDescrip = function() {\n return \"Este es un carro: \" + this.marca + \" que tiene \" + this.numPuertas + \" Puertas!\";\n };\n}", "function serVivo(especie) {\n //this.especie = especie;\n this.especie = especie;\n }", "function IniciaPersonagem() {\n // entradas padroes para armas, armaduras e escudos.\n gPersonagem.armas.push(ConverteArma({\n chave: 'desarmado',\n nome_gerado: 'desarmado',\n texto_nome: Traduz('desarmado'),\n obra_prima: false,\n bonus: 0\n }));\n}", "mostrar() {\n return \"Propiedad N° \" + this.id +\n \"\\nTipo: \" + this.tipo +\n \"\\nActividad: \" + this.actividad +\n \"\\nCalle: \" + this.calle + \" \" + this.numero +\n \"\\nDescripción: \" + this.descripcion +\n \"\\nValor: \" + this.precio\n }", "function mostrarPlantearEje(){ // Cuando toque el boton \"plantear ejercicios\" voy a ver la seccion (plantear tarea a alumnos)\r\n limpiar(); //limpio campos de texto y mensajes al usuario\r\n document.querySelector(\"#divDevoluciones\").style.display = \"none\"; // oculto redactar devoluciones a tareas\r\n document.querySelector(\"#homeDocente\").style.display = \"block\"; //Habilito division docente\r\n document.querySelector(\"#bodyHome\").style.display = \"none\"; //Oculto body bienvenida\r\n document.querySelector(\"#divAsignarNivel\").style.display = \"none\"; // oculto plantear ejercicios a alumnos\r\n document.querySelector(\"#divPlantearEje\").style.display = \"block\"; // muestro plantear tarea\r\n document.querySelector(\"#divEntregas\").style.display = \"none\"; // oculto redactar devoluciones a tareas\r\n document.querySelector(\"#divEstadisticas\").style.display = \"none\"; // oculto visualizar estadisticas\r\n}", "function mostrarProveedor(req, res) {\n var id = req.params.id;\n var pro = Proveedor.find();\n if (id) pro = Proveedor.findById(id);\n pro.populate('fk_usuario prov_modificado').exec((error, response) => {\n if (error)\n return res.status(500).send({ Message: 'Error al ejectuar la peticion', Error: error });\n if (!response || response.length <= 0)\n return res.status(404).send({ Message: 'No existen marca en el sistema' });\n return res.status(200).send({Message: 'marca cargados!', proveedor: response});\n })\n}", "function mostrarArreglo() { //carga en la tabla html los elementos que ya se encuentran \"precargados\" en el arreglo\n for (const pedido of pedidos) {\n mostrarItem(pedido);\n }\n}", "function escreveTexto(vetor){\n for (const v of vetor){\n console.log(\n \"O \"+ v.nome + \" possui as habilidades:\" + v.habilidades.join(', ')\n )\n }\n}", "function ordenar() {\n let seleccion = $(\"#miSeleccion\").val().toUpperCase();\n popularListaCompleta();\n listaCompletaClases = listaCompletaClases.filter(Clase => Clase.dia ==\n seleccion);\n renderizarProductos();\n}", "function comprovarEscriu () {\r\n this.validate=1;\r\n index=cerca(this.paraules,this.actual);\r\n this.capa.innerHTML=\"\";\r\n if (index != -1) {\r\n paraula = this.paraules[index];\r\n this.putImg (this.dirImg+\"/\"+paraula.imatge);\r\n this.capa.innerHTML += \"<br>\" + this.paraules[index].paraula.toUpperCase();\r\n this.putSound (paraula.so);\r\n this.ant = this.actual;\r\n this.actual = \"\";\r\n }\r\n else {\r\n this.putImg (\"imatges/error.gif\");\r\n this.putSound (\"so/error.wav\");\r\n this.actual = \"\";\r\n }\r\n}", "function _CarregaPericias() {\n for (var chave_pericia in tabelas_pericias) {\n var pericia = tabelas_pericias[chave_pericia];\n var achou = false;\n for (var i = 0; i < pericia.classes.length; ++i) {\n // Aplica as pericias de mago a magos especialistas tambem.\n if (pericia.classes[i] == 'mago') {\n achou = true;\n break;\n }\n }\n if (!achou) {\n continue;\n }\n for (var chave_classe in tabelas_classes) {\n var mago_especialista = chave_classe.search('mago_') != -1;\n if (mago_especialista) {\n pericia.classes.push(chave_classe);\n }\n }\n }\n var span_pericias = Dom('span-lista-pericias');\n // Ordenacao.\n var divs_ordenados = [];\n for (var chave_pericia in tabelas_pericias) {\n var pericia = tabelas_pericias[chave_pericia];\n var habilidade = pericia.habilidade;\n var prefixo_id = 'pericia-' + chave_pericia;\n var div = CriaDiv(prefixo_id);\n var texto_span = Traduz(pericia.nome) + ' (' + Traduz(tabelas_atributos[pericia.habilidade]).toLowerCase() + '): ';\n if (tabelas_pericias[chave_pericia].sem_treinamento) {\n texto_span += 'ϛτ';\n }\n div.appendChild(\n CriaSpan(texto_span, null, 'pericias-nome'));\n\n var input_complemento =\n CriaInputTexto('', prefixo_id + '-complemento', 'input-pericias-complemento',\n {\n chave_pericia: chave_pericia,\n handleEvent: function(evento) {\n AtualizaGeral();\n evento.stopPropagation();\n }\n });\n input_complemento.placeholder = Traduz('complemento');\n div.appendChild(input_complemento);\n\n var input_pontos =\n CriaInputNumerico('0', prefixo_id + '-pontos', 'input-pericias-pontos',\n { chave_pericia: chave_pericia,\n handleEvent: function(evento) {\n ClickPericia(this.chave_pericia);\n evento.stopPropagation(); } });\n input_pontos.min = 0;\n input_pontos.maxlength = input_pontos.size = 2;\n div.appendChild(input_pontos);\n\n div.appendChild(CriaSpan(' ' + Traduz('pontos') + '; '));\n div.appendChild(CriaSpan('0', prefixo_id + '-graduacoes'));\n div.appendChild(CriaSpan('+0', prefixo_id + '-total-bonus'));\n div.appendChild(CriaSpan(' = '));\n div.appendChild(CriaSpan('+0', prefixo_id + '-total'));\n\n // Adiciona as gEntradas\n gEntradas.pericias.push({ chave: chave_pericia, pontos: 0 });\n // Adiciona ao personagem.\n gPersonagem.pericias.lista[chave_pericia] = {\n graduacoes: 0, bonus: new Bonus(),\n };\n // Adiciona aos divs.\n divs_ordenados.push({ traducao: texto_span, div_a_inserir: div});\n }\n divs_ordenados.sort(function(lhs, rhs) {\n return lhs.traducao.localeCompare(rhs.traducao);\n });\n divs_ordenados.forEach(function(trad_div) {\n if (span_pericias != null) {\n span_pericias.appendChild(trad_div.div_a_inserir);\n }\n });\n}", "function agregarComentario(id_miembro){\n\n\n res= document.getElementById(\"comentar\").value; //Se toma a traves del id, el comentario realizado(valor).\n document.getElementById(\"mostrarComentario\").innerHTML+= res + \"<br>\"; //Hace visible el comentario relizado.\n\tres= document.getElementById(\"comentar\").value= \"\";//Despues que se genera el click vuelve al valor original.\n}", "function buscarClienteOnClick(){\n if ( get('formulario.accion') != 'clienteSeleccionado' ) {\n // var oid;\n // var obj = new Object();\n var whnd = mostrarModalSICC('LPBusquedaRapidaCliente','',new Object());//[1] obj);\n if(whnd!=null){\n \n //[1] }else{\n /* posicion N°\n 0 : oid del cliente\n 1 : codigo del cliente\n 2 : Nombre1 del cliente\n 3 : Nombre2 del cliente\n 4 : apellido1 del cliente\n 5 : apellido2 del cliente */\n \n var oid = whnd[0];\n var cod = whnd[1];\n //[1] var nombre1 = whnd[2];\n //[1] var nombre2 = whnd[3];\n //[1] var apellido1 = whnd[4]; \n //[1] var apellido2 = whnd[5]; \n \n // asigno los valores a las variables y campos corresp.\n set(\"frmFormulario.hOidCliente\", oid);\n set(\"frmFormulario.txtCodigoCliente\", cod);\n \n } \n }\n }", "function MostrarContadores() {\n\tvar div = document.getElementById(\"mostrarcontador\");\n\tdiv.innerHTML = \"\";\n\n\tvar TitleTotalArticles = document.createElement(\"h4\");\n\tvar TitlePriceWithoutIVA = document.createElement(\"h4\");\n\tvar TitleTotalPrice = document.createElement(\"h4\");\n\n\tvar cont1 = 0;\n\tvar cont2 = 0;\n\tvar TotalArticulos = 0;\n\tvar Totalprecio = 0;\n\tvar PrecioSinIva = 0;\n\n\t//Con esto mostramos el total de articulos en nuestro carrito.\n\tfor (x of carritocompra.cantidades) {\n\t\tx = parseInt(x);\n\t\tTotalArticulos += x;\n\t}\n\n\tcarritocompra.items.forEach(element => {\n\t\telement.precio = parseInt(element.precio);\n\t\tTotalprecio += (element.precio * carritocompra.cantidades[cont2]);\n\t\tcont2++;\n\t});\n\n\t// Esta parte del codigo es para sacar los precios sin iva\n\tcarritocompra.items.forEach(element => {\n\t\telement.precio = parseInt(element.precio);\n\t\telement.iva = parseInt(element.iva);\n\t\tPrecioSinIva += (element.precio * carritocompra.cantidades[cont1]) - (((element.precio * element.iva) / 100) * carritocompra.cantidades[cont1]);\n\t\tcont1++;\n\t});\n\n\tTitleTotalArticles.appendChild(document.createTextNode(\"Artículos en tu carrito: \" + TotalArticulos));\n\tTitlePriceWithoutIVA.appendChild(document.createTextNode(\"Precio sin IVA: \" + PrecioSinIva + \"€\"));\n\tTitleTotalPrice.appendChild(document.createTextNode(\"Precio total a pagar: \" + Totalprecio + \"€\"));\n\n\tdiv.appendChild(TitleTotalArticles);\n\tdiv.appendChild(TitlePriceWithoutIVA);\n\tdiv.appendChild(TitleTotalPrice);\n}", "function cargarCgg_res_beneficiarioCtrls(){\n if(inInfoPersona.CRPER_CODIGO_AUSPICIANTE != undefined && inInfoPersona.CRPER_CODIGO_AUSPICIANTE.length>0){\n if(inInfoPersona.CRPJR_CODIGO.length>0)\n {\n txtCrper_codigo.setValue(inInfoPersona.CRPJR_RAZON_SOCIAL);\n tmpAuspiciantePJ = inInfoPersona.CRPJR_CODIGO;\n txtCrpjr_representante_legal.setValue(inInfoPersona.CRPER_NOMBRE_AUSPICIANTE);\n tmpAuspiciante= inInfoPersona.CRPER_CODIGO_AUSPICIANTE;\n rdgTipoAuspiciante.setValue('rdgTipoAuspiciante',TypeAuspiciante.JURIDICA);\n }\n else\n {\n txtCrper_codigo.setValue(inInfoPersona.CRPER_NOMBRE_AUSPICIANTE);\n tmpAuspiciante= inInfoPersona.CRPER_CODIGO_AUSPICIANTE;\n rdgTipoAuspiciante.setValue('rdgTipoAuspiciante',TypeAuspiciante.NATURAL);\n }\n }\n }", "function Propiedades() {\n this.texto = \"Palabra\";\n console.log(\"this.texto\", this.texto);\n this.numero = 5;\n console.log(\"numero\", this.numero);\n this.boleana = true;\n console.log(\"boleana\", this.boleana);\n this.arreglo = [\"texto1\", \"teto2\", 0, true];\n console.log(\"arreglo\", this.arreglo);\n this.cualquiera = { \"propiedad1\": \"valor1\",\n \"propiedad2\": \"valor2\",\n \"propiedad3\": \"valor3\" };\n console.log(\"cualquiera\", this.cualquiera);\n }", "function mostrarDatos(event) {\n event.preventDefault();\n \n let propietario = document.getElementById(\"propietario\").value;\n let telefono = document.getElementById(\"telefono\").value;\n let direccion = document.getElementById(\"direccion\").value;\n let nombreMascota = document.getElementById(\"nombreMascota\").value;\n let select = document.getElementById(\"tipo\").value;\n let enfermedad = document.getElementById(\"enfermedad\").value;\n let resultado = document.getElementById(\"resultado\");\n \n switch (select) {\n case \"1\":\n let perro = new Perro(\n propietario,\n direccion,\n telefono,\n nombreMascota,\n selectTipoMascota(),\n enfermedad\n );\n resultado.innerHTML = `<ul><li>${perro.datosPropietario()}</li><li>${perro.datosAnimal()} y la enfermedad es: ${\n perro.enfermedad\n }</li></ul>`;\n break;\n\n case \"2\":\n let gato = new Gato(\n propietario,\n direccion,\n telefono,\n nombreMascota,\n selectTipoMascota(),\n enfermedad\n );\n resultado.innerHTML = `<ul><li>${gato.datosPropietario()}</li><li>${gato.datosAnimal()} y la enfermedad es: ${\n gato.enfermedad\n }</li></ul>`;\n break;\n\n case \"3\":\n let conejo = new Conejo(\n propietario,\n direccion,\n telefono,\n nombreMascota,\n selectTipoMascota(),\n enfermedad\n );\n resultado.innerHTML = `<ul><li>${conejo.datosPropietario()}</li><li>${conejo.datosAnimal()} y la enfermedad es: ${\n conejo.enfermedad\n }</li></ul>`;\n break;\n }\n}", "function mostrarDatosCompra() {\n //Tomo los datos que pasé en la funcion navegar\n const unaCompra = this.data;\n if (unaCompra) {\n const idProd = unaCompra.idProducto;\n const productoComprado = obtenerProductoPorID(idProd);\n const subTotal = unaCompra.cantidad * productoComprado.precio;\n //Escribo el mensaje a mostrar\n const mensaje = `Producto <strong>${productoComprado.nombre}</strong>.\n <br> Cantidad comprada: <strong>${unaCompra.cantidad}</strong>.<br>\n Sub Total: <strong> $${subTotal}</strong>`;\n //Muestro el mensaje\n $(\"#pDetalleCompraMensaje\").html(mensaje);\n } else {\n ons.notification.alert(\"Ocurrió un error, por favor contacte al administrador\", { title: 'Oops!' });\n }\n}", "function Liste() {\r\n this.elenco = [];\r\n\r\n this.inizializza =\r\n function(y) {\r\n for (var i = 0; i < y.length; i++) {\r\n var lista = new Lista();\r\n lista.inizializza(y[i]);\r\n this.elenco.push(lista);\r\n };\r\n }\r\n\r\n //scorre tutte le Scuole e creo un array associativo con le opzioni scuole\r\n this.creaSelectScuola =\r\n function() {\r\n var scuole = {};\r\n for (var i = 0; i < this.elenco.length; i++) {\r\n scuole[this.elenco[i].scuola] = true;\r\n }\r\n var selectDiv = \"<option value='null'>scegli una scuola</option>\";\r\n for (var i in scuole) {\r\n selectDiv += '<option value=\"' + i + '\">' + i + '</option>';\r\n }\r\n return selectDiv;\r\n }\r\n\r\n //scorre i maestri in base alla scuola e creo un array associativo relativo \r\n this.creaSelectMaestro =\r\n function(scuola) {\r\n var maestri = {};\r\n for (var i = 0; i < this.elenco.length; i++) {\r\n if (this.elenco[i].scuola == scuola) {\r\n maestri[this.elenco[i].maestro] = true;\r\n }\r\n }\r\n var selectDiv = \"<option value='null'>scegli un maestro</option>\";\r\n for (var i in maestri) {\r\n selectDiv += '<option value=\"' + i + '\">' + i + '</option>';\r\n }\r\n return selectDiv;\r\n }\r\n\r\n //cerca la lista in base alla scuola e al maestro scelti\r\n this.cercaMaestro =\r\n function(maestro, scuola) {\r\n var z = [];\r\n for (var i = 0; i < this.elenco.length; i++) {\r\n if (this.elenco[i].scuola == scuola && this.elenco[i].maestro == maestro) {\r\n z.push(this.elenco[i]);\r\n }\r\n }\r\n return z;\r\n }\r\n}", "function pickUpThings(objeto){\n \n quitaConsumible(objeto);\n mapaCargado.cogeConsumible(objeto);\n if(objeto.getId()==1)\n guardarEstado(idMapaAct);\n $('#valorArm').html(mapaCargado.personaje.getFuerza());\n $('#valorDef').html(mapaCargado.personaje.getVida());\n $('.valorLlave').html(mapaCargado.personaje.tieneLLave());\n\n refrescaInv()\n \n $('#barras').empty();\n barraProgreso();\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n actualizaCanvas(mapaCargado,mapaCargado.mazmorraActual.idMazmorra);\n //console.log(mapaCargado.personaje.inventario)\n //refrescaInv();\n \n}", "function caricaElencoScritture() {\n var selectCausaleEP = $(\"#uidCausaleEP\");\n caricaElencoScrittureFromAction(\"_ottieniListaConti\", {\"causaleEP.uid\": selectCausaleEP.val()});\n }", "function mostrarDatosProveedor() {\n //tomar el idProveedor desde el value del select\n let idProvedor = document.getElementById(\"idProveedor\").value;\n //buscar el proveedor en la lista\n for (let i = 0; i < listaProveedores.length; i++) {\n let dato = listaProveedores[i].getData();\n if(dato['idProveedor'] === parseInt(idProvedor)){\n //desplegar los datos en el formulario\n vista.setDatosForm(dato);\n break;\n }\n }\n}", "function mostrarDevoluciones(){ // Cuando toque el boton \"devoluciones\" voy a ver la seccion (hacer devoluciones)\r\n limpiar(); //limpio campos de texto y mensajes al usuario\r\n document.querySelector(\"#homeDocente\").style.display = \"block\"; // habilito division docente\r\n document.querySelector(\"#bodyHome\").style.display = \"none\"; // oculto body bienvenida\r\n document.querySelector(\"#divAsignarNivel\").style.display = \"none\"; // oculto plantear ejercicios a alumnos\r\n document.querySelector(\"#divPlantearEje\").style.display = \"none\"; // oculto plantear tarea\r\n document.querySelector(\"#divEntregas\").style.display = \"none\"; // oculto tabla\r\n document.querySelector(\"#divDevoluciones\").style.display = \"block\"; // muestro redactar devoluciones a tareas\r\n document.querySelector(\"#divEstadisticas\").style.display = \"none\"; // oculto visualizar estadisticas\r\n}", "function preenche(){\n if(comentario.comentario==\"\"){\n c.email.innerText = \"user: \" + comentario.usuario.email;\n c.textoComentario.innerHTML = 'comentario apagado';\n c.botaoEnviarComentario = c.botoes.children[0];\n }else{\n c.email.innerText = \"user: \" + comentario.usuario.email;\n c.textoComentario.innerHTML = comentario.comentario;\n c.botaoEnviarComentario = c.botoes.children[0];\n }\n }", "function voltarEtapa3() {\n msgTratamentoEtapa4.innerHTML = \"\";\n //recebendo H3 e setando nela o texto com o nome do cliente\n var tituloDaEtapa = document.querySelector(\"#tituloDaEtapa\");\n tituloDaEtapa.textContent = \"3º Etapa - Colaborador\";\n\n document.getElementById('selecionarPacotes').style.display = 'none'; //desabilita a etapa 4\n document.getElementById('selecionarFuncionarios').style.display = ''; //habilita a etapa 3\n }", "function trocarCliente() {\n\n //seta como vazio os atributos do cliente seleciado\n idCliente = 0;\n nomeCliente = \"\";\n\n //apaga o input criado na \"function selecionarCliente\"\n document.getElementById('idCliente').remove();\n \n document.getElementById('listagemDeCliente').style.display = ''; //habilita a tabela de listagem do cliente\n document.getElementById('confirmacaoCliente').style.display = 'none'; //desabilita a confirmação da etapa 1\n document.getElementById('confirmacaoCliente').style.display = 'none'; //desabilita a confirmação da etapa 1\n\n //como está trocando de cliente , as crianças serão outras , então limpa tudo que é relacionado as crianças (etapa2)\n if(countEtapa2 !== 0){\n document.getElementById(\"tbodyAniversariantes\").innerHTML=\"\";\n document.getElementById('tabelaAniversariante').style.display = 'none'; //desabilita a tabela de listagem de criança\n countEtapa2 = 0;\n } \n \n //apaga os inputs das crianças caso tiver\n for(var i = 0; i < quantidadeCrianca2; i++){\n var existeInputCrianca = document.getElementById('idCrianca'+(i+1)); \n if(existeInputCrianca !== null){\n document.getElementById('idCrianca'+(i+1)).remove(); \n }\n \n }\n \n //limpando/zerando as variaveis relacionadas a criança\n quantidadeCrianca = 0;\n quantidadeCriancaBotaoRemover = 0;\n quantidadeCrianca2 = 0;\n textoConfirmacaoCrianca = \"\";\n listaNomeCrianca = [];\n possuiCrianca = 0;\n }", "get mostrarComision(){\n //quiero que el metodo get me muestre el valor de la propiedad comision\n return this.comision;\n }", "function mostrarVentanaInicio(){\n\t//verificar el rol\n\tif (datosUsuario[0][\"idRol\"] == 3) {\n\t\tmostrarVentanaChef1(datosUsuario[0][\"nombre\"]);\t// Invoca la ventana de Cocina y envia nombre del empleado\n\t}\n\telse if(datosUsuario[0][\"idRol\"] == 2) {\n\t\tmostrarVentanaCajero(datosUsuario[0][\"nombre\"]);\t//Invoca la ventana de Cajero y envia nombre del empleado\n\t}\n\telse{\n\t\tmostrarVentanaMesero(datosUsuario[0][\"nombre\"]);\t//Invoca la ventana de Mesero y envia nombre del empleado\n\t}\n\n}", "draw() {\n\t\t//se tem algum objeto importante no espaco onde iria printar as pocoes do personagem\n\t\tlet opacidade;\n\t\tif (this._pocoesPers.length > 0) {\n\t\t\t//primeira pocao\n\t\t\tif (ControladorJogo.algumObjetoImportanteNesseEspaco(this._pocoesPers[0].formaGeometrica))\n\t\t\t\topacidade = opacidadePainelPersObjsEmBaixo;\n\t\t\telse\n\t\t\t\t//outras pocoes (se houver)\n\t\t\t\tif (this._pocoesPers.length > 1) {\n\t\t\t\t\tconst formaUltimaPocao = this._pocoesPers[this._pocoesPers.length - 1].formaGeometrica;\n\t\t\t\t\tconst retanguloEspaco = new Retangulo(formaUltimaPocao.x, formaUltimaPocao.y, formaUltimaPocao.width,\n\t\t\t\t\t\tthis._pocoesPers[1].formaGeometrica.y + this._pocoesPers[1].formaGeometrica.height - formaUltimaPocao.y);\n\t\t\t\t\tif (ControladorJogo.algumObjetoImportanteNesseEspaco(retanguloEspaco))\n\t\t\t\t\t\topacidade = opacidadePainelPersObjsEmBaixo;\n\t\t\t\t}\n\t\t}\n\t\telse { } //deixa undefined mesmo\n\n\t\tthis._pocoesPers.forEach(pocaoPers => pocaoPers.draw(opacidade));\n\t\t/*ps: nao importa a ordem sempre vai colocar os mesmos nos lugares certos */\n\n\t\tif (this._nomePocaoEscrever !== undefined)\n\t\t//nao necessariamente a primeira pocao estara sendo usada (pois se ela fosse instantanea ou muito rapida, nao daria certo)\n\t\t{\n\t\t\tpush();\n\t\t\t// TODO: design\n\t\t\tnoStroke();\n\t\t\ttextSize(30);\n\t\t\ttextAlign(CENTER, CENTER);\n\t\t\ttext(this._nomePocaoEscrever, width / 2, (height - heightVidaUsuario) / 2); //escrever nome da pocao\n\t\t\tpop();\n\t\t}\n\t}", "function mostrarPaqueteDeOpciones(cliente) {\n return autosDB.filter(auto => (clientePuedePagar(cliente, auto) && !auto.vendido))\n}", "function nuevoEsquemaComision(cuadroOcultar, cuadroMostrar){\n\t\tcuadros(\"#cuadro1\", \"#cuadro2\");\n\t\tlimpiarFormularioRegistrar(\"#form_esquema_comision_registrar\");\n\t\t$(\"#id_vendedor_registrar\").focus();\n\t}", "cambio(){\n\n productos.forEach(producto => {\n if(producto.nombre === this.productoSeleccionado) this.productoActual = producto;\n });\n\n //Ver si el producto actual tiene varios precios\n if(this.productoActual.variosPrecios){\n //Verificar si sobrepasa algun precio extra\n\n //Si es menor al tope del primer precio\n if(this.cantidadActual < this.productoActual.precios.primerPrecio.hasta){\n this.precioActual = this.productoActual.precios.primerPrecio.precio;\n //Seteamos el precio tachado a 0 de nuevo\n this.precioPorUnidadTachado = 0;\n }\n //Si es mayor o igual al tope del primer precio pero menor al tope del segundo\n else if(this.cantidadActual >= this.productoActual.precios.primerPrecio.hasta && this.cantidadActual < this.productoActual.precios.segundoPrecio.hasta){\n this.precioActual = this.productoActual.precios.segundoPrecio.precio;\n //Asignamos un nuevo precio tachado\n this.precioPorUnidadTachado = this.productoActual.precios.primerPrecio.precio;\n }\n //Si es igual o mayor al tope del segundo precio\n else if(this.cantidadActual >= this.productoActual.precios.segundoPrecio.hasta){\n this.precioActual = this.productoActual.precios.tercerPrecio.precio;\n //Asignamos un nuevo precio tachado\n this.precioPorUnidadTachado = this.productoActual.precios.primerPrecio.precio;\n }\n }\n }", "function escolta () {\r\n text = this.ant;\r\n if(this.validate) {\r\n \tthis.capa.innerHTML=\"\";\r\n index = cerca (this.paraules, text); \r\n if (index == -1) {\r\n this.capa.innerHTML=this.putCursor(\"black\");\r\n }\r\n else {\r\n this.putImg (this.dirImg+\"/\"+this.paraules[index].imatge);\r\n this.capa.innerHTML += \"<br>\" + this.paraules[index].paraula;\r\n this.putSound (this.paraules[index].so);\r\n }\r\n }\r\n \r\n\r\n}", "imprimirVehiculos() {\n\t\tthis.vehiculos.forEach(vehiculo => {\n\t\t\tif (vehiculo.puertas) {\n\t\t\t\tconsole.log(`Marca: ${vehiculo.marca} // Modelo: ${vehiculo.modelo} // Puertas: ${vehiculo.puertas} // Precio: $${this.formatearPrecio(vehiculo.precio)}`)\n\t\t\t}\n\t\t\tif (vehiculo.cilindrada) {\n\t\t\t\tconsole.log(`Marca: ${vehiculo.marca} // Modelo: ${vehiculo.modelo} // Cilindrada: ${vehiculo.cilindrada}cc // Precio: $${this.formatearPrecio(vehiculo.precio)}`)\n\t\t\t}\n\t\t});\n\t}", "function afficherLegendeCarte() {\n if (couvertureQoS == \"couverture\") {\n if (carteCouverture == \"voix\") afficherLegendeCarteCouvVoix();\n else if (carteCouverture == \"data\") afficherLegendeCarteCouvData();\n } else if (couvertureQoS == \"QoS\") {\n actualiserMenuSelectionOperateurs();\n if (agglosTransports == \"transports\") afficherLegendeCarteQoSTransport();\n else if(agglosTransports == 'agglos') afficherLegendeCarteQoSAgglos();\n else if(driveCrowd == \"crowd\") afficherLegendeCarteQoSAgglos();\n }\n}", "function Aviao() {\n this.matricula = Utils.getRandomMatricula();\n this.selecionado = true;\n }", "function accionConsultarProducto(){\n listado1.actualizaDat();\n var numSelec = listado1.numSelecc();\n if ( numSelec < 1 ) {\n GestionarMensaje(\"PRE0025\", null, null, null); // Debe seleccionar un producto.\n } else {\n var codSeleccionados = listado1.codSeleccionados();\n var arrayDatos = obtieneLineasSeleccionadas(codSeleccionados, 'listado1'); \n var cadenaLista = serializaLineasDatos(arrayDatos);\n var obj = new Object();\n obj.hidCodSeleccionadosLE = \"[\" + codSeleccionados + \"]\";\n obj.hidListaEditable = cadenaLista;\n //set('frmContenido.conectorAction', 'LPModificarGrupo');\n mostrarModalSICC('LPModificarOferta','Consultar producto',obj,795,495);\n }\n}", "esconder(){\n console.log(`${this._nombre} corre a ${this._velocidad}m/s y da un salto de ${this._salto}m y se esconde`)\n }", "mostrarTarefas() {\n printPlanejamentoAtual(this.getPlanejamentoAtual());\n printListaTarefa(this.listaQuadros());\n }", "function mostrarEstDocente(){ // Cuando toque el boton \"estadisticas\" voy a ver la seccion (ver estadisticas)\r\n limpiar(); //limpio campos de texto y mensajes al usuario\r\n document.querySelector(\"#homeDocente\").style.display = \"block\"; //Habilito division docente\r\n document.querySelector(\"#bodyHome\").style.display = \"none\"; //Oculto body bienvenida\r\n document.querySelector(\"#divAsignarNivel\").style.display = \"none\"; // oculto plantear ejercicios a alumnos\r\n document.querySelector(\"#divPlantearEje\").style.display = \"none\"; // oculto plantear tarea\r\n document.querySelector(\"#divDevoluciones\").style.display = \"none\"; // oculto redactar devoluciones a tareas\r\n document.querySelector(\"#divEstadisticas\").style.display = \"block\"; // muestro visualizar estadisticas\r\n generarListaAlumnos();\r\n}", "function limpiarControles(){ //REVISAR BIEN ESTO\n clearControls(obtenerInputsIdsProducto());\n clearControls(obtenerInputsIdsTransaccion());\n htmlValue('inputEditar', 'CREACION');\n htmlDisable('txtCodigo', false);\n htmlDisable('btnAgregarNuevo', true);\n}", "function displayFacture(){\n\n // Si elle existe déjà, on la détruit\n $(\"#factureDetail\").empty();\n $(\"#factureSomme\").empty();\n\n // Titre\n var titre = document.createElement(\"h2\");\n titre.setAttribute(\"class\", \"w3-center\");\n titre.innerHTML= \"La Livrairie vous remercie !\";\n\n // Si la personne a fournie ses coordonnées, on les affiches (Pas de vérification demandée dans le TP)\n if(coordonnees.nom){\n $(\"#factureCoord\").show();\n $(\"#factureNom\").text(\"Nom : \" + coordonnees.nom);\n $(\"#facturePrenom\").text(\"Prénom : \" + coordonnees.prenom);\n $(\"#factureAdresse\").text(\"Adresse : \" + coordonnees.address);\n }\n\n // On crée les éléments correspondants aux achats\n for(var p in panier){\n $(\"#factureDetail\").append(createFactureElement(panier[p]));\n }\n\n // On crée la zone somme\n var somme = createSumZone(); \n \n // Ajout de la somme\n var list = $(\"#factureSomme\").append(somme);\n\n\n // On affiche\n document.getElementById(\"factureModal\").style.display='block';\n\n // On remplie les montants de la somme\n refreshSomme();\n}", "function proposer(element){\n\t\t\t\t\t\n\t\t\t\t\t// Si la couleur de fond est lightgreen, c'est qu'on a déja essayé - on quitte la fonction\n\t\t\t\t\tif(element.style.backgroundColor==\"lightGreen\" ||fini) return;\n\t\t\t\t\t\n\t\t\t\t\t// On récupere la lettre du clavier et on met la touche en lightgreen (pour signaler qu'elle est cliqu�e)\n\t\t\t\t\tvar lettre=element.innerHTML;\n\t\t\t\t\tchangeCouleur(element,\"lightGrey\");\n\t\t\t\t\t\n\t\t\t\t\t// On met la variable trouve false;\n\t\t\t\t\tvar trouve=false;\n\t\t\t\t\t\n\t\t\t\t\t// On parcours chaque lettre du mot, on cherche si on trouve la lettre s�l�ectionn�e au clavier\n\t\t\t\t\tfor(var i=0; i<tailleMot; i++) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Si c'est le cas :\n\t\t\t\t\t\tif(tableauMot[i].innerHTML==lettre) {\n\t\t\t\t\t\t\ttableauMot[i].style.visibility='visible';\t// On affiche la lettre\n\t\t\t\t\t\t\ttrouve=true;\n\t\t\t\t\t\t\tlettresTrouvees++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// Si la lettre n'est pas présente, trouve vaut toujours false :\n\t\t\t\t\tif(!trouve){\n\t\t\t\t\t\tcoupsManques++;\n\t\t\t\t\t\tdocument.images['pendu'].src=\"asset/image/pendu_\"+coupsManques+\".jpg\"; // On change l'image du pendu\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Si on a rate 9 fois :\n\t\t\t\t\t\tif(coupsManques==8){\n\t\t\t\t\t\t\talert(\"Vous avez perdu !\");\n\t\t\t\t\t\t\tfor(var i=0; i<tailleMot; i++) tableauMot[i].style.visibility='visible';\n\t\t\t\t\t\t\tfini=true;\n\t\t\t\t\t\t\t// on affiche le mot, on fini le jeu\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif(lettresTrouvees==tailleMot){\n\t\t\t\t\t\talert(\"Bravo ! Vous avez découvert le mot secret !\");\n\t\t\t\t\t\tfini=true;\n\t\t\t\t\t}\n\t\t\t\t}", "function mostrarCarritoRecuperado()\n{\n for (const precio of carritoRecuperado)\n {\n precioRecuperado = precio.precio + precioRecuperado;\n }\n $(\"#precioDelCarrito\").text(`Total: $${precioRecuperado}`);\n\n// SI HAY ITEMS EN EL CARRITO, MUESTRA PRODUCTOS\n for (const nombre of carritoRecuperado)\n {\n listaRecuperada.push(nombre.nombre+\"<br>\");\n }\n $(\"#productosEnCarrito\").append(listaRecuperada);\n\n// VUELVO A PUSHEAR LOS ITEMS EN EL CARRITO\n for (const item of carritoRecuperado)\n {\n carrito.push(item);\n }\n\n// ACTUALIZO EL CONTADOR DEL CARRITO\n contadorCarrito();\n\n}", "function mostrarCarrito() {\n // Limpiamos el HTML\n\n limpiarHTML();\n\n // Recorre el carrito y genera el HTML\n\n articulos_carrito.forEach((curso) => {\n const { img, titulo, precio, cantidad, id } = curso;\n\n const row = document.createElement('tr');\n\n row.innerHTML = `\n <td>\n <img src=\"${img}\">\n </td>\n\n <td>\n ${titulo}\n </td>\n <td>\n ${precio}\n </td>\n <td>\n ${cantidad}\n </td>\n \n <td>\n <a href='#' class=\"borrar-curso\" data-id=\"${id}\"> X </a>\n </td>\n `;\n\n // Agrega el contenido del carrito en el tbody\n contenedor_carrito.appendChild(row);\n });\n\n // Sincronizamos con el localStorage\n\n sincronizarLocalStorage();\n}", "function escoltaPregunta ()\r\n{\r\n if(this.validate) {\r\n this.capa.innerHTML=\"\";\r\n this.putImg (this.dirImg+\"/\"+this.paraules[index].imatge);\r\n this.capa.innerHTML+=\"<br>\"+this.paraules[index].paraula.toUpperCase();\r\n this.putSound (this.paraules[index].so);\r\n }\r\n else {\r\n this.capa.innerHTML = \"\"\r\n this.putImg (this.dirImg+\"/\"+this.paraules[index].imatge);\r\n this.putSound (this.paraules[index].so);\r\n this.capa.innerHTML += \"<br>\" + this.actual+this.putCursor ('black');\r\n }\r\n}", "function agregarOrden(){\r\n let compra = document.getElementById('tit1')\r\n let precio = document.getElementById('pre1')\r\n pedido.push(new vehiculo(compra.textContent, precio.textContent));\r\n crearPedido(); \r\n}", "function mostrarPedidos(pedidos) {\n const miPedido = pedidos.data;\n //si hay algun pedido\n if (miPedido.length > 0) {\n //Recorro el array de pedidos y voy cargando la info\n for (let i = 0; i < miPedido.length; i++) {\n let elPedido = miPedido[i];\n let elProducto = elPedido.producto;\n let unaImagenUrl = `http://ec2-54-210-28-85.compute-1.amazonaws.com:3000/assets/imgs/${elProducto.urlImagen}.jpg`;\n let unaCard = `<ons-card modifier=\"material\">\n <div class=\"title\" style=\"text-align: center\">${elProducto.nombre}</div>\n <ons-list>\n <ons-list-item tappable>\n <ons-list-item><img src=${unaImagenUrl} style=\"width: 60%; display:block; margin:auto\"></ons-list-item>\n <ons-list-item>Código: ${elProducto.codigo}</ons-list-item>\n <ons-list-item>Etiquetas: ${elProducto.etiquetas}</ons-list-item>\n <ons-list-item>Estado: ${elProducto.estado}</ons-list-item>\n <ons-list-item>Sucursal donde retira: ${elPedido.sucursal.nombre}</ons-list-item>\n <ons-list-item>Precio total: $ ${parseInt(elPedido.cantidad) * parseInt(elProducto.precio)}</ons-list-item>\n <ons-list-item>Estado del pedido: ${elPedido.estado}</ons-list-item>\n </ons-list-item>\n </ons-list>`;\n // Si el estado del pedido es pendiente, muestro el boton para insertar comentario\n if (elPedido.estado == 'pendiente') {\n unaCard += `<p style=\"text-align:center\">\n <ons-button modifier=\"material\" onclick=\"showPrompt('${elPedido._id}')\">Agregar comentario</ons-button>\n </p>\n </ons-card>`;\n //Si el pedido no es 'pendiente', deshabilito el boton\n } else {\n unaCard += `<p style=\"text-align:center\">\n <ons-button modifier=\"material\" onclick=\"showPrompt('${elPedido._id}')\" disabled=\"true\">Agregar comentario</ons-button>\n </p>\n </ons-card>`;\n }\n $(\"#divDetallePedidos\").append(unaCard);\n }\n //Si no hay ningun pedido, muestro un cartel y navego hacia atras.\n } else {\n ons.notification.alert(\"No hay pedidos para mostrar\", { title: 'Error' });\n navegarAtras();\n }\n}", "function mostrarListadoSaldoConductor(){\n ocultarFormularios();\n \n let sListado = oDGT.listadoSaldoConductor();\n \n document.getElementById(\"areaListado\").innerHTML= sListado;\n document.getElementById(\"titulo\").innerHTML= \"Listado de conductores con saldo pendiente\";\n}", "function vaciarCarrito() {\n // Limpiamos los productos guardados\n carrito = [];\n // Renderizamos los cambios\n renderizarCarrito();\n calcularTotal();\n}", "function getCuponesPorIndustria(idIndustria){\n\t\n}", "ispisiMi(){\r\n console.log(this.prefektura + \" \" + this.glavniGrad + \" \" + this.region + \" \" + this.ostrvo + \" \" + this.brojStanovnika);\r\n}", "function mostrar(estudiante) {\n // TO DO: Completar el template para que muestre las propiedades correctas del estudiante\n var resultado = \"\";\n resultado += \"<div class='row'>\";\n resultado += \"<div class='col m12'>\";\n resultado += \"<div class='card blue-grey darken-1'>\";\n resultado += \"<div class='card-content white-text'>\";\n resultado += \"<p><strong>Nombre:</strong> \" + estudiante.nombre + \"</p>\";\n resultado += \"<p><strong>Puntos Técnicos:</strong> \" + estudiante.portec + \"</p>\";\n resultado += \"<p><strong>Puntos HSE:</strong> \" + estudiante.porHSE + \"</p>\";\n resultado += \"</div>\";\n resultado += \"</div>\";\n resultado += \"</div>\";\n resultado += \"</div>\";\n return resultado;\n}", "toString(){\n //Se aplica poliformismo (multiples formas en tiempo de ejecucion)\n //el metodo que se ejecuta depende si es una referencia de tipo padre \n //o de tipo hijo\n return this.nombreCompleto();\n }", "function Buscar() {\n var nombreTipoHabitacion = get(\"txtNombreTipoHabitacion\")\n //alert(nombreTipoHabitacion);\n pintar({\n url: \"TipoHabitacion/filtrarTipoHabitacionPorNombre/?nombreHabitacion=\" + nombreTipoHabitacion,\n id: \"divTabla\",\n cabeceras: [\"Id\", \"Nombre\", \"Descripcion\"],\n propiedades: [\"id\", \"nombre\", \"descripcion\"],\n editar: true,\n eliminar: true,\n propiedadID: \"id\"\n\n })\n\n}", "function ConverteEscudo(escudo_entrada) {\n var escudo_tabela = tabelas_escudos[escudo_entrada.chave];\n var escudo_personagem = {};\n // O nome da entrada eh apenas um indice na tabela de armas.\n escudo_personagem.entrada = {\n chave: escudo_entrada.chave,\n material: escudo_entrada.material,\n bonus: escudo_entrada.bonus,\n // Se é magico, também é obra prima.\n obra_prima: escudo_entrada.bonus > 0 ?\n true : escudo_entrada.obra_prima,\n em_uso: escudo_entrada.em_uso,\n };\n return escudo_personagem;\n}", "function obtenerEquiposParticipantes(){\n wizardFactory.equiposParticipantes(vm.torneoSelected.tor_id)\n .success(function (data) {\n vm.equiposParticipantes = data;\n obtenerEquiposDisponibles();\n })\n .error( errorHandler );\n }", "function etapa2() {\n countEtapa2++;\n\n //recebendo H3 e setando nela o texto com o nome do cliente\n var tituloDaEtapa = document.querySelector(\"#tituloDaEtapa\");\n tituloDaEtapa.textContent = \"2º Etapa - Crianças\"; \n\n //recebe o controlador com total e todos os aniversariantes e salva em uma variavel \n var totalCriancas = document.getElementById('totalCriancas').value;\n var listaConcatenadaCrianca = document.getElementById('listaConcatenadaCrianca').value; \n\n document.getElementById('confirmacaoCliente').style.display = 'none'; //desabilita a confirmação da etapa 1\n document.getElementById('selecionarAniversariantes').style.display = ''; //habilita a etapa 2\n\n //pega a lista concatenada das crianças e faz um split e salva o resultado na lista resultado\n var resultado = listaConcatenadaCrianca.split(\"/\");\n\n //percorre essa lista resultado\n resultado.forEach((valorAtual) => {\n\n //variaveis \n var idCrianca = 0;\n var nomeCrianca = \"\";\n var idClienteCrianca = 0;\n var countResultado = 0;\n\n //faz novamente um split em cada objeto da lista \n var resultado2 = valorAtual.split(\",\");\n\n //salva nas variaveis os valores da criança\n resultado2.forEach((valorAtual2) => {\n countResultado++;\n //se é a primeira vez que passa na lista, salva o id\n if (countResultado == 1) {\n idCrianca = valorAtual2;\n } \n if (countResultado == 2){\n nomeCrianca = valorAtual2;\n }\n if(countResultado == 3){\n idClienteCrianca = valorAtual2;\n }\n });\n\n //verifica se a criança atual do laço, tem o mesmo idCliente que foi selecionado\n if(idCliente == idClienteCrianca){\n //condição para verificar se alguma vez já passou pela etapa 2 e criou os elementos \n if(countEtapa2 == 1){\n quantidadeCrianca++;\n quantidadeCrianca2++;\n\n document.getElementById('tabelaAniversariante').style.display = ''; //habilita a tabela de listagem de criança\n \n //COMEÇO DA CRIAÇÃO DA TABELA DAS CRIANÇAS\n //cria um elemento do tipo TR e salva ele em uma variavel\n var aniversariantesTr = document.createElement(\"tr\");\n aniversariantesTr.id = \"tdAniversariante\" + quantidadeCrianca;\n\n //cria elementos do tipo TD e salva eles em uma variavel\n var aniversarianteTd = document.createElement(\"td\");\n var removerAniversarianteTd = document.createElement(\"td\");\n\n //criando elemento button para remover\n var removerAniversarianteBotao = document.createElement(\"button\");\n removerAniversarianteBotao.textContent = \"Remover\";\n removerAniversarianteBotao.type = \"button\";\n removerAniversarianteBotao.classList.add(\"btn\", \"btn-info\");\n removerAniversarianteBotao.id = \"idRemoverAniversarianteBotao\";\n removerAniversarianteBotao.name = \"nameRemoverAniversarianteBotao\" + quantidadeCrianca;\n \n //criando atributo onclick para o botão remover\n removerAniversarianteBotao.onclick = function (){\n quantidadeCrianca--; //remove 1 da quantidade de criança\n \n //remove o elemento tr da table\n document.getElementById(aniversariantesTr.id).remove();\n \n //remove o input \n document.getElementById(inputCrianca.id).remove();\n \n //remove da lista de nome a criança removida\n listaNomeCrianca.splice(listaNomeCrianca.indexOf(nomeCrianca), 1); \n \n //se não ficou nenhuma criança oculta a table\n if(quantidadeCrianca == 0){\n document.getElementById('tabelaAniversariante').style.display = 'none';\n quantidadeCriancaBotaoRemover = 0;\n quantidadeCrianca2 = 0;\n textoConfirmacaoCrianca = \"\";\n \n var subTituloEtapa2 = document.querySelector(\"#subTituloEtapa2\");\n subTituloEtapa2.textContent = \"Nenhuma criança selecionada! Por favor, siga para a 3° Etapa ou clique no botão 'Recarregar crianças' para selecionar novamente.\"; \n }\n };\n \n //colocando o botão de remover dentro do td de remover\n removerAniversarianteTd.appendChild(removerAniversarianteBotao);\n\n //seta o texto das td com o nome da criança\n aniversarianteTd.textContent = nomeCrianca;\n\n //coloca os TDS criados que estão com os valores do form dentro do TR\n aniversariantesTr.appendChild(aniversarianteTd);\n aniversariantesTr.appendChild(removerAniversarianteTd);\n\n //pega o elemento table do html através do id e seta nele o TR criado\n var tabelaTbodyAniversariante = document.querySelector(\"#tbodyAniversariantes\");\n tabelaTbodyAniversariante.appendChild(aniversariantesTr);\n //FIM DA CRIAÇÃO DA TABELA DAS CRIANÇAS\n \n //COMEÇO DA CRIAÇÃO O INPUT DO CADASTRO DE FESTA\n //cria um elemento html input\n var inputCrianca = document.createElement(\"input\");\n \n //seta os atributos do input\n inputCrianca.type = \"hidden\";\n inputCrianca.value = idCrianca;\n inputCrianca.name = \"idCrianca\"+quantidadeCrianca;\n inputCrianca.id = \"idCrianca\"+quantidadeCrianca;\n \n //buscando o form de cadastro e setando nele o input criado\n var formCadastroDeFesta = document.querySelector('#cadastrarFestaForm');\n formCadastroDeFesta.appendChild(inputCrianca);\n //FIM DA CRIAÇÃO O INPUT DO CADASTRO DE FESTA\n \n //adiciona o nome da criança na lista de nome da criança\n listaNomeCrianca.push(nomeCrianca);\n \n }\n \n }\n \n });\n \n quantidadeCriancaBotaoRemover = quantidadeCrianca;\n \n //se o cliente não tiver criança\n if(quantidadeCrianca < 1){\n \n if(possuiCrianca == 1){\n var subTituloEtapa2 = document.querySelector(\"#subTituloEtapa2\");\n subTituloEtapa2.textContent = \"Nenhuma criança selecionada! Por favor, siga para a 3° Etapa ou clique no botão 'Recarregar crianças' para selecionar novamente.\"; \n }else{\n var subTituloEtapa2 = document.querySelector(\"#subTituloEtapa2\");\n subTituloEtapa2.textContent = \"Esse cliente não possui nenhuma criança vinculada ao seu cadastro. Por favor, siga para a 3° Etapa ou atualize as informações no cadastro de cliente.\"; \n }\n \n }else{\n possuiCrianca = 1;\n \n var subTituloEtapa2 = document.querySelector(\"#subTituloEtapa2\");\n subTituloEtapa2.textContent = \"Por favor, clique em remover caso alguma criança não faça parte do cadastro: \";\n }\n \n }", "function mostrarSedesCarrera() {\n let carreraSelect = this.dataset.codigo;\n let carrera = buscarCarreraPorCodigo(carreraSelect);\n let listaCursos = getListaCursos();\n let listaCheckboxCursos = document.querySelectorAll('#tblCursos tbody input[type=checkbox]');\n let codigosCursos = [];\n\n for (let i = 0; i < carrera[7].length; i++) {\n codigosCursos.push(carrera[7][i]);\n }\n\n for (let j = 0; j < listaCursos.length; j++) {\n for (let k = 0; k < codigosCursos.length; k++) {\n if (listaCursos[j][0] == codigosCursos[k]) {\n listaCheckboxCursos[j].checked = true;\n }\n }\n }\n verificarCheckCarreras();\n}", "mostrar() {\n return `${this.nombre} tiene una urgencia de ${this.prioridad}`;\n }", "function siguienteSeccion(){\n document.getElementById('segundaParte').style.display='block';\n document.getElementById('primeraParte').style.display='none';\n document.getElementById('Errores').style.display='none';\n document.getElementById('Exitoso').style.display='none';\n}", "function etapa3() {\n countListaNomeCrianca = 0; //count de quantas vezes passou na lista de crianças\n\n //recebendo H3 e setando nela o texto com o nome do cliente\n var tituloDaEtapa = document.querySelector(\"#tituloDaEtapa\");\n tituloDaEtapa.textContent = \"3º Etapa - Colaborador\";\n\n document.getElementById('selecionarFuncionarios').style.display = ''; //habilita a etapa 3\n document.getElementById('selecionarAniversariantes').style.display = 'none'; //desabilita a etapa 2\n \n //seta a quantidade de criança que foi definida no input de controle \"qtdCrianca\"\n document.getElementById('qtdCrianca').value = quantidadeCrianca2;\n \n //percorre a lista de nomes das crianças e monta o texto de confirmação para as crianças\n var tamanhoListaNomeCrianca = listaNomeCrianca.length; //recebe o tamanho da lista em uma variavel\n\n listaNomeCrianca.forEach((valorAtualLista) => {\n if(countListaNomeCrianca == 0){\n textoConfirmacaoCrianca = \"Aniversariantes: \";\n }\n countListaNomeCrianca++;\n \n if(countListaNomeCrianca == tamanhoListaNomeCrianca){\n textoConfirmacaoCrianca = textoConfirmacaoCrianca + valorAtualLista;\n }else{\n textoConfirmacaoCrianca = textoConfirmacaoCrianca + valorAtualLista + \" / \";\n }\n \n }); \n countListaNomeCrianca = 0;\n \n if(tamanhoListaNomeCrianca == 0){\n textoConfirmacaoCrianca = \"Evento não possui aniversariante.\";\n }\n \n //seta o texto informação da crianças na ultima etapa\n var confirmacaoInfCrianca = document.querySelector(\"#criancasInf\");\n confirmacaoInfCrianca.textContent = textoConfirmacaoCrianca; \n \n }", "function agregarCarrito(seleccion){\n let encontrado = listaProductos.find(producto => producto.nombre == seleccion);\n const card = `\n <div class= \"carritoContainer\">\n <img class=\"imagenProductoComprado\" src=\"${encontrado.img}\">\n <h5 class=\"productoComprado\">${encontrado.nombre}</h5>\n <h6 class=\"productoPrecio\">${encontrado.precio}</h6>\n </div>` \n\n let carro = document.getElementById('botonCarrito')\n carro.innerHTML += card\n}", "procesarControles(){\n\n }", "function seleccionePersona(tipo){\n elementos.mensajePanel.find('h3').text('Seleccione un '+tipo+' para ver las devoluciones disponibles');\n elementos.mensajePanel.removeClass('hide');\n elementos.devolucionesTabla.addClass('hide');\n elementos.mensajePanel.find('.overlay').addClass('hide');\n }", "function muestraCliente(ventas){\n let productosDesc=document.querySelector('.productosDesc');\n ventas.forEach(element => {\n let divProductos=document.createElement('div');\n divProductos.className=\"producto\";\n divProductos.innerHTML=`\n <img src=\"${element.imagen}\" width=100>\n <p class=\"name\">${element.titulo}</p>\n <p>$${element.precio}</p>\n <input type=\"number\" class=\"cantidad\" name=\"cant\" min=\"0\" max=\"999\" value=\"${element.cant}\">\n <button class=\"deleteItem\"> X </button>\n `\n productosDesc.appendChild(divProductos);\n });\n actualizaMonto();\n}", "function renderizaMunicoes(){\n\tmunicoes.forEach(desenhaMunicao);\n\tmunicoesAndam();\n}", "function fasesTorneo() {\n vm.paso = 3;\n obtenerFases();\n obtenerTiposDeFase();\n obtenerPenalizaciones();\n }", "function Produto(nome,preco){\n this.nome = nome;\n this.preco = preco;\n\n}", "function agregar_carrito(e) {\r\n const boton = e.target;\r\n const item = boton.closest('.card');\r\n const item_titulo = item.querySelector('.card-title').textContent;\r\n const item_precio = item.querySelector('.precio').textContent;\r\n const item_img = item.querySelector('.card-img-top').src;\r\n const item_nuevo = {\r\n nombre: item_titulo,\r\n precio: item_precio,\r\n foto: item_img,\r\n cantidad: 1,\r\n };\r\n agregar_nuevo_producto(item_nuevo);\r\n}", "function mostrarFormCrearProv(){\n vista.mostrarPlantilla('formProveedor', 'areaTrabajo');\n document.getElementById(\"btnProveedorLimpiar\").addEventListener(\"click\", limpiarFormCrearProv);\n document.getElementById(\"btnProveedorModificar\").addEventListener(\"click\", modificarProveedor);\n document.getElementById(\"btnProveedorCrear\").addEventListener(\"click\", crearProveedor);\n document.getElementById(\"idProveedor\").addEventListener(\"change\", mostrarDatosProveedor);\n proveedor.consultarProveedores(consultarProveedoresRetorno); //cargar el select de proveedores\n}", "function buscarAutor() {\n let autores = listados.getAutores();\n let pregunta = rl.question(\"Introduce el autor a buscar :\");\n\n if (autores.length > 0)\n for (let autor of autores) {\n if (pregunta === autor.nombre) {\n console.log(\"Nombre : \" + autor.nombre);\n console.log(\"Apellidos : \" + autor.apellidos + \"\\n\");\n }\n\n }\n else {\n console.log(\"No hay resultados\\n\");\n return;\n }\n}", "function agregarCarro(nombre) {\n const añadido = cursos.find(curso => curso.nombre === nombre)\n carrito.push(añadido)\n document.getElementById(\"car\").innerHTML = carrito.length\n const compra = carrito.map(curso => curso.nombre + \" $ \" + curso.precio)\n document.getElementById(\"listaCurso\").innerHTML = compra.join(\"<br>\")\n\n localStorage.carrito = JSON.stringify(carrito);\n\n}", "function cargarCgg_res_oficial_seguimientoCtrls(){\n if(inRecordCgg_res_oficial_seguimiento){\n tmpUsuario = inRecordCgg_res_oficial_seguimiento.get('CUSU_CODIGO');\n txtCrosg_codigo.setValue(inRecordCgg_res_oficial_seguimiento.get('CROSG_CODIGO'));\n txtCusu_codigo.setValue(inRecordCgg_res_oficial_seguimiento.get('NOMBRES')+' '+inRecordCgg_res_oficial_seguimiento.get('APELLIDOS'));\n chkcCrosg_tipo_oficial.setValue(inRecordCgg_res_oficial_seguimiento.get('CROSG_TIPO_OFICIAL'));\n isEdit = true;\n habilitarCgg_res_oficial_seguimientoCtrls(true);\n }}", "toString(){\r\n //Se aplica poliformismo (multiples formas en tiempo de ejecucion)\r\n //el metodo que se ejecuta depende si es una referencia de tipo padre \r\n //o de tipo hijo\r\n return this.nombreCompleto();\r\n }", "function infogral(cabinet) {\n vm.asset = cabinet;\n if (vm.puncture) {\n vm.puncture.cabinet_id = vm.asset.economico;\n }\n }", "function mostrarDevoluciones() {\n elementos.mensajePanel.addClass('hide');\n elementos.devolucionesTabla.removeClass('hide');\n\n NumberHelper.mascaraMoneda('.mascaraMoneda');\n }", "function servicios(servicio) {\n //creo el contenedor que va a alojar a los div de cada servicio que ofresco\n let contenedor = document.createElement(\"div\");\n contenedor.id = prefijo + servicio.id;\n contenedor.classList.add(\"col-mb-2\", \"mb-4\");\n contenedor.innerHTML = `<div class=\"card\">\n <img src=\"${servicio.imagen}\" class=\"card-img-top\" alt=\"...\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">${servicio.nombre}</h5>\n <p class=\"card-text\">$${servicio.precio}</p>\n <button id=\"${servicio.id}\" class = \"botonComprar\">COMPRAR</button>\n </div>`;\n //genero un nodo hijo por cada servicio que agrego (un div por cada servicio, al div que va a contener a todos)\n contenedorServicios.appendChild(contenedor);\n}", "function showRequisition (requisicion, table) {\n let productos = requisicion.productos;\n let numeroProductos = productos.length;\n let producto, tr;\n \n for (let i = 0; i < numeroProductos; i++) {\n producto = productos[i];\n\n tr = createRequisitionProduct (producto);\n table.appendChild(tr);\n }\n\n // crear la fila de las observaciones\n if (requisicion.observaciones != \"\") {\n producto = {\n product: requisicion.observaciones,\n cant: 1,\n unimed: \"p\",\n marcaSug: \"...\",\n enCamino: 0,\n entregado: 0,\n status: 0\n };\n \n let entregado = requisicion.observaciones.split(\"_\");\n entregado = entregado[entregado.length-1];\n if (entregado == \"entregado\") {\n producto.entregado = 1;\n producto.status = 1;\n }\n if (requisicion.comentarios != \"\") {\n producto.enCamino = 1;\n }\n \n tr = createRequisitionProduct (producto);\n table.appendChild(tr);\n }\n}", "function criarObjetoFis(_objeto) {\n var objeto = _objeto;\n switch (objeto) {\n case \"Esfera\":\n {\n try {\n if (document.getElementById(\"MassaEsfera\").value === \"\" || document.getElementById(\"MassaEsfera\").value <= 0) {\n alert(\"O valor da da massa não pode ser vazio nem menor que zero!\");\n } else {\n objetoAtual = new ObjetoFisica(document.getElementById(\"NomeEsfera\").value,\n parseInt(document.getElementById(\"Raio\").value),\n \"Esfera\",\n document.getElementById(\"MaterialEsfera\").value,\n indice,\n getVector3(\"posEsfera\"),\n getVector3(\"vEsfera\"),\n document.getElementById(\"MassaEsfera\").value,\n document.getElementById(\"amortce_Linear_Esfera\").value,\n document.getElementById(\"amortce_Angular_Esfera\").value,\n getVector3(\"rotEsfera\"),\n getVector3(\"acEsfera\"),\n getQuaternion(\"oEsfera\"),\n colisao('esfera'),\n true);\n objetoAtual.CriaEsfera();//Colocar como parametro a cena.\n listaObjetosFis.push(objetoAtual);\n console.log(objetoAtual.getOrientacao());\n //console.log(objetoAtual.teste());\n document.getElementById(\"listaObjetos\").appendChild(objetoAtual.getDiv());\n document.getElementById(\"listaDeObjetos_Efera\").appendChild(objetoAtual.addLista('esfera'));\n document.getElementById(\"listaDeObjetos_Cubo\").appendChild(objetoAtual.addLista('cubo'));\n document.getElementById(\"listaDeObjetos_Alvo\").appendChild(objetoAtual.addLista('alvo'));\n indice++;\n }\n } catch (e) {\n alert(e);\n }\n break;\n }\n case \"Cubo\":\n {\n try {\n if (document.getElementById(\"MassaCubo\").value === \"\" || document.getElementById(\"MassaCubo\").value <= 0) {\n alert(\"O valor da da massa não pode ser vazio nem menor que zero!\");\n } else {\n objetoAtual = new ObjetoFisica(document.getElementById(\"NomeCubo\").value,\n parseInt(document.getElementById(\"TamanhoCubo\").value),\n \"Cubo\",\n document.getElementById(\"MaterialCubo\").value,\n indice,\n getVector3(\"posCubo\"),\n getVector3(\"vCubo\"),\n document.getElementById(\"MassaCubo\").value,\n document.getElementById(\"amortce_Linear_Cubo\").value,\n document.getElementById(\"amortce_Angular_Cubo\").value,\n getVector3(\"rotCubo\"),\n getVector3(\"acCubo\"),\n getQuaternion(\"oCubo\"),\n colisao('cubo'),\n true);\n objetoAtual.CriaCubo();\n listaObjetosFis.push(objetoAtual);\n //alert(objetoAtual.teste());\n document.getElementById(\"listaObjetos\").appendChild(objetoAtual.getDiv());\n document.getElementById(\"listaDeObjetos_Efera\").appendChild(objetoAtual.addLista('esfera'));\n document.getElementById(\"listaDeObjetos_Cubo\").appendChild(objetoAtual.addLista('cubo'));\n document.getElementById(\"listaDeObjetos_Alvo\").appendChild(objetoAtual.addLista('alvo'));\n indice++;\n }\n } catch (e) {\n alert(e);\n }\n break;\n }\n case \"Alvo\":\n {\n try {\n objetoAtual = new ObjetoFisica(document.getElementById(\"NomeAlvo\").value,\n parseInt(document.getElementById(\"TamanhoAlvo\").value),\n \"Alvo\",\n null,\n indice,\n getVector3(\"posAlvo\"),\n getVector3(\"vAlvo\"),\n document.getElementById(\"MassaAlvo\").value,\n document.getElementById(\"amortce_Linear_Alvo\").value,\n document.getElementById(\"amortce_Angular_Alvo\").value,\n getVector3(\"rotAlvo\"),\n getVector3(\"acAlvo\"),\n getQuaternion(\"oAlvo\"),\n colisao('alvo'),\n false);\n objetoAtual.CriaAlvo();\n listaObjetosFis.push(objetoAtual);\n //alert(objetoAtual.teste());\n document.getElementById(\"listaObjetos\").appendChild(objetoAtual.getDiv());\n document.getElementById(\"listaDeObjetos_Efera\").appendChild(objetoAtual.addLista('esfera'));\n document.getElementById(\"listaDeObjetos_Cubo\").appendChild(objetoAtual.addLista('cubo'));\n document.getElementById(\"listaDeObjetos_Alvo\").appendChild(objetoAtual.addLista('alvo'));\n indice++;\n } catch (e) {\n alert(e);\n }\n break;\n }\n }\n}", "function mostrarMovimientosEnPantalla() {\n let cartel = document.getElementById('movimientos');\n let limite = document.getElementById('movimientos-restantes');\n cartel.innerText = movimientos.length;\n limite.innerText = `Movimientos restantes: ${limiteMovimientos}`;\n}", "function registroCarrito(curso) {\n return `<p> ${curso.nombreCurso} \n <span class=\"badge bg-warning\"> Precio Unitario: $ ${curso.precioCurso}</span>\n <span class=\"badge bg-dark\">${curso.cantidad}</span>\n <span class=\"badge bg-success\"> Precio total: $ ${curso.subtotal()}</span>\n <a id=\"${curso.id}\" class=\"btn btn-info btn-add\">+</a>\n <a id=\"${curso.id}\" class=\"btn btn-warning btn-restar\">-</a>\n <a id=\"${curso.id}\" class=\"btn btn-danger btn-delete\">x</a>\n \n </p>`\n}", "function mostrarprmaelementocequiv(habp,com){\n\n\t\t\t//////////////////////////////////PLAN HABILITADORAS ////////////////////////////////////////////////\t\t\t\n\t\t\t\t\t\t// ESFUERZO PROPIO PLAN EN BOLIVARES \t\t\t\t\t\n\t\t\t\t\t\tvar laborep = filtrarcostohab(habp,filtrolabor,5,com,1);\n\t\t\t\t\t\tvar bbep = filtrarcostohab(habp,filtrobb,5,com,1);\n\t\t\t\t\t\tvar mep = filtrarcostohab(habp,filtrom,5,com,1);\n\t\t\t\t\t\tvar scep = filtrarcostohab(habp,filtrosc,5,com,1);\n\t\t\t\t\t\tvar oep = filtrarcostohab(habp,filtroo,5,com,1);\n\t\t\t\t\t\tvar totalep = filtrartotal(laborep,bbep,mep,scep,oep);\n \n \t\t\t\t\t\t \t\t // ESFUERZOS PROPIOS PLAN EN DOLARES\n \t\t\t\t\t\t var laborepdol = filtrarcostohab(habp,filtrolabor,5,com,2);\n \t\t\t\t\t\t var bbepdol = filtrarcostohab(habp,filtrobb,5,com,2);\n \t\t\t\t\t\t var mepdol = filtrarcostohab(habp,filtrom,5,com,2);\n \t\t\t\t\t\t var scepdol = filtrarcostohab(habp,filtrosc,5,com,2);\n \t\t\t\t\t\t var oepdol = filtrarcostohab(habp,filtroo,5,com,2);\n \t\t\t\t\t\t var totalepdol = filtrartotal(laborepdol,bbepdol,mepdol,scepdol,oepdol);\n\n \t\t\t\t\t\t // DTTO ORIENTAL PLAN EN BOLIVARES\n\t\t\t\t\t \t var labordtto = filtrarcostohab(habp,filtrolabor,4,com,1);\n \t\t\t\t\t\t var bbdtto = filtrarcostohab(habp,filtrobb,4,com,1);\n \t\t\t\t\t\t var mdtto = filtrarcostohab(habp,filtrom,4,com,1);\n \t\t\t\t\t\t var scdtto = filtrarcostohab(habp,filtrosc,4,com,1);\n \t\t\t\t\t\t var odtto = filtrarcostohab(habp,filtroo,4,com,1);\n \t\t\t\t\t\t var totaldtto = filtrartotal(labordtto,bbdtto,mdtto,scdtto,odtto);\n\n \t\t\t\t\t\t // DTTO ORIENTAL PLAN EN DOLARES\n \t\t\t\t\t\t var labordttodol = filtrarcostohab(habp,filtrolabor,4,com,2);\n \t\t\t\t\t\t var bbdttodol = filtrarcostohab(habp,filtrobb,4,com,2);\n \t\t\t\t\t\t var mdttodol = filtrarcostohab(habp,filtrom,4,com,2);\n \t\t\t\t\t\t var scdttodol = filtrarcostohab(habp,filtrosc,4,com,2);\n \t\t\t\t\t\t var odttodol = filtrarcostohab(habp,filtroo,4,com,2);\n \t\t\t\t\t\t var totaldttodol = filtrartotal(labordttodol,bbdttodol,mdttodol,scdttodol,odttodol);\n\n\n \t\t\t\t\t\t /// DIVISION ORIENTAL PLAN EN BOLIVARES\n \t\t\t\t\t\t var labordivo = filtrardivo(labordtto,laborep);\n \t\t\t\t\t\t var bbdivo = filtrardivo(bbdtto,bbep);\n \t\t\t\t\t\t var mdivo = filtrardivo(mdtto,mep);\n \t\t\t\t\t\t var scdivo = filtrardivo(scdtto,scep);\n \t\t\t\t\t\t var odivo = filtrardivo(odtto,oep);\n \t\t\t\t\t\t var totaldivo = filtrartotal(labordivo,bbdivo,mdivo,scdivo,odivo);\n\n \t\t\t\t\t\t /// DIVISION ORIENTAL PLAN EN DOLARES\n \t\t\t\t\t\t var labordivodol = filtrardivo(labordttodol,laborepdol);\n \t\t\t\t\t\t var bbdivodol = filtrardivo(bbdttodol,bbepdol);\n \t\t\t\t\t\t var mdivodol = filtrardivo(mdttodol,mepdol);\n \t\t\t\t\t\t var scdivodol = filtrardivo(scdttodol,scepdol);\n \t\t\t\t\t\t var odivodol = filtrardivo(odttodol,oepdol);\n \t\t\t\t\t\t var totaldivodol = filtrartotal(labordivodol,bbdivodol,mdivodol,scdivodol,odivodol);\n\n \t\t\t\t\t\t /// DIVISION ORIENTAL PLAN EN DOLARES EQUIVALENTES\n \t\t\t\t\t\t var labordivoDeqv = filtroequivalente(labordivo,labordivodol);\n \t\t\t\t\t\t var bbdivoDeqv = filtroequivalente(bbdivo,bbdivodol);\n \t\t\t\t\t\t var mdivoDeqv = filtroequivalente(mdivo,mdivodol);\n \t\t\t\t\t\t var scdivoDeqv = filtroequivalente(scdivo,scdivodol);\n \t\t\t\t\t\t var odivoDeqv = filtroequivalente(odivo,odivodol);\n \t\t\t\t\t\t var totaldivoDeqv = filtrartotal(labordivoDeqv,bbdivoDeqv,mdivoDeqv,scdivoDeqv,odivoDeqv);\n\n \t\t\t\t\t\t ////////////////////// FIN PLAN ////////////////////////////////////////////////\n \t\t\t\t\t\t var laborybbdivoDeqv = filtrardivo(labordivoDeqv,bbdivoDeqv);\n\n \t\t\t\t\t\t\n \t\t\t\t\t\tvar\tinformacion = cabeceracategoriaprmva('red-header','ELEMENTO DE COSTO');\n \t\t\t\t\t\t\tinformacion += mostrarcategoriaprmva('','Labor y Beneficios',laborybbdivoDeqv); \n \t\t\t\t\t\t\tinformacion += mostrarcategoriaprmva('','Materiales',mdivoDeqv);\n \t\t\t\t\t\t\tinformacion += mostrarcategoriaprmva('','Servicios y Contratos',scdivoDeqv);\n \t\t\t\t\t\t\tinformacion += mostrarcategoriaprmva('','Otros Costos y Gastos',odivoDeqv);\n \t\t\t\t\t\t\tinformacion += mostrarcategoriaprmva('red-header','Total',totaldivoDeqv); \n \t\t\t\t\treturn informacion;\n\n}", "function mostrar()\n{\n\tvar edadIngresada;\n\tvar estadoCivilIngresado;\n\n\tedadIngresada=txtIdEdad.value;\n\tedadIngresada=parseInt(edadIngresada);\n\n\testadoCivilIngresado=estadoCivil.value;\n\n\tif(edadIngresada<18)\n\t{\n\t\talert(\"respeta a tus mayores\");\n\t\tif(edadIngresada<13)\n\t\t{\n\t\t\talert(\"hagan la tarea\");\n\t\t}\n\t\tif(estadoCivilIngresado!=\"Soltero\")\n\t\t{\n\t\t\talert(\"Es muy pequeño para NO ser soltero\");\n\t\t}\n\t}\n\telse\n\t{\n\t\talert(\"se responsable\");\n\t\tif(edadIngresada>59)\n\t\t{\n\t\t\talert(\"sos persona de riesgo\");\n\t\t}\n\t\tif(estadoCivilIngresado==\"Casado\")\n\t\t{\n\t\t\talert(\"a disfrutar la pareja\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif(estadoCivilIngresado==\"Soltero\")\n\t\t\t{\n\t\t\t\talert(\"a vivir la vida\");\n\t\t\t}\n\t\t}\n\t}\n\t\n\tif(estadoCivilIngresado==\"Divorciado\")\n\t{\n\t\talert(\"a intentarlo nuevamente\");\n\t}\n}", "function chercheCaseVide () {\n let objet;\n for (let i = 0; i < plateau.length; i++) {\n for (let j = 0; j < plateau.length; j++) {\n if (plateau[i][j] === 16) {\n $('.row' + i + ' .cas' + j).addClass(\"celluleVide\");\n $('.row' + i + ' .cas' + j).text(\" \");\n objet = {\"i\":i,\"j\":j};\n } else {\n $('.row' + i + ' .cas' + j).removeClass(\"celluleVide\");\n }\n }\n } return objet;\n }", "saludar (){\n console.log(`Hola, me llamo ${this.nombreObj} ${this.apellidoObj}`)\n }", "function showDecomp() {\n var decompArea = document.querySelector(\".decompose-current\");\n decompArea.innerHTML = `\n <h5> Dekompozicija: ${ro}</h5>\n `;\n}", "nuevoCiclo() {\n let suma = 0;\n for (let i = 0; i < this.vecinos.length; i++) {\n if (this.vecinos[i].estado === 1) {\n suma++;\n }\n }\n\n // Aplicamos las normas\n this.estadoProx = this.estado; // Por defecto queda igual\n\n // Vida: tiene 3 vecinos\n if (this.estado === 0 && suma === 3) {\n this.estadoProx = 1;\n }\n\n // Muerte: menos de 2(soledad) o mas de 3 (inanicion)\n if (this.estado == 1 && (suma < 2 || suma > 3)) {\n this.estadoProx = 0;\n }\n }", "function cambiar(){\n \t var compania;\n \t //Se toma el valor de la \"compañia seleccionarda\"\n \t compania = document.formulariorecargas.compania[document.formulariorecargas.compania.selectedIndex].value;\n \t //se chequea si la \"compañia\" esta definida\n \t \n \t if(compania!=0){\n \t\t //Seleccionamos las cosas correctas\n \t\t \n \t\t mis_tipos=eval(\"tipo_\" + compania);\n \t\t //se calcula el numero de compania\n \t\t num_tipos=mis_tipos.length;\n \t\t //marco el numero de tipos en el select\n \t\t document.formulariorecargas.tipo.length = num_tipos;\n \t\t //para cada tipo del array, la pongo en el select\n \t\t for(i=0; i<num_tipos; i++){\n \t\t\t document.formulariorecargas.tipo.options[i].value=mis_tipos[i];\n \t\t\t document.formulariorecargas.tipo.options[i].text=mis_tipos[i];\n \t\t }\n \t\t \n \t\t }else{\n \t\t\t //sino habia ningun tipo seleccionado,elimino las cosas del select\n \t\t\t document.formulariocompania.tipo.length = 1;\n \t\t\t //ponemos un guion en la unica opcion que he dejado\n \t\t\t document.formulariorecargas.tipo.options[0].value=\"seleccionar\";\n \t\t\t document.formulariorecargas.tipo.options[0].text=\"seleccionar\";\n \t\t\t \n \t\t }\n \t \n \t\n \t \n \t \n \t\t //hacer un reset de los tipos\n \t document.formulariorecargas.tipo.options[0].selected=true;\n\n }", "function _CarregaFeiticos() {\n for (var chave_classe in tabelas_feiticos) {\n gPersonagem.feiticos[chave_classe] = {\n atributo_chave: tabelas_feiticos[chave_classe].atributo_chave,\n conhecidos: {},\n slots: {},\n };\n for (var i = 0; i <= 9; ++i) {\n gPersonagem.feiticos[chave_classe].conhecidos[i] = [];\n gPersonagem.feiticos[chave_classe].slots[i] = {\n atributo_chave: tabelas_feiticos[chave_classe].atributo_chave,\n base: 0,\n bonus_atributo: 0,\n feiticos: [],\n feitico_dominio: null,\n };\n }\n }\n\n // Tabela invertida de feiticos.\n for (var classe in tabelas_lista_feiticos) {\n for (var nivel in tabelas_lista_feiticos[classe]) {\n for (var chave_feitico in tabelas_lista_feiticos[classe][nivel]) {\n var feitico = tabelas_lista_feiticos[classe][nivel][chave_feitico];\n tabelas_lista_feiticos_invertida[StringNormalizada(feitico.nome)] = chave_feitico;\n tabelas_lista_feiticos_completa[chave_feitico] = feitico;\n }\n }\n }\n}", "function mostrarDatosProducto(producto){\n let transaccion = obtenerTransaccionInicial(producto.getCodigo());\n let datosProducto = [obtenerInputsIdsProducto(),producto.fieldsToArray()];\n let datosTransaccion = [obtenerInputsIdsTransaccion(),transaccion.fieldsToArray()];\n fillFields(datosProducto);\n fillFields(datosTransaccion);\n htmlValue('inputEditar', 'EDICION');\n htmlDisable('txtCodigo');\n htmlDisable('btnAgregarNuevo', false);\n}", "function verPacientesActivos() {\n borrarMarca();\n borrarMarcaCalendario();\n\n let contenedor = document.createElement(\"div\");\n contenedor.setAttribute('class', 'container-fluid');\n contenedor.setAttribute('id', 'prueba');\n let titulo = document.createElement(\"h1\");\n titulo.setAttribute('class', 'h3 mb-2 text-gray-800');\n let textoTitulo = document.createTextNode('PACIENTES ACTIVOS');\n let parrafoTitulo = document.createElement(\"p\");\n parrafoTitulo.setAttribute('class', 'mb-4');\n let textoParrafo = document.createTextNode('MODIFICA O ELIMINA LOS USUARIOS ACTIVOS');\n let capa1 = document.createElement(\"div\");\n capa1.setAttribute('class', 'card shadow mb-4');\n let capa2 = document.createElement(\"div\");\n capa2.setAttribute('class', 'card-header py-3');\n let tituloCapas = document.createElement(\"h6\");\n tituloCapas.setAttribute('class', 'm-0 font-weight-bold text-primary');\n let textoTituloCapas = document.createTextNode('Información de Usuarios');\n let cuerpo = document.createElement(\"div\");\n cuerpo.setAttribute('class', 'card-body');\n let tablaResponsiva = document.createElement(\"div\");\n tablaResponsiva.setAttribute('class', 'table-responsive');\n let tablas = document.createElement(\"table\");\n tablas.setAttribute('class', 'table table-bordered');\n tablas.setAttribute('id', 'dataTable');\n tablas.setAttribute('width', '100%');\n tablas.setAttribute('cellspacing', '0');\n\n let principal = document.getElementsByClassName(\"marca\");\n principal[0].appendChild(contenedor);\n contenedor.appendChild(titulo);\n titulo.appendChild(textoTitulo);\n contenedor.appendChild(parrafoTitulo);\n parrafoTitulo.appendChild(textoParrafo);\n contenedor.appendChild(capa1);\n capa1.appendChild(capa2);\n capa2.appendChild(tituloCapas);\n tituloCapas.appendChild(textoTituloCapas);\n capa1.appendChild(cuerpo);\n cuerpo.appendChild(tablaResponsiva);\n tablaResponsiva.appendChild(tablas);\n\n let httpRequest = new XMLHttpRequest();\n httpRequest.open('POST', '../consultas_ajax.php', true);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.onreadystatechange = function () {\n if (httpRequest.readyState === 4) {\n if (httpRequest.status === 200) {\n document.getElementById('dataTable').innerHTML = httpRequest.responseText;\n }\n }\n };\n httpRequest.send('activos=');\n}", "function Equipo(nombre, resultados) {\n this.nombre = nombre;\n this.resultados = resultados;\n this.media = 0;\n}", "toString() {\n //se aplica polimorfismo(multiples formas en tiempo de ejecucion)\n //el metodo que se ejecuta depende si es una referencia de tipo padre o de tipo hijo\n return this.nombreCompleto();\n }", "function mostrarFormulario(){\n var acum; \n //variable que permite saber que es un registrar\n encontrado=0; \n if(ventana==null) \n ventana = Ext.create ('App.miVentanaBanco')\n limpiar();\n ventana.show();\n }", "function AjPoFo() {\r\n \r\n if (perso.Por < 2) { //Test si assez d'argent\r\n alert(\"Vous n'avez pas assez d'argent\");\r\n console.log(\"Pas assez d'argent / nombre de potion = \"+ perso.Pinv[0]);\r\n } else {\r\n perso.Por -= 2; //Or du perso -2\r\n perso.Pinv[0] += 1; //Nombre de potion +1 \r\n document.getElementById('or').value = perso.Por; //affiche Or du perso dans la div caracteristique\r\n document.getElementById('nbPoFo').value = perso.Pinv[0]; //affiche le nombre de potion\r\n console.log(\"Achat d'une potion de force / nombre de potion = \"+ perso.Pinv[0]);\r\n }\r\n\r\n}", "function showProductReserva(product) {\n var hora = document.getElementById(product.hora).nextElementSibling;\n var lugar = document.getElementById(product.lugar).innerHTML;\n switch (lugar){\n case \"Padel 1\": \n lugar = 0;\n break;\n case \"Padel 2\": \n lugar = 1;\n break;\n case \"Padel 3\": \n lugar = 2;\n break;\n case \"Tenis 1\": \n lugar = 3;\n break;\n case \"Tenis 2\": \n lugar = 4;\n break;\n case \"Trinquete\": \n lugar = 5;\n break;\n default: \n lugar = 6;\n break;\n }\n var ocupado = hora;\n for(var i = 0; i < lugar; i++) {\n ocupado = ocupado.nextElementSibling;\n }\n ocupado.innerHTML = \"Ocupado\"\n ocupado.className = \"ocupado\"\n }", "function Coche(){\n this.marca = null;\n this.modelo = null;\n this.matricula = null;\n\n this.toString = function() {\n return this.marca + \", \"+ this.modelo + \", \" + this.matricula;\n }\n}", "function menu1_carte(id,no){\n\t\tc = jeu_me[no];\n\t\tif (c.etat == ETAT_JEU){\n\t\t\taction=prompt(\"A1,A2 pour attaquer | S pour sacrifier\");\n\t\t\tif (action!=null){\n\t\t\t\tc = jeu_me[no];\n\t\t\t\tnoAtt= action.substring(1);\n\t\t\t\t\t\t\n\t\t\t\tswitch(action){\n\t\t\t\t\tcase \"A1\":\n\t\t\t\t\tcase \"A2\":\n\t\t\t\t\t\tif (cim.length<c.cout){\n\t\t\t\t\t\t\talert(\">>pas assez de créatures ds le cimetière !!!\");\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tmy_logger(\"Je place carte:\"+ c.nom+ \" en \" +action);\n\t\t\t\t\t\t\t//récupére no ATT\n\t\t\t\t\t\t\tnoAtt= action.substring(1);\n\t\t\t\t\t\t\t//placer la carte en ATT\n\t\t\t\t\t\t\tmy_logger(\"contenu:\"+att_me[noAtt-1]);\n\t\t\t\t\t\t\tif (att_me[noAtt-1]== 0){\n\t\t\t\t\t\t\t\tjeu_effacerCarte(c);\n\t\t\t\t\t\t\t\tjeu_placerEnAttaque(true, no,c,noAtt);\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\talert(\">>Attaque déjà occupée !\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"S\":\n\t\t\t\t\t\tmy_logger(\"Je sacrifie la carte=>\"+c.nom);\n\t\t\t\t\t\tsacrifierUneCarte(no,c,true,true);\n\t\t\t\t\t\t\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "verificaDados(){\n this.verificaEndereco();\n if(!this.verificaVazio()) this.criaMensagem('Campo vazio detectado', true);\n if(!this.verificaIdade()) this.criaMensagem('Proibido cadastro de menores de idade', true);\n if(!this.verificaCpf()) this.criaMensagem('Cpf deve ser válido', true);\n if(!this.verificaUsuario()) this.criaMensagem('Nome de usuario deve respeitar regras acima', true);\n if(!this.verificaSenhas()) this.criaMensagem('Senha deve ter os critérios acima', true)\n else{\n this.criaMensagem();\n // this.formulario.submit();\n }\n }", "function mostrarPrimPantalla(){\n\n \t\t$('#cuadro-preguntas').addClass(\"hidden\");//ocultar\n\t\t$('#segunda-pantalla').removeClass(\"hidden\");//mostrar\n \t}" ]
[ "0.6447861", "0.63530546", "0.6286339", "0.6138603", "0.61293054", "0.6076284", "0.6044103", "0.6036169", "0.60360914", "0.6033844", "0.6032603", "0.6019213", "0.60176426", "0.6009436", "0.6006949", "0.59953874", "0.5994543", "0.59943336", "0.59932256", "0.598679", "0.5977851", "0.59777457", "0.5973072", "0.59370214", "0.5917181", "0.59064245", "0.5892252", "0.58864313", "0.58815837", "0.58809686", "0.5880504", "0.5878721", "0.5878279", "0.5874618", "0.5871352", "0.5856897", "0.5847362", "0.5847052", "0.5844249", "0.5834115", "0.58302546", "0.5828464", "0.58150357", "0.5812794", "0.58109176", "0.5806085", "0.58035", "0.5799682", "0.57973075", "0.57961214", "0.579217", "0.5789979", "0.57829946", "0.57754475", "0.57726353", "0.5772136", "0.5771966", "0.5768893", "0.5767172", "0.57669485", "0.57665455", "0.57622635", "0.5759445", "0.57553", "0.57540727", "0.5752087", "0.5744093", "0.57424843", "0.5736782", "0.57345253", "0.5729109", "0.5727198", "0.57245755", "0.5721799", "0.57095027", "0.57078356", "0.57028586", "0.57013184", "0.5695899", "0.5695827", "0.56829774", "0.568222", "0.5680302", "0.5673144", "0.56726724", "0.5672401", "0.5671517", "0.5665409", "0.56638074", "0.5661167", "0.56609076", "0.56606096", "0.5658561", "0.56575227", "0.56571126", "0.5656478", "0.56485033", "0.56399244", "0.56387305", "0.5632403", "0.5629275" ]
0.0
-1
contenerdor de que se usara para mostrar los datos de los departamentos
function DatDepart(id, nombre) { return '<!-- car de un departamento--->' + ' <div class="accordion" id="accordionExample">' + ' <div class="card">' + ' <div class="card-header row" id="headingOne">' + ' <h2 class="col-8">' + ' <button' + ' class="btn btn-link btn-block text-left"' + ' type="button" data-toggle="collapse"' + ' data-target="#collapseOne' + id + '"' + ' aria-expanded="true"' + ' aria-controls="collapseOne' + id + '">' + '🌎 ' + nombre + ' </button>' + ' </h2>' + ' <div class="col-4">' + ' <button type="button" onclick="deleDepart(' + id + ')" id="NewProdut"' + ' class="btn btn-outline-danger btn-block rounded-pill">Eliminar</button>' + ' </div>' + ' </div>' + ' <div id="collapseOne' + id + '" class="collapse show"' + ' aria-labelledby="headingOne"' + ' data-parent="#accordionExample">' + ' <div class="card-body">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col">' + ' <div' + ' class="input-group mb-3">' + ' <div' + ' class="input-group-prepend">' + ' <span' + ' class="input-group-text"' + ' id="basic-addon1">🌎</span>' + ' </div>' + ' <input type="text" id="TextDepart' + id + '" value="' + nombre + '"' + ' class="form-control"' + ' placeholder="Nombre del departamento"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <button type="button" onclick="ActuDepart(' + id + ')"' + ' id="NewProdut"' + ' class="btn btn-success btn-block">Agregar' + ' Departamento</button>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' <!------------------------------------>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function viewDepartments(){\n // Select all data from the departmenets table\n connection.query(`SELECT * FROM department_table`, (err, res) => {\n // If error log error\n if (err) throw err;\n // Display the data in a table format...\n console.table(res);\n // Run the task completed function\n taskComplete();\n })\n }", "async function obtenerDepartamentos() {\n try {\n let response = await axios.get(URL_departamentos)\n let data = response.data.items\n let result = []\n\n // Opcion por defecto\n result.push(<option value={0} key={0}>Seleccione una Opción</option>)\n \n for (let index in data) { \n result.push(<option value={data[index].codigo} key={data[index].codigo}>{data[index].nombre}</option>)\n }\n setDepartamentos(result)\n \n // Se obtiene el municipio por defecto a partir del departamento por defecto\n recalcularMunicipios()\n\n } catch (error) {\n console.log('Fallo obteniendo los departamentos / municipios' + error)\n } \n }", "function consultarDepartamentos(){ \n\tvar selector = $('#selectTerritorialDivision').val();\n\t$.post(\"gestionEspectro/php/consultasConsultasBD.php\", { consulta: 'departamentos', idConsulta: selector }, function(data){\n\t\t$(\"#departamentos\").html(data);\n\t\t$(\"#municipios\").html(\"\");\n\t\t$(\"#tipoAsignacion\").html(\"La asignación es a nivel departamental\");\n\n\t}); \n}", "function viewDepartmnt() {\n \n connection.query(\" SELECT * FROM department \", function (error, result) \n {\n if (error) throw error;\n console.table(result);\n mainMenu()\n\n });\n\n }", "function showDepartments() {\n //sql consult select\n connection.query(`SELECT * FROM department`, (err, res) => {\n if (err) throw err;\n \n if (res.length > 0) {\n console.log('\\n')\n console.log(' ** Departments **')\n console.log('\\n')\n console.table(res);\n }\n //calls the menu to display the question again\n menu();\n });\n }", "function viewDepartments() {\n connection.query(\"SELECT * FROM department\", function(error, results) {\n if (error) throw error;\n console.table(results);\n start();\n })\n}", "function getDepartamentosDropdown() {\n $http.post(\"Departamentos/getDepartamentosTotal\").then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.listaDepartamentos.data = r.data.d.data;\n \n }\n })\n }", "function loadDeparturesData() {\n\n //add a empty option\n // let departureOption = document.createElement('option');\n // departureOption.text = '';\n // document.querySelector('#slcDepartures').add(departureOption);\n\n for (let i = 0; i < airports.length; i++) {\n let departureOption = document.createElement('option');\n departureOption.text = airports[i].departure;\n document.querySelector('#slcDepartures').add(departureOption);\n }\n\n loadDestinationsData();\n}", "function viewAllDepartments() {\n db.query(\"SELECT * FROM department\", function (err, res) {\n if (err) throw err;\n console.log(\n \"---------------------------------------------------------------------------------------------------------------------------------------\"\n );\n console.table(res);\n console.log(\n \"---------------------------------------------------------------------------------------------------------------------------------------\"\n );\n start();\n });\n}", "function viewAllDepts() {\n connection.query(\"SELECT d.name AS Department FROM department d ORDER BY d.name;\", function (err, res) {\n if (err) throw err;\n let tableResults = [];\n for (var i = 0; i < res.length; i++) {\n var deptObj = [res[i].Department];\n tableResults.push(deptObj);\n }\n console.clear();\n console.log(\n \" ------------------------------------ \\n ALL COMPANY DEPARTMENTS AT THIS TIME \\n ------------------------------------\"\n );\n console.table([\"Department\"], tableResults);\n actions();\n });\n}", "function viewDepartments(){\n connection.query(`SELECT * FROM departments`, function (err, res){\n if (err) throw err\n console.table(res);\n startApp();\n })\n }", "function viewDepartments() {\n connection.query(\"SELECT name FROM department\", (err, results) => {\n if (err) throw err;\n console.log(\"\\n\");\n console.table(results);\n console.log(\"===============================\");\n console.log(\"\\n \\n \\n \\n \\n \\n \\n\");\n });\n // RETURN TO MAIN LIST\n runTracker();\n}", "function viewDepartments(){\n connection.query(queryList.deptList, function(err, res){\n if(err) throw err;\n console.table(res);\n startQ();\n })\n\n}", "function whichDepart() {\r\n\r\n let lcraDepartment = [\"Business Development\", \"Chief Administrative Officer\", \"Chief Commercial Officer\", \"Chief Financial Officer\", \"Chief of Staff\", \"Commercial Asset Management\", \"Communications\", \"Community Services\", \"Construction I\", \"Construction II\", \"Construction Support\", \"Controller\", \"Corporate Events\", \"Corporate Strategy\", \"Critical Infra Protection\", \"Critical Infrastructure Protection\", \"Customer Operations\", \"Cybersecurity\", \"Dam and Hydro\", \"Digital Services\", \"Enterprise Operations\", \"Environmental Affairs\", \"Environmental Field Services\", \"Environmental Lab\", \"Facilities Planning Management\", \"Finance\", \"Financial Planning & Strategy\", \"Fleet Services\", \"FPP Maintenance\", \"FPP Operations\", \"FPP Plant Support\", \"FRG Maintenance\", \"FRG Operations\", \"FRG Plant Support\", \"Fuels Accounting\", \"General Counsel\", \"General Manager\", \"Generation Environmental Group\", \"Generation Operations Mgmt\", \"Governmental & Regional Affairs\", \"Hilbig Gas Operations\", \"Human Resources\", \"Information Management\", \"Irrigation Operations\", \"Lands & Conservation\", \"Legal Services\", \"Line & Structural Engineering\", \"Line Operations\", \"LPPP Maintenance\", \"LPPP Operations\", \"LPPP Plant Support\", \"Materials Management\", \"Mid-Office Credit and Risk\", \"P&G Oper Reliability Group\", \"Parks\", \"Parks District - Coastal\", \"Parks District - East\", \"Parks District - West\", \"Plant Operations Engr. Group\", \"Plant Support Service\", \"Project Management\", \"Public Affairs\", \"QSE Operations\", \"Rail Fleet Operations\", \"Rangers\", \"Real Estate Services\", \"Regulatory & Market Compliance\", \"Regulatory Affairs\", \"Resilience\", \"River Operations\", \"Safety Services\", \"Sandy Creek Energy Station\", \"Security\", \"Service Quality & Planning\", \"SOCC Operations\", \"Strategic Initiatives & Transformation\", \"Strategic Sourcing\", \"Substation Engineering\", \"Substation Operations\", \"Supply Chain\", \"Survey GIS & Technical Svc\", \"System Control Services\", \"System Infrastructure\", \"Technical & Engineering Services\", \"Telecom Engineering\", \"Trans Contract Construction\", \"Trans Operational Intelligence\", \"Transmission Design & Protect\", \"Transmission Executive Mgmt\", \"Transmission Field Services\", \"Transmission Planning\", \"Transmission Protection\", \"Transmission Strategic Svcs\", \"Water\", \"Water Contracts & Conservation\", \"Water Engineering\", \"Water Quality\", \"Water Resource Management\", \"Water Surface Management\", \"Wholesale Markets & Sup\"];\r\n\r\n //let lcraDepart = document.getElementById(\"lcraDepart\");\r\n\r\n\r\n for(let i = 0; i < lcraDepartment.length; i++){\r\n let optn = lcraDepartment[i];\r\n let el = document.createElement(\"option\");\r\n el.value = optn;\r\n el.textContent = optn;\r\n lcraDepart.appendChild(el);\r\n }\r\n}", "function viewAllDepartments(conn, start) {\n conn.query(`SELECT * FROM department ORDER BY name;`, function(err, results) {\n if (err) throw err;\n console.table(results);\n start();\n });\n }", "function viewDepartments() {\n \n let query =\n \"SELECT department.id, department.dept_name FROM department\";\n return connection.query(query, function (err, res) {\n if (err) throw err;\n console.table(res);\n start();\n });\n}", "function viewAllDepartments() {\n connection.query(\n 'SELECT d_id AS id, name AS department_name FROM department ORDER BY d_id ASC;',\n function (err, results) {\n if (err) throw err;\n console.table(results);\n backMenu();\n }\n );\n}", "function viewDepartments() {\n connection.query(\"SELECT * FROM department\", function (err, res) {\n if (err) throw err;\n console.log(\"\\n\" + res.length + \" departments found!\\n\" + \"______________________________________\\n\");\n for (var i = 0; i < res.length; i++) {\n console.log(\n \"|| \" +\n res[i].id +\n \" ||\\t\" +\n res[i].title + \"\\n\" + \"______________________________________\\n\"\n );\n }\n start();\n });\n}", "function viewDepartments() {\n connection.query(\"SELECT * FROM department\", function(err, results) {\n if (err) throw err;\n // show results in table format\n console.table(results);\n // re-prompt the user for further actions by calling \"start\" function\n start();\n });\n}", "function viewDepartments() {\n db.query('SELECT * FROM department', function (err, results) {\n console.table(results);\n goPrompt();\n });\n}", "function viewDept() {\n db.selectAllDepartments()\n .then(([data]) => {\n console.log(`${separator}\\n DEPARTMENTS\\n${separator}`);\n console.table(data);\n console.log(`${separator}\\n`);\n })\n .then(() => {\n promptAction();\n })\n}", "function getDepartments() {\n Department.getAll()\n .then(function (departments) {\n $scope.departments = departments;\n })\n ['catch'](function (err) {\n Notification.error('Something went wrong with fetching the departments, please refresh the page.')\n });\n }", "function viewDepartment() {\n const query = `SELECT department FROM department`;\n \n connection.query(query, function(err, res) {\n if (err) throw err;\n console.table(res);\n \n start();\n });\n \n\n}", "function viewDepartments() {\n connection.query(\"SELECT * FROM department\", function (err, res){\n if (err) throw err; \n console.table(res); \n });\n // init.init()\n}", "function viewDepatments() {\n var query = \"SELECT * FROM DEPARTMENTS\";\n con.query(query, function(err, res) {\n if (err) throw err;\n for (var i = 0; i < res.length; i++) {\n console.log(\"\\n\" + \"|| Name: \" + res[i].name + \"|| ID: \" + res[i].id);\n }\n runManager();\n });\n }", "function viewDept() {\n connection.query(\"SELECT * FROM department\", function (err, res) {\n if (err) throw err;\n console.table(res);\n start();\n });\n}", "function viewDepartments() {\n connection.query(\"SELECT * FROM departments\", function (err, res) {\n if (err) throw err;\n for (var i = 0; i < res.length; i++) {\n console.log(res[i].id + \" | \" + res[i].name);\n }\n console.log(\"-----------------------------------\");\n start();\n })\n}", "function departmentTable() { }", "function viewAllEmployeesByDepart() {\n const query2 = `select department.id,department.name\n FROM employee INNER JOIN role ON (employee.role_id = role.id) INNER JOIN department ON (department.id = role.department_id) group by department.id,department.name;`;\n connection.query(query2, (err, res) => {\n if (err) throw err;\n const departmentChoices = res.map((data) => ({\n value: data.id, name: data.name,\n }));\n // console.table(res);\n // console.log(departmentChoices);\n promptDepartment(departmentChoices);\n });\n}", "function obtenerArbolDepartamentos(s, d, e) {\n if(s) {\n $('form[name=frmGestionPerfil] .arbolDepartamento').append(procesarArbolDep(d));\n $('form[name=frmGestionPerfil] .arbolDepartamento').genTreed(); // Añade clases y imagenes a la lista html para hacerla interactiva\n\n $('form[name=frmGestionPerfil] .arbolDepartamento.tree li').dblclick(function (e) {\n let me = $(this);\n $('form[name=frmGestionPerfil] .tree li').each(function () {\n $(this).removeClass('filaSeleccionada');\n });\n me.addClass('filaSeleccionada');\n\n Moduls.app.child.templateParamas.template.Forms.frmGestionPerfil.set({\n p_objtiv: me.attr('id')\n });\n\n $('form[name=frmGestionPerfil] [name=nomdep]').val(me.attr('name'));\n $('form[name=frmGestionPerfil] [name=nomdep]').change();\n $('form[name=frmGestionPerfil] .arbolDepartamento').addClass('dn');\n return false;\n });\n } else {\n validaErroresCbk(d, true);\n }\n}", "function viewAllDepts() {\n connection.query(\n 'SELECT * FROM Department', (err, res) => {\n if (err) {\n console.log(err);\n }\n console.table(res)\n startProgram();\n })\n}", "function viewDepartments(){\n connection.query(\"SELECT name FROM department\", function(err, result){\n if (err) {\n throw err \n } else {\n console.table(result);\n beginApp();\n }\n });\n}", "function displayAllDepartments() {\n let query = \"SELECT * FROM department \";\n connection.query(query, (err, res) => {\n if (err) throw err;\n\n console.log(\"\\n\\n ** Full Department list ** \\n\");\n console.table(res);\n });\n}", "async function viewDepartments () {\n \n try {\n const departments = await connection.getAllDepartments();\n console.table(departments);\n } catch(err) {\n console.log(err); \n }\n \n \n employeeChoices();\n \n }", "function viewAllDepartments() {\n connection.query(`SELECT department FROM employee_tracker_db.department;`,\n function(err, res) {\n if (err) throw err;\n console.log(\"\\n\");\n // Log all results of the SELECT statement\n console.table(res);\n //go back to inital\n initialQuestion();\n });\n}", "function viewDepartments() {\r\n connection.query(\"SELECT employee.first_name, employee.last_name, department.name AS Department FROM employee JOIN role ON employee.role_id = role.id JOIN department ON role.department_id = department.id ORDER BY employee.id;\", \r\n function(err, res) {\r\n if (err) throw err\r\n console.table(res)\r\n questions();\r\n })\r\n}", "function viewDepartments() {\n // var querycolumns = \"SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='employeeTracker_db' AND TABLE_NAME='edepartment'\";\n // connection.query(querycolumns, function(err, res) {\n // for (let i = 0; i < res.length; i++) {\n // console.log(\"Column \" + i + \" \" + JSON.stringify(res[i]));\n // }\n // });\n var query = \"Select id, name from edepartment\";\n connection.query(query, function(err, res) {\n\n departmentarray = [];\n\n for (let i = 0; i < res.length; i++) {\n console.log(\"department name = \" + res[i].name);\n departmentobj = { ID: res[i].id, department: res[i].name }\n departmentarray.push(departmentobj);\n }\n\n console.log(\"departmentarray = \", departmentarray);\n\n for (let i = 0; i < departmentarray.length; i++) {\n console.log(\"departmentarray[i] = \", departmentarray[i].department)\n }\n\n console.log(\"\");\n console.table(departmentarray);\n console.log(\"\");\n\n mainMenu();\n });\n}", "function viewAllDepts() {\n console.log(\"Showing all departments...\\n\");\n connection.query(\"SELECT * FROM department \", function (err, res) {\n if (err) throw err;\n console.table(res);\n connection.end();\n });\n}", "function getAvailableDepartments() {\n departmentService.getAllDepartments().then(function(departments) {\n $scope.departments = departments.data;\n })\n }", "function departamento(iddepartamento) {\n var tipoeleccion = $('#TIPOELECCION').val()\n var id =0;\n\n let dept;\n let municipios;\n let template ='';\n\n tipoeleccion=parseInt(tipoeleccion)\n id = parseInt(iddepartamento);\n\n console.log(tipoeleccion);\n console.log(id);\n //los casos especiales son 5, 12, 14, 19 que son los que tienen elecciones municipales\n switch (id) {\n case 0:\n dept = JSON.stringify(NACIONAL)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n case 1:\n dept = JSON.stringify(GUATEMALA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 2:\n dept = JSON.stringify(SACATEPEQUEZ)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 3:\n dept = JSON.stringify(CHIMALTENANGO)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n console.log(template);\n\n });\n break;\n\n case 4:\n dept = JSON.stringify(ELPROGRESO)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 5:\n if (tipoeleccion == 1) {\n dept = JSON.stringify(ESCUINTLA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n } else {\n parseado = JSON.stringify(mun5)\n response = JSON.parse(parseado)\n\n response.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n }\n break;\n\n case 6:\n dept = JSON.stringify(SANTAROSA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 7:\n dept = JSON.stringify(SOLOLA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 8:\n dept = JSON.stringify(TOTONICAPAN)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 9:\n dept = JSON.stringify(QUETZALTENANGO)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 10:\n dept = JSON.stringify(SUCHITEPEQUEZ)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 11:\n dept = JSON.stringify(RETALHULEU)\n municipios = JSON.parse(dept)\n\n par.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 12:\n if (tipoeleccion == 1) {\n dept = JSON.stringify(SANMARCOS)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n } else {\n parseado = JSON.stringify(mun12)\n response = JSON.parse(parseado)\n\n response.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n }\n\n break;\n case 13:\n dept = JSON.stringify(HUEHUETENANGO)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n case 14:\n if (tipoeleccion == 1) {\n dept = JSON.stringify(QUICHE)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n } else {\n parseado = JSON.stringify(mun14)\n response = JSON.parse(parseado)\n\n response.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n }\n break;\n\n case 15:\n dept = JSON.stringify(BAJAVERAPAZ)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 16:\n dept = JSON.stringify(ALTAVERAPAZ)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 17:\n dept = JSON.stringify(PETEN)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 18:\n dept = JSON.stringify(IZABAL)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 19:\n if (tipoeleccion == 1) {\n dept = JSON.stringify(ZACAPA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n } else {\n parseado = JSON.stringify(mun19)\n response = JSON.parse(parseado)\n\n response.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n }\n\n break;\n\n case 20:\n dept = JSON.stringify(CHIQUIMULA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 21:\n dept = JSON.stringify(JALAPA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 22:\n dept = JSON.stringify(JUTIAPA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 23:\n dept = JSON.stringify(USA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n }\n $('#MUN').html(template)\n\n }", "async function viewDepartments() {\n\tconst res = await queryAsync('SELECT * FROM department');\n\tconst allDepartments = [];\n\tconsole.log(' ');\n for (let i of res) {\n\t allDepartments.push({ ID: i.id, NAME: i.name });\n }\n console.table(allDepartments);\n start();\n}", "function deptPartido(d) {\n return d.properties.PARTIDO;\n }", "function viewDepartmentsBudget() {\n // console.log(`Selecting all departments...\\n`);\n connection.query(`SELECT d.department_name ,sum(r.salary) FROM employees e LEFT JOIN roles r on e.role_id = r.id JOIN ` + `departments d on d.id=r.departmentId where d.department_name !='None' GROUP BY d.department_name `, (err, res) => {\n if (err) throw err;\n // console.log(res);\n console.table(res);\n\n askeQuestions();\n });\n}", "function viewAllDept() {\n console.log('viewAllDept');\n connection.query('SELECT * FROM department', (err, res) => {\n if (err) throw err;\n console.table(res);\n userSelect()\n })\n}", "function viewDepartment() {\n connection.query(\"SELECT * FROM employee_db.department\", function (error, data) {\n console.table(data)\n init()\n })\n}", "function viewDepartment() {\n const queryDepartment = \"SELECT * FROM department\";\n connection.query(queryDepartment, (err, res) => {\n if (err) throw err;\n console.table(res);\n whatToDo();\n });\n}", "function viewAllDepartments() {\n connection.query(\"SELECT * FROM department\", function (err, results) {\n if (err) throw err;\n console.log(\"----------------------------------------------------------------------\")\n console.table(results)\n userInput()\n });\n}", "function getDepartamentoEmpleados(id) {\n $http.post(\"Departamentos/getDepartamentoEmpleados\", { id: id }).then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.lista.data = r.data.d.getDepartamentoEmpleados;\n vm.lista.disp = [].concat(vm.lista.data);\n }\n })\n }", "viewAllDept() {\n\t\tconst query = `SELECT *\n\t FROM department;`;\n\t\treturn this.connection.query(query);\n\t}", "printDept() {\n // get department information\n dbFunctions.viewDepartments()\n // show results in console\n .then((results) => {\n console.table(results)\n startManagement()\n })\n }", "async function viewByDepart() {\n const depsArray = await getDepsInArray();\n // Prompts\n const { department }= await prompt({\n name: \"department\",\n message: \"What department would you like to chose?\",\n choices: depsArray.map((depsItem) => ({\n name: depsItem.name,\n value: depsItem.id,\n })),\n type: \"list\",\n });\n \n const query = `SELECT first_name, last_name, title, salary\n FROM employee \n INNER JOIN role ON employee.role_id = role.id \n INNER JOIN department ON role.department_id= department.id \n WHERE department.id = ?`;\n \n\n // Send request to database\n const data = await connection.query(query, [department]);\n console.table(data);\n \n }", "AGREGAR_DPTOS(state, departamentos) {\n state.departamentos = departamentos;\n }", "function viewDepts(){\n var query = connection.query(\"SELECT Department_ID, Department_Name FROM departments;\", function(err, res) {\n console.log(\"\");\n console.table(res);\n console.log(\"\");\n superAsk();\n });\n }", "function allDepartments() {\n connection.query(\"SELECT * FROM departments\", function (err, res) {\n if (err) throw err;\n console.table(\"Departments\", res);\n start();\n });\n}", "function viewAllDepartments() {\n connection.query(\"SELECT * FROM departments\",\n (error, results) => {\n console.table(results);\n mainMenu();\n });\n}", "function viewDepts() {\n let query = `SELECT id as ID, name as \"DEPARTMENT NAME\" FROM department;`;\n connection.query(query, (err, res) => {\n if (err) throw err;\n printTable(res);\n CMS();\n });\n}", "function departmentView() {\n let query = \"SELECT * FROM department\";\n connection.query(query, function(err, res) {\n if (err) throw err;\n console.table(res);\n // result is then shown in the console.table\n runMenu();\n });\n}", "function loadDeparturesWithCountrycode(countrycode) {\n vm.loading = true;\n datacontext.getDepartureTerminalsByCountryCode(countrycode).then(function(resp) {\n //console.log(resp);\n\n try {\n vm.departureTerminals = resp.Items;\n } catch (exception) {\n swal(\"please try again later!\");\n }\n\n\n\n // console.log(vm.departureTerminals[0]);\n vm.loading = false;\n }, function(err) {\n console.log(err);\n vm.loading = false;\n });\n }", "function getDepartments() {\n const query = \"SELECT * FROM department\";\n return queryDB(query);\n}", "function populateDepInfo() {\n const depCheck = document.querySelectorAll(\"#depTable tbody tr\"); //Get Department Table Rows\n let deps = getDeps();\n if (depCheck.length == 0) {\n for (let j = 0; j < deps.length; j++) {\n let depOb = new CRUD(\"depTable\", \"depSelect\", deps[j]); //Create Object for department\n depOb.addOption();\n depOb.addRow();\n }\n } else {\n removeExistingDep();\n populateDepInfo();\n }\n}", "function getDepartments(data) {\n if (data.jobs.job[0]) {\n return data.jobs.job[0].company.company_departments.department;\n }\n}", "function viewDepartments() {\n connection.query(\"SELECT * FROM department\", \n function(err, res) {\n if (err) throw err\n console.table(res)\n databaseQuestions()\n })\n}", "function viewDepartments() {\n\n\n // var query = \"SELECT top_albums.year, top_albums.album, top_albums.position, top5000.song, top5000.artist \";\n // query += \"FROM top_albums INNER JOIN top5000 ON (top_albums.artist = top5000.artist AND top_albums.year \";\n // query += \"= top5000.year) WHERE (top_albums.artist = ? AND top5000.artist = ?) ORDER BY top_albums.year \";\n\n\n connection.query(\"SELECT DepartmentID, Department, Overhead_Cost FROM departments\", function (err, res) {\n if (err) throw err;\n\n //Prints Table\n console.log(\"\\n\");\n console.table(res);\n console.log(\"\\n\");\n\n userSearch();\n });\n\n}", "viewDepartments() {\n return connection.query(`SELECT * from department`)\n }", "function getCurrentDepartments(){\n connection.query(`SELECT * FROM department_table`, (err, res) => {\n // If error log error\n if (err) throw err;\n // Set the current departments array equal to an array of department objects returned in the response\n currentDepartments = res;\n // Get the department names from the returned object and set them equal to a variable for use in inquirer choices\n currentDepartmentNames = currentDepartments.map(a=>a.department_name);\n // Get the latest roles information\n getCurrentRoles()\n })\n }", "function viewDepartments() {\n connection.query(\"SELECT * FROM department\", function (err, data) {\n if (err) throw err;\n console.log(`\\n`);\n console.table(data);\n userInput();\n })\n}", "function displayAlldept() {\n // let query = \"SELECT * FROM department\";\n connection.query(\"SELECT * FROM department\", (err, res) => {\n if (err) throw err;\n\n console.log(\"\\n\\n ** Full Department list ** \\n\");\n printTable(res);\n });\n}", "function viewAllDepartments() {\n const query = 'SELECT * FROM department';\n connection.query(query, function (err, res) {\n if (err) {\n console.log(err)\n }\n else {\n // do stuff with the results \n console.log(res)\n console.table(res);\n options();\n }\n })\n}", "function getDepartures(siteId) {\n\n const divMetros = document.getElementById('divMetros');\n const divBuses = document.getElementById('divBuses');\n const divTrains = document.getElementById('divTrains');\n\n const uriTrains = 'https://cors-anywhere.herokuapp.com/http://api.sl.se/api2/realtimedeparturesV4.json?key=81a6a09603e14d51a73276f98ba095bb&siteid= ' + siteId + '&timewindow=10';\n fetch(uriTrains)\n .then((resp) => resp.json())\n .then(function (data) {\n console.log(data)\n let metros = data.ResponseData.Metros;\n let buses = data.ResponseData.Buses;\n let trains = data.ResponseData.Trains;\n\n // Prints Metro information if available\n clearDiv('divMetros');\n if (metros.length > 0) {\n divMetros.style.display = \"inline-block\";\n divMetros.innerHTML += '<b>' + data.ResponseData.Metros[0].TransportMode + ' Station: ' + data.ResponseData.Metros[0].StopAreaName + '</b>';\n metros.map(function (departure) {\n let divtag = document.createElement('div');\n divtag.innerHTML = `${departure.LineNumber + \" \" + departure.Destination + \" \" + departure.DisplayTime}`;\n divMetros.appendChild(divtag);\n })\n }\n else {\n divMetros.style.display = \"none\";\n }\n\n // Prints Bus information if available\n clearDiv('divBuses');\n if (buses.length > 0) {\n divBuses.style.display = \"inline-block\";\n divBuses.innerHTML += '<b>' + data.ResponseData.Buses[0].TransportMode +' Station: ' + data.ResponseData.Buses[0].StopAreaName + '</b>';\n buses.map(function (departure) {\n let divtag = document.createElement('div');\n divtag.innerHTML = `${departure.LineNumber + \" \" + departure.Destination + \" \" + departure.DisplayTime}`;\n divBuses.appendChild(divtag);\n })\n }\n else {\n divBuses.style.display = \"none\";\n }\n\n // Prints Train information if available\n clearDiv('divTrains');\n if (trains.length > 0) {\n divTrains.style.display = \"inline-block\"\n divTrains.innerHTML += '<b>' + data.ResponseData.Trains[0].TransportMode +' Station: ' + data.ResponseData.Trains[0].StopAreaName + '</b>';\n trains.map(function (departure) {\n let divtag = document.createElement('div');\n divtag.innerHTML = `${departure.LineNumber + \" \" + departure.Destination + \" \" + departure.DisplayTime}`;\n divTrains.appendChild(divtag);\n })\n }\n else {\n divTrains.style.display = \"none\";\n }\n\n })\n .catch(function (error) {\n console.log(error);\n });\n}", "function getDepartments() {\n\tsocket.emit('departmentRequest',\"\");\n}", "function viewAllDepartmentsBudgets(conn, start) {\n conn.query(`SELECT\td.name Department, \n LPAD(CONCAT('$ ', FORMAT(SUM(r.salary), 0)), 12, ' ') Salary, \n COUNT(e.id) \"Emp Count\"\n FROM\temployee e \n LEFT JOIN role r on r.id = e.role_id\n LEFT JOIN department d on d.id = r.department_id\n WHERE\te.active = true\n GROUP BY d.name\n ORDER BY Salary desc;`, function(err, results) {\n if (err) throw err;\n console.table(results);\n start();\n });\n }", "function IncetDat(id) {\n var auxc = new ApiCiudad(\"\", \"\", \"\");\n var id_conte_lis = \"#LCiuDist\" + id;\n var id_conte_depart = \"#LDepDist\" + id;\n $(id_conte_lis).html(\" \"); // limpia la casilla para que se pueda ver \n var id_depart = $(id_conte_depart).val();\n var dat = {\n llave: id_conte_lis,\n idCiu: 0,\n iddist: id_depart\n };\n auxc.idDepart = id_depart;\n auxc.List(dat);\n}", "function getResponseData() {\n\tconnection.query('SELECT * FROM departments', function(err, res) {\n\t\tif (err) throw err;\n\t\texecutiveInputs(res);\n\t})\n}", "function viewDept() {\n connection.query(\n `\n SELECT \n department.name AS 'Department'\n FROM department\n `\n , function (error, res) {\n console.table(res);\n mainMenu();\n }\n );\n}", "function showDatosFacturacion() {\n fillSelect();\n showInfoClient();\n}", "function getallDeptByOfficeData(ofcid) {\n\t\t\t\n\t\t\t\tif(ofcid==\"\")\n\t\t\t\t{\t\t\t\t\n\t\t\t\t$('#deptlstSendTo').empty();\n\t\t\t\t $(\"#deptlstSendTo_div\").hide();\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tshowAjaxLoader();\n\t\t\t\t$.ajax({\n\t\t\t\t\t\turl : 'checkofficetype.htm',\n\t\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t\tdata : {\n\t\t\t\t\t\t\tofcid : ofcid,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess : function(response) \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t/*var html=\"<option value=''>---Select---</option>\"*/\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(response!=\"\")\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$.each(response, function(index, value) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif(value.ofctype==\"HO\")\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$(\"#deptlstSendTo_div\").show();\n\t\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\t $(\"#deptlstSendTo_div\").hide();\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t getallEmpBySendTo(\"DO\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t });\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\thideAjaxLoader();\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t},\n\t\t\t\t\t\terror:function(error)\n\t\t\t\t\t {\n\t\t\t\t\t \t\thideAjaxLoader();\n\t\t\t\t\t }\n\t\t\t\t});\n\t\t\t\n\t\t\t};\n\t\t\t}", "getDepartments() {\n return this.departments;\n }", "function mostrarCargoDepartamento(id){\n\n $.get('CargosDepartamentosMostrar/'+id, function (data) { \n $(\"#tabla_DepartamentoCargo\").html(\"\");\n $.each(data, function(i, item) { //recorre el data \n cargartablaCargoDepartamento(item); // carga los datos en la tabla\n }); \n });\n \n}", "function getDepartments(school){\n\n\t$.getJSON(\"/api/departments/\" + school, function (data) {\n\t\tvar depts =[];\n\t\tdepts = data.departments;\n\t\tvar deptDropdown = [];\n\n\t\tfor (var i = 0; i < depts.length; i++){\n\t\t\tdeptDropdown.push('<option>' + depts[i] + '</option>');\n\t\t}\n\n\t\t$( \"<select/>\", {\n\t\t\t\"class\": \"deptSelector\",\n\t\t\t\"id\": \"dept\",\n\t\t\t\"style\": \"display:inline\",\n\t\t\t\"name\": \"department\",\n\t\t\thtml: deptDropdown.join( \"\" )\n\t\t }).appendTo( \"body\" );\n\n\n\t});\n}", "async function viewDepartments() {\n const departmentList = await db.obtainAllDepartments();\n\n console.log(`\\nTASK: VIEW ALL DEPARMENTS\\n`);\n console.table(departmentList);\n\n displayMenus();\n}", "function consultarMunicipios(){ \n\tvar selector = $('#selectDepartaments').val();\n\t$.post(\"gestionEspectro/php/consultasConsultasBD.php\", { consulta: 'municipios', idConsulta: selector }, function(data){\n\t\t$(\"#municipios\").html(data);\n\t\t$(\"#tipoAsignacion\").html(\"La asignación es a nivel municipal\");\n\t}); \n}", "departamento() {\n return super.informacion('departamento');\n }", "function viewDept() {\n connection.query(\n \"SELECT deptid as DeptId, name as Department, CONCAT(e.first_name, ' ', e.last_name) as Employee, title as Title, salary as Salary, CONCAT(m.first_name, ' ', m.last_name) as Manager FROM department LEFT JOIN roles ON department.deptid = roles.department_id LEFT JOIN employee e ON roles.roleid = e.role_id LEFT JOIN employee m ON m.empid = e.manager_id ORDER BY deptid\",\n function (err, res) {\n if (err) throw err;\n console.table(res)\n reroute();\n })\n}", "function tableDeparture(data) {\r\n //when data.modified returns false the user has not yet selected\r\n //a station to call the information from.\r\n if(data.modified == false)\r\n return alert(\"Välj station\");\r\n\r\n tableDelete();\r\n //creates table element\r\n var tbl = document.createElement('table');\r\n tbl.style.width = '100%';\r\n tbl.id = \"tagtabell\";\r\n //creates table body\r\n var tbdy = document.createElement('tbody');\r\n\r\n var list = [\"Avgång\", \"Tågnummer\", \"Spår\", \"Till\", \"NyTid\" ,\"Kommentar\"];\r\n\r\n //global table row variable\r\n var tr = document.createElement('tr');\r\n\r\n //foreach loop for appending list objects into the th element\r\n list.forEach(function(item) {\r\n var th = document.createElement('th');\r\n th.appendChild(document.createTextNode(item));\r\n tr.appendChild(th);\r\n tr.appendChild(th);\r\n });\r\n //close tablerow\r\n tbdy.appendChild(tr);\r\n\r\n //Makes use of loops to show data\r\n //loops foreach in the array transfer with the variable transfer\r\n for (var transfer of data.station.transfers.transfer) {\r\n var tr = document.createElement('tr');\r\n var td = document.createElement('td');\r\n\r\n //creates an element of td and attatches the information from transfer.departure to the created element\r\n //td appends the data from the transfer variable declared in the for loop\r\n //when creating another element of td it closes the last created element of td.\r\n td = document.createElement('td');\r\n td.appendChild(document.createTextNode(transfer.departure));\r\n tr.appendChild(td);\r\n tbdy.appendChild(tr);\r\n\r\n td = document.createElement('td');\r\n td.appendChild(document.createTextNode(transfer.train));\r\n tr.appendChild(td);\r\n tbdy.appendChild(tr);\r\n\r\n td = document.createElement('td');\r\n td.appendChild(document.createTextNode(transfer.track));\r\n tr.appendChild(td);\r\n tbdy.appendChild(tr);\r\n\r\n td = document.createElement('td');\r\n td.appendChild(document.createTextNode(transfer.destination));\r\n tr.appendChild(td);\r\n tbdy.appendChild(tr);\r\n\r\n //if statements for null exception\r\n if(transfer.newDeparture != null){\r\n td = document.createElement('td');\r\n td.appendChild(document.createTextNode(transfer.newDeparture));\r\n tr.appendChild(td);\r\n tbdy.appendChild(tr);\r\n } else {\r\n td = document.createElement('td');\r\n td.appendChild(document.createTextNode(\" \"));\r\n tr.appendChild(td);\r\n tbdy.appendChild(tr);\r\n }\r\n //if statements for null exception\r\n if(transfer.comment != null){\r\n td = document.createElement('td');\r\n td.appendChild(document.createTextNode(transfer.comment));\r\n tr.appendChild(td);\r\n tbdy.appendChild(tr);\r\n } else {\r\n\r\n td = document.createElement('td');\r\n td.appendChild(document.createTextNode(\" \"));\r\n tr.appendChild(td);\r\n tbdy.appendChild(tr);\r\n }\r\n\r\n }\r\n //appends the tablebody into the table\r\n tbl.appendChild(tbdy);\r\n //appends the table into the div \"data\"\r\n document.getElementById('data').appendChild(tbl);\r\n}", "function displayDepartments() {\n var deptArr = [];\n connection.query(\"SELECT d.department_id, d.department_name, d.over_head_costs, SUM(p.sales) AS product_sales, (SUM(p.sales)-d.over_head_costs) AS total_profit FROM departments AS d INNER JOIN products AS p ON department_name = p.department GROUP BY department_id ORDER BY department_id ASC\", \n function (err, res) {\n if (err) throw err;\n for (var i = 0; i < res.length; i++) {\n var tempArry =\n {\n department_id: res[i].department_id,\n department_name: res[i].department_name,\n over_head_costs: res[i].over_head_costs,\n product_sales: res[i].product_sales,\n total_profit: res[i].total_profit\n }\n deptArr.push(tempArry);\n };\n console.table('\\nBamazon Departments', deptArr);\n console.log(\"-----------------------------------------------------\\n\");\n inquireForm();\n });\n}", "function employeesDepartment() {\n connection.query(\"SELECT * FROM employeeTracker_db.department\",\n function (err, res) {\n if (err) throw err\n console.table(res)\n runSearch()\n }\n )\n}", "function viewEmployees(){\n // Select all data from the departmenets table\n connection.query(`SELECT * FROM employee_table`, (err, res) => {\n // If error log error\n if (err) throw err;\n // Display the data in a table format...\n console.table(res);\n // Run the task completed function\n taskComplete();\n })\n }", "function viewEmployeeDepartment() {\n\n var query =\n `SELECT d.id AS department_id, d.name AS department, e.first_name, e.last_name, r.salary\n FROM employee e\n LEFT JOIN roles r\n ON e.roles_id = r.id\n LEFT JOIN department d\n ON d.id = r.department_id\n LEFT JOIN employee m\n ON m.id = e.manager_id\n ORDER BY d.id`\n\n\n connection.query(query, function (err, res) {\n if (err) throw err;\n\n console.table(res); \n init(); \n \n });\n}", "function deptList() {\n return connection.query(\"SELECT id, dept_name FROM departments\");\n}", "function setDepartmentData(departments, department_pages)\n{\n this.departments = departments;\n this.pages = department_pages;\n// updateDepartments();\n}", "function campos_fecha(tabla)\n{\n\tswitch(tabla)\n\t\t\t\t{\n\t\t\t\tcase \"facturacion\":\n\t\t\t\t\t{\n\t\t\t\t\t\tCalendar.setup({\n \t\t\tinputField : 'finicio', // id of the input field\n \t\t\tifFormat : '%d-%m-%Y', // format of the input field\n \t\t\tshowsTime : true, // will display a time selector\n \t\t\tbutton : 'f_trigger_finicio', // trigger for the calendar (button ID)\n \t\t\tsingleClick : false, // double-click mode\n \t\t\tstep : 1 // show all years in drop-down boxes (instead of every other year as default)\n\t\t\t\t\t})\n\t\t\t\t\t\tCalendar.setup({\n \t\t\tinputField : 'duracion', // id of the input field\n \t\t\tifFormat : '%d-%m-%Y', // format of the input field\n \t\t\tshowsTime : true, // will display a time selector\n \t\t\tbutton : 'f_trigger_duracion', // trigger for the calendar (button ID)\n \t\t\tsingleClick : false, // double-click mode\n \t\t\tstep : 1 // show all years in drop-down boxes (instead of every other year as default)\n\t\t\t\t\t})\n\t\t\t\t\t\tCalendar.setup({\n \t\t\tinputField : 'renovacion', // id of the input field\n \t\t\tifFormat : '%d-%m-%Y', // format of the input field\n \t\t\tshowsTime : true, // will display a time selector\n \t\t\tbutton : 'f_trigger_renovacion', // trigger for the calendar (button ID)\n \t\t\tsingleClick : false, // double-click mode\n \t\t\tstep : 1 // show all years in drop-down boxes (instead of every other year as default)\n\t\t\t\t\t})\n\t\t\t\t\t\n\t\t\t\t\t}break\n\t\t\t\t\tcase \"pcentral\":\n\t\t\t\t\t{\n\t\t\t\t\t\tCalendar.setup({\n \t\t\tinputField : 'cumple', // id of the input field\n \t\t\tifFormat : '%d-%m-%Y', // format of the input field\n \t\t\tshowsTime : true, // will display a time selector\n \t\t\tbutton : 'f_trigger_cumple', // trigger for the calendar (button ID)\n \t\t\tsingleClick : false, // double-click mode\n \t\t\tstep : 1 // show all years in drop-down boxes (instead of every other year as default)\n\t\t\t\t\t})\n\t\t\t\t\t}break\n\t\t\t\t\tcase \"pempresa\":\n\t\t\t\t\t{\n\t\t\t\t\t\tCalendar.setup({\n \t\t\tinputField : 'cumple', // id of the input field\n \t\t\tifFormat : '%d-%m-%Y', // format of the input field\n \t\t\tshowsTime : true, // will display a time selector\n \t\t\tbutton : 'f_trigger_cumple', // trigger for the calendar (button ID)\n \t\t\tsingleClick : false, // double-click mode\n \t\t\tstep : 1 // show all years in drop-down boxes (instead of every other year as default)\n\t\t\t\t\t})\n\t\t\t\t\t}break\n\t\t\t\t\tcase \"z_facturacion\":\n\t\t\t\t\t{\n\t\t\t\t\t\tCalendar.setup({\n \t\t\tinputField : 'finicio', // id of the input field\n \t\t\tifFormat : '%d-%m-%Y', // format of the input field\n \t\t\tshowsTime : true, // will display a time selector\n \t\t\tbutton : 'f_trigger_finicio', // trigger for the calendar (button ID)\n \t\t\tsingleClick : false, // double-click mode\n \t\t\tstep : 1 // show all years in drop-down boxes (instead of every other year as default)\n\t\t\t\t\t})\n\t\t\t\t\t\t\n\t\t\t\t\t\tCalendar.setup({\n \t\t\tinputField : 'renovacion', // id of the input field\n \t\t\tifFormat : '%d-%m-%Y', // format of the input field\n \t\t\tshowsTime : true, // will display a time selector\n \t\t\tbutton : 'f_trigger_renovacion', // trigger for the calendar (button ID)\n \t\t\tsingleClick : false, // double-click mode\n \t\t\tstep : 1 // show all years in drop-down boxes (instead of every other year as default)\n\t\t\t\t\t})\n\t\t\t\t\t}break\n\t\t\t\t\tcase \"empleados\":\n\t\t\t\t\t{\n\t\t\t\t\t\tCalendar.setup({\n \t\t\tinputField : 'fnac', // id of the input field\n \t\t\tifFormat : '%d-%m-%Y', // format of the input field\n \t\t\tshowsTime : true, // will display a time selector\n \t\t\tbutton : 'f_trigger_fnac', // trigger for the calendar (button ID)\n \t\t\tsingleClick : false, // double-click mode\n \t\t\tstep : 1 // show all years in drop-down boxes (instead of every other year as default)\n\t\t\t\t\t})\n\t\t\t\t\t\t\n\t\t\t\t\t\tCalendar.setup({\n \t\t\tinputField : 'fcon', // id of the input field\n \t\t\tifFormat : '%d-%m-%Y', // format of the input field\n \t\t\tshowsTime : true, // will display a time selector\n \t\t\tbutton : 'f_trigger_fcon', // trigger for the calendar (button ID)\n \t\t\tsingleClick : false, // double-click mode\n \t\t\tstep : 1 // show all years in drop-down boxes (instead of every other year as default)\n\t\t\t\t\t})\n\t\t\t\t\t}break\n case \"entradas_salidas\":\n\t\t\t\t\t{\n\t\t\t\t\t\tCalendar.setup({\n \t\t\tinputField : 'entrada', // id of the input field\n \t\t\tifFormat : '%d-%m-%Y', // format of the input field\n \t\t\tshowsTime : true, // will display a time selector\n \t\t\tbutton : 'f_trigger_entrada', // trigger for the calendar (button ID)\n \t\t\tsingleClick : false, // double-click mode\n \t\t\tstep : 1 // show all years in drop-down boxes (instead of every other year as default)\n\t\t\t\t\t})\n\n\t\t\t\t\t\tCalendar.setup({\n \t\t\tinputField : 'salida', // id of the input field\n \t\t\tifFormat : '%d-%m-%Y', // format of the input field\n \t\t\tshowsTime : true, // will display a time selector\n \t\t\tbutton : 'f_trigger_salida', // trigger for the calendar (button ID)\n \t\t\tsingleClick : false, // double-click mode\n \t\t\tstep : 1 // show all years in drop-down boxes (instead of every other year as default)\n\t\t\t\t\t})\n\t\t\t\t\t}break\n\t\t\t\t}\n\t\t\t\t//editor()\n}", "function paz(){\n\tDepartamento = new Array('<p>La Paz</p>');\n\tHistoria = new Array('<p class=\"text-justify\">La Paz es un departamento de El Salvador ubicado en la zona oriental del país. Limita al Norte con la república de Honduras; al Sur y al Oeste con el departamento de San Miguel, y al Sur y al Este con el departamento de La Unión. Su cabecera departamental es San Francisco. Morazán comprende un territorio de 1 447 km² y cuenta con una población de 181 285 habitantes.</p>');\n\t/*Declaracion de Variable Interna para recorrer el arreglo de Municipios,\n\tde la Misma manera para recorrer los elementos de otros arreglos*/\n\tvar Municipioss, Municipioss2, rios, lagos, volcanes, centertour, personaje;\n\tMunicipioss = \"\";\n\tMunicipios = new Array('<ol><span class=\"glyphicon glyphicon-home\"></span> La Union</ol>','<ol><span class=\"glyphicon glyphicon-home\"></span> Yucuaiquin</ol>', '<ol><span class=\"glyphicon glyphicon-home\"></span> Intipuca</ol>','<ol><span class=\"glyphicon glyphicon-home\"></span> El Carmen</ol>','<ol><span class=\"glyphicon glyphicon-home\"></span> Bolivar</ol>', '<ol><span class=\"glyphicon glyphicon-home\"></span> Santa Rosa de Lima</ol>', '<ol><span class=\"glyphicon glyphicon-home\"></span> Anamoros</ol>', '<ol><span class=\"glyphicon glyphicon-home\"></span> Concepcion de Oriente</ol>','<ol><span class=\"glyphicon glyphicon-home\"></span> Lislique </ol>');\n\tfor(i = 0; i < Municipios.length; i++){\n\t\tMunicipioss += Municipios[i];\n\t}\n\tMuniciipios2 = new Array('<ol><span class=\"glyphicon glyphicon-home\"></span> San Alejo</ol>','<ol><span class=\"glyphicon glyphicon-home\"></span> Conchagua</ol>', '<ol><span class=\"glyphicon glyphicon-home\"></span> San Jose</ol>','<ol><span class=\"glyphicon glyphicon-home\"></span> Yayantique</ol>','<ol><span class=\"glyphicon glyphicon-home\"></span> Meanguera del Golfo</ol>', '<ol><span class=\"glyphicon glyphicon-home\"></span> Pasaquina</ol>', '<ol><span class=\"glyphicon glyphicon-home\"></span> Nueva Esparta</ol>', '<ol><span class=\"glyphicon glyphicon-home\"></span> Poloros</ol>');\n\tfor(m = 0; m< Municiipios2.length; m++){\n\t\tMunicipioss2 += Municiipios2[m];\n\t}\n\tRios = new Array('<ol class=\"text-center\"><span class=\"glyphicon glyphicon-ok\"></span> PLaya El Jaguey</ol>', '<ol class=\"text-center\"><span class=\"glyphicon glyphicon-ok\"></span> Playa Blanca</ol>');\n\trios = \"\";\n\tfor(j = 0; j < Rios.length; j++){\n\t\trios += Rios[j];\n\t}\n\tVolcanes = new Array('<ol class=\"text-center\"><span class=\"glyphicon glyphicon-ok\"></span> Volcan Conchagua</ol>');\n\tPersonajes = new Array('<ol><span class=\"glyphicon glyphicon-ok\"></span> Antonio Grau Mora</ol>', '<ol><span class=\"glyphicon glyphicon-ok\"></span> Maria Cegarra Salcedo</ol>', '<ol><span class=\"glyphicon glyphicon-ok\"></span> Asensio Saez</ol>');\n\tpersonaje = \"\";\n\tfor(k = 0; k < Personajes.length; k++){\n\t\tpersonaje += Personajes[k];\n\t}\n\tCentroTour = new Array('<ol class=\"text-center\"><span class=\"glyphicon glyphicon-ok\"></span> Parque de la Familia</ol>', '<ol class=\"text-center\"><span class=\"glyphicon glyphicon-ok\"></span> Bosque Conchagua</ol>');\n\tcentertour = \"\";\n\tfor(c = 0; c < CentroTour.length; c++){\n\t\tcentertour += CentroTour[c];\n\t}\n\n\tdocument.getElementById(\"Departament\").innerHTML = Departamento[0];\n\tdocument.getElementById(\"History\").innerHTML = Historia[0];\n\tdocument.getElementById(\"Municipio\").innerHTML = Municipioss;\n\tdocument.getElementById(\"Municipio2\").innerHTML = Municipioss2;\n\tdocument.getElementById(\"centro\").innerHTML = centertour;\n\tdocument.getElementById(\"Persons\").innerHTML = personaje;\n\tdocument.getElementById(\"river\").innerHTML = rios;\n\tdocument.getElementById(\"volca\").innerHTML = Volcanes[0];\n}", "function getDepartments() {\n return $http.get(API.sailsUrl + '/departments')\n .then(function success(res) {\n if(res.data) {\n return res.data.data;\n } else {\n return $q.reject(res.data);\n }\n }).catch(function error(reason) {\n return $q.reject({\n error: 'Error with API request.',\n origErr: reason\n });\n });\n }", "function getDesempenho(){\n init(1200, 500,\"#infos2\");\n executa(dados_atuais, 0,10,4);\n showLegendasRepetencia(false);\n showLegendasDesempenho(true);\n showLegendasAgrupamento(false);\n}", "function viewDepartments() {\n connection.query(\"SELECT * FROM department\", function(err, res){\n console.table(res);\n startQuestions();\n })\n\n}", "function TraerEstadisticas(){\n var fechaInicio = $(\"#fechaInicio\").val();\n var fechaFinal = $(\"#fechaFinal\").val();\n var urlEstadisticas = 'http://localhost/ESTACIONAMIENTO_2017/APIREST/Estadisticas';\n \n if(fechaInicio != \"\" && fechaFinal != \"\"){\n urlEstadisticas += '/' + fechaInicio + '/'+ fechaFinal;\n }\n $.ajax({\n url: urlEstadisticas,\n method: 'GET',\n dataType: 'json',\n async: true\n }).done(function(result){\n $(\"#tablaEstadisticas\").DataTable({\n \"bDestroy\": true,\n \"order\": [[ 5, \"asc\"]],\n \"language\": {\n url:'dataTablesSpanish.json'\n },\n data: result[\"Usadas\"],\n columns: [\n { data: 'Piso'},\n { data: 'Numero'},\n { data: 'Patente'},\n { data: 'Marca'},\n { data: 'Color'},\n { data: 'Fecha_Ingreso'},\n { data: 'Fecha_Salida'},\n { data: 'Importe'}\n ]\n });\n \n var div = $(\"#estadisticasCocheras\");\n div.html(\"\");\n\n // Verifico que se haya usado alguna cochera\n if(!$.isEmptyObject(result[\"cocheraMasUsada\"])){\n div.append(\"<h2>Cochera mas usada</h2>\" + \"Numero \" + result[\"cocheraMasUsada\"][\"Numero\"] + \" piso \" + result[\"cocheraMasUsada\"][\"Piso\"]);\n }\n\n // Verifico que se haya usado alguna cochera\n if(!$.isEmptyObject(result[\"cocheraMenosUsada\"])){\n div.append(\"<h2>Cochera menos usada</h2>\" + \"Numero \" + result[\"cocheraMenosUsada\"][\"Numero\"] + \" piso \" + result[\"cocheraMenosUsada\"][\"Piso\"]);\n }\n\n // Verifico que haya cocheras sin usar\n if(result[\"cocherasSinUsar\"].length > 0){\n div.append(\"<h2>Cocheras no usadas</h2>\");\n var listado = '<ul class=\"list-group\">';\n result[\"cocherasSinUsar\"].forEach(function(element) {\n listado += '<li class=\"list-group-item\">';\n listado += element[\"Numero\"] + \" Piso \" + element[\"Piso\"];\n listado += '</li>';\n }, this);\n listado += '</ul>';\n div.append(listado);\n }\n $(\"#divResultado\").show();\n }).fail(function(result){\n $(\"#divContenido\").prepend('<div class=\"alert alert-danger alert-dismissable\"><a href=\"#\" class=\"close\" data-dismiss=\"alert\" aria-label=\"close\">&times;</a>Error al comunicarse con la API</div>');\n });\n \n \n}", "function viewEmpByDept() {\n const sql = `\n SELECT \n employee.id AS EmployeeID, \n CONCAT(employee.first_name, \" \", employee.last_name) AS EmployeeName, \n department.name AS Department \n FROM employee\n LEFT JOIN role \n ON employee.role_id = role.id \n LEFT JOIN department \n ON role.department_id = department.id\n ORDER BY employee.id;`\n db.query(sql, (err, response) => {\n if (err) {\n throw(err);\n return;\n }\n console.log(``);\n console.log(chalk.white.bold(`============================================================================================================`));\n console.log(` ` +chalk.white.bold(` Employee by Department `));\n console.log(chalk.white.bold(`============================================================================================================`));\n console.table(response);\n console.log(chalk.white.bold(`============================================================================================================`));\n });\n init();\n}", "viewEmployeesByDepartment() {\n console.log(`\n\n * Viewing All Employees by Department *\n `)\n connection.query(`SELECT employees.id, employees.first_name, employees.last_name, roles.title AS role, departments.name AS department FROM employees LEFT JOIN roles ON employees.role_id = roles.id LEFT JOIN departments ON roles.department_id = departments.id ORDER BY department DESC;`, function(err, res) {\n if (err) throw err;\n console.table(res);\n beginAgain();\n })\n }", "viewDepartments() {\n console.log(`\n\n * Viewing Departments *\n `)\n connection.query(`SELECT * FROM departments`, function(err, res) {\n if (err) throw err;\n console.table(res);\n beginAgain();\n })\n }", "function displayEmployeePageData(tablesInput) {\r\n // Set global variables\r\n\r\n departments = tablesInput['departments'];\r\n departments.forEach(function(department) {\r\n\r\n departmentLocation[department['id']] = department['location'];\r\n departmentLocationId[department['id']] = department['locationID'];\r\n\r\n if (department['managerFirstName'] == null || department['managerLastName'] == null) {\r\n departmentManager[department['id']] = \"No manager\";\r\n departmentManagerId[department['id']] = null;\r\n } else {\r\n departmentManager[department['id']] = department['managerFirstName'] + ' ' + department['managerLastName'];\r\n departmentManagerId[department['id']] = department['departmentManager'];\r\n }\r\n });\r\n // console.log(departmentLocation)\r\n locations = tablesInput['locations'];\r\n locations.forEach(function(location) {\r\n if (location['managerFirstName'] == null || location['managerLastName'] == null) {\r\n locationManager[location['id']] = \"No manager\";\r\n } else {\r\n locationManager[location['id']] = location['managerFirstName'] + ' ' + location['managerLastName'];\r\n }\r\n });\r\n // console.log(locations)\r\n\r\n statuses = tablesInput['status']\r\n\r\n employees = tablesInput['employees'];\r\n displayAllEmployees(employees)\r\n\r\n}", "function cmbdepartemen(typ,dep){\n var u= dir2;\n var d='aksi=cmb'+mnu2;\n ajax(u,d).done(function (dt) {\n var out='';\n if(dt.status!='sukses'){\n out+='<option value=\"\">'+dt.status+'</option>';\n }else{\n if(dt.departemen.length==0){\n out+='<option value=\"\">kosong</option>';\n }else{\n $.each(dt.departemen, function(id,item){\n out+='<option '+(dep==item.replid?' selected ':'')+' value=\"'+item.replid+'\">'+item.nama+'</option>';\n });\n }\n if(typ=='filter'){ // filter (search)\n $('#departemenS').html(out);\n cmbtahunajaran('filter','');\n }else{ // form (edit & add)\n $('#departemenDV').text(': '+dt.departemen[0].nama);\n }\n }\n });\n }" ]
[ "0.6860861", "0.6847966", "0.66786003", "0.6615127", "0.65699804", "0.6525777", "0.65161496", "0.6483957", "0.6481827", "0.64705336", "0.6459466", "0.6452986", "0.6435863", "0.643057", "0.6323305", "0.6319397", "0.6314972", "0.63025004", "0.62924814", "0.6255458", "0.624899", "0.62154186", "0.62040734", "0.62004274", "0.61944383", "0.61838377", "0.6183291", "0.61667085", "0.61612356", "0.6149863", "0.6138304", "0.61183906", "0.6115531", "0.6105891", "0.6099357", "0.60983986", "0.6086703", "0.608232", "0.6074659", "0.60592", "0.60590005", "0.6048835", "0.6011064", "0.60102785", "0.60033756", "0.60015744", "0.59958696", "0.59879357", "0.59811175", "0.59720093", "0.59636384", "0.5962696", "0.5933164", "0.5926398", "0.59262955", "0.5920433", "0.59141296", "0.59081507", "0.5894942", "0.5894042", "0.5889645", "0.5883312", "0.58704025", "0.58589655", "0.5851958", "0.58406967", "0.58387744", "0.5832675", "0.58276486", "0.582604", "0.5808351", "0.5806366", "0.5805", "0.58025616", "0.5801443", "0.578197", "0.577238", "0.5763889", "0.5748953", "0.5742171", "0.5737954", "0.57334596", "0.5732748", "0.572433", "0.57242733", "0.572243", "0.5701186", "0.56992406", "0.56908953", "0.56855315", "0.56794786", "0.56792754", "0.5671951", "0.5670601", "0.56703687", "0.5666419", "0.56596136", "0.56588835", "0.56296176", "0.56215554", "0.5620412" ]
0.0
-1
contenedor de quera unsa para mostrar los datos de los ciudades
function DatCiu(id, nombre) { return '<!-- car de un departamento--->' + ' <div class="accordion" id="accordionExample">' + ' <div class="card">' + ' <div class="card-header row" id="headingOne">' + ' <h2 class="col-8">' + ' <button' + ' class="btn btn-link btn-block text-left"' + ' type="button" data-toggle="collapse"' + ' data-target="#collapci' + id + '"' + ' aria-expanded="true"' + ' aria-controls="collapci' + id + '">' + '🗾 ' + nombre + ' </button>' + ' </h2>' + ' <div class="col-4">' + ' <button type="button" onclick="deleCiuda(' + id + ')" id="NewProdut"' + ' class="btn btn-outline-danger btn-block rounded-pill">Eliminar</button>' + ' </div>' + ' </div>' + ' <div id="collapci' + id + '" class="collapse show"' + ' aria-labelledby="headingOne"' + ' data-parent="#accordionExample">' + ' <div class="card-body">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col">' + ' <div' + ' class="input-group mb-3">' + ' <div' + ' class="input-group-prepend">' + ' <span' + ' class="input-group-text"' + ' id="basic-addon1">🌎</span>' + ' </div>' + ' <select' + ' class="custom-select"' + ' id="LDepInt' + id + '">' + ' <option' + ' selected>' + ' Deàrtamento' + ' </option>' + ' </select>' + ' </div>' + ' </div>' + ' <div class="col">' + ' <div' + ' class="input-group mb-3">' + ' <div' + ' class="input-group-prepend">' + ' <span' + ' class="input-group-text"' + ' id="basic-addon1">🗾</span>' + ' </div>' + ' <input type="text" id="textCiud' + id + '" value="' + nombre + '"' + ' class="form-control"' + ' placeholder="Nombre de la ciudad"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <button type="button" onclick="ActuCiuda(' + id + ')"' + ' id="NewProdut"' + ' class="btn btn-success btn-block">Agregar' + ' Ciudad</button>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' <!------------------------------------>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function accionBuscar ()\n {\n configurarPaginado (mipgndo,'DTOBuscarMatricesDTOActivas','ConectorBuscarMatricesDTOActivas',\n 'es.indra.sicc.cmn.negocio.auditoria.DTOSiccPaginacion', armarArray());\n }", "function cargarCgg_res_beneficiarioCtrls(){\n if(inInfoPersona.CRPER_CODIGO_AUSPICIANTE != undefined && inInfoPersona.CRPER_CODIGO_AUSPICIANTE.length>0){\n if(inInfoPersona.CRPJR_CODIGO.length>0)\n {\n txtCrper_codigo.setValue(inInfoPersona.CRPJR_RAZON_SOCIAL);\n tmpAuspiciantePJ = inInfoPersona.CRPJR_CODIGO;\n txtCrpjr_representante_legal.setValue(inInfoPersona.CRPER_NOMBRE_AUSPICIANTE);\n tmpAuspiciante= inInfoPersona.CRPER_CODIGO_AUSPICIANTE;\n rdgTipoAuspiciante.setValue('rdgTipoAuspiciante',TypeAuspiciante.JURIDICA);\n }\n else\n {\n txtCrper_codigo.setValue(inInfoPersona.CRPER_NOMBRE_AUSPICIANTE);\n tmpAuspiciante= inInfoPersona.CRPER_CODIGO_AUSPICIANTE;\n rdgTipoAuspiciante.setValue('rdgTipoAuspiciante',TypeAuspiciante.NATURAL);\n }\n }\n }", "function mostrarDatosCompra() {\n //Tomo los datos que pasé en la funcion navegar\n const unaCompra = this.data;\n if (unaCompra) {\n const idProd = unaCompra.idProducto;\n const productoComprado = obtenerProductoPorID(idProd);\n const subTotal = unaCompra.cantidad * productoComprado.precio;\n //Escribo el mensaje a mostrar\n const mensaje = `Producto <strong>${productoComprado.nombre}</strong>.\n <br> Cantidad comprada: <strong>${unaCompra.cantidad}</strong>.<br>\n Sub Total: <strong> $${subTotal}</strong>`;\n //Muestro el mensaje\n $(\"#pDetalleCompraMensaje\").html(mensaje);\n } else {\n ons.notification.alert(\"Ocurrió un error, por favor contacte al administrador\", { title: 'Oops!' });\n }\n}", "constructor()\n {\n this.unidad = 0\n this.subida1 = 0\n this.subida2 = 0\n this.subida3 = 0\n this.bajada1 = 0\n this.bajada2 = 0\n this.bajada3 = 0\n this.error = 0\n this.oContadorAjuste=new cContadorAjuste()\n }", "imprimirVehiculos() {\n\t\tthis.vehiculos.forEach(vehiculo => {\n\t\t\tif (vehiculo.puertas) {\n\t\t\t\tconsole.log(`Marca: ${vehiculo.marca} // Modelo: ${vehiculo.modelo} // Puertas: ${vehiculo.puertas} // Precio: $${this.formatearPrecio(vehiculo.precio)}`)\n\t\t\t}\n\t\t\tif (vehiculo.cilindrada) {\n\t\t\t\tconsole.log(`Marca: ${vehiculo.marca} // Modelo: ${vehiculo.modelo} // Cilindrada: ${vehiculo.cilindrada}cc // Precio: $${this.formatearPrecio(vehiculo.precio)}`)\n\t\t\t}\n\t\t});\n\t}", "function preencherResultados(data) {\n data = data[0];\n document.querySelector(\"#estado\").innerHTML = data.state;\n document.querySelector(\"#casos\").innerHTML = data.cases;\n document.querySelector(\"#obitos\").innerHTML = data.deaths;\n document.querySelector(\"#curados\").innerHTML = data.refuses;\n\n}", "initCedulas() {\n this.statisticsService.getCedulas().subscribe(response => {\n this.cedulas = response.cedulas;\n console.log(response.Message);\n });\n }", "function HistoriaClinica() { //-------------------------------------------Class HistoriaClinica()\n\n this.a = [];\n\n HistoriaClinica.prototype.cargarData = function (data) {\n this.a = data;\n this.a.Adjuntos = [];\n // // this.a.II;\n // this.a.II_BD = 0;//estado inicial, se puede ir al servidor a buscar la informacion.\n }\n\n} //-------------------------------------------Class HistoriaClinica()", "function detallesCabello(){\n\t //petición para obtener los detalles de cabello.\n\t $.ajax({\n\t url: routeDescrip+'/get_cabello/'+extraviado,\n\t type:\"GET\",\n\t dataType:\"json\",\n\n\t success:function(data) {\n\t \n\t $.each(data, function(key, value){ \n\t $(\"#pCabello\").empty();\n\n\t if(value.tenia == \"SÍ\"){\n\t $(\"#pCabello\").show();\n\t $(\"#pCabello\").append('<div class=\"card\">'+\n\t '<div class=\"card-header bg-white\">'+\n\t '<h5><b>Datos del cabello</b></h5>'+\n\t '</div>'+\n\t '<div class=\"card-body\">'+\n\t '<div class=\"row\" >'+\n\t '<div class=\"col-4\">'+\n\t '<label>Color:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.color+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Tamaño:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.tamano+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Tipo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.tipo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Particularidades:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.particularidades+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Modificaciones:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.modificaciones+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Observaciones:</label>'+\n\t '</div>'+\n\n\t '<div class=\"col\">'+\n\t '<p>'+value.observaciones+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>');\n\t }else{\n\t $(\"#pCabello\").hide();\n\t } \n\n\t \n\n\n\t });\n\n\t },\n\t \n\t });// fin de petición de talles de cabello\n\n\t //peticion para obtener detalles de barba\n\t $.ajax({\n\t url: routeDescrip+'/get_barba/'+extraviado,\n\t type:\"GET\",\n\t dataType:\"json\",\n\n\t success:function(data) {\n\t \n\t $.each(data, function(key, value){ \n\t pCabello \n\t $(\"#pBarba\").empty();\n\t if(value.tenia == \"SÍ\"){\n\t $(\"#pBarba\").show();\n\t $(\"#pBarba\").append('<div class=\"card\">'+\n\t '<div class=\"card-header bg-white\">'+\n\t '<h5><b>Datos de la barba</b></h5>'+\n\t '</div>'+\n\t '<div class=\"card-body\">'+\n\t '<div class=\"row\" >'+\n\t '<div class=\"col-4\">'+\n\t '<label>Color:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.color+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Tipo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.tipo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Estilo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.estilo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Observaciones:</label>'+\n\t '</div>'+\n\n\t '<div class=\"col\">'+\n\t '<p>'+value.observaciones+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>');\n\t }else{\n\t $(\"#pBarba\").hide();\n\t }\n\t \n\t });\n\t },\n\t });// fin de detalles de barba.\n\n\t //peticion para obtener detalles de bigote.\n\t $.ajax({\n\t url: routeDescrip+'/get_bigote/'+extraviado,\n\t type:\"GET\",\n\t dataType:\"json\",\n\n\t success:function(data) {\n\t \n\t $.each(data, function(key, value){ \n\t $(\"#pBigote\").empty();\n\n\t if(value.tenia == \"SÍ\"){\n\t $(\"#pBigote\").show();\n\t $(\"#pBigote\").append('<div class=\"card\">'+\n\t '<div class=\"card-header bg-white\">'+\n\t '<h5><b>Datos del bigote</b></h5>'+\n\t '</div>'+\n\t '<div class=\"card-body\">'+\n\t '<div class=\"row\" >'+\n\t '<div class=\"col-4\">'+\n\t '<label>Color:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.color+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Tipo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.tipo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Estilo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.estilo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Observaciones:</label>'+\n\t '</div>'+\n\n\t '<div class=\"col\">'+\n\t '<p>'+value.observaciones+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>');\n\n\t }else{\n\t $(\"#pBigote\").hide();\n\t }\n\t \n\t });\n\n\t },\n\t \n\t });// fin de detalles de bigote.\n\n\t //peticion para obtener detalles de patilla\n\t $.ajax({\n\t url: routeDescrip+'/get_patilla/'+extraviado,\n\t type:\"GET\",\n\t dataType:\"json\",\n\n\t success:function(data) {\n\t \n\t $.each(data, function(key, value){ \n\t $(\"#pPatilla\").empty();\n\n\t if(value.tenia == \"SÍ\"){\n\t $(\"#pPatilla\").show();\n\t $(\"#pPatilla\").append('<div class=\"card\">'+\n\t '<div class=\"card-header bg-white\">'+\n\t '<h5><b>Datos de las patillas</b></h5>'+\n\t '</div>'+\n\t '<div class=\"card-body\">'+\n\t '<div class=\"row\" >'+\n\t '<div class=\"col-4\">'+\n\t '<label>Color:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.color+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Tipo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.tipo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Estilo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.estilo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Observaciones:</label>'+\n\t '</div>'+\n\n\t '<div class=\"col\">'+\n\t '<p>'+value.observaciones+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>');\n\t }else{\n\t $(\"#pPatilla\").hide();\n\n\t }\n\t \n\t });\n\t }, \n\t });// fin de detalles de patilla\n\t}", "function cargarCgg_res_beneficiarioCtrls(){\n if(inRecordCgg_res_beneficiario!== null){\n if(inRecordCgg_res_beneficiario.get('CRPER_CODIGO'))\n {\n txtCrben_codigo.setValue(inRecordCgg_res_beneficiario.get('CRPER_CODIGO'));\n txtCrben_nombres.setValue(inRecordCgg_res_beneficiario.get('CRPER_NOMBRES'));\n txtCrben_apellido_paterno.setValue(inRecordCgg_res_beneficiario.get('CRPER_APELLIDO_PATERNO'));\n txtCrben_apellido_materno.setValue(inRecordCgg_res_beneficiario.get('CRPER_APELLIDO_MATERNO'))\n txtCrben_num_doc_identific.setValue(inRecordCgg_res_beneficiario.get('CRPER_NUM_DOC_IDENTIFIC'));\n cbxCrben_genero.setValue(inRecordCgg_res_beneficiario.get('CRPER_GENERO'));\n cbxCrdid_codigo.setValue(inRecordCgg_res_beneficiario.get('CRDID_CODIGO'));\n cbxCrecv_codigo.setValue(inRecordCgg_res_beneficiario.get('CRECV_CODIGO'));\n cbxCpais_nombre_nacimiento.setValue(inRecordCgg_res_beneficiario.get('CPAIS_CODIGO'));\n var tmpFecha = null;\n if(inRecordCgg_res_beneficiario.get('CRPER_FECHA_NACIMIENTO')== null || inRecordCgg_res_beneficiario.get('CRPER_FECHA_NACIMIENTO').trim().length ==0){\n tmpFecha = new Date();\n }else{\n tmpFecha = Date.parse(inRecordCgg_res_beneficiario.get('CRPER_FECHA_NACIMIENTO'));\n }\n dtCrper_fecha_nacimiento.setValue(tmpFecha);\n }\n if(inRecordCgg_res_beneficiario.get('CRPER_REQUISITOS_JSON')){\n gsCgg_res_solicitud_requisito.loadData(Ext.util.JSON.decode(inRecordCgg_res_beneficiario.get('CRPER_REQUISITOS_JSON')),true);\n }else{\n gsCgg_res_solicitud_requisito.reload({\n params:{\n inCrtra_codigo:null, \n inCrtst_codigo:INRECORD_TIPO_SOLICITUD.get('CRTST_CODIGO'),\n format:TypeFormat.JSON\n }\n });\n }\n }\n }", "function cargarCgg_res_oficial_seguimientoCtrls(){\n if(inRecordCgg_res_oficial_seguimiento){\n tmpUsuario = inRecordCgg_res_oficial_seguimiento.get('CUSU_CODIGO');\n txtCrosg_codigo.setValue(inRecordCgg_res_oficial_seguimiento.get('CROSG_CODIGO'));\n txtCusu_codigo.setValue(inRecordCgg_res_oficial_seguimiento.get('NOMBRES')+' '+inRecordCgg_res_oficial_seguimiento.get('APELLIDOS'));\n chkcCrosg_tipo_oficial.setValue(inRecordCgg_res_oficial_seguimiento.get('CROSG_TIPO_OFICIAL'));\n isEdit = true;\n habilitarCgg_res_oficial_seguimientoCtrls(true);\n }}", "function ciudades (){\nvar uniqueStorage = removeDuplicates(Storage, \"Ciudad\");\nvar atributos = Array();\n \n if( uniqueStorage.length > 0 ) {\n for( var aux in uniqueStorage )\n atributos.push(uniqueStorage[aux].Ciudad);\n }\n return atributos;\n}", "function tablaCoS(data){\n var tabuladoCoS = '<table class=\"striped tablaArmada\"><thead><tr>';\n var cabezera = false;\n console.log(data);\n for (var i = 0; i < data.Coberturas.length; i++) {\n\n //tomamos las cabezeras, años del primer dato\n if(!cabezera){\n tabuladoCoS += '<th> Entidad Federativa </th>';\n for (var j = 0; j < data.Coberturas[i].ValorDato.length; j++) {\n if(data.Coberturas[i].ValorDato[j].Leyenda_ser == '' || data.Coberturas[i].ValorDato[j].Leyenda_ser == null){\n tabuladoCoS += '<th>' + data.Coberturas[i].ValorDato[j].AADato_ser + '</th>';\n }else{\n tabuladoCoS += '<th>' + data.Coberturas[i].ValorDato[j].Leyenda_ser + '</th>';\n }\n\n }//fin for j\n cabezera = true;\n }\n\n tabuladoCoS += '</tr></thead><tr><td>' + '<span style=\"display:none;\">'+data.Coberturas[i].ClaveCobGeo_cg+ '</span>' + data.Coberturas[i].Descrip_cg +'</td>';\n for (var j = 0; j < data.Coberturas[i].ValorDato.length; j++) {\n if(data.Coberturas[i].ValorDato[j].Dato_Formato == \"\"){\n tabuladoCoS += '<td style=\"text-align:right;\"> '+ data.Coberturas[i].ValorDato[j].NoDatos.Codigo_nd +' </td>';\n }else{\n tabuladoCoS += '<td style=\"text-align:right;\">' + data.Coberturas[i].ValorDato[j].Dato_Formato + '</td>';\n }\n }//fin for j\n tabuladoCoS += '</tr>';\n }//fin for i\n tabuladoCoS += '</table>';\n\n //$('#tabla').html(tabuladoCoS);\n return tabuladoCoS;\n}//fin funcion", "function contaregistrosbanco() {\n\t\t\tdb.transaction(function(tx) {\n\t\t\t\ttx.executeSql('CREATE TABLE IF NOT EXISTS checklist_gui (token text, codigo text, descricao text, secaopai text, tipo text, conforme text, obs text, latitude text, longitude text,datalimite text, entidade int, ordenacao text, codigooriginal text, atualizouservidor int, imagemanexa text)');\n\n\t\t\t\t\ttx.executeSql(\"select count(1) totalitens, sum(case when conforme is not null then 1 else 0 end) totalrespondidos, sum(case conforme when 'sim' then 1 else 0 end) totalconforme, sum(case conforme when 'nao' then 1 else 0 end) totalnaoconforme , sum(case conforme when 'nao se aplica' then 1 else 0 end) totalnaoseaplica, sum(case ifnull(atualizouservidor,0) when 0 then 1 else 0 end) totalparaatualizar, sum(case ifnull(atualizouservidor,0) when 0 then 1 else 0 end) totalparaatualizar, (select sum(case ifnull(atualizouservidor,0) when 0 then 1 else 0 end) from checklist_fotos where codigo = cg.codigo) totalfotosparaatualizar from checklist_gui cg where token=? and codigo like ? and tipo='item' \", [$scope.token, $scope.secaoPai.codigo + '.%'], function(tx, results) {\n\t\t\t\t\t\t\n\t\t\t\t\t$scope.totalitens = results.rows.item(0).totalitens;\n\t\t\t\t\t$scope.totalrespondidos = results.rows.item(0).totalrespondidos;\n\t\t\t\t\t$scope.totalconforme = results.rows.item(0).totalconforme;\n\t\t\t\t\t$scope.totalnaoconforme = results.rows.item(0).totalnaoconforme;\n\t\t\t\t\t$scope.totalnaoseaplica = results.rows.item(0).totalnaoseaplica;\n\t\t\t\t\t$scope.total_para_servidor = totalparaatualizar;\n\t\t\t\t\t$scope.total_fotos_para_servidor = totalfotosparaatualizar;\n\t\t\t\t\t$scope.$apply();\n\t\t\t\t},\n\t\t\t\tfunction(a,b) {\n\t\t\t\t\talert(b.message);\n\t\t\t\t}\n\t\t\t\t);\n\t\t\t});\n\t\t}", "function loadDataDonViTinh() {\n $scope.donViTinh = [];\n if (!tempDataService.tempData('donViTinh')) {\n donViTinhService.getAllData().then(function (successRes) {\n if (successRes && successRes.status === 200 && successRes.data && successRes.data.Status && successRes.data.Data && successRes.data.Data.length > 0) {\n tempDataService.putTempData('donViTinh', successRes.data.Data);\n $scope.donViTinh = successRes.data.Data;\n }\n }, function (errorRes) {\n console.log('errorRes', errorRes);\n });\n } else {\n $scope.donViTinh = tempDataService.tempData('donViTinh');\n }\n }", "function loadDataDonViTinh() {\n $scope.donViTinh = [];\n if (!tempDataService.tempData('donViTinh')) {\n donViTinhService.getAllData().then(function (successRes) {\n if (successRes && successRes.status === 200 && successRes.data && successRes.data.Status && successRes.data.Data && successRes.data.Data.length > 0) {\n tempDataService.putTempData('donViTinh', successRes.data.Data);\n $scope.donViTinh = successRes.data.Data;\n }\n }, function (errorRes) {\n console.log('errorRes', errorRes);\n });\n } else {\n $scope.donViTinh = tempDataService.tempData('donViTinh');\n }\n }", "function loadDataDonViTinh() {\n $scope.donViTinh = [];\n if (!tempDataService.tempData('donViTinh')) {\n donViTinhService.getAllData().then(function (successRes) {\n if (successRes && successRes.status === 200 && successRes.data && successRes.data.Status && successRes.data.Data && successRes.data.Data.length > 0) {\n tempDataService.putTempData('donViTinh', successRes.data.Data);\n $scope.donViTinh = successRes.data.Data;\n }\n }, function (errorRes) {\n console.log('errorRes', errorRes);\n });\n } else {\n $scope.donViTinh = tempDataService.tempData('donViTinh');\n }\n }", "function mostrarEstAlumnosParaDocente(){\r\n let contadorEjXNivel = 0;//variable para contar cuantos ejercicios planteo el docente para el nivel del alumno\r\n let contadorEntXNivel = 0;//variable para contar cuantos ejercicios de su nivel entrego el alumno\r\n let alumnoSeleccionado = document.querySelector(\"#selEstAlumnos\").value;\r\n let posicionUsuario = alumnoSeleccionado.charAt(1);\r\n let usuario = usuarios[posicionUsuario];\r\n let nivelAlumno = usuario.nivel;\r\n for (let i = 0; i < ejercicios.length; i++){\r\n const element = ejercicios[i].Docente.nombreUsuario;\r\n if(element === usuarioLoggeado){\r\n if(ejercicios[i].nivel === nivelAlumno){\r\n contadorEjXNivel ++;\r\n }\r\n }\r\n }\r\n for (let i = 0; i < entregas.length; i++) {\r\n const element = entregas[i].Alumno.nombreUsuario;\r\n if(element === usuario.nombreUsuario){\r\n if(entregas[i].Ejercicio.nivel === nivelAlumno){\r\n contadorEntXNivel++;\r\n }\r\n }\r\n }\r\n document.querySelector(\"#pMostrarEstAlumnos\").innerHTML = `El alumno ${usuario.nombre} tiene ${contadorEjXNivel} ejercicios planteados para su nivel (${nivelAlumno}) sobre los cuales a realizado ${contadorEntXNivel} entrega/s. `;\r\n}", "function fnc_child_cargar_valores_iniciales() {\n\tf_create_html_table(\n\t\t\t\t\t\t'grid_lista',\n\t\t\t\t\t\t'',\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t'data-row_data',\n\t\t\t\t\t\t'', false, false, false\n\t\t\t\t\t\t);\n\tf_load_select_ajax(fc_frm_cb, 'aac', 'ccod_aac', 'cdsc_aac', '/home/lq_usp_ga_aac_ct_list?ic_ccod_emp=' + gc_ccod_emp + '&ic_cest=' + '1' + '&ic_load_BD=', false, '');\n}", "function TraerEstadisticas(){\n var fechaInicio = $(\"#fechaInicio\").val();\n var fechaFinal = $(\"#fechaFinal\").val();\n var urlEstadisticas = 'http://localhost/ESTACIONAMIENTO_2017/APIREST/Estadisticas';\n \n if(fechaInicio != \"\" && fechaFinal != \"\"){\n urlEstadisticas += '/' + fechaInicio + '/'+ fechaFinal;\n }\n $.ajax({\n url: urlEstadisticas,\n method: 'GET',\n dataType: 'json',\n async: true\n }).done(function(result){\n $(\"#tablaEstadisticas\").DataTable({\n \"bDestroy\": true,\n \"order\": [[ 5, \"asc\"]],\n \"language\": {\n url:'dataTablesSpanish.json'\n },\n data: result[\"Usadas\"],\n columns: [\n { data: 'Piso'},\n { data: 'Numero'},\n { data: 'Patente'},\n { data: 'Marca'},\n { data: 'Color'},\n { data: 'Fecha_Ingreso'},\n { data: 'Fecha_Salida'},\n { data: 'Importe'}\n ]\n });\n \n var div = $(\"#estadisticasCocheras\");\n div.html(\"\");\n\n // Verifico que se haya usado alguna cochera\n if(!$.isEmptyObject(result[\"cocheraMasUsada\"])){\n div.append(\"<h2>Cochera mas usada</h2>\" + \"Numero \" + result[\"cocheraMasUsada\"][\"Numero\"] + \" piso \" + result[\"cocheraMasUsada\"][\"Piso\"]);\n }\n\n // Verifico que se haya usado alguna cochera\n if(!$.isEmptyObject(result[\"cocheraMenosUsada\"])){\n div.append(\"<h2>Cochera menos usada</h2>\" + \"Numero \" + result[\"cocheraMenosUsada\"][\"Numero\"] + \" piso \" + result[\"cocheraMenosUsada\"][\"Piso\"]);\n }\n\n // Verifico que haya cocheras sin usar\n if(result[\"cocherasSinUsar\"].length > 0){\n div.append(\"<h2>Cocheras no usadas</h2>\");\n var listado = '<ul class=\"list-group\">';\n result[\"cocherasSinUsar\"].forEach(function(element) {\n listado += '<li class=\"list-group-item\">';\n listado += element[\"Numero\"] + \" Piso \" + element[\"Piso\"];\n listado += '</li>';\n }, this);\n listado += '</ul>';\n div.append(listado);\n }\n $(\"#divResultado\").show();\n }).fail(function(result){\n $(\"#divContenido\").prepend('<div class=\"alert alert-danger alert-dismissable\"><a href=\"#\" class=\"close\" data-dismiss=\"alert\" aria-label=\"close\">&times;</a>Error al comunicarse con la API</div>');\n });\n \n \n}", "function obtener_datos_por_establecimiento() {\n var lista = conexion_resultados();\n //var promedios = conexion_resultados_promedio_por_fecha();\n var contenido = \"\";\n var fecha = \"\";\n\n //removemos los datos previos de la tabla\n\n //checamos si la tabla tiene datos\n if (lista.length > 0) {\n $(\".celda_tabla_res\").remove();\n $.each(lista, function (index, item) {\n\n //obtenemos el nombre de usuario por medio de una consulta\n //var nombre_cuest = nombres_cuestionarios_por_folio(item.zona);\n var cuestionario = resultados_cuestionario_por_dia(item.fecha, item.id_cuestionario);\n\n if (index == 0) {\n fecha = item.fecha;\n // console.log(fecha + \">\");\n //creamos el contenido\n contenido = \" <tr class='celda_tabla_res fecha'> <td id='indice'colspan='6' > \" + nombre_fecha(fecha) + \"<td></tr><tr class='celda_tabla_res'> <th>#</th><th>CUESTIONARIO</th> <th>LIMPIEZA %</th> <th>SURTIDO % </th> <th>IMAGEN %</th> <th>APLICADOR</th> </tr>\"\n // $(\"#tabla_res\").append(contenido);\n }//fin if\n if (fecha == item.fecha) {\n\n //creamos el contenido\n contenido += \" <tr class='celda_tabla_res dato' onclick='llenar_modal_cuestionarios(\\\"\" + item.fecha + \"\\\",\" + item.id_cuestionario + \")'> <td id='indice'>\" + item.id_cuestionario + \"</td><td class='nombre' >\" + cuestionario.cuestionario + \"</td> <td id='zona_lim' >\" + cuestionario.limpieza + \"</td> <td id='zona_surt' >\" + cuestionario.surtido + \"</td> <td id='zona_imag' >\" + cuestionario.imagen + \"</td> <td id='zona_aplicador'>\" + item.aplicador + \"</td> </tr>\";\n //$(\"#tabla_res\").append(contenido);\n //llenamos los datos de pie\n }//fin if\n else if (fecha != item.fecha) {\n\n //$(\"#tabla_res\").append(contenido);\n\n var promedio = conexion_resultados_promedio_por_fecha(fecha);\n\n // console.log(promedios[contador_fecha].fecha + \":\" + promedios[contador_fecha].aspecto+\":\"+promedios[contador_fecha].aspecto);\n fecha = item.fecha;\n //creamos el contenido\n contenido += \" <tr class='celda_tabla_res'><th colspan='2'>Total:</th> <th>\" + promedio.limpieza + \"</th> <th>\" + promedio.surtido + \"</th> <th>\" + promedio.imagen + \"</th><th>\" + promedio.total + \"</th> </tr><tr class='celda_tabla_res fecha'> <td id='indice'colspan='6' > \" + nombre_fecha(fecha) + \"<td> <tr class='celda_tabla_res'> <th>#</th><th>CUESTIONARIO</th> <th>LIMPIEZA %</th> <th>SURTIDO %</th> <th>IMAGEN %</th> <th>APLICADOR</th> </tr> </tr><tr class='celda_tabla_res dato' onclick='llenar_modal_cuestionarios(\\\"\" + item.fecha + \"\\\",\" + item.id_cuestionario + \")' > <td id='indice'>\" + item.id_cuestionario + \"</td><td class='nombre' >\" + cuestionario.cuestionario + \"</td> <td id='zona_lim' >\" + cuestionario.limpieza + \"</td> <td id='zona_surt' >\" + cuestionario.surtido + \"</td> <td id='zona_imag' >\" + cuestionario.imagen + \"</td> <td id='zona_aplicador'>\" + item.aplicador + \"</td> <</tr>\"\n // $(\"#tabla_res\").append(contenido);\n \n }//fin if\n\n });\n var promedio = conexion_resultados_promedio_por_fecha(fecha);\n contenido += \" <tr class='celda_tabla_res'><th colspan='2'>Total:</th> <th>\" + promedio.limpieza + \"</th> <th>\" + promedio.surtido + \"</th> <th>\" + promedio.imagen + \"</th><th>\" + promedio.total + \"</th></tr>\"\n $(\"#tabla_res\").append(contenido);\n //ajustamos los decimales de total \n // total_limpieza = r(total_limpieza) ;\n //total_limpieza = Math.round(total_limpieza);\n //total_limpieza = total_limpieza / 100;\n var totales = conexion_resultados_ckl_total_por_fechas_establecimiento();\n //console.log(r(total_limpieza / contador) + \":\" + r(total_surtido / contador) + \":\" + r(total_imagen / contador));\n $(\"#total_limpieza\").val(totales.limpieza), $(\"#total_surtido\").val(totales.surtido), $(\"#total_imagen\").val(totales.imagen);\n var res = (total_limpieza + total_surtido + total_imagen);\n //console.log(res);\n $(\"#total_neto\").val(totales.total);\n\n }//fin\n //si no hay datos manda una advertencia\n else {\n alert(\"No Hay Datos...\");\n }\n\n}//fin", "async function obtenerTodasCIudades() {\n var queryString = '';\n\n\n queryString = queryString + ' SELECT cd.id, cd.nombre as ciudad, ps.nombre as pais';\n queryString = queryString + ' from ciudades cd join paises ps on (cd.pais_id=ps.id) ';\n\n \n\n let ciudad = await sequelize.query(queryString,\n { type: sequelize.QueryTypes.SELECT})\n return ciudad;\n }", "function mostrarSedesCarrera() {\n let carreraSelect = this.dataset.codigo;\n let carrera = buscarCarreraPorCodigo(carreraSelect);\n let listaCursos = getListaCursos();\n let listaCheckboxCursos = document.querySelectorAll('#tblCursos tbody input[type=checkbox]');\n let codigosCursos = [];\n\n for (let i = 0; i < carrera[7].length; i++) {\n codigosCursos.push(carrera[7][i]);\n }\n\n for (let j = 0; j < listaCursos.length; j++) {\n for (let k = 0; k < codigosCursos.length; k++) {\n if (listaCursos[j][0] == codigosCursos[k]) {\n listaCheckboxCursos[j].checked = true;\n }\n }\n }\n verificarCheckCarreras();\n}", "function impostaCausaliEntrata (list) {\n var opts = {\n aaData: list,\n oLanguage: {\n sZeroRecords: \"Nessun accertamento associato\"\n },\n aoColumnDefs: [\n {aTargets: [0], mData: defaultPerDataTable('distinta.descrizione')},\n {aTargets: [1], mData: computeStringMovimentoGestione.bind(undefined, 'accertamento', 'subAccertamento', 'capitoloEntrataGestione')},\n {aTargets: [2], mData: readData(['subAccertamento', 'accertamento'], 'descrizione')},\n {aTargets: [3], mData: readData(['subAccertamento', 'accertamento'], 'importoAttuale', 0, formatMoney), fnCreatedCell: tabRight},\n {aTargets: [4], mData: readData(['subAccertamento', 'accertamento'], 'disponibilitaIncassare', 0, formatMoney), fnCreatedCell: tabRight}\n ]\n };\n var options = $.extend(true, {}, baseOpts, opts);\n $(\"#tabellaMovimentiEntrata\").dataTable(options);\n }", "function cargarCabeceraElectrico() {\n var msj = '';\n msj += '<tr class=\"bg-primary text-white\">';\n msj += ' <th class=\"text-center\" style=\"background-color: green;\" scope=\"col\"><span>N°&nbsp;</span></th>';\n msj += ' <th class=\"text-center\" style=\"background-color: green;\" scope=\"col\"><span>Año&nbsp;<i class=\"fas fa-question-circle text-white ayuda-tooltip\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Indicador Año\"></i></span></th>';\n msj += ' <th class=\"text-center\" style=\"background-color: green;\" scope=\"col\"><span>Inicio de Operaciones&nbsp;<i class=\"fas fa-question-circle text-white ayuda-tooltip\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Indicador fecha inicio de operación\"></i></span></th>';\n msj += ' <th class=\"text-center\" style=\"background-color: green;\" scope=\"col\"><span>Tipo Vehiculo&nbsp;<i class=\"fas fa-question-circle text-white ayuda-tooltip\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Indicador Tipo Vehículo\"></i></span></th>';\n msj += ' <th class=\"text-center\" style=\"background-color: orange;\" scope=\"col\"><span>Tipo Combustible&nbsp;<i class=\"fas fa-question-circle text-white ayuda-tooltip\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Indicador Tipo Combustible\"></i></span></th>';\n msj += ' <th class=\"text-center\" style=\"background-color: green;\" scope=\"col\"><span>KRV&nbsp;<i class=\"fas fa-question-circle text-white ayuda-tooltip\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Indicador KRV\"></i></span></th>';\n msj += ' <th class=\"text-center\" style=\"background-color: green;\" scope=\"col\"><span>Cantidad&nbsp;<i class=\"fas fa-question-circle text-white ayuda-tooltip\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Indicador Cantidad\"></i></span></th>';\n msj += ' <th class=\"text-center\" style=\"background-color: green;\" scope=\"col\"><span>Factor de Rendimiento&nbsp;<i class=\"fas fa-question-circle text-white ayuda-tooltip\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Indicador Rendimiento\"></i></span></th>';\n msj += ' <th class=\"text-center\" style=\"background-color: green;\" scope=\"col\"><span>Placa&nbsp;<i class=\"fas fa-question-circle text-white ayuda-tooltip\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"Placa del vehículo\"></i></span></th>';\n msj += ' <th class=\"text-center\" style=\"background-color: orange;\" scope=\"col\"><span>Línea Base Emisiones GEI (tCO<sub>2</sub>eq)</span></th>';\n msj += ' <th class=\"text-center\" style=\"background-color: green;\" scope=\"col\"><span>Acción de Mitigación Emisiones GEI (tCO<sub>2</sub>eq)</span></th>';\n msj += ' <th class=\"text-center\" style=\"background-color: #2271b3;\" scope=\"col\"><span>Emisiones GEI Reducidas (tCO<sub>2</sub>eq)</span></th>';\n msj += ' <th class=\"text-center\" scope=\"col\">Más</th>';\n msj += ' <th class=\"text-hide\" scope=\"col\" style=\"display:none;\">Id. Iniciativa</th>';\n msj += '</tr>';\n $(\"#cabeceraTablaIndicador\").append(msj);\n}", "function loadDataNhaCungCap() {\n $scope.nhaCungCap = [];\n if (!tempDataService.tempData('nhaCungCap')) {\n nhaCungCapService.getAllData().then(function (successRes) {\n if (successRes && successRes.status === 200 && successRes.data && successRes.data.Status && successRes.data.Data && successRes.data.Data.length > 0) {\n tempDataService.putTempData('nhaCungCap', successRes.data.Data);\n $scope.nhaCungCap = successRes.data.Data;\n }\n }, function (errorRes) {\n console.log('errorRes', errorRes);\n });\n } else {\n $scope.nhaCungCap = tempDataService.tempData('nhaCungCap');\n }\n }", "function loadDataNhaCungCap() {\n $scope.nhaCungCap = [];\n if (!tempDataService.tempData('nhaCungCap')) {\n nhaCungCapService.getAllData().then(function (successRes) {\n if (successRes && successRes.status === 200 && successRes.data && successRes.data.Status && successRes.data.Data && successRes.data.Data.length > 0) {\n tempDataService.putTempData('nhaCungCap', successRes.data.Data);\n $scope.nhaCungCap = successRes.data.Data;\n }\n }, function (errorRes) {\n console.log('errorRes', errorRes);\n });\n } else {\n $scope.nhaCungCap = tempDataService.tempData('nhaCungCap');\n }\n }", "function escoltaCopia () {\r\n if(this.validate) {\r\n this.capa.innerHTML=\"\";\r\n this.putImg (this.dirImg+\"/\"+this.paraules[index].imatge);\r\n this.capa.innerHTML += \"<br>\" + this.correcte.toUpperCase();\r\n this.putSound (this.paraules[index].so);\r\n }\r\n else {\r\n tabla =insertTable (this.correcte + \"&nbsp;\",this.actual + this.putCursor ('black'), this.estil);\r\n this.capa.innerHTML = tabla;\r\n this.putSound (this.paraules[index].so);\r\n }\r\n}", "get icaos() {\n return this.rows.reduce((result, {icao}) => icao ? result.concat(icao) : result, []);\n }", "function mostrarServicios(){\n\n //llenado de la tabla\n cajas_hoy();\n cajas_ayer() ;\n}", "function obtenerDataPais(caseCovid) {\n;\n if(caseCovid === \"confirmed\"){\n caseCovid == \"confirmed\";\n }\n\n // actualizando la ruta de la lectura de gráfica\n const newPath = \"grafico/graficoEvolutivo.html?name=\"+nameCountry+\"&slug=\"+slug+\"&countryCode=\"+countryCode+\"&caseCovid=\"+caseCovid;\n const newUrl = oldURL.replace(oldPath,newPath);\n $(\"#redirect-grafico\").attr(\"href\",newUrl);\n $.ajax({\n method: \"GET\",\n datatype: \"json\",\n url: \"https://api.covid19api.com/total/dayone/country/\" + slug + \"/status/\" + caseCovid\n }).done(function (data) {\n let contentHTML = \"\";\n $.each(data, function (i, casoCovid){\n contentHTML += \"<tr>\";\n contentHTML += \"<td>\"+formatDate(casoCovid[\"Date\"])+\"</td>\";\n contentHTML += \"<td>\"+casoCovid[\"Cases\"]+\"</td>\";\n contentHTML += \"</tr>\";\n });\n $(\"#body-paises\").html(contentHTML);\n }).fail(function (err) {\n console.log(err);\n alert(\"ocurrió un error al cargar la página\");\n });\n}", "function consultaAperturaYCorteDelDia(fecha){\n // debugger;\n \t\tvar datos = {\n \t\t\t\tfecha : fecha,\n \t\t }\n \t\t$.ajax({\n url: base_url+'Cajero/CorteCaja/consultarApertura',\n type: \"post\",\n dataType: \"json\",\n \t\t\tdata : (datos),\n \t\t\tsuccess : function(response){\n $(\"#tbl_consultaCortesDelDia\").DataTable({\n data: response,\n responsive: true,\n columns: [\n {\n data: \"monto\",\n \"className\": \"text-center\",\n // \"visible\": false, // ocultar la columna\n render: function(data, type, row, meta) {\n var hayApertura = `${row.monto}`;\n var idApertura = `${row.id_apertura}`;\n if (hayApertura == 'null'){\n var a = '<div text-white\">'+'No hay apertura'+'</div>';\n $(\"#id_ventas\").val(\"No hay apertura\");\n }else {\n $(\"#id_apertura\").val(idApertura);\n $(\"#monto_apertura\").val(hayApertura);\n var a = '<div text-white\">'+hayApertura+'</div>';\n }\n return a;\n },\n },\n {\n data: \"monto_entregado\",\n \"className\": \"text-center\",\n },\n {\n data: \"gastos\",\n \"className\": \"text-center\",\n },\n {\n data: \"ventas\",\n // \"visible\": false, // ocultar la columna\n },\n {\n data: \"diferencia\",\n \"className\": \"text-center\",\n },\n {\n data: \"fecha\",\n \"className\": \"text-center\",\n },\n {\n data: \"usuario\",\n \"className\": \"text-center\",\n },\n\n ],\n \"language\" : language_espaniol,\n });\n \t\t\t }\n \t\t});\n }", "processData()\n\t{\n\t\tlet filas = this.controlFilas; // Filas\n\t\tlet columnas = this.controlColumnas; // Columnas\n\t\tlet sumaClase = 0; // Sumas del tamaño de la clase\n\t\tlet data = []; // Matriz para datos\n\t\tdata[0] = []; // Init\n\t\tdata[1] = []; // fin\n\t\tdata[2] = []; // marca clase\n\t\tdata[3] = []; // Unidades\n\n\t\t// Recogemos los datos\n\t\tfor(let i = 0; i < filas; i++){\n\t\t\tfor(let j = 0; j < columnas; j++){\n\t\t\t\t// Verificamos si hay un dato\n\t\t\t\tif(document.getElementById((i+1)+''+(j+1)).value.length > 0){\n\t\t\t\t\t// Verificamos que solo se sumen columnas 1 y 2\n\t\t\t\t\tif(j == 0 || j == 1){\n\t\t\t\t\t\tsumaClase += parseFloat(document.getElementById((i+1)+''+(j+1)).value);\n\t\t\t\t\t\tif(j == 0){\n\t\t\t\t\t\t\t// Guardamos datos\n\t\t\t\t\t\t\tdata[0].push(parseFloat(document.getElementById((i+1)+''+(j+1)).value));\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Guardamos datos\n\t\t\t\t\t\t\tdata[1].push(parseFloat(document.getElementById((i+1)+''+(j+1)).value));\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if(j == 2){\n\t\t\t\t\t\t// Guardamos datos\n\t\t\t\t\t\tdata[3].push(parseFloat(document.getElementById((i+1)+''+(j+1)).value));\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Inyectamos\n\t\t\t\t\tdocument.getElementById((i+1)+''+(j+1)).value = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tdata[2].push(sumaClase / 2); // Guardamos datos\n\t\t\tsumaClase = 0; // Reseteamos\n\t\t}\n\n\t\t// Mostramos texto para resultados\n\t\tlet h = document.createElement('h2');\n\t\th.setAttribute('class', 'results-title');\n\t\tlet hText = document.createTextNode('Resultados:');\n\t\th.appendChild(hText);\n\t\tdocument.getElementById('main-content').appendChild(h);\n\n\t\t// Obtenem0s medidas de tendencia central\n\t\tlet table = document.createElement('table');\n\t\ttable.setAttribute('id', 'medidas');\n\t\tlet caption = document.createElement('caption');\n\t\tcaption.setAttribute('class', 'padding');\n\t\tlet text = document.createTextNode('Medidas de tendencia central');\n\t\tcaption.appendChild(text);\n\t\ttable.appendChild(caption);\n\t\tlet row = table.insertRow(0);\n\t\tlet cell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Media aritmética');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.mediaAritmetica(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\trow = table.insertRow(1);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Moda');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.moda(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\trow = table.insertRow(2);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Mediana');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.mediana(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\trow = table.insertRow(3);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Media armónica');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.mediaArmonica(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\trow = table.insertRow(4);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Media geométrica');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.mediaGeometrica(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\tdocument.getElementById('main-content').appendChild(table);\n\n\t\t// Obtenem0s medidas de dispersión\n\t\ttable = document.createElement('table');\n\t\ttable.setAttribute('id', 'medidas');\n\t\tcaption = document.createElement('caption');\n\t\tcaption.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Medidas de dispersión');\n\t\tcaption.appendChild(text);\n\t\ttable.appendChild(caption);\n\t\trow = table.insertRow(0);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Desviación media');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.desviacionMedia(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\trow = table.insertRow(1);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Desviación estandar');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.desviacionEstandar(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\trow = table.insertRow(2);\n\t\tcell = row.insertCell(0);\n\t\tcell.setAttribute('class', 'padding');\n\t\ttext = document.createTextNode('Varianza');\n\t\tcell.appendChild(text);\n\t\tcell = row.insertCell(1);\n\t\ttext = document.createTextNode(this.process.varianza(data).toFixed(2));\n\t\tcell.appendChild(text);\n\t\tdocument.getElementById('main-content').appendChild(table);\n\t}", "function mostrarMaquina(data, accion){\n if(data.maquina.id_pack==null){\n $('#navPaqueteJuegos').attr('hidden',true);\n $('#navJuego').attr('hidden',false);\n }else{\n // gestiona paquete de juegos\n $('#tablaMtmJuegoPack tbody').empty();\n\n for (i = 0; i < data.juego_pack_mtm.juegos.length; i++) {\n if (i==0){\n pack=data.juego_pack_mtm.juegos[0];\n $('#inputPackActual').val(pack.identificador);\n $('#inputPackActual').attr(\"data-idPack\", pack.id_pack);\n }else{\n agregarJuegosPackMtm(data.juego_pack_mtm.juegos[i]);\n }\n\n }\n\n $('#navPaqueteJuegos').attr('hidden',false);\n $('#navJuego').attr('hidden',true);\n }\n casino_global = data.casino.id_casino;\n $('#buscadorExpediente').generarDataList(\"maquinas/buscarExpedientePorCasinoYNumero/\"+casino_global,'resultados','id_expediente','concatenacion',2,true);\n $('#buscadorExpediente').setearElementoSeleccionado(0,\"\");\n if (data.maquina.juega_progresivo==0){\n $('#juega_progresivo_m').val(\"NO\");\n }else{\n $('#juega_progresivo_m').val(\"SI\");\n }\n\n $('#nro_admin').val(data.maquina.nro_admin);\n $('#marca').val(data.maquina.marca);\n $('#modelo').val(data.maquina.modelo);\n $('#unidad_medida').val(data.maquina.id_unidad_medida);\n $('#nro_serie').val(data.maquina.nro_serie);\n $('#mac').val(data.maquina.mac);\n $('#marca_juego').val(data.maquina.marca_juego);\n $('#marca_juego_check').prop('checked',data.marca_juego_es_generado).trigger('change');\n data.tipo_gabinete != null ? $('#tipo_gabinete').val(data.tipo_gabinete.id_tipo_gabinete) : $('#tipo_gabinete').val(\"\") ;\n data.tipo_maquina != null ? $('#tipo_maquina').val(data.tipo_maquina.id_tipo_maquina) : $('#tipo_maquina').val(\"\");\n $('#estado').val(data.maquina.id_estado_maquina);\n $('#porcentaje_devolucion').val(data.maquina.porcentaje_devolucion);\n if(data.maquina.juega_progresivo == 1){\n $('#juega_progresivo').val(0);\n }\n else {\n $('#juega_progresivo').val(1);\n }\n $('#denominacion').val(data.maquina.denominacion);\n if(data.expedientes != null){\n for(var i=0; i < data.expedientes.length; i++){\n $('#listaExpedientes').append($('<li>')\n .val(data.expedientes[i].id_expediente)\n .addClass('row')\n .css('list-style','none').css('padding','5px 0px')\n .append($('<div>')\n .addClass('col-xs-7')\n .text(data.expedientes[i].nro_exp_org+'-'+data.expedientes[i].nro_exp_interno + '-' + data.expedientes[i].nro_exp_control)\n )\n .append($('<div>')\n .addClass('col-xs-5')\n .append($('<button>')\n .addClass('btn').addClass('btn-danger').addClass('borrarFila').addClass('borrarExpediente')\n .append($('<i>')\n .addClass('fa').addClass('fa-trash')\n )\n )\n )\n )\n }\n }\n\n $('#tipo_moneda').val(data.moneda != null? data.moneda.id_tipo_moneda: null);\n\n var text=$('#modalMaquina .modal-title').text();\n\n //Datos pesataña isla\n console.log(data.isla);\n if(data.isla != null){//si no tiene isla asociada, puede pasar al modifcar isla\n mostrarIsla(data.casino, data.isla ,data.sectores, data.sector);\n //seteo datos pensataña maquina\n text= text +\" N°: \" + data.maquina.nro_admin + \" ISLA: \"+data.isla.nro_isla ;\n $('#modalMaquina .modal-title').text(text);\n }else{\n text= text +\" N°: \" + data.maquina.nro_admin + \" ISLA: SIN ASIGNAR \";\n $('#modalMaquina .modal-title').text(text);\n }\n\n mostrarJuegos(data.maquina.id_casino,data.juegos,data.juego_activo);\n\n data.gli_soft != null ? mostrarGliSofts(data.gli_soft) : null;\n data.gli_hard != null ? mostrarGliHard(data.gli_hard) : null;\n data.formula != null ? mostrarFormula(data.formula) : null;\n}", "function setCajasServidor() {\n for (var i = 0; i < self.datosProyecto.businesModel.length; i++) {\n var businesModel = self.datosProyecto.businesModel[i];\n for (var x = 0; x < businesModel.cajas.length; x++) {\n var caja = businesModel.cajas[x];\n for (var j = 0; j < cajasServidor.length; j++) {\n if (caja.id == cajasServidor[j].id) {\n caja.titulo = cajasServidor[j].titulo;\n caja.descripcion = cajasServidor[j].descripcion;\n caja.color = cajasServidor[j].color;\n caja.textoCheck = cajasServidor[j].textoCheck;\n }\n }\n }\n }\n}", "function rp_planif_contratacion_vs_trab_cubrir(data, id_contenedor, cliente, ubicacion, callback) {\r\n\tif (d3.select('#' + id_contenedor).node()) {\r\n\t\tlimpiarContenedor('id_contenedor');\r\n\r\n\t\tres_contratacion = d3.nest()\r\n\t\t\t.key((d) => d.cod_cliente).sortKeys(d3.ascending)\r\n\t\t\t.key((d) => d.cod_ubicacion).sortKeys(d3.ascending)\r\n\t\t\t.entries(data['contrato']);\r\n\r\n\t\tres_activos = d3.nest()\r\n\t\t\t.key((d) => d.cod_ubicacion).sortKeys(d3.ascending)\r\n\t\t\t.entries(data['trab_activos']);\r\n\r\n\t\tif (data['excepcion'] !== undefined) {\r\n\t\t\tres_excepcion = d3.nest()\r\n\t\t\t\t.key((d) => d.cod_ubicacion).sortKeys(d3.ascending)\r\n\t\t\t\t.entries(data['excepcion']);\r\n\t\t\tvar map_res_excepcion = d3.map(res_excepcion, (d) => d.key);\r\n\t\t}\r\n\r\n\t\tvar map_res_activos = d3.map(res_activos, (d) => d.key);\r\n\r\n\t\td3.select('#' + id_contenedor).append('table').attr('id', 't_reporte').attr('width', '100%').attr('border', 0).attr('align', 'center');\r\n\t\td3.select('#t_reporte').append('thead').attr('id', 'thead');\r\n\t\td3.select('#t_reporte').append('tbody').attr('id', 'tbody');\r\n\t\td3.select('#thead').append('tr').attr('class', 'fondo00')\r\n\t\t\t.html('<th width=\"25%\" class=\"etiqueta\">Region</th>' +\r\n\t\t\t\t'<th width=\"25%\" class=\"etiqueta\">Estado</th>' +\r\n\t\t\t\t'<th width=\"25%\" class=\"etiqueta\">Empresa</th>' +\r\n\t\t\t\t'<th width=\"25%\" class=\"etiqueta\">ubicacion</th>' +\r\n\t\t\t\t'<th width=\"10%\" class=\"etiqueta\">Pl. Cantidad </th>' +\r\n\t\t\t\t'<th width=\"10%\" class=\"etiqueta\">Trab. Necs.</th>' +\r\n\t\t\t\t'<th width=\"10%\" class=\"etiqueta\">Hombres Activos</th>' +\r\n\t\t\t\t'<th width=\"10%\" class=\"etiqueta\">Pl. Excepcion</th>' +\r\n\t\t\t\t'<th width=\"10%\" class=\"etiqueta\">Diferencia</th>');\r\n\t\td3.select('#t_reporte').selectAll('.tbody2').data(res_contratacion).enter().append('tbody').attr('class', 'tbody2')\r\n\t\t\t.attr('id', (d) => {\r\n\t\t\t\treturn 'body_' + d.key;\r\n\t\t\t});\r\n\r\n\t\tres_contratacion.forEach((d) => {\r\n\t\t\td3.select('#body_' + d.key).selectAll('tr').data(d.values).enter().append('tr')\r\n\t\t\t\t.attr('class', (e) => {\r\n\t\t\t\t\tfactor = 0, trab_neces = 0, trab_activos = 0, excepcion = 0, color = ''; cantidad = 0;\r\n\t\t\t\t\tif (data['excepcion'] !== undefined) {\r\n\t\t\t\t\t\tif (map_res_excepcion.has(e.key)) {\r\n\t\t\t\t\t\t\texcepcion = Number(map_res_excepcion.get(e.key).values[0].cantidad);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.values.forEach((f, i) => {\r\n\t\t\t\t\t\tcantidad += Number(f.cantidad);\r\n\t\t\t\t\t\ttrab_neces += Number(f.trab_neces);\r\n\t\t\t\t\t\tif (i == 0) {\r\n\t\t\t\t\t\t\tif (map_res_activos.has(f.cod_ubicacion)) {\r\n\t\t\t\t\t\t\t\tmap_res_activos.get(f.cod_ubicacion).values.forEach((g) => {\r\n\t\t\t\t\t\t\t\t\ttrab_activos += Number(g.cantidad);\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t\tfactor = (trab_activos - excepcion) - trab_neces;\r\n\t\t\t\t\tcolor = 'color ' + validarFondo(factor);\r\n\t\t\t\t\treturn color;\r\n\t\t\t\t}).html((e) => {\r\n\t\t\t\t\tfactor = 0, trab_neces = 0, trab_activos = 0, excepcion = 0; cantidad = 0;\r\n\t\t\t\t\tif (data['excepcion'] !== undefined) {\r\n\t\t\t\t\t\tif (map_res_excepcion.has(e.key)) {\r\n\t\t\t\t\t\t\texcepcion = Number(map_res_excepcion.get(e.key).values[0].cantidad);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\te.values.forEach((f, i) => {\r\n\t\t\t\t\t\tcantidad += Number(f.cantidad);\r\n\t\t\t\t\t\ttrab_neces += Number(f.trab_neces);\r\n\t\t\t\t\t\tif (i == 0) {\r\n\t\t\t\t\t\t\tif (map_res_activos.has(f.cod_ubicacion)) {\r\n\t\t\t\t\t\t\t\tmap_res_activos.get(f.cod_ubicacion).values.forEach((g) => {\r\n\t\t\t\t\t\t\t\t\ttrab_activos += Number(g.cantidad);\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t});\r\n\t\t\t\t\tfactor = Math.floor((trab_activos - excepcion) - trab_neces);\r\n\t\t\t\t\tif (factor == 0) factor = 'OK';\r\n\t\t\t\t\treturn '<td class=\"texto\" id=\"center\" >' + e.values[0].region + '</td><td class=\"texto\" id=\"center\" >' + e.values[0].estado + '</td><td class=\"texto\" id=\"center\" >' + e.values[0].cliente + '</td><td class=\"texto\" id=\"center\" >' + e.values[0].ubicacion + '</td><td class=\"texto\" id=\"center\" >' + cantidad\r\n\t\t\t\t\t\t+ '</td><td class=\"texto\" id=\"center\" >' + trab_neces + '</td><td class=\"texto\" id=\"center\" >' + trab_activos + '</td><td class=\"texto\" id=\"center\" >' + excepcion + '</td><td class=\"texto\" id=\"center\" >' + factor + '</td>';\r\n\t\t\t\t});\r\n\t\t});\r\n\t\tif (typeof (callback) == 'function') callback();\r\n\t}\r\n}", "function impostaCausaliSpesa (list) {\n var opts = {\n aaData: list,\n oLanguage: {\n sZeroRecords: \"Nessun impegno associato\"\n },\n aoColumnDefs: [\n {aTargets: [0], mData: computeStringMovimentoGestione.bind(undefined, 'impegno', 'subImpegno', 'capitoloUscitaGestione')},\n {aTargets: [1], mData: readData(['subImpegno', 'impegno'], 'descrizione')},\n {aTargets: [2], mData: readData(['subImpegno', 'impegno'], 'importoAttuale', 0, formatMoney), fnCreatedCell: tabRight},\n {aTargets: [3], mData: readData(['subImpegno', 'impegno'], 'disponibilitaPagare', 0, formatMoney), fnCreatedCell: tabRight}\n ]\n };\n var options = $.extend(true, {}, baseOpts, opts);\n $(\"#tabellaMovimentiSpesa\").dataTable(options);\n }", "function obtenertecnicos() {\n $.ajax({\n type: \"POST\",\n url: \"wsprivado/wsasignarsolicitud.asmx/ObtenerTecnicos\",\n data: '',\n contentType: \"application/json; charset=utf-8\",\n dataType: \"json\",\n success: function (msg) {\n var tds = \"<option value='0'>Elegir...</option>\"\n $.each(msg.d, function () {\n datac.push({'id': this.id, 'nombre': this.nombre});\n });\n }\n });\n }", "function formarControles() {\n let ban = 0;\n for (let item of controles1) {\n if (item !== undefined) {\n if (ban !== 0) {\n controles1_string += \",\";\n }\n controles1_string += item.control;\n ban = 1;\n }\n }\n ban = 0;\n for (let item of controles2) {\n if (item !== undefined) {\n if (ban !== 0) {\n controles2_string += \",\";\n }\n controles2_string += item.control;\n ban = 1;\n }\n }\n ban = 0;\n for (let item of controles3) {\n if (item !== undefined) {\n if (ban !== 0) {\n controles3_string += \",\";\n }\n controles3_string += item.control;\n ban = 1;\n }\n }\n}", "function construye() {\n let base = [];\n for (let i = 0; i < numCajas; i++) {\n base.push(angular.copy(cajaDefecto));\n }\n return base;\n }", "function bien_bajas() \r\n{\r\n var t = $('#tbl_bajas');\r\n if ( $.fn.dataTable.isDataTable( '#tbl_bajas' ) ) {\r\n $('#tbl_bajas').DataTable().destroy();\r\n }\r\n \r\n $.ajax({\r\n url: 'controller/puente.php',\r\n type: 'POST',\r\n dataType: 'json',\r\n data: {option: '67'},\r\n async:false,\r\n })\r\n .done(function(bajas) {\r\n $('#tbl_bajas tbody').empty();\r\n //console.log(bajas);\r\n if (bajas.length > 0 ) \r\n {\r\n $.each(bajas, function(i, baja) {\r\n var accion,detalle ,clase_row;\r\n //saber el tipo de baja\r\n if (baja.t_baja == 'Temporal') \r\n {\r\n accion = \r\n '<div class=\"btn-group\">'+\r\n '<button type=\"button\" class=\"btn btn-success btn-flat dropdown-toggle\" data-toggle=\"dropdown\" aria-expanded=\"false\">'+\r\n '<span class=\"caret\"></span>'+\r\n '<span class=\"sr-only\">Toggle Dropdown</span>'+\r\n '</button>'+\r\n '<ul class=\"dropdown-menu\" role=\"menu\">'+\r\n '<li><a href=\"#\" onclick=\"UpdateBajaDefinitiva('+baja.baja_id+');\">Baja definitiva</a></li>'+\r\n '</ul>'+\r\n '</div>' ;\r\n clase_row = 'class=\"bg-yellow \"';\r\n }\r\n else\r\n {\r\n accion = '';\r\n clase_row= 'class=\"bg-red-active \"';\r\n }\r\n //Formar la lista de caracteristicas del bien\r\n detalle = \r\n '<ul>'+\r\n '<li><label>Serie: </label> '+baja.serie+'</li>'+\r\n '<li><label>Inventario: </label> '+baja.inventario+'</li>'+\r\n '<li><label>Marca: </label> '+baja.marca+'</li>'+\r\n '<li><label>Grupo: </label> '+baja.grupo+'</li>'+\r\n '<li><label>Modelo: </label> '+baja.modelo+'</li>'+\r\n '<li><label>Color: </label> '+baja.color+'</li>'+\r\n '<li><label>Material: </label> '+baja.material+'</li>'+\r\n '<li><label>Comentario: </label> '+baja.comentario+'</li>'+\r\n '<li><label>Estatus: </label> '+baja.status+'</li>'+\r\n '</ul>' ;\r\n t.append(\r\n '<tr '+clase_row+'>'+\r\n '<td>'+accion+'</td>'+\r\n '<td>'+baja.id+'</td>'+\r\n '<td>'+detalle+'</td>'+\r\n '<td>'+baja.t_baja+'</td>'+\r\n '</tr>'\r\n );\r\n\r\n });\r\n\r\n }else{\r\n t.append('<tr> <td colspan=\"4\"> <center>NO HAY BIENES DADOS DE BAJA</center> </td> </tr>');\r\n }\r\n })\r\n .fail(function() {\r\n console.log(\"error\");\r\n })\r\n .always(function() {\r\n $('#tbl_bajas').DataTable(\r\n {\r\n 'language':\r\n {\r\n 'url':'//cdn.datatables.net/plug-ins/1.10.19/i18n/Spanish.json'\r\n },\r\n 'lengthMenu': [[10, 25, 50,100, -1], [10, 25, 50, 100, 'Todos']],\r\n \r\n dom: '<<\"col-md-3\"B><\"#buscar.col-sm-4\"f><\"pull-right\"l><t>pr>',\r\n buttons:{\r\n buttons: [\r\n { extend: 'pdf', className: 'btn btn-flat btn-warning',text:' <i class=\"fa fa-file-pdf-o\"></i> Exportar a PDF' },\r\n { extend: 'excel', className: 'btn btn-success btn-flat',text:' <i class=\"fa fa-file-excel-o\"></i> Exportar a Excel' }\r\n ]\r\n } \r\n }\r\n );\r\n });\r\n \r\n return false;\r\n}", "function pedir_tiempos_conc(){\n\tdataBase.query(\"USE reactor40\", function (err, result,field) {\n\t\t\tif (err) throw err;\n\t});\n\tdataBase.query('SELECT * FROM concentracion ORDER BY ID DESC LIMIT 20;', function(err, result, fiel){\n\t\tdatosY.y_1 = result[19].time;\n\t\tdatosY.y_2 = result[18].time;\n\t\tdatosY.y_3 = result[17].time;\n\t\tdatosY.y_4 = result[16].time;\n\t\tdatosY.y_5 = result[15].time;\n\t\tdatosY.y_6 = result[14].time;\n\t\tdatosY.y_7 = result[13].time;\n\t\tdatosY.y_8 = result[12].time;\n\t\tdatosY.y_9 = result[11].time;\n\t\tdatosY.y_10 = result[10].time;\n\t\tdatosY.y_11 = result[9].time;\n\t\tdatosY.y_12 = result[8].time;\n\t\tdatosY.y_13 = result[7].time;\n\t\tdatosY.y_14 = result[6].time;\n\t\tdatosY.y_15 = result[5].time;\n\t\tdatosY.y_16 = result[4].time;\n\t\tdatosY.y_17 = result[3].time;\n\t\tdatosY.y_18 = result[2].time;\n\t\tdatosY.y_19 = result[1].time;\n\t\tdatosY.y_20 = result[0].time;\n\t});\n}", "function obtener_datos_todos_establecimiento() {\n var lista_datos = conexion_cuestionarios_resuelto();\n var contenido = \"\";\n var sucursal = \"\";\n var indice = 1;\n if (lista_datos.length > 0 ) {\n $.each(lista_datos, function (index, item) {\n if (index == 0) {\n contenido = \"<tr class='celda_tabla_res' style='background-color:#cbf1f5' ><th style='width:60px'>#</th><th style='width:30%'>\"+item.establecimiento+\"</th><th style='width:60px' >limpieza %</th><th style='width:60px'>Surtido %</th><th style='width:60px'>Imagen %</th><th style='width:60px'>Total %</th></tr>\"\n $(\"#tabla_res\").append(contenido);\n sucursal=item.establecimiento;\n }//fin if\n if (sucursal == item.establecimiento) {\n contenido = \"<tr class='celda_tabla_res dato'><td style='width:60px'>\" + indice + \"</td><td class='nombre' style='width:30%'>\" + item.cuestionario + \"</td><td style='width:90px' >\" + item.limpieza + \"</td><td style='width:90px'>\" + item.surtido + \"</td><td style='width:90px'>\" + item.imagen + \"</td><td style='width:60px'>\" + item.total + \"</td></tr>\"\n $(\"#tabla_res\").append(contenido);\n indice++;\n }\n else {\n indice = 1;\n contenido = \"<tr class='celda_tabla_res' style='background-color:#cbf1f5' ><th style='width:60px'>#</th><th style='width:30%'>\" + item.establecimiento + \"</th><th style='width:60px' >limpieza %</th><th style='width:60px'>Surtido %</th><th style='width:60px'>Imagen %</th><th style='width:60px'>Total %</th></tr>\"\n $(\"#tabla_res\").append(contenido);\n contenido = \"<tr class='celda_tabla_res dato'><td style='width:60px'>\" + indice + \"</td><td class='nombre' style='width:30%'>\" + item.cuestionario + \"</td><td style='width:90px' >\" + item.limpieza + \"</td><td style='width:90px'>\" + item.surtido + \"</td><td style='width:90px'>\" + item.imagen + \"</td><td style='width:60px'>\" + item.total + \"</td></tr>\"\n $(\"#tabla_res\").append(contenido);\n sucursal = item.establecimiento;\n indice++;\n }//fin if\n });\n }//fin\n else alert(\"No Hay Datos...\");\n}//fin", "function setCajasDefault(num) {\n for (var i = 0; i < self.datosProyecto.businesModel.length; i++) {\n var cajas = [];\n for (var x = 0; x < num; x++) {\n var idContador = x + 1;\n var caja = {\n id: idContador,\n titulo: \"\",\n descripcion: \"\",\n color: \"#bad9f9\",\n textoCheck: \"\"\n };\n cajas.push(caja);\n }\n self.datosProyecto.businesModel[i].cajas = cajas;\n }\n}", "function dodajClana() {\n if (ime.value == \"\" || prezime.value == \"\" || datumRodjenja.value == \"\") {\n alert(\"Unesite sve potrebne podatke: Ime, prezime, datum rođenja!!!\");\n } else if (danasnjDatum < new moment(datumRodjenja.value)) {\n alert(\"Potrebno je da unesete datum ne mlađi od današnjeg !!!\");\n } else {\n var ispis = racunjanjeDatuma(datumRodjenja.value);\n brojClanovaPorodice();\n var row =\n \"<tr><td>\" +\n ime.value +\n \"</td><td>\" +\n prezime.value +\n \"</td><td>\" +\n datumRodjenja.value +\n \"</td><td>\" +\n ispis +\n \"</td>\" +\n trash +\n edit +\n check +\n \"</tr>\";\n var novi = tableTbody.innerHTML + row;\n tableTbody.innerHTML = novi;\n obrisiVrijednosti();\n console.table(porodica);\n }\n}", "async getDatosAcopio() {\n let query = `SELECT al.almacenamientoid, ca.centroacopioid, ca.centroacopionombre, \n concat('Centro de Acopio: ', ca.centroacopionombre, ' | Propietario: ', pe.pernombres, ' ', pe.perapellidos) \"detalles\"\n FROM almacenamiento al, centroacopio ca, responsableacopio ra, persona pe\n WHERE al.centroacopioid = ca.centroacopioid AND ca.responsableacopioid = ra.responsableacopioid AND ra.responsableacopioid = pe.personaid;`;\n let result = await pool.query(query);\n return result.rows; // Devuelve el array de json que contiene todos los controles de maleza realizados\n }", "function carga_logica_informe_anatomia_coronaria() {\r\n\tinicializar_variables_anatomia_coronaria();\r\n\tactualizarDibujoCanvasAnatomiaCoronaria();\r\n\treiniciar_control_seleccion_lesion();\r\n\tcargar_areas_de_seleccion_arterias();\r\n\tcargar_coordenadas_de_lesiones();\r\n}", "function cargarDatosCabecera() {\n $(\".nombre\").text(nombre)\n $(\".titulo\").text(titulo)\n $(\"#resumen\").text(resumen)\n $(\"#email\").text(contacto.mail)\n $(\"#telefono\").text(contacto.telefono)\n $(\"#direccion\").text(`${contacto.calle} ${contacto.altura}, ${contacto.localidad}`)\n}", "function corrida(){\n var tasa = ($('#tasa').val() / 100)/12;\n //var plazo = $('#plazo').val() * 12;\n // var inicio = $('.f_inicio').val();\n var plazo = $('#plazo').val();\n var pago_mensual = $('#mensualidad').val();\n //console.log(tasa);\n var contado = $('#costo_contado').val();\n\n var saldo = $('#pago_total').val();\n\n var intereses = tasa * contado;\n var capital = pago_mensual - intereses;\n\n var tabla = $('#t_cobros').val();\n var display = \"table-cell\";\n\n if(tabla > 4){\n display = \"none\";\n }\n\n $('#mostrar_corrida').empty();\n var corrida = \"\";\n corrida +=\n '<table class=\"table table-hover\">'+\n '<thead>'+\n '<th class=\"text-center\">Mensualidad</th>'+\n '<th>Contado</th>'+\n '<th style=\"display:'+display+';\">Capital</th>'+\n '<th style=\"display:'+display+';\">Interés</th>'+\n '<th>Pago Mensual</th>'+\n '<th>Saldo</th>'+\n '</thead>'+\n '<tbody>';\n // console.log(inicio);\n\n for (var mensualidad = 0; mensualidad < plazo ; mensualidad ++) {\n var v_contado = (Math.round(contado * 100) / 100);\n var v_capital = (Math.round(capital * 100) / 100);\n var v_intereses = (Math.round(intereses * 100) / 100);\n var v_pago_mensual = (Math.round(pago_mensual * 100) / 100);\n var v_saldo = (Math.round((saldo - pago_mensual) * 100) / 100);\n if(tabla > 4){\n v_contado = (Math.round(saldo * 100) / 100);\n }\n corrida +=\n \"<tr>\"+\n \"<td class='text-center'>\" + (parseFloat(mensualidad) + 1) + \"</td>\" +\n // \"<td>\" + (fecha_vencimiento(inicio,(parseFloat(mensualidad) + 1) * 30)) + \"</td>\" +\n \"<td> $\" + formato_money(v_contado) + \"</td>\" +\n \"<td style='display:\"+display+\";'> $\" + formato_money(v_capital) + \"</td>\" +\n \"<td style='display:\"+display+\";'> $\" + formato_money(v_intereses) + \"</td>\" +\n \"<td> $\" + formato_money(v_pago_mensual) + \"</td>\" +\n \"<td> $\" + formato_money(v_saldo) + \"</td>\" +\n \"</tr>\";\n contado -= capital;\n intereses = tasa * contado;\n capital = pago_mensual - intereses;\n saldo -= pago_mensual;\n // if(tabla < 5){\n // saldo -= pago_mensual;\n // }\n }\n corrida +=\n '</tbody>' +\n '</table>';\n $('#mostrar_corrida').append(corrida);\n }", "function getCombustivelTable() {\n //Populates Table with Json\n tableCombustivel = $('table#table-combustivel').DataTable({\n ajax: {\n url: urlApi + \"combustivel\",\n contentType: 'application/json; charset=UTF-8',\n dataType: 'json'\n },\n columns: [{\n data: \"id\"\n }, {\n data: \"tipo\"\n }],\n columnDefs: [\n {\n width: '20%',\n targets: 'combIdCol'\n }\n ],\n select: true,\n lengthChange: false,\n pageLength: 5,\n dom: 'lrti<\"right\"p>',\n language: {\n url: \"../../doc/Portuguese-Brasil.json\"\n }\n });\n}", "function tablaresultadosordencompra(limite)\r\n{\r\n \r\n \r\n var decimales = document.getElementById('decimales').value;\r\n var base_url = document.getElementById('base_url').value;\r\n var controlador = base_url+'orden_compra/buscar_ordenescompra';\r\n let parametro = \"\";\r\n if(limite == 2){\r\n parametro = document.getElementById('filtrar').value;\r\n }else if(limite == 3){\r\n parametro = \"\";\r\n }\r\n //document.getElementById('loader').style.display = 'block'; //muestra el bloque del loader\r\n $.ajax({url: controlador,\r\n type:\"POST\",\r\n data:{parametro:parametro},\r\n success:function(respuesta){\r\n var registros = JSON.parse(respuesta);\r\n var color = \"\";\r\n if (registros != null){\r\n //var formaimagen = document.getElementById('formaimagen').value;\r\n var n = registros.length; //tamaño del arreglo de la consulta\r\n $(\"#encontrados\").html(n);\r\n html = \"\";\r\n for (var i = 0; i < n ; i++){\r\n html += \"<tr>\";\r\n html += \"<td style='padding: 2px;' class='text-center'>\"+(i+1)+\"</td>\";\r\n html += \"<td style='padding: 2px;'>\"+registros[i]['usuario_nombre']+\"</td>\";\r\n html += \"<td style='padding: 2px;' class='text-center'>\"+registros[i]['ordencompra_id']+\"</td>\";\r\n html += \"<td style='padding: 2px;' class='text-center'>\";\r\n html += moment(registros[i][\"ordencompra_fecha\"]).format(\"DD/MM/YYYY\");\r\n html += \"</td>\";\r\n html += \"<td style='padding: 2px;' class='text-center'>\"+registros[i]['ordencompra_hora']+\"</td>\";\r\n html += \"<td style='padding: 2px;' class='text-center'>\";\r\n html += moment(registros[i][\"ordencompra_fechaentrega\"]).format(\"DD/MM/YYYY\");\r\n html += \"</td>\";\r\n html += \"<td style='padding: 2px;' class='text-center'>\"+registros[i]['proveedor_nombre']+\"</td>\";\r\n html += \"<td style='padding: 2px;' class='text-right'>\"+Number(registros[i]['ordencompra_totalfinal']).toFixed(decimales)+\"</td>\";\r\n html += \"<td style='padding: 2px;' class='text-center'>\"+registros[i]['estado_descripcion']+\"</td>\";\r\n html += \"<td style='padding: 2px;' class='no-print'>\";\r\n html += \"<a href='\"+base_url+\"orden_compra/edit/\"+registros[i][\"ordencompra_id\"]+\"' class='btn btn-info btn-xs' title='Modificar orden compra' ><span class='fa fa-pencil'></span></a>&nbsp;\";\r\n html += \"<a class='btn btn-success btn-xs' onclick='mostrar_reciboorden(\"+registros[i]['ordencompra_id']+\")' title='Ver reporte orden compra'><fa class='fa fa-print'></fa></a>&nbsp;\";\r\n html += \"<a class='btn btn-facebook btn-xs' onclick='mostrar_reciboordenp(\"+registros[i]['ordencompra_id']+\")' title='Ver reporte orden compra para proveedor'><fa class='fa fa-print'></fa></a>&nbsp;\";\r\n if(registros[i]['estado_id'] == 33){\r\n html += \"<a class='btn btn-danger btn-xs' onclick='modal_ejecutarordencompra(\"+registros[i]['ordencompra_id']+\")' title='Ejecutar orden compra'><fa class='fa fa-bolt'></fa></a>&nbsp;\";\r\n html += \"<a class='btn btn-warning btn-xs' onclick='modal_anularordencompra(\"+registros[i]['ordencompra_id']+\")' title='Anular orden compra'><fa class='fa fa-minus-circle'></fa></a>\";\r\n }/*else if(registros[i]['estado_id'] == 35){\r\n html += \"<a class='btn btn-warning btn-xs' onclick='modal_anularordencmpra(\"+registros[i]['ordencompra_id']+\")' title='Anular orden compra'><fa class='fa fa-minus-circle'></fa></a>\";\r\n }*/\r\n \r\n html += \"</td>\";\r\n html += \"</tr>\";\r\n }\r\n $(\"#tablaresultados\").html(html);\r\n //document.getElementById('loader').style.display = 'none';\r\n }\r\n //document.getElementById('loader').style.display = 'none'; //ocultar el bloque del loader\r\n },\r\n error:function(respuesta){\r\n // alert(\"Algo salio mal...!!!\");\r\n html = \"\";\r\n $(\"#tablaresultados\").html(html);\r\n },\r\n complete: function (jqXHR, textStatus) {\r\n //document.getElementById('loader').style.display = 'none'; //ocultar el bloque del loader \r\n //tabla_inventario();\r\n }\r\n });\r\n}", "function reportBatalla(){ \n\t\tvar t = find(\"//table//table//table[@class='tbg']\", XPList); \n\t\tif (t.snapshotLength < 2) return;\n\n\t\t// Encuentra y suma todas las cantidades del botin\n\t\tvar botin = null;\n\t\tvar a = find(\"//tr[@class='cbg1']\", XPList);\n\t\tif (a.snapshotLength >= 3){\n\t\t\t// FIXME: Apaño para Firefox. FF mete nodos de tipo texto vacios\n\t\t\tif (a.snapshotItem(1).childNodes.length == 4){\n\t\t\t\tvar b = a.snapshotItem(1).childNodes[3];\n\t\t\t}else{\n\t\t\t\tvar b = a.snapshotItem(1).childNodes[1];\n\t\t\t}\n\t\t\tif (b.childNodes.length == 8){ \n\t\t\t\tvar cantidades_botin = new Array();\n\t\t\t\tcantidades_botin[0] = parseInt(b.childNodes[1].nodeValue);\n\t\t\t\tcantidades_botin[1] = parseInt(b.childNodes[3].nodeValue);\n\t\t\t\tcantidades_botin[2] = parseInt(b.childNodes[5].nodeValue);\n\t\t\t\tcantidades_botin[3] = parseInt(b.childNodes[7].nodeValue);\n\t\t\t\tbotin = arrayToInt(cantidades_botin);\n\t\t\t\tvar info_botin = '';\n\t\t\t\tfor (var i = 0; i < 4; i++){\n\t\t\t\t\tinfo_botin += '<img src=\"' + img('r/' + (i + 1) + '.gif') + '\" width=\"18\" height=\"12\" border=\"0\" title=\"' + T('RECURSO' + (i+1)) + '\">';\n\t\t\t\t\tinfo_botin += cantidades_botin[i];\n\t\t\t\t\tif (i < 3) info_botin += ' + '; else info_botin += ' = ';\n\t\t\t\t}\n\t\t\t\tinfo_botin += botin;\n\t\t\t\tb.innerHTML = info_botin;\n\t\t\t}\n\t\t}\n\n\t\tvar perds = new Array();\n\t\tvar carry = new Array();\n\t\t// Por cada participante en la batalla (atacante, defensor y posibles apoyos)\n\t\tfor(var g = 0; g < t.snapshotLength; g++){ \n\t\t\tcarry[g] = 0;\t\n\t\t\tvar tt = t.snapshotItem(g); \n\t\t\tvar num_elementos = tt.rows[1].cells.length - 1;\n\t\t\tfor(var j = 1; j < 11; j++){ \n\t\t\t\t// Recupera la cantidades de tropa de cada tipo que han intervenido\n\t\t\t\tvar u = uc[tt.rows[1].cells[j].getElementsByTagName('img')[0].src.replace(/.*\\/.*\\//,'').replace(/\\..*/,'')]; \n\t\t\t\t\tvar p = tt.rows[3] ? tt.rows[3].cells[j].innerHTML : 0; \n\t\t\t\t// Basandose en el coste por unidad y su capacidad, se calculan las perdidas y la capacidad de carga total\n\t\t\t\tvar ptu = arrayByN(u, p);\n\t\t\t\tperds[g] = arrayAdd(perds[g], ptu.slice(0, 4)); \n\t\t\t\tcarry[g] += (tt.rows[2] ? tt.rows[2].cells[j].innerHTML - p : 0) * u[4];\n\t\t\t}\n\n\t\t\t// Anyade la nueva informacion como una fila adicional en cada tabla\n\t\t\tvar informe = document.createElement(\"TD\");\n\t\t\tfor (var i = 0; i < 4; i++){\n\t\t\t\tinforme.innerHTML += '<img src=\"' + img('r/' + (i + 1) + '.gif') + '\" width=\"18\" height=\"12\" border=\"0\" title=\"' + T('RECURSO' + (i+1)) + '\">';\n\t\t\t\tinforme.innerHTML += perds[g][i];\n\t\t\t\tif (i < 3) informe.innerHTML += ' + '; else informe.innerHTML += ' = ';\n\t\t\t}\t\t\n\t\t\tvar perdidas = arrayToInt(perds[g]);\n\t\t\tinforme.innerHTML += perdidas;\n\t\t\tinforme.colSpan = num_elementos;\n\t\t\tinforme.className = \"s7\";\n\t\t\tvar fila = document.createElement(\"TR\");\n\t\t\tfila.className = \"cbg1\";\n\t\t\tfila.appendChild(elem(\"TD\", T('PERDIDAS')));\n\t\t\tfila.appendChild(informe);\n\t\t\ttt.appendChild(fila);\n\n\t\t\t// Solo para el atacante se calcula y muestra la rentabilidad y eficiencia del ataque\n\t\t\tif (g == 0 && botin != null){\n\t\t\t\tvar datos = document.createElement(\"TD\");\n\t\t\t\tvar fila_datos = document.createElement(\"TR\");\n\t\t\t\tdatos.colSpan = num_elementos;\n\n\t\t\t\t// La rentabilidad muestra el botin en comparacion con las perdidas\n\t\t\t\tvar rentabilidad = Math.round((botin - perdidas) * 100 / botin);\n\t\t\t\tif (botin == 0)\tif (perdidas == 0) rentabilidad = 0; else rentabilidad = -100;\t\n\t\t\t\tdatos.innerHTML = rentabilidad + \"%\";\n\t\t\t\tdatos.className = \"s7\";\n\t\t\t\tfila_datos.className = \"cbg1\";\n\t\t\t\tfila_datos.appendChild(elem(\"TD\", T('RENT')));\n\t\t\t\tfila_datos.appendChild(datos);\n\t\t\t\ttt.appendChild(fila_datos);\n\n\t\t\t\tvar datos = document.createElement(\"TD\");\n\t\t\t\tvar fila_datos = document.createElement(\"TR\");\n\t\t\t\tdatos.colSpan = num_elementos;\n\n\t\t\t\t// La eficiencia muestra el botin en comparacion con la cantidad de tropas utilizadas\n\t\t\t\tvar eficiencia = 100 - Math.round((carry[g] - botin) * 100 / carry[g]);\t\t\t\n\t\t\t\tif (carry[g] == 0) eficiencia = 0;\n\t\t\t\tdatos.innerHTML = eficiencia + \"%\";\n\t\t\t\tdatos.className = \"s7\";\n\t\t\t\tfila_datos.className = \"cbg1\";\n\t\t\t\tfila_datos.appendChild(elem(\"TD\", T('EFICIENCIA')));\n\t\t\t\tfila_datos.appendChild(datos);\n\t\t\t\ttt.appendChild(fila_datos);\n\t\t\t}\n\t\t}\n\t}", "function Incentivo() {\n\n obj = this;\n\n // Public variables\n this.filtro = {\n DATA_INI_INPUT: moment().subtract(3, 'month').toDate(),\n DATA_FIM_INPUT: moment().toDate()\n };\n this.dado = {};\n\n obj.ALTERANDO = false;\n obj.SELECTED = null;\n obj.DADOS = []\n obj.DADOS.push({ID:'', DESCRICAO:'', PERCENTUAL: '',PERCENTUAL_IR:''});\n obj.ORDER_BY = 'ID';\n\n obj.consultar = function(){\n var ds = {\n FLAG : 0\n };\n\n $ajax.post('/_31070/consultar',ds,{contentType: 'application/json'})\n .then(function(response) {\n obj.DADOS = response; \n }\n );\n };\n\n obj.cancelar = function(){\n obj.ALTERANDO = false;\n }\n\n obj.modalIncluir = function(){\n obj.ALTERANDO = false;\n\n obj.NOVO = {\n ID : 0,\n DESCRICAO : '',\n PERCENTUAL : 0,\n PERCENTUAL_IR : 0\n };\n\n $('#modal-incluir').modal(); \n };\n\n obj.modalAlterar = function(){\n obj.ALTERANDO = true;\n\n obj.NOVO = {\n ID : obj.SELECTED.ID,\n DESCRICAO : obj.SELECTED.DESCRICAO,\n PERCENTUAL : Number(obj.SELECTED.PERCENTUAL),\n PERCENTUAL_IR : Number(obj.SELECTED.PERCENTUAL_IR)\n };\n\n $('#modal-incluir').modal(); \n };\n\n obj.incluir = function(){\n addConfirme('<h4>Confirmação</h4>',\n 'Deseja realmente gravar?',\n [obtn_sim,obtn_nao],\n [{ret:1,func:function(){\n var ds = {\n ITEM : obj.NOVO\n };\n\n $ajax.post('/_31070/incluir',ds,{contentType: 'application/json'})\n .then(function(response) {\n obj.consultar();\n $('#modal-incluir').modal('hide'); \n showSuccess('Gravado com sucesso!'); \n obj.ALTERANDO = false; \n }\n );\n }}] \n );\n\n \n };\n\n obj.alterar = function(){\n addConfirme('<h4>Confirmação</h4>',\n 'Deseja realmente gravar?',\n [obtn_sim,obtn_nao],\n [{ret:1,func:function(){\n var ds = {\n ITEM : obj.NOVO\n };\n\n $ajax.post('/_31070/alterar',ds,{contentType: 'application/json'})\n .then(function(response) {\n obj.consultar();\n $('#modal-incluir').modal('hide'); \n showSuccess('Alterado com sucesso!');\n obj.ALTERANDO = false; \n }\n );\n }}] \n );\n };\n\n obj.excluir = function(){\n addConfirme('<h4>Confirmação</h4>',\n 'Deseja realmente excluir o incentivo ('+obj.SELECTED.DESCRICAO+')?',\n [obtn_sim,obtn_nao],\n [{ret:1,func:function(){\n var ds = {\n ITEM : obj.SELECTED\n };\n\n $ajax.post('/_31070/excluir',ds,{contentType: 'application/json'})\n .then(function(response) {\n obj.consultar();\n showSuccess('Excluido com sucesso!'); \n obj.ALTERANDO = false; \n }\n ); \n }}] \n );\n };\n\n obj.consultar();\n }", "function obtenerTotCie(filters) {\n $scope.promiseCie = partPendientesViService\n .obtenerTotCie(filters)\n .then( res => {\n $scope.totCieGrid.data = res;\n $scope.totCieGrid.count = res.length;\n //$scope.totCieGrid.cantidadTotal = 0;\n //$scope.totCieGrid.importeTotal = 0;\n //res.forEach(function(obj){$scope.totCieGrid.cantidadTotal+=obj.cant;$scope.totCieGrid.importeTotal+=obj.importe; });\n $(\".md-head md-checkbox\").hide();\n })\n .catch( err => Toast.showError(err,'Error'));\n }", "function verUsuariosAnamnesis() {\n\n borrarMarca();\n borrarMarcaCalendario();\n\n let contenedor = document.createElement(\"div\");\n contenedor.setAttribute('class', 'container-fluid');\n contenedor.setAttribute('id', 'prueba');\n let titulo = document.createElement(\"h1\");\n titulo.setAttribute('class', 'h3 mb-2 text-gray-800');\n let textoTitulo = document.createTextNode('ANAMNESIS');\n let parrafoTitulo = document.createElement(\"p\");\n parrafoTitulo.setAttribute('class', 'mb-4');\n let textoParrafo = document.createTextNode('CREACION DE ANAMNESIS');\n let capa1 = document.createElement(\"div\");\n capa1.setAttribute('class', 'card shadow mb-4');\n let capa2 = document.createElement(\"div\");\n capa2.setAttribute('class', 'card-header py-3');\n let tituloCapas = document.createElement(\"h6\");\n tituloCapas.setAttribute('class', 'm-0 font-weight-bold text-primary');\n let textoTituloCapas = document.createTextNode('Información de Usuarios');\n let cuerpo = document.createElement(\"div\");\n cuerpo.setAttribute('class', 'card-body');\n let tablaResponsiva = document.createElement(\"div\");\n tablaResponsiva.setAttribute('class', 'table-responsive');\n let tablas = document.createElement(\"table\");\n tablas.setAttribute('class', 'table table-bordered');\n tablas.setAttribute('id', 'dataTable');\n tablas.setAttribute('width', '100%');\n tablas.setAttribute('cellspacing', '0');\n\n let principal = document.getElementsByClassName(\"marca\");\n principal[0].appendChild(contenedor);\n contenedor.appendChild(titulo);\n titulo.appendChild(textoTitulo);\n contenedor.appendChild(parrafoTitulo);\n parrafoTitulo.appendChild(textoParrafo);\n contenedor.appendChild(capa1);\n capa1.appendChild(capa2);\n capa2.appendChild(tituloCapas);\n tituloCapas.appendChild(textoTituloCapas);\n capa1.appendChild(cuerpo);\n cuerpo.appendChild(tablaResponsiva);\n tablaResponsiva.appendChild(tablas);\n\n let httpRequest = new XMLHttpRequest();\n httpRequest.open('POST', '../consultas_ajax.php', true);\n httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\n httpRequest.onreadystatechange = function () {\n if (httpRequest.readyState === 4) {\n if (httpRequest.status === 200) {\n document.getElementById('dataTable').innerHTML = httpRequest.responseText;\n }\n }\n };\n httpRequest.send('verUsuariosAnamesis=');\n\n\n}", "function CaricaDati() {\n\n\t// Vengono caricate tutte le piazzole\n\turl = \"api/?method=piazzole&format=json\";\n\t$.getJSON(url, function(data) {\n\t\t\n\t\t// Questo contatore serve per allineare a destra ed a sinistra le piazzole\n\t\t// man mano che vengono caricate. NON usare il numero di piazzola: se non \n\t\t// ci fossero tutte, si creerebbe un disallinemaneto nell'impaginazione. \n\t\tvar piazzolaVideo = 1;\n\t\t$.each(data.data, function(key, val) {\n\t\t\tvar PiazzolaCorrente = val.Piazzola;\n\t\t\tvar PiazzolaPrecedente = sessionStorage.PiazzolaPrecedente;\n\t\t\t\n\t\t\tvar idPiazzola = \"Piazzola\" + PiazzolaCorrente;\n\t\t\t\n\t\t\t// Al cambio del numero piazzola (o al primo ingresso nella funzione)\n\t\t\t// viene stampata la tabella senza righe. Verranno aggiunte successivamente.\n\t\t\tif (PiazzolaPrecedente != PiazzolaCorrente) {\n\t\t\t\tsessionStorage.PiazzolaPrecedente = PiazzolaCorrente;\n\t\t\t\tvar allineamento = (piazzolaVideo++ % 2 == 1 ? \"dispari\" : \"pari\");\n\t\t\t\tvar table = \"<table class='tbpiazzola \" + allineamento + \"' id='\" + idPiazzola + \"''><thead><tr><td>Piazzola \" + PiazzolaCorrente + \"</td></tr></thead><tbody></tbody></table>\";\n\t\t\n\t\t\t\t$('#boxInterno').append( table);\n\t\t\t}\n\t\t\t\n\t\t\t// Aggiunta righe\n\t\t\t$('#' + idPiazzola).append('<tr><td>' + toTitleCase(val.Cognome) + ' ' + toTitleCase(val.Nome) + '</td></tr>');\n\t\t\t\t\n\t\t\t\n\t\t});\n\t\n\t});\n\n}", "function iniciarListaBusqueda(){\n var ciclos = selectDatoErasmu();\n for(var aux = 0, help = 0 ; aux < erasmu.length ; aux++){\n if(ciclos.indexOf(erasmu[aux].ciclo) != -1){\n crearListErasmu(erasmu[aux]);\n }\n }\n}", "abrirSessao(bd, usuario, hashSenha) {\n var resLogin = [];\n var papelUsuario = \"\";\n var colunasProjetadas = [\"nomeusuario\", \"senha\", \"carteira\"];\n var nomeColunaCarteira = \"carteira\";\n\n configuracoes.tabelas.forEach(function (nomeTabela, indice) {\n var resLoginTemp = interfaceBD.select(\n bd,\n nomeTabela,\n colunasProjetadas,\n { nomeusuario: usuario, senha: hashSenha },\n 1\n );\n if (resLoginTemp != null) {\n resLogin = resLogin.concat(resLoginTemp);\n if (resLoginTemp.length && papelUsuario === \"\")\n papelUsuario = nomeTabela;\n }\n console.log(\n `A saida da tabela ${nomeTabela} foi: ${resLoginTemp}\\nE possui comprimento de ${resLoginTemp.length}`\n );\n });\n\n console.log(\n `A saida das tabelas foi: ${resLogin}\\nE possui comprimento de ${resLogin.length}`\n );\n\n if (resLogin != null && resLogin != {}) {\n if (resLogin.length > 0) {\n return {\n estado: \"aberta\",\n conteudo: resLogin,\n papelUsuario: papelUsuario,\n carteiraUsuario:\n resLogin[0][colunasProjetadas.indexOf(nomeColunaCarteira)],\n horaAbertura: new Date(),\n };\n }\n /*return ContentService.createTextOutput(\n JSON.stringify({ nome: \"isaias\" })\n ).setMimeType(ContentService.MimeType.JSON);*/\n }\n\n return { estado: \"fechada\", conteudo: [], horaAbertura: new Date() };\n }", "async function getData() {\n let cleanService = await CleanServiceModel.getCleanServiceById(id);\n setDitta(cleanService.ditta);\n setEmail(cleanService.email);\n setTelefono(cleanService.numeroTel);\n setDataAssunzione((new Date(cleanService.dataAssunzione.seconds * 1000)).toLocaleString(\"it-IT\").split(\",\")[0]);\n }", "function cargarCgg_titulo_profesionalCtrls(){\n\t\tif(inRecordCgg_titulo_profesional){\n\t\t\ttxtCgtpr_codigo.setValue(inRecordCgg_titulo_profesional.get('CGTPR_CODIGO'));\n\t\t\tcodigoNivelEstudio = inRecordCgg_titulo_profesional.get('CGNES_CODIGO');\t\t\t\n\t\t\ttxtCgnes_codigo.setValue(inRecordCgg_titulo_profesional.get('CGNES_DESCRIPCION'));\n\t\t\ttxtCgtpr_descripcion.setValue(inRecordCgg_titulo_profesional.get('CGTPR_DESCRIPCION'));\n\t\t\tisEdit = true;\n\t\t\thabilitarCgg_titulo_profesionalCtrls(true);\n\t}}", "function consultarCandidataC2()\n{\n con.query(\"SELECT candidata.*, categoria.nom_cat FROM candidata INNER JOIN categoria ON candidata.fky_cat=categoria.cod_cat WHERE est_can='A' AND fky_cat='2'\", function (err, result, fields) \n {\n if (err) console.log(err);\n\n var tam = result.length;\n var text;\n text = \"<tr>\"; \n\n for (i = 0; i < tam; i++) \n {\n text += \"<td>\";\n text += result[i].cod_can;\n text += \"</td>\";\n text += \"\\t\\t\";\n text += \"<td>\";\n text += result[i].ci_can;\n text += \"</td>\";\n text += \"\\t\\t\";\n text += \"<td>\";\n text += result[i].nom_can;\n text += \"</td>\";\n text += \"\\t\\t\";\n text += \"<td>\";\n text += result[i].ape_can;\n text += \"</td>\";\n text += \"\\t\\t\";\n text += \"<td>\";\n text += result[i].edad_can;\n text += \"</td>\";\n text += \"\\t\\t\";\n text += \"<td>\";\n text += result[i].nom_cat;\n text += \"</td>\";\n text += \"</tr>\";\n document.getElementById(\"tcandidata\").innerHTML = text;\n } \n });\n}", "function mostrarVentanaInicio(){\n\t//verificar el rol\n\tif (datosUsuario[0][\"idRol\"] == 3) {\n\t\tmostrarVentanaChef1(datosUsuario[0][\"nombre\"]);\t// Invoca la ventana de Cocina y envia nombre del empleado\n\t}\n\telse if(datosUsuario[0][\"idRol\"] == 2) {\n\t\tmostrarVentanaCajero(datosUsuario[0][\"nombre\"]);\t//Invoca la ventana de Cajero y envia nombre del empleado\n\t}\n\telse{\n\t\tmostrarVentanaMesero(datosUsuario[0][\"nombre\"]);\t//Invoca la ventana de Mesero y envia nombre del empleado\n\t}\n\n}", "function crearNotaCredito(cabecera,miventa){\n var contenido= '<div class=\"card\" style=\"width: 20rem;\">'+\n '<div class=\"card-body\">'+ \n '<div><center> <b> FARMACIA COMUNITARIA PUYO </b></center> </div>'+ \n ' <center><div>R.U.C:'+ cabecera[0].RUC_AGE+' </div> </center>'+\n ' <center><div>'+ cabecera[0].DIRECCION_AGE+' </div> </center>'+\n '<div id=\"numfac\">Nota de Crédito: 0000'+miventa[0].NUMERO_COM+'</div>'+ \n '<div id=\"numfac\">Factura Anulada: 000'+miventa[0].NUM_FAC+'</div>'+ \n '<div>Fecha: '+miventa[0].FECHA_COM+' Codigo_NC: '+miventa[0].ID_COM+'</div>'+\n // '<div>'+document.getElementById(\"dtruc\").innerHTML+'</div>'+\n // '<div> '+document.getElementById(\"dtcliente\").innerHTML+'</div>'+\n //'<div>Motivo de Anulación:'+midev[0].OBSERVACION_COMP+'</div>'+ \n '<table class=\"table table-sm\">'+\n '<tr style=\"font-size: smaller;\">'+\n '<th>Motivo de anulación</th>'+\n //'<th>Cantidad</th>'+\n //'<th>Pre.Uni</th>'+\n '<th>Pre.Total</th>'+\n '</tr> <tbody>'+\n ' <tr> <td>'+ document.getElementById(\"MOTIVO\").value +'</td> ' +\n ' <td>'+ document.getElementById(\"TOTAL_VEN\").value +'</td> </tr>';\n //ID_DET_DEV_VEN, DESCRIPCION_PRO, ID_DEV_VEN, CANTIDAD, PRECIO_VEN, SUBTOTAL, PRODUCTO, OBSERVACION_DEV, ID_DET_VEN\n /* for (let i = 0; i < misdetalles.length; i++) {\n var fila= '<tr style=\"font-size: smaller;\">'+\n '<td>'+misdetalles[i].DESCRIPCION_PRO+'</td>'+\n '<td>'+misdetalles[i].CANTIDAD+'</td>'+\n '<td>'+misdetalles[i].PRECIO_VEN+'</td>'+\n '<td>'+misdetalles[i].SUBTOTAL+'</td>'+\n '</tr>';\n contenido+=fila;\n \n }*/\n \n contenido+='</tbody>'+\n '</table>'+\n '<table class=\"table table-sm\" style=\"font-size: smaller;\">'+\n '<tr>'+\n \n \n '<th>TOTAL</th>'+\n '<th>'+document.getElementById(\"TOTAL_VEN\").value+'</th>'+\n '</tr>'+\n ' </table>'+\n ' <hr>'+\n '<div class=\"datosv\" style=\"font-size: smaller;\">Anulado por:'+ document.getElementById(\"h6UserName\").innerHTML +' </div>'+\n ' <div class=\"datosv\" style=\"font-size: smaller;\">'+cabecera[0].DESCRIPCION_CAJA+'</div>'+\n '</div>'+\n '</div>';\n document.getElementById(\"ridenc\").innerHTML=contenido;\n}", "function renderPorSucursal() {\n var ventasPorSucursal = [];\n for (i = 0; i < local.sucursales.length; i++) {\n ventasPorSucursal.push('Total de ' + local.sucursales[0] + ': ' + ventasSucursal(local.sucursales[0]));\n ventasPorSucursal.push(' Total de ' + local.sucursales[1] + ': ' + ventasSucursal(local.sucursales[1]));\n //intenté mil veces con ventasPorSucursal.push('Total de ' + local.sucursales[i] + ': ' + ventasSucursal(local.sucursales[i])) pero no funciona\n } return 'Ventas por sucursal: ' + ventasPorSucursal;\n}", "afficheResultat(){\n alert(this.resultat);\n console.log(this.tableau);\n }", "function auditorias(fecha, codigo){\n\t\t$.ajax({\t\t\t\t\t \n\t\t\t\t\t type:\"POST\",\n\t\t\t\t\t url: \"auditoria5_epl.php\",\n\t\t\t\t\t data: \"fecha=\"+fecha+\"&codigo=\"+codigo,\n\t\t\t\t\t\t\t beforeSend:function(){\n\t\t\t\t\t\t\t$(\"#contenido2\").html(\"\");\n\t\t\t\t\t\t\t\n\t\t\t\t\t },\n\t\t\t\t\t success: function (datos){\n\t\t\t\t\t \n\t\t\t\t\t\t\t//console.log(datos);return false;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t//INICIO DE TABLA\t \n\t\t\t\t\t\n\t\t\t\t\t\t\t//THEAD\n\t\t\t\t\t\t\tvar table=\"<div style='width:30%'><table style='color: rgb(41, 76, 139) !important; width: 100%' cellpadding='0' cellspacing='0' border='1' class='display' id='example2'>\";\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\ttable+=\"<thead style='background-color: rgb(41, 76, 139); font-size: 13px; color: #fff; font-weight:bold;'>\";\t\n\n\t\t\t\t\t\t\ttable+=\"<tr>\";\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\ttable+=\"<td align='center'>Turno</td><td align='center'>Hora Inicio</td><td align='center'>Hora Fin&nbsp;&nbsp;&nbsp;</td><td align='center'>Horas</td>\";\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\ttable+=\"</tr>\";\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\ttable+=\"</thead>\";\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//FIN THEAD\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//TBODY\n\t\t\t\t\t\t\t\t\ttable+=datos;\n\t\t\t\t\t\t\t\t\t//console.log(datos);\n\t\t\t\t\t\t\t\t\t//return false;\n\t\t\t\t\t\t\t//FIN TBODY\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\ttable+=\"</table></div><br><br>\";\n\t\t\t\t\t\n\t\t\t\t\t\t\t//FIN TABLA\n\t\t\t\t\t\n\t\t\t\t\t\t\t$(\"#contenido2\").html(table);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//Aca va el datable porque se crea example y ahi si con ese example hagame esta accion\n\t\t\t\t\t\t\t$('#example2').dataTable({\n\n\t\t\t\t\t\t\t\t\"bLengthChange\": false,\n\t\t\t\t\t\t\t\t\"bSort\": false,\n\t\t\t\t\t\t\t\t\"bPaginate\": true,\n\t\t\t\t\t\t\t\t\"bInfo\": false,\n\t\t\t\t\t\t\t\t\"bFilter\": false,\n\t\t\t\t\t\t\t\t\"oLanguage\": {\n\t\t\t\t\t\t\t\t\t\t\"sProcessing\": \"Procesando...\",\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\"sZeroRecords\": \"No se encontraron resultados\",\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\"sInfoEmpty\": \"No existen registros\",\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\"oPaginate\": {\n\t\t\t\t\t\t\t\t\t\t\t\"sFirst\": \"Primero\",\n\t\t\t\t\t\t\t\t\t\t\t\"sPrevious\": \"Anterior\",\n\t\t\t\t\t\t\t\t\t\t\t\"sNext\": \"Siguiente\",\n\t\t\t\t\t\t\t\t\t\t\t\"sLast\": \"Último\"\n\t\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\n\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\t\n\t\t\t\t});\t\t\n}", "function asociarCursosCarrera() {\n let codigoCarrera = guardarCarreraAsociar();\n\n let carrera = buscarCarreraPorCodigo(codigoCarrera);\n\n let cursosSeleccionados = guardarCursosAsociar();\n\n\n\n let listaCarrera = [];\n\n let sCodigo = carrera[0];\n let sNombreCarrera = carrera[1];\n let sGradoAcademico = carrera[2];\n let nCreditos = carrera[3];\n let sVersion = carrera[4];\n let bAcreditacion = carrera[5]\n let bEstado = carrera[6];\n let cursosAsociados = cursosSeleccionados;\n let sedesAsociadas = carrera[8];\n\n if (cursosAsociados.length == 0) {\n swal({\n title: \"Asociación inválida\",\n text: \"No se le asignó ningun curso a la carrera.\",\n buttons: {\n confirm: \"Aceptar\",\n },\n });\n } else {\n listaCarrera.push(sCodigo, sNombreCarrera, sGradoAcademico, nCreditos, sVersion, bAcreditacion, bEstado, cursosAsociados, sedesAsociadas);\n actualizarCarrera(listaCarrera);\n\n swal({\n title: \"Asociación registrada\",\n text: \"Se le asignaron cursos a la carrera exitosamente.\",\n buttons: {\n confirm: \"Aceptar\",\n },\n });\n limpiarCheckbox();\n }\n}", "function loadTotalreclamacoes() {\n api.get('/api/reclamacoes/total_por_mes/')\n .then(resp => {\n const data = resp.data\n setTotalMesreclamacao(data)\n\n })\n\n }", "function actualitzaCopia ()\r\n{\r\n this.capa.innerHTML =insertTable (this.correcte + \"&nbsp;\",this.actual + this.putCursor ('black'), this.estil);\r\n}", "function busca(busca) {\n $.ajax({\n type: \"POST\",\n url: \"acoes/select.php\",\n dataType: \"json\",\n data: {//tipo de dado\n 'busca':\"busca\"//botão pra inicia a ação\n }\n\n }).done(function (resposta) { //receber a resposta do busca\n console.log('encontrei ' + resposta.quant + ' registros');\n console.log(resposta.busca[0,'0'].id, resposta.busca[0,'0'].descri);\n if(resposta.erros){\n\n //criação das variaves apos o receber a resposta da pagina select\n for (let i = 0; i < resposta.quant; i++) {\n var id = resposta.busca[i]['0']\n var desc = resposta.busca[i]['1']\n var mar = resposta.busca[i]['2']\n var mod = resposta.busca[i]['3']\n var tpv = resposta.busca[i]['4']\n var qntp = resposta.busca[i]['5']\n var vlv = resposta.busca[i]['6']\n var vlc = resposta.busca[i]['7']\n var dtc = resposta.busca[i]['8']\n var st = resposta.busca[i]['9']\n //criação da tabela para exebição do resultado\n $('.carro td.descri').append(\" <tr><td ><p class=' text-capitalize id='des' value='\"+desc+\"'>\"+desc +'</p></td></tr>')\n $('.carro td.marca').append(\" <tr><td ><p class=' text-capitalize id='mar' value='\"+mar+\"'>\"+mar +'</p></td></tr>')\n $('.carro td.modelo').append(\" <tr><td ><p class=' text-capitalize id='mod' value='\"+mod+\"'>\"+mod +'</p></td></tr>')\n $('.carro td.tipov').append(\" <tr><td ><p class=' text-capitalize id='tpv' value='\"+tpv+\"'>\"+tpv +'</p></td></tr>')\n $('.carro td.quantp').append(\" <tr><td ><p class=' text-capitalize id='qnt' value='\"+qntp+\"'>\"+qntp +'</p></td></tr>')\n $('.carro td.vlvenda').append(\" <tr><td ><p class=' text-capitalize id='vlv' value='\"+vlv+\"'>\"+vlv +'</p></td></tr>')\n $('.carro td.vlcompra').append(\" <tr><td ><p class=' text-capitalize id='vlc' value='\"+vlc+\"'>\"+vlc +'</p></td></tr>')\n $('.carro td.dtcompra').append(\" <tr><td ><p class=' text-capitalize id='dtc' value='\"+dtc+\"'>\"+dtc +'</p></td></tr>')\n $('.carro td.estato').append(\" <tr><td ><p class=' text-capitalize id='st' value='\"+st+\"'>\"+st +'</p></td></tr>')\n $('.carro td.id').append(\" <tr><td ><button class='r btn btn-sm btn-primary nav-link' id='idvalor' type='button' data-toggle='modal' data-target='#atualFormulario' value='\"+id+\"'>\"+\"Edit\"+'</button></td></tr>')\n $('.carro td.ider').append(\"<tr><td ><button class='del btn btn-sm btn-danger nav-link' type='button' name='idel' value='\"+id+\"'>\"+\"Del\"+'</button></td></tr>')\n\n\n }\n\n\n //função pra por valores da tabela no input do formulario de atualização\n //aqui insere os o ID no formulario de atualização\n $('.r').click('button',function() {\n var idvl = $(this).val();\n $('#i1'). val(idvl);\n for (let i = 0; i < resposta.quant; i++) {\n var id = resposta.busca[i]['0']\n var desc = resposta.busca[i]['1']\n var mar = resposta.busca[i]['2']\n var mod = resposta.busca[i]['3']\n var tpv = resposta.busca[i]['4']\n var qnt = resposta.busca[i]['5']\n var vlv = resposta.busca[i]['6']\n var vlc = resposta.busca[i]['7']\n var dtc = resposta.busca[i]['8']\n var sta = resposta.busca[i]['9']\n //aqui comparamos o valor que recuperamos o id da tabela e comparfamos com o id da função busca\n if (idvl==id) {\n $('#descri1'). val(desc);\n $('#marca1'). val(mar);\n $('#modelo1'). val(mod);\n $('#tipov1'). val(tpv);\n $('#quantp1'). val(qnt);\n $('#vlvenda1'). val(vlv);\n $('#vlcompra1'). val(vlc);\n $('#dtcompra1'). val(dtc);\n $('#estato1'). val(sta);\n console.log(idvl);\n\n }\n\n\n\n\n\n }\n })\n //aqui finda\n\n //deleta via ajax\n $('.del').click('button',function() {\n var idel = $(this).val();\n console.log(idel);\n $.ajax({\n url: \"acoes/del.php\",\n type: \"POST\",\n data : { 'idel': idel },\n success: function(data)\n {\n location.reload(\".carro\");//atualiza o contener apos a execução com sucesso\n }\n });\n }); // delete close\n\n\n }\n })\n }", "function MelhorResult(){\n\tconsole.info(Cidade);\n\tvar CidadeTOP = new Object();\n for(var cont=0;cont<Cidade.length;cont++){\n if(CidadeTOP.aptidao>Cidade[cont].aptidao || CidadeTOP.aptidao == null){\n CidadeTOP = new Object(Cidade[cont]);\n }\n }\n\tconsole.log(\"Individuo mais qualificado:\");\n\tconsole.info(CidadeTOP);\n\tconsole.log(\"Nº Pessoas: \"+Cidade.length);\n}", "function mostrarSucursalesProvs(id, idTrabajo){\n\t$('.collapse').collapse('hide');\n\t$('#collapse'+id).collapse('show');\n\n\tvar provData = {\n\t\ttrab: idTrabajo,\n\t\tidprov: idClienteGLOBAL\n\t}\n\t$.ajax({\n\t\turl:'routes/routeFormcliente.php',\n\t\ttype:'post',\n\t\tasync: true,\n\t\tdata: {info: provData, action: 'sucursalesProv'},\n\t\tdataType:'JSON',\n\t\tbeforeSend: function(){\n\t\t\t$('#tablaSucs'+id).html('');\n\t\t\t$('#tablaSucs'+id).hide();\n\t\t\tvar tabla = tablaProvs.replace(\"*ID*\", id);\n\t\t\t$('#tablaSucs'+id).append(tabla);\n\t\t},\n\t\terror: function(error){\n\t\t\tconsole.log(error);\n\t\t\ttoast1(\"Error!\", ajaxError, 8000, \"error\");\n\t\t},\n\t\tsuccess: function(data){\n\t\t\tif(data != \"\"){\n\t\t\t\tvar tabla = \"\";\n\t\t\t\t$.each(data, function (val, key){\n\t\t\t\t\tvar accionBtn = \"\";\n\t\t\t\t\tif(key.tipo === \"Perifoneo\")\n\t\t\t\t\t\taccionBtn = \"accionTrabPerif\";\n\t\t\t\t\telse\n\t\t\t\t\t\taccionBtn = \"accionTrab\";\n\n\t\t\t\t\tvar estilo = \"\";\n\t\t\t\t\tvar boton = \"\";\n\t\t\t\t\tif(key.status === \"4\"){\n\t\t\t\t\t\testilo = \"success\";\n\t\t\t\t\t\tboton = '<button onclick=\"configFechas(' + key.idtrabajo+ ',' + key.idsucursal + ')\" class=\"btn btn-xs btn-default\">&nbsp;<span class=\"glyphicon glyphicon-cog\"></span>&nbsp;Config/Editar Trabajo&nbsp;</button>';\n\t\t\t\t\t//}else if(key.status === \"6\"){\n\t\t\t\t\t\t//estilo = \"success\";\n\t\t\t\t\t\t//boton = '<button class=\"btn btn-xs btn-success\" onclick=\"verEstadistica('+key.idsucursal+')\"><span class=\"fa fa-area-chart\"></span> Trab. Iniciado</button>';\n\t\t\t\t\t}else if(key.status === \"7\"){\n\t\t\t\t\t\testilo = \"active\";\n\t\t\t\t\t\tboton = '<button class=\"btn btn-xs btn-primary\">Completado</button>';\n\t\t\t\t\t}else{\n\t\t\t\t\t\testilo = \"warning\";\n\t\t\t\t\t\tboton = '<button class=\"btn btn-xs btn-warning\">En Revisión</button>';\n\t\t\t\t\t}\n\t\t\t\t\ttabla += '<tr class=\"' + estilo + '\"><td>' + key.nombre + '</td><td>' + /*key.cantidad*/ key.cantprov + '</td><td id=\"tipo_' + key.idtrabajo + '\">' + key.tipo + '</td><td>' + key.vigencia + '</td><td>' + boton + '</td><td><button class=\"btn btn-xs btn-primary\" onclick=\"' + accionBtn + '(' + key.idtrabajo + ',' + key.idsucursal + ',' + \"'detallesTrab'\" + ')\">Detalle</button></td><td><button class=\"btn btn-xs btn-info\" onclick=\"zonasSucursal('+ key.idsucursal +')\">Zonas</button></td></tr>';\n\t\t\t\t});\n\t\t\t\t$('#sucs'+id).html('');\n\t\t\t\t$('#sucs'+id).append(tabla);\n\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t$('#tablaSucs'+id).show(200);\n\t\t\t\t}, 200);\n\t\t\t}else{\n\t\t\t\ttoast1(\"Atencion!\", \"No hay datos para mostrar\\n\\n<b>Pongase en contacto con el administrador para revisar el avanze de este trabajo.</b>\", 8000, \"default\");\n\t\t\t}\n\t\t}\n\t});\n}", "totalContenu() {\n console.log(`Il y a ${this.contenu.length} personne(s) dans le/la ${this.nom}`);\n }", "function verEstadistica(idTrab, idSuc){\n\tvar contenido = \"\";\n\tvar est = {\n\t\tserv: idTrab,\n\t\tsuc: idSuc\n\t};\n\tshowSpinner();\n\t$.ajax({\n\t\turl:'routes/routeFormcliente.php',\n\t\ttype:'post',\n\t\tdata: {info: est ,action: 'getEstadistica'},\n\t\tdataType:'json',\n\t\terror: function(error){\n\t\t\tconsole.log(error);\n\t\t\tremoveSpinner();\n\t\t},\n\t\tsuccess: function(data){\n\t\t\tconsole.log(data)\n\t\t\tvar porcentaje = 100 / data.length;\n\t\t\tvar valorBarra = 0;\n\t\t\tvar tabla = \"\";\n\t\t\t// CREACION DECORATIVA DEL COLOR DE LA BARRA\n\t\t\tvar estilo = \"\";\n\t\t\tvar num = Math.floor((Math.random() * 5) + 1);\n\t\t\tif(parseInt(num) === 1)\n\t\t\t\testilo = \"success\";\n\t\t\telse if(parseInt(num) === 2)\n\t\t\t\testilo = \"info\";\n\t\t\telse if(parseInt(num) === 3)\n\t\t\t\testilo = \"primary\";\n\t\t\telse if(parseInt(num) === 4)\n\t\t\t\testilo = \"warning\";\n\t\t\telse if(parseInt(num) === 5)\n\t\t\t\testilo = \"danger\";\n\n\t\t\t$.each(data, function (val, key){\n\t\t\t\ttabla += '<tr><td>' + key.nombre + '</td><td>' + key.txtsucursal + '</td>';\n\t\t\t\tif(parseInt(key.status) === 0){\n\t\t\t\t\tvalorBarra += parseFloat(porcentaje);\n\t\t\t\t\ttabla += '<td><span class=\"label label-success\">Terminado</span></td>';\n\t\t\t\t}else if(parseInt(key.status) === 1){\n\t\t\t\t\ttabla += '<td><span class=\"label label-default\">Sin terminar</span></td></tr>';\n\t\t\t\t}else if(parseInt(key.status) === 2){\n\t\t\t\t\ttabla += '<td><span class=\"label label-info\">En proceso</span></td></tr>';\n\t\t\t\t}\n\t\t\t});\n\t\t\tcontenido = '<div class=\"panel panel-default\">'+\n\t\t\t\t\t\t\t'<div class=\"panel-body\">'+\n\t\t\t\t\t\t\t\t'<p><b>NOTA: </b>Los valores mostrados estan sujetos a cambios conforme los proveedores vayan iniciando las labores de entrega de volanteo/perifoneo. Consulte con el administrador para más información.</p>'+\n\t\t\t\t\t\t\t\t'<div class=\"table-responsive\">'+\n\t\t\t\t\t\t\t\t\t'<table class=\"table table-bordered\">'+\n\t\t\t\t\t\t\t\t\t\t'<thead><tr><th>Proveedor</th><th>Sucursal</th><th>Status</th></tr></thead>'+\n\t\t\t\t\t\t\t\t\t\t'<tbody>'+tabla+'</tbody>'+\n\t\t\t\t\t\t\t\t\t'</table>'+\n\t\t\t\t\t\t\t\t'</div>'+\n\t\t\t\t\t\t\t\t'<p><b>Porcentaje de progreso: </b>'+valorBarra.toFixed(2)+'%</p>'+\n\t\t\t\t\t\t\t\t'<div class=\"progress\">'+\n\t\t\t\t\t\t\t\t\t'<div class=\"progress-bar progress-bar-'+estilo+' progress-bar-striped active\" role=\"progressbar\" aria-valuenow=\"'+parseFloat(valorBarra)+'\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: '+parseFloat(valorBarra)+'%\"></div>'+\n\t\t\t\t\t\t\t\t'</div>'+\n\t\t\t\t\t\t\t\t'<button onclick=\"cerrarEstadistica()\" class=\"btn btn-xs btn-primary\">Cerrar ventana</button>'+\n\t\t\t\t\t\t\t'</div>'+\n\t\t\t\t\t\t'</div>';\n\n\t\t\tPNotify.removeAll();\n\t\t\tnew PNotify({\n\t\t\t title: 'Progreso de trabajo N° ' + idTrab,\n\t\t\t text: contenido,\n\t\t\t hide: false,\n\t\t\t width: '600px'\n\t\t\t});\n\t\t\tremoveSpinner();\n\t\t}\n\t});\n}", "function obtener_cursos_guardados() {\n var consulta = conexion_ajax(\"/servicios/dh_cursos.asmx/obtener_datos_cursos\")\n $(\".datos_curso\").remove()\n $.each(consulta, function (index, item) {\n\n var filla = $(\"<tr class='datos_curso'></tr>\")\n filla.append($(\"<td></td>\").append(item.id_curso).css({\"width\":\"30px\",\"text-align\":\"center\"}))\n filla.append($(\"<td></td>\").append(item.nombre_curso))\n filla.append($(\"<td></td>\").append(item.puesto_pertenece).css({ \"text-align\": \"center\" }))\n filla.append($(\"<td></td>\").append(\n (function (valor) {\n var dato;\n $(\"#puestos option\").each(function (index, item) {\n if (valor == parseInt($(this).attr(\"name\")))\n dato = $(this).val();\n })\n return dato;\n }(item.puesto_pertenece))\n ))\n filla.append($(\"<td></td>\").append(\n (function (estatus) {\n if (estatus == \"v\" || estatus==\"V\")\n return \"vigente\";\n else if (estatus == \"c\" || estatus == \"C\")\n return \"cancelado\"\n else return \"indefinido\"\n }(item.estatus))\n ).css({ \"text-align\": \"center\" }))\n $(\"#tabla_cursos\").append(filla)\n })\n filtrar_tabla_cursos();\n //funcion onclick tabla Cursos\n $(\".datos_curso\").on(\"click\", function () {\n Habilitar_bloquear_controles(true);\n var consulta = { \n id_curso: \"\"\n , nombre_curso: \"\"\n , estatus: \"\"\n , puesto_pertenece: \"\"\n };\n $(this).children(\"td\").each(function (index, item) {\n switch (index) {\n case 0:\n consulta.id_curso = $(this).text();\n case 1:\n consulta.nombre_curso = $(this).text();\n case 3:\n consulta.puesto_pertenece = $(this).text();\n case 4:\n consulta.estatus = $(this).text();\n } \n })\n\n $(\"#folio_curso\").val(consulta.id_curso)\n $(\"#Nombre_curso\").val(consulta.nombre_curso)\n $(\"#estatus_cusro\").val(\n (function (estatus) {\n if (estatus == \"vigente\")\n return \"V\";\n else if (estatus == \"cancelado\")\n return \"C\"\n else return \"\"\n }(consulta.estatus))\n )\n $(\"#selector_puestos\").val(consulta.puesto_pertenece)\n $(\".datos_curso\").removeClass(\"seleccio_curso\")\n $(this).toggleClass(\"seleccio_curso\")\n // checar_imagen_cambio();\n obtener_imagen()\n })\n \n}", "rellenarCampos(datos){\n this.tituloInput.value = datos.titulo;\n this.cuerpoInput.value = datos.cuerpo;\n this.idInput.value = datos.id;\n this.estado = \"editar\";\n this.cambiarEstado(this.estado);\n }", "function cargarTableEstu(){\n\t$(\"#TDataEstudiante\").DataTable({\n\t\t\"ajax\": {\n\t\t\t\"method\" : \"Get\",\n\t\t\t\"url\" : \"/grupoestudiantes/allEstudiantes\"\n\t\t\t\t},\n\t\t\"columns\" :[{\n\t\t\t\"data\" : \"id_estudiante\"\n\t\t},{\n\t\t\t\"data\" : \"nombre\"\n\t\t},{\n\t\t\t\"data\" : \"apellido\"\n\t\t},{\n\t\t\t\"data\" : \"id_institucion\"\n\t\t},{\n\t\t\t\"data\" : \"opciones\"\n\t\t}],\n\t\t\n\t\t\"language\" : {\n \"lengthMenu\" : \"Mostrar _MENU_ \",\n \"zeroRecords\" : \"Datos no encontrados\",\n \"info\" : \"Mostar páginas _PAGE_ de _PAGES_\",\n \"infoEmpty\" : \"Datos no encontrados\",\n \"infoFiltered\" : \"(Filtrados por _MAX_ total registros)\",\n \"search\" : \"Buscar:\",\n \"paginate\" : {\n \"first\" : \"Primero\",\n \"last\" : \"Anterior\",\n \"next\" : \"Siguiente\",\n \"previous\" : \"Anterior\"\n },\n }\n\t});\n}", "function dataOR (req, res) {\n\n\tvar bd = \"db\"+req.cookies.isowin_al.substring(0,6); //En server\n\tconnection.query(\"USE \"+bd);\n\tconsole.log(bd+\" dataOR(): Iniciando... \");\n\n\tconnection.query('SELECT pue4 c1, GROUP_CONCAT(pue0) c2, GROUP_CONCAT(pue1) c3 FROM pue GROUP BY pue4 ORDER BY pue4 ASC',\n\t\tfunction selectCC(err, results, fields) {\n\t\t\tif (err) {throw err;} \n\t\t\telse {\n\n\t\t\t\tif (results.length>0) {\n\t\t\t\t\tif(results[0].c2.length>0){\n\t\t\t\t\t//>>Array con los nombres de los puestos hijos\n\t\t\t\t\tvar a1nivel = results[0].c3.split(\",\");//Convierte cadena con comas, en array\n\t\t\t\t\t//>>Array con los ids de los puestos hijos\n\t\t\t\t\tvar aid1nivel = results[0].c2.split(\",\");//Convierte cadena con comas, en array\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"aid1nivel: \" + aid1nivel);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"aid1nivel.length: \" + aid1nivel.length);\n\t\t\t\t\t//>>Id del puesto hijo seleccionado\n\t\t\t\t\tvar id1nivel = aid1nivel[0];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"id1nivel: \" + id1nivel);\n\t\t\t\t\tvar cadenadatos = \"\";\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"cadenadatos: \" + cadenadatos);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"results[0].c2: \" + results[0].c2);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"results[0].c2[0]: \" + results[0].c2[0]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"a1nivel: \" + a1nivel);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"a1nivel[0]: \" + a1nivel[0]);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"results[0].c2.length: \" + results[0].c2.length);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"results.length: \" + results.length);\n\t\t\t\t\tfor (var a=0; a<aid1nivel.length; a++) {\n\t\t\t\t\tcadenadatos = cadenadatos+\"<li>\"+a1nivel[a];\n\t\t\t\t\t//>>Busco si tiene hijos en nivel 2 en los resultados obtenidos de la consulta SQL\n\t\t\t\t\tfor (var i=1; i<results.length; i++) {\n\t\t\t\t\t\tif (id1nivel == results[i].c1) {\n\t\t\t\t\t\t\tvar aid2nivel = results[i].c2.split(\",\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"aid2nivel: \" + aid2nivel);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"aid2nivel.length: \" + aid2nivel.length);\n\t\t\t\t\t\t\tif(aid2nivel.length>0){\n\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"<ul>\";\n\t\t\t\t\t\t\t\tvar a2nivel = results[i].c3.split(\",\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"a2nivel: \" + a2nivel);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"results[i].c2.length: \" + results[i].c2.length);\n\t\t\t\t\t\t\t\tfor (var b=0; b<aid2nivel.length; b++) {\n\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"<li>\"+a2nivel[b];\n\t\t\t\t\t\t\t\tvar id2nivel = aid2nivel[b];\n\t\t\t\t\t\t\t\t//>>Busco si tiene hijos en nivel 3\t\t\t\t\t\t\t\t\t\t\t//console.log(\"id2nivel: \" + id2nivel);\n\t\t\t\t\t\t\t\tfor (var j=1; j<results.length; j++) {\n\t\t\t\t\t\t\t\t\tif (id2nivel == results[j].c1) {\n\t\t\t\t\t\t\t\t\t\tvar aid3nivel = results[j].c2.split(\",\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"aid3nivel: \" + aid3nivel);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"aid3nivel.length: \" + aid3nivel.length);\n\t\t\t\t\t\t\t\t\t\tif(aid3nivel.length>0){\n\t\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"<ul>\";\n\t\t\t\t\t\t\t\t\t\t\tvar a3nivel = results[j].c3.split(\",\");\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tfor (var c=0; c<aid3nivel.length; c++) {\n\t\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"<li>\"+a3nivel[c];\n\t\t\t\t\t\t\t\t\t\t\tvar id3nivel = aid3nivel[c];\n\t\t\t\t\t\t\t\t//>>Busco si tiene hijos en nivel 4\t\t\t\t\t\t\t\t\t\t\t//console.log(\"id3nivel: \" + id3nivel);\n\t\t\t\t\t\t\t\tfor (var k=1; k<results.length; k++) {\n\t\t\t\t\t\t\t\t\tif (id3nivel == results[k].c1) {\n\t\t\t\t\t\t\t\t\t\tvar aid4nivel = results[k].c2.split(\",\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"aid4nivel: \" + aid4nivel);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"aid4nivel.length: \" + aid4nivel.length);\n\t\t\t\t\t\t\t\t\t\tif(aid4nivel.length>0){\n\t\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"<ul>\";\n\t\t\t\t\t\t\t\t\t\t\tvar a4nivel = results[k].c3.split(\",\");\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tfor (var d=0; d<aid4nivel.length; d++) {\n\t\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"<li>\"+a4nivel[d];\n\t\t\t\t\t\t\t\t\t\t\tvar id4nivel = aid4nivel[d];\n\t\t\t\t\t\t\t\t//>>Busco si tiene hijos en nivel 5\t\t\t\t\t\t\t\t\t\t\t//console.log(\"id4nivel: \" + id4nivel);\n\t\t\t\t\t\t\t\tfor (var m=1; m<results.length; m++) {\n\t\t\t\t\t\t\t\t\tif (id4nivel == results[m].c1) {\n\t\t\t\t\t\t\t\t\t\tvar aid5nivel = results[m].c2.split(\",\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"aid5nivel: \" + aid5nivel);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"aid5nivel.length: \" + aid5nivel.length);\n\t\t\t\t\t\t\t\t\t\tif(aid5nivel.length>0){\n\t\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"<ul>\";\n\t\t\t\t\t\t\t\t\t\t\tvar a5nivel = results[m].c3.split(\",\");\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tfor (var e=0; e<aid5nivel.length; e++) {\n\t\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"<li>\"+a5nivel[e];\n\t\t\t\t\t\t\t\t\t\t\tvar id5nivel = aid5nivel[e];\n\t\t\t\t\t\t\t\t//>>Busco si tiene hijos en nivel 6\t\t\t\t\t\t\t\t\t\t\t//console.log(\"id5nivel: \" + id5nivel);\n\t\t\t\t\t\t\t\tfor (var n=1; n<results.length; n++) {\n\t\t\t\t\t\t\t\t\tif (id5nivel == results[n].c1) {\n\t\t\t\t\t\t\t\t\t\tvar aid6nivel = results[n].c2.split(\",\");\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"aid6nivel: \" + aid6nivel);\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"aid6nivel.length: \" + aid6nivel.length);\n\t\t\t\t\t\t\t\t\t\tif(aid6nivel.length>0){\n\t\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"<ul>\";\n\t\t\t\t\t\t\t\t\t\t\tvar a6nivel = results[n].c3.split(\",\");\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tfor (var f=0; f<aid6nivel.length; f++) {\n\t\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"<li>\"+a6nivel[f];\n\t\t\t\t\t\t\t\t\t\t\tvar id6nivel = aid6nivel[f];\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//console.log(\"id6nivel: \" + id6nivel);\n\n\t\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"</li>\";\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"</ul>\";\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"</li>\";\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\t\t\t\tcadenadatos = cadenadatos+\"</li>\";\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"</ul>\";\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"</li>\";\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\t\t\t\tcadenadatos = cadenadatos+\"</li>\";\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"</ul>\";\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"</li>\";\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\t\t\t\tcadenadatos = cadenadatos+\"</li>\";\n\n\t\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"</ul>\";\n\t\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"</li>\";\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\t};\n\t\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"</ul>\";\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tcadenadatos = cadenadatos+\"</li>\";\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t\t};\n\t\t\t\t\tcadenadatos = cadenadatos+\"</ul>\";\n\t\t\t\t};\n\t\t\t\tcadenadatos = cadenadatos+\"</li>\";\n\n\t\t\t\t\tvar results = {data: cadenadatos};\n\t\t\t\t\tres.contentType('json');\n\t\t\t\t\tres.send(results);\n\t\t\t\t\t//console.log(bd+\" dataOR(): Devuelve: \" + cadenadatos);\n\t\t\t\t\tconsole.log(bd+\" dataOR(): Devuelto.\");\n\t\t\t\t\t// console.log(\"Datos enviados: \" + results);\n\t\t\t\t\t// console.log(\"Datos enviados: \" + results);\n\t\t\t\t\t// console.log(\"results[0].c2: \" + results[0].c2);\n\t\t\t\t\t// console.log(\"results[0].c3: \" + results[0].c3);\n\t\t\t\t\t// console.log(\"results[0].c2[0]: \" + results[0].c2[0]);\n\n\t\t\t\t} else {\n\t\t\t\t\tconsole.log(bd+\" dataOR(): 0 resultados\");\n\t\t\t\t\tres.set('Content-Type', 'text/plain');\n\t\t\t\t\tres.send('nosuccess');\t\n\t\t\t\t};\n\t\t\t};\n\t\t});\n}", "function mbhcc(){\n tableCompletenessSelected();\n var completenessData = [];\n //console.log(\"mbhcc present: \", dqFactory.completeness.color.present);\n //console.log(\"mbhcc missing: \", dqFactory.completeness.color.missing);\n var colorPresent = dqFactory.completeness.color.present;\n var colorMissing = dqFactory.completeness.color.missing;\n completenessData.push({key: 'Present', color: colorPresent, values: []}); //completenessData[0]\n completenessData.push({key: 'Missing', color: colorMissing, values: []}); //completenessData[1]\n\n //console.log(dqFactory.completeness.variables);\n angular.forEach(dqFactory.completeness.variables, function(row) {\n if(row.state.selected) {\n completenessData[0].values.push({label: row.name, value: row.statistics.present});\n completenessData[1].values.push({label: row.name, value: row.statistics.missing});\n }\n });\n return completenessData;\n }", "function MostrarRegistro(){\n // declaramos una variable para guardar los datos\n var listaregistro=Mostrar();\n // selecciono el tbody de la tabla donde voy a guardar\n tbody=document.querySelector(\"#tbRegistro tbody\");\n tbody.innerHTML=\"\";\n // agregamos las columnas que se registren\n for(var i=0; i<listaregistro.length;i++){\n // declaramos una variable para la fila\n var fila=tbody.insertRow(i);\n // declaramos variables para los titulos\n var titulonombre=fila.insertCell(0);\n var tituloprecio=fila.insertCell(1);\n var titulocategoria=fila.insertCell(2);\n var titulocantidad=fila.insertCell(3);\n // agregamos los valores\n titulonombre.innerHTML=listaregistro[i].nombre;\n tituloprecio.innerHTML=listaregistro[i].precio;\n titulocategoria.innerHTML=listaregistro[i].categoria\n titulocantidad.innerHTML=listaregistro[i].cantidad;\n tbody.appendChild(fila);\n }\n}", "function dataAjusteInv(){\n let rangodeFecha = $(\"#daterange-btn-Ajuste span\").html();\n console.log(\"Rango de Fecha:\",rangodeFecha);\n if(rangodeFecha==undefined || rangodeFecha==null){\n var FechDev1=moment().format('YYYY-MM-DD');\n var FechDev2=moment().format('YYYY-MM-DD');\n }else{\n\t let arrayFecha = rangodeFecha.split(\" \", 3);\n\t let f1=arrayFecha[0].split(\"-\");\n\t let f2=arrayFecha[2].split(\"-\");\n\n\t var FechDev1=f1[2].concat(\"-\").concat(f1[1]).concat(\"-\").concat(f1[0]); //armar la fecha año-mes-dia\n\n\t var FechDev2=f2[2].concat(\"-\").concat(f2[1]).concat(\"-\").concat(f2[0]);\n }\t \n \n //console.log(FechDev1, FechDev2);\n\n tablaAjusteInv=$('#datatableAI').dataTable(\n\t{\n\t\t\"aProcessing\": true,//Activamos el procesamiento del datatables\n\t \"aServerSide\": true,//Paginación y filtrado realizados por el servidor\n \"lengthMenu\": [ [10, 25, 50,100, -1], [10, 25, 50, 100, \"Todos\"] ],\n \"language\": {\n\t\t\"sProcessing\": \"Procesando...\",\n \"sLengthMenu\": \"Mostrar _MENU_ registros &nbsp\",\n \"sZeroRecords\": \"No se encontraron resultados\",\n \"sEmptyTable\": \"Ningún dato disponible en esta tabla\",\n \"sInfo\": \"Mostrar registros del _START_ al _END_ de un total de _TOTAL_\",\n\t\t\"sInfoFiltered\": \"(filtrado de un total de _MAX_ registros)\",\n\t\t\"sInfoPostFix\": \"\", \n \"sSearch\": \"Buscar:\",\n \"sInfoThousands\": \",\",\n \"sLoadingRecords\": \"Cargando...\",\n \"oPaginate\": {\n\t\t\"sFirst\": \"Primero\",\n\t\t\"sLast\": \"Último\",\n\t\t\"sNext\": \"Siguiente\",\n\t\t\"sPrevious\": \"Anterior\"}\n },\n\t\t\"oAria\": {\n\t\t\t\"sSortAscending\": \": Activar para ordenar la columna de manera ascendente\",\n\t\t\t\"sSortDescending\": \": Activar para ordenar la columna de manera descendente\"\n\t\t},\n dom: '<clear>Bfrtip',\n buttons: [\n {\n text: 'Copiar',\n extend: 'copy'\n },\n 'excelHtml5',\n 'csvHtml5',\n {\n extend: 'pdfHtml5',\n orientation: 'landscape',\n title: \"AdminLTE\",\n customize: function ( doc ) {\n pdfMake.createPdf(doc).open();\n },\n },\n \n {\n extend: 'print',\n text: 'Imprimir',\n className: 'btn btn-success btn-sm',\n autoPrint: false //TRUE para abrir la impresora\n }\n ],\n initComplete: function () {\n var btns = $('.dt-button');\n btns.removeClass('dt-button');\n btns.addClass('btn btn-success btn-sm');\n },\n\t\t\"ajax\":\n\t\t\t\t{\n url: 'ajax/ajusteinventario.ajax.php?op=listar',\n data: {\"FechDev1\": FechDev1, \"FechDev2\": FechDev2}, \n\t\t\t\t\ttype : \"POST\",\n\t\t\t\t\tdataType : \"json\",\t\t\t\t\t\t\n\t\t\t\t\terror: function(e){\n\t\t\t\t\t\tconsole.log(e.responseText);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\"bDestroy\": true,\n\t\t\"iDisplayLength\": 10,//Paginación\n\t \"order\": [[ 0, \"desc\" ]]//Ordenar (columna,orden)\n\t}).DataTable(); \n \n}", "function MostrarDatos() {\n ReportesService.muestras().then(function(response) {\n console.log(response.data.records);\n $scope.datas = response.data.records;\n $scope.search();\n $scope.select($scope.currentPage);\n cargarClientes();\n cargarOrdenes();\n });\n console.log($scope.currentPageStores);\n }", "function verEncuestaCompleta (id){\n var $miModal = $(\"#myModal\");\n\n $.post(\"/censocc/viewcontroller/getAllDataEncuesta.php\", {idEmpresa : id}, function(allData){\n var dataView = allData[0];\n var codigoHTML = \"<div>\" +\n \"<div><h3>Fecha encuesta: </h3><span>\"+dataView.fecha+\"</span></div>\" +\n \"<div><h3>Tipo de Organizacion: </h3><span>\"+dataView.TipoOrg_name+\"</span></div>\" +\n \"<div><h3>Razon Social: </h3><span>\"+dataView.nombre_razon+\"</span></div>\" +\n \"<div><h3>Nombre Representante: </h3><span>\"+dataView.nombre_persona+\"</span></div>\" +\n \"<div><h3>Nombre Propietario: </h3><span>\"+dataView.nombre_persona+\"</span></div>\" +\n \"<div><h3>Tipo de documento: </h3><span>\"+dataView.Diminutivo_identifica+\"</span></div>\";\n var stringIdEmpresa = dataView.id_empresa;\n if(dataView.id_tipo_identifica == 3){\n stringIdEmpresa = stringIdEmpresa.substring(0,stringIdEmpresa.length-1)+\"-\"+stringIdEmpresa.substring(stringIdEmpresa.length-1);\n }\n codigoHTML +=\"<div><h3>Numero de documento </h3><span>\"+stringIdEmpresa+\"</span></div>\" +\n \"<div><h3>Ubicacion empresa: </h3><span>\"+dataView.ubicacion_name+\"</span></div>\"+\n \"<div><h3>Caracter ubicacion: </h3><span>\"+dataView.caracter_ubicacion+\"</span></div>\"+\n \"<div><h3>Direccion empresa: </h3><span>\"+dataView.direccion_empresa+\"</span></div>\"+\n \"<div><h3>Barrio: </h3><span>\"+dataView.barrio+\"</span></div>\"+\n \"<div><h3>Comuna: </h3><span>\"+dataView.comuna+\"</span></div>\"+\n \"<div><h3>Telefono: </h3><span>\"+dataView.telefonoEmpresa+\"</span></div>\"+\n \"<div><h3>Celular: </h3><span>\"+dataView.celular+\"</span></div>\"+\n \"<div><h3>Correo Electronico: </h3><span>\"+dataView.correo_electronico+\"</span></div>\"+\n \"<div><h3>Actividad Economica: </h3><span>\"+dataView.actividad_name+\"</span></div>\"+\n \"<div><h3>Clasificacion Empresa: </h3><span>\"+dataView.descripcion_clasificacion+\"</span></div>\";\n\n if(dataView.empleados == 1){\n codigoHTML += \"<div><h3>Numero de Empleados: </h3><span>\"+dataView.empleados_numero+\"</span></div>\" ;\n if(dataView.prestaciones == 1){\n codigoHTML += \"<div><h3>Afiliado a salud, pension, ARL: </h3><span>Si</span></div>\" ;\n }else{\n codigoHTML += \"<div><h3>Afiliado a salud, pension, ARL: </h3><span>No</span></div>\" +\n \"<div><h3>Por que no estan afiliados ? </h3><span>\"+dataView.porque_prestaciones+\"</span></div>\" ;\n }\n }\n\n // REGISTRO MERCANTIL\n if(dataView.registroMercantil == 1){\n codigoHTML += \"<div><h3>Numero de registro mercantil: </h3><span>\"+dataView.num_registro_mercantil+\"</span></div>\" +\n \"<div><h3>Fecha registro: </h3><span>\"+dataView.fecha_registro_mercantil+\"</span></div>\";\n }else{\n codigoHTML += \"<div><h3>Porque no tiene registro mercantil: </h3><span>\"+dataView.justificaciones[dataView.justificacion_registro - 1].Nombre_Justificacion+\"</span></div>\";\n }\n\n // USO DEL SUELO\n\n if(dataView.usoSuelo == 1){\n codigoHTML += \"<div><h3>Certificado de uso del suelo: </h3><span>Si</span></div>\";\n }else{\n codigoHTML += \"<div><h3>Porque no tiene certificado de uso del suelo: </h3><span>\"+dataView.justificaciones[dataView.justificacion_uso_suelo - 1].Nombre_Justificacion+\"</span></div>\";\n }\n\n // CERTIFICADO DE BOMBEROS\n\n if(dataView.certificadoBomberos == 1){\n codigoHTML += \"<div><h3>Certificado de Bomberos: </h3><span>Si</span></div>\";\n }else{\n codigoHTML += \"<div><h3>Porque no tiene certificado de Bomberos: </h3><span>\"+dataView.justificaciones[dataView.justificacion_bomberos - 1].Nombre_Justificacion+\"</span></div>\";\n }\n\n // MANIPULACION DE ALIMENTOS\n\n if(dataView.manipulacion_alimentos == 1){\n codigoHTML += \"<div><h3>Certificado de Manipulacion de alimentos: </h3><span>Si</span></div>\";\n }else{\n codigoHTML += \"<div><h3>Porque no tiene certificado de Manipulacion de alimentos: </h3><span>\"+dataView.justificaciones[dataView.justificacion_alimentos - 1].Nombre_Justificacion+\"</span></div>\";\n }\n\n // REGISTRO INVIMA\n\n if(dataView.registro_Invima == 1){\n codigoHTML += \"<div><h3>Numero Invima: </h3><span>\"+dataView.num_registro_mercantil+\"</span></div>\" +\n \"<div><h3>Fecha registro: </h3><span>\"+dataView.fecha_registro_mercantil+\"</span></div>\";\n }else{\n codigoHTML += \"<div><h3>Porque no tiene registro Invima: </h3><span>\"+dataView.justificaciones[dataView.justificacion_Invima - 1].Nombre_Justificacion +\"</span></div>\";\n }\n if(dataView.sayco_acinpro == 1){\n codigoHTML += \"<div><h3>Numero Sayco: </h3><span>\"+dataView.num_cert_sayco+\"</span></div>\" +\n \"<div><h3>Fecha registro: </h3><span>\"+dataView.fecha_registro_mercantil+\"</span></div>\";\n }else{\n codigoHTML += \"<div><h3>Porque no tiene certificado de Sayco y Acinpro: </h3><span>\"+dataView.justificaciones[dataView.justificacion_sayco - 1].Nombre_Justificacion+\"</span></div>\";\n }\n if(dataView.num_residuos == 1){\n codigoHTML += \"<div><h3>Numero Invima: </h3><span>\"+dataView.num_residuos_peligrosos+\"</span></div>\" +\n \"<div><h3>Fecha registro: </h3><span>\"+dataView.fecha_registro_mercantil+\"</span></div>\";\n }else{\n codigoHTML += \"<div><h3>Residuos Peligroso: </h3><span>No Tiene</span></div>\";\n }\n if(dataView.num_ciiu == 1){\n codigoHTML += \"<div><h3>Numero CIIU: </h3><span>\"+dataView.num_cod_ciiu+\"</span></div>\";\n }else{\n codigoHTML += \"<div><h3>Codigo CIIU: </h3><span>No Tiene</span></div>\";\n }\n if(dataView.num_industriComercio == 1){\n codigoHTML += \"<div><h3>Numero Industria y Comercio: </h3><span>\"+dataView.num_industriComercio+\"</span></div>\";\n }else{\n codigoHTML += \"<div><h3>Industria y Comercio: </h3><span>No Tiene</span></div>\";\n }\n\n codigoHTML += \"<div><h3>Ingresos Mensuales: </h3><span>\"+dataView.ingresos_mensuales+\"</span></div>\";\n codigoHTML += \"<div><h3>Cuanto valen los activos del establecimiento: </h3><span>\"+dataView.valor_activos+\"</span></div>\";\n\n if(dataView.sistemaSeguridad == 1){\n codigoHTML += \"<div><h3>Cuenta con sistema de Seguridad: </h3><span>Si</span></div>\" +\n \"<div><h3>Cual: </h3><span>\"+dataView.name_seguridad+\"</span></div>\"\n }else{\n codigoHTML += \"<div><h3>Cuenta con sistema de Seguridad: </h3><span>No</span></div>\";\n }\n\n if(dataView.victimaDelito == 1){\n codigoHTML += \"<div><h3>Ha sido victima de algún delito: </h3><span>Si</span></div>\" +\n \"<div><h3>Cual: </h3><span>\"+dataView.name_delito+\"</span></div>\"\n }else{\n codigoHTML += \"<div><h3>Ha sido victima de algún delito: </h3><span>No</span></div>\";\n }\n\n codigoHTML += \"<div><h3>Cuenta con sistema de seguridad personal: </h3><span>\"+((dataView.sistema_seguridad_personal == 1) ? \"Si\" : \"No\") +\"</span></div>\";\n\n if(dataView.tipo_usuario == 'D'){\n codigoHTML += \"<div><h3>Nombre del digitador: </h3><span>\"+dataView.Nombre_Completo+\"</span></div>\";\n codigoHTML += \"<div><h3>Nombre del encuestador: </h3><span>\"+dataView.nombre_encuestador+\"</span></div>\";\n }else{\n codigoHTML += \"<div><h3>Nombre del encuestador: </h3><span>\"+dataView.Nombre_Completo+\"</span></div>\";\n }\n\n codigoHTML +=\"</div>\";\n\n $(\"#modalContentBody\").html(codigoHTML);\n }, \"json\");\n\n $miModal.modal({\n show : true,\n keyboard : true\n });\n}", "function continuaEscriure ()\r\n{\r\n this.borra ();\r\n this.actual=\"\";\r\n this.validate=0;\r\n}", "misDatos() { // un metodo es una funcion declarativa sin el function dentro de un objeto, puede acceder al universo del objeto\n return `${this.nombre} ${this.apellido}`; // por medio del \"this\", que es una forma de acceder a las propiedades del objeto en un metodo\n }", "function getCuponesPorIndustria(idIndustria){\n\t\n}", "function mostrarAlumnoConMasEjerciciosResueltos(){\r\n let mensaje = `Alumno/s con más ejercicios resueltos: `\r\n mensaje += buscarAlumnoConMasEjResueltos();\r\n document.querySelector(\"#pMostrarAlumnoQueMasResolvio\").innerHTML = mensaje;\r\n}", "function atualizaDados(){\n\t\t\tatendimentoService.all($scope.data).then(function (response) {\n\t\t\t\tlimpar();\n\t\t\t\t$scope.atendimentos = response.data;\n\t\t\t\t$log.info($scope.atendimentos);\n\t\t\t}, function (error) {\n\t\t\t\t$scope.status = 'Unable to load customer data: ' + error.message;\n\t\t\t});\n\t\t\t$scope.usuario={};\n\t\t}", "function etapa3() {\n countListaNomeCrianca = 0; //count de quantas vezes passou na lista de crianças\n\n //recebendo H3 e setando nela o texto com o nome do cliente\n var tituloDaEtapa = document.querySelector(\"#tituloDaEtapa\");\n tituloDaEtapa.textContent = \"3º Etapa - Colaborador\";\n\n document.getElementById('selecionarFuncionarios').style.display = ''; //habilita a etapa 3\n document.getElementById('selecionarAniversariantes').style.display = 'none'; //desabilita a etapa 2\n \n //seta a quantidade de criança que foi definida no input de controle \"qtdCrianca\"\n document.getElementById('qtdCrianca').value = quantidadeCrianca2;\n \n //percorre a lista de nomes das crianças e monta o texto de confirmação para as crianças\n var tamanhoListaNomeCrianca = listaNomeCrianca.length; //recebe o tamanho da lista em uma variavel\n\n listaNomeCrianca.forEach((valorAtualLista) => {\n if(countListaNomeCrianca == 0){\n textoConfirmacaoCrianca = \"Aniversariantes: \";\n }\n countListaNomeCrianca++;\n \n if(countListaNomeCrianca == tamanhoListaNomeCrianca){\n textoConfirmacaoCrianca = textoConfirmacaoCrianca + valorAtualLista;\n }else{\n textoConfirmacaoCrianca = textoConfirmacaoCrianca + valorAtualLista + \" / \";\n }\n \n }); \n countListaNomeCrianca = 0;\n \n if(tamanhoListaNomeCrianca == 0){\n textoConfirmacaoCrianca = \"Evento não possui aniversariante.\";\n }\n \n //seta o texto informação da crianças na ultima etapa\n var confirmacaoInfCrianca = document.querySelector(\"#criancasInf\");\n confirmacaoInfCrianca.textContent = textoConfirmacaoCrianca; \n \n }", "function reportBatalla(){\r\n\t\tvar t = find(\"//table[@class='tbg']//table[@class='tbg']\", XPList);\r\n\t\tif (t.snapshotLength < 2) return;\r\n\r\n\t\t// Encuentra y suma todas las cantidades del botin\r\n\t\tvar botin = null;\r\n\t\tvar a = find(\"//tr[@class='cbg1']\", XPList);\r\n\t\tif (a.snapshotLength >= 3){\r\n\t\t\t// FIXME: Apanyo para Firefox. FF mete nodos de tipo texto vacios\r\n\t\t\tif (a.snapshotItem(1).childNodes.length == 4){\r\n\t\t\t\tvar b = a.snapshotItem(1).childNodes[3];\r\n\t\t\t}else{\r\n\t\t\t\tvar b = a.snapshotItem(1).childNodes[1];\r\n\t\t\t}\r\n\t\t\tif (b.childNodes.length == 8){\r\n\t\t\t\tvar cantidades_botin = new Array();\r\n\t\t\t\tcantidades_botin[0] = parseInt(b.childNodes[1].nodeValue);\r\n\t\t\t\tcantidades_botin[1] = parseInt(b.childNodes[3].nodeValue);\r\n\t\t\t\tcantidades_botin[2] = parseInt(b.childNodes[5].nodeValue);\r\n\t\t\t\tcantidades_botin[3] = parseInt(b.childNodes[7].nodeValue);\r\n\t\t\t\tbotin = arrayToInt(cantidades_botin);\r\n\t\t\t\tvar info_botin = '';\r\n\t\t\t\tfor (var i = 0; i < 4; i++){\r\n\t\t\t\t\tinfo_botin += '<img src=\"' + img('r/' + (i + 1) + '.gif') + '\" width=\"18\" height=\"12\" border=\"0\" title=\"' + T('RECURSO' + (i+1)) + '\">';\r\n\t\t\t\t\tinfo_botin += cantidades_botin[i];\r\n\t\t\t\t\tif (i < 3) info_botin += ' + '; else info_botin += ' = ';\r\n\t\t\t\t}\r\n\t\t\t\tinfo_botin += botin;\r\n\t\t\t\tb.innerHTML = info_botin;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tvar perds = new Array();\r\n\t\tvar carry = new Array();\r\n\t\t// Por cada participante en la batalla (atacante, defensor y posibles apoyos)\r\n\t\tfor(var g = 0; g < t.snapshotLength; g++){\r\n\t\t\tcarry[g] = 0;\r\n\t\t\tvar tt = t.snapshotItem(g);\r\n\t\t\tvar num_elementos = tt.rows[1].cells.length - 1;\r\n\t\t\tfor(var j = 1; j < 11; j++){\r\n\t\t\t\t// Recupera la cantidades de tropa de cada tipo que han intervenido\r\n\t\t\t\tvar u = uc[tt.rows[1].cells[j].getElementsByTagName('img')[0].src.replace(/.*\\/.*\\//,'').replace(/\\..*/,'')];\r\n\t\t\t\tvar p = tt.rows[3] ? tt.rows[3].cells[j].innerHTML : 0;\r\n\t\t\t\t// Basandose en el coste por unidad y su capacidad, se calculan las perdidas y la capacidad de carga total\r\n\t\t\t\tvar ptu = arrayByN(u, p);\r\n\t\t\t\tperds[g] = arrayAdd(perds[g], ptu.slice(0, 4));\r\n\t\t\t\tcarry[g] += (tt.rows[2] ? tt.rows[2].cells[j].innerHTML - p : 0) * u[4];\r\n\t\t\t}\r\n\r\n\t\t\t// Anyade la nueva informacion como una fila adicional en cada tabla\r\n//\t\t\t另有插件 将其移除\r\n//\t\t\tvar informe = document.createElement(\"TD\");\r\n//\t\t\tfor (var i = 0; i < 4; i++){\r\n//\t\t\t\tinforme.innerHTML += '<img src=\"' + img('r/' + (i + 1) + '.gif') + '\" width=\"18\" height=\"12\" border=\"0\" title=\"' + T('RECURSO' + (i+1)) + '\">';\r\n//\t\t\t\tinforme.innerHTML += perds[g][i];\r\n//\t\t\t\tif (i < 3) informe.innerHTML += ' + '; else informe.innerHTML += ' = ';\r\n//\t\t\t}\r\n//\t\t\tvar perdidas = arrayToInt(perds[g]);\r\n//\t\t\tinforme.innerHTML += perdidas;\r\n//\t\t\tinforme.colSpan = num_elementos;\r\n//\t\t\tinforme.className = \"s7\";\r\n//\t\t\tvar fila = document.createElement(\"TR\");\r\n//\t\t\tfila.className = \"cbg1\";\r\n//\t\t\tfila.appendChild(elem(\"TD\", T('PERDIDAS')));\r\n//\t\t\tfila.appendChild(informe);\r\n//\t\t\ttt.appendChild(fila);\r\n\r\n\t\t\t// Solo para el atacante se calcula y muestra la rentabilidad y eficiencia del ataque\r\n\t\t\tif (g == 0 && botin != null){\r\n\t\t\t\tvar datos = document.createElement(\"TD\");\r\n\t\t\t\tvar fila_datos = document.createElement(\"TR\");\r\n\t\t\t\tdatos.colSpan = num_elementos;\r\n\r\n\t\t\t\t// La rentabilidad muestra el botin en comparacion con las perdidas\r\n\r\n\t\t\t\tvar rentabilidad = Math.round((botin - perdidas) * 100 / botin);\r\n\t\t\t\tif (botin == 0)\tif (perdidas == 0) rentabilidad = 0; else rentabilidad = -100;\r\n\t\t\t\tdatos.innerHTML = rentabilidad + \"%\";\r\n\t\t\t\tdatos.className = \"s7\";\r\n\t\t\t\tfila_datos.className = \"cbg1\";\r\n\t\t\t\tfila_datos.appendChild(elem(\"TD\", T('RENT')));\r\n\t\t\t\tfila_datos.appendChild(datos);\r\n\t\t\t\ttt.appendChild(fila_datos);\r\n\r\n\t\t\t\tvar datos = document.createElement(\"TD\");\r\n\t\t\t\tvar fila_datos = document.createElement(\"TR\");\r\n\t\t\t\tdatos.colSpan = num_elementos;\r\n\r\n\t\t\t\t// La eficiencia muestra el botin en comparacion con la cantidad de tropas utilizadas\r\n\r\n\t\t\t\tvar eficiencia = 100 - Math.round((carry[g] - botin) * 100 / carry[g]);\r\n\t\t\t\tif (carry[g] == 0) eficiencia = 0;\r\n\t\t\t\tdatos.innerHTML = eficiencia + \"%\";\r\n\t\t\t\tdatos.className = \"s7\";\r\n\t\t\t\tfila_datos.className = \"cbg1\";\r\n\t\t\t\tfila_datos.appendChild(elem(\"TD\", T('EFICIENCIA')));\r\n\t\t\t\tfila_datos.appendChild(datos);\r\n\t\t\t\ttt.appendChild(fila_datos);\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t}", "reiniciarConteo() {\n this.ultimo = 0;\n this.tickets = [];\n this.grabarArchivo();\n this.ultimos4 = []\n console.log('Se ha inicializado el sistema');\n \n }", "function MostrarContadores() {\n\tvar div = document.getElementById(\"mostrarcontador\");\n\tdiv.innerHTML = \"\";\n\n\tvar TitleTotalArticles = document.createElement(\"h4\");\n\tvar TitlePriceWithoutIVA = document.createElement(\"h4\");\n\tvar TitleTotalPrice = document.createElement(\"h4\");\n\n\tvar cont1 = 0;\n\tvar cont2 = 0;\n\tvar TotalArticulos = 0;\n\tvar Totalprecio = 0;\n\tvar PrecioSinIva = 0;\n\n\t//Con esto mostramos el total de articulos en nuestro carrito.\n\tfor (x of carritocompra.cantidades) {\n\t\tx = parseInt(x);\n\t\tTotalArticulos += x;\n\t}\n\n\tcarritocompra.items.forEach(element => {\n\t\telement.precio = parseInt(element.precio);\n\t\tTotalprecio += (element.precio * carritocompra.cantidades[cont2]);\n\t\tcont2++;\n\t});\n\n\t// Esta parte del codigo es para sacar los precios sin iva\n\tcarritocompra.items.forEach(element => {\n\t\telement.precio = parseInt(element.precio);\n\t\telement.iva = parseInt(element.iva);\n\t\tPrecioSinIva += (element.precio * carritocompra.cantidades[cont1]) - (((element.precio * element.iva) / 100) * carritocompra.cantidades[cont1]);\n\t\tcont1++;\n\t});\n\n\tTitleTotalArticles.appendChild(document.createTextNode(\"Artículos en tu carrito: \" + TotalArticulos));\n\tTitlePriceWithoutIVA.appendChild(document.createTextNode(\"Precio sin IVA: \" + PrecioSinIva + \"€\"));\n\tTitleTotalPrice.appendChild(document.createTextNode(\"Precio total a pagar: \" + Totalprecio + \"€\"));\n\n\tdiv.appendChild(TitleTotalArticles);\n\tdiv.appendChild(TitlePriceWithoutIVA);\n\tdiv.appendChild(TitleTotalPrice);\n}", "function mostrarCalendarioCompleto(data) {\n\n\tif (data.length === 0){\n\t\tvar row = $(\"<tr></tr>\").attr(\"scope\", \"row\").append($(\"<td></td>\").text(\"No se ha generado el fixture\").attr(\"colspan\", \"8\").css(\"font-size\", \"20px\"));\n \t$(\"#tabla_fixture\").append(row);\n \t$(\"#btn_jornada_anterior\").css('visibility', 'hidden');\n \t$(\"#btn_jornada_siguiente\").css('visibility', 'hidden');\n\t}\n\n\telse{\n\n\t\t var pxJornada;\n\t\t $.get(\"/api/fechas\", function(data, status) {\n\n\t\t $.each(data, function (i, jornada) {\n\t\t if (jornada.numero === jornadaActual) {\n\t\t pxJornada = jornada;\n\t\t }\n\t\t });\n\n\t\t if(pxJornada !== undefined){\n\t\t $(\"#nroJornada\").text(\"Jornada \" + pxJornada.numero);\n\t\t mostrarJornadaEnTabla(pxJornada.partidos);\n\n\t\t if(jornadaActual === 1)\n\t\t\t\t\t$(\"#btn_jornada_anterior\").css(\"visibility\", \"hidden\");\n\t\t }\n\n\t\t });\t\n\t}\n}", "getMisCurso(curso, id) {\n document.getElementById(\"Curso\").value = curso[0];\n document.getElementById(\"Estudiante\").value = curso[1];\n document.getElementById(\"Profesor\").value = curso[2];\n document.getElementById(\"Grado\").value = curso[3];\n document.getElementById(\"Pago\").value = curso[4];\n document.getElementById(\"Fecha\").value = curso[5];\n inscripcionID = id;\n }", "function obtenerTotCancelaciones(filters) {\n $scope.promiseTotReclamosVISA = partPendientesViService\n .obtenerTotCancelaciones(filters)\n .then( res => {\n $scope.totCancelacionesGrid.data = res;\n $scope.totCancelacionesGrid.count = res.length;\n })\n .catch( err => Toast.showError(err,'Error'));\n }", "function visualizar_info_oi(id) {\n visualizar_facturacion(id);\n id_oi = id;\n $.ajax({\n url: \"consultar_orden/\",\n type: \"POST\",\n dataType: 'json',\n data: {\n 'id':id,\n 'csrfmiddlewaretoken': token\n },\n success: function (response) {\n //datos de la orden interna\n var data = JSON.parse(response.data);\n data = data.fields;\n //datos de las muestras\n var muestras = JSON.parse(response.muestras);\n //datos del usuario\n var usuario = JSON.parse(response.usuario);\n usuario = usuario.fields;\n //datos del solicitante\n if(response.solicitante != null){\n var solicitante = JSON.parse(response.solicitante);\n solicitante = solicitante.fields;\n }\n var analisis_muestras = response.dict_am;\n var facturas = response.facturas;\n var dhl = response.dict_dhl;\n var links = response.links;\n var fechas = response.fechas;\n //pestaña de información\n $('#titulov_idOI').text(\"Orden Interna #\" + id);\n $('#visualizar_idOI').val(id);\n $('#visualizar_estatus').val(data.estatus);\n $('#visualizar_localidad').val(data.localidad);\n $('#visualizar_fecha_recepcion_m').val(data.fecha_recepcion_m);\n $('#visualizar_fecha_envio').val(data.fecha_envio);\n $('#visualizar_fecha_llegada_lab').val(data.fecha_llegada_lab);\n $('#visualizar_pagado').val(data.pagado);\n $('#visualizar_link_resultados').val(data.link_resultados);\n $('#visualizar_usuario_empresa').text(response.empresa);\n var n = usuario.nombre + \" \" + usuario.apellido_paterno + \" \" + usuario.apellido_materno;\n $('#visualizar_usuario_nombre').text(n);\n $('#visualizar_usuario_email').text(response.correo);\n $('#visualizar_usuario_telefono').text(response.telefono);\n\n //pestaña de observaciones\n $('#visualizar_idioma_reporte').text(data.idioma_reporte);\n\n var html_muestras = \"\";\n if(muestras != null){\n for (let mue in muestras){\n var id_muestra = muestras[mue].pk;\n var objm = muestras[mue].fields;\n\n html_muestras+= build_muestras(id_muestra, objm,analisis_muestras[id_muestra], facturas[id_muestra], dhl, links, fechas);\n }\n }\n $('#muestras-body').html(html_muestras);\n $('#v_observaciones').val(data.observaciones);\n if(!$(\"#factura-tab\").hasClass(\"active\")){\n restaurar_editar();\n }\n else{\n doble_editar();\n }\n }\n })\n}", "function ricaricaContiPerCausale(){\n var selectCausaleEP = $(\"#uidCausaleEP\");\n $.postJSON(baseUrl + \"_ottieniListaConti.do\", {\"causaleEP.uid\": selectCausaleEP.val()})\n .then(function(data) {\n if(impostaDatiNegliAlert(data.errori, alertErrori)) {\n return;\n }\n aggiornaDatiScritture (data);\n });\n }", "function restaurarReloj() {\n $horasDom.text('00');\n $minutosDom.text('00');\n $segundosDom.text('00');\n }", "async getEstadoCarrera(req,res){\n console.log(req.body)\n // ESTA CONSULTA DEVUELVE LOS CURSOS QUE EL ALUMNO CURSO O ESTA CURSANDO\n const query1 = `\n SELECT c.nombre, ea.condicion, ea.nota, cc.nombre as carrera, cc.identificador as idcarrera\n FROM curso as c\n INNER JOIN estado_academico as ea ON ea.idcurso = c.identificador\n INNER JOIN alumno as a ON ea.idalumno = a.identificador\n INNER JOIN carrera cc ON c.idcarrera = cc.identificador\n WHERE ea.condicion IN ($2,$3,$4,$5) AND a.identificador = $1`; \n \n // ESTA CONSULTA DEVUELVE LA O LAS CARRERA EN QUE EL ALUMNO ESTA INSCRIPTO\n var query2 = ` \n SELECT DISTINCT carrera.identificador, carrera.nombre FROM carrera, inscripciones_carrera ic, alumno\n WHERE carrera.identificador = ic.idcarrera AND ic.idalumno = $1;`;\n\n var pool = new pg.Pool(config)\n pool.connect();\n const cursos = (await pool.query(query1, [req.body.identificador, req.body.opciones[0],req.body.opciones[1],req.body.opciones[2],req.body.opciones[3]])).rows \n const carrera = (await pool.query(query2, [req.body.identificador])).rows\n\n pool.end();\n var acumulador1 = 0;\n var contador1 = 0;\n var acumulador2 = 0;\n var contador2 = 0;\n for(var i = 0; i < cursos.length;i++){\n if (cursos[i].condicion == 'PROMOCIONADO'){\n if (cursos[i].idcarrera == 1){\n acumulador1 = acumulador1 + cursos[i].nota;\n contador1 = contador1 + 1; \n }else{\n acumulador2 = acumulador2 + cursos[i].nota;\n contador2 = contador2 + 1; \n } \n } \n }\n var promedio1 = acumulador1 / contador1;\n var promedio2 = acumulador2 / contador2;\n\n var carreras = [];\n console.log(carrera);\n for(var i = 0; i < carrera.length;i++){\n carreras.push(carrera[i].nombre);\n \n }\n console.log(carreras);\n informacion = {\n cursos:cursos,\n carrera: carreras,\n promedio1: promedio1,\n promedio2: promedio2\n }\n console.log(informacion);\n\n res.json(informacion);\n\n }", "function Coche(){\n this.marca = null;\n this.modelo = null;\n this.matricula = null;\n\n this.toString = function() {\n return this.marca + \", \"+ this.modelo + \", \" + this.matricula;\n }\n}", "function consultarAllCiudades(){\n\n\n\tvar datos = new FormData();\n\tdatos.append(\"parametroNeutro\", \"nulo\");\n\tlet plantilla2 = \" \";\n\tlet obj\n\t$.ajax({\n\t\turl:rutaOculta+\"ajax/administracionCiudad.ajax.php\",\n\t\tmethod:\"POST\",\n\t\tdata: datos, \n\t\tcache: false,\n\t\tcontentType: false,\n\t\tprocessData: false,\n\t\tsuccess: function(respuesta3){\n\t\t\t\t\t\t\n\t\t\tif(respuesta3.length >10 ){\n\n\t\t\t\trespuesta3 =respuesta3.replace(\"[\",\"\");\n\t\t\t\trespuesta3 =respuesta3.replace(\"]\",\"\");\n\t\t\t\tvar auxSplit2 = respuesta3.split(\"},\");\n\n\t\t\t\tplantilla2 +='<div class=\"col-lg-9 col-md-9 col-sm-10 col-xs-12 m-2\" id=\"\">'\n\t\t\t\tfor(var i=0;i<auxSplit2.length;i++){\n\t\t\t\t\tif(!auxSplit2[i].includes(\"}\")){\n\t\t\t\t\t\tauxSplit2[i] = auxSplit2[i]+\"}\";\n\t\t\t\t\t}\n\t\t\t\t\tvar res2 = JSON.parse(auxSplit2[i]);\n\t\t\t\t\tvar aux = \"'\"+res2.nombreCiudad+\"'\";\n\t\t\t\t\tplantilla2 +='<div class=\"p-2\">'\n\n\t\t\t\t\tplantilla2 +=' <h3 class=\"div-pais p-3 rounded\">'+res2.nombreCiudad+'<a href=\"javascript:eliminarCiudad('+res2.idCiudad+','+aux+')\" class=\"\"><button class=\"btn eliminarPais eliminar text-danger\" type=\"button\"><i class=\"fas fa-trash-alt\"></i></button></a><a href=\"javascript:mostrarModalEditCiudad('+res2.idCiudad+','+aux+','+res2.Municipio_idMunicipio+');\" class=\"\"><button class=\"btn eliminarPais eliminar text-primary\" type=\"button\"><i class=\"fas fa-pencil-alt\"></i></button></a></h3>'\n\n\t\t\t\t\tplantilla2 +=' </div>'\n\n\t\t\t\t}\n\t\t\t\tplantilla2 +='</div>'\n\t\t\t\t$(\"#verCiudades\").html(plantilla2); \n\t\t\t\t$('#verCiudades').show();\n\t\t\t}else{\n\t\t\t\t$(\"#verCiudades\").hide(); \n\n\t\t\t}\n\t\t\t\n\n\t\t}\n\t})\n}" ]
[ "0.6151246", "0.61081386", "0.6103436", "0.61009806", "0.5991096", "0.59855425", "0.59708446", "0.59583426", "0.59121543", "0.59019583", "0.5845118", "0.58449155", "0.5820936", "0.5813818", "0.5803204", "0.5803204", "0.5803204", "0.58001643", "0.5792509", "0.57750016", "0.57427603", "0.5731706", "0.57312906", "0.5724191", "0.57079804", "0.56939167", "0.56939167", "0.56931037", "0.5687337", "0.56763035", "0.56679225", "0.5650635", "0.56379175", "0.5634344", "0.5634271", "0.56324756", "0.5627145", "0.5619322", "0.5613491", "0.5607205", "0.5607114", "0.56031734", "0.56030846", "0.5600336", "0.55974174", "0.5596465", "0.55870575", "0.55784494", "0.55741763", "0.5568998", "0.5563892", "0.5562888", "0.55616623", "0.55527997", "0.554831", "0.55478066", "0.5538964", "0.5535531", "0.55303574", "0.55295736", "0.55241627", "0.55188656", "0.55169344", "0.5516732", "0.5511112", "0.55108017", "0.55042636", "0.5485412", "0.5484208", "0.54825413", "0.5469994", "0.54692197", "0.5464025", "0.5462069", "0.546066", "0.5458609", "0.5458128", "0.5458092", "0.5449571", "0.54460937", "0.54410666", "0.5438313", "0.543695", "0.54310596", "0.5429315", "0.5429023", "0.54281104", "0.54274136", "0.54235375", "0.5419328", "0.541844", "0.54182774", "0.54149926", "0.54100436", "0.54079115", "0.54042363", "0.54027575", "0.53997546", "0.53974295", "0.53967345", "0.5396349" ]
0.0
-1
Contenerodot que sera usado para mostrar los datos de las ciudades existentes
function DatDistrito(id, nombre) { return '<!-- car de un departamento--->' + ' <div class="accordion" id="accordionExample">' + ' <div class="card">' + ' <div class="card-header row" id="headingOne">' + ' <h2 class="col-8">' + ' <button' + ' class="btn btn-link btn-block text-left"' + ' type="button"' + ' data-toggle="collapse"' + ' data-target="#collapseOne' + id + '"' + ' aria-expanded="true"' + ' aria-controls="collapseOne' + id + '">' + "🌃 " + nombre + ' </button>' + ' </h2>' + ' <div class="col-4">' + ' <button type="button" onclick="deleDistri(' + id + ')" id="NewProdut"' + ' class="btn btn-outline-danger btn-block rounded-pill">Eliminar</button>' + ' </div>' + ' </div>' + '' + ' <div id="collapseOne' + id + '" class="collapse show"' + ' aria-labelledby="headingOne"' + ' data-parent="#accordionExample">' + ' <div class="card-body">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col">' + ' <div' + ' class="input-group mb-3">' + ' <div' + ' class="input-group-prepend">' + ' <span' + ' class="input-group-text"' + ' id="basic-addon1">🌎</span>' + ' </div>' + ' <select' + ' class="custom-select"' + ' id="LDepDist' + id + '" onchange="IncetDat(' + id + ')">' + ' <option' + ' selected>' + ' Deàrtamento' + ' </option>' + ' </select>' + ' </div>' + ' </div>' + ' <div class="col">' + ' <div' + ' class="input-group mb-3">' + ' <div' + ' class="input-group-prepend">' + ' <span' + ' class="input-group-text"' + ' id="basic-addon1">🗾</span>' + ' </div>' + ' <select' + ' class="custom-select"' + ' id="LCiuDist' + id + '" >' + ' <option' + ' selected>' + ' Ciudad' + ' </option>' + ' </select>' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <div' + ' class="input-group mb-3">' + ' <div' + ' class="input-group-prepend">' + ' <span' + ' class="input-group-text"' + ' id="basic-addon1">🌃</span>' + ' </div>' + ' <input' + ' type="text" id="textDist' + id + '" value="' + nombre + '"' + ' class="form-control"' + ' placeholder="Nombre de la Distrito"' + ' aria-label="Direccion"' + ' aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <button' + ' type="button" onclick="ActuDistri(' + id + ')"' + ' id="NewProdut"' + ' class="btn btn-success btn-block">Agregar' + ' Distrito</button>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' <!------------------------------------>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadDataDonViTinh() {\n $scope.donViTinh = [];\n if (!tempDataService.tempData('donViTinh')) {\n donViTinhService.getAllData().then(function (successRes) {\n if (successRes && successRes.status === 200 && successRes.data && successRes.data.Status && successRes.data.Data && successRes.data.Data.length > 0) {\n tempDataService.putTempData('donViTinh', successRes.data.Data);\n $scope.donViTinh = successRes.data.Data;\n }\n }, function (errorRes) {\n console.log('errorRes', errorRes);\n });\n } else {\n $scope.donViTinh = tempDataService.tempData('donViTinh');\n }\n }", "function loadDataDonViTinh() {\n $scope.donViTinh = [];\n if (!tempDataService.tempData('donViTinh')) {\n donViTinhService.getAllData().then(function (successRes) {\n if (successRes && successRes.status === 200 && successRes.data && successRes.data.Status && successRes.data.Data && successRes.data.Data.length > 0) {\n tempDataService.putTempData('donViTinh', successRes.data.Data);\n $scope.donViTinh = successRes.data.Data;\n }\n }, function (errorRes) {\n console.log('errorRes', errorRes);\n });\n } else {\n $scope.donViTinh = tempDataService.tempData('donViTinh');\n }\n }", "function loadDataDonViTinh() {\n $scope.donViTinh = [];\n if (!tempDataService.tempData('donViTinh')) {\n donViTinhService.getAllData().then(function (successRes) {\n if (successRes && successRes.status === 200 && successRes.data && successRes.data.Status && successRes.data.Data && successRes.data.Data.length > 0) {\n tempDataService.putTempData('donViTinh', successRes.data.Data);\n $scope.donViTinh = successRes.data.Data;\n }\n }, function (errorRes) {\n console.log('errorRes', errorRes);\n });\n } else {\n $scope.donViTinh = tempDataService.tempData('donViTinh');\n }\n }", "static dataESC(req,res){\n \n Especialidad.findAll({\n \n //attributes: ['id','estado','codigo_p','hora','especialidad'],\n include: [\n { model: Salas, \n include:[ { model: Camas } ]\n }\n ]\n }).then(users => {\n res.status(200).send(users)\n })\n }", "async function obtenerTodasCIudades() {\n var queryString = '';\n\n\n queryString = queryString + ' SELECT cd.id, cd.nombre as ciudad, ps.nombre as pais';\n queryString = queryString + ' from ciudades cd join paises ps on (cd.pais_id=ps.id) ';\n\n \n\n let ciudad = await sequelize.query(queryString,\n { type: sequelize.QueryTypes.SELECT})\n return ciudad;\n }", "function accionBuscar ()\n {\n configurarPaginado (mipgndo,'DTOBuscarMatricesDTOActivas','ConectorBuscarMatricesDTOActivas',\n 'es.indra.sicc.cmn.negocio.auditoria.DTOSiccPaginacion', armarArray());\n }", "function ciudades (){\nvar uniqueStorage = removeDuplicates(Storage, \"Ciudad\");\nvar atributos = Array();\n \n if( uniqueStorage.length > 0 ) {\n for( var aux in uniqueStorage )\n atributos.push(uniqueStorage[aux].Ciudad);\n }\n return atributos;\n}", "function getCombustivelTable() {\n //Populates Table with Json\n tableCombustivel = $('table#table-combustivel').DataTable({\n ajax: {\n url: urlApi + \"combustivel\",\n contentType: 'application/json; charset=UTF-8',\n dataType: 'json'\n },\n columns: [{\n data: \"id\"\n }, {\n data: \"tipo\"\n }],\n columnDefs: [\n {\n width: '20%',\n targets: 'combIdCol'\n }\n ],\n select: true,\n lengthChange: false,\n pageLength: 5,\n dom: 'lrti<\"right\"p>',\n language: {\n url: \"../../doc/Portuguese-Brasil.json\"\n }\n });\n}", "function cargaComplementos(){\n //Cargado del DataTables\n if($('table').length>0){\n $('table').DataTable();\n }\n \n //Cargado del DatePicker\n if($(\".date-picker\").toArray().length>0){\n $('.date-picker').datepicker({\n format : \"dd/mm/yyyy\"\n });\n }\n \n //Cargado del Input Mask con el formato \"dd/mm/yyyy\"\n if($('.input-date').toArray().length>0){\n $(\".input-date\").inputmask(\"dd/mm/yyyy\");\n }\n if($('.select2').toArray().length>0){\n $(\".select2\").select2({\n placeholder : \"Seleccione una opción\"\n });\n }\n}", "static get_one_conulta_p(req, res) {\n const { id_cita } = req.params\n return Consultas\n .findAll({\n where:{id_cita : id_cita },\n include:[{\n model : Recetas\n }]\n })\n .then(Consultas => res.status(200).send(Consultas));\n }", "function cargarCgg_res_beneficiarioCtrls(){\n if(inInfoPersona.CRPER_CODIGO_AUSPICIANTE != undefined && inInfoPersona.CRPER_CODIGO_AUSPICIANTE.length>0){\n if(inInfoPersona.CRPJR_CODIGO.length>0)\n {\n txtCrper_codigo.setValue(inInfoPersona.CRPJR_RAZON_SOCIAL);\n tmpAuspiciantePJ = inInfoPersona.CRPJR_CODIGO;\n txtCrpjr_representante_legal.setValue(inInfoPersona.CRPER_NOMBRE_AUSPICIANTE);\n tmpAuspiciante= inInfoPersona.CRPER_CODIGO_AUSPICIANTE;\n rdgTipoAuspiciante.setValue('rdgTipoAuspiciante',TypeAuspiciante.JURIDICA);\n }\n else\n {\n txtCrper_codigo.setValue(inInfoPersona.CRPER_NOMBRE_AUSPICIANTE);\n tmpAuspiciante= inInfoPersona.CRPER_CODIGO_AUSPICIANTE;\n rdgTipoAuspiciante.setValue('rdgTipoAuspiciante',TypeAuspiciante.NATURAL);\n }\n }\n }", "function mostrarServicios(){\n\n //llenado de la tabla\n cajas_hoy();\n cajas_ayer() ;\n}", "obtenerTodosCiudad() {\n return axios.get(`${API_URL}/v1/ciudad`);\n }", "static OneCuaderno(req, res){ \n const { id } = req.params\n Cuadernos.findAll({\n where: {id: id}\n //attributes: ['id', ['description', 'descripcion']]\n }).then((one) => {\n res.status(200).json(one);\n }); \n }", "static list_DiagnosticoTratameinto(req, res){ \n const { id_internacion } = req.params\n diagnostico_tratamientos.findAll({\n where: { id_internacion: id_internacion }\n }).then((data) => {\n res.status(200).json(data);\n }); \n }", "function iniciarListaBusqueda(){\n var ciclos = selectDatoErasmu();\n for(var aux = 0, help = 0 ; aux < erasmu.length ; aux++){\n if(ciclos.indexOf(erasmu[aux].ciclo) != -1){\n crearListErasmu(erasmu[aux]);\n }\n }\n}", "abrirSessao(bd, usuario, hashSenha) {\n var resLogin = [];\n var papelUsuario = \"\";\n var colunasProjetadas = [\"nomeusuario\", \"senha\", \"carteira\"];\n var nomeColunaCarteira = \"carteira\";\n\n configuracoes.tabelas.forEach(function (nomeTabela, indice) {\n var resLoginTemp = interfaceBD.select(\n bd,\n nomeTabela,\n colunasProjetadas,\n { nomeusuario: usuario, senha: hashSenha },\n 1\n );\n if (resLoginTemp != null) {\n resLogin = resLogin.concat(resLoginTemp);\n if (resLoginTemp.length && papelUsuario === \"\")\n papelUsuario = nomeTabela;\n }\n console.log(\n `A saida da tabela ${nomeTabela} foi: ${resLoginTemp}\\nE possui comprimento de ${resLoginTemp.length}`\n );\n });\n\n console.log(\n `A saida das tabelas foi: ${resLogin}\\nE possui comprimento de ${resLogin.length}`\n );\n\n if (resLogin != null && resLogin != {}) {\n if (resLogin.length > 0) {\n return {\n estado: \"aberta\",\n conteudo: resLogin,\n papelUsuario: papelUsuario,\n carteiraUsuario:\n resLogin[0][colunasProjetadas.indexOf(nomeColunaCarteira)],\n horaAbertura: new Date(),\n };\n }\n /*return ContentService.createTextOutput(\n JSON.stringify({ nome: \"isaias\" })\n ).setMimeType(ContentService.MimeType.JSON);*/\n }\n\n return { estado: \"fechada\", conteudo: [], horaAbertura: new Date() };\n }", "function loadDataNhaCungCap() {\n $scope.nhaCungCap = [];\n if (!tempDataService.tempData('nhaCungCap')) {\n nhaCungCapService.getAllData().then(function (successRes) {\n if (successRes && successRes.status === 200 && successRes.data && successRes.data.Status && successRes.data.Data && successRes.data.Data.length > 0) {\n tempDataService.putTempData('nhaCungCap', successRes.data.Data);\n $scope.nhaCungCap = successRes.data.Data;\n }\n }, function (errorRes) {\n console.log('errorRes', errorRes);\n });\n } else {\n $scope.nhaCungCap = tempDataService.tempData('nhaCungCap');\n }\n }", "function loadDataNhaCungCap() {\n $scope.nhaCungCap = [];\n if (!tempDataService.tempData('nhaCungCap')) {\n nhaCungCapService.getAllData().then(function (successRes) {\n if (successRes && successRes.status === 200 && successRes.data && successRes.data.Status && successRes.data.Data && successRes.data.Data.length > 0) {\n tempDataService.putTempData('nhaCungCap', successRes.data.Data);\n $scope.nhaCungCap = successRes.data.Data;\n }\n }, function (errorRes) {\n console.log('errorRes', errorRes);\n });\n } else {\n $scope.nhaCungCap = tempDataService.tempData('nhaCungCap');\n }\n }", "function TraerEstadisticas(){\n var fechaInicio = $(\"#fechaInicio\").val();\n var fechaFinal = $(\"#fechaFinal\").val();\n var urlEstadisticas = 'http://localhost/ESTACIONAMIENTO_2017/APIREST/Estadisticas';\n \n if(fechaInicio != \"\" && fechaFinal != \"\"){\n urlEstadisticas += '/' + fechaInicio + '/'+ fechaFinal;\n }\n $.ajax({\n url: urlEstadisticas,\n method: 'GET',\n dataType: 'json',\n async: true\n }).done(function(result){\n $(\"#tablaEstadisticas\").DataTable({\n \"bDestroy\": true,\n \"order\": [[ 5, \"asc\"]],\n \"language\": {\n url:'dataTablesSpanish.json'\n },\n data: result[\"Usadas\"],\n columns: [\n { data: 'Piso'},\n { data: 'Numero'},\n { data: 'Patente'},\n { data: 'Marca'},\n { data: 'Color'},\n { data: 'Fecha_Ingreso'},\n { data: 'Fecha_Salida'},\n { data: 'Importe'}\n ]\n });\n \n var div = $(\"#estadisticasCocheras\");\n div.html(\"\");\n\n // Verifico que se haya usado alguna cochera\n if(!$.isEmptyObject(result[\"cocheraMasUsada\"])){\n div.append(\"<h2>Cochera mas usada</h2>\" + \"Numero \" + result[\"cocheraMasUsada\"][\"Numero\"] + \" piso \" + result[\"cocheraMasUsada\"][\"Piso\"]);\n }\n\n // Verifico que se haya usado alguna cochera\n if(!$.isEmptyObject(result[\"cocheraMenosUsada\"])){\n div.append(\"<h2>Cochera menos usada</h2>\" + \"Numero \" + result[\"cocheraMenosUsada\"][\"Numero\"] + \" piso \" + result[\"cocheraMenosUsada\"][\"Piso\"]);\n }\n\n // Verifico que haya cocheras sin usar\n if(result[\"cocherasSinUsar\"].length > 0){\n div.append(\"<h2>Cocheras no usadas</h2>\");\n var listado = '<ul class=\"list-group\">';\n result[\"cocherasSinUsar\"].forEach(function(element) {\n listado += '<li class=\"list-group-item\">';\n listado += element[\"Numero\"] + \" Piso \" + element[\"Piso\"];\n listado += '</li>';\n }, this);\n listado += '</ul>';\n div.append(listado);\n }\n $(\"#divResultado\").show();\n }).fail(function(result){\n $(\"#divContenido\").prepend('<div class=\"alert alert-danger alert-dismissable\"><a href=\"#\" class=\"close\" data-dismiss=\"alert\" aria-label=\"close\">&times;</a>Error al comunicarse con la API</div>');\n });\n \n \n}", "function preencherResultados(data) {\n data = data[0];\n document.querySelector(\"#estado\").innerHTML = data.state;\n document.querySelector(\"#casos\").innerHTML = data.cases;\n document.querySelector(\"#obitos\").innerHTML = data.deaths;\n document.querySelector(\"#curados\").innerHTML = data.refuses;\n\n}", "function HistoriaClinica() { //-------------------------------------------Class HistoriaClinica()\n\n this.a = [];\n\n HistoriaClinica.prototype.cargarData = function (data) {\n this.a = data;\n this.a.Adjuntos = [];\n // // this.a.II;\n // this.a.II_BD = 0;//estado inicial, se puede ir al servidor a buscar la informacion.\n }\n\n} //-------------------------------------------Class HistoriaClinica()", "function _carregaJson(){\n\t\tconexaoJson.getAll().then(function(response){\n\t\t\t$scope.produtos = response.data;\n\t\t})\n\t}", "static CitasPaciente(req, res){ \n var id = req.params.id; \n Citas_Medicas.findAll({\n where: {id_Paciente: id}\n //attributes: ['id', ['description', 'descripcion']]\n }).then((Citas) => {\n res.status(200).json(Citas);\n }); \n }", "function consultaAperturaYCorteDelDia(fecha){\n // debugger;\n \t\tvar datos = {\n \t\t\t\tfecha : fecha,\n \t\t }\n \t\t$.ajax({\n url: base_url+'Cajero/CorteCaja/consultarApertura',\n type: \"post\",\n dataType: \"json\",\n \t\t\tdata : (datos),\n \t\t\tsuccess : function(response){\n $(\"#tbl_consultaCortesDelDia\").DataTable({\n data: response,\n responsive: true,\n columns: [\n {\n data: \"monto\",\n \"className\": \"text-center\",\n // \"visible\": false, // ocultar la columna\n render: function(data, type, row, meta) {\n var hayApertura = `${row.monto}`;\n var idApertura = `${row.id_apertura}`;\n if (hayApertura == 'null'){\n var a = '<div text-white\">'+'No hay apertura'+'</div>';\n $(\"#id_ventas\").val(\"No hay apertura\");\n }else {\n $(\"#id_apertura\").val(idApertura);\n $(\"#monto_apertura\").val(hayApertura);\n var a = '<div text-white\">'+hayApertura+'</div>';\n }\n return a;\n },\n },\n {\n data: \"monto_entregado\",\n \"className\": \"text-center\",\n },\n {\n data: \"gastos\",\n \"className\": \"text-center\",\n },\n {\n data: \"ventas\",\n // \"visible\": false, // ocultar la columna\n },\n {\n data: \"diferencia\",\n \"className\": \"text-center\",\n },\n {\n data: \"fecha\",\n \"className\": \"text-center\",\n },\n {\n data: \"usuario\",\n \"className\": \"text-center\",\n },\n\n ],\n \"language\" : language_espaniol,\n });\n \t\t\t }\n \t\t});\n }", "function get_disease_data(){\n Diseases.selected($rootScope.diseases.userselected).then(function(res){\n $rootScope.diseases.vizdata = res.data;\n });\n }", "function loadAll() {\n var cidades = eurecaECBrasil.filtrarCidadeTextoService();\n return cidades.split(/, +/g).map( function (cidade) {\n return {\n value: cidade.toLowerCase(),\n display: cidade\n }; \n });\n }", "obtenerTodosFincas() {\n return axios.get(`${API_URL}/v1/reportefincaproductor/`);\n }", "static lista_emergencia (req,res){\n const { id_medico } = req.params\n Citas_Medicas.findAll({\n where : { id_medico : id_medico, estado: 'true', especialidad: 'CONSUL. EMERGENCIA' }, // el url es para identificar si es emergencia o consulta medica\n //attributes: ['id','estado','codigo_p','hora','especialidad'],\n include: [\n {model: Pacientes, attributes: ['id','nombre', 'apellidop','apellidom'] }\n ]\n }).then(users => {\n res.status(200).send(users)\n }) \n }", "static doctor_area(req, res){ \n especialidad_doctor.findAll({\n where:{ id_medico : req.params.id_medico },\n include:[\n { model : Especialidades }\n ]\n \n })\n .then((data) => {\n res.status(200).json(data);\n }); \n }", "function comprobarBD(){\n comprobarExistenciaTablaAscensorItemsCabina();\n}", "function impostaCausaliEntrata (list) {\n var opts = {\n aaData: list,\n oLanguage: {\n sZeroRecords: \"Nessun accertamento associato\"\n },\n aoColumnDefs: [\n {aTargets: [0], mData: defaultPerDataTable('distinta.descrizione')},\n {aTargets: [1], mData: computeStringMovimentoGestione.bind(undefined, 'accertamento', 'subAccertamento', 'capitoloEntrataGestione')},\n {aTargets: [2], mData: readData(['subAccertamento', 'accertamento'], 'descrizione')},\n {aTargets: [3], mData: readData(['subAccertamento', 'accertamento'], 'importoAttuale', 0, formatMoney), fnCreatedCell: tabRight},\n {aTargets: [4], mData: readData(['subAccertamento', 'accertamento'], 'disponibilitaIncassare', 0, formatMoney), fnCreatedCell: tabRight}\n ]\n };\n var options = $.extend(true, {}, baseOpts, opts);\n $(\"#tabellaMovimentiEntrata\").dataTable(options);\n }", "function getCuponesPorIndustria(idIndustria){\n\t\n}", "async function getData() {\n let cleanService = await CleanServiceModel.getCleanServiceById(id);\n setDitta(cleanService.ditta);\n setEmail(cleanService.email);\n setTelefono(cleanService.numeroTel);\n setDataAssunzione((new Date(cleanService.dataAssunzione.seconds * 1000)).toLocaleString(\"it-IT\").split(\",\")[0]);\n }", "function cargarCgg_res_oficial_seguimientoCtrls(){\n if(inRecordCgg_res_oficial_seguimiento){\n tmpUsuario = inRecordCgg_res_oficial_seguimiento.get('CUSU_CODIGO');\n txtCrosg_codigo.setValue(inRecordCgg_res_oficial_seguimiento.get('CROSG_CODIGO'));\n txtCusu_codigo.setValue(inRecordCgg_res_oficial_seguimiento.get('NOMBRES')+' '+inRecordCgg_res_oficial_seguimiento.get('APELLIDOS'));\n chkcCrosg_tipo_oficial.setValue(inRecordCgg_res_oficial_seguimiento.get('CROSG_TIPO_OFICIAL'));\n isEdit = true;\n habilitarCgg_res_oficial_seguimientoCtrls(true);\n }}", "static OnlyCita(req, res){ \n var id = req.params.id; \n Citas_Medicas.findAll({\n where: {id: id}\n //attributes: ['id', ['description', 'descripcion']]\n }).then((Citas) => {\n res.status(200).json(Citas);\n }); \n }", "function cargarCgg_res_beneficiarioCtrls(){\n if(inRecordCgg_res_beneficiario!== null){\n if(inRecordCgg_res_beneficiario.get('CRPER_CODIGO'))\n {\n txtCrben_codigo.setValue(inRecordCgg_res_beneficiario.get('CRPER_CODIGO'));\n txtCrben_nombres.setValue(inRecordCgg_res_beneficiario.get('CRPER_NOMBRES'));\n txtCrben_apellido_paterno.setValue(inRecordCgg_res_beneficiario.get('CRPER_APELLIDO_PATERNO'));\n txtCrben_apellido_materno.setValue(inRecordCgg_res_beneficiario.get('CRPER_APELLIDO_MATERNO'))\n txtCrben_num_doc_identific.setValue(inRecordCgg_res_beneficiario.get('CRPER_NUM_DOC_IDENTIFIC'));\n cbxCrben_genero.setValue(inRecordCgg_res_beneficiario.get('CRPER_GENERO'));\n cbxCrdid_codigo.setValue(inRecordCgg_res_beneficiario.get('CRDID_CODIGO'));\n cbxCrecv_codigo.setValue(inRecordCgg_res_beneficiario.get('CRECV_CODIGO'));\n cbxCpais_nombre_nacimiento.setValue(inRecordCgg_res_beneficiario.get('CPAIS_CODIGO'));\n var tmpFecha = null;\n if(inRecordCgg_res_beneficiario.get('CRPER_FECHA_NACIMIENTO')== null || inRecordCgg_res_beneficiario.get('CRPER_FECHA_NACIMIENTO').trim().length ==0){\n tmpFecha = new Date();\n }else{\n tmpFecha = Date.parse(inRecordCgg_res_beneficiario.get('CRPER_FECHA_NACIMIENTO'));\n }\n dtCrper_fecha_nacimiento.setValue(tmpFecha);\n }\n if(inRecordCgg_res_beneficiario.get('CRPER_REQUISITOS_JSON')){\n gsCgg_res_solicitud_requisito.loadData(Ext.util.JSON.decode(inRecordCgg_res_beneficiario.get('CRPER_REQUISITOS_JSON')),true);\n }else{\n gsCgg_res_solicitud_requisito.reload({\n params:{\n inCrtra_codigo:null, \n inCrtst_codigo:INRECORD_TIPO_SOLICITUD.get('CRTST_CODIGO'),\n format:TypeFormat.JSON\n }\n });\n }\n }\n }", "function cargarTableEstu(){\n\t$(\"#TDataEstudiante\").DataTable({\n\t\t\"ajax\": {\n\t\t\t\"method\" : \"Get\",\n\t\t\t\"url\" : \"/grupoestudiantes/allEstudiantes\"\n\t\t\t\t},\n\t\t\"columns\" :[{\n\t\t\t\"data\" : \"id_estudiante\"\n\t\t},{\n\t\t\t\"data\" : \"nombre\"\n\t\t},{\n\t\t\t\"data\" : \"apellido\"\n\t\t},{\n\t\t\t\"data\" : \"id_institucion\"\n\t\t},{\n\t\t\t\"data\" : \"opciones\"\n\t\t}],\n\t\t\n\t\t\"language\" : {\n \"lengthMenu\" : \"Mostrar _MENU_ \",\n \"zeroRecords\" : \"Datos no encontrados\",\n \"info\" : \"Mostar páginas _PAGE_ de _PAGES_\",\n \"infoEmpty\" : \"Datos no encontrados\",\n \"infoFiltered\" : \"(Filtrados por _MAX_ total registros)\",\n \"search\" : \"Buscar:\",\n \"paginate\" : {\n \"first\" : \"Primero\",\n \"last\" : \"Anterior\",\n \"next\" : \"Siguiente\",\n \"previous\" : \"Anterior\"\n },\n }\n\t});\n}", "initCedulas() {\n this.statisticsService.getCedulas().subscribe(response => {\n this.cedulas = response.cedulas;\n console.log(response.Message);\n });\n }", "function setCajasServidor() {\n for (var i = 0; i < self.datosProyecto.businesModel.length; i++) {\n var businesModel = self.datosProyecto.businesModel[i];\n for (var x = 0; x < businesModel.cajas.length; x++) {\n var caja = businesModel.cajas[x];\n for (var j = 0; j < cajasServidor.length; j++) {\n if (caja.id == cajasServidor[j].id) {\n caja.titulo = cajasServidor[j].titulo;\n caja.descripcion = cajasServidor[j].descripcion;\n caja.color = cajasServidor[j].color;\n caja.textoCheck = cajasServidor[j].textoCheck;\n }\n }\n }\n }\n}", "function infotable()\n {\n $.ajaxSetup({\n headers: {\n 'X-CSRF-TOKEN': $('meta[name=\"csrf-token]').attr('content')\n }\n });\n $.ajax({\n type: \"POST\",\n url: url_prev + 'obtenerUsuariosEmpresa',\n data: {\n _token: $('input[name=\"_token\"]').val()\n } //esto es necesario, por la validacion de seguridad de laravel\n }).done(function(msg) {\n // se incorporan las opciones en la comuna\n var json = JSON.parse(msg);\n var html;\n \n for (let [key, value] of Object.entries(json.datos)) {\n if(json.datos[key].id != json.id)\n {\n html += \"<tr><td>\"+json.datos[key].nombre+\"</td><td>\"+json.datos[key].email+\"</td><td>\"+json.datos[key].fono+\"</td><td>\"+json.datos[key].cargo+\"</td><td>\"+json.datos[key].empresa+\"</td><td><button class='btn btn-warning editarfin ml-1' id='editarinfo\"+json.datos[key].id+\"' onclick='confirmarEliminacion(\"+json.datos[key].id+\")' disabled><i class='fas fa-edit' aria-hidden='true'></i></button><button class='btn btn-info ml-1' id='cancelar\"+json.datos[key].id+\"' onclick='cancelaredit(\"+json.datos[key].id+\")' disabled><i class='fas fa-window-close' aria-hidden='true'></i></button></td></tr>\";\n }\n\n \n $(\"#bodytabla\").html(\"\");\n $(\"#bodytabla\").html(html);\n \n var table = $('#tabla_usuarios').DataTable( {\n retrieve : true,\t\t\t\t \t\n paging\t\t\t: true,\n pageLength\t\t: 10,\n order \t\t\t: [],\n fixedHeader : true,\n responsive : true,\n autoWidth : true,\n scrollX : 'true',\n //scrollY : '850px',\n scrollCollapse: true,\n } );\n $('[data-toggle=\"tooltip\"]').tooltip();\n console.log(`${key}: ${json.datos[key].id}`);\n }\n \n }).fail(function(){\n console.log('Error en infotable()');\n });\n }", "despertarBaseDatos(){\n conectarBD();\n }", "function construye() {\n let base = [];\n for (let i = 0; i < numCajas; i++) {\n base.push(angular.copy(cajaDefecto));\n }\n return base;\n }", "function getData() {\n var size = Object.keys($scope.datos).length;\n var data = [];\n for (var j=0; j<size; j++) {\n data.push({\n id: j+1,\n codigoaf: $scope.datos[j].codigoaf,\n descripcion: $scope.datos[j].tipoactivo + ' ' + $scope.datos[j].descripcion,\n codigos: $scope.datos[j].codigo + ', ' + $scope.datos[j].codigoold,\n observeciones: $scope.datos[j].obstrans,\n });\n }\n return data;\n }", "function fillUsuarios() {\n $scope.dataLoading = true;\n apiService.get('api/user/' + 'GetAll', null, getAllUsuariosCompleted, apiServiceFailed);\n }", "function listarInstrutores () {\n instrutorService.listar().then(function (resposta) {\n //recebe e manipula uma promessa(resposta)\n $scope.instrutores = resposta.data;\n })\n instrutorService.listarAulas().then(function (resposta) {\n $scope.aulas = resposta.data;\n })\n }", "function tablausuarios(){\n\t\t$('#tablausuarios').dataTable().fnDestroy();\t\t \t\n\t\t$('#tablausuarios').DataTable({\n\n\t\t\t//PARA EXPORTAR\n\t\t\tdom: \"Bfrtip\",\n\t\t\tbuttons: [{\n\t\t\t\textend: \"copy\",\n\t\t\t\tclassName: \"btn-sm\"\n\t\t\t}, {\n\t\t\t\textend: \"csv\",\n\t\t\t\tclassName: \"btn-sm\"\n\t\t\t}, {\n\t\t\t\textend: \"excel\",\n\t\t\t\tclassName: \"btn-sm\"\n\t\t\t}, {\n\t\t\t\textend: \"pdf\",\n\t\t\t\tclassName: \"btn-sm\"\n\t\t\t}, {\n\t\t\t\textend: \"print\",\n\t\t\t\tclassName: \"btn-sm\"\n\t\t\t}],\n\t\t\tresponsive: !0,\n\t\t\t\n\t\t\t\"order\" : [ [ 1, \"asc\" ] ],\n\t\t\t\"ajax\" : \"../usuario/getusuarios\",\n\t\t\t\"columns\" : [{\n\t\t\t\t\"data\" : \"IDUSUARIO\"\n\t\t\t},{\n\t\t\t\t\"data\" : \"NOMBRE\"\n\t\t\t},{\n\t\t\t\t\"data\" : \"AREA\"\n\t\t\t},{\n\t\t\t\t\"data\" : \"STATUS\"\n\t\t\t},{\n\t\t\t\t\"data\" : \"OPCIONES\"\n\t\t\t},\t\t\n\t\t\t],\n\t\t\t\"language\": {\n\t\t\t\t\"url\": \"/ugel06_dev/public/cdn/datatable.spanish.lang\"\n\t\t\t} \n\t\t});\t\n\t}", "verificaDados(){\n this.verificaEndereco();\n if(!this.verificaVazio()) this.criaMensagem('Campo vazio detectado', true);\n if(!this.verificaIdade()) this.criaMensagem('Proibido cadastro de menores de idade', true);\n if(!this.verificaCpf()) this.criaMensagem('Cpf deve ser válido', true);\n if(!this.verificaUsuario()) this.criaMensagem('Nome de usuario deve respeitar regras acima', true);\n if(!this.verificaSenhas()) this.criaMensagem('Senha deve ter os critérios acima', true)\n else{\n this.criaMensagem();\n // this.formulario.submit();\n }\n }", "function getTeclas(){\n\tvar teclas = getData('teclas', teclado, 'default');\n\tfor(var t in teclas) teclado[t] = teclas[t];\n\treturn teclado;\n}", "function fnc_child_cargar_valores_iniciales() {\n\tf_create_html_table(\n\t\t\t\t\t\t'grid_lista',\n\t\t\t\t\t\t'',\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t'data-row_data',\n\t\t\t\t\t\t'', false, false, false\n\t\t\t\t\t\t);\n\tf_load_select_ajax(fc_frm_cb, 'aac', 'ccod_aac', 'cdsc_aac', '/home/lq_usp_ga_aac_ct_list?ic_ccod_emp=' + gc_ccod_emp + '&ic_cest=' + '1' + '&ic_load_BD=', false, '');\n}", "async selectAllDataCovidInBrazil() {\n\n const data = await DataCovidInBrazil.find({});\n\n return data;\n }", "function cargarDatosExpediente() {\n let obtenerDatos = JSON.parse(localStorage.getItem(\"Guardar_Cita\")) || []\n obtenerDatos.forEach(element => {\n $(\"#tbl_expediente\").append(`<tr><td>${element.date}</td><td>${element.hora}</td><td>${element.nombre}</td><td>${element.servicio}</td><td>${element.consultorio}</td></tr>`);\n });\n }", "function GetDataForActie(){\n var url = config.api.url + 'actie?id=' + $scope.actieId;\n $http({\n url: url,\n method: 'GET'\n }).success(function(data, status, headers, config) {\n ///Convert al data to local vars\n $scope.actieBorg = data.borg;\n $scope.actieBorg_betaald = data.borg_betaald;\n $scope.actieInitiatiefnemerId = data.initiatiefnemer_id;\n $scope.actieStartDatum = data.start_datum;\n $scope.actieEindDatum = data.eind_datum;\n $scope.actieNaam = data.naam;\n $scope.actieStatus = data.statuslist_id;\n $scope.wijkId = data.wijk_id; \n GetDataForWijk();\n console.log(\"Actiedata load succesfull\");\n }).error(function(data, status, headers, config) {\n console.log(\"Actiedata load failed\");\n });\n }", "function getCuentas(callback) {\n\tvar criterio = {$or: [\n \t {$and: [\n\t \t{'datosMonitoreo' : {$exists : true}},\n \t\t{'datosMonitoreo' : {$ne : ''}},\n \t\t{'datosMonitoreo.id' : {$ne : ''}}\n \t ]},\n \t {$and: [\n \t\t{'datosPage' : {$exists : true}},\n\t\t{'datosPage': {$ne : ''}},\n\t\t{'datosPage.id' : {$ne : ''}}\n \t ]}\n \t]};\n\tvar elsort = { nombreSistema : 1 };\n \tclassdb.buscarToStream('accounts', criterio, elsort, 'solicitudes/getoc/getCuentas', function(cuentas){\n\t if (cuentas === 'error') {\n\t\treturn callback(cuentas);\n\t }\n\t else {\n\t\trefinaCuentas(cuentas, 0, [], function(refinadas){\n\t\t return callback(refinadas);\n\t\t});\n\t }\n\t});\n }", "async getAll(req, res) {\n try {\n let data = await mata_kuliah.findAll({\n // only this attributes will send as response\n attributes: [\"id\", \"kode\", \"nama\", \"SKS\"],\n // join table\n include: [\n {\n model: program_studi,\n attributes: [\"id\", \"kode\", \"nama\"],\n },\n ],\n });\n\n // If data does not exist\n if (data.length === 0) {\n return res.status(404).json({\n message: \"Data Not Found\",\n });\n }\n\n // If success\n return res.status(200).json({\n message: \"Success\",\n data,\n });\n } catch (error) {\n // If error\n return res.status(500).json({\n message: \"Internal Server Error\",\n error: error.message,\n });\n }\n }", "function cargarCgg_titulo_profesionalCtrls(){\n\t\tif(inRecordCgg_titulo_profesional){\n\t\t\ttxtCgtpr_codigo.setValue(inRecordCgg_titulo_profesional.get('CGTPR_CODIGO'));\n\t\t\tcodigoNivelEstudio = inRecordCgg_titulo_profesional.get('CGNES_CODIGO');\t\t\t\n\t\t\ttxtCgnes_codigo.setValue(inRecordCgg_titulo_profesional.get('CGNES_DESCRIPCION'));\n\t\t\ttxtCgtpr_descripcion.setValue(inRecordCgg_titulo_profesional.get('CGTPR_DESCRIPCION'));\n\t\t\tisEdit = true;\n\t\t\thabilitarCgg_titulo_profesionalCtrls(true);\n\t}}", "getAllDataJQ() {\n\t\tthis.service.all(this.creaTabella)\n\t}", "function dataStatus() {\n Promise.props({\n etutor_org: mongoose.model('LogExt').count().execAsync(),\n etutor: mongoose.model('LogExt2').count().execAsync(),\n markov: mongoose.model('LogMarkov2').count().execAsync(),\n iwrm: mongoose.model('LogIWRM').count().execAsync()\n }).then(function(results) {\n console.log('***********************');\n console.log(results);\n console.log('***********************');\n }).catch(function(err) {\n console.log(err)\n res.send(500); // oops - we're even handling errors!\n });\n }", "function getSitios() {\n sitioService.getSitios().then(function(resp){\n pasajeVm.sitios = resp;\n });\n }", "function obtenerMeses(){\n cxcService.getParMes({}, {},serverConf.ERPCONTA_WS, function (response) {\n //exito\n console.info(\"libroCompras: Meses\",response.data);\n $scope.listaMeses = response.data;\n\n }, function (responseError) {\n console.log(responseError);\n });\n }", "static list(req, res){\n return Cuadernos\n .findAll()\n .then(data => res.status(200).send(data))\n .catch(error => res.status(400).send(error));\n }", "function mostrarEstAlumnosParaDocente(){\r\n let contadorEjXNivel = 0;//variable para contar cuantos ejercicios planteo el docente para el nivel del alumno\r\n let contadorEntXNivel = 0;//variable para contar cuantos ejercicios de su nivel entrego el alumno\r\n let alumnoSeleccionado = document.querySelector(\"#selEstAlumnos\").value;\r\n let posicionUsuario = alumnoSeleccionado.charAt(1);\r\n let usuario = usuarios[posicionUsuario];\r\n let nivelAlumno = usuario.nivel;\r\n for (let i = 0; i < ejercicios.length; i++){\r\n const element = ejercicios[i].Docente.nombreUsuario;\r\n if(element === usuarioLoggeado){\r\n if(ejercicios[i].nivel === nivelAlumno){\r\n contadorEjXNivel ++;\r\n }\r\n }\r\n }\r\n for (let i = 0; i < entregas.length; i++) {\r\n const element = entregas[i].Alumno.nombreUsuario;\r\n if(element === usuario.nombreUsuario){\r\n if(entregas[i].Ejercicio.nivel === nivelAlumno){\r\n contadorEntXNivel++;\r\n }\r\n }\r\n }\r\n document.querySelector(\"#pMostrarEstAlumnos\").innerHTML = `El alumno ${usuario.nombre} tiene ${contadorEjXNivel} ejercicios planteados para su nivel (${nivelAlumno}) sobre los cuales a realizado ${contadorEntXNivel} entrega/s. `;\r\n}", "imprimirVehiculos() {\n\t\tthis.vehiculos.forEach(vehiculo => {\n\t\t\tif (vehiculo.puertas) {\n\t\t\t\tconsole.log(`Marca: ${vehiculo.marca} // Modelo: ${vehiculo.modelo} // Puertas: ${vehiculo.puertas} // Precio: $${this.formatearPrecio(vehiculo.precio)}`)\n\t\t\t}\n\t\t\tif (vehiculo.cilindrada) {\n\t\t\t\tconsole.log(`Marca: ${vehiculo.marca} // Modelo: ${vehiculo.modelo} // Cilindrada: ${vehiculo.cilindrada}cc // Precio: $${this.formatearPrecio(vehiculo.precio)}`)\n\t\t\t}\n\t\t});\n\t}", "constructor ( nombre, apellido, direccion, edad, telefono, correo ){\n this.db = [];\n this.nombre = nombre;\n this.apellido = apellido;\n this.direccion = direccion;\n this.edad = edad;\n this.telefono = telefono;\n this.correo = correo;\n }", "function detallesCabello(){\n\t //petición para obtener los detalles de cabello.\n\t $.ajax({\n\t url: routeDescrip+'/get_cabello/'+extraviado,\n\t type:\"GET\",\n\t dataType:\"json\",\n\n\t success:function(data) {\n\t \n\t $.each(data, function(key, value){ \n\t $(\"#pCabello\").empty();\n\n\t if(value.tenia == \"SÍ\"){\n\t $(\"#pCabello\").show();\n\t $(\"#pCabello\").append('<div class=\"card\">'+\n\t '<div class=\"card-header bg-white\">'+\n\t '<h5><b>Datos del cabello</b></h5>'+\n\t '</div>'+\n\t '<div class=\"card-body\">'+\n\t '<div class=\"row\" >'+\n\t '<div class=\"col-4\">'+\n\t '<label>Color:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.color+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Tamaño:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.tamano+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Tipo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.tipo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Particularidades:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.particularidades+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Modificaciones:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.modificaciones+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Observaciones:</label>'+\n\t '</div>'+\n\n\t '<div class=\"col\">'+\n\t '<p>'+value.observaciones+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>');\n\t }else{\n\t $(\"#pCabello\").hide();\n\t } \n\n\t \n\n\n\t });\n\n\t },\n\t \n\t });// fin de petición de talles de cabello\n\n\t //peticion para obtener detalles de barba\n\t $.ajax({\n\t url: routeDescrip+'/get_barba/'+extraviado,\n\t type:\"GET\",\n\t dataType:\"json\",\n\n\t success:function(data) {\n\t \n\t $.each(data, function(key, value){ \n\t pCabello \n\t $(\"#pBarba\").empty();\n\t if(value.tenia == \"SÍ\"){\n\t $(\"#pBarba\").show();\n\t $(\"#pBarba\").append('<div class=\"card\">'+\n\t '<div class=\"card-header bg-white\">'+\n\t '<h5><b>Datos de la barba</b></h5>'+\n\t '</div>'+\n\t '<div class=\"card-body\">'+\n\t '<div class=\"row\" >'+\n\t '<div class=\"col-4\">'+\n\t '<label>Color:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.color+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Tipo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.tipo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Estilo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.estilo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Observaciones:</label>'+\n\t '</div>'+\n\n\t '<div class=\"col\">'+\n\t '<p>'+value.observaciones+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>');\n\t }else{\n\t $(\"#pBarba\").hide();\n\t }\n\t \n\t });\n\t },\n\t });// fin de detalles de barba.\n\n\t //peticion para obtener detalles de bigote.\n\t $.ajax({\n\t url: routeDescrip+'/get_bigote/'+extraviado,\n\t type:\"GET\",\n\t dataType:\"json\",\n\n\t success:function(data) {\n\t \n\t $.each(data, function(key, value){ \n\t $(\"#pBigote\").empty();\n\n\t if(value.tenia == \"SÍ\"){\n\t $(\"#pBigote\").show();\n\t $(\"#pBigote\").append('<div class=\"card\">'+\n\t '<div class=\"card-header bg-white\">'+\n\t '<h5><b>Datos del bigote</b></h5>'+\n\t '</div>'+\n\t '<div class=\"card-body\">'+\n\t '<div class=\"row\" >'+\n\t '<div class=\"col-4\">'+\n\t '<label>Color:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.color+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Tipo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.tipo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Estilo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.estilo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Observaciones:</label>'+\n\t '</div>'+\n\n\t '<div class=\"col\">'+\n\t '<p>'+value.observaciones+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>');\n\n\t }else{\n\t $(\"#pBigote\").hide();\n\t }\n\t \n\t });\n\n\t },\n\t \n\t });// fin de detalles de bigote.\n\n\t //peticion para obtener detalles de patilla\n\t $.ajax({\n\t url: routeDescrip+'/get_patilla/'+extraviado,\n\t type:\"GET\",\n\t dataType:\"json\",\n\n\t success:function(data) {\n\t \n\t $.each(data, function(key, value){ \n\t $(\"#pPatilla\").empty();\n\n\t if(value.tenia == \"SÍ\"){\n\t $(\"#pPatilla\").show();\n\t $(\"#pPatilla\").append('<div class=\"card\">'+\n\t '<div class=\"card-header bg-white\">'+\n\t '<h5><b>Datos de las patillas</b></h5>'+\n\t '</div>'+\n\t '<div class=\"card-body\">'+\n\t '<div class=\"row\" >'+\n\t '<div class=\"col-4\">'+\n\t '<label>Color:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.color+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Tipo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.tipo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Estilo:</label>'+\n\t '</div>'+\n\t '<div class=\"col\">'+\n\t '<p>'+value.estilo+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\n\t '<div class=\"row\" style=\"margin-top:-10px\">'+\n\t '<div class=\"col-4\">'+\n\t '<label>Observaciones:</label>'+\n\t '</div>'+\n\n\t '<div class=\"col\">'+\n\t '<p>'+value.observaciones+'</p>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>'+\n\t '</div>');\n\t }else{\n\t $(\"#pPatilla\").hide();\n\n\t }\n\t \n\t });\n\t }, \n\t });// fin de detalles de patilla\n\t}", "static oneCita(req, res){ \n var id = req.params.id; \n Citas_Medicas.findAll({\n where: {codigo_p: id}\n //attributes: ['id', ['description', 'descripcion']]\n }).then((Citas) => {\n res.status(200).json(Citas);\n }); \n }", "function carregarDados() { \n \n function success(data) {\t\t\t\t\t\t\n if(data) {\n $('div.modal-body').html(data);\n selector.popUp();\n bootstrapInit();\n dataTableItens();\n dataTableAutorizacoes();\n acoes();\n }\n }\n\n execAjax1('GET','/_13050/show/'+param.id,null,success);\n }", "function getFolio(){\n $http.get(\"edicionController?getUsuarios=1\").success(function(data){\n $scope.datos= data;\n console.warn(data);\n });\n }", "function loadCor(id) {\n var dilon=JSON.stringify(carRec[id]);\n var noop = JSON.parse(dilon);\n console.log(noop);\n $(\"#misdatos\").empty();\n $(\"#misdatos\").append(\n \" <h4>\"+\"Destinatario: \"+noop.destino+\"</h4>\",\n \" <h4>\"+\"Mensaje: \"+noop.mensaje+\"</h4>\",\n \" <h4>\"+\"Fecha: \"+noop.fecha+\"</h4>\" \n );\n }", "function mostrarDatosCompra() {\n //Tomo los datos que pasé en la funcion navegar\n const unaCompra = this.data;\n if (unaCompra) {\n const idProd = unaCompra.idProducto;\n const productoComprado = obtenerProductoPorID(idProd);\n const subTotal = unaCompra.cantidad * productoComprado.precio;\n //Escribo el mensaje a mostrar\n const mensaje = `Producto <strong>${productoComprado.nombre}</strong>.\n <br> Cantidad comprada: <strong>${unaCompra.cantidad}</strong>.<br>\n Sub Total: <strong> $${subTotal}</strong>`;\n //Muestro el mensaje\n $(\"#pDetalleCompraMensaje\").html(mensaje);\n } else {\n ons.notification.alert(\"Ocurrió un error, por favor contacte al administrador\", { title: 'Oops!' });\n }\n}", "function cargarDatosCabecera() {\n $(\".nombre\").text(nombre)\n $(\".titulo\").text(titulo)\n $(\"#resumen\").text(resumen)\n $(\"#email\").text(contacto.mail)\n $(\"#telefono\").text(contacto.telefono)\n $(\"#direccion\").text(`${contacto.calle} ${contacto.altura}, ${contacto.localidad}`)\n}", "async index () {\n const atividade = await AtividadeDoDia.all();\n return atividade;\n }", "async getDatosAcopio() {\n let query = `SELECT al.almacenamientoid, ca.centroacopioid, ca.centroacopionombre, \n concat('Centro de Acopio: ', ca.centroacopionombre, ' | Propietario: ', pe.pernombres, ' ', pe.perapellidos) \"detalles\"\n FROM almacenamiento al, centroacopio ca, responsableacopio ra, persona pe\n WHERE al.centroacopioid = ca.centroacopioid AND ca.responsableacopioid = ra.responsableacopioid AND ra.responsableacopioid = pe.personaid;`;\n let result = await pool.query(query);\n return result.rows; // Devuelve el array de json que contiene todos los controles de maleza realizados\n }", "function alldatos(nombre,apellido,edad,genero,ciudad,pais){\n this.nombre=nombre;\n this.apellido=apellido;\n this.edad=edad;\n this.genero=genero;\n this.ciudad=ciudad;\n this.pais=pais;\n }", "function InicializarControles(){\t\n\tif (gListaLuz.length === 0){\n\t\tvar hidden = $(\"#hiddenDb\").val();\n\t\tgListaLuz = $.parseJSON(hidden);\n\t}\n}", "function cargarInformacionEnTabla(data)\n{\n\t\t\n\t\t//se destruye el datatable al inicio\n\tif(typeof table !== \"undefined\")\n\t{\n\t\t\n table.destroy(); \n $('#tablaModulos').empty();\n }\n\t\t\n\t\t\t\n\t\t table = $('#tablaModulos').DataTable({\n\t\t\t\"data\": data,\n\t\t\tcolumns: [\n\t\t\t{ data: \"bloques\"},\n\t\t\t{ data: \"LUNES\"},\n\t\t\t{ data: \"MARTES\"},\n\t\t\t{ data: \"MIERCOLES\" },\n\t\t\t{ data: \"JUEVES\" },\n\t\t\t{ data: \"VIERNES\" },\n\t\t\t{ data: \"SABADO\" },\n\t\t\t{ data: \"DOMINGO\" },\n\t\t\t\n\t\t\t// {data: null, className: \"center\", defaultContent: '<a id=\"view-link\" class=\"edit-link\" href=\"#\" title=\"Edit\">Estudiantes por Salón </a>'},\n\t\t\t// {data: null, className: \"center\", defaultContent: '<a id=\"asistencias-link\" class=\"asistencias-link\" href=\"#\" title=\"Edit\">Asistencias</a>'}\n\t\t\t],\n\t\t\t\"info\": false,\n\t\t\t\"order\": [[ 0, \"asc\" ]],\n\t\t\t\"scrollY\": \"300px\",\n\t\t\t\"scrollX\": true,\n\t\t\t\"bDestroy\": true,\n\t\t\t\"bSort\": false,\n\t\t\t\"scrollCollapse\": true,\n\t\t\t\"searching\": false,\n\t\t\t\"paging\": false,\n\t\t\t\"filter\":false,\n\t\t\t\"columnDefs\": [\n\t\t\t// {\"targets\": [ 0 ],\"visible\": true,\"searchable\": true},\n\t\t\t// {\"targets\": [ 1 ],\"visible\": true,\"searchable\": false},\n\t\t\t// {\"targets\": [ 3 ],\"visible\": false,\"searchable\": false},\n\t\t\t// {\"targets\": [ 5 ],\"visible\": false,\"searchable\": false},\n\t\t\t// {\"targets\": [ 15 ],\"visible\": false,\"searchable\": false},\n\t\t\t// {\"targets\": [ 13 ],\"visible\": false,\"searchable\": false},\n\t\t\t// {\"targets\": [ 16 ],\"visible\": false,\"searchable\": false},\n\t\t\t// {\"targets\": [ 17 ],\"visible\": false,\"searchable\": false}\n\t\t\t],\n\t\t\t\"language\": {\n\t\t\t\t\"url\": \"//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/Spanish.json\",\n \"sProcessing\": \"Procesando...\",\n\t\t\t\t\"sSearch\": \"Filtrar:\",\n\t\t\t\t\"zeroRecords\": \"Ningún resultado encontrado\",\n\t\t\t\t\"infoEmpty\": \"No hay registros disponibles\",\n\t\t\t\t\"Search:\": \"Filtrar\"\n\t\t\t}\n\t\t});\n\t\t\n}", "function fetchCuisines() {\n DBHelper.fetchCuisines((error, cuisines) => { // eslint-disable-line no-undef\n if (error) { // Got an error!\n console.error(error);\n } else {\n main.cuisines = cuisines;\n IndexDBHelper.storeCuisines(cuisines); // eslint-disable-line no-undef\n resetCuisines();\n fillCuisinesHTML();\n }\n });\n}", "misDatos() { // un metodo es una funcion declarativa sin el function dentro de un objeto, puede acceder al universo del objeto\n return `${this.nombre} ${this.apellido}`; // por medio del \"this\", que es una forma de acceder a las propiedades del objeto en un metodo\n }", "async function loadComentarios() {\n try {\n let response = await fetch('api/comentarios/' + prodID);\n if (response.ok) {//si la api responde correctamente, muestra los comentarios en pantalla\n let t = await response.json();\n comentarios = t;\n mostrarComentarios();\n }\n else {//si no hay comentarios, imprime un mensaje de que no hay comentarios para mostrar\n container.innerHTML = \"No hay comentarios para mostrar\";\n }\n }\n catch (response) {\n container.innerHTML = \"No hay comentarios para mostrar\";\n };\n}", "static getConsultaPaciente(req, res){ \n var historial = req.params.historial;\n var tipoConsulta = req.params.tipoConsulta;\n Consultas.findAll({\n where: { numeroHistorial: historial, tipoConsulta:tipoConsulta },\n //attributes: ['id', ['description', 'descripcion']]\n include:[\n { model:Citas_Medicas, attributes:['id'],\n include:[{\n model:Pacientes, attributes:[ 'id','nombre','apellidop','apellidom']\n }]\n }\n ]\n }).then((resp) => {\n res.status(200).json(resp);\n }); \n }", "async show ({ params, request, response, view }) {\n\n return await Database.select('ganadas,perdidas').from('users').where('usuarios','=', params.id)\n \n }", "static getAll() {\r\n return new Promise((next) => {\r\n db.query('SELECT id, nom FROM outil ORDER BY nom')\r\n .then((result) => next(result))\r\n .catch((err) => next(err))\r\n })\r\n }", "async function obtenerTodosLasCiudadesXpais(pais_id) {\n var queryString = '';\n\n console.log('ENTRE');\n queryString = queryString + ' SELECT cd.id, cd.nombre as ciudad';\n queryString = queryString + ' from ciudades cd where pais_id = ? ';\n\n \n\n let ciudad = await sequelize.query(queryString,\n { type: sequelize.QueryTypes.SELECT,\n replacements:[pais_id]})\n return ciudad;\n }", "function cargarActividad(){\n\n\tmostrarActividad(); \n\n\tcomienzo = getActual();\n\n}", "function IncetDat(id) {\n var auxc = new ApiCiudad(\"\", \"\", \"\");\n var id_conte_lis = \"#LCiuDist\" + id;\n var id_conte_depart = \"#LDepDist\" + id;\n $(id_conte_lis).html(\" \"); // limpia la casilla para que se pueda ver \n var id_depart = $(id_conte_depart).val();\n var dat = {\n llave: id_conte_lis,\n idCiu: 0,\n iddist: id_depart\n };\n auxc.idDepart = id_depart;\n auxc.List(dat);\n}", "function listaModelos(){\n return new Promise((resolve,reject) => {\n let qry = `\n select \n usuarioCadastro, tbinfoveiculo.id, nomemodelo, tbmontadoras.nome, anofabricacao, cores, tipochassi, suspensaodianteira, suspensaotraseira, pneusdianteiro, pneutraseiro, freiodianteiro, freiotraseiro, tipodofreio,\n qtdcilindros, diametro, curso, cilindrada, potenciamaxima, torquemaximo, sistemadepartida, tipodealimentacao, combustivel, sistemadetransmissao, cambio, bateria, \n taxadecompessao, comprimento, largura, altura, distanciaentreeixos, distanciadosolo, alturadoassento, tanquedecombustivel, peso, arqFoto\n from tbInfoVeiculo inner join tbmontadoras on tbinfoveiculo.idmontadora = tbmontadoras.id\n `\n db.all(qry, (err,data) => {\n if(err) {\n reject(err);\n }\n resolve(data);\n })\n })\n}", "function loadData() {\n bootcampsFactory.getAllBootcamps()\n .success(function(model) {\n $scope.bootcamps = model.Bootcamps;\n $scope.locations = model.Locations;\n $scope.technologies = model.Technologies;\n })\n .error(function(status) {\n alert(\"Error! Status: \" + status);\n });\n }", "function visualizar_info_oi(id) {\n visualizar_facturacion(id);\n id_oi = id;\n $.ajax({\n url: \"consultar_orden/\",\n type: \"POST\",\n dataType: 'json',\n data: {\n 'id':id,\n 'csrfmiddlewaretoken': token\n },\n success: function (response) {\n //datos de la orden interna\n var data = JSON.parse(response.data);\n data = data.fields;\n //datos de las muestras\n var muestras = JSON.parse(response.muestras);\n //datos del usuario\n var usuario = JSON.parse(response.usuario);\n usuario = usuario.fields;\n //datos del solicitante\n if(response.solicitante != null){\n var solicitante = JSON.parse(response.solicitante);\n solicitante = solicitante.fields;\n }\n var analisis_muestras = response.dict_am;\n var facturas = response.facturas;\n var dhl = response.dict_dhl;\n var links = response.links;\n var fechas = response.fechas;\n //pestaña de información\n $('#titulov_idOI').text(\"Orden Interna #\" + id);\n $('#visualizar_idOI').val(id);\n $('#visualizar_estatus').val(data.estatus);\n $('#visualizar_localidad').val(data.localidad);\n $('#visualizar_fecha_recepcion_m').val(data.fecha_recepcion_m);\n $('#visualizar_fecha_envio').val(data.fecha_envio);\n $('#visualizar_fecha_llegada_lab').val(data.fecha_llegada_lab);\n $('#visualizar_pagado').val(data.pagado);\n $('#visualizar_link_resultados').val(data.link_resultados);\n $('#visualizar_usuario_empresa').text(response.empresa);\n var n = usuario.nombre + \" \" + usuario.apellido_paterno + \" \" + usuario.apellido_materno;\n $('#visualizar_usuario_nombre').text(n);\n $('#visualizar_usuario_email').text(response.correo);\n $('#visualizar_usuario_telefono').text(response.telefono);\n\n //pestaña de observaciones\n $('#visualizar_idioma_reporte').text(data.idioma_reporte);\n\n var html_muestras = \"\";\n if(muestras != null){\n for (let mue in muestras){\n var id_muestra = muestras[mue].pk;\n var objm = muestras[mue].fields;\n\n html_muestras+= build_muestras(id_muestra, objm,analisis_muestras[id_muestra], facturas[id_muestra], dhl, links, fechas);\n }\n }\n $('#muestras-body').html(html_muestras);\n $('#v_observaciones').val(data.observaciones);\n if(!$(\"#factura-tab\").hasClass(\"active\")){\n restaurar_editar();\n }\n else{\n doble_editar();\n }\n }\n })\n}", "function bien_bajas() \r\n{\r\n var t = $('#tbl_bajas');\r\n if ( $.fn.dataTable.isDataTable( '#tbl_bajas' ) ) {\r\n $('#tbl_bajas').DataTable().destroy();\r\n }\r\n \r\n $.ajax({\r\n url: 'controller/puente.php',\r\n type: 'POST',\r\n dataType: 'json',\r\n data: {option: '67'},\r\n async:false,\r\n })\r\n .done(function(bajas) {\r\n $('#tbl_bajas tbody').empty();\r\n //console.log(bajas);\r\n if (bajas.length > 0 ) \r\n {\r\n $.each(bajas, function(i, baja) {\r\n var accion,detalle ,clase_row;\r\n //saber el tipo de baja\r\n if (baja.t_baja == 'Temporal') \r\n {\r\n accion = \r\n '<div class=\"btn-group\">'+\r\n '<button type=\"button\" class=\"btn btn-success btn-flat dropdown-toggle\" data-toggle=\"dropdown\" aria-expanded=\"false\">'+\r\n '<span class=\"caret\"></span>'+\r\n '<span class=\"sr-only\">Toggle Dropdown</span>'+\r\n '</button>'+\r\n '<ul class=\"dropdown-menu\" role=\"menu\">'+\r\n '<li><a href=\"#\" onclick=\"UpdateBajaDefinitiva('+baja.baja_id+');\">Baja definitiva</a></li>'+\r\n '</ul>'+\r\n '</div>' ;\r\n clase_row = 'class=\"bg-yellow \"';\r\n }\r\n else\r\n {\r\n accion = '';\r\n clase_row= 'class=\"bg-red-active \"';\r\n }\r\n //Formar la lista de caracteristicas del bien\r\n detalle = \r\n '<ul>'+\r\n '<li><label>Serie: </label> '+baja.serie+'</li>'+\r\n '<li><label>Inventario: </label> '+baja.inventario+'</li>'+\r\n '<li><label>Marca: </label> '+baja.marca+'</li>'+\r\n '<li><label>Grupo: </label> '+baja.grupo+'</li>'+\r\n '<li><label>Modelo: </label> '+baja.modelo+'</li>'+\r\n '<li><label>Color: </label> '+baja.color+'</li>'+\r\n '<li><label>Material: </label> '+baja.material+'</li>'+\r\n '<li><label>Comentario: </label> '+baja.comentario+'</li>'+\r\n '<li><label>Estatus: </label> '+baja.status+'</li>'+\r\n '</ul>' ;\r\n t.append(\r\n '<tr '+clase_row+'>'+\r\n '<td>'+accion+'</td>'+\r\n '<td>'+baja.id+'</td>'+\r\n '<td>'+detalle+'</td>'+\r\n '<td>'+baja.t_baja+'</td>'+\r\n '</tr>'\r\n );\r\n\r\n });\r\n\r\n }else{\r\n t.append('<tr> <td colspan=\"4\"> <center>NO HAY BIENES DADOS DE BAJA</center> </td> </tr>');\r\n }\r\n })\r\n .fail(function() {\r\n console.log(\"error\");\r\n })\r\n .always(function() {\r\n $('#tbl_bajas').DataTable(\r\n {\r\n 'language':\r\n {\r\n 'url':'//cdn.datatables.net/plug-ins/1.10.19/i18n/Spanish.json'\r\n },\r\n 'lengthMenu': [[10, 25, 50,100, -1], [10, 25, 50, 100, 'Todos']],\r\n \r\n dom: '<<\"col-md-3\"B><\"#buscar.col-sm-4\"f><\"pull-right\"l><t>pr>',\r\n buttons:{\r\n buttons: [\r\n { extend: 'pdf', className: 'btn btn-flat btn-warning',text:' <i class=\"fa fa-file-pdf-o\"></i> Exportar a PDF' },\r\n { extend: 'excel', className: 'btn btn-success btn-flat',text:' <i class=\"fa fa-file-excel-o\"></i> Exportar a Excel' }\r\n ]\r\n } \r\n }\r\n );\r\n });\r\n \r\n return false;\r\n}", "function findAll() {\n\t\t\treturn $http({\n\t\t\t\turl: 'api/comercios',\n\t\t\t\tmethod: \"GET\"\n\t\t\t}).then(\n\t\t\t\tfunction success(response) {\n\t\t\t\t\treturn response.data;\n\t\t\t\t},\n\t\t\t\tfunction error(error) {\n\t\t\t\t\treturn error.data;\n\t\t\t\t});\n\t\t}", "function cargarDataT(){\n\t$(\"#TDataEstu\").DataTable({\n\t\t\"ajax\":{\n\t\t\t\"method\" : \"Get\",\n\t\t\t\"url\" : \"/estudiantes/allEstudiantes\"\n\t\t},\n\t\t\"columns\" :[{\n\t\t\t\"data\" : \"id_estudiante\",\n\t\t\t\"width\" : \"5%\"\n\t\t},{\n\t\t\t\"data\" : \"institucion\",\n\t\t\t\"width\" : \"20%\"\n\t\t},{\n\t\t\t\"data\" : \"nombre\",\n\t\t\t\"width\" : \"12%\"\n\t\t},{\n\t\t\t\"data\" : \"apellido\",\n\t\t\t\"width\" : \"12%\"\n\t\t},{\n\t\t\t\"data\" : \"email\",\n\t\t\t\"width\" : \"15%\"\n\t\t},{\n\t\t\t\"data\" : \"telefono\",\n\t\t\t\"width\" : \"10%\"\n\t\t},{\n\t\t\t\"data\" : \"opciones\",\n\t\t\t\"width\" : \"26%\"\n\t\t}],\n\t\t\"scrollY\":400,\n\t\t\n\t\t\"language\" : {\n \"lengthMenu\" : \"Mostrar _MENU_ \",\n \"zeroRecords\" : \"Datos no encontrados\",\n \"info\" : \"Mostar páginas _PAGE_ de _PAGES_\",\n \"infoEmpty\" : \"Datos no encontrados\",\n \"infoFiltered\" : \"(Filtrados por _MAX_ total registros)\",\n \"search\" : \"Buscar:\",\n \"paginate\" : {\n \"first\" : \"Primero\",\n \"last\" : \"Anterior\",\n \"next\" : \"Siguiente\",\n \"previous\" : \"Anterior\"\n },\n }\n\t});\n}", "initRegistro() {\n this.registro = new _models_register__WEBPACK_IMPORTED_MODULE_7__[\"Register\"](null, // id\n 0, // lecturaAnterior\n 0, // lectura\n 0, // consumo\n this.today.getFullYear(), // year\n this.today.getMonth(), // month\n 0, // excessconsumo\n 0, // excesscosto\n 0, // excessm3\n 0, // base\n 0, // subtotal\n false, // cancelado\n false, // facturado\n '', // meter\n '' // extra\n );\n }", "function carga_logica_informe_anatomia_coronaria() {\r\n\tinicializar_variables_anatomia_coronaria();\r\n\tactualizarDibujoCanvasAnatomiaCoronaria();\r\n\treiniciar_control_seleccion_lesion();\r\n\tcargar_areas_de_seleccion_arterias();\r\n\tcargar_coordenadas_de_lesiones();\r\n}", "function find(){\r\nCustomer.find({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 son: \", ret);\r\n\t\tconsole.log(\"Todo correcto!!\");\r\n\t\t\r\n\t}\r\n\r\n});\r\n\r\n}", "static onlyConsulta(req, res){ \n var id = req.params.id; \n Consultas.findAll({\n where: {id: id}, \n //attributes: ['id', ['description', 'descripcion']]\n include:[ {model:Citas_Medicas,attributes:['id', 'medico']}]\n }).then((data) => {\n res.status(200).json(data);\n }); \n }", "function obtenerDatos() {\n // Obteniendo los valores de los campos\n let nombre = document.getElementById('nombre').value;\n let apellido = document.getElementById('apellido').value;\n let correo = document.getElementById('correo').value;\n let mensaje = document.getElementById('mensaje').value;\n\t\n\n // Crear el objeto de modelo\n let comentario = {}\n comentario.nombre = nombre\n comentario.apellido = apellido\n comentario.correo = correo\n comentario.mensaje = mensaje\n\t\n\n // Formas de imprimir\n //console.log(`El objeto automotor es: ${automotor}`);\n //console.log('El objeto automotor es:' + automotor);\n console.log('El objeto comentario es:', comentario);\n return comentario;\n}", "function MostarDatos() {\n ControlService.ordenes().then(function(response) {\n $scope.datas = response.data.records;\n $scope.search();\n $scope.select($scope.currentPage); \n });\n \n }", "function atualizaDados(){\n\t\t\tatendimentoService.all($scope.data).then(function (response) {\n\t\t\t\tlimpar();\n\t\t\t\t$scope.atendimentos = response.data;\n\t\t\t\t$log.info($scope.atendimentos);\n\t\t\t}, function (error) {\n\t\t\t\t$scope.status = 'Unable to load customer data: ' + error.message;\n\t\t\t});\n\t\t\t$scope.usuario={};\n\t\t}", "function MostrarDatos() {\n ReportesService.muestras().then(function(response) {\n console.log(response.data.records);\n $scope.datas = response.data.records;\n $scope.search();\n $scope.select($scope.currentPage);\n cargarClientes();\n cargarOrdenes();\n });\n console.log($scope.currentPageStores);\n }", "function diagnostico(id,codigo,descripcion,complicacion)\r\n{\r\n\tthis.id = id;\r\n\tthis.codigo = codigo;\r\n \tthis.descripcion = descripcion;\r\n \tthis.complicacion = complicacion;\r\n}", "function cargarInformacion(){\n $.getJSON(\"js/attributes.json\", function(myData) {\n attributesOfficial = myData;\n new Vue({\n el: '#cont-myAttributes',\n data: {\n todos: myData\n },\n methods:{\n addAttributesGlobal:function (argument) { \n for(let i in this.todos){\n for(let j in this.todos[i].attributes){\n if(this.todos[i].attributes[j].uid == argument){\n var index = isContenido(attributesGlobal, this.todos[i].attributes[j].name); \n if (index > -1) {\n attributesGlobal.splice(index, 1); \n }else{\n attributesGlobal.push(this.todos[i].attributes[j].name);\n } \n }\n }\n } \n }\n } \n });\n $('.i-checks').iCheck({\n checkboxClass: 'icheckbox_square-green',\n radioClass: 'iradio_square-green',\n }); \n });\n $.getJSON(\"js/arquitectures.json\", function(myDat) {\n arquitecturesOfficial = myDat;\n new Vue({\n el: '#cont-myArquitecturas',\n data: {\n todos: myDat\n },\n methods:{\n addArquitecturesGlobal:function(typeUID, argument){\n var control = true;\n for(let i in this.todos){\n for(let j in this.todos[i].arquitectures){\n if(this.todos[i].arquitectures[j].uid == argument){\n if(control){\n var index = isContenido(arquitecturesGlobal, this.todos[i].arquitectures[j].name); \n if (index > -1) {\n arquitecturesGlobal.splice(index, 1); \n }else{\n arquitecturesGlobal.push(this.todos[i].arquitectures[j].name);\n }\n control = false;\n } \n }\n }\n }\n\n //Esto lo tengo que hacer para controlar la vista\n for(let i in this.todos){\n for(let j in this.todos[i].arquitectures){ \n if(this.todos[i].uid != typeUID && this.todos[i].arquitectures[j].uid == argument){ \n caja = document.getElementById(\"caja_\"+this.todos[i].uid+\"_\"+argument);\n if(caja.hidden){\n caja.hidden = false ; \n }else{\n caja.hidden = true ; \n } \n } \n }\n }\n\n\n arrayUidAttr = [];\n for(let i in attributesGlobal){\n uidattr = getUidByName(attributesOfficial, attributesGlobal[i]); \n arrayUidAttr.push(uidattr);\n }\n\n for(let i in this.todos){\n for(let j in this.todos[i].arquitectures){\n if(this.todos[i].uid == typeUID && this.todos[i].arquitectures[j].uid == argument){ \n peso = document.getElementById(\"peso_\"+this.todos[i].uid+\"_\"+argument); \n if(peso.innerHTML == \"...\"){\n peso.innerHTML = \"\";\n my_scores = getScore(arquitecturesOfficial, argument, arrayUidAttr); \n var rta = \"\";\n for(let k in arrayUidAttr){\n rta += getNamedByUid(attributesOfficial, arrayUidAttr[k])+\": \"+my_scores[k]+\" \";\n }\n peso.innerHTML = rta; \n }else{\n peso.innerHTML = \"...\"; \n }\n \n\n } \n }\n } \n \n\n }\n }\n });\n $('.i-checks').iCheck({\n checkboxClass: 'icheckbox_square-green',\n radioClass: 'iradio_square-green',\n }); \n }); \n}" ]
[ "0.62147325", "0.62147325", "0.62147325", "0.6159115", "0.61129856", "0.60013026", "0.5920522", "0.58973265", "0.5827785", "0.5803361", "0.57637894", "0.57512033", "0.5745033", "0.57262886", "0.57129127", "0.56810206", "0.56801534", "0.56613994", "0.56613994", "0.56467205", "0.56405014", "0.5619563", "0.5608711", "0.56050146", "0.56026036", "0.5602004", "0.5589349", "0.55791706", "0.55775815", "0.5575264", "0.55677176", "0.5550157", "0.554846", "0.55229604", "0.55024517", "0.5500306", "0.54991674", "0.5493096", "0.5491335", "0.54895544", "0.54671025", "0.5462537", "0.54565024", "0.5455287", "0.54533774", "0.5449683", "0.54490674", "0.5446398", "0.54428047", "0.5435964", "0.54325503", "0.54235864", "0.54210347", "0.542091", "0.5416547", "0.54160506", "0.5404382", "0.54040754", "0.5402754", "0.53960305", "0.53944623", "0.5393459", "0.5393213", "0.5389713", "0.5388359", "0.5385015", "0.53825927", "0.5379714", "0.5377869", "0.53759915", "0.5375614", "0.5374925", "0.5374527", "0.53689134", "0.53646123", "0.5355345", "0.5352532", "0.5351638", "0.53498787", "0.53390145", "0.53389686", "0.53388274", "0.53360933", "0.5329351", "0.53276694", "0.53265154", "0.53238344", "0.53226966", "0.5322358", "0.531561", "0.5312746", "0.530989", "0.53017193", "0.52931273", "0.5290218", "0.5288988", "0.52874905", "0.5283432", "0.5280836", "0.52783537", "0.5270461" ]
0.0
-1
car para de departamento para listado
function DatLisDepart(id, nombre) { return '<option value="' + id + '">' + nombre + '</option>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getDepartamentosDropdown() {\n $http.post(\"Departamentos/getDepartamentosTotal\").then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.listaDepartamentos.data = r.data.d.data;\n \n }\n })\n }", "function deptList() {\n return connection.query(\"SELECT id, dept_name FROM departments\");\n}", "function getDepartments() {\n Department.getAll()\n .then(function (departments) {\n $scope.departments = departments;\n })\n ['catch'](function (err) {\n Notification.error('Something went wrong with fetching the departments, please refresh the page.')\n });\n }", "function getDepartamentoEmpleados(id) {\n $http.post(\"Departamentos/getDepartamentoEmpleados\", { id: id }).then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.lista.data = r.data.d.getDepartamentoEmpleados;\n vm.lista.disp = [].concat(vm.lista.data);\n }\n })\n }", "async function obtenerDepartamentos() {\n try {\n let response = await axios.get(URL_departamentos)\n let data = response.data.items\n let result = []\n\n // Opcion por defecto\n result.push(<option value={0} key={0}>Seleccione una Opción</option>)\n \n for (let index in data) { \n result.push(<option value={data[index].codigo} key={data[index].codigo}>{data[index].nombre}</option>)\n }\n setDepartamentos(result)\n \n // Se obtiene el municipio por defecto a partir del departamento por defecto\n recalcularMunicipios()\n\n } catch (error) {\n console.log('Fallo obteniendo los departamentos / municipios' + error)\n } \n }", "function getList() {\n return fetch(\n 'https://5f91384ae0559c0016ad7349.mockapi.io/departments',\n ).then((data) => data.json());\n }", "function getAvailableDepartments() {\n departmentService.getAllDepartments().then(function(departments) {\n $scope.departments = departments.data;\n })\n }", "function getDepartments() {\n return $http.get(API.sailsUrl + '/departments')\n .then(function success(res) {\n if(res.data) {\n return res.data.data;\n } else {\n return $q.reject(res.data);\n }\n }).catch(function error(reason) {\n return $q.reject({\n error: 'Error with API request.',\n origErr: reason\n });\n });\n }", "getDepartments() {\n return this.departments;\n }", "function consultarDepartamentos(){ \n\tvar selector = $('#selectTerritorialDivision').val();\n\t$.post(\"gestionEspectro/php/consultasConsultasBD.php\", { consulta: 'departamentos', idConsulta: selector }, function(data){\n\t\t$(\"#departamentos\").html(data);\n\t\t$(\"#municipios\").html(\"\");\n\t\t$(\"#tipoAsignacion\").html(\"La asignación es a nivel departamental\");\n\n\t}); \n}", "function viewDepartments(){\n connection.query(queryList.deptList, function(err, res){\n if(err) throw err;\n console.table(res);\n startQ();\n })\n\n}", "function getDepartments() {\n const query = \"SELECT * FROM department\";\n return queryDB(query);\n}", "function deptPartido(d) {\n return d.properties.PARTIDO;\n }", "function getDepartments(data) {\n if (data.jobs.job[0]) {\n return data.jobs.job[0].company.company_departments.department;\n }\n}", "function obtenerArbolDepartamentos(s, d, e) {\n if(s) {\n $('form[name=frmGestionPerfil] .arbolDepartamento').append(procesarArbolDep(d));\n $('form[name=frmGestionPerfil] .arbolDepartamento').genTreed(); // Añade clases y imagenes a la lista html para hacerla interactiva\n\n $('form[name=frmGestionPerfil] .arbolDepartamento.tree li').dblclick(function (e) {\n let me = $(this);\n $('form[name=frmGestionPerfil] .tree li').each(function () {\n $(this).removeClass('filaSeleccionada');\n });\n me.addClass('filaSeleccionada');\n\n Moduls.app.child.templateParamas.template.Forms.frmGestionPerfil.set({\n p_objtiv: me.attr('id')\n });\n\n $('form[name=frmGestionPerfil] [name=nomdep]').val(me.attr('name'));\n $('form[name=frmGestionPerfil] [name=nomdep]').change();\n $('form[name=frmGestionPerfil] .arbolDepartamento').addClass('dn');\n return false;\n });\n } else {\n validaErroresCbk(d, true);\n }\n}", "function viewAllDepartments() {\n connection.query(\n 'SELECT d_id AS id, name AS department_name FROM department ORDER BY d_id ASC;',\n function (err, results) {\n if (err) throw err;\n console.table(results);\n backMenu();\n }\n );\n}", "function viewDepartments() {\n \n let query =\n \"SELECT department.id, department.dept_name FROM department\";\n return connection.query(query, function (err, res) {\n if (err) throw err;\n console.table(res);\n start();\n });\n}", "function viewAllEmployeesByDepart() {\n const query2 = `select department.id,department.name\n FROM employee INNER JOIN role ON (employee.role_id = role.id) INNER JOIN department ON (department.id = role.department_id) group by department.id,department.name;`;\n connection.query(query2, (err, res) => {\n if (err) throw err;\n const departmentChoices = res.map((data) => ({\n value: data.id, name: data.name,\n }));\n // console.table(res);\n // console.log(departmentChoices);\n promptDepartment(departmentChoices);\n });\n}", "function whichDepart() {\r\n\r\n let lcraDepartment = [\"Business Development\", \"Chief Administrative Officer\", \"Chief Commercial Officer\", \"Chief Financial Officer\", \"Chief of Staff\", \"Commercial Asset Management\", \"Communications\", \"Community Services\", \"Construction I\", \"Construction II\", \"Construction Support\", \"Controller\", \"Corporate Events\", \"Corporate Strategy\", \"Critical Infra Protection\", \"Critical Infrastructure Protection\", \"Customer Operations\", \"Cybersecurity\", \"Dam and Hydro\", \"Digital Services\", \"Enterprise Operations\", \"Environmental Affairs\", \"Environmental Field Services\", \"Environmental Lab\", \"Facilities Planning Management\", \"Finance\", \"Financial Planning & Strategy\", \"Fleet Services\", \"FPP Maintenance\", \"FPP Operations\", \"FPP Plant Support\", \"FRG Maintenance\", \"FRG Operations\", \"FRG Plant Support\", \"Fuels Accounting\", \"General Counsel\", \"General Manager\", \"Generation Environmental Group\", \"Generation Operations Mgmt\", \"Governmental & Regional Affairs\", \"Hilbig Gas Operations\", \"Human Resources\", \"Information Management\", \"Irrigation Operations\", \"Lands & Conservation\", \"Legal Services\", \"Line & Structural Engineering\", \"Line Operations\", \"LPPP Maintenance\", \"LPPP Operations\", \"LPPP Plant Support\", \"Materials Management\", \"Mid-Office Credit and Risk\", \"P&G Oper Reliability Group\", \"Parks\", \"Parks District - Coastal\", \"Parks District - East\", \"Parks District - West\", \"Plant Operations Engr. Group\", \"Plant Support Service\", \"Project Management\", \"Public Affairs\", \"QSE Operations\", \"Rail Fleet Operations\", \"Rangers\", \"Real Estate Services\", \"Regulatory & Market Compliance\", \"Regulatory Affairs\", \"Resilience\", \"River Operations\", \"Safety Services\", \"Sandy Creek Energy Station\", \"Security\", \"Service Quality & Planning\", \"SOCC Operations\", \"Strategic Initiatives & Transformation\", \"Strategic Sourcing\", \"Substation Engineering\", \"Substation Operations\", \"Supply Chain\", \"Survey GIS & Technical Svc\", \"System Control Services\", \"System Infrastructure\", \"Technical & Engineering Services\", \"Telecom Engineering\", \"Trans Contract Construction\", \"Trans Operational Intelligence\", \"Transmission Design & Protect\", \"Transmission Executive Mgmt\", \"Transmission Field Services\", \"Transmission Planning\", \"Transmission Protection\", \"Transmission Strategic Svcs\", \"Water\", \"Water Contracts & Conservation\", \"Water Engineering\", \"Water Quality\", \"Water Resource Management\", \"Water Surface Management\", \"Wholesale Markets & Sup\"];\r\n\r\n //let lcraDepart = document.getElementById(\"lcraDepart\");\r\n\r\n\r\n for(let i = 0; i < lcraDepartment.length; i++){\r\n let optn = lcraDepartment[i];\r\n let el = document.createElement(\"option\");\r\n el.value = optn;\r\n el.textContent = optn;\r\n lcraDepart.appendChild(el);\r\n }\r\n}", "function deplist(){\n return $.ajax({\n url:dir2,\n data:'aksi=cmbdepartemen',\n dataType:'json',\n type:'post'\n });\n }", "function GetDepartment(deptList)\n{\n let departments = '';\n for(const dept of deptList)\n {\n departments = `${departments} <div class='dept-label'>${dept}</div>`\n }\n return departments;\n}", "function GetDepartment(deptList)\n{\n let departments = '';\n for(const dept of deptList)\n {\n departments = `${departments} <div class='dept-label'>${dept}</div>`\n }\n return departments;\n}", "viewDepartments() {\n return connection.query(`SELECT * from department`)\n }", "function findAllDepartments() {\n return connection.query(\"SELECT id AS ID, name AS Department FROM department\");\n}", "function viewAllDepartments(conn, start) {\n conn.query(`SELECT * FROM department ORDER BY name;`, function(err, results) {\n if (err) throw err;\n console.table(results);\n start();\n });\n }", "function getEmpleadosDropdown() {\n $http.post(\"lateral/getNombresDropdown\").then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.listaEmpleados.data = r.data.d.data;\n \n }\n })\n }", "function viewDepartments(){\n // Select all data from the departmenets table\n connection.query(`SELECT * FROM department_table`, (err, res) => {\n // If error log error\n if (err) throw err;\n // Display the data in a table format...\n console.table(res);\n // Run the task completed function\n taskComplete();\n })\n }", "function departmentList() {\n\n\t\t// empty array to store the department names into\n\t\tvar department_list = [];\n\n\t\t// store the query string into a variable to pass to connection.query()\n\t\tvar query = 'SELECT DepartmentName FROM Departments';\n\t\t\n\t\t// grab the department names\n\t\tconnect.connection.query(query, function(err, data) {\n\t\t\t\n\t\t\t// if error, throw error\n\t\t\tif (err) throw err;\n\n\t\t\t// loop through each department name returned from data\n\t\t\tvar i;\n\t\t\tvar data_length = data.length;\n\t\t\tfor (i = 0; i < data_length; i++) {\n\t\t\t\t\n\t\t\t\t// push each department name into the department_list array\n\t\t\t\tdepartment_list.push(data[i].DepartmentName);\n\n\t\t\t} // end for loop\n\n\t\t\t// call addNewProduct and pass the completed department_list array\n\t\t\taddNewProduct(department_list);\n\n\t\t}); // end connect.connection.query()\n\n\t} // end departmentList()", "function viewDepartments(){\n connection.query(`SELECT * FROM departments`, function (err, res){\n if (err) throw err\n console.table(res);\n startApp();\n })\n }", "viewAllDept() {\n\t\tconst query = `SELECT *\n\t FROM department;`;\n\t\treturn this.connection.query(query);\n\t}", "function queryDepartments() {\n let departments = [];\n connection.query('SELECT department_name FROM department', (error, response) => {\n if (error) throw error;\n\n response.forEach(department => {\n departments.push(department.department_name);\n })\n })\n\n return departments\n}", "async function viewDepartments() {\n\tconst res = await queryAsync('SELECT * FROM department');\n\tconst allDepartments = [];\n\tconsole.log(' ');\n for (let i of res) {\n\t allDepartments.push({ ID: i.id, NAME: i.name });\n }\n console.table(allDepartments);\n start();\n}", "function _listarPagamentos(guidPedido) {\r\n\r\n console.log(PagamentoResource.listarPagamentosPorPedidoHabilitacao);\r\n\r\n PagamentoResource.listarPagamentosPorPedidoHabilitacao(guidPedido).getList()\r\n .then(function(response) {\r\n vm.pagamentos = response.data.plain();\r\n })\r\n .catch(function(err) {\r\n console.log(err);\r\n });\r\n }", "function viewDepartments() {\n connection.query(\"SELECT * FROM department\", function(error, results) {\n if (error) throw error;\n console.table(results);\n start();\n })\n}", "function showDepartments() {\n //sql consult select\n connection.query(`SELECT * FROM department`, (err, res) => {\n if (err) throw err;\n \n if (res.length > 0) {\n console.log('\\n')\n console.log(' ** Departments **')\n console.log('\\n')\n console.table(res);\n }\n //calls the menu to display the question again\n menu();\n });\n }", "async function viewDepartments () {\n \n try {\n const departments = await connection.getAllDepartments();\n console.table(departments);\n } catch(err) {\n console.log(err); \n }\n \n \n employeeChoices();\n \n }", "function getDepartments() {\n\tsocket.emit('departmentRequest',\"\");\n}", "departamento() {\n return super.informacion('departamento');\n }", "function getAll(req, res) {\n tipocliente.findAll().then(tipo_cliente => {\n return res.status(200).json({\n ok: true,\n tipo_cliente\n });\n }).catch(err => {\n return res.status(500).json({\n message: 'Ocurrió un error al buscar los departamentos'\n });\n });\n}", "async function viewByDepart() {\n const depsArray = await getDepsInArray();\n // Prompts\n const { department }= await prompt({\n name: \"department\",\n message: \"What department would you like to chose?\",\n choices: depsArray.map((depsItem) => ({\n name: depsItem.name,\n value: depsItem.id,\n })),\n type: \"list\",\n });\n \n const query = `SELECT first_name, last_name, title, salary\n FROM employee \n INNER JOIN role ON employee.role_id = role.id \n INNER JOIN department ON role.department_id= department.id \n WHERE department.id = ?`;\n \n\n // Send request to database\n const data = await connection.query(query, [department]);\n console.table(data);\n \n }", "getDepartamento(){\r\nreturn this.departamento;\r\n}", "function viewDepartments() {\n connection.query(\"SELECT * FROM department\", function (err, res) {\n if (err) throw err;\n console.log(\"\\n\" + res.length + \" departments found!\\n\" + \"______________________________________\\n\");\n for (var i = 0; i < res.length; i++) {\n console.log(\n \"|| \" +\n res[i].id +\n \" ||\\t\" +\n res[i].title + \"\\n\" + \"______________________________________\\n\"\n );\n }\n start();\n });\n}", "function somarInventarioDepartamento(departamento) {\n let somaInventario = 0;\n for (p in listaProdutos) {\n if (listaProdutos[p].departamento.nomeDepto == departamento) {\n somaInventario += listaProdutos[p].qtdEstoque * listaProdutos[p].preco\n }\n }\n somaInventario = somaInventario.toLocaleString('pt-BR', {style: 'currency', currency: 'BRL'});\n return {departamento, somaInventario};\n}", "function cmbdepartemen(typ,dep){\n var u= dir2;\n var d='aksi=cmb'+mnu2;\n ajax(u,d).done(function (dt) {\n var out='';\n if(dt.status!='sukses'){\n out+='<option value=\"\">'+dt.status+'</option>';\n }else{\n if(dt.departemen.length==0){\n out+='<option value=\"\">kosong</option>';\n }else{\n $.each(dt.departemen, function(id,item){\n out+='<option '+(dep==item.replid?' selected ':'')+' value=\"'+item.replid+'\">'+item.nama+'</option>';\n });\n }\n if(typ=='filter'){ // filter (search)\n $('#departemenS').html(out);\n cmbtahunajaran('filter','');\n }else{ // form (edit & add)\n $('#departemenDV').text(': '+dt.departemen[0].nama);\n }\n }\n });\n }", "function thnlist(dep){\n return $.ajax({\n url:dir3,\n data:'aksi=cmbproses&departemen='+dep,\n dataType:'json',\n type:'post'\n });\n }", "function loadDeparturesData() {\n\n //add a empty option\n // let departureOption = document.createElement('option');\n // departureOption.text = '';\n // document.querySelector('#slcDepartures').add(departureOption);\n\n for (let i = 0; i < airports.length; i++) {\n let departureOption = document.createElement('option');\n departureOption.text = airports[i].departure;\n document.querySelector('#slcDepartures').add(departureOption);\n }\n\n loadDestinationsData();\n}", "function displayAllDepartments() {\n let query = \"SELECT * FROM department \";\n connection.query(query, (err, res) => {\n if (err) throw err;\n\n console.log(\"\\n\\n ** Full Department list ** \\n\");\n console.table(res);\n });\n}", "function viewAllDepts() {\n connection.query(\"SELECT d.name AS Department FROM department d ORDER BY d.name;\", function (err, res) {\n if (err) throw err;\n let tableResults = [];\n for (var i = 0; i < res.length; i++) {\n var deptObj = [res[i].Department];\n tableResults.push(deptObj);\n }\n console.clear();\n console.log(\n \" ------------------------------------ \\n ALL COMPANY DEPARTMENTS AT THIS TIME \\n ------------------------------------\"\n );\n console.table([\"Department\"], tableResults);\n actions();\n });\n}", "function viewDepartmnt() {\n \n connection.query(\" SELECT * FROM department \", function (error, result) \n {\n if (error) throw error;\n console.table(result);\n mainMenu()\n\n });\n\n }", "function getDepartments(school){\n\n\t$.getJSON(\"/api/departments/\" + school, function (data) {\n\t\tvar depts =[];\n\t\tdepts = data.departments;\n\t\tvar deptDropdown = [];\n\n\t\tfor (var i = 0; i < depts.length; i++){\n\t\t\tdeptDropdown.push('<option>' + depts[i] + '</option>');\n\t\t}\n\n\t\t$( \"<select/>\", {\n\t\t\t\"class\": \"deptSelector\",\n\t\t\t\"id\": \"dept\",\n\t\t\t\"style\": \"display:inline\",\n\t\t\t\"name\": \"department\",\n\t\t\thtml: deptDropdown.join( \"\" )\n\t\t }).appendTo( \"body\" );\n\n\n\t});\n}", "function viewDepartments() {\n db.query('SELECT * FROM department', function (err, results) {\n console.table(results);\n goPrompt();\n });\n}", "AGREGAR_DPTOS(state, departamentos) {\n state.departamentos = departamentos;\n }", "function viewAllDepartments() {\n db.query(\"SELECT * FROM department\", function (err, res) {\n if (err) throw err;\n console.log(\n \"---------------------------------------------------------------------------------------------------------------------------------------\"\n );\n console.table(res);\n console.log(\n \"---------------------------------------------------------------------------------------------------------------------------------------\"\n );\n start();\n });\n}", "function departamento(iddepartamento) {\n var tipoeleccion = $('#TIPOELECCION').val()\n var id =0;\n\n let dept;\n let municipios;\n let template ='';\n\n tipoeleccion=parseInt(tipoeleccion)\n id = parseInt(iddepartamento);\n\n console.log(tipoeleccion);\n console.log(id);\n //los casos especiales son 5, 12, 14, 19 que son los que tienen elecciones municipales\n switch (id) {\n case 0:\n dept = JSON.stringify(NACIONAL)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n case 1:\n dept = JSON.stringify(GUATEMALA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 2:\n dept = JSON.stringify(SACATEPEQUEZ)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 3:\n dept = JSON.stringify(CHIMALTENANGO)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n console.log(template);\n\n });\n break;\n\n case 4:\n dept = JSON.stringify(ELPROGRESO)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 5:\n if (tipoeleccion == 1) {\n dept = JSON.stringify(ESCUINTLA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n } else {\n parseado = JSON.stringify(mun5)\n response = JSON.parse(parseado)\n\n response.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n }\n break;\n\n case 6:\n dept = JSON.stringify(SANTAROSA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 7:\n dept = JSON.stringify(SOLOLA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 8:\n dept = JSON.stringify(TOTONICAPAN)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 9:\n dept = JSON.stringify(QUETZALTENANGO)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 10:\n dept = JSON.stringify(SUCHITEPEQUEZ)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 11:\n dept = JSON.stringify(RETALHULEU)\n municipios = JSON.parse(dept)\n\n par.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 12:\n if (tipoeleccion == 1) {\n dept = JSON.stringify(SANMARCOS)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n } else {\n parseado = JSON.stringify(mun12)\n response = JSON.parse(parseado)\n\n response.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n }\n\n break;\n case 13:\n dept = JSON.stringify(HUEHUETENANGO)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n case 14:\n if (tipoeleccion == 1) {\n dept = JSON.stringify(QUICHE)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n } else {\n parseado = JSON.stringify(mun14)\n response = JSON.parse(parseado)\n\n response.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n }\n break;\n\n case 15:\n dept = JSON.stringify(BAJAVERAPAZ)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 16:\n dept = JSON.stringify(ALTAVERAPAZ)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 17:\n dept = JSON.stringify(PETEN)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 18:\n dept = JSON.stringify(IZABAL)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 19:\n if (tipoeleccion == 1) {\n dept = JSON.stringify(ZACAPA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n } else {\n parseado = JSON.stringify(mun19)\n response = JSON.parse(parseado)\n\n response.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n }\n\n break;\n\n case 20:\n dept = JSON.stringify(CHIQUIMULA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 21:\n dept = JSON.stringify(JALAPA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 22:\n dept = JSON.stringify(JUTIAPA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n\n case 23:\n dept = JSON.stringify(USA)\n municipios = JSON.parse(dept)\n\n municipios.forEach(dep => {\n template += `<option class=\"success\"value=\"${dep.ID}\">${dep.NAME}</option>`\n });\n break;\n }\n $('#MUN').html(template)\n\n }", "function iniciar(){\n for(var i = 1; i <= 31; i ++){\n var dezena = diaSorteService.montaDezena(i);\n vm.dezenas.push(dezena);\n }\n }", "function listPedido() {\n return new Promise((resolve, reject) => {\n con.query(\"SELECT * FROM pedido\", (err, result) => {\n if (err) reject(err);\n resolve(result);\n });\n });\n}", "function viewDepartments() {\n connection.query(\"SELECT name FROM department\", (err, results) => {\n if (err) throw err;\n console.log(\"\\n\");\n console.table(results);\n console.log(\"===============================\");\n console.log(\"\\n \\n \\n \\n \\n \\n \\n\");\n });\n // RETURN TO MAIN LIST\n runTracker();\n}", "function viewDepartments() {\n connection.query(\"SELECT * FROM departments\", function (err, res) {\n if (err) throw err;\n for (var i = 0; i < res.length; i++) {\n console.log(res[i].id + \" | \" + res[i].name);\n }\n console.log(\"-----------------------------------\");\n start();\n })\n}", "function getDepartmentsApi() {\n return Departments.getDepartments()\n .then(function success(departments) {\n return departments;\n }).catch(function error(reason) {\n //error handling\n $ionicHistory.clearCache().then(function(){ $state.go('error', {reason: reason}); });\n return $q.reject(reason);\n });\n }", "function chargerDomaines() {\n return $.ajax({\n url: urlServiceWeb +'domainesEmploi/' + langue,\n dataType: 'JSON',\n success: function(retour) {\n for(var i = 0; i < retour.items.length; i++) {\n listeDomaines = listeDomaines + '<option value=\"' + retour.items[i].valeur + '\">' + retour.items[i].nom + '</option>';\n }\n },\n error: function() {\n $('#manitouSimplicite').html(messages.erreurs.chargementDomainesEmploi);\n }\n });\n }", "function viewDepartment() {\n const query = `SELECT department FROM department`;\n \n connection.query(query, function(err, res) {\n if (err) throw err;\n console.table(res);\n \n start();\n });\n \n\n}", "function viewDepartments(){\n connection.query(\"SELECT name FROM department\", function(err, result){\n if (err) {\n throw err \n } else {\n console.table(result);\n beginApp();\n }\n });\n}", "constructor(nombre, apellido, departamento) { //es necesario colocar los parametros de la clase padre que se utilizaran en la clase hija\n super(nombre, apellido); //con super mandamos a llamar al constructor de la clase padre\n this._departamento = departamento;\n }", "function viewDepatments() {\n var query = \"SELECT * FROM DEPARTMENTS\";\n con.query(query, function(err, res) {\n if (err) throw err;\n for (var i = 0; i < res.length; i++) {\n console.log(\"\\n\" + \"|| Name: \" + res[i].name + \"|| ID: \" + res[i].id);\n }\n runManager();\n });\n }", "function viewDepartments() {\n connection.query(\"SELECT * FROM department\", function(err, results) {\n if (err) throw err;\n // show results in table format\n console.table(results);\n // re-prompt the user for further actions by calling \"start\" function\n start();\n });\n}", "function listDevises() {\n /*******************************************************************\n ********************************************************************\n ***@GET(admin/devise/list)******************************************\n **********\n ***@return JsonParser***********************************************\n ********************************************************************\n ********************************************************************/\n $http({\n method: 'GET',\n url: baseUrl + 'admin/devise/list',\n data: {},\n headers: { 'Authorization': 'Bearer ' + localStorage.getItem('jeton') }\n }).then(function successCallback(response) {\n $scope.listDevises = response.data.devise_list;\n //console.log(\"La liste de toutes les devises \",$scope.listDevises);\n }).catch(function(err) {\n if (err.status == 500 && localStorage.getItem('jeton') != '' && localStorage.getItem('jeton') != null && localStorage.getItem('jeton') != undefined) {\n deconnectApi.logout(sessionStorage.getItem(\"iduser\")).then(function(response) {\n $location.url('/access/login');\n $state.go('access.login');\n }).catch(function(response) {});\n };\n });\n }", "function viewDept() {\n db.selectAllDepartments()\n .then(([data]) => {\n console.log(`${separator}\\n DEPARTMENTS\\n${separator}`);\n console.table(data);\n console.log(`${separator}\\n`);\n })\n .then(() => {\n promptAction();\n })\n}", "function allDepartments() {\n connection.query(\"SELECT * FROM departments\", function (err, res) {\n if (err) throw err;\n console.table(\"Departments\", res);\n start();\n });\n}", "async function viewDepartments() {\n const departmentList = await db.obtainAllDepartments();\n\n console.log(`\\nTASK: VIEW ALL DEPARMENTS\\n`);\n console.table(departmentList);\n\n displayMenus();\n}", "function generateDepartments() {\n const query = \"SELECT ID, department FROM department\";\n connection.query(query, (err, res) => {\n departments.splice(0, departments.length);\n departmentsId.splice(0, departmentsId.length);\n for (const j in res) {\n departments.push(res[j].departments);\n departmentsId.push(res[j].ID)\n }\n })\n}", "readAllDepartments() {\r\n return this.connection.query(\r\n \"SELECT department.id, department.name, SUM(role.salary) AS utilized_budget FROM employee LEFT JOIN role on employee.role_id = role.id LEFT JOIN department on role.department_id = department.id GROUP BY department.id, department.name;\"\r\n );\r\n }", "function cmbdepartemenS(){\n deplist().done(function(res){\n var opt='';\n if(res.status!='sukses'){\n notif(res.status,'red');\n }else{\n $.each(res.departemen, function(id,item){\n opt+='<option value=\"'+item.replid+'\">'+item.nama+'</option>'\n });\n $('#departemenS').html(opt);\n cmbprosesS($('#departemenS').val());\n }\n });\n }", "function getEmpleadosTabla() {\n $http.post(\"EmpleadosTabla/getEmpleadosTabla\").then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.lista.data = r.data.d.tablaEmpleado\n vm.lista.disp = [].concat(vm.lista.data);\n }\n })\n }", "function viewDepartments() {\r\n connection.query(\"SELECT employee.first_name, employee.last_name, department.name AS Department FROM employee JOIN role ON employee.role_id = role.id JOIN department ON role.department_id = department.id ORDER BY employee.id;\", \r\n function(err, res) {\r\n if (err) throw err\r\n console.table(res)\r\n questions();\r\n })\r\n}", "function viewDepartment() {\n const queryDepartment = \"SELECT * FROM department\";\n connection.query(queryDepartment, (err, res) => {\n if (err) throw err;\n console.table(res);\n whatToDo();\n });\n}", "function deletList() {\n setPedido([])\n setAcao(!acao)\n }", "async listaPedidos(req, res) {\n /*\n #swagger.tags = ['Clientes']\n #swagger.description = 'Endpoint para obter a lista de todos os pedidos realizados do cliente' \n #swagger.responses[200] = {\n schema: { $ref: \"#/definitions/Pedido\"},\n description: 'Pedidos encontrados'\n }\n\n #swagger.security = [{\n \"apiKeyAuth\": []\n }]\n\n #swagger.responses[400] = {\n description: 'Desculpe, tivemos um problema com a requisição'\n }\n */\n try {\n const pedidosDoCliente = await Pedido.findAll({\n where: {\n id_cliente: req.clienteId,\n status: {\n [Op.ne]: \"carrinho\",\n },\n },\n attributes: {\n exclude: [\"createdAt\", \"updatedAt\"],\n },\n include: {\n model: Produto,\n through: {\n attributes: [],\n },\n attributes: {\n exclude: [\"createdAt\", \"updatedAt\"],\n },\n },\n });\n res.status(200).json(pedidosDoCliente);\n } catch (erro) {\n res.status(400).json({ message: erro.message });\n }\n }", "function getDashAtendimentoPadraoMeuDepartamentoAJAX() {\n return new Promise((resolve, reject) => {\n $.ajax({\n url: APP_HOST + '/atendimento/getRegistroAJAX',\n data: {\n operacao: 'getListaControle',\n dataInicial: '2020-01-01',\n dataFinal: (new Date()).toISOString().split('T')[0],\n departamento: $('#template_user_cargo').data('id'),\n paginaSelecionada: 1,\n registroPorPagina: 16,\n situacao: 10\n },\n type: 'post',\n dataType: 'json'\n }).done(function (resultado) {\n resolve(resultado);\n }).fail(function () {\n reject();\n });\n }).then(function (retorno) {\n return retorno;\n }).catch(function () {\n return [];\n });\n}", "function ListaTipoZona(){\n DoPostAjax({\n url: \"Citas/CtrlCitas/ListarTipoZona\"\n }, function(err, data) {\n if (err) {\n Notificate({\n titulo: 'Ha ocurrido un error',\n descripcion: 'Error con la lista de los tipo de zona.',\n tipo: 'error',\n duracion: 4\n });\n } else {\n let respuesta=JSON.parse(data);\n $(\"#SltComuna\").html(\"<option value='-1'>Seleccione una comuna.</option>\");\n\n for (var val in respuesta) {\n $(\"#SltComuna\").append(\"<option value='\"+respuesta[val].idTipoZona+\"'>\"+respuesta[val].descripcionTipozona+\"</option>\");\n }\n }\n });\n}", "getListaDoctoresOrganizacion(state){\n return state.listarDoctoresOrganizacion\n }", "function listar(ok,error){\n console.log(\"Funcionlistar DAO\")\n helper.query(sql,\"Maestro.SP_SEL_ENTIDAD_FINANCIERA\",[],ok,error)\n}", "findByDept(numDept) {\n let sqlRequest = \"SELECT * FROM activite WHERE code_du_departement=$numDept\";\n let sqlParams = {$numDept: numDept};\n return this.common.run(sqlRequest, sqlParams).then(rows => {\n let activite = [];\n for (const row of rows) {\n activite.push(new Activite(row.code_du_departement, row.libelle_du_departement, row.nom_de_la_commune, row.numero_de_la_fiche_equipement, row.nombre_dEquipements_identiques, row.activite_libelle, row.activite_praticable, row.activite_pratiquee, row.dans_salle_specialisable, row.niveau_de_lActivite, row.localisation, row.activite_code));\n }\n return activite;\n });\n }", "function getDepartments(products) {\n var departments = [];\n for (var i = 0; i < products.length; i++) {\n if (departments.indexOf(products[i].department_name) === -1) {\n departments.push(products[i].department_name);\n }\n }\n return departments;\n}", "function viewAllDepartmentsBudgets(conn, start) {\n conn.query(`SELECT\td.name Department, \n LPAD(CONCAT('$ ', FORMAT(SUM(r.salary), 0)), 12, ' ') Salary, \n COUNT(e.id) \"Emp Count\"\n FROM\temployee e \n LEFT JOIN role r on r.id = e.role_id\n LEFT JOIN department d on d.id = r.department_id\n WHERE\te.active = true\n GROUP BY d.name\n ORDER BY Salary desc;`, function(err, results) {\n if (err) throw err;\n console.table(results);\n start();\n });\n }", "function cargarDepartamentos() {\n\n //consume el ws para obtener los datos\n $.ajax({\n url: 'wscargar_datos.asmx/cargarDepartamentos',\n data: '',\n type: 'POST',\n contentType: 'application/json; charset=utf-8',\n beforeSend: function () {\n },\n success: function (msg) {\n $.each(msg.d, function () {\n $('#departamento').append('<option value=\"' + this.id + '\">' + this.descripcion + '</option>')\n });\n }\n });\n\n}", "function loadDeparturesWithCountrycode(countrycode) {\n vm.loading = true;\n datacontext.getDepartureTerminalsByCountryCode(countrycode).then(function(resp) {\n //console.log(resp);\n\n try {\n vm.departureTerminals = resp.Items;\n } catch (exception) {\n swal(\"please try again later!\");\n }\n\n\n\n // console.log(vm.departureTerminals[0]);\n vm.loading = false;\n }, function(err) {\n console.log(err);\n vm.loading = false;\n });\n }", "function deptSearch() {\n db.query(\n `SELECT * FROM departments`,\n (err, res) => {\n if (err) throw err\n console.table(res)\n deptOptions()\n }\n )\n}", "colocarNaves(ejercito) {\n ejercito.listadoNaves.forEach(element => {\n this.poscionNaves.push(element);\n });\n }", "function viewAllDepts() {\n console.log(\"Showing all departments...\\n\");\n connection.query(\"SELECT * FROM department \", function (err, res) {\n if (err) throw err;\n console.table(res);\n connection.end();\n });\n}", "async function viewDepartments() {\n const departments = await db.findAllDepartments();\n console.log(\"\\n\");\n console.table(departments);\n startPrompt();\n}", "function IncetDat(id) {\n var auxc = new ApiCiudad(\"\", \"\", \"\");\n var id_conte_lis = \"#LCiuDist\" + id;\n var id_conte_depart = \"#LDepDist\" + id;\n $(id_conte_lis).html(\" \"); // limpia la casilla para que se pueda ver \n var id_depart = $(id_conte_depart).val();\n var dat = {\n llave: id_conte_lis,\n idCiu: 0,\n iddist: id_depart\n };\n auxc.idDepart = id_depart;\n auxc.List(dat);\n}", "function viewDepartments() {\n connection.query(\"SELECT * FROM department\", function (err, res){\n if (err) throw err; \n console.table(res); \n });\n // init.init()\n}", "function viewDepartmentsBudget() {\n // console.log(`Selecting all departments...\\n`);\n connection.query(`SELECT d.department_name ,sum(r.salary) FROM employees e LEFT JOIN roles r on e.role_id = r.id JOIN ` + `departments d on d.id=r.departmentId where d.department_name !='None' GROUP BY d.department_name `, (err, res) => {\n if (err) throw err;\n // console.log(res);\n console.table(res);\n\n askeQuestions();\n });\n}", "function obtener_estados() {\n var combo = $('[name=estado]');\n var codigo_pais = $('[name=pais]').val();\n $.ajax({\n url: \"terceros_controller/obtener_estados\",\n type: 'POST',\n data: {\n codigo_pais: codigo_pais\n },\n success: function(response) {\n var respuesta = $.parseJSON(response);\n if (respuesta.success === true) {\n combo.empty();\n combo.append('<option value=\"\">Seleccione</option>')\n var cantidad = respuesta.estados.length\n item = respuesta.estados[cantidad-1]\n combo.append('<option value=\"'+item[\"depcodigo\"]+'\">'+item[\"depnombre\"]+'</option>');\n for (var i = 0; i < cantidad-1; i++) {\n var item = respuesta.estados[i];\n combo.append('<option value=\"'+item[\"depcodigo\"]+'\">'+item[\"depnombre\"]+'</option>');\n }\n }\n }\n });\n}", "function getallDeptByOfficeData(ofcid) {\n\t\t\t\n\t\t\t\tif(ofcid==\"\")\n\t\t\t\t{\t\t\t\t\n\t\t\t\t$('#deptlstSendTo').empty();\n\t\t\t\t $(\"#deptlstSendTo_div\").hide();\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tshowAjaxLoader();\n\t\t\t\t$.ajax({\n\t\t\t\t\t\turl : 'checkofficetype.htm',\n\t\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t\tdata : {\n\t\t\t\t\t\t\tofcid : ofcid,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess : function(response) \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t/*var html=\"<option value=''>---Select---</option>\"*/\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(response!=\"\")\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$.each(response, function(index, value) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif(value.ofctype==\"HO\")\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$(\"#deptlstSendTo_div\").show();\n\t\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\t $(\"#deptlstSendTo_div\").hide();\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t getallEmpBySendTo(\"DO\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t });\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\thideAjaxLoader();\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t},\n\t\t\t\t\t\terror:function(error)\n\t\t\t\t\t {\n\t\t\t\t\t \t\thideAjaxLoader();\n\t\t\t\t\t }\n\t\t\t\t});\n\t\t\t\n\t\t\t};\n\t\t\t}", "function viewDepartmentList() {\n let query = \"SELECT * FROM department\";\n\n connection.query(query, (error, data) => {\n if (error) throw error;\n console.table(data);\n return employee_App();\n });\n}", "function viewAllDepartments() {\n connection.query(\"SELECT * FROM departments\",\n (error, results) => {\n console.table(results);\n mainMenu();\n });\n}", "function consultarMunicipios(){ \n\tvar selector = $('#selectDepartaments').val();\n\t$.post(\"gestionEspectro/php/consultasConsultasBD.php\", { consulta: 'municipios', idConsulta: selector }, function(data){\n\t\t$(\"#municipios\").html(data);\n\t\t$(\"#tipoAsignacion\").html(\"La asignación es a nivel municipal\");\n\t}); \n}", "function mostrarCargoDepartamento(id){\n\n $.get('CargosDepartamentosMostrar/'+id, function (data) { \n $(\"#tabla_DepartamentoCargo\").html(\"\");\n $.each(data, function(i, item) { //recorre el data \n cargartablaCargoDepartamento(item); // carga los datos en la tabla\n }); \n });\n \n}", "function employeesDepartment() {\n connection.query(\"SELECT * FROM employeeTracker_db.department\",\n function (err, res) {\n if (err) throw err\n console.table(res)\n runSearch()\n }\n )\n}", "function jogosDaDesenvolvedora(desenvolvedora){\n let jogos = [];\n\n for (let categoria of jogosPorCategoria) {\n for ( let jogo of categoria.jogos ) {\n if (jogo.desenvolvedora === desenvolvedora){\n jogos.push(jogo.titulo)\n } \n }\n }\n console.log(\"Os jogos da \" + desenvolvedora + \" são: \" + jogos)\n}" ]
[ "0.6952878", "0.6720546", "0.6717672", "0.66944206", "0.66405255", "0.6623729", "0.6491975", "0.6464398", "0.64349055", "0.6414195", "0.6366378", "0.6347393", "0.62816465", "0.6280265", "0.62619394", "0.62166506", "0.61779237", "0.61597264", "0.61573666", "0.61376184", "0.6131989", "0.6131989", "0.6122371", "0.61193925", "0.61098903", "0.60961306", "0.6093327", "0.6032114", "0.60130876", "0.5975588", "0.5974803", "0.5970109", "0.59644115", "0.59576344", "0.59482276", "0.594536", "0.59436387", "0.5941572", "0.5939869", "0.593779", "0.5929762", "0.59258133", "0.5919691", "0.5913278", "0.5896481", "0.5885289", "0.5879039", "0.58784735", "0.5876653", "0.5856818", "0.58557665", "0.5849302", "0.5832159", "0.5831117", "0.58187187", "0.58058506", "0.57834923", "0.5764859", "0.5736776", "0.5724328", "0.57142365", "0.5713426", "0.5711598", "0.56986094", "0.5690382", "0.56828237", "0.567145", "0.56689835", "0.5632395", "0.5627204", "0.56205326", "0.56158566", "0.5612836", "0.561034", "0.5609241", "0.5600327", "0.5589453", "0.5587755", "0.5582347", "0.556948", "0.5563618", "0.5562074", "0.5555832", "0.5550219", "0.55475587", "0.5544163", "0.55431235", "0.5542815", "0.5524966", "0.55247474", "0.5510634", "0.5504388", "0.54975164", "0.54967517", "0.54886585", "0.54860353", "0.54815376", "0.5479875", "0.54772735", "0.5464214", "0.546134" ]
0.0
-1
car para de ciudad para listado
function DatLisCiry(id, nombre) { return '<option value="' + id + '">' + nombre + '</option>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "obtenerTodosCiudad() {\n return axios.get(`${API_URL}/v1/ciudad`);\n }", "function cambiarCiudad(id_p){\n\t$.post(\"/contacts/get_city\",{id_pais:id_p},function(data){\n\t\tvar obj_int = jQuery.parseJSON(data);\n\t\tvar opciones = \"\";\n\t\tif(obj_int){\n\t\t\t$.each(obj_int, function(i, item) {\t\n\t\t\t\t//console.log(item);\n\t\t\t\topciones += '<option value=\"'+item.id+'\">'+item.name+'</option>';\n\t\t\t});\n\n\t\t}\t\n\t\t$(\".cbo-city\").html(opciones);\n\t\t\n\t\t\n\t});\n}", "function ciudades (){\nvar uniqueStorage = removeDuplicates(Storage, \"Ciudad\");\nvar atributos = Array();\n \n if( uniqueStorage.length > 0 ) {\n for( var aux in uniqueStorage )\n atributos.push(uniqueStorage[aux].Ciudad);\n }\n return atributos;\n}", "function cambiarCiudadEditar(id_p, seleccionado){\n\t$.post(\"/contacts/get_city\",{id_pais:id_p},function(data){\n\t\tvar obj_int = jQuery.parseJSON(data);\n\t\tvar opciones = \"\";\n\t\tif(obj_int){\n\t\t\t$.each(obj_int, function(i, item) {\n\t\t\t\tvar sel = \"\";\n\t\t\t\tif(item.id == seleccionado){\n\t\t\t\t\tsel = \"selected\";\n\t\t\t\t}\n\t\t\t\topciones += '<option value=\"'+item.id+'\" '+sel+'>'+item.name+'</option>';\n\t\t\t});\n\n\t\t}\t\n\t\t$(\".cbo-city\").html(opciones);\n\t\t\n\t\t\n\t});\n}", "function obtener_ciudades(){\n var combo = $('[name=ciudad]');\n var codigo_estado = $('[name=estado]').val();\n $.ajax({\n url: \"terceros_controller/obtener_ciudades\",\n type: 'POST',\n data: {\n codigo_estado: codigo_estado\n },\n success: function(response) {\n var respuesta = $.parseJSON(response);\n if (respuesta.success === true) {\n combo.empty();\n combo.append('<option value=\"\">Seleccione</option>')\n var cantidad = respuesta.ciudades.length\n item = respuesta.ciudades[cantidad-1]\n combo.append('<option value=\"'+item[\"muncodigo\"]+'\">'+item[\"munnombre\"]+'</option>');\n for (var i = 0; i < cantidad-1; i++) {\n var item = respuesta.ciudades[i];\n combo.append('<option value=\"'+item[\"muncodigo\"]+'\">'+item[\"munnombre\"]+'</option>');\n }\n }\n }\n });\n}", "function filtroCiudad(){\n $.ajax({\n url:\"./ciudades.php\"\n }).done(function(data){\n var datos= JSON.parse(data);\n\n var ciudades= []\n for (var i=0;i<datos.length;i++)\n {\n var items= datos[i];\n var c= items.Ciudad;\n ciudades.push(c);\n }\n ciudades=ciudades.filter(function (x,i,a) {\n return a.indexOf(x) == i;\n });\n\n for(var i=0; i<ciudades.length;i++){\n $(\"#selectCiudad\").append(`<option value= ${ciudades[i]} selected>${ciudades[i]}</option>`)\n }\n })\n}", "getCiudad(){\r\nreturn this.ciudad;\r\n}", "async function obtenerTodasCIudades() {\n var queryString = '';\n\n\n queryString = queryString + ' SELECT cd.id, cd.nombre as ciudad, ps.nombre as pais';\n queryString = queryString + ' from ciudades cd join paises ps on (cd.pais_id=ps.id) ';\n\n \n\n let ciudad = await sequelize.query(queryString,\n { type: sequelize.QueryTypes.SELECT})\n return ciudad;\n }", "function getCuponesPorIndustria(idIndustria){\n\t\n}", "function buscarCiudad() {\n // obtener valor ingresado\n let ciudadBuscada = document.getElementById('nombreCiudad').value;\n console.log(ciudadBuscada);\n // comprobar que se haya ingresado un valor\n if (ciudadBuscada === \"\") {\n alert(\"Ingrese una ciudad\");\n } else {\n // armar url para hacer el fetch de openweather con nombre\n let fetchNombre = tempactual + q + ciudadBuscada +idioma + grados + apiKey;\n // llamo funcion que ubica en mapa y vuelca datos de clima\n temperaturaCiudad(fetchNombre);\n }\n }", "function getEmpleadosDropdown() {\n $http.post(\"lateral/getNombresDropdown\").then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.listaEmpleados.data = r.data.d.data;\n \n }\n })\n }", "function ListaTipoZona(){\n DoPostAjax({\n url: \"Citas/CtrlCitas/ListarTipoZona\"\n }, function(err, data) {\n if (err) {\n Notificate({\n titulo: 'Ha ocurrido un error',\n descripcion: 'Error con la lista de los tipo de zona.',\n tipo: 'error',\n duracion: 4\n });\n } else {\n let respuesta=JSON.parse(data);\n $(\"#SltComuna\").html(\"<option value='-1'>Seleccione una comuna.</option>\");\n\n for (var val in respuesta) {\n $(\"#SltComuna\").append(\"<option value='\"+respuesta[val].idTipoZona+\"'>\"+respuesta[val].descripcionTipozona+\"</option>\");\n }\n }\n });\n}", "function getDepartamentosDropdown() {\n $http.post(\"Departamentos/getDepartamentosTotal\").then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.listaDepartamentos.data = r.data.d.data;\n \n }\n })\n }", "getCountryList() {\r\n this.sql_getCountryList = `SELECT id, country_name FROM country_tb ORDER BY id ASC`;\r\n return this.apdao.all(this.sql_getCountryList);\r\n }", "function IncetDat(id) {\n var auxc = new ApiCiudad(\"\", \"\", \"\");\n var id_conte_lis = \"#LCiuDist\" + id;\n var id_conte_depart = \"#LDepDist\" + id;\n $(id_conte_lis).html(\" \"); // limpia la casilla para que se pueda ver \n var id_depart = $(id_conte_depart).val();\n var dat = {\n llave: id_conte_lis,\n idCiu: 0,\n iddist: id_depart\n };\n auxc.idDepart = id_depart;\n auxc.List(dat);\n}", "function selectDistrict(){\n let outputCommune = \"<option value='0'>&nbspChọn Phường/Xã...</option>\";\n let idDistrict = $('#input-user-district > option').filter(':selected').val();\n for (let i = 0; i < listCommune.length; i ++){\n if (listCommune[i].idDistrict == idDistrict){\n outputCommune += `<option>&nbsp${listCommune[i].name}</option>`;\n }\n }\n $('#input-user-commune').html(outputCommune);\n}", "get listarTareas () {\n\n const arreglo = [];\n\n Object.keys(this._listado).forEach(indice => {\n arreglo.push(this._listado[indice]);\n })\n\n return arreglo;\n }", "async function obtenerDepartamentos() {\n try {\n let response = await axios.get(URL_departamentos)\n let data = response.data.items\n let result = []\n\n // Opcion por defecto\n result.push(<option value={0} key={0}>Seleccione una Opción</option>)\n \n for (let index in data) { \n result.push(<option value={data[index].codigo} key={data[index].codigo}>{data[index].nombre}</option>)\n }\n setDepartamentos(result)\n \n // Se obtiene el municipio por defecto a partir del departamento por defecto\n recalcularMunicipios()\n\n } catch (error) {\n console.log('Fallo obteniendo los departamentos / municipios' + error)\n } \n }", "function loadAll() {\n var cidades = eurecaECBrasil.filtrarCidadeTextoService();\n return cidades.split(/, +/g).map( function (cidade) {\n return {\n value: cidade.toLowerCase(),\n display: cidade\n }; \n });\n }", "function getCountries(){\n $http.get(\"usuariosController?getUnidades=1\").success(function(data){\n $scope.datos= data;\n //console.log(data);\n });\n }", "function selectProvince(){\n let outputDistrict = \"<option value='0'>&nbspChọn Quận/Huyện...</option>\";\n let outputCommune = \"<option value='0'>&nbspChọn Phường/Xã...</option>\";\n let idProvince = $('#input-user-city-province > option').filter(':selected').val();\n for (let i = 0; i < listDistrict.length; i ++){\n if (listDistrict[i].idProvince == idProvince){\n outputDistrict += `<option value='${listDistrict[i].idDistrict}'>&nbsp${listDistrict[i].name}</option>`;\n }\n }\n $('#input-user-commune').html(outputCommune);\n $('#input-user-district').html(outputDistrict);\n}", "function getCountries(){\n $http.get(\"equipoController?getlista=1\").success(function(data){\n $scope.datos= data;\n //console.log(data);\n });\n }", "function listarAulas () {\n aulaService.listar().then(function (resposta) {\n //recebe e manipula uma promessa(resposta)\n $scope.aulas = resposta.data;\n })\n }", "function carregaUnidadesSolicitantes(){\n\tvar unidade = DWRUtil.getValue(\"comboUnidade\"); \n\tcarregarListaNaoSolicitantes();\n\tcarregarListaSolicitantes();\n}", "function getUnidades() {\n return $http({\n method: 'GET',\n url: APP.apiHost + '/api/unidades'\n }).then(function success(res) {\n return res.data // jshint ignore:line\n }, function error(res) {\n return $q.reject(res.data);\n });\n }", "async ciudad(lugar = '') {\n try {\n\n\n // peticion hhttp \n const instance = axios.create({\n baseURL: `https://api.mapbox.com/geocoding/v5/mapbox.places/${lugar}.json`,\n params: this.paramsMapbox\n });\n\n const resp = await instance.get();\n\n // retornamos los datos con un objeto de forma implicita ({})\n return resp.data.features.map(lugar => ({\n id: lugar.id,\n nombre: lugar.place_name,\n lng: lugar.center[0],\n lat: lugar.center[1],\n\n\n\n }));\n\n } catch (error) {\n console.log(error);\n }\n }", "function iniciar(){\n for(var i = 1; i <= 31; i ++){\n var dezena = diaSorteService.montaDezena(i);\n vm.dezenas.push(dezena);\n }\n }", "function template_actualizar_ciudad(nomElemento, idCiudad, idColonia) {\n\tvar indexEstado = -1;\n\tvar arrayEstados = Array(\"template_venta_estado\", \"template_renta_estado\", \"template_rentaVac_estado\", \"template_busqueda_estado\");\n\tvar arrayCiudades = Array(\"template_venta_municipio\", \"template_renta_municipio\", \"template_rentaVac_municipio\", \"template_busqueda_municipio\");\n\tvar arrayColonias = Array(\"template_venta_colonia\", \"template_renta_colonia\", \"template_rentaVac_colonia\", \"template_busqueda_colonia\");\n\t\n\tindexEstado = arrayEstados.indexOf(nomElemento);\n\t\n\tif (indexEstado > -1) {\n\t\tobjEstado = $(\"#\"+nomElemento);\n\t\tobjMunicipio = $(\"#\"+arrayCiudades[indexEstado]);\n\t\tobjColonia = $(\"#\"+arrayColonias[indexEstado]);\n\t\t\n\t\t\n\t\tobjMunicipio.find(\"li.lista ul\").html(\"\");\n\t\tobjMunicipio.find(\"p\").attr(\"data-value\", -1);\n\t\tobjMunicipio.find(\"p\").text(\"\");\n\t\tobjColonia.find(\"li.lista ul\").html(\"\");\n\t\tobjColonia.find(\"p\").attr(\"data-value\", -1);\n\t\tobjColonia.find(\"p\").text(\"\");\n\t\t\n\t\t\n\t\t$.ajax({\n\t\t\turl: \"admin/lib_php/consDireccion.php\",\n\t\t\ttype: \"POST\",\n\t\t\tdataType: \"json\",\n\t\t\tdata: {\n\t\t\t\tconsCiudad: 1,\n\t\t\t\testado: objEstado.find(\"p\").attr(\"data-value\")\n\t\t\t}\n\t\t}).always(function(respuesta_json){\n\t\t\tif (respuesta_json.isExito == 1) {\n\t\t\t\tfor (var x = 0; x < respuesta_json.datos.length; x++) {\n\t\t\t\t\tobjMunicipio.find(\"li.lista ul\").append(\"<li data-value='\"+respuesta_json.datos[x].id+\"'>\"+respuesta_json.datos[x].nombre+\"</li>\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tobjMunicipio.find(\"li.lista li\").on({\n\t\t\t\t\tclick: function() {\n\t\t\t\t\t\tobjMunicipio.find(\"p\").attr(\"data-value\", $(this).attr(\"data-value\"));\n\t\t\t\t\t\tobjMunicipio.find(\"p\").text($(this).text());\n\t\t\t\t\t\ttemplate_actualizar_colonia(objMunicipio.prop(\"id\"));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tif ((idCiudad != null) && (idCiudad != -1)) {\n\t\t\t\t\tobjMunicipio.find(\"li.lista li[data-value='\"+idCiudad+\"']\").click();\n\t\t\t\t\tobjMunicipio.find(\"li.lista\").hide();\n\t\t\t\t\t\n\t\t\t\t\tif ((idColonia != null) && (idColonia != -1)) {\n\t\t\t\t\t\ttemplate_actualizar_colonia(objMunicipio.prop(\"id\"), idColonia);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n}", "function template_actualizar_ciudad(nomElemento) {\n\tvar indexEstado = -1;\n\tvar arrayEstados = Array(\"template_venta_estado\", \"template_renta_estado\", \"template_rentaVac_estado\");\n\tvar arrayCiudades = Array(\"template_venta_municipio\", \"template_renta_municipio\", \"template_rentaVac_municipio\");\n\tvar arrayColonias = Array(\"template_venta_colonia\", \"template_renta_colonia\", \"template_rentaVac_colonia\");\n\t\n\tindexEstado = arrayEstados.indexOf(nomElemento);\n\t\n\tif (indexEstado > -1) {\n\t\tobjEstado = $(\"#\"+nomElemento);\n\t\tobjMunicipio = $(\"#\"+arrayCiudades[indexEstado]);\n\t\tobjColonia = $(\"#\"+arrayColonias[indexEstado]);\n\t\t\n\t\t\n\t\tobjMunicipio.find(\"li.lista ul\").html(\"\");\n\t\tobjMunicipio.find(\"p\").attr(\"data-value\", -1);\n\t\tobjMunicipio.find(\"p\").text(\"\");\n\t\tobjColonia.find(\"li.lista ul\").html(\"\");\n\t\tobjColonia.find(\"p\").attr(\"data-value\", -1);\n\t\tobjColonia.find(\"p\").text(\"\");\n\t\t\n\t\t\n\t\t$.ajax({\n\t\t\turl: \"admin/lib_php/consDireccion.php\",\n\t\t\ttype: \"POST\",\n\t\t\tdataType: \"json\",\n\t\t\tdata: {\n\t\t\t\tconsCiudad: 1,\n\t\t\t\testado: objEstado.find(\"p\").attr(\"data-value\")\n\t\t\t}\n\t\t}).always(function(respuesta_json){\n\t\t\tif (respuesta_json.isExito == 1) {\n\t\t\t\tfor (var x = 0; x < respuesta_json.datos.length; x++) {\n\t\t\t\t\tobjMunicipio.find(\"li.lista ul\").append(\"<li data-value='\"+respuesta_json.datos[x].id+\"'>\"+respuesta_json.datos[x].nombre+\"</li>\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tobjMunicipio.find(\"li.lista li\").on({\n\t\t\t\t\tclick: function() {\n\t\t\t\t\t\tobjMunicipio.find(\"p\").attr(\"data-value\", $(this).attr(\"data-value\"));\n\t\t\t\t\t\tobjMunicipio.find(\"p\").text($(this).text());\n\t\t\t\t\t\ttemplate_actualizar_colonia(objMunicipio.prop(\"id\"));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n}", "getCSList() {\r\n this.sql_getCSList = `SELECT id, country_name, state_name FROM country_state_tb ORDER BY id ASC`;\r\n return this.apdao.all(this.sql_getCSList);\r\n }", "function getCidades(element) {\n var resultado = [];\n if (element) {\n var cidades = $(element).find('table tr');\n if (cidades && cidades.length > 0) {\n cidades.each(function(index, element) {\n let tds = $(element).find('td');\n if (tds && tds.length > 1) {\n let cidade = {\n Cidade: getText(tds[0]),\n UF: getText(tds[1])\n };\n resultado.push(cidade);\n }\n });\n } \n }\n return resultado;\n }", "function carregarListaUnidadesCadastradas(){\n\tDWRUtil.removeAllOptions(\"comboUnidade\");\n\tFacadeAjax.getListaUnidadesSuporte(function montaComboUnidadeCadastradas(listBeans){\n\t\tDWRUtil.removeAllOptions(\"comboUnidade\");\n\t\tDWRUtil.addOptions(\"comboUnidade\", listBeans, \"idUsuario\",\"nome\");\n\t});\n}", "getListCollaborateur () {\n return this.$http.get(this.API_URL_Collab)\n .then(response => response.data)\n }", "function _listarClientes(){\n ClienteFactory.listarClientes()\n .then(function(dados){\n // Verifica se dados foram retornado com sucesso\n if(dados.success){\n $scope.clientes = dados.clientes;\n }else{\n toaster.warning('Atenção', 'Nenhum cliente encontrado.');\n }\n }).catch(function(err){\n toaster.error('Atenção', 'Erro ao carregar clientes.');\n });\n }", "function livrosAugustoCury() {\n let livros = [];\n for (let categoria of livrosPorCategoria) {\n for (let livro of categoria.livros) {\n if (livro.autor === 'Augusto Cury') {\n livros.push(livro.titulo);\n }\n }\n }\n console.log('Livros do Augusto Cury: ' , livros);\n}", "function listar()\n{\n\t tabla=$('#listado').dataTable(\n\t{\n\t\t\"aProcessing\": true,//Activamos el procesamiento del datatables\n\t \"aServerSide\": true,//Paginación y filtrado realizados por el servidor\n\t dom: 'Bfrtip',//Definimos los elementos del control de tabla\n\t buttons: [\t\t \n\t \n\t\t 'copyHtml5',\n\t\t 'excelHtml5',\n\t\t 'csvHtml5',\n\t\t 'pdf'\n\t\t ],\n\t\t\"ajax\":\n\t\t\t\t{\n\n\t\t\turl: '../controller/persona.php?op=listarc',\n type: \"GET\",\n\t\t\t\t\tdataType : \"json\",\t\t\t\t\t\t\n\t\t\t\t\terror: function(e){\n\t\t\t\t\t\tconsole.log(e.responseText);\t\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\"bDestroy\": true,\n\t\t\"iDisplayLength\": 5,//Paginación\n\t \"order\": [[ 0, \"desc\" ]]//Ordenar (columna,orden)\n\t}).DataTable();\n}", "async function obtenerTodosLasCiudadesXpais(pais_id) {\n var queryString = '';\n\n console.log('ENTRE');\n queryString = queryString + ' SELECT cd.id, cd.nombre as ciudad';\n queryString = queryString + ' from ciudades cd where pais_id = ? ';\n\n \n\n let ciudad = await sequelize.query(queryString,\n { type: sequelize.QueryTypes.SELECT,\n replacements:[pais_id]})\n return ciudad;\n }", "function listDevises() {\n /*******************************************************************\n ********************************************************************\n ***@GET(admin/devise/list)******************************************\n **********\n ***@return JsonParser***********************************************\n ********************************************************************\n ********************************************************************/\n $http({\n method: 'GET',\n url: baseUrl + 'admin/devise/list',\n data: {},\n headers: { 'Authorization': 'Bearer ' + localStorage.getItem('jeton') }\n }).then(function successCallback(response) {\n $scope.listDevises = response.data.devise_list;\n //console.log(\"La liste de toutes les devises \",$scope.listDevises);\n }).catch(function(err) {\n if (err.status == 500 && localStorage.getItem('jeton') != '' && localStorage.getItem('jeton') != null && localStorage.getItem('jeton') != undefined) {\n deconnectApi.logout(sessionStorage.getItem(\"iduser\")).then(function(response) {\n $location.url('/access/login');\n $state.go('access.login');\n }).catch(function(response) {});\n };\n });\n }", "function cargar_municipios(datos_municipios) {\r\n\tvar texto_aconvertir = \"{'municipios':\" + datos_municipios + \"}\";\r\n\tvar objeto_respuesta = eval('(' + texto_aconvertir + ')');\r\n\tvar lista_muni = document.getElementById(\"municipios\");\r\n\tlista_muni.options.length = 0;\r\n\tvar posiciones = objeto_respuesta.municipios.length;\r\n\tfor (var i = 0; i < posiciones; i++) {\r\n\t\topcion = document.createElement('option');\r\n\t\ttexto_opcion = document\r\n\t\t\t\t.createTextNode(objeto_respuesta.municipios[i].municipio);\r\n\t\topcion.appendChild(texto_opcion);\r\n\t\topcion.value = objeto_respuesta.municipios[i].codigoMunicipio;\r\n\t\tlista_muni.appendChild(opcion);\r\n\t}\r\n}", "function iniciarListaBusqueda(){\n var ciclos = selectDatoErasmu();\n for(var aux = 0, help = 0 ; aux < erasmu.length ; aux++){\n if(ciclos.indexOf(erasmu[aux].ciclo) != -1){\n crearListErasmu(erasmu[aux]);\n }\n }\n}", "function ciudades(estado_id, ciudades_element, ciudad=null){\n var url = \"?action=adminsitio\"\n \n console.log(estado_id)\n\n ciudades_element.html(\"\")\n ciudades_element.attr(\"disabled\",true)\n\n $.ajax({\n url: url,\n type: 'POST', //metodo de la peticion\n dataType: 'json',//tipo de dato de la respuesta\n data: {id_estado: estado_id,function:\"get-ciudades\"},\n success: function(respuesta){\n var contenidoHTML = $(\"\") \n $.each( respuesta.data, function(i,item){\n\n contenidoHTML += `<option value=\"${item.id_ciudad}\">\n ${item.nombre_ciudad}\n </option>`\n })\n ciudades_element.html(contenidoHTML)\n console.log(ciudad)\n if (ciudad!==null) {\n \n ciudades_element.val(ciudad);\n } \n ciudades_element.attr(\"disabled\",false)\n },\n error: function() {\n console.log(\"No se ha podido obtener la información\");\n }\n })\n}", "function getCitiesList() {\n var self = this\n var cities = indianCitiesDatabase.cities\n self.json(cities)\n}", "function getCountries(){\n $http.get(\"equipoController?getTipo=1\").success(function(data){\n $scope.datos= data;\n //console.log(data);\n });\n }", "function getCandateList() {\n var obj = {\n p: $scope.page,\n ps: 10\n };\n\n CandidatePoolService.getCandidatesByNetwork(obj).then(function(res) {\n $scope.candidateListSumary = res;\n $scope.candidateListSumary.IsSelectingStatus = '';\n });\n\n }", "function getAllGrupoAcademicoLst() {\n $.ajax({\n dataType: DATA_TYPE_JSON,\n contentType: CONTEN_TYPE_JSON,\n type: METHOD_GET,\n url: GRUPOACADEMICO_URL_LISTAR,\n success: function(data) {\n $(\"#slnGrupoAcademico\").html('');\n $(\"#slnGrupoAcademico\").append(\"<option value='0' selected='selected'> Todos </option>\");\n $.each(data, function(key, value) {\n var newrow = \"<option value='\" + value['codGrupoAcademico'] + \"'>\" +\n value['idGrado'] + \"° \" +\n value['codSeccion'] + \" - \" +\n value['anio'] +\n \"</option>\";\n $(\"#slnGrupoAcademico\").append(newrow);\n });\n },\n error: function(data) {\n console.log(data);\n }\n });\n}", "function chargerDomaines() {\n return $.ajax({\n url: urlServiceWeb +'domainesEmploi/' + langue,\n dataType: 'JSON',\n success: function(retour) {\n for(var i = 0; i < retour.items.length; i++) {\n listeDomaines = listeDomaines + '<option value=\"' + retour.items[i].valeur + '\">' + retour.items[i].nom + '</option>';\n }\n },\n error: function() {\n $('#manitouSimplicite').html(messages.erreurs.chargementDomainesEmploi);\n }\n });\n }", "function cuisinListToString(){\n\n STATE.searchCuisine = STATE.searchCuisine.cuisines.map((current_cuisine) => {\n \n return current_cuisine.cuisine.cuisine_name;\n })\n}", "function canton(args) {\r\n let results = ecuador.data.lookupProvinces(args);\r\n results = results[0];\r\n let canton = [];\r\n for (var key in results.cities) {\r\n canton.push(results.cities[key].name);\r\n }\r\n return canton;\r\n}", "function obterDoadores(){\n var doadoresUniversal = [];\n for(var i=0; i<goldSaints.length; i++){\n var cavaleiro = goldSaints[i];\n if(cavaleiro.tipoSanguineo === 'O'){\n doadoresUniversal.push(cavaleiro);\n }\n }\n return doadoresUniversal;\n}", "function getCountries() {\n return [{\n name: \"India\",\n code: \"IN\"\n },\n {\n name: \"United States\",\n code: \"USA\"\n }];\n}", "getPersonasPorSala(sala) {\n\n }", "function carregarListaSolicitantes(){\n\tdwr.util.useLoadingMessage();\n\tvar unidade = DWRUtil.getValue(\"comboUnidade\"); \n\tFacadeAjax.getListaSolicitantes(unidade, function montaComboUnidadeTRE(listBeans){\n\t\tDWRUtil.removeAllOptions(\"comboUnidadesSolicitantes\");\n\t\tDWRUtil.addOptions(\"comboUnidadesSolicitantes\", listBeans, \"idUnidade\",\"nome\");\n\t});\n}", "function getAllGrupoAcademico() {\n $.ajax({\n dataType: DATA_TYPE_JSON,\n contentType: CONTEN_TYPE_JSON,\n type: METHOD_GET,\n url: GRUPOACADEMICO_URL_LISTAR,\n success: function(data) {\n $(\"#codGrupoAcademico\").html('');\n $(\"#codGrupoAcademico\").append(\"<option value='0' disabled selected> Seleccione Grupo </option>\");\n $.each(data, function(key, value) {\n var newrow = \"<option value='\" + value['codGrupoAcademico'] + \"'>\" +\n value['idGrado'] + \"° \" +\n value['codSeccion'] + \" - \" +\n value['anio'] +\n \"</option>\";\n $(\"#codGrupoAcademico\").append(newrow);\n });\n },\n error: function(data) {\n console.log(data);\n }\n });\n}", "function get_currency_countries_list()\n\t{\t\n\t\tlet curr_from = new Array();\n\t\tlet curr_to = new Array();\n\t\tcurr_from.push('<option value=\"\"></option>');\n\t\tcurr_to.push('<option value=\"\"></option>');\n\t\t$.ajax({\n\t\t\ttype:'get',\n\t\t\turl:'/ajaxcall-currency-country-list',\n\t\t\tsuccess:function(data){\n\t\t\t\tfor (var i = 0; i < data.length; i++) {\n\n\t\t\t\t\tcurr_from.push('<option value=\"'+data[i]['code']+'\">'+data[i]['country']+' ('+data[i]['code']+')</option>');\n\t\t\t\t\tcurr_to.push('<option value=\"'+data[i]['code']+'\">'+data[i]['country']+' ('+data[i]['code']+')</option>');\n\t\t\t\t}\n\t\t\t\t$(\"#fromCurr\").html($.unique(curr_from));\n\t\t\t\t$(\"#toCurr\").html($.unique(curr_to));\n\t\t\t}\n\t\t});\n\t}", "function GetAvalibleDistricts(){\n var url = config.api.url + \"wijk?ex={'k':'beschikbaar', 'v':'true'}\";\n $http({\n url: url,\n method: 'GET'\n }).success(function(data, status, headers, config) {\n $scope.avalibleWijken = data;\n console.log(\"WijkData load succesfull\");\n }).error(function(data, status, headers, config) {\n console.log(\"WijkData load failed\");\n }); \n }", "function ciudad(){\n\n $.ajax({\n url: 'data-1.json', \n type: 'post', \n dataType: \"json\",\n success: function (data) {\n \n var obj = data\n \n $.each(obj, function(key, value) {\n\n $(\"#selectCiudad\").each(function(){//recorremos el select\n\n if($(this).text() != value.Ciudad){ // validacion si el opcion ya existe en el\n $(\"#selectCiudad\").append('<option name=\"' + key.Id+ '\" value=\"' + value.Id+ '\">' + value.Ciudad + '</option>')\n } \n });\n });\n }\n });\n}", "function showCity(idprovince,id){\n\t\t $.ajax({\n\t\t url:'proses.php?q=loadcity',\n\t\t dataType:'json',\n\t\t data:{province:idprovince},\n\t\t success:function(response){\n\t\t $(id).html('');\n\t\t city = '';\n\t\t $.each(response['rajaongkir']['results'], function(i,n)\n\t\t {\n\t\t city = '<option value=\"' + n['city_id'] + '\">'+n['city_name']+'</option>';\n\t\t city = city + '';\n\t\t $(id).append(city);\n\t\t });\n\t\t },\n\t\t error:function(){\n\t\t $(id).html('ERROR');\n\t\t \t}\n\t\t});\n\t}", "async function CountryByConti(countries) {\n\n // countries = await allCountriesData(proxy);\n\n let countryLi = document.querySelector(`#countryLi`);\n let america = document.querySelector(`#america`);\n let asia = document.querySelector(`#asia`);\n let europe = document.querySelector(`#europe`);\n let africa = document.querySelector(`#africa`);\n let oceania = document.querySelector(`#oceania`);\n let world = document.querySelector(`#world`);\n\n const basics = () => {\n countryLi.innerHTML = ``;\n countries[0].forEach(element => {\n let option = document.createElement(\"option\");\n option.value = element[1];\n option.text = element[0];\n countryLi.appendChild(option);\n });\n };\n\n basics();\n\n america.addEventListener(\"click\", () => {\n countryLi.innerHTML = ``;\n countries[1].Americas.forEach(element => {\n let option = document.createElement(\"option\");\n option.value = element[1];\n option.text = element[0];\n countryLi.appendChild(option);\n });\n\n });\n\n asia.addEventListener(\"click\", () => {\n countryLi.innerHTML = ``;\n countries[1].Asia.forEach(element => {\n let option = document.createElement(\"option\");\n option.value = element[1];\n option.text = element[0];\n countryLi.appendChild(option);\n });\n });\n\n europe.addEventListener(\"click\", () => {\n countryLi.innerHTML = ``;\n countries[1].Europe.forEach(element => {\n let option = document.createElement(\"option\");\n option.value = element[1];\n option.text = element[0];\n countryLi.appendChild(option);\n });\n });\n\n africa.addEventListener(\"click\", () => {\n countryLi.innerHTML = ``;\n countries[1].Africa.forEach(element => {\n let option = document.createElement(\"option\");\n option.value = element[1];\n option.text = element[0];\n countryLi.appendChild(option);\n });\n });\n\n oceania.addEventListener(\"click\", () => {\n countryLi.innerHTML = ``;\n countries[1].Oceania.forEach(element => {\n let option = document.createElement(\"option\");\n option.value = element[1];\n option.text = element[0];\n countryLi.appendChild(option);\n });\n });\n\n world.addEventListener(\"click\", () => {\n countryLi.innerHTML = ``;\n countries[0].forEach(element => {\n let option = document.createElement(\"option\");\n option.value = element[1];\n option.text = element[0];\n countryLi.appendChild(option);\n });\n });\n\n let data = await continetAnalize(countries[1]);\n return data;\n}", "function listClientes(){\n// aqui se llama al rest api de nuestro servidor\n $http.get('/cliente/listar').then(\n\n (response) =>{\n $scope.clientes=response.data;\n }\n\n );\n\n }", "function courierList(query) {\n return api\n .get('courier', { params: { q: query } })\n .then(response => {\n const options = response.data.courierList.map(courier => ({\n value: courier.id,\n label: courier.name,\n }));\n return options;\n })\n .catch(error => {\n console.tron.log(error);\n toast.error(\n 'Listagem de entregadores não foi carregada. Verifique a sua conexão com o Banco de dados.'\n );\n });\n }", "function carregaNacionalidades() {\n\n\t\tnacionalidadeService.findAll().then(function(retorno) {\n\n\t\t\tcontroller.nacionalidades = angular.copy(retorno.data);\n\n\t\t\tnewOption = {\n\t\t\t\tid : \"\",\n\t\t\t\tdescricao : \"Todas\"\n\t\t\t};\n\t\t\tcontroller.nacionalidades.unshift(newOption);\n\n\t\t});\n\n\t}", "getListaDoctoresOrganizacion(state){\n return state.listarDoctoresOrganizacion\n }", "function DatLisDepart(id, nombre) {\n return '<option value=\"' + id + '\">' + nombre + '</option>';\n}", "function reno_contado(){\n\t\t$('#listado').DataTable({\n\t\t\t\"bJQueryUI\": false,\n\t\t \"bDeferRender\": false,\n\t\t \"bInfo\" : false,\n\t\t \"bSort\" : false,\n\t\t \"bDestroy\" : true,\n\t\t \"bFilter\" : false,\n\t\t \"bLengthChange\": false,\n\t\t \"bPagination\" : false,\n\t \"aoColumnDefs\": [\n\t { \"bVisible\": false, \"aTargets\": [6] },\n\t { \"bVisible\": true, \"aTargets\": [7] },\n\t { \"bVisible\": false, \"aTargets\": [8] },\n\t { \"bVisible\": false, \"aTargets\": [9] },\n\t { \"bVisible\": false, \"aTargets\": [10] },\n\t { \"bVisible\": false, \"aTargets\": [11] },\n\t { \"bVisible\": false, \"aTargets\": [12] },\n\t { \"bVisible\": false, \"aTargets\": [13] },\n\t { \"bVisible\": false, \"aTargets\": [14] },\n\t { \"bVisible\": false, \"aTargets\": [15] },\n\t { \"bVisible\": false, \"aTargets\": [16] },\n\t { \"bVisible\": false, \"aTargets\": [17] }\n\t ], \n\t });\n\t }", "getDados() {\n return this.dados;\n }", "function inmueble_onChange_estado_ciudad_colonia(estado, ciudad, colonia, _nombreCampoEstado, _nombreCampoCiudad, _nombreCamposColonia) {\n\tnombreCampoEstado = _nombreCampoEstado == null ? \"estado\" : _nombreCampoEstado;\n\tnombreCampoCiudad = _nombreCampoCiudad == null ? \"ciudad\" : _nombreCampoCiudad;\n\tnombreCamposColonia = _nombreCamposColonia == null ? \"colonia\" : _nombreCamposColonia;\n\t$(\"#\"+nombreCampoEstado).val(estado);\n\t\n\tif (estado != \"\") {\n\t\t$.ajax({\n\t\t\turl: \"lib_php/consDireccion.php\",\n\t\t\ttype: \"POST\",\n\t\t\tdataType: \"json\",\n\t\t\tdata: {\n\t\t\t\tconsCiudad: 1,\n\t\t\t\testado: estado\n\t\t\t}\n\t\t}).always(function(respuesta_json){\n\t\t\tif (respuesta_json.isExito == 1) {\n\t\t\t\t$(\"#\"+nombreCampoCiudad).prop(\"disabled\", false);\n\t\t\t\t$(\"#\"+nombreCampoCiudad+\" option[value!='-1']\").remove();\n\t\t\t\t\n\t\t\t\tfor (var x = 0; x < respuesta_json.datos.length; x++) {\n\t\t\t\t\t$(\"#\"+nombreCampoCiudad).append(\"<option value='\"+respuesta_json.datos[x].id+\"'>\"+respuesta_json.datos[x].nombre+\"</option>\");\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t$(\"#\"+nombreCampoCiudad).val(ciudad);\n\t\t\t\t\n\t\t\t\tif (ciudad != \"\") {\n\t\t\t\t\t$.ajax({\n\t\t\t\t\t\turl: \"lib_php/consDireccion.php\",\n\t\t\t\t\t\ttype: \"POST\",\n\t\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tconsColonia: 1,\n\t\t\t\t\t\t\tciudad: ciudad\n\t\t\t\t\t\t}\n\t\t\t\t\t}).always(function(respuesta_json2){\n\t\t\t\t\t\tif (respuesta_json2.isExito == 1) {\n\t\t\t\t\t\t\t$(\"#\"+nombreCamposColonia).prop(\"disabled\", false);\n\t\t\t\t\t\t\t$(\"#\"+nombreCamposColonia+\" option[value!='-1']\").remove();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfor (var x = 0; x < respuesta_json2.datos.length; x++) {\n\t\t\t\t\t\t\t\t$(\"#\"+nombreCamposColonia).append(\"<option value='\"+respuesta_json2.datos[x].id+\"' data-cp='\"+respuesta_json2.datos[x].cp+\"'>\"+respuesta_json2.datos[x].nombre+\"</option>\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t$(\"#\"+nombreCamposColonia).val(colonia);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t$(\"#\"+nombreCamposColonia).val(\"-1\");\n\t\t\t\t\t$(\"#\"+nombreCamposColonia).prop(\"disabled\", true);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\telse {\n\t\t$(\"#\"+nombreCampoCiudad).val(\"-1\");\n\t\t$(\"#\"+nombreCamposColonia).val(\"-1\");\n\t\t\n\t\t$(\"#\"+nombreCampoCiudad).prop(\"disabled\", true);\n\t\t$(\"#\"+nombreCamposColonia).prop(\"disabled\", true);\n\t}\n}", "function getFolio(){\n $http.get(\"edicionController?getUsuarios=1\").success(function(data){\n $scope.datos= data;\n console.warn(data);\n });\n }", "get listadoArr () {\n const listadoArreglado = [];\n Object.keys(this._listado).forEach( key => {\n const tarea = this._listado[key];\n listadoArreglado.push(tarea);\n });\n return listadoArreglado;\n }", "function listProjet() {\n $http({\n \t\turl: 'http://localhost:3000/projet/getProjets',\n \t\tmethod: 'GET',\n \t\tdatatype: 'json',\n \t\tcontentType: 'text/plain',\n \t\theaders: {'Content-Type': 'application/json'}\n \t}).then(function successCallback(res) {\n $scope.projets = res.data.projets;\n console.log(res);\n return;\n }, function errorCallback(err) {\n console.log(\"Impossible d'accéder à la liste des projets.\\n\" + err.toString());\n });\n }", "function deplist(){\n return $.ajax({\n url:dir2,\n data:'aksi=cmbdepartemen',\n dataType:'json',\n type:'post'\n });\n }", "function getLieuFromRegionFirst(region,edNumber) {\n $.ajax({ \n url: '../json/ED'+edNumber+'/PositionsPoints'+edNumber+'.json', \n data: \"\",\n dataType: 'json', \n success: function(data)\n {\n $output = \"<div class='form-group'><label>\"+lieuDefi+\" :</label><select name='lieu' class='form-control' required><option disabled selected value></option>\";\n\n $.each(data, function(i, item) {\n if (typeof(data[i].lieu) != \"undefined\" && data[i].region == region) {\n $output += \"<option value=\"+data[i].lieu+\">\"+data[i].lieu+\"</option>\";\n }\n });\n $output += \"</select></div>\";\n $('#LieuList').html($output);\n $('#LieuList > div > select').val(dataRes.lieu);\n } \n });\n }", "function getSelectTipoTarea(accion) {\n $(\"#txtidtt\").kendoDropDownList({\n dataSource: {\n transport: {\n read: {\n url: \"http://www.ausa.com.pe/appmovil_test01/Tareas/tipoListar\",\n dataType: \"json\"\n }\n }\n },\n dataTextField: \"tiptar_str_nombre\",\n dataValueField: \"tiptar_int_id\"\n });\n\n //Si se seleccionó la fila, asignamos el valor del kendoDropDownList con el valor de accion\n // if (accion !== \"add\") {\n // var dropdownlist = $(\"#txtidtt\").data(\"kendoDropDownList\");\n // dropdownlist.value(accion);\n // };\n }", "function cuisineCat(cityID) {\n let queryUrl = `https://developers.zomato.com/api/v2.1/cuisines?city_id=${cityID}`;\n $.ajax({\n url: queryUrl,\n method: \"GET\",\n headers: { \"user-key\": \"a0916e41597909e8faa9dff1a09e8971\" },\n dataType: \"json\",\n }).then(function (response) {\n for (let i = 0; i < response.cuisines.length; i++) {\n document.getElementById('catSelect').add(new Option(response.cuisines[i].cuisine.cuisine_name, response.cuisines[i].cuisine.cuisine_id));\n }\n })\n}", "function listarUsuarios(){\n $http.get('/api/usuarios').success(function(response){\n $scope.usuarios = response;\n });\n }", "function listasDeCentro() {\n $('#a_centro').empty();\n var container = $('#a_centro');\n $.ajax({\n async: false,\n url: \"/listaCentro\",\n method: \"GET\",\n headers: {\n 'X-CSRF-TOKEN': $('meta[name=\"csrf-token\"]').attr('content')\n },\n statusCode: {\n 401: function () {\n location.reload();\n },\n /*419: function () {\n location.reload();\n }*/\n },\n success: function (data) {\n var option = `<option value=\"\" disabled selected>Seleccionar</option>`;\n data.forEach(element => {\n option += `<option value=\"${element.id}\"> CC : ${element.descripcion} </option>`;\n });\n container.append(option);\n },\n error: function () { }\n });\n}", "function listarEmpresa() {\n\tvar estado = 1;\n\t$(document).ready(function () {\n\t\t$('#tablaempresa').DataTable({\n\t\t\t\"destroy\": true,\n\t\t\t\"searching\": true,\n\t\t\t\"ajax\": \"../models/empresa/listar.php\",\n\t\t\t\"dataSrc\": \"\",\n\t\t\t\"method\": \"POST\",\n\t\t\t\"columns\": [{\n\t\t\t\t\t\"data\": \"nit\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"data\": \"nombre\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"data\": \"marca\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"data\": \"telefono\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"data\": \"correo\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"data\": \"estado\",\n\t\t\t\t\trender: function (data) {\n\t\t\t\t\t\testado = data;\n\t\t\t\t\t\tif (data == 'Activo') {\n\t\t\t\t\t\t\treturn \"<span class='badge badge-success badge-pill text-center'>Activo</span>\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn \"<span class='badge badge-danger badge-pill text-center'>Inactivo</span>\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"data\": \"codigo\",\n\t\t\t\t\trender: function (data) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (estado == 'Activo') {\n\t\t\t\t\t\t\treturn \"<div class='dropdown dropdown-action'><a href='#'' class='action-icon dropdown-toggle' data-toggle='dropdown' aria-expanded='false'><i class='fa fa-ellipsis-v'></i></a><div class='dropdown-menu dropdown-menu-right'><a class='dropdown-item' href='#' onclick='preparar(\" + data + \")' data-toggle='modal' data-target='#editarempresa'><i class='si si-pencil'></i> Editar</a><a class='dropdown-item' href='#' onclick='eliminar(\" + data + \")'><i class='si si-trash'></i> Eliminar</a></div></div>\";\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn \"<div class='dropdown dropdown-action'><a href='#'' class='action-icon dropdown-toggle' data-toggle='dropdown' aria-expanded='false'><i class='fa fa-ellipsis-v'></i></a><div class='dropdown-menu dropdown-menu-right'><a class='dropdown-item' href='#'' value=\" + data + \" onclick='renovar(\" + data + \")'><i class='fa fa-undo'></i> Renovar</a></div></div>\";\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t]\n\t\t});\n\t});\n}", "function Unidad(data,nombre) {\n var total = data.filter(function(d) {\n return d[\"UNIDAD DE ADSCRIPCIÓN\"] == nombre;\n });\n var hombres = total.filter(function(d) { return d[\"SEXO\"] == \"H\"; }).length\n var mujeres = total.filter(function(d) { return d[\"SEXO\"] == \"M\"; }).length;\n total = total.length;\n\n return [{key:hombres,sexo:\"H\"},{key:mujeres,sexo:\"M\"}]\n}", "function findCity() {\n for ( var i = 0; i < list[0].ponudjene.length; i++) {\n \tif (list[0].ponudjene[i].indexOf(autocomplete.value) >= 0) {\n \tvar newOption = document.createElement(\"option\");\n \tnewOption.value = list[0].ponudjene[i];\n \tdocument.getElementById(\"guessCity\").appendChild(newOption); \n \t}\t\n }\t\n}", "function buscaTodasCategorias(){\n $.ajax({\n url: '/finan/lancamentos/buscaTodasCategorias',\n }).done(function (result) {\n $('#finan_lanc_modal_cat_id').html('<option value=\"0\">Nova...</option>');\n \n $(result).each(function (i, cada){\n $('#finan_lanc_modal_cat_id').append('<option data-status=\"'+cada.status+'\" value=\"'+cada.id+'\">'+cada.nome+'</option>');\n });\n \n });\n }", "function getDepartamentoEmpleados(id) {\n $http.post(\"Departamentos/getDepartamentoEmpleados\", { id: id }).then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.lista.data = r.data.d.getDepartamentoEmpleados;\n vm.lista.disp = [].concat(vm.lista.data);\n }\n })\n }", "function mostrarListadoSaldoConductor(){\n ocultarFormularios();\n \n let sListado = oDGT.listadoSaldoConductor();\n \n document.getElementById(\"areaListado\").innerHTML= sListado;\n document.getElementById(\"titulo\").innerHTML= \"Listado de conductores con saldo pendiente\";\n}", "function cargar_Paises(lista_paises) {\r\n\t// PREPARAMOS TEXTOS PARA CREAR UN OBJETO DE NAVEGADOR\r\n\tvar texto_aconvertir = \"{'paises':\" + lista_paises + \"}\";\r\n\t// CREAMOS EL OBJETO DE NAVEGADOR\r\n\tvar objeto_paises = eval('(' + texto_aconvertir + ')');\r\n\t// ACCEDEMOS AL SELECT DE LA PAGINA PARA MODIFICARLO\r\n\tvar lista_paises = document.getElementById(\"pais\");\r\n\t// CREAMOS TANTOS OPTIONS COMO PAISES\r\n\tvar numero_paises = objeto_paises.paises.length;\r\n\tfor (i = 0; i < numero_paises; i++) {\r\n\t\topcion = document.createElement('option');\r\n\t\ttexto_opcion = document\r\n\t\t\t\t.createTextNode(objeto_paises.paises[i].paisNombre);\r\n\t\topcion.appendChild(texto_opcion);\r\n\t\topcion.value = objeto_paises.paises[i].codigoPais;\r\n\t\tlista_paises.appendChild(opcion);\r\n\t}\r\n}", "function obtenertecnicos() {\n $.ajax({\n type: \"POST\",\n url: \"wsprivado/wsasignarsolicitud.asmx/ObtenerTecnicos\",\n data: '',\n contentType: \"application/json; charset=utf-8\",\n dataType: \"json\",\n success: function (msg) {\n var tds = \"<option value='0'>Elegir...</option>\"\n $.each(msg.d, function () {\n datac.push({'id': this.id, 'nombre': this.nombre});\n });\n }\n });\n }", "function listar(cuadro){\n\t\t$('#tabla tbody').off('click');\n\t\tcuadros(cuadro, \"#cuadro1\");\n\t\tvar url=document.getElementById('ruta').value; //obtiene la ruta del input hidden con la variable <?=base_url()?>\n\t\tvar table=$(\"#tabla\").DataTable({\n\t\t\t\"destroy\":true,\n\t\t\t\"stateSave\": true,\n\t\t\t\"serverSide\":false,\n\t\t\t\"ajax\":{\n\t\t\t\t\"method\":\"POST\",\n\t\t\t\t\"url\": url + \"EsquemaComision/listado_esquema_comision\",\n\t\t\t\t\"dataSrc\":\"\"\n\t\t\t},\n\t\t\t\"columns\":[\n\t\t\t\t{\"data\": \"id_esquema_comision\",\n\t\t\t\t\trender : function(data, type, row) {\n\t\t\t\t\t\treturn \"<input type='checkbox' class='checkitem chk-col-blue' id='item\"+data+\"' value='\"+data+\"'><label for='item\"+data+\"'></label>\"\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{\"data\":\"idVendedor\"},\n\t\t\t\t{\"data\":\"tipoVendedor\"},\n\t\t\t\t{\"data\":\"num_ventas_mes\"},\n\t\t\t\t{\"data\":\"tipoPlazo\"},\n\t\t\t\t{\"data\":\"porctj_comision\",\n\t\t\t\t\trender : function(data, type, row) {\n\t\t\t\t\t\treturn data.replace('.',',') + \" %\";\n\t \t\t}\n\t\t\t\t},\n\t\t\t\t{\"data\":\"fec_regins\",\n\t\t\t\t\trender : function(data, type, row) {\n\t\t\t\t\t\treturn cambiarFormatoFecha(data);\n\t \t\t}\n\t\t\t\t},\n\t\t\t\t{\"data\":\"correo_usuario\"},\n\t\t\t\t{\"data\": null,\n\t\t\t\t\trender : function(data, type, row) {\n\t\t\t\t\t\tvar botones = \"\";\n\t\t\t\t\t\tif(consultar == 0)\n\t\t\t\t\t\t\tbotones += \"<span class='consultar btn btn-xs btn-info waves-effect' data-toggle='tooltip' title='Consultar'><i class='fa fa-eye' style='margin-bottom:5px'></i></span> \";\n\t\t\t\t\t\tif(actualizar == 0)\n\t\t\t\t\t\t\tbotones += \"<span class='editar btn btn-xs btn-primary waves-effect' data-toggle='tooltip' title='Editar'><i class='fa fa-pencil-square-o' style='margin-bottom:5px'></i></span> \";\n\t\t\t\t\t\tif(data.status == 1 && actualizar == 0)\n\t\t\t\t\t\t\tbotones += \"<span class='desactivar btn btn-xs btn-warning waves-effect' data-toggle='tooltip' title='Desactivar'><i class='fa fa-unlock' style='margin-bottom:5px'></i></span> \";\n\t\t\t\t\t\telse if(data.status == 2 && actualizar == 0)\n\t\t\t\t\t\t\tbotones += \"<span class='activar btn btn-xs btn-warning waves-effect' data-toggle='tooltip' title='Activar'><i class='fa fa-lock' style='margin-bottom:5px'></i></span> \";\n\t\t\t\t\t\tif(borrar == 0)\n\t\t \t\tbotones += \"<span class='eliminar btn btn-xs btn-danger waves-effect' data-toggle='tooltip' title='Eliminar'><i class='fa fa-trash-o' style='margin-bottom:5px'></i></span>\";\n\t\t \t\treturn botones;\n\t\t \t}\n\t\t\t\t}\n\t\t\t],\n\t\t\t\"language\": idioma_espanol,\n\t\t\t\"dom\": 'Bfrtip',\n\t\t\t\"responsive\": true,\n\t\t\t\"buttons\":[\n\t\t\t\t'copy', 'csv', 'excel', 'pdf', 'print'\n\t\t\t]\n\t\t});\n\t\tver(\"#tabla tbody\", table);\n\t\teditar(\"#tabla tbody\", table);\n\t\teliminar(\"#tabla tbody\", table);\n\t\tdesactivar(\"#tabla tbody\", table);\n\t\tactivar(\"#tabla tbody\", table);\n\t}", "function listarLlaves(){\n $http.get('/api/llaves').success(function(response){\n $scope.llavesCombo = response;\n });\n }", "function buscarCliente(cdni) {\n let resultado = baseCliente.filter(fila => fila.dni == cdni);\n\n for (const cliente of resultado) {\n return cliente;\n }\n\n}", "async listCategoria(Request, Response){\n pool.connect(async function (err, client, done){\n\n const userId = Request.headers.authorization;\n const { mes, nome } = Request.body\n \n const despesas = await client.query(\"select d.id_despesas, d._data, d.valor, c.nome as soma from despesas d inner join categoria c using (id_categoria) where Extract('Month' From _data) = $1 and id_usuario = $2 and d.id_categoria = c.id_categoria and c.nome = $3;\", [mes, userId, nome]);\n \n done();\n return Response.json(despesas.rows);\n });\n }", "function getCombustiveis() {\n\n //Load Json marca\n $.ajax({\n url: urlApi + \"combustivel\",\n\n type: 'GET',\n dataType: 'json',\n success: function (resp) {\n\n $.each(resp.data, function (key, value) {\n\n $('#combustivel').append(\n $(\"<option></option>\")\n .attr('value', value.id)\n .text(value.tipo)\n );\n $('#combustivel').material_select();\n\n });\n\n }\n });\n}", "getAllContries () {\n return axios.get(`${RESTCOUNTRIES_API_URL}/all`)\n }", "getRefferalAndAngentList(){\nreturn this.get(Config.API_URL + Constant.REFFERAL_GETREFFERALANDANGENTLIST);\n}", "function cmbdepartemenS(){\n deplist().done(function(res){\n var opt='';\n if(res.status!='sukses'){\n notif(res.status,'red');\n }else{\n $.each(res.departemen, function(id,item){\n opt+='<option value=\"'+item.replid+'\">'+item.nama+'</option>'\n });\n $('#departemenS').html(opt);\n cmbprosesS($('#departemenS').val());\n }\n });\n }", "function loadDeparturesWithCountrycode(countrycode) {\n vm.loading = true;\n datacontext.getDepartureTerminalsByCountryCode(countrycode).then(function(resp) {\n //console.log(resp);\n\n try {\n vm.departureTerminals = resp.Items;\n } catch (exception) {\n swal(\"please try again later!\");\n }\n\n\n\n // console.log(vm.departureTerminals[0]);\n vm.loading = false;\n }, function(err) {\n console.log(err);\n vm.loading = false;\n });\n }", "function getUniqueNationalities()\n{\n\t$.get(publicPort + 'GetUniqueNationalities',function(data,status){\n\t\tvar countryBox = document.getElementById('countryCmbBox');\n\n\t\tfor(var i=0; i<data.length; i++)\n\t\t{\n\t\t\tvar option = document.createElement(\"option\");\n \t\t\toption.text = data[i];\n \t\t\tcountryBox.add(option);\n\t\t}\n\t\tgetNationalityAverages();\n\t});\n\n\n}", "function getNamesCarriers()\r\n {\r\n $.ajax({url: \"../Grupos/Nombres\", success: function(datos)\r\n {\r\n $SINE.DATA.groups = JSON.parse(datos);\r\n $SINE.DATA.nombresGroups = Array();\r\n for (var i = 0, j = $SINE.DATA.groups.length - 1; i <= j; i++)\r\n {\r\n $SINE.DATA.nombresGroups[i] = $SINE.DATA.groups[i].name;\r\n }\r\n ;\r\n $('input#grupo, input#group').autocomplete({source: $SINE.DATA.nombresGroups});\r\n }\r\n });\r\n }", "function get_coberturas_unidad() {\n lista_coberturas = [];\n var unidad = $(\"#txt_unidad\").val();\n var demanda = $(\"#txt_demanda\").val();\n var capas = $.ajax({\n url: \"/visor/CobVeg/get_coberturas_unidad/\" + unidad + \"/\" + demanda,\n type: \"GET\",\n dataType: \"json\",\n async: false}).responseText;\n capas = JSON.parse(capas)\n for (var i = 0; i < capas.length; i++) {\n var item = {id: i + 1, nombre: capas[i].cap_nombre, periodo: capas[i].cap_precipitacion, layer: capas[i].cap_layer, agregado: false, valor:capas[i].cap_valor, demanda:capas[i].cap_demanda}\n lista_coberturas.push(item);\n }\n}", "getLista() {\n let listaTemporal = this.lista.filter((usuario) => {\n // if(usuario.nombre!='sin-nombre'){//cuando si tenga un nombre lo retornare a una lista temporal\n return usuario;\n // }\n });\n return listaTemporal;\n }", "function ordenar() {\n let seleccion = $(\"#miSeleccion\").val().toUpperCase();\n popularListaCompleta();\n listaCompletaClases = listaCompletaClases.filter(Clase => Clase.dia ==\n seleccion);\n renderizarProductos();\n}", "function parroquia(args) {\r\n let result = ecuador.data.lookupCities(args);\r\n results = result[0];\r\n let parroquia = [];\r\n for (var key in results.towns) {\r\n parroquia.push(results.towns[key].name);\r\n }\r\n return parroquia;\r\n}", "function provinces() {\r\n let results = ecuador.data.provinces;\r\n let provincias = [];\r\n for (var key in results) {\r\n provincias.push(results[key].name);\r\n }\r\n return provincias;\r\n}", "function listar() {\n\n\t\ttabla=$('#resolucion_data').dataTable({\n\t\t\t\"aProcessing\":true,//Activamos procesamiento de datatable\n\t\t\t\"aServerSide\":true,//Paginacion y filtrado realizados por el servidor\n\t\t\tdom:'Bfrtip',//Definimos los elementos del control de table\n\t\t\tbuttons:[\n\t\t\t\t'copyHtml5',\n\t\t\t\t'excelHtml5',\n\t\t\t\t'pdf'//para los botones en el datatable\n\t\t\t\t],\n\t\t\t\"ajax\":\n\t\t\t{\n\t\t\t\turl:'../ajax/resolucion.php?op=buscar_resolucion',//enviamos el parametro \n\t\t\t\ttype:\"get\",//el tipo del parametro\n\t\t\t\tdataType:\"json\",//formato de la data\n\n\t\t\t\terror: function (e) {\n\t\t\t\t\tconsole.log(e.responseText);//para hacer la verificacion de errores\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"bDestroy\":true,\n\t\t\t\"responsive\":true,\n\t\t\t\"bInfo\":true,//informacion del los datatable\n\t\t\t\"iDisplayLength\":20,//Pora cada 10 registros hace una paginacion\n\t\t\t\"order\":[[0,\"desc\"]],//Ordenar (Columna,orden)\n \t\t\t\n \t\t\t\"language\": {\n \n\t\t\t \"sProcessing\": \"Procesando...\",\n\t\t\t \n\t\t\t \"sLengthMenu\": \"Mostrar _MENU_ registros\",\n\t\t\t \n\t\t\t \"sZeroRecords\": \"No se encontraron resultados\",\n\t\t\t \n\t\t\t \"sEmptyTable\": \"Ningún dato disponible en esta tabla\",\n\t\t\t \n\t\t\t \"sInfo\": \"Mostrando un total de _TOTAL_ registros\",\n\t\t\t \n\t\t\t \"sInfoEmpty\": \"Mostrando un total de 0 registros\",\n\t\t\t \n\t\t\t \"sInfoFiltered\": \"(filtrado de un total de _MAX_ registros)\",\n\t\t\t \n\t\t\t \"sInfoPostFix\": \"\",\n\t\t\t \n\t\t\t \"sSearch\": \"Buscar:\",\n\t\t\t \n\t\t\t \"sUrl\": \"\",\n\t\t\t \n\t\t\t \"sInfoThousands\": \",\",\n\t\t\t \n\t\t\t \"sLoadingRecords\": \"Cargando...\",\n\t\t\t \n\t\t\t \"oPaginate\": {\n\t\t\t \n\t\t\t \"sFirst\": \"Primero\",\n\t\t\t \n\t\t\t \"sLast\": \"Último\",\n\t\t\t \n\t\t\t \"sNext\": \"Siguiente\",\n\t\t\t \n\t\t\t \"sPrevious\": \"Anterior\"\n\t\t\t \n\t\t\t },\n\t\t\t \n\t\t\t \"oAria\": {\n\t\t\t \n\t\t\t \"sSortAscending\": \": Activar para ordenar la columna de manera ascendente\",\n\t\t\t \n\t\t\t \"sSortDescending\": \": Activar para ordenar la columna de manera descendente\"\n\t\t\t\n\t\t\t }\n\n\t\t\t }//cerrando language\n\t\t}).DataTable();\n\t}", "getLista() {\n return this.lista.filter(usuario => usuario.nombre !== 'sin-nombre');\n }" ]
[ "0.7260528", "0.7181152", "0.6979924", "0.6458958", "0.64531326", "0.6435541", "0.633695", "0.6231", "0.62308604", "0.6204876", "0.614203", "0.61321753", "0.61061156", "0.609788", "0.605269", "0.6017308", "0.60037667", "0.5988487", "0.5951727", "0.5934652", "0.5920953", "0.59089816", "0.5867421", "0.5863425", "0.5863217", "0.5850666", "0.58425534", "0.58305395", "0.58001876", "0.5780475", "0.57511663", "0.5715679", "0.5708205", "0.57031125", "0.5674434", "0.5674384", "0.56716025", "0.5669418", "0.56611794", "0.5653379", "0.5646336", "0.5645091", "0.5636584", "0.5627043", "0.56221795", "0.56196463", "0.5609946", "0.5601944", "0.5597704", "0.5596128", "0.55735916", "0.55640674", "0.55631846", "0.5559959", "0.5554287", "0.55497503", "0.55432093", "0.5538517", "0.55373204", "0.5523309", "0.55186397", "0.5506885", "0.5487934", "0.54849863", "0.54704565", "0.5469792", "0.5468472", "0.54673016", "0.54593915", "0.5456931", "0.5443214", "0.5442103", "0.54398215", "0.5434119", "0.5427325", "0.54173017", "0.54162186", "0.54153514", "0.54128647", "0.54102665", "0.54073745", "0.54019964", "0.5400026", "0.5398716", "0.53972554", "0.5396572", "0.5394208", "0.5392486", "0.53896946", "0.53783345", "0.53772175", "0.5375816", "0.5375193", "0.53725", "0.53664106", "0.5362862", "0.5362251", "0.535963", "0.53584945", "0.5355057", "0.535234" ]
0.0
-1
opccion que sirve para poder listar las ciudades dependindo de la celencion del departamento en cada itent
function IncetDat(id) { var auxc = new ApiCiudad("", "", ""); var id_conte_lis = "#LCiuDist" + id; var id_conte_depart = "#LDepDist" + id; $(id_conte_lis).html(" "); // limpia la casilla para que se pueda ver var id_depart = $(id_conte_depart).val(); var dat = { llave: id_conte_lis, idCiu: 0, iddist: id_depart }; auxc.idDepart = id_depart; auxc.List(dat); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cargaCombosDependientes() {\n\tcargaCombosMarcaCanal();\n\tcargaCombosClientes();\n\tcargaCombosZonas();\n\tif (parametrosRecargaCombos.length > 0) {\n\t\trecargaComboMultiple(parametrosRecargaCombos); \n\t\tparametrosRecargaCombos = new Array();\n\t}\n}", "function getCuponesPorIndustria(idIndustria){\n\t\n}", "function _DependenciasHabilidadesEspeciais() {\n var especiais_antes = gPersonagem.especiais;\n var especiais_nivel_classe = [];\n for (var i = 0; i < gPersonagem.classes.length; ++i) {\n var entrada_classe = gPersonagem.classes[i];\n if (tabelas_classes[entrada_classe.classe].especiais == null) {\n continue;\n }\n especiais_nivel_classe.push(\n { nivel: PersonagemNivelClasse(entrada_classe.classe), especiais_classe: tabelas_classes[entrada_classe.classe].especiais });\n }\n if ('especiais' in tabelas_raca[gPersonagem.raca]) {\n especiais_nivel_classe.push({ nivel: PersonagemNivel(), especiais_classe: tabelas_raca[gPersonagem.raca].especiais });\n }\n var template_pc = PersonagemTemplate();\n if (template_pc != null && 'especiais' in template_pc) {\n especiais_nivel_classe.push({ nivel: PersonagemNivel(), especiais_classe: template_pc.especiais });\n }\n\n for (var i = 0; i < especiais_nivel_classe.length; ++i) {\n var dados_nivel_classe = especiais_nivel_classe[i];\n for (var nivel = 1; nivel <= dados_nivel_classe.nivel; ++nivel) {\n var especiais_por_nivel = dados_nivel_classe.especiais_classe;\n if (!(nivel in especiais_por_nivel)) {\n continue;\n }\n for (var j = 0; j < especiais_por_nivel[nivel].length; ++j) {\n _DependenciaHabilidadeEspecial(especiais_por_nivel[nivel][j]);\n }\n }\n }\n gPersonagem.dominios.forEach(function(dominio) {\n if ('habilidade_especial' in tabelas_dominios[dominio]) {\n _DependenciaHabilidadeEspecial(tabelas_dominios[dominio].habilidade_especial);\n }\n });\n\n // Atualiza o numero de usos de cada especial.\n for (var chave_especial in gPersonagem.especiais) {\n if (chave_especial in especiais_antes) {\n gPersonagem.especiais[chave_especial].usado = especiais_antes[chave_especial].usado || 0;\n } else {\n gPersonagem.especiais[chave_especial].usado = 0;\n }\n }\n}", "function _DependenciasNivelConjurador() {\n // Niveis basicos de conjurador.\n gPersonagem.classes.forEach(function(entrada_classe) {\n var classe_tabela = tabelas_classes[entrada_classe.classe];\n if (classe_tabela.nivel_conjurador == null) {\n entrada_classe.nivel_conjurador = 0;\n entrada_classe.linha_tabela_feiticos = 0;\n } else {\n var nivel_minimo = classe_tabela.nivel_conjurador.minimo || 0;\n if (entrada_classe.nivel < nivel_minimo) {\n entrada_classe.nivel_conjurador = 0;\n entrada_classe.linha_tabela_feiticos = 0;\n return;\n }\n var modificador_nivel_conjurador = classe_tabela.nivel_conjurador.modificador || 0;\n entrada_classe.nivel_conjurador = Math.floor(entrada_classe.nivel * modificador_nivel_conjurador);\n entrada_classe.linha_tabela_feiticos = entrada_classe.nivel;\n }\n });\n // Niveis incrementais de conjurador.\n gPersonagem.classes.forEach(function(classe_personagem_modificadora) {\n var classe_tabela = tabelas_classes[classe_personagem_modificadora.classe];\n if (classe_tabela.incremento_nivel_conjurador == null) {\n return;\n }\n classe_tabela.incremento_nivel_conjurador.forEach(function(tipo) {\n var classe_personagem = PersonagemMaiorClasseConjurador(tipo);\n if (classe_personagem == null) {\n return;\n }\n classe_personagem.nivel_conjurador += classe_personagem_modificadora.nivel;\n classe_personagem.linha_tabela_feiticos += classe_personagem_modificadora.nivel;\n });\n });\n}", "function _DependenciasClasseArmadura() {\n gPersonagem.armadura = null;\n for (var i = 0; i < gPersonagem.armaduras.length; ++i) {\n if (gPersonagem.armaduras[i].entrada.em_uso) {\n gPersonagem.armadura = gPersonagem.armaduras[i];\n break;\n }\n }\n\n gPersonagem.escudo = null;\n for (var i = 0; i < gPersonagem.escudos.length; ++i) {\n if (gPersonagem.escudos[i].entrada.em_uso) {\n gPersonagem.escudo = gPersonagem.escudos[i];\n break;\n }\n }\n\n var bonus_ca = gPersonagem.ca.bonus;\n // Por classe.\n var bonus_classe = 0;\n for (var i_classe = 0; i_classe < gPersonagem.classes.length; ++i_classe) {\n var chave_classe = gPersonagem.classes[i_classe].classe;\n var nivel = gPersonagem.classes[i_classe].nivel;\n var tabela_classe = tabelas_classes[chave_classe];\n for (var i = 1; i <= nivel; ++i) {\n if (tabela_classe.especiais != null && tabela_classe.especiais[i] != null) {\n var especiais_classe_nivel = tabela_classe.especiais[i];\n for (var j = 0; j < especiais_classe_nivel.length; ++j) {\n if (especiais_classe_nivel[j] == 'bonus_ca') {\n ++bonus_classe;\n }\n }\n }\n }\n }\n bonus_ca.Adiciona('classe', 'monge', bonus_classe);\n\n if (gPersonagem.armadura != null) {\n bonus_ca.Adiciona(\n 'armadura', 'armadura', tabelas_armaduras[gPersonagem.armadura.entrada.chave].bonus);\n bonus_ca.Adiciona(\n 'armadura_melhoria', 'armadura', gPersonagem.armadura.entrada.bonus);\n }\n if (gPersonagem.escudo != null) {\n bonus_ca.Adiciona(\n 'escudo', 'escudo', tabelas_escudos[gPersonagem.escudo.entrada.chave].bonus);\n bonus_ca.Adiciona(\n 'escudo_melhoria', 'escudo', gPersonagem.escudo.entrada.bonus);\n }\n bonus_ca.Adiciona(\n 'atributo', 'destreza', gPersonagem.atributos.destreza.modificador);\n if (PersonagemNivelClasse('monge') > 0) {\n bonus_ca.Adiciona(\n 'atributo', 'sabedoria', gPersonagem.atributos.sabedoria.modificador);\n }\n\n bonus_ca.Adiciona(\n 'tamanho', 'tamanho', gPersonagem.tamanho.modificador_ataque_defesa);\n // Pode adicionar as armaduras naturais aqui que elas nao se acumulam.\n bonus_ca.Adiciona(\n 'armadura_natural', 'racial', tabelas_raca[gPersonagem.raca].armadura_natural || 0);\n var template_personagem = PersonagemTemplate();\n if (template_personagem != null) {\n if ('bonus_ca' in template_personagem) {\n for (var chave in template_personagem.bonus_ca) {\n bonus_ca.Adiciona(chave, 'template', template_personagem.bonus_ca[chave]);\n }\n }\n bonus_ca.Adiciona(\n 'armadura_natural', 'template', template_personagem.armadura_natural || 0);\n }\n}", "getDependencies() {\n const list = [];\n for (let i = 0; i < this.SubCircuit.length; i++) {\n list.push(this.SubCircuit[i].id);\n list.extend(scopeList[this.SubCircuit[i].id].getDependencies());\n }\n return uniq(list);\n }", "function _DependenciasNumeroFeiticosParaClasse(classe_personagem) {\n var chave_classe = classe_personagem.classe;\n var tabela_feiticos_classe = tabelas_feiticos[chave_classe];\n if (tabela_feiticos_classe == null) {\n return;\n }\n // Possivel para paladinos e rangers.\n if (classe_personagem.nivel_conjurador == 0) {\n return;\n }\n var atributo_chave = tabela_feiticos_classe.atributo_chave;\n var valor_atributo_chave = gPersonagem.atributos[atributo_chave].bonus.Total();\n var feiticos_por_nivel = tabela_feiticos_classe.por_nivel[classe_personagem.linha_tabela_feiticos];\n var nivel_inicial = tabela_feiticos_classe.possui_nivel_zero ? 0 : 1;\n gPersonagem.feiticos[chave_classe].em_uso = true;\n // Feiticos conhecidos (se houver para a classe). Se nao houver, vai usar o que vier da entrada.\n // Por exemplo, magos nao tem limite de conhecidos.\n for (var indice = 0;\n feiticos_por_nivel.conhecidos != null && indice < feiticos_por_nivel.conhecidos.length;\n ++indice) {\n var conhecidos_nivel = parseInt(feiticos_por_nivel.conhecidos.charAt(indice)) || 0;\n _DependenciasNumeroFeiticosConhecidosParaClassePorNivel(\n chave_classe, nivel_inicial + indice, conhecidos_nivel, feiticos_por_nivel);\n }\n // Slots de feiticos.\n var array_bonus_feiticos_atributo = feiticos_atributo(valor_atributo_chave);\n var bonus_atributo_chave = gPersonagem.atributos[atributo_chave].modificador;\n var possui_dominio = tabela_feiticos_classe.possui_dominio;\n var escola_especializada = tabela_feiticos_classe.escola_especializada;\n for (var indice = 0; indice < feiticos_por_nivel.por_dia.length; ++indice) {\n var num_slots_nivel = parseInt(feiticos_por_nivel.por_dia.charAt(indice)) || 0;\n _DependenciasNumeroSlotsParaClassePorNivel(\n chave_classe, nivel_inicial + indice, num_slots_nivel, feiticos_por_nivel,\n array_bonus_feiticos_atributo, bonus_atributo_chave, possui_dominio, escola_especializada);\n }\n gPersonagem.feiticos[chave_classe].nivel_maximo = nivel_inicial + feiticos_por_nivel.por_dia.length - 1;\n}", "function whichDepart() {\r\n\r\n let lcraDepartment = [\"Business Development\", \"Chief Administrative Officer\", \"Chief Commercial Officer\", \"Chief Financial Officer\", \"Chief of Staff\", \"Commercial Asset Management\", \"Communications\", \"Community Services\", \"Construction I\", \"Construction II\", \"Construction Support\", \"Controller\", \"Corporate Events\", \"Corporate Strategy\", \"Critical Infra Protection\", \"Critical Infrastructure Protection\", \"Customer Operations\", \"Cybersecurity\", \"Dam and Hydro\", \"Digital Services\", \"Enterprise Operations\", \"Environmental Affairs\", \"Environmental Field Services\", \"Environmental Lab\", \"Facilities Planning Management\", \"Finance\", \"Financial Planning & Strategy\", \"Fleet Services\", \"FPP Maintenance\", \"FPP Operations\", \"FPP Plant Support\", \"FRG Maintenance\", \"FRG Operations\", \"FRG Plant Support\", \"Fuels Accounting\", \"General Counsel\", \"General Manager\", \"Generation Environmental Group\", \"Generation Operations Mgmt\", \"Governmental & Regional Affairs\", \"Hilbig Gas Operations\", \"Human Resources\", \"Information Management\", \"Irrigation Operations\", \"Lands & Conservation\", \"Legal Services\", \"Line & Structural Engineering\", \"Line Operations\", \"LPPP Maintenance\", \"LPPP Operations\", \"LPPP Plant Support\", \"Materials Management\", \"Mid-Office Credit and Risk\", \"P&G Oper Reliability Group\", \"Parks\", \"Parks District - Coastal\", \"Parks District - East\", \"Parks District - West\", \"Plant Operations Engr. Group\", \"Plant Support Service\", \"Project Management\", \"Public Affairs\", \"QSE Operations\", \"Rail Fleet Operations\", \"Rangers\", \"Real Estate Services\", \"Regulatory & Market Compliance\", \"Regulatory Affairs\", \"Resilience\", \"River Operations\", \"Safety Services\", \"Sandy Creek Energy Station\", \"Security\", \"Service Quality & Planning\", \"SOCC Operations\", \"Strategic Initiatives & Transformation\", \"Strategic Sourcing\", \"Substation Engineering\", \"Substation Operations\", \"Supply Chain\", \"Survey GIS & Technical Svc\", \"System Control Services\", \"System Infrastructure\", \"Technical & Engineering Services\", \"Telecom Engineering\", \"Trans Contract Construction\", \"Trans Operational Intelligence\", \"Transmission Design & Protect\", \"Transmission Executive Mgmt\", \"Transmission Field Services\", \"Transmission Planning\", \"Transmission Protection\", \"Transmission Strategic Svcs\", \"Water\", \"Water Contracts & Conservation\", \"Water Engineering\", \"Water Quality\", \"Water Resource Management\", \"Water Surface Management\", \"Wholesale Markets & Sup\"];\r\n\r\n //let lcraDepart = document.getElementById(\"lcraDepart\");\r\n\r\n\r\n for(let i = 0; i < lcraDepartment.length; i++){\r\n let optn = lcraDepartment[i];\r\n let el = document.createElement(\"option\");\r\n el.value = optn;\r\n el.textContent = optn;\r\n lcraDepart.appendChild(el);\r\n }\r\n}", "function ciudades (){\nvar uniqueStorage = removeDuplicates(Storage, \"Ciudad\");\nvar atributos = Array();\n \n if( uniqueStorage.length > 0 ) {\n for( var aux in uniqueStorage )\n atributos.push(uniqueStorage[aux].Ciudad);\n }\n return atributos;\n}", "function viewAllDepartmentsBudgets(conn, start) {\n conn.query(`SELECT\td.name Department, \n LPAD(CONCAT('$ ', FORMAT(SUM(r.salary), 0)), 12, ' ') Salary, \n COUNT(e.id) \"Emp Count\"\n FROM\temployee e \n LEFT JOIN role r on r.id = e.role_id\n LEFT JOIN department d on d.id = r.department_id\n WHERE\te.active = true\n GROUP BY d.name\n ORDER BY Salary desc;`, function(err, results) {\n if (err) throw err;\n console.table(results);\n start();\n });\n }", "function cargarCgg_res_beneficiarioCtrls(){\n if(inInfoPersona.CRPER_CODIGO_AUSPICIANTE != undefined && inInfoPersona.CRPER_CODIGO_AUSPICIANTE.length>0){\n if(inInfoPersona.CRPJR_CODIGO.length>0)\n {\n txtCrper_codigo.setValue(inInfoPersona.CRPJR_RAZON_SOCIAL);\n tmpAuspiciantePJ = inInfoPersona.CRPJR_CODIGO;\n txtCrpjr_representante_legal.setValue(inInfoPersona.CRPER_NOMBRE_AUSPICIANTE);\n tmpAuspiciante= inInfoPersona.CRPER_CODIGO_AUSPICIANTE;\n rdgTipoAuspiciante.setValue('rdgTipoAuspiciante',TypeAuspiciante.JURIDICA);\n }\n else\n {\n txtCrper_codigo.setValue(inInfoPersona.CRPER_NOMBRE_AUSPICIANTE);\n tmpAuspiciante= inInfoPersona.CRPER_CODIGO_AUSPICIANTE;\n rdgTipoAuspiciante.setValue('rdgTipoAuspiciante',TypeAuspiciante.NATURAL);\n }\n }\n }", "findByDept(numDept) {\n let sqlRequest = \"SELECT * FROM activite WHERE code_du_departement=$numDept\";\n let sqlParams = {$numDept: numDept};\n return this.common.run(sqlRequest, sqlParams).then(rows => {\n let activite = [];\n for (const row of rows) {\n activite.push(new Activite(row.code_du_departement, row.libelle_du_departement, row.nom_de_la_commune, row.numero_de_la_fiche_equipement, row.nombre_dEquipements_identiques, row.activite_libelle, row.activite_praticable, row.activite_pratiquee, row.dans_salle_specialisable, row.niveau_de_lActivite, row.localisation, row.activite_code));\n }\n return activite;\n });\n }", "function getDiscount() {\n \n var order = angular.copy(self.order);\n \n if (order.birthday) {\n order.birthday = dateFilter(order.birthday, 'yyyy-MM-dd')\n }\n \n if (!order.services) {\n order.services = [];\n }\n \n var orderServices = [];\n \n services.forEach(function (service) {\n \n if (order.services[service.id]) {\n orderServices.push(angular.copy(service));\n }\n \n });\n \n order.services = orderServices;\n \n rpc('order.getDiscount', order)\n .then(function (result) {\n alert('Ваша скидка ' + result + '%');\n });\n \n }", "function obtenerColoresDegradados() {\r\n return [\"90-#ff0000-#9d0000\",\"90-#00ff00-#009d00\",\"90-#0000ff-#00009d\",\"90-#ffff00-#A99200\",\"90-#FF8000-#AA6000\",\"90-#8000FF-#420373\",\"90-#FF8080-#FF8888\",\"90-#808080-#00009d\",\"90-#800000-#00009d\",\"90-#800080-#4D0178\"]; \r\n}", "getConcessionairesList(state) {\n return state.concessionairesList;\n }", "function getCuentas(callback) {\n\tvar criterio = {$or: [\n \t {$and: [\n\t \t{'datosMonitoreo' : {$exists : true}},\n \t\t{'datosMonitoreo' : {$ne : ''}},\n \t\t{'datosMonitoreo.id' : {$ne : ''}}\n \t ]},\n \t {$and: [\n \t\t{'datosPage' : {$exists : true}},\n\t\t{'datosPage': {$ne : ''}},\n\t\t{'datosPage.id' : {$ne : ''}}\n \t ]}\n \t]};\n\tvar elsort = { nombreSistema : 1 };\n \tclassdb.buscarToStream('accounts', criterio, elsort, 'solicitudes/getoc/getCuentas', function(cuentas){\n\t if (cuentas === 'error') {\n\t\treturn callback(cuentas);\n\t }\n\t else {\n\t\trefinaCuentas(cuentas, 0, [], function(refinadas){\n\t\t return callback(refinadas);\n\t\t});\n\t }\n\t});\n }", "function populateDepInfo() {\n const depCheck = document.querySelectorAll(\"#depTable tbody tr\"); //Get Department Table Rows\n let deps = getDeps();\n if (depCheck.length == 0) {\n for (let j = 0; j < deps.length; j++) {\n let depOb = new CRUD(\"depTable\", \"depSelect\", deps[j]); //Create Object for department\n depOb.addOption();\n depOb.addRow();\n }\n } else {\n removeExistingDep();\n populateDepInfo();\n }\n}", "function DependenciasGerais() {\n _DependenciasNivelConjurador();\n _DependenciasEquipamentos();\n _DependenciasFamiliar();\n _DependenciasDadosVida();\n _DependenciasAtributos();\n _DependenciasTalentos();\n _DependenciasPontosVida();\n _DependenciasIniciativa();\n _DependenciasTamanho();\n _DependenciasBba();\n _DependenciasProficienciaArmas();\n _DependenciasHabilidadesEspeciais();\n _DependenciasImunidades();\n _DependenciasResistenciaMagia();\n\n // So pode fazer aqui, pois os pre requisitos dependem de atributos, classes,\n // talentos, proficiencias...\n // TODO se essa funcao falhar, potencialmente o personagem tera que ser recarregado.\n _VerificaPrerequisitosTalento();\n\n _DependenciasPericias();\n _DependenciasFocoArmas();\n _DependenciasEspecializacaoArmas();\n _DependenciasClasseArmadura();\n _DependenciasArmas();\n _DependenciasEstilos();\n _DependenciasSalvacoes();\n _DependenciasFeiticos();\n}", "getCommanditaires() {\n\t\tthis.serviceTournois.getCommanditaires(this.tournoi.idtournoi).then(commanditaires => {\n\t\t\tthis.commanditaires = commanditaires;\n\t\t\tfor (let commanditaire of this.commanditaires) {\n\t\t\t\tthis.getContribution(commanditaire);\n\t\t\t}\n\t\t});\n\t}", "function _DependenciasItemOuFamiliar(chave_item, item_tabela) {\n for (var propriedade in item_tabela.propriedades) {\n if (propriedade == 'ca') {\n _DependenciasItemCa(chave_item, item_tabela);\n } else if (propriedade == 'ataque') {\n _DependenciasItemAtaque(chave_item, item_tabela);\n } else if (propriedade == 'pericias') {\n _DependenciasItemPericias(chave_item, item_tabela);\n } else if (propriedade == 'salvacoes') {\n _DependenciasItemSalvacoes(chave_item, item_tabela);\n } else if (propriedade == 'atributos') {\n _DependenciasItemAtributos(chave_item, item_tabela);\n } else if (propriedade == 'tamanho') {\n _DependenciasItemTamanho(chave_item, item_tabela);\n } else if (propriedade == 'bonus_pv') {\n _DependenciasItemPontosVida(chave_item, item_tabela);\n } else if (propriedade == 'especiais') {\n _DependenciasItemEspeciais(chave_item, item_tabela);\n }\n }\n}", "function viewDeps() {\n connection.query(\"SELECT * FROM department\", (err, results) => {\n if (err) throw err\n console.table(results)\n action()\n })\n}", "function getCidades(element) {\n var resultado = [];\n if (element) {\n var cidades = $(element).find('table tr');\n if (cidades && cidades.length > 0) {\n cidades.each(function(index, element) {\n let tds = $(element).find('td');\n if (tds && tds.length > 1) {\n let cidade = {\n Cidade: getText(tds[0]),\n UF: getText(tds[1])\n };\n resultado.push(cidade);\n }\n });\n } \n }\n return resultado;\n }", "function accionBuscar ()\n {\n configurarPaginado (mipgndo,'DTOBuscarMatricesDTOActivas','ConectorBuscarMatricesDTOActivas',\n 'es.indra.sicc.cmn.negocio.auditoria.DTOSiccPaginacion', armarArray());\n }", "function getAll(req, res) {\n tipocliente.findAll().then(tipo_cliente => {\n return res.status(200).json({\n ok: true,\n tipo_cliente\n });\n }).catch(err => {\n return res.status(500).json({\n message: 'Ocurrió un error al buscar los departamentos'\n });\n });\n}", "listarPendientesCompletados (completado=true){\n\n //Arreglos para diferenciar tareas completas de pendientes \n const listadoCompletas=[];\n const listadoPendientes=[];\n\n\n //recorridos del listado arreglado \n this.listadoArr.forEach((tarea)=>{\n\n //destructuracion de la tarea, lo que necesito\n const {descripcion, completadoEn} = tarea;\n\n //dependiendo del estado de las tareas las agrego a los arreglos establecidos para cada caso\n (completadoEn)\n ? listadoCompletas.push(tarea)\n : listadoPendientes.push(tarea);\n })\n\n //Separar si quiero ver las completadas o las pendientes\n if(completado){\n\n console.log('');\n\n //recorrido e impresion de las tareas completadas\n listadoCompletas.forEach((tareasCompletadas,i)=>{\n const indice = `${i+1}.`.green;\n const {descripcion, completadoEn} = tareasCompletadas;\n console.log(`${indice} ${descripcion} :: ${completadoEn.green}`);\n })\n } else {\n\n console.log('');\n\n //recorrido e impresion de las tareas pendietes \n listadoPendientes.forEach((tareasPendientes,i)=>{\n const indice = `${i+1}.`.green;\n const {descripcion, completadoEn} = tareasPendientes;\n console.log(`${indice} ${descripcion} :: ${'Pendiente'.red}`);\n })\n }\n }", "function getDepartamentosDropdown() {\n $http.post(\"Departamentos/getDepartamentosTotal\").then(function (r) {\n if (r.data.cod == \"OK\") {\n vm.listaDepartamentos.data = r.data.d.data;\n \n }\n })\n }", "function somarInventarioDepartamento(departamento) {\n let somaInventario = 0;\n for (p in listaProdutos) {\n if (listaProdutos[p].departamento.nomeDepto == departamento) {\n somaInventario += listaProdutos[p].qtdEstoque * listaProdutos[p].preco\n }\n }\n somaInventario = somaInventario.toLocaleString('pt-BR', {style: 'currency', currency: 'BRL'});\n return {departamento, somaInventario};\n}", "function fnc_child_cargar_valores_iniciales() {\n\n\tf_create_html_table(\n\t\t\t\t\t\t'grid_lista',\n\t\t\t\t\t\t'',\n\t\t\t\t\t\tfalse, 'data-row_data', '', false, false, false\n\t\t\t\t\t\t);\n\n\tf_load_select_ajax(\n\t\t\t\t\t\tfc_frm_cb, 'lin', 'ccod_lin', 'cdsc_lin',\n\t\t\t\t\t\t'/home/lq_usp_al_ct_lin_list?ic_ccod_emp=' + gc_ccod_emp + '&ic_cest=' + fc_ct_cest_Activo + '&ic_ctipo_lin=B' + '&ic_load_BD=',\n\t\t\t\t\t\tfalse, ''\n\t\t\t\t\t\t);\n\n\tf_load_select_ajax(\n\t\t\t\t\t\tfc_frm_cb, 'tip_prod', 'ccod_tip_prod', 'cdsc_tip_prod',\n\t\t\t\t\t\t'/home/lq_usp_al_ct_tip_prod_list?ic_ccod_emp=' + gc_ccod_emp + '&ic_cest=' + fc_ct_cest_Activo + '&ic_load_BD=',\n\t\t\t\t\t\tfalse, ''\n\t\t\t\t\t\t);\n\n\tf_load_select_ajax(\n\t\t\t\t\t\tfc_frm_cb, 'um', 'ccod_um', 'cdsc_um',\n\t\t\t\t\t\t'/home/lq_usp_al_ct_um_list?ic_ccod_emp=' + gc_ccod_emp + '&ic_ctipo_um=B' + '&ic_cest=' + fc_ct_cest_Activo + '&ic_load_BD=',\n\t\t\t\t\t\tfalse, ''\n\t\t\t\t\t\t);\n\n\tf_load_select_ajax(\n\t\t\t\t\t\tfc_frm_cb, 'mc', 'ccod_mc', 'cdsc_mc',\n\t\t\t\t\t\t'/home/lq_usp_al_ct_mc_list?ic_ccod_emp=' + gc_ccod_emp + '&ic_cest=' + fc_ct_cest_Activo + '&ic_load_BD=',\n\t\t\t\t\t\tfalse, ''\n\t\t\t\t\t\t);\n\n\t// Impuestos\n\tf_load_select_ajax(\n\t\t\t\t\t\tfc_frm_cb, 'imp_igv', 'ccod_imp', 'cdsc_imp', \n\t\t\t\t\t\t'/home/lq_usp_co_ct_imp_list?ic_ccod_emp=' + gc_ccod_emp + '&ic_ccod_imp=' + '&ic_cest=' + fc_ct_cest_Activo + '&ic_load_BD=', \n\t\t\t\t\t\tfalse, ''\n\t\t\t\t\t\t);\n\t\n\tf_load_select_ajax(\n\t\t\t\t\t\tfc_frm_cb, 'imp_isc', 'ccod_imp', 'cdsc_imp', \n\t\t\t\t\t\t'/home/lq_usp_co_ct_imp_list?ic_ccod_emp=' + gc_ccod_emp + '&ic_ccod_imp=' + '&ic_cest=' + fc_ct_cest_Activo + '&ic_load_BD=', \n\t\t\t\t\t\tfalse, ''\n\t\t\t\t\t\t);\n\t\t\t\t\t\t\n\tf_load_select_ajax(\n\t\t\t\t\t\tfc_frm_cb, 'imp_per', 'ccod_imp', 'cdsc_imp', \n\t\t\t\t\t\t'/home/lq_usp_co_ct_imp_list?ic_ccod_emp=' + gc_ccod_emp + '&ic_ccod_imp=' + '&ic_cest=' + fc_ct_cest_Activo + '&ic_load_BD=', \n\t\t\t\t\t\tfalse, ''\n\t\t\t\t\t\t);\n\n\t// Temporal prueba\n\tlet preloaded = [];\n\t/*\n\tlet preloaded = [\n\t\t{id: 1, src: 'https://picsum.photos/500/500?random=1'},\n\t\t{id: 2, src: 'https://picsum.photos/500/500?random=2'},\n\t\t{id: 3, src: 'https://picsum.photos/500/500?random=3'},\n\t\t{id: 4, src: 'https://picsum.photos/500/500?random=4'},\n\t\t{id: 5, src: 'https://picsum.photos/500/500?random=5'},\n\t\t{id: 6, src: 'https://picsum.photos/500/500?random=6'},\n\t];\n\t*/\n\n\t$('.input-images-2').imageUploader({\n\t\tpreloaded: preloaded,\n\t\timagesInputName: 'photos',\n\t\tpreloadedInputName: 'old',\n\t\tmaxSize: 2 * 1024 * 1024,\n\t\tmaxFiles: 20\n\t});\n\n}", "async getDeparments(hospital, email) {\n noOpArray = []\n querySnapshot = await firebase.firestore().collection(\"hospital\").doc(hospital).collection(\"Departments\").get() //doc(department).collection(accountTypeString).get();\n querySnapshot.forEach((doc) => {\n this.getDoctors(doc.id, hospital, email).then((res) => {\n this.setState({ noOp: res })\n })\n })\n return noOpArray;\n }", "static get_one_conulta_p(req, res) {\n const { id_cita } = req.params\n return Consultas\n .findAll({\n where:{id_cita : id_cita },\n include:[{\n model : Recetas\n }]\n })\n .then(Consultas => res.status(200).send(Consultas));\n }", "function getDepartments() {\n Department.getAll()\n .then(function (departments) {\n $scope.departments = departments;\n })\n ['catch'](function (err) {\n Notification.error('Something went wrong with fetching the departments, please refresh the page.')\n });\n }", "function fetchAllDepartments() {\n $.ajax({\n url: '/api/Counselor/AllDepartments',\n contentType: \"application/json\",\n dataType: \"json\",\n async: true,\n type: \"GET\",\n success: function (req) {\n ////////console.log(req);\n config.generalInfo.allDepartments = req;\n\n for (var i = 0; i < config.generalInfo.allDepartments.length; i++) {\n if (config.generalInfo.allDepartments[i] == config.department) {\n continue;\n }\n if (i + 1 < config.generalInfo.allDepartments.length) {\n fetchSummary(config.generalInfo.allDepartments[i]);\n }\n else {\n fetchSummary(config.generalInfo.allDepartments[i], setGENERAL);\n }\n }\n\n\n },\n error: function (xhr) {\n ////////console.log(xhr);\n alert(\"数据获取失败,请检查网络!\");\n }\n });\n}", "function calculTempsPreparationRestant(commandes){\n angular.forEach(commandes,function(commande){\n angular.forEach(commande.detailCommandes,function(detailCommande){\n detailCommande.plat.dureePreparation = getDureeRestant(commande.dateCommande,detailCommande.plat.dureePreparation*1000)*detailCommande.quantite;\n })\n });\n }", "async listaCarrinho(req, res) {\n\n /*\n #swagger.tags = ['Clientes']\n #swagger.description = 'Endpoint para obter a lista dos produtos que se encontram no carrinho do cliente' \n\n #swagger.security = [{\n \"apiKeyAuth\": []\n }]\n\n #swagger.responses[200] = {\n schema: { $ref: \"#/definitions/Carrinho\"},\n description: 'Carrinho encontrado com sucesso'\n }\n #swagger.responses[400] = {\n description: 'Desculpe, tivemos um problema com a requisição'\n }\n */\n\n try {\n const carrinhoDoCliente = await Pedido.findAll({\n where: {\n id_cliente: req.clienteId,\n status: \"carrinho\",\n },\n attributes: {\n exclude: [\"createdAt\", \"updatedAt\"],\n },\n include: {\n model: Produto,\n through: {\n attributes: [],\n },\n attributes: {\n exclude: [\"createdAt\", \"updatedAt\"],\n },\n },\n });\n res.status(200).json(carrinhoDoCliente);\n } catch (erro) {\n res.status(400).json({ message: erro.message });\n }\n }", "function getAvailableDepartments() {\n departmentService.getAllDepartments().then(function(departments) {\n $scope.departments = departments.data;\n })\n }", "function viewBudget() {\n connection.query(\n \"SELECT d.name AS 'Department', SUM(r.salary) AS 'Budget' FROM employee e INNER JOIN role r ON r.id = e.role_id INNER JOIN department d ON d.id = r.department_id GROUP BY Department;\",\n function (err, res) {\n if (err) throw err;\n let tableResults = [];\n for (let i = 0; i < res.length; i++) {\n let empObj = [res[i].Department, res[i].Budget];\n tableResults.push(empObj);\n }\n console.clear();\n console.log(\n \" ------------------------------------ \\n ALL COMPANY DEPARTMENTS & BUDGET UTILIZED \\n ------------------------------------\"\n );\n console.table([\"Department\", \"Budget\"], tableResults);\n actions();\n }\n );\n}", "static list_DiagnosticoTratameinto(req, res){ \n const { id_internacion } = req.params\n diagnostico_tratamientos.findAll({\n where: { id_internacion: id_internacion }\n }).then((data) => {\n res.status(200).json(data);\n }); \n }", "async function obtenerDepartamentos() {\n try {\n let response = await axios.get(URL_departamentos)\n let data = response.data.items\n let result = []\n\n // Opcion por defecto\n result.push(<option value={0} key={0}>Seleccione una Opción</option>)\n \n for (let index in data) { \n result.push(<option value={data[index].codigo} key={data[index].codigo}>{data[index].nombre}</option>)\n }\n setDepartamentos(result)\n \n // Se obtiene el municipio por defecto a partir del departamento por defecto\n recalcularMunicipios()\n\n } catch (error) {\n console.log('Fallo obteniendo los departamentos / municipios' + error)\n } \n }", "function BdConsultaDescGeneralInmuebleComple(pFolio, pTipoConstruccion, pUsuarioOperacion) {\n let etiquetaLOG = `${ ruta } [Usuario: ${ pUsuarioOperacion }] METODO: BdConsultaDescGeneralInmuebleComple `;\n try {\n logger.info(etiquetaLOG);\n const client = new Pool(configD);\n\n let sQuery = `SELECT * FROM fConsultaInmConstrucComplemento('${pFolio}','${pTipoConstruccion}');`;\n\n logger.info(`${ etiquetaLOG } ${sQuery} `);\n\n return new Promise(function(resolve, reject) {\n client.query(sQuery)\n .then(response => {\n client.end();\n logger.info(etiquetaLOG + 'RESULTADO: ' + JSON.stringify(response.rows));\n resolve(response.rows);\n })\n .catch(err => {\n client.end()\n logger.error(etiquetaLOG + 'ERROR: ' + err.message + ' CODIGO_BD(' + err.code + ')');\n reject(err.message + ' CODIGO_BD(' + err.code + ')');\n })\n });\n } catch (err) {\n logger.error(`${ ruta } ERROR: ${ err } `);\n throw (`Se presentó un error en BdConsultaDescGeneralInmuebleComple: ${err}`);\n }\n}", "function viewDepartmentsBudget() {\n // console.log(`Selecting all departments...\\n`);\n connection.query(`SELECT d.department_name ,sum(r.salary) FROM employees e LEFT JOIN roles r on e.role_id = r.id JOIN ` + `departments d on d.id=r.departmentId where d.department_name !='None' GROUP BY d.department_name `, (err, res) => {\n if (err) throw err;\n // console.log(res);\n console.table(res);\n\n askeQuestions();\n });\n}", "async getparentcomitees(offid) {\n let response = await axios.get(\n `${API_URL}/committees/{id}/getparentcomittees?comm_id=${offid}`\n );\n return response.data.parent_Comittees;\n }", "function deplist(){\n return $.ajax({\n url:dir2,\n data:'aksi=cmbdepartemen',\n dataType:'json',\n type:'post'\n });\n }", "function afficher() {\n console.log (\"\\nVoici la liste de tous vos contacts :\");\n Gestionnaire.forEach(function (liste) {\n\n console.log(liste.decrire()); // on utilise la méthode decrire créé dans nos objets\n\n }); // la parenthese fermante correspond à la la parenthese de la méthode forEach()\n\n}", "function jogosDaDesenvolvedora(desenvolvedora){\n let jogos = [];\n\n for (let categoria of jogosPorCategoria) {\n for ( let jogo of categoria.jogos ) {\n if (jogo.desenvolvedora === desenvolvedora){\n jogos.push(jogo.titulo)\n } \n }\n }\n console.log(\"Os jogos da \" + desenvolvedora + \" são: \" + jogos)\n}", "function viewAllDepts() {\n connection.query(\"SELECT d.name AS Department FROM department d ORDER BY d.name;\", function (err, res) {\n if (err) throw err;\n let tableResults = [];\n for (var i = 0; i < res.length; i++) {\n var deptObj = [res[i].Department];\n tableResults.push(deptObj);\n }\n console.clear();\n console.log(\n \" ------------------------------------ \\n ALL COMPANY DEPARTMENTS AT THIS TIME \\n ------------------------------------\"\n );\n console.table([\"Department\"], tableResults);\n actions();\n });\n}", "function fnc_child_cargar_valores_iniciales() {\n\tf_create_html_table(\n\t\t\t\t\t\t'grid_lista',\n\t\t\t\t\t\t'',\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t'data-row_data',\n\t\t\t\t\t\t'', false, false, false\n\t\t\t\t\t\t);\n\tf_load_select_ajax(fc_frm_cb, 'aac', 'ccod_aac', 'cdsc_aac', '/home/lq_usp_ga_aac_ct_list?ic_ccod_emp=' + gc_ccod_emp + '&ic_cest=' + '1' + '&ic_load_BD=', false, '');\n}", "function inicializacaoClasseProduto() {\r\n VETORDEPRODUTOSCLASSEPRODUTO = [];\r\n VETORDEINGREDIENTESCLASSEPRODUTO = [];\r\n VETORDECATEGORIASCLASSEPRODUTO = [];\r\n}", "function depEmpDt() {\n let depEmpArr = depDataTable();\n depEmpArr.forEach(element => {\n let dataArr = Object.values(element);\n dataTable.rows().add(dataArr);\n });\n}", "obtenerTodosCiudad() {\n return axios.get(`${API_URL}/v1/ciudad`);\n }", "async function collectClades(clade, clade_relatives) {\n if (!clade) {\n return null;\n }\n\n const result = { ids: [], lineage: null };\n\n // Try clade by ID first\n const id = parseInt(clade);\n let record;\n if (!isNaN(id)) {\n record = await dfam.ncbiTaxdbNamesModel.findOne({\n where: { tax_id: id, name_class: 'scientific name' },\n attributes: [ 'tax_id', 'name_txt' ],\n include: [\n { model: dfam.ncbiTaxdbNodesModel, attributes: [ \"parent_id\" ] },\n ],\n });\n }\n\n // Then try by scientific name\n if (!record) {\n record = await dfam.ncbiTaxdbNamesModel.findOne({\n where: { name_class: 'scientific name', name_txt: clade },\n attributes: [ 'tax_id', 'name_txt' ],\n include: [\n { model: dfam.ncbiTaxdbNodesModel, attributes: [ \"parent_id\" ] },\n ],\n });\n }\n\n if (!record) {\n return null;\n }\n\n // Primary results: the given ID and its lineage\n result.ids.push(record.tax_id);\n result.lineage = record.name_txt;\n\n // Secondary query: parent IDs\n const recurseParents = async function(parent_id) {\n const parent = await dfam.ncbiTaxdbNodesModel.findOne({\n attributes: [ 'tax_id', 'parent_id' ],\n where: { tax_id: parent_id },\n include: [\n { model: dfam.ncbiTaxdbNamesModel, where: { name_class: 'scientific name' }, attributes: [ 'name_txt' ] },\n ]\n });\n\n if (parent) {\n if (clade_relatives === \"ancestors\" || clade_relatives === \"both\") {\n result.ids.push(parent.tax_id);\n }\n\n let parent_name = \"\";\n if (parent.ncbi_taxdb_names.length) {\n parent_name = parent.ncbi_taxdb_names[0].name_txt;\n }\n result.lineage = parent_name + \";\" + result.lineage;\n\n if (parent_id !== 1) {\n return recurseParents(parent.parent_id);\n }\n }\n };\n\n let recurseParentsPromise;\n if (record.tax_id !== 1) {\n recurseParentsPromise = recurseParents(record.ncbi_taxdb_node.parent_id);\n } else {\n recurseParentsPromise = Promise.resolve();\n }\n\n await recurseParentsPromise;\n return result;\n}", "function getDepartments(data) {\n if (data.jobs.job[0]) {\n return data.jobs.job[0].company.company_departments.department;\n }\n}", "function getdepsservicos(req, res, next) {\n depservico.find({}).lean().exec(function (err, docs) {\n req.depsservicos = docs\n next()\n })\n}", "async function obtenerTodasCIudades() {\n var queryString = '';\n\n\n queryString = queryString + ' SELECT cd.id, cd.nombre as ciudad, ps.nombre as pais';\n queryString = queryString + ' from ciudades cd join paises ps on (cd.pais_id=ps.id) ';\n\n \n\n let ciudad = await sequelize.query(queryString,\n { type: sequelize.QueryTypes.SELECT})\n return ciudad;\n }", "function obtenerTotCie(filters) {\n $scope.promiseCie = partPendientesViService\n .obtenerTotCie(filters)\n .then( res => {\n $scope.totCieGrid.data = res;\n $scope.totCieGrid.count = res.length;\n //$scope.totCieGrid.cantidadTotal = 0;\n //$scope.totCieGrid.importeTotal = 0;\n //res.forEach(function(obj){$scope.totCieGrid.cantidadTotal+=obj.cant;$scope.totCieGrid.importeTotal+=obj.importe; });\n $(\".md-head md-checkbox\").hide();\n })\n .catch( err => Toast.showError(err,'Error'));\n }", "function courierList(query) {\n return api\n .get('courier', { params: { q: query } })\n .then(response => {\n const options = response.data.courierList.map(courier => ({\n value: courier.id,\n label: courier.name,\n }));\n return options;\n })\n .catch(error => {\n console.tron.log(error);\n toast.error(\n 'Listagem de entregadores não foi carregada. Verifique a sua conexão com o Banco de dados.'\n );\n });\n }", "function get_coberturas_unidad() {\n lista_coberturas = [];\n var unidad = $(\"#txt_unidad\").val();\n var demanda = $(\"#txt_demanda\").val();\n var capas = $.ajax({\n url: \"/visor/CobVeg/get_coberturas_unidad/\" + unidad + \"/\" + demanda,\n type: \"GET\",\n dataType: \"json\",\n async: false}).responseText;\n capas = JSON.parse(capas)\n for (var i = 0; i < capas.length; i++) {\n var item = {id: i + 1, nombre: capas[i].cap_nombre, periodo: capas[i].cap_precipitacion, layer: capas[i].cap_layer, agregado: false, valor:capas[i].cap_valor, demanda:capas[i].cap_demanda}\n lista_coberturas.push(item);\n }\n}", "function _DependenciasEstilo(estilo_personagem) {\n var arma_primaria = ArmaPersonagem(estilo_personagem.arma_primaria.nome);\n if (arma_primaria == null) {\n estilo_personagem.arma_primaria.nome = 'desarmado';\n arma_primaria = ArmaPersonagem(estilo_personagem.arma_primaria.nome);\n }\n var arma_secundaria = ArmaPersonagem(estilo_personagem.arma_secundaria.nome);\n if (arma_secundaria == null) {\n estilo_personagem.arma_secundaria.nome = 'desarmado';\n arma_secundaria = ArmaPersonagem(estilo_personagem.arma_secundaria.nome);\n }\n\n if (estilo_personagem.nome == 'arma_dupla' &&\n (arma_primaria == null || !arma_primaria.arma_tabela.arma_dupla)) {\n Mensagem(Traduz('Arma') + ' \"' + Traduz(estilo_personagem.arma_primaria.nome) + '\" ' + Traduz('não é dupla.'));\n estilo_personagem.nome = 'uma_arma';\n }\n\n if (estilo_personagem.nome == 'rajada' && PersonagemNivelClasse('monge') == 0) {\n Mensagem('Estilo \"rajada de golpes\" requer nível de monge.');\n estilo_personagem.nome = 'uma_arma';\n }\n\n if (estilo_personagem.nome == 'tiro_rapido' &&\n (!PersonagemPossuiTalento('tiro_rapido') || (!('distancia' in arma_primaria.arma_tabela.categorias) && !('arremesso' in arma_primaria.arma_tabela.categorias)))) {\n Mensagem('Estilo \"tiro_rapido\" requer talento tiro rapido e arma de distância.');\n estilo_personagem.nome = 'uma_arma';\n }\n\n if ('cac_duas_maos' in arma_primaria.arma_tabela.categorias &&\n estilo_personagem.nome != 'uma_arma') {\n Mensagem(Traduz('Arma') + ' \"' + Traduz(estilo_personagem.arma_primaria.nome) + '\" ' + Traduz('requer duas mãos.'));\n estilo_personagem.nome = 'uma_arma';\n }\n\n // Se o estilo eh duplo, forca segunda arma ser igual a primeira.\n if (estilo_personagem.nome == 'arma_dupla') {\n estilo_personagem.arma_secundaria.nome = estilo_personagem.arma_primaria.nome;\n arma_secundaria = ArmaPersonagem(estilo_personagem.arma_secundaria.nome);\n }\n\n // Atualiza cada categoria da arma no estilo.\n var secundaria_leve = false;\n for (var categoria in arma_secundaria.arma_tabela.categorias) {\n secundaria_leve =\n (estilo_personagem.nome == 'duas_armas' && categoria.indexOf('leve') != -1) ||\n estilo_personagem.nome == 'arma_dupla';\n }\n\n for (var categoria in arma_primaria.arma_tabela.categorias) {\n estilo_personagem.arma_primaria.bonus_por_categoria[categoria] =\n _DependenciasBonusPorCategoria(\n categoria, arma_primaria, estilo_personagem, true, secundaria_leve);\n }\n if (estilo_personagem.nome == 'duas_armas' || estilo_personagem.nome == 'arma_dupla') {\n for (var categoria in arma_secundaria.arma_tabela.categorias) {\n estilo_personagem.arma_secundaria.bonus_por_categoria[categoria] =\n _DependenciasBonusPorCategoria(\n categoria, arma_secundaria, estilo_personagem, false, secundaria_leve);\n }\n }\n}", "readAllDepartments() {\r\n return this.connection.query(\r\n \"SELECT department.id, department.name, SUM(role.salary) AS utilized_budget FROM employee LEFT JOIN role on employee.role_id = role.id LEFT JOIN department on role.department_id = department.id GROUP BY department.id, department.name;\"\r\n );\r\n }", "function iniciarListaBusqueda(){\n var ciclos = selectDatoErasmu();\n for(var aux = 0, help = 0 ; aux < erasmu.length ; aux++){\n if(ciclos.indexOf(erasmu[aux].ciclo) != -1){\n crearListErasmu(erasmu[aux]);\n }\n }\n}", "function getBudgetData() {\n budgetFactory.getBudget().then(function(response) {\n var budget = response;\n self.startingMonthID = budget.budget_start_month;\n self.startingYear = budget.budget_start_year;\n setStartingMonth();\n setYears();\n });\n } //end getBudgetData", "function getComplaintDisputeFn() {\n let obj = {\n page : vm.complaintPage,\n limit : 10,\n userId: vm.userId\n };\n CommonCrudService\n .paginate(\"job-complaint-dispute\", obj)\n .then(\n (res) => {\n if (res.data) {\n if (res.data.list && res.data.list.length) {\n if (obj.page === 1) {\n vm.complaintDisputeList = angular.copy(res.data.list);\n _.each(vm.complaintDisputeList, function (stObj) {\n let statusObj = _.findWhere(JobComplaintDisputeStatus, {id: stObj.status});\n if (statusObj) {\n stObj['displayStatus'] = statusObj;\n }\n });\n vm.disabled = false;\n }\n else {\n vm.complaintDisputeList = vm.complaintDisputeList.concat(res.data.list);\n _.each(vm.complaintDisputeList, function (stObj) {\n if (stObj && stObj.status && !stObj.displayStatus) {\n let statusObj = _.findWhere(JobComplaintDisputeStatus, {id: stObj.status});\n if (statusObj) {\n stObj['displayStatus'] = statusObj;\n }\n }\n\n });\n vm.disabled = false;\n }\n }\n else {\n vm.disabled = true;\n }\n\n\n }\n else {\n vm.complaintDisputeList = [];\n vm.disabled = true;\n }\n\n },\n (err) => {\n vm.complaintDisputeList = [];\n vm.disabled = true;\n }\n );\n }", "function cprnTcdtToIdb() {\r\n\tvar tRec = [];\r\n\tcsdnClearWorkDtlArys();\r\n//\tvDynm.ob.csrv.accum = {total_invc: 0, total_disc: 0};\r\n\r\n\tvWork.al.tcdt.map( function (tD) {\r\n\t\tvar tI = vWork.al.tchd.findIndex(function (e) { if (e.dept_no == tD.dept_no && e.rpt_sect == tD.rpt_sect) {return true}; });\r\n\t\tif (tI < 0) {\r\n\t\t\tconsole.log('CTDT rpt_sect not in TCHD');\r\n\t\t} else {\r\n\t\t\tvar tH = vWork.al.tchd[tI];\r\n\t\t\ttD.tkt_no = tH.tkt_no;\r\n\r\n\t\t\tif (tH.checked) {\r\n\t\t\t\tswitch (tD.trans_id) {\r\n\t\t\t\t\tcase 88:\r\n\t\t\t\t\t\ttRec = new tcdt2ctrt(tD);\r\n\t\t\t\t\t\tvWork.ar.bldCtrt.push(tRec);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tcase 89:\r\n\t\t\t\t\t\ttRec = new tcdt2ctrp(tD);\r\n\t\t\t\t\t\tvWork.ar.bldCtrp.push(tRec);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\tdefault:\r\n\t\t\t\t\t\ttRec = new tcdt2ctdt(tD);\r\n\t\t\t\t\t\tvWork.ar.bldCtdt.push(tRec);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\tif (vWork.ar.bldCtdt.length > 0) promAddAryToIdb(vWork.db.upld.handle, 'ctdt', vWork.ar.bldCtdt);\r\n\tif (vWork.ar.bldCtrp.length > 0) promAddAryToIdb(vWork.db.upld.handle, 'ctrp', vWork.ar.bldCtrp);\r\n\tif (vWork.ar.bldCtrt.length > 0) promAddAryToIdb(vWork.db.upld.handle, 'ctrt', vWork.ar.bldCtrt);\r\n//\tnextSeq();\r\n}", "function _DependenciasItemAtaque(chave_item, item_tabela) {\n for (var chave_bonus in item_tabela.propriedades.ataque) {\n var valor = item_tabela.propriedades.ataque[chave_bonus];\n gPersonagem.outros_bonus_ataque.Adiciona(chave_bonus, chave_item, valor);\n }\n}", "function gather_cpan_dependents(dist) {\n requestCrossDomain( 'http://deps.cpantesters.org/depended-on-by.pl?dist=' + escape(dist), function(resp) {\n num = '0';\n if ( resp ) {\n num = resp.split('<li>').length-1;\n }\n dependent_counts[dist] = num;\n add_dependents_to_page(dist);\n num_dists_fetched += 1;\n if ( num_dists_fetched == num_dists ) {\n show_top_dists();\n }\n });\n}", "function acu_fondosolidaridadredistribucioningresos_cargardatostemporal(){\n\t\n\t\tif(acu_fsri_panel_datanuevo)\n\t\t{\n\t\t\tacu_fsri_panel_dataviejo=acu_fsri_panel_datanuevo;\n\t\t}\n\t\tacu_fsri_panel_datanuevo=new Array();\n\t\tacu_fsri_panel_datanuevo['acu_fsi_sol_tranferencia_recursos'] = Ext.getCmp('acu_fsi_sol_tranferencia_recursos').getValue().getGroupValue();\n\t\t\n\t\tacu_fsri_panel_datanuevo['acu_fsi_recibo_recursos'] =Ext.getCmp('acu_fsi_recibo_recursos').getValue().getGroupValue();\n\t\tacu_fsri_panel_datanuevo['acu_fsi_recibo_recursos_valor_recib'] = Ext.getCmp('acu_fsi_recibo_recursos_valor_recib').getValue();\n\t\tacu_fsri_panel_datanuevo['acu_fsi_aporte_recursos'] = Ext.getCmp('acu_fsi_aporte_recursos').getValue().getGroupValue();\n\t\tacu_fsri_panel_datanuevo['acu_fsi_aporte_recursos_valor_apor'] = Ext.getCmp('acu_fsi_aporte_recursos_valor_apor').getValue();\n\t\tacu_fsri_panel_datanuevo['acu_vas_suscripcion_contrato'] = Ext.getCmp('acu_vas_suscripcion_contrato').getValue().getGroupValue();\n\t\t\n\t\t\n\t}", "function cargarCgg_res_beneficiarioCtrls(){\n if(inRecordCgg_res_beneficiario!== null){\n if(inRecordCgg_res_beneficiario.get('CRPER_CODIGO'))\n {\n txtCrben_codigo.setValue(inRecordCgg_res_beneficiario.get('CRPER_CODIGO'));\n txtCrben_nombres.setValue(inRecordCgg_res_beneficiario.get('CRPER_NOMBRES'));\n txtCrben_apellido_paterno.setValue(inRecordCgg_res_beneficiario.get('CRPER_APELLIDO_PATERNO'));\n txtCrben_apellido_materno.setValue(inRecordCgg_res_beneficiario.get('CRPER_APELLIDO_MATERNO'))\n txtCrben_num_doc_identific.setValue(inRecordCgg_res_beneficiario.get('CRPER_NUM_DOC_IDENTIFIC'));\n cbxCrben_genero.setValue(inRecordCgg_res_beneficiario.get('CRPER_GENERO'));\n cbxCrdid_codigo.setValue(inRecordCgg_res_beneficiario.get('CRDID_CODIGO'));\n cbxCrecv_codigo.setValue(inRecordCgg_res_beneficiario.get('CRECV_CODIGO'));\n cbxCpais_nombre_nacimiento.setValue(inRecordCgg_res_beneficiario.get('CPAIS_CODIGO'));\n var tmpFecha = null;\n if(inRecordCgg_res_beneficiario.get('CRPER_FECHA_NACIMIENTO')== null || inRecordCgg_res_beneficiario.get('CRPER_FECHA_NACIMIENTO').trim().length ==0){\n tmpFecha = new Date();\n }else{\n tmpFecha = Date.parse(inRecordCgg_res_beneficiario.get('CRPER_FECHA_NACIMIENTO'));\n }\n dtCrper_fecha_nacimiento.setValue(tmpFecha);\n }\n if(inRecordCgg_res_beneficiario.get('CRPER_REQUISITOS_JSON')){\n gsCgg_res_solicitud_requisito.loadData(Ext.util.JSON.decode(inRecordCgg_res_beneficiario.get('CRPER_REQUISITOS_JSON')),true);\n }else{\n gsCgg_res_solicitud_requisito.reload({\n params:{\n inCrtra_codigo:null, \n inCrtst_codigo:INRECORD_TIPO_SOLICITUD.get('CRTST_CODIGO'),\n format:TypeFormat.JSON\n }\n });\n }\n }\n }", "function iniciar(){\n for(var i = 1; i <= 31; i ++){\n var dezena = diaSorteService.montaDezena(i);\n vm.dezenas.push(dezena);\n }\n }", "function thnlist(dep){\n return $.ajax({\n url:dir3,\n data:'aksi=cmbproses&departemen='+dep,\n dataType:'json',\n type:'post'\n });\n }", "function professorsRelation(parentDiv, data ,departmentColor, loadingObject){\n\t\n\t\n\t\n\t\n}", "function loadDepsList(tx) \n{\t\n\tsql = \"SELECT department, COUNT(*) AS count FROM members GROUP BY department\";\n tx.executeSql\n (\n \tsql, \n \t\tundefined, \n\t \tfunction (tx, result)\n\t \t{\n\t \t\t$(\"#depsList\").empty();\n\t \t\tfor (var i = 0; i < result.rows.length; i++) \n\t {\n\t \t\t\t$(\"#depsList\").append(\"<li><a href=\\\"dep_details.html?dep=\" + result.rows.item(i).department.replace(/\\s+/g,\"_\") + \"\\\">\"\n\t\t\t\t\t\t\t\t\t\t+ \"<h4>\" + result.rows.item(i).department + \"</h4>\"\n \t\t\t\t\t\t\t+ \"<p>\" + result.rows.item(i).count + \" personas</p></a></li>\");\n\t\t\t}\n\t\t\t$(\"#depsList\").listview().listview(\"refresh\"); \n\t }, \n\t dbTxError);\n}", "static GetInfoReports(cadenaDeConexion, fI, fF, idSucursal, result) {\n var sucursal = '';\n if (idSucursal != 1) {\n sucursal = `AND info_ingresos.codSucursal=` + idSucursal;\n }\n console.log(\"sucursal \", sucursal);\n sqlNegocio(\n cadenaDeConexion,\n `SELECT info_grupopartidas.nombreGrupo,info_partidas.idPartida,info_partidas.nombrePartida,codMes,SUM(sumPrecioVenta) as PrecioVenta, (SUM(sumPrecioVenta) - SUM(aCuenta)) as pagar_cobrar,SUM(costVenta) as cost_venta\n FROM info_ingresos \n left join info_partidas\n on info_ingresos.idPartida=info_partidas.idPartida\n left join info_fuente \n on info_ingresos.codFuente=info_fuente.codFuente\n left join info_grupopartidas\n on info_partidas.idGrupo=info_grupopartidas.idGrupoPartida\n where info_ingresos.idPartida!=1 ` + sucursal + ` and tipoComprobante!=2 and tipoComprobante!=3 \n \t\t\t\t\t\t\t\t\t and fecEmision BETWEEN '`+ fI + `' AND '` + fF + `' AND estado=1\n group by nombreGrupo,idPartida,codMes\n order by idGrupoPartida ASC,idPartida ASC`,\n [],\n function (err, res) {\n if (err) {\n console.log(\"error: \", err);\n result(null, err);\n }\n else {\n result(null, res);\n }\n });\n }", "function _DependenciasItemPericias(chave_item, item_tabela) {\n if ('todas' in item_tabela.propriedades.pericias) {\n for (var chave_pericia in tabelas_pericias) {\n for (var chave_bonus in item_tabela.propriedades.pericias['todas']) {\n gPersonagem.pericias.lista[chave_pericia].bonus.Adiciona(\n chave_bonus, chave_item, item_tabela.propriedades.pericias['todas'][chave_bonus]);\n }\n }\n } else {\n for (var chave_pericia in item_tabela.propriedades.pericias) {\n for (var chave_bonus in item_tabela.propriedades.pericias[chave_pericia]) {\n gPersonagem.pericias.lista[chave_pericia].bonus.Adiciona(\n chave_bonus, chave_item, item_tabela.propriedades.pericias[chave_pericia][chave_bonus]);\n }\n }\n }\n}", "static GetUtilidad(cadenaDeConexion, fI, fF, idSucursal, result) {\n\n var sucursal = '';\n if (idSucursal != 1) {\n sucursal = `AND info_ingresos.codSucursal=` + idSucursal;\n }\n console.log(\"sucursal \", sucursal);\n sqlNegocio(\n cadenaDeConexion,\n ` SELECT base.codMes, SUM(base.precioVenta) as totalVenta from (SELECT info_grupopartidas.nombreGrupo,info_ingresos.codMes,\n\n CASE info_grupopartidas.nombreGrupo\n WHEN 'EGRESOS' THEN -(SUM(info_ingresos.sumPrecioVenta))\n WHEN 'INGRESOS' THEN SUM(info_ingresos.sumPrecioVenta)\n END as precioVenta\n \n \n from info_ingresos LEFT JOIN\n info_partidas on info_ingresos.idPartida = info_partidas.idPartida LEFT JOIN \n info_grupopartidas on info_grupopartidas.idGrupoPartida = info_partidas.idGrupo \n where info_ingresos.fecEmision BETWEEN '`+ fI + `' AND '` + fF + `' AND info_ingresos.estado=1 ` + sucursal + ` AND ( info_grupopartidas.nombreGrupo = 'EGRESOS' or info_grupopartidas.nombreGrupo = 'INGRESOS')\n group by info_grupopartidas.nombreGrupo,info_ingresos.codMes)as base group by base.codMes\n order by base.codMes ASC`,\n [],\n function (err, res) {\n if (err) {\n console.log(\"error: \", err);\n result(null, err);\n }\n else {\n result(null, res);\n }\n });\n }", "function getAboveDepartments(data) {\n\n _.forEach(data, (value, index) => { \n\n departmentIds.push(value._id.toString());\n getAboveDepartments(_.filter(result.departments, { _id: DatabaseManager.toObjectId(value.parentId) }));\n\n });\n\n return departmentIds;\n }", "function viewAllDepartments(conn, start) {\n conn.query(`SELECT * FROM department ORDER BY name;`, function(err, results) {\n if (err) throw err;\n console.table(results);\n start();\n });\n }", "function _DependenciasProficienciaArmas() {\n var todas_simples = false;\n var todas_comuns = false;\n gPersonagem.proficiencia_armas = {};\n for (var i = 0; i < gPersonagem.classes.length; ++i) {\n var chave_classe = gPersonagem.classes[i].classe;\n var tabela_classe = tabelas_classes[chave_classe];\n var armas_classe = tabela_classe.proficiencia_armas || [];\n for (var j = 0; j < armas_classe.length; ++j) {\n gPersonagem.proficiencia_armas[armas_classe[j]] = true;\n if (armas_classe[j] == 'arco_curto' || armas_classe[j] == 'arco_longo') {\n for (var arma_tabela in tabelas_armas_comuns) {\n if (arma_tabela.indexOf(armas_classe[j]) == 0) {\n gPersonagem.proficiencia_armas[arma_tabela] = true;\n } \n }\n }\n }\n // TODO usar a nova funcao de PersonagemProficienteTipoArma.\n var talentos_classe = tabela_classe.talentos || [];\n for (var j = 0; j < talentos_classe.length; ++j) {\n if (talentos_classe[j] == 'usar_armas_simples') {\n todas_simples = true;\n } else if (talentos_classe[j] == 'usar_armas_comuns') {\n todas_comuns = true;\n }\n }\n }\n gPersonagem.proficiencia_armas['desarmado'] = true;\n gPersonagem.proficiencia_armas['manopla'] = true;\n if (todas_simples) {\n for (var arma in tabelas_armas_simples) {\n gPersonagem.proficiencia_armas[arma] = true;\n }\n }\n if (todas_comuns) {\n for (var arma in tabelas_armas_comuns) {\n gPersonagem.proficiencia_armas[arma] = true;\n }\n // Familiaridade.\n for (var arma in tabelas_raca[gPersonagem.raca].familiaridade_arma) {\n gPersonagem.proficiencia_armas[arma] = true;\n }\n }\n // Raciais.\n var armas_raca = tabelas_raca[gPersonagem.raca].proficiencia_armas;\n for (var i = 0; armas_raca != null && i < armas_raca.length; ++i) {\n gPersonagem.proficiencia_armas[armas_raca[i]] = true;\n }\n\n // Talentos. Preciso obter o nome da chave na tabela de armas.\n for (var chave_classe in gPersonagem.talentos) {\n var lista_classe = gPersonagem.talentos[chave_classe];\n for (var i = 0; i < lista_classe.length; ++i) {\n var talento = lista_classe[i];\n if ((talento.chave == 'usar_arma_comum' ||\n talento.chave == 'usar_arma_exotica') &&\n (talento.complemento != null) &&\n talento.complemento.length > 0) {\n var chave_arma = tabelas_armas_invertida[talento.complemento];\n // TODO remover essa verificacao quando o input dos talentos estiver\n // terminado.\n if (chave_arma == null) {\n Mensagem(Traduz('Arma') + ' \"' + talento.complemento + '\" ' + Traduz('inválida para talento') + ' \"' +\n Traduz(tabelas_talentos[talento.chave].nome) + '\"');\n continue;\n }\n var arma_tabela = tabelas_armas[chave_arma];\n if (arma_tabela.talento_relacionado != talento.chave) {\n // verifica familiaridade.\n var familiar = false;\n if (arma_tabela.talento_relacionado == 'usar_arma_exotica' &&\n tabelas_raca[gPersonagem.raca].familiaridade_arma &&\n tabelas_raca[gPersonagem.raca].familiaridade_arma[chave_arma] &&\n talento.chave == 'usar_arma_comum') {\n familiar = true;\n }\n if (!familiar) {\n Mensagem(Traduz('Arma') + ' \"' + talento.complemento + '\" ' + Traduz('inválida para talento') + ' \"' +\n Traduz(tabelas_talentos[talento.chave].nome) + '\"');\n continue;\n }\n }\n gPersonagem.proficiencia_armas[chave_arma] = true;\n }\n }\n }\n}", "colocarNaves(ejercito) {\n ejercito.listadoNaves.forEach(element => {\n this.poscionNaves.push(element);\n });\n }", "function carregaOpcoesUnidadeSuporte(){\n\tcarregaTipoGerencia();\t\n\tcarregaTecnicos();\n\tcarregaUnidadesSolicitantes();\t\n\tcarregaEdicaoTipos();//no arquivo tipoSubtipo.js\n\tcarregaComboTipo();//no arquivo tipoSubtipo.js\n}", "function _getDependencies (id, deps, circularDeps, i, j, d, subDeps, sd) {\n\n\t\tdeps = _dependencies[id] || [];\n\t\tcircularDeps = [];\n\n\t\tfor (i = 0; i < deps.length; i ++) {\n\t\t\td = deps[i];\n\t\t\tsubDeps = _dependencies[d];\n\t\t\tif (subDeps) {\n\t\t\t\tfor (j = 0; j < subDeps.length; j ++) {\n\t\t\t\t\tsd = subDeps[j];\n\t\t\t\t\tif (sd != id && deps.indexOf(sd) < 0) {\n\t\t\t\t\t\tdeps.push(sd);\n\t\t\t\t\t}\n\t\t\t\t\telse if(sd === id){\n\t\t\t\t\t\tcircularDeps.push(d);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn [deps, circularDeps];\n\t}", "function actualiserCommandes() {\n if (window.fetch) {\n\n var myInit = {\n method: 'GET',\n //headers: myHeaders,\n mode: 'cors',\n cache: 'default'\n };\n\n var datedebut = document.getElementById('start').value;\n var datefin = document.getElementById('end').value;\n\n var url = '/gestionTAIDI/api/chp_api4/' +formatted_date1+ '/' + formatted_date2;\n\n fetch(url, myInit)\n /*.then(function(){\n console.log(\"Chargement...\")\n })*/\n .then(function (response) {\n return response.json();\n // console.log(response.json())\n })\n .then(function (json) {\n\n json.forEach(([{designation}, occurence]) => {\n designations.push(designation+\" Quantité :\"+ occurence);\n occurences.push(occurence)\n })\n console.log(designations+\"\\n\\n\"+occurences);\n\n //if (current !== designations.length) {\n // current = designations.length\n var config = {\n type: 'pie',\n data: {\n datasets: [{\n data: [...occurences],\n backgroundColor: [\n window.chartColors.red,\n window.chartColors.orange,\n window.chartColors.yellow,\n window.chartColors.green,\n window.chartColors.blue,\n ],\n label: 'Dataset 2'\n }],\n labels: [...designations]\n },\n options: {\n responsive: true,\n legend: {\n position: 'right',\n labels:{\n fontSize: 16,\n\n }\n },\n title:{\n display:true,\n text:'ytergplkjhgr',\n }\n }\n };\n window.myPie = new Chart(ctx, config);\n // }\n\n });\n } else {\n // Faire quelque chose avec XMLHttpRequest?\n console.log(\"error!!!\");\n }\n }", "function buildDomiciliosReport(movimientos, query, req, res){\n let master = {}\n let parent = {}\n movimientos.forEach(asis => {\n if(asis.casoIndice){\n populateDomiciliosReport(master, asis, parent)\n }else {\n populateParent(parent, asis)\n\n }\n\n })\n exportDomiciliosReport(master, req, res);\n\n}", "function amountcommi()\n{\n for (var i=0; i<rentals.length;i++)\n {\n //Drivy take a 30% commission on the rental price to cover their costs.\n var commission= rentals[i].price *0.3;\n\n //insurance: half of commission\n rentals[i].commission.insurance = commission *0.5;\n\n //roadside assistance 1€ per day\n rentals[i].commission.assistance = getRentDays(rentals[i].pickupDate,rentals[i].returnDate) +1;\n\n //drivy takes the rest\n rentals[i].commission.drivy= commission - (rentals[i].commission.insurance + rentals[i].commission.assistance);\n }\n\n}", "function livrosAugustoCury() {\n let livros = [];\n for (let categoria of livrosPorCategoria) {\n for (let livro of categoria.livros) {\n if (livro.autor === 'Augusto Cury') {\n livros.push(livro.titulo);\n }\n }\n }\n console.log('Livros do Augusto Cury: ' , livros);\n}", "function calculCommission () {\n for (var i = 0; i < deliveries.length; i++) {\n var commission = deliveries[i].price * 0.3;\n deliveries[i].commission.insurance = commission / 2;\n deliveries[i].commission.treasury = Math.floor(deliveries[i].distance/500) + 1\n deliveries[i].commission.convargo = commission - deliveries[i].commission.insurance - deliveries[i].commission.treasury\n }\n}", "function loadAll() {\n var cidades = eurecaECBrasil.filtrarCidadeTextoService();\n return cidades.split(/, +/g).map( function (cidade) {\n return {\n value: cidade.toLowerCase(),\n display: cidade\n }; \n });\n }", "function obtenerArbolDepartamentos(s, d, e) {\n if(s) {\n $('form[name=frmGestionPerfil] .arbolDepartamento').append(procesarArbolDep(d));\n $('form[name=frmGestionPerfil] .arbolDepartamento').genTreed(); // Añade clases y imagenes a la lista html para hacerla interactiva\n\n $('form[name=frmGestionPerfil] .arbolDepartamento.tree li').dblclick(function (e) {\n let me = $(this);\n $('form[name=frmGestionPerfil] .tree li').each(function () {\n $(this).removeClass('filaSeleccionada');\n });\n me.addClass('filaSeleccionada');\n\n Moduls.app.child.templateParamas.template.Forms.frmGestionPerfil.set({\n p_objtiv: me.attr('id')\n });\n\n $('form[name=frmGestionPerfil] [name=nomdep]').val(me.attr('name'));\n $('form[name=frmGestionPerfil] [name=nomdep]').change();\n $('form[name=frmGestionPerfil] .arbolDepartamento').addClass('dn');\n return false;\n });\n } else {\n validaErroresCbk(d, true);\n }\n}", "obtenerTodosFincas() {\n return axios.get(`${API_URL}/v1/reportefincaproductor/`);\n }", "function cargaCombosClientes() {\n\tvar idioma = get(FORMULARIO+'.idioma').toString();\n\tvar pais = get(FORMULARIO+'.pais').toString();\n\t\n\tvar tipoCliente = get(FORMULARIO+'.hTipoCliente').toString();\n\tvar subtipoCliente = get(FORMULARIO+'.hSubtipoCliente').toString();\n\tvar tipoClasificacion = get(FORMULARIO+'.hTipoClasificacion').toString();\n\tvar clasificacion = get(FORMULARIO+'.hClasificacion').toString();\n\t\n\t// Se carga el combo de subtipos de cliente\n\tif (tipoCliente != '') {\n\t\tvar parametros = new Array(5);\n \tparametros[0] = FORMULARIO+'.ValorSubtipoCliente'; \n \tparametros[1] = \"CMNObtieneSubtiposCliente\";\n \tparametros[2] = DTODruidaBusqueda;\n \tparametros[3] = \"[['oidTipoCliente', \" + tipoCliente + \"], ['oidIdioma',\" + idioma + \"], ['oidPais',\" + pais + \"]]\";\n \tparametros[4] = \"seleccionaSubtipoCliente(datos)\";\n \tparametrosRecargaCombos[parametrosRecargaCombos.length] = parametros;\n\t\t/*gestionaCombo(FORMULARIO+'.ValorSubtipoCliente', 'CMNObtieneSubtiposCliente', DTODruidaBusqueda,\n\t\t\t[['oidTipoCliente', tipoCliente], ['oidIdioma',idioma], ['oidPais',pais]],\n\t\t\t'seleccionaSubtipoCliente(datos)',subtipoCliente); */\n\t}\n\t\n\t// Se carga el combo de tipos de clasificación\n\tif (subtipoCliente != '') {\n\t\tvar parametros = new Array(5);\n \tparametros[0] = FORMULARIO+'.ValorTipoClasificacion'; \n \tparametros[1] = \"CMNObtieneTiposClasificacion\";\n \tparametros[2] = DTODruidaBusqueda;\n \tparametros[3] = \"[['oidSubtipoCliente', \" + subtipoCliente + \"], ['oidIdioma',\" + idioma + \"], ['oidPais',\" + pais + \"]]\";\n \tparametros[4] = \"seleccionaTipoClasificacion(datos)\";\n \tparametrosRecargaCombos[parametrosRecargaCombos.length] = parametros;\n\t\t/*gestionaCombo(FORMULARIO+'.ValorTipoClasificacion', 'CMNObtieneTiposClasificacion', DTODruidaBusqueda,\n\t\t\t[['oidSubtipoCliente', subtipoCliente], ['oidIdioma',idioma], ['oidPais',pais]],\n\t\t\t'seleccionaTipoClasificacion(datos)',tipoClasificacion);*/\n\t}\n\t\n\t// Se recarga el combo de clasificaciones\n\tif (tipoClasificacion != '' && subtipoCliente != '') {\n\t\tvar parametros = new Array(5);\n \tparametros[0] = FORMULARIO+'.ValorClasificacion'; \n \tparametros[1] = \"CMNObtieneClasificaciones\";\n \tparametros[2] = DTODruidaBusqueda;\n \tparametros[3] = \"[['oidTipoClasificacion', \" + tipoClasificacion + \"], ['oidSubtipoCliente', \" + subtipoCliente + \"], ['oidIdioma',\" + idioma + \"], ['oidPais',\" + pais + \"]]\";\n \tparametros[4] = \"seleccionaClasificacion(datos)\";\n \tparametrosRecargaCombos[parametrosRecargaCombos.length] = parametros;\n\t\t/*recargaCombo(FORMULARIO+'.ValorClasificacion', 'CMNObtieneClasificaciones', DTODruidaBusqueda, \n\t\t\t[['oidTipoClasificacion', tipoClasificacion], ['oidSubtipoCliente', subtipoCliente], \n\t\t\t['oidIdioma',idioma], ['oidPais',pais]],'seleccionaClasificacion(datos)',clasificacion);*/\n\t}\n}", "function getallDeptByOfficeData(ofcid) {\n\t\t\t\n\t\t\t\tif(ofcid==\"\")\n\t\t\t\t{\t\t\t\t\n\t\t\t\t$('#deptlstSendTo').empty();\n\t\t\t\t $(\"#deptlstSendTo_div\").hide();\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tshowAjaxLoader();\n\t\t\t\t$.ajax({\n\t\t\t\t\t\turl : 'checkofficetype.htm',\n\t\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t\tdata : {\n\t\t\t\t\t\t\tofcid : ofcid,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsuccess : function(response) \n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t/*var html=\"<option value=''>---Select---</option>\"*/\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(response!=\"\")\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t$.each(response, function(index, value) {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif(value.ofctype==\"HO\")\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t$(\"#deptlstSendTo_div\").show();\n\t\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\t $(\"#deptlstSendTo_div\").hide();\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t getallEmpBySendTo(\"DO\");\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t });\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\thideAjaxLoader();\n\t\t\t\t\t\t\t \n\t\t\t\t\t\t},\n\t\t\t\t\t\terror:function(error)\n\t\t\t\t\t {\n\t\t\t\t\t \t\thideAjaxLoader();\n\t\t\t\t\t }\n\t\t\t\t});\n\t\t\t\n\t\t\t};\n\t\t\t}", "function obtieneDatosCbo(campo, tipo) { \n\t\t\t\tvar l=combo_get(campo,'L');\n\t\t\t\tvar ar=new Array();\n\t\t\t\tfor(var i=0;i<l;i++) {\n\t\t\t\t\tar[i]=combo_get(campo,tipo,i);\n\t\t\t\t}\n\t\t\t\treturn ar;\n\t\t\t}", "function dataDepartmentChart5(myObj, parent, thang) {\n let data = myObj.filter(e => {\n return e.parent == parent && e.thang == thang && (e.tuy_chon == 'viec-hoan-thanh-khong-dung-han-co-due-date-trong-thang' || e.tuy_chon == 'viec-cham-chua-hoan-thanh-co-due-date-trong-thang' || e.tuy_chon == 'viec-co-due-date-trong-thang')\n })\n data = groupBy(data, 'ten_don_vi');\n let rs = [];\n Object.values(data).forEach(e => {\n let ty_le = Math.round((findChiSoByTuyChon(e, 'viec-hoan-thanh-khong-dung-han-co-due-date-trong-thang') + findChiSoByTuyChon(e, 'viec-cham-chua-hoan-thanh-co-due-date-trong-thang')) / findChiSoByTuyChon(e, 'viec-co-due-date-trong-thang') * 100)\n if (e[0].hasChild == 1) {\n rs.push({\n name: e[0].ten_don_vi,\n y: ty_le,\n drilldown: e[0].parent + '-' + e[0].ten_don_vi + '-' + thang,\n })\n } else {\n rs.push({\n name: e[0].ten_don_vi,\n y: ty_le,\n drilldown: true\n })\n }\n })\n return rs;\n}", "function dataDepartmentChart8(myObj, parent, thang) {\n let data = myObj.filter(e => {\n return e.parent == parent && e.thang == thang && (e.tuy_chon == 'viec-chuyen-sang-dang-thuc-hien-nho-hon-2-ngay' || e.tuy_chon == 'viec-co-due-date-trong-thang')\n })\n data = groupBy(data, 'ten_don_vi');\n let rs = [];\n Object.values(data).forEach(e => {\n let ty_le = Math.round(findChiSoByTuyChon(e, 'viec-chuyen-sang-dang-thuc-hien-nho-hon-2-ngay') / findChiSoByTuyChon(e, 'viec-co-due-date-trong-thang') * 100)\n if (!isNaN(ty_le)) {\n if (e[0].hasChild == 1) {\n rs.push({\n name: e[0].ten_don_vi,\n y: ty_le,\n drilldown: e[0].parent + '-' + e[0].ten_don_vi + '-' + thang,\n })\n } else {\n rs.push({\n name: e[0].ten_don_vi,\n y: ty_le,\n drilldown: true\n })\n }\n }\n })\n return rs;\n}", "function construye() {\n let base = [];\n for (let i = 0; i < numCajas; i++) {\n base.push(angular.copy(cajaDefecto));\n }\n return base;\n }", "recorrerArbolConsulta(nodo) {\n //NODO INICIO \n if (this.tipoNodo('INICIO', nodo)) {\n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n //NODO L, ES LA LISTA DE CONSULTAS \n if (this.tipoNodo('L', nodo)) {\n //SE RECORREN TODOS LOS NODOS QUE REPRESENTAN UNA CONSULTA \n for (var i = 0; i < nodo.hijos.length; i++) {\n this.recorrerArbolConsulta(nodo.hijos[i]);\n this.reiniciar();\n // this.codigoTemporal += \"xxxxxxxxxxxxxxxxxxxx-\"+this.contadorConsola+\".\"+\"\\n\";\n }\n }\n //PARA RECORRER TODOS LOS ELEMENTOS QUE COMPONEN LA CONSULTA \n if (this.tipoNodo('CONSULTA', nodo)) {\n for (var i = 0; i < nodo.hijos.length; i++) {\n this.pathCompleto = false;\n this.controladorAtributoImpresion = false;\n this.controladorDobleSimple = false;\n this.controladorPredicado = false;\n this.recorrerArbolConsulta(nodo.hijos[i]);\n }\n }\n //PARA RECORRER TODOS LOS ELEMENTOS QUE COMPONEN LA CONSULTA \n if (this.tipoNodo('VAL', nodo)) {\n for (var i = 0; i < nodo.hijos.length; i++) {\n this.pathCompleto = false;\n this.controladorAtributoImpresion = false;\n this.controladorDobleSimple = false;\n this.controladorPredicado = false;\n this.recorrerArbolConsulta(nodo.hijos[i]);\n }\n }\n //PARA VERIFICAR EL TIPO DE ACCESO, EN ESTE CASO // \n if (this.tipoNodo('DOBLE', nodo)) {\n this.controladorDobleSimple = true;\n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n //PARA VERIFICAR EL TIPO DE ACCESO, EN ESTE CASO: /\n if (this.tipoNodo('SIMPLE', nodo)) {\n //Establecemos que se tiene un acceso de tipo DOBLE BARRA \n this.controladorDobleSimple = false;\n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n //PARA VERIFICAR SI EL ELEMENTO A BUSCAR ES UN IDENTIFICADOR \n if (this.tipoNodo('identificador', nodo)) {\n const str = nodo.hijos[0];\n this.busquedaElemento(str);\n }\n //PARA VERIFICAR SI LO QUE SE VA A ANALIZAR ES UN PREDICADO \n if (this.tipoNodo('PREDICADO', nodo)) {\n this.controladorPredicado = true;\n const identificadorPredicado = nodo.hijos[0];\n //Primero se procede a la búsqueda del predicado\n this.codigoTemporal += \"//Inicio ejecucion predicado\\n\";\n this.busquedaElemento(identificadorPredicado);\n //Seguidamente se resuelve la expresión\n let resultadoExpresion = this.resolverExpresion(nodo.hijos[1]);\n let anteriorPredicado = this.temporalGlobal.retornarString();\n this.temporalGlobal.aumentar();\n this.codigoTemporal += this.temporalGlobal.retornarString() + \"=\" + anteriorPredicado + \";\\n\";\n let predicadoVariable = this.temporalGlobal.retornarString();\n this.codigoTemporal += \"PXP = \" + predicadoVariable + \";\\n\";\n this.codigoTemporal += \"ubicarPredicado();\\n\";\n //SI EL RESULTADO ES DE TIPO ETIQUETA\n if (resultadoExpresion.tipo == 4) {\n let datos = resultadoExpresion.valor;\n let a = datos[0];\n let b = datos[1];\n let c = datos[2];\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n // salidaXPATH.getInstance().push(this.consolaSalidaXPATH[i].dameID());\n this.auxiliarPredicado(a, b, c, this.consolaSalidaXPATH[i]);\n }\n }\n //SI EL RESULTADO ES DE TIPO ETIQUETA\n if (resultadoExpresion.tipo == 1) {\n this.consolaSalidaXPATH.push(this.consolaSalidaXPATH[(this.contadorConsola + resultadoExpresion.valor) - 1]);\n this.contadorConsola = this.consolaSalidaXPATH.length - 1;\n }\n this.controladorPredicadoInicio = false;\n }\n //PARA VERIFICAR QUE ES UN PREDICADO DE UN ATRIBUTO\n if (this.tipoNodo('PREDICADO_A', nodo)) {\n //return this.recorrer(nodo.hijos[0]);\n const identificadorPredicadoAtributo = nodo.hijos[0];\n //RECORREMOS LO QUE VA DENTRO DE LLAVES PARA OBTENER EL VALOR\n //AQUI VA EL METODO RESOLVER EXPRESION DE SEBAS PUTO \n return this.recorrerArbolConsulta(nodo.hijos[1]);\n }\n //PARA VERIFICAR SI EL ELEMENTO A BUSCAR ES UN ATRIBUTO \n if (this.tipoNodo('atributo', nodo)) {\n this.controladorAtributoImpresion = true;\n const identificadorAtributo = nodo.hijos[0];\n if (this.inicioRaiz) {\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n let x = this.consolaSalidaXPATH[i];\n //let nodoBuscarAtributo = this.consolaSalidaXPATH[this.consolaSalidaXPATH.length - 1];\n let nodoBuscarAtributo = x;\n //CODIGO DE 3 DIRECCIONES \n this.codigoTemporal += \"P=\" + nodoBuscarAtributo.posicion + \";\\n\";\n let inicioRaizXML = this.temporalGlobal.retornarString();\n this.temporalGlobal.aumentar();\n //Ubicamos nuestra variabel a buscar en el principio del heap \n this.codigoTemporal += this.temporalGlobal.retornarString() + \"=HXP;\\n\";\n //Escribimos dentro del heap de XPATH el nombre del identificador a buscar \n for (var z = 0; z < identificadorAtributo.length; z++) {\n this.codigoTemporal += `heapXPATH[(int)HXP] = ${identificadorAtributo.charCodeAt(z)};\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n }\n this.codigoTemporal += `heapXPATH[(int)HXP] =-1;\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n let anteriorGlobal = this.temporalGlobal.retornarString();\n this.codigoTemporal += \"stackXPATH[(int)PXP]=\" + anteriorGlobal + \";\\n\";\n this.temporalGlobal.aumentar();\n this.codigoTemporal += \"busquedaAtributo();\\n\";\n //CODIGO DE 3 DIRECCIONES \n //Se procede a la búsqueda de los atributos en todos los nodos\n for (let entry of nodoBuscarAtributo.atributos) {\n let atributoTemporal = entry;\n let nombreAbributo = atributoTemporal.dameNombre();\n if (nombreAbributo == identificadorAtributo) {\n this.atributoID = identificadorAtributo;\n this.pathCompleto = true;\n // this.contadorConsola = i;\n // this.consolaSalidaXPATH.push(nodoBuscarAtributo);\n }\n }\n /*for (let entry of nodoBuscarAtributo.hijos) {\n this.busquedaAtributo(entry, identificadorAtributo);\n }*/\n if (this.controladorDobleSimple) {\n this.busquedaAtributo(x, identificadorAtributo);\n }\n }\n }\n else {\n this.inicioRaiz = true;\n for (let entry of this.ArrayEtiquetas) {\n let temp = entry;\n //CODIGO DE 3 DIRECCIONES \n this.codigoTemporal += \"P=\" + temp.posicion + \";\\n\";\n let inicioRaizXML = this.temporalGlobal.retornarString();\n this.temporalGlobal.aumentar();\n //Ubicamos nuestra variabel a buscar en el principio del heap \n this.codigoTemporal += this.temporalGlobal.retornarString() + \"=HXP;\\n\";\n //Escribimos dentro del heap de XPATH el nombre del identificador a buscar \n for (var z = 0; z < identificadorAtributo.length; z++) {\n this.codigoTemporal += `heapXPATH[(int)HXP] = ${identificadorAtributo.charCodeAt(z)};\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n }\n this.codigoTemporal += `heapXPATH[(int)HXP] =-1;\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n let anteriorGlobal = this.temporalGlobal.retornarString();\n this.codigoTemporal += \"stackXPATH[(int)PXP]=\" + anteriorGlobal + \";\\n\";\n this.temporalGlobal.aumentar();\n this.codigoTemporal += \"busquedaAtributo();\\n\";\n //CODIGO DE 3 DIRECCIONES \n for (let entry2 of temp.atributos) {\n let aTemp = entry2;\n let nameAtt = aTemp.dameNombre();\n if (nameAtt == identificadorAtributo) {\n this.atributoID = identificadorAtributo;\n this.pathCompleto = true;\n }\n }\n if (this.controladorDobleSimple) {\n this.busquedaAtributo(entry, identificadorAtributo);\n }\n }\n }\n }\n //PARA VERIFICAR SI EL ELEMENTO A BUSCAR ES CUALQUIER ELEMENTO \n if (this.tipoNodo('any', nodo)) {\n //SIGNIFICA ACCESO DOBLE\n if (this.controladorDobleSimple) {\n let controladorNuevoInicio = -1;\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n let temporal = this.consolaSalidaXPATH[i];\n for (let entry of temporal.hijos) {\n //insertamos TODOS los hijos\n this.codigoTemporal += \"P =\" + entry.posicion + \";\\n\";\n this.codigoTemporal += \"imprimirContenido();\\n\";\n this.consolaSalidaXPATH.push(entry);\n if (controladorNuevoInicio == -1)\n controladorNuevoInicio = this.consolaSalidaXPATH.length - 1;\n this.complementoAnyElement(entry);\n }\n }\n this.contadorConsola = controladorNuevoInicio;\n this.pathCompleto = true;\n }\n //SIGNIFICA ACCESO SIMPLE \n else {\n //Controlamos el nuevo acceso para cuando coloquemos un nuevo elemento en la lista \n let controladorNuevoInicio = -1;\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n let temporal = this.consolaSalidaXPATH[i];\n for (let entry of temporal.hijos) {\n //insertamos TODOS los hijos\n this.consolaSalidaXPATH.push(entry);\n if (controladorNuevoInicio == -1)\n controladorNuevoInicio = this.consolaSalidaXPATH.length - 1;\n }\n }\n this.contadorConsola = controladorNuevoInicio;\n this.pathCompleto = true;\n }\n }\n //PARA VERIFICAR SI EL ELEMENTO A BUSCAR ES UNA PALABRA RESERVADA que simplicaria un AXE \n if (this.tipoNodo('reservada', nodo)) {\n //return this.recorrer(nodo.hijos[0]);\n const identificador = nodo.hijos[0];\n this.auxiliarAxe = identificador;\n //VERIFICAMOS EL TIPO DE ACCESO DE AXE \n if (this.controladorDobleSimple)\n this.dobleSimpleAxe = true;\n }\n if (this.tipoNodo('AXE', nodo)) {\n //return this.recorrer(nodo.hijos[0]);\n if (this.dobleSimpleAxe)\n this.controladorDobleSimple = true;\n this.temporalGlobal.aumentar();\n //Ubicamos nuestra variabel a buscar en el principio del heap \n this.codigoTemporal += this.temporalGlobal.retornarString() + \"=HXP;\\n\";\n //Escribimos dentro del heap de XPATH el nombre del identificador a buscar \n for (var i = 0; i < this.auxiliarAxe.length; i++) {\n this.codigoTemporal += `heapXPATH[(int)HXP] = ${this.auxiliarAxe.charCodeAt(i)};\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n }\n this.codigoTemporal += `heapXPATH[(int)HXP] =-1;\\n`;\n this.codigoTemporal += `HXP = HXP+1;\\n`;\n this.codigoTemporal += \"PXP =\" + this.temporalGlobal.retornarString() + \";\\n\";\n this.codigoTemporal += \"ejecutarAxe();\\n\";\n //Si Solicita implementar el axe child\n if (this.auxiliarAxe == \"child\") {\n //ESCRIBIMOS LOS IFS RESPECTIVOS \n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n //Si necesitsa implementar el axe attribute\n if (this.auxiliarAxe == \"attribute\") {\n //Le cambiamos la etiqueta de identificador a atributo para fines de optimizacion de codigo\n nodo.hijos[0].label = \"atributo\";\n //Escribimos el codigo en C3D para la ejecución del axe atributo \n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n //Si necesitsa implementar el ancestor\n if (this.auxiliarAxe == \"ancestor\") {\n //Va a resolver el predicado o identificador que pudiese venir \n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n if (this.auxiliarAxe == \"descendant\") {\n this.controladorDobleSimple = true;\n this.recorrerArbolConsulta(nodo.hijos[0]);\n }\n //Reiniciamos la variable cuando ya se acabe el axe\n this.auxiliarAxe = \"\";\n }\n //PARA VERIFICAR SI EL ELEMENTO A BUSCAR ES UN ATRIBUTO \n if (this.tipoNodo('X', nodo)) {\n //return this.recorrer(nodo.hijos[0]);\n //const identificadorAtributo = nodo.hijos[0] as string;\n this.controladorDobleSimple = true;\n this.recorrerArbolConsulta(nodo.hijos[0]);\n /*\n EN ESTA PARTE SE VA A PROCEDER PARA IR A BUSCAR EL ELEMENTO SEGÚN TIPO DE ACCESO\n */\n }\n //PARA VERIFICAR SI SE NECESITAN TODOS LOS ATRIBUTOS DEL NODO ACTUAL \n if (this.tipoNodo('any_att', nodo)) {\n this.controladorText = true;\n const identificadorAtributo = nodo.hijos[0];\n //Verificamos el tipo de acceso\n //Significa acceso con prioridad\n if (this.controladorDobleSimple) {\n //VERIFICAMOS DESDE DONDE INICIAMOS\n if (!this.inicioRaiz) {\n this.inicioRaiz = true;\n for (let entry of this.ArrayEtiquetas) {\n this.codigoTemporal += \"P =\" + entry.posicion + \";\\n\";\n this.codigoTemporal += \"imprimirAtributoAny();\\n\";\n for (let att of entry.atributos) {\n // salidaXPATH.getInstance().push(att.dameNombre()+\"=\"+att.dameValor());\n }\n this.complementoAnnyAtributte(entry);\n }\n }\n else {\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n let entry = this.consolaSalidaXPATH[i];\n this.codigoTemporal += \"P =\" + entry.posicion + \";\\n\";\n this.codigoTemporal += \"imprimirAtributoAny();\\n\";\n for (let att of entry.atributos) {\n // salidaXPATH.getInstance().push(att.dameNombre()+\"=\"+att.dameValor());\n }\n this.complementoAnnyAtributte(entry);\n }\n }\n }\n //Acceso sin prioridad\n else {\n if (!this.inicioRaiz) {\n for (let entry of this.ArrayEtiquetas) {\n this.codigoTemporal += \"P =\" + entry.posicion + \";\\n\";\n this.codigoTemporal += \"imprimirAtributoAny();\\n\";\n for (let att of entry.atributos) {\n // salidaXPATH.getInstance().push(att.dameNombre()+\"=\"+att.dameValor());\n }\n }\n }\n else {\n let limite = this.consolaSalidaXPATH.length;\n for (var i = this.contadorConsola; i < limite; i++) {\n let entry = this.consolaSalidaXPATH[i];\n this.codigoTemporal += \"P =\" + entry.posicion + \";\\n\";\n this.codigoTemporal += \"imprimirAtributoAny();\\n\";\n for (let att of entry.atributos) {\n // salidaXPATH.getInstance().push(att.dameNombre()+\"=\"+att.dameValor());\n }\n }\n }\n }\n } //FIN ANNY ATT\n //PARA VERIFICAR SI SE ESTÁ INVOCANDO A LA FUNCIÓN TEXT() \n if (this.tipoNodo('text', nodo)) {\n this.controladorText = true;\n const identificadorAtributo = nodo.hijos[0];\n //Si se necesita el texto de el actual y los descendientes\n if (this.controladorDobleSimple) {\n for (var i = this.contadorConsola; i < this.consolaSalidaXPATH.length; i++) {\n /*if (this.consolaSalidaXPATH[i].dameValor() == \"\" || this.consolaSalidaXPATH[i].dameValor() == \" \") {\n \n } else {\n // salidaXPATH.getInstance().push(this.consolaSalidaXPATH[i].dameValor());\n }*/\n this.codigoTemporal += \"P=\" + this.consolaSalidaXPATH[i].posicion + \";\\n\";\n this.codigoTemporal += \"text();\\n\";\n this.complementoText(this.consolaSalidaXPATH[i]);\n }\n }\n else {\n //si necesita solo el texto del actual \n for (var i = this.contadorConsola; i < this.consolaSalidaXPATH.length; i++) {\n /* if (this.consolaSalidaXPATH[i].dameValor() == \"\" || this.consolaSalidaXPATH[i].dameValor() == \" \") {\n \n } else {\n //salidaXPATH.getInstance().push(this.consolaSalidaXPATH[i].dameValor());\n }*/\n this.codigoTemporal += \"P=\" + this.consolaSalidaXPATH[i].posicion + \";\\n\";\n this.codigoTemporal += \"text();\\n\";\n }\n }\n }\n //PARA VERIFICAR SI ES EL TIPO DE ACCESO AL PADRE: \":\" \n if (this.tipoNodo('puntos', nodo)) {\n const cantidad = nodo.hijos[0];\n //DOSPUNTOSSSSSSSSS\n if (cantidad.length == 2) {\n this.pathCompleto = true;\n if (this.auxiliarArrayPosicionPadres == -1) {\n this.auxiliarArrayPosicionPadres = this.arrayPosicionPadres.length - 1;\n }\n for (var i = this.auxiliarArrayPosicionPadres; i >= 0; i--) {\n let contadorHermanos = this.arrayPosicionPadres[i];\n let controladorInicio = 0;\n if (i > 0) {\n while (contadorHermanos != this.arrayPosicionPadres[i - 1]) {\n this.consolaSalidaXPATH.push(this.consolaSalidaXPATH[contadorHermanos]);\n this.codigoTemporal += \"P =\" + this.consolaSalidaXPATH[contadorHermanos].posicion + \";\\n\";\n if (controladorInicio == 0) {\n this.contadorConsola = this.consolaSalidaXPATH.length - 1;\n }\n controladorInicio++;\n contadorHermanos--;\n this.auxiliarArrayPosicionPadres = contadorHermanos;\n }\n }\n else {\n while (contadorHermanos >= 0) {\n this.consolaSalidaXPATH.push(this.consolaSalidaXPATH[contadorHermanos]);\n this.codigoTemporal += \"P =\" + this.consolaSalidaXPATH[contadorHermanos].posicion + \";\\n\";\n if (controladorInicio == 0) {\n this.contadorConsola = this.consolaSalidaXPATH.length - 1;\n }\n controladorInicio++;\n contadorHermanos--;\n this.auxiliarArrayPosicionPadres = contadorHermanos;\n }\n }\n break;\n }\n this.codigoTemporal += \"busquedaSimple();\\n\";\n }\n //SIGNIFICA QUE TIENE SOLO UN PUNTO \n else {\n this.pathCompleto = true;\n }\n ///DOS PUNTOOOOOOOOOOOOOOOOS\n }\n }", "function loadDeparturesWithCountrycode(countrycode) {\n vm.loading = true;\n datacontext.getDepartureTerminalsByCountryCode(countrycode).then(function(resp) {\n //console.log(resp);\n\n try {\n vm.departureTerminals = resp.Items;\n } catch (exception) {\n swal(\"please try again later!\");\n }\n\n\n\n // console.log(vm.departureTerminals[0]);\n vm.loading = false;\n }, function(err) {\n console.log(err);\n vm.loading = false;\n });\n }", "function dibujar_tier(){\n\n var aux=0;\n var padre=$(\"#ordenamientos\"); // CONTENEDOR DE TODOS LOS TIER Y TABLAS\n for(var i=0;i<tier_obj.length;i++){ // tier_obj = OBJETO CONTENEDOR DE TODOS LOS TIER DE LA NAVE\n if(i==0) { // PRIMER CASO\n aux=tier_obj[0].id_bodega;\n aux=tier_obj[i].id_bodega;\n var titulo1= $(\"<h4 id='bodega' > BODEGA \"+tier_obj[i].num_bodega+\"</h4>\");\n padre.append(titulo1);\n }\n if(aux!=tier_obj[i].id_bodega){\n aux=tier_obj[i].id_bodega;\n var titulo1= $(\"<h4 id='bodega' > BODEGA \"+tier_obj[i].num_bodega+\"</h4>\");\n padre.append(titulo1);\n }\n\n // DIV CONTENEDOR DEL TITULO, TABLA DE DATOS Y TIER\n var tier_div= $(\"<div class='orden_tier_div'></div>\");\n padre.append( tier_div );\n\n // DIV CON EL TITULO Y LA TABLA VACIA\n var titulo2= $(\"<div id='div\"+tier_obj[i].id_tier+\"'><h4 id='tier'> M/N. \"+tier_obj[i].nombre+\" ARROW . . . . .HOLD Nº \"+tier_obj[i].num_bodega+\" </h4><table class='table table-bordered dat'></table></div>\");\n tier_div.append( titulo2 );\n\n // DIV CON EL TIER Y SUS DIMENSIONES\n var dibujo_tier=$(\"<div class='dibujo1_tier'></div>\");\n\n //DIV DEL RECTANGULO QUE SIMuLA UN TIER\n\n // LARGO AL LADO DERECHO DEL TIER\n var largo_tier=$(\"<div class='largo_tier'><p>\"+tier_obj[i].largo+\" mts</p></div>\");\n dibujo_tier.append( largo_tier );\n\n // EL ID DEL DIV, SERA EL ID DEL TIER EN LA BASE DE DATOS\n var cuadrado_tier=$(\"<div class='dibujo_tier' id=\"+tier_obj[i].id_tier+\"></div>\");\n dibujo_tier.append( cuadrado_tier );\n\n // ANCHO DEBAJO DEL TIER\n var ancho_tier=$(\"<div class='ancho_tier'><p>\"+tier_obj[i].ancho+\" mts</p></div>\");\n dibujo_tier.append( ancho_tier );\n\n tier_div.append( dibujo_tier );\n }\n\n datos_tier(); // ASIGNAR DATOS A LA TABLE DE CADA TIER\n}", "function MUPM_get_selected_depbases(){\n //console.log( \" --- MUPM_get_selected_depbases --- \")\n const tblBody_select = document.getElementById(\"id_MUPM_tbody_select\");\n let dep_list_arr = [];\n for (let i = 0, row; row = tblBody_select.rows[i]; i++) {\n let row_pk = get_attr_from_el_int(row, \"data-pk\");\n // skip row 'select_all'\n if(row_pk){\n if(!!get_attr_from_el_int(row, \"data-selected\")){\n dep_list_arr.push(row_pk);\n }\n }\n }\n dep_list_arr.sort((a, b) => a - b);\n const dep_list_str = dep_list_arr.join(\";\");\n //console.log( \"dep_list_str\", dep_list_str)\n return dep_list_str;\n } // MUPM_get_selected_depbases", "async function chargesListByDepartmentLegacy() {\n const subscriptionId =\n process.env[\"CONSUMPTION_SUBSCRIPTION_ID\"] || \"00000000-0000-0000-0000-000000000000\";\n const scope = \"providers/Microsoft.Billing/BillingAccounts/1234/departments/42425\";\n const filter = \"usageStart eq '2018-04-01' AND usageEnd eq '2018-05-30'\";\n const options = { filter };\n const credential = new DefaultAzureCredential();\n const client = new ConsumptionManagementClient(credential, subscriptionId);\n const result = await client.charges.list(scope, options);\n console.log(result);\n}", "function getDepartments() {\n const query = \"SELECT * FROM department\";\n return queryDB(query);\n}", "function updateTransactionList() {\n\n var f_instance = M.FormSelect.getInstance($('#fundingType'));\n var c_instance = M.FormSelect.getInstance($('#categories'));\n\n let funding_round_types = f_instance.getSelectedValues();\n let catagory_codes= c_instance.getSelectedValues();\n\n directoryChart.cities = [];\n directoryChart.update();\n }" ]
[ "0.60088456", "0.59903276", "0.59153014", "0.5846319", "0.5771146", "0.57610315", "0.5730923", "0.57061726", "0.5665966", "0.5642549", "0.5595356", "0.55906004", "0.5590081", "0.5555582", "0.55520856", "0.5538663", "0.5535483", "0.5516374", "0.5492069", "0.54724574", "0.54720384", "0.54521567", "0.5407424", "0.5396608", "0.5394451", "0.5391638", "0.5379328", "0.53747815", "0.53702754", "0.53684396", "0.5367486", "0.53618014", "0.535675", "0.5343422", "0.5308548", "0.53066605", "0.5302832", "0.53010076", "0.52974", "0.529727", "0.5279691", "0.52686375", "0.5258434", "0.5257013", "0.5254969", "0.5251097", "0.5249737", "0.5243749", "0.5238677", "0.5232863", "0.5225888", "0.52255166", "0.5217477", "0.5216895", "0.5208512", "0.52038914", "0.51913786", "0.51909685", "0.5188614", "0.5186279", "0.5185901", "0.51806206", "0.5178759", "0.5172493", "0.51667994", "0.5164699", "0.5156675", "0.51506114", "0.5148488", "0.51454085", "0.51377344", "0.5132619", "0.51304847", "0.5125861", "0.5123929", "0.51192325", "0.5099349", "0.5099129", "0.50989187", "0.5085592", "0.50849736", "0.5078892", "0.5064408", "0.5061591", "0.50556815", "0.50537497", "0.5050812", "0.5046416", "0.50437284", "0.5038515", "0.50333554", "0.50306785", "0.502863", "0.5026812", "0.5020169", "0.5012565", "0.50107133", "0.5005132", "0.5003826", "0.50023055" ]
0.5283222
40
escucha del Boton para insertar un file
function clickFile() { var idchan = '#imgLog'; var idchankey = 'imgLog'; $(idchan).click();//obliga un click const imgFile = document.getElementById(idchankey); imgFile.addEventListener("change", function () { const file = this.files[0]; localStorage.setItem("foto", JSON.stringify(file)); console.log(file); var yave = '#ImganItenAdmin'; if (file) { const render = new FileReader(); render.addEventListener("load", function (event) { console.log(this.result); $(yave).attr("src", this.result); }); render.readAsDataURL(file); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertFile(file) {\n uploadFile(file, function (url) {\n var text = \"[img]\" + url + \"[/img]\";\n typeInTextarea(text);\n });\n }", "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 guardarTextoComoArchivo() {\n // Sacar el texto que actualmente esta en el area de texto\n var texto = document.getElementById(\"textoAGuardar\").value;\n\n // Convertir el texto en un tipo de data BLOB\n var textoBlob = new Blob([texto], { type: \"text/plain\" });\n // Crear el URL para descargar el archivo con el BLOB\n var textoURL = window.URL.createObjectURL(textoBlob);\n //Sacar el nombre que el usuario quiera asignar al archivo\n var nombreArchivoAGuardar = document.getElementById(\"nombreArchivoAGuardar\").value;\n\n // Crear elemento para construir el link de descarga\n var linkDescarga = document.createElement(\"a\");\n // Crear el atributo de descarga con el URL y agregar .txt para descargarlo de formato correcto\n linkDescarga.download = nombreArchivoAGuardar + \".txt\";\n // Configuraciones internas del HTML para que funcione como link de descarga\n linkDescarga.innerHTML = \"Descargar Archivo\";\n // Apuntar el elemento HTML creado al URL creada\n linkDescarga.href = textoURL;\n // Despues de hacerle click al element destruirlo para volver a descargar\n linkDescarga.onclick = destruirElemento;\n // Omitir estilos para mantener mismo boton\n linkDescarga.style.display = \"none\";\n //Agregar link de descarga al codigo HTML\n document.body.appendChild(linkDescarga);\n\n // Hacer el llamado de click para iniciar la descarga\n linkDescarga.click();\n}", "saveToFile() {\r\n saveFile({\r\n idParent: this.currentOceanRequest.id,\r\n fileType: this.fileType,\r\n strFileName: this.fileName\r\n })\r\n .then(() => {\r\n // refreshing the datatable\r\n this.getRelatedFiles();\r\n })\r\n .catch(error => {\r\n // Showing errors if any while inserting the files\r\n this.dispatchEvent(\r\n new ShowToastEvent({\r\n title: \"Error while uploading File\",\r\n message: error.message,\r\n variant: \"error\"\r\n })\r\n );\r\n });\r\n }", "function uploadSavedataPending(file) {\n runCommands.push(function () { \n gba.loadSavedataFromFile(file) \n });\n }", "_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 onEditDialogSave(){\r\n\t\t\r\n\t\tif(!g_codeMirror)\r\n\t\t\tthrow new Error(\"Codemirror editor not found\");\r\n\t\t\r\n\t\tvar content = g_codeMirror.getValue();\r\n\t\tvar objDialog = jQuery(\"#uc_dialog_edit_file\");\r\n\t\t\r\n\t\tvar item = objDialog.data(\"item\");\r\n\t\t\r\n\t\tvar data = {filename: item.file, path: g_activePath, pathkey: g_pathKey, content: content};\r\n\t\t\r\n\t\tg_ucAdmin.setAjaxLoaderID(\"uc_dialog_edit_file_loadersaving\");\r\n\t\tg_ucAdmin.setErrorMessageID(\"uc_dialog_edit_file_error\");\r\n\t\tg_ucAdmin.setSuccessMessageID(\"uc_dialog_edit_file_success\");\r\n\t\t\r\n\t\tassetsAjaxRequest(\"assets_save_file\", data);\r\n\t\t\r\n\t}", "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 addFile(row, col, action) {\n\t\t\tconsole.log(\"add file example\", row);\n\t\t\tvar d = new Date();\n\t\t\tvar modifyItem = row.entity;\n\t\t\tif(modifyItem != undefined){\n\t\t\t\tmodifyItem.filename='newfile.jpg';\n\t\t\t\tmodifyItem.serial=10;\n\t\t\t\tmodifyItem.date = d;\n\t\t\t}\n\t\t\t//update actions\n\t\t\tvar showButton = (modifyItem.filename && modifyItem.filename != \"\") ? false : true;\n\t\t\tmodifyItem.actions = [\n\t\t\t\t{field: modifyItem.filename, actionFieldType: enums.actionFieldType.getName(\"Text\"), cssClass: \"\"},\n\t\t\t\t{field: 'fa fa-search', actionFieldType: enums.actionFieldType.getName(\"Icon\"), function: searchFunc, showControl: !showButton},\n\t\t\t\t{field: 'fa fa-eye', actionFieldType: enums.actionFieldType.getName(\"Icon\"), function: editFunc, showControl: !showButton},\n\t\t\t\t{field: '/ignoreImages/si_close_entity_normal.png', actionFieldType: enums.actionFieldType.getName(\"Image\"), height: \"16\", width: \"16\", function: deleteFunc, cssClass: \"\", showControl: !showButton},\n\t\t\t\t{field: 'Add File', title: 'Add File', actionFieldType: enums.actionFieldType.getName(\"Button\"), function: addFile, showControl: showButton}\n\t\t\t]\n\t\t\tvar showRowLock = modifyItem.isSelected;\n\t\t\tmodifyItem.lock = [\n\t\t\t\t{field: 'fa fa-check', actionFieldType: enums.actionFieldType.getName(\"Icon\"), showControl: showRowLock}\n\t\t\t]\n\t\t}", "saveDialog() {\n content = JSON.stringify(datastore.getDevices());\n dialog.showSaveDialog({ filters: [\n { name: 'TellSec-Dokument', extensions: ['tell'] }\n ]},(fileName) => {\n if (fileName === undefined) {\n console.log(\"Du hast die Datei nicht gespeichert\");\n return;\n }\n fileName = fileName.split('.tell')[0] \n fs.writeFile(fileName+\".tell\", content, (err) => {\n if (err) {\n alert(\"Ein Fehler tritt während der Erstellung der Datei auf \" + err.message)\n }\n alert(\"Die Datei wurde erfolgreich gespeichert\");\n });\n });\n }", "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}", "supprCloudCallback(confirmCallBack) {\n var option = this.saveView.cloudSelectFile.options[this.saveView.cloudSelectFile.selectedIndex];\n var id = option.value;\n this.drive.trashFile(id);\n confirmCallBack();\n }", "putFile(path,data,callback) { this.engine.putFile(path,data,callback); }", "function handleFileUploadSubmit2(e) {\n const uploadTask = storageRef.child(`${idPlace}/2`).put(selectedFile); //create a child directory called images, and place the file inside this directory\n document.querySelector('#file-submit_2').disabled = true;\n document.querySelector('#file-submit_2').innerHTML = 'subiendo';\n uploadTask.on('state_changed', (snapshot) => {\n // Observe state change events such as progress, pause, and resume\n }, (error) => {\n // Handle unsuccessful uploads\n console.log(error);\n }, () => {\n // Do something once upload is complete\n uploadTask.then(snapshot => snapshot.ref.getDownloadURL())\n .then((url) => {\n database.ref('/'+idPlace+'/feed_2').set({\n 'url': url,\n\t\t\t\t\t\t'placeName': placeName\n });\n fileObject.target.value = ''\n document.querySelector('#file-submit_2').innerHTML = 'listo';\n document.querySelector('#file-submit_2').removeAttribute('disabled');\n })\n .catch(console.error);\n });\n }", "function upload()\n {\n messageBox.confirm({\n \"title\": \"Import Tasks\",\n \"message\": \"Do you wish import a file with your tasks?\",\n \"success\": function(e){\n var successFile = function(reason){\n if( window.cordova ){\n window.plugins.toast.show(reason, 'long', 'top');\n }\n BadgeHelper.redirectBadge();\n },\n errorFile = function(reason){\n Log.err(\"$cordovaFile.writeFile.err: \"+reason);\n messageBox.alert('Validation Error', reason, $rootScope, [{\n text: '<b>Ok</b>',\n type: 'button-blue-inverse',\n onTap: function(e){\n BadgeHelper.redirectBadge();\n }\n }]);\n };\n if( 'fileChooser' in window)\n {\n window.fileChooser.open(function(uri) {\n Log.success(\"window.fileChooser.open.success: \"+uri);\n window.FilePath.resolveNativePath(uri, function(fileName){\n Log.success(\"window.FilePath.resolveNativePath.success: \"+fileName);\n window.resolveLocalFileSystemURL(fileName, function (fileEntry)\n {\n Log.success(\"window.resolveLocalFileSystemURL.success: \", fileEntry);\n fileEntry.file(function (file) { \n saveByExport(file).then(successFile, errorFile);\n });\n });\n });\n });\n }\n else{\n var element = document.getElementById('upload-file-item');\n element.value = \"\";\n element.click();\n \n element.onchange = function()\n {\n saveByExport(this.files[0]).then(successFile, errorFile);\n };\n }\n }\n });\n }", "function newFile(){\n var decision = confirm(\"Operacja spowoduje usunięcie danych aktualnego testu. Kontynuować?\");\n if(decision){\n window.localStorage.clear();\n location.reload();\n }\n}", "function saveFile(){\n socket.emit(\"save_file\",\n {\n room:roomname,\n user:username,\n text:editor.getSession().getValue()\n });\n}", "function handleFileUploadSubmit3(e) {\n const uploadTask = storageRef.child(`${idPlace}/3`).put(selectedFile); //create a child directory called images, and place the file inside this directory\n document.querySelector('#file-submit_3').disabled = true;\n document.querySelector('#file-submit_3').innerHTML = 'subiendo';\n uploadTask.on('state_changed', (snapshot) => {\n // Observe state change events such as progress, pause, and resume\n }, (error) => {\n // Handle unsuccessful uploads\n console.log(error);\n }, () => {\n // Do something once upload is complete\n uploadTask.then(snapshot => snapshot.ref.getDownloadURL())\n .then((url) => {\n database.ref('/'+idPlace+'/feed_3').set({\n 'url': url,\n\t\t\t\t\t\t'placeName': placeName\n });\n fileObject.target.value = ''\n document.querySelector('#file-submit_3').innerHTML = 'listo';\n document.querySelector('#file-submit_3').removeAttribute('disabled');\n })\n .catch(console.error);\n });\n }", "importDB() {\r\n document.getElementById('file-upload-import').click();\r\n }", "function loadfile() {\n // pop up a file upload dialog\n // when file is received, send to server and populate db with it\n}", "function uploadComplete(file_id){\n var content = \"<tr class='file' name='\" + fileName + \"'lookup='\" +\n file_id + \"'><td><i class='icon-file'></i>\" +\n fileName + \"</td><td><button class='btn delete'>\"\n + \"<i class='icon-remove'></i>delete</button></td></tr>\";\n $(\"#folder_view\").append(content);\n $(\"#upload_file\").empty();\n}", "function InsertPicture(_1){\r\nif(typeof _editor_picturePath!==\"string\"){\r\n_editor_picturePath=Xinha.getPluginDir(\"InsertPicture\")+\"/demo_pictures/\";\r\n}\r\nInsertPicture.Scripting=\"php\";\r\n_1.config.URIs.insert_image=\"../plugins/InsertPicture/InsertPicture.\"+InsertPicture.Scripting+\"?picturepath=\"+_editor_picturePath;\r\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", "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 CrearBtUploadImg(){\n\t\n\t var argv = CrearBtUploadImg.arguments;\n\t var BotonId = argv[0];\n\t var idImgMostrar = argv[1];\n\t var divGuardar = argv[2];\n\t var inputSize = argv[3];\n\t var inputName = argv[4];\n\t var inputFile = argv[5];\n\t\n\t var uploader = new qq.FileUploader({\n element: document.getElementById(BotonId),\n action: 'mul_multimedia_carga_temporal.php',\n multiple: false,\n template: '<div class=\"qq-uploader\">' +\n '<div class=\"qq-upload-drop-area\" style=\"display: none;\"><span>Drop files here to upload</span></div>' +\n '<div class=\"qq-upload-button\" style=\"height:17px;\">Seleccione un archivo</div>' +\n '<div class=\"qq-upload-size\"></div>' +\n '<ul class=\"qq-upload-list\"></ul>' + \n '</div>', \n\n onComplete: function(id, fileName, responseJSON) {\n\t\t\t\t var htmlmostrar = responseJSON.archivo.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');\n\t\t\t\t $(idImgMostrar).html(htmlmostrar);\n\t\t\t\t $(inputSize).val(responseJSON.size);\n\t\t\t\t $(inputName).val(responseJSON.nombrearchivo);\n\t\t\t\t $(inputFile).val(responseJSON.nombrearchivotmp);\n\t\t\t\t $(divGuardar).show();\n },\n messages: {\n },\n debug: false\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 fc_UploadFile_Limpiar(idUpload){\n f = document.getElementById(idUpload);\n nuevoFile = document.createElement('input');\n nuevoFile.id = f.id;\n nuevoFile.type = 'file';\n nuevoFile.name = f.name;\n nuevoFile.value = '';\n nuevoFile.className = f.className;\n nuevoFile.onchange = f.onchange;\n nuevoFile.style.width = f.style.width;\n nodoPadre = f.parentNode;\n nodoSiguiente = f.nextSibling;\n nodoPadre.removeChild(f);\n (nodoSiguiente == null) ? nodoPadre.appendChild(nuevoFile):\n nodoPadre.insertBefore(nuevoFile, nodoSiguiente);\n}", "function Update () {\n//System.IO.File.AppendAllText(fileLocation + \"/DINGBAT2.txt\", ArduinoValue.ToString());\n//System.IO.File.AppendAllText(fileLocation + \"/DINGBAT2.txt\", \" \" + Time.time.ToString());\nif (!CreatedFile){\n//print(\"file Not created!\");\nreturn;}\nelse{\nWriteDatatoFile();\n//srs.Close();\n}\n}", "uploadFileFaust(app, module, x, y, e, dsp_code) {\n var files = e.dataTransfer.files;\n var file = files[0];\n this.loadFile(file, module, x, y);\n }", "function upload() {\n\tconst input = document.createElement('input');\n\tinput.type = 'file';\n\tdocument.body.appendChild(input);\n\tinput.classList.add('hidden');\n\tinput.click();\n\tinput.onchange = async () => {\n\t\tconst files = input.files;\n\t\tconst text = await files[0].text()\n\t\tconst savedGame = JSON.parse(text);\n\t\tload(savedGame);\n\t\temptyBlockListeners();\n\t\tdocument.body.removeChild(input);\n\t}\n}", "function handleFileUploadSubmit4(e) {\n const uploadTask = storageRef.child(`${idPlace}/4`).put(selectedFile); //create a child directory called images, and place the file inside this directory\n document.querySelector('#file-submit_4').disabled = true\n document.querySelector('#file-submit_4').innerHTML = 'subiendo'\n uploadTask.on('state_changed', (snapshot) => {\n // Observe state change events such as progress, pause, and resume\n }, (error) => {\n // Handle unsuccessful uploads\n console.log(error);\n }, () => {\n // Do something once upload is complete\n uploadTask.then(snapshot => snapshot.ref.getDownloadURL())\n .then((url) => {\n database.ref('/'+idPlace+'/feed_4').set({\n 'url': url,\n\t\t\t\t\t\t'placeName': placeName\n });\n fileObject.target.value = ''\n document.querySelector('#file-submit_4').innerHTML = 'listo'\n document.querySelector('#file-submit_4').removeAttribute('disabled');\n })\n .catch(console.error);\n });\n }//end handleFileUploadSubmit2", "saveFile(fileName, ext, data) {\r\n fs.writeFile('output/'+fileName+'.'+ext.toLowerCase(), data, (err) => {\r\n if(err) {\r\n fs.mkdir('output', (e) => {\r\n if(!e || (e && e.code === 'EEXIST')){ \r\n fs.writeFile('output/'+fileName+'.'+ext.toLowerCase(), data, (err) => {\r\n if(err) {\r\n alert(err)\r\n } else {\r\n dialog.showMessageBox(null, {\r\n type: 'info',\r\n buttons: ['&Ok'],\r\n defaultId: 0,\r\n title: 'Live Web Editor',\r\n message: 'File '+ext+' saved successfully!',\r\n noLink: true,\r\n normalizeAccessKeys: true\r\n })\r\n }\r\n })\r\n }\r\n })\r\n } else {\r\n dialog.showMessageBox(null, {\r\n type: 'info',\r\n buttons: ['&Ok'],\r\n defaultId: 0,\r\n title: 'Live Web Editor',\r\n message: 'File '+ext+' saved successfully!',\r\n noLink: true,\r\n normalizeAccessKeys: true\r\n })\r\n }\r\n })\r\n // Hide the dropdown\r\n document.getElementsByClassName('dropdown-content')[0].style.display = 'none'\r\n }", "function uploadFile(err, url){\n\n instance.publishState('created_file', url);\n instance.triggerEvent('has_created_your_file')\n\n if (err){\n\n console.log('error '+ err);\n\n }\n\n }", "function uploadFile(fileContent) {\n dbx.filesUpload({\n contents: fileContent,\n path: conf.get('filePath'),\n mode: \"overwrite\"\n }).then(function(response) {\n //console.log(JSON.stringify(response));\n }).catch(function(error) {\n //console.log(JSON.stringify(error.response));\n });\n}", "addFileX(event) {\n let aFile = event.target.files[0];\n if (aFile.type === \"text/plain\"){\n this.files[0] = aFile;\n } \n }", "function deleteThisFile () {\n // only hide the file\n $thisFile.hide();\n // trigger a file deletion operations\n self.emit('_deleteFile', $thisFile.find(ps).text(), function(err) {\n // show back the file on error or remove on success\n if (err) {\n $thisFile.fadeIn();\n } else {\n $thisFile.remove();\n }\n });\n }", "function successMove2(entry) {\n //I do my insert with \"entry.fullPath\" as for the path\n //app.finForm();\n //enable button\n document.getElementById(\"fnFrm\").disabled = false;\n}", "function save() {\n\t\t$$invalidate(1, excluded_files = allExcludedFiles());\n\t\tplugin.settings.set({ exluded_filename_components });\n\t}", "function borradoElemento () {\n\t/*\n\tinit_listener_file_upload();\n\t$(\".combo_tipo_doc\").val(\"\");\n\tfileUploadPreview ();\n\t\n\t\n\t\tcloseFancy();\n\t\n\t*/\n}", "function onDelete() {\n setFileURL(false)\n console.log(\"delete file\");\n }", "function subirArchivo( archivo ) {\n openModalLoader();\n var key = vm.saveKeyUpload;\n // referencia al lugar donde guardaremos el archivo\n var refStorage = storageService.ref(key).child(archivo.name);\n // Comienza la tarea de upload\n var uploadTask = refStorage.put(archivo);\n\n uploadTask.on('state_changed', function(snapshot){\n // aqui podemos monitorear el proceso de carga del archivo\n }, function(error) {\n vm.modalLoader.dismiss();\n swal(\"¡Error al cargar!\", \"No se pudo cargar el archivo\", \"error\");\n }, function() {\n var downloadURL = uploadTask.snapshot.downloadURL;\n firebase.database().ref('rh/tramitesProceso/' + key + '/archivos').push({\n 'nombreArchivo': archivo.name,\n 'rutaArchivo': downloadURL\n }).then(function(){\n vm.modalLoadFile.dismiss();\n vm.modalLoader.dismiss();\n swal(\"¡Carga Realizada!\", \"Carga del archivo exitosa\", \"success\");\n });\n });\n }", "function submitUpload() {\n el(\"divRecordNotFound\").style.display = \"none\";\n if (el(\"hdnFileName\").value != '') {\n var tablename = getQStr(\"tablename\");\n if (tablename.toUpperCase() == \"TARIFF\" || tablename.toUpperCase() == \"TARIFF_CODE_DETAIL\") {\n showConfirmMessage(\"Do you really want to upload this File? This will Delete all the existing data from Database and Insert Data from the File.\",\n \"mfs().yesClickTariff();\", \"\", \"\");\n }\n else {\n hideDiv(\"btnSubmit\");\n showLayer(\"Loading..\");\n setTimeout(insertUploadTable, 0);\n }\n }\n else {\n showErrorMessage('Please Upload a file');\n el(\"divifgGrid\").style.display = \"none\";\n el(\"divlnk\").style.display = \"none\";\n }\n}", "function handleFileImport(evt) {\n var file = evt.target.files[0];\n var reader = new FileReader();\n reader.onload = function(e) {\n editor.setValue(e.target.result);\n };\n reader.onerror = function(e) {\n console.log(\"error\", e);\n };\n reader.readAsText(file);\n setStatusText(\"File imported.\");\n }", "function storeFile(fileRequest, username, callback) {\n db = app.get(\"db_conn\");\n grid = app.get(\"grid_conn\");\n\n // source - Inbox/Outbox/Upload\n // details - Some details about the file (doctor name (sender )for Inbox, user comments for Upload, doctor name (to whom it was sent) for Outbox)\n var source = '';\n var details = '';\n\n if (fileRequest.source) {\n source = fileRequest.source;\n }\n if (fileRequest.details) {\n details = fileRequest.details;\n }\n\n console.log(\"Storage PUT call\");\n //console.log(fileRequest);\n\n if (fileRequest.filename === undefined || fileRequest.filename.length < 1 || fileRequest.filename === null) {\n callback('Error, filname bad.');\n }\n\n if (fileRequest.file === undefined || fileRequest.file.length < 1 || fileRequest.file === null) {\n callback('Error, file bad.');\n }\n\n var fileType = 'binary/octet-stream';\n if (fileRequest.filename && fileRequest.filename.length > 3) {\n var extension = fileRequest.filename.substring(fileRequest.filename.lastIndexOf(\".\") + 1, fileRequest.filename.length);\n if (extension.toLowerCase() === 'xml') {\n fileType = 'text/xml';\n }\n }\n\n //console.log(\"---\");\n //console.log(fileRequest.file);\n //console.log(\"---\");\n\n try {\n var bb = blueButton(fileRequest.file);\n\n var bbMeta = bb.document();\n\n if (bbMeta.type === 'ccda') {\n fileType = \"CCDA\";\n }\n } catch (e) {\n //do nothing, keep original fileType\n console.log(e);\n }\n\n //TODO: Fix once auth is implemented.\n var buffer = new Buffer(fileRequest.file);\n grid.put(buffer, {\n metadata: {\n source: source,\n details: details,\n owner: username,\n parsedFlag: false\n },\n 'filename': fileRequest.filename,\n 'content_type': fileType\n }, function(err, fileInfo) {\n if (err) {\n throw err;\n }\n var recordId = fileInfo._id;\n //console.log(\"Record Stored in Gridfs: \" + recordId);\n callback(err, fileInfo);\n });\n\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 insertUploadTable() {\n var SchemaID = getQStr(\"SchemaID\");\n var oCallback = new Callback();\n oCallback.add(\"SchemaID\", SchemaID);\n oCallback.add(\"DepotId\", el(\"hdnDpt_ID\").value);\n oCallback.add(\"filename\", el(\"hdnFileName\").value);\n oCallback.add(\"USERNAME\", getQStr(\"USERNAME\"));\n oCallback.add(\"TableName\", getQStr(\"tablename\"));\n oCallback.add(\"Size\", getQStr(\"Size\"));\n oCallback.add(\"Type\", getQStr(\"Type\"));\n oCallback.add(\"Cstmr_id\", getQStr(\"Cstmr_id\"));\n oCallback.add(\"TariffId\", getQStr(\"TariffId\"));\n\n oCallback.invoke(\"Upload.aspx\", \"InsertFileUpload\");\n\n if (oCallback.getCallbackStatus()) {\n if (oCallback.getReturnValue('Message') != '' && oCallback.getReturnValue('Message') != null) {\n showInfoMessage(oCallback.getReturnValue('Message'));\n if (typeof (pdfs('wfFrame' + pdf('CurrentDesk')).bindGrid()) != \"undefined\") {\n pdfs('wfFrame' + pdf('CurrentDesk')).bindGrid();\n }\n }\n else {\n showErrorMessage(oCallback.getReturnValue('Error'));\n }\n\n if (oCallback.getReturnValue('Upload') == 'yes') {\n bindGrid(oCallback.getReturnValue('IdCol'), \"Valid\", \"No\");\n el(\"hdnIdColumn\").value = oCallback.getReturnValue('IdCol');\n }\n }\n else {\n showErrorMessage(oCallback.getCallbackError());\n }\n //UIG fix\n if (oCallback.getReturnValue('Error') == 'No')\n pdfs(\"wfFrame\" + pdf(\"CurrentDesk\")).HasChanges = true;\n oCallback = null;\n el(\"hdnFileName\").value = ''\n hideLayer();\n showDiv(\"btnSubmit\");\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 escrever(){\n fs.writeFile(\"./output/dados.txt\",\"Hello World\", (err) => {\n console.log(\"Erro durante o salvamento...\")\n })\n}", "_uploadImage(file) {\n if (!this._isImage(file)) {\n return;\n }\n\n const userFileAttachment = new RB.UserFileAttachment({\n caption: file.name,\n });\n\n userFileAttachment.save()\n .then(() => {\n this.insertLine(\n `![Image](${userFileAttachment.get('downloadURL')})`);\n\n userFileAttachment.set('file', file);\n userFileAttachment.save()\n .catch(err => alert(err.message));\n })\n .catch(err => alert(err.message));\n }", "function insertObject(event) {\n try{\n var fileData = event.target.files[0];\n }\n catch(e) {\n //'Insert Object' selected from the API Commands select list\n //Display insert object button and then exit function\n filePicker.style.display = 'block';\n return;\n }\n const boundary = '-------314159265358979323846';\n const delimiter = \"\\r\\n--\" + boundary + \"\\r\\n\";\n const close_delim = \"\\r\\n--\" + boundary + \"--\";\n\n var reader = new FileReader();\n reader.readAsBinaryString(fileData);\n reader.onload = function(e) {\n var contentType = fileData.type || 'application/octet-stream';\n var metadata = {\n 'name': fileData.name,\n 'mimeType': contentType\n };\n\n var base64Data = btoa(reader.result);\n var multipartRequestBody =\n delimiter +\n 'Content-Type: application/json\\r\\n\\r\\n' +\n JSON.stringify(metadata) +\n delimiter +\n 'Content-Type: ' + contentType + '\\r\\n' +\n 'Content-Transfer-Encoding: base64\\r\\n' +\n '\\r\\n' +\n base64Data +\n close_delim;\n\n //Note: gapi.client.storage.objects.insert() can only insert\n //small objects (under 64k) so to support larger file sizes\n //we're using the generic HTTP request method gapi.client.request()\n var request = gapi.client.request({\n 'path': '/upload/storage/' + API_VERSION + '/b/' + BUCKET + '/o',\n 'method': 'POST',\n 'params': {'uploadType': 'multipart'},\n 'headers': {\n 'Content-Type': 'multipart/mixed; boundary=\"' + boundary + '\"'\n },\n 'body': multipartRequestBody});\n //Remove the current API result entry in the main-content div\n listChildren = document.getElementById('main-content').childNodes;\n if (listChildren.length > 1) {\n listChildren[1].parentNode.removeChild(listChildren[1]);\n }\n try{\n //Execute the insert object request\n executeRequest(request, 'insertObject');\n //Store the name of the inserted object\n object = fileData.name;\n }\n catch(e) {\n alert('An error has occurred: ' + e.message);\n }\n }\n}", "function onUpload(files) {\n\tvar file = files[0]\n\tconsole.log(\"sending to background\")\n\t// Sending the file to background\n\tsendToBackground(file)\n}", "function fileUploadDone() {\n signale.complete('File upload done');\n}", "function insert_asset(){ \t\n try{\n\t\tvar url = getUrl(this.href);\n\t\t$.get(url,{}, function(data){\n\t\t\t//insert into editor(tinyMCE is global)\n\t\t\ttinyMCE.execCommand('mceInsertContent', false, data); \n\t\t});\n\t}catch(e){ alert(\"insert asset: \"+ e);}\n}", "function syncFile() {\n var insertAtText = '<files>';\n \n for (var i = 0; i < allMissingFiles.length; i++) {\n if (allMissingFiles[i].length) {\n var missingText = '';\n \n for (var x = 0; x < allMissingFiles[i].length; x++) {\n missingText += split + ' <file>/' + allMissingFiles[i][x] + '</file>';\n }\n var index = fileData[i].indexOf(insertAtText);\n fileData[i] = fileData[i].slice(0, (index + insertAtText.length)) + missingText + fileData[i].slice((index + insertAtText.length));\n var fullPath = root + bundleLocation + fileNames[i];\n dialog.logSomething('Writing to location', fullPath);\n file.writeFile(fullPath, fileData[i]);\n }\n }\n \n return ('And done.' + ((allowDialog)?' Please press enter to exit.':''));\n}", "insertSound({commit}, data){\n commit('insertActiveSound', data)\n }", "function loadClick(e, data)\n\t{\n\t\t$(data.popup).find('input[type=file]').unbind('change').bind('change', function(e){\n\n\t\t\tvar editor = data.editor;\n\n\t\t\tvar file = this.files[0];\n\n\t\t\tif (typeof file == 'object') {\n\t\t\t\tvar url = uploadUrl;\n\t\t\t\tvar alt = $(data.popup).find('input[name=alt]').val();\n\n\t\t\t\tuploadFile(file, url, function(response){\n\n\t\t\t\t\tvar html = '<img src=\"' + response + '\" alt=\"' + alt + '\"/>';\n\n\t\t\t\t\teditor.execCommand(data.command, html, null, data.button);\n\n\t\t\t\t\teditor.hidePopups();\n\t\t\t\t\teditor.focus();\n\t\t\t\t});\n\t\t\t}\n\n\n\t\t});\n\t}", "SaveAndReimport() {}", "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}", "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 upldOnlyFile(evt,Route,Ext,FB2ndRoute){\n\tevt.stopPropagation();\n\tevt.preventDefault();\n\n\tvar file = evt.target.files[0];\n\n\t// Prepara Metadata\n\tvar metadata = {'contentType': file.type};\n\t// Subir archivo con nombre nuevo\n\tvar uploadTask = firebase.storage().ref().child(Route+\"/\"+Ext).put(file, metadata);\n\t// Atender cambios de estado, errores, y fin de carga exitosa (almacenar URL).\n\tuploadTask.on('state_changed', function(estado) {\n\t\t// Obtener % de carga, mediante monto de bytes cargados / totales\n\t\tvar carga = (estado.bytesTransferred / estado.totalBytes) * 100;\n\t\tif(tst_logs)console.log('Cargando '+carga+'%...');\n\t\tprogBar.MaterialProgress.setBuffer(carga);\n\t\tswitch (estado.state) {\n\t\t\tcase firebase.storage.TaskState.PAUSED: // or 'paused'\n\t\t\t\tif(tst_logs)console.log('Carga Pausada!');\n\t\t\t\tbreak;\n\t\t\tcase firebase.storage.TaskState.RUNNING: // or 'running'\n\t\t\t\tif(tst_logs)console.log('Carga Corriendo...');\n\t\t\t\tbreak;\n\t\t}\n\t}, function(error) {\n\t\t// Si hay error\n\t\tconsole.error('Carga fallida:', error);\n\t\treject(error);\n\t}, function() {\n\t\tif(tst_logs)console.log('Cargados ',uploadTask.snapshot.totalBytes,'bytes.');\n\t\tprogBar.MaterialProgress.setProgress(30);\n\t\tprogBar.MaterialProgress.setBuffer(100);\n\t\tif(tst_logs)console.log(uploadTask.snapshot.metadata);\n\t\tvar url = uploadTask.snapshot.metadata.downloadURLs[0];\n\t\tvar name = uploadTask.snapshot.metadata.name;\n\t\tif(tst_logs)console.log(name+'- Archivo disponible aqui: ', url);\n\t\tprogBar.MaterialProgress.setProgress(50);\n\n\t\t// Almacenar 2da Referencia de archivos\n\t\tif(FB2ndRoute)firebase.database().ref(FB2ndRoute+\"/\"+Ext).transaction(function(current){\n\t\t\tprogBar.MaterialProgress.setProgress(90);\n\t\t\treturn url;\n\t\t}).catch(function(error){console.error(error.message);});\n\n\t\t// Almacenar Referencia de archivos\n\t\tfirebase.database().ref(Route+\"/\"+Ext).transaction(function(current){\n\t\t\tif(tst_logs)console.log(name+\"- Referencias Guardadas:\", url);\n\t\t\tprogBar.MaterialProgress.setProgress(100);\n\t\t\tsetTimeout('progBar.style.opacity=0',300);\n\t\t\treturn url;\n\t\t}).catch(function(error){console.error(error.message);});\n\n\t});\t// uploadTask\n}", "_controlUploadFile(event) {\n let file = event.target.files[0];\n let fileName = file.name;\n let fileType = fileName.split(\".\")[fileName.split(\".\").length - 1];\n\n if(this.options.tableRender) {\n let table = this._componentRoot.querySelector('[data-component=\"table-custom\"]');\n\n if(table) {\n this._inputData = [];\n table.parentNode.removeChild(table);\n }\n\n this.options.tableRender = false;\n }\n\n let chooseFields = this._componentRoot.querySelector(\"#chooseFields\");\n\n if (chooseFields) {\n chooseFields.parentNode.removeChild(chooseFields);\n }\n\n if(fileType !== 'csv') {\n\n noty({\n text: 'Файл ' + fileName + ' некорректный, выберите корректный файл, формата csv.',\n type: 'error',\n timeout: 3000\n });\n\n return;\n\n } else {\n\n noty({\n text: 'Был выбран файл ' + fileName + '.',\n type: 'success',\n timeout: 3000\n });\n }\n\n this._parseCSV(event, file);\n }", "function uploadFile(camino,nombre) {\n\t\talert(\"Manda archivo\");\n\t\talert(\"ubicacion:\"+camino);\n\t\tmediaFile.play();\n\t\talert(\"reproduce archivo\");\n var ft = new FileTransfer(),\n path = camino,\n name = nombre;\n\n ft.upload(path,\n \"http://www.swci.com.ar/audio/upload.php\", ///ACÁ va el php\n function(result) {\n alert('Upload success: ' + result.responseCode);\n alert(result.bytesSent + ' bytes sent');\n },\n function(error) {\n alert('Error uploading file ' + path + ': ' + error.code);\n },\n { fileName: name });\n }", "_savefile (index) {\n const save = this.shadowRoot.querySelector('#save')\n const bind = onClick.bind(this)\n const input = this.shadowRoot.querySelector('input')\n const text = this.shadowRoot.querySelector('textarea')\n save.addEventListener('click', bind)\n function onClick () {\n if (input.value.length !== 0) {\n var d = new Date()\n const hours = d.getHours()\n const minuites = d.getMinutes()\n let time\n if (hours >= 12) {\n time = hours + ':' + minuites + ' PM'\n } else {\n time = hours + ':' + minuites + ' AM'\n }\n this._upload(input.value, text.value, index, time)\n input.value = ''\n text.value = ''\n }\n save.removeEventListener('click', bind)\n }\n }", "handleOnClickFinalize() {\n this.startUpload();\n }", "function frameInsertHandler(e) {\n\n var modal = $(this).parents('[role=\"filemanager-modal\"]');\n\n $(this).contents().find(\".redactor\").on('click', '[role=\"insert\"]', function(e) {\n e.preventDefault();\n\n var fileInputs = $(this).parents('[role=\"file-inputs\"]'),\n mediafileContainer = $(modal.attr(\"data-mediafile-container\")),\n titleContainer = $(modal.attr(\"data-title-container\")),\n descriptionContainer = $(modal.attr(\"data-description-container\")),\n insertedData = modal.attr(\"data-inserted-data\"),\n mainInput = $(\"#\" + modal.attr(\"data-input-id\"));\n\n mainInput.trigger(\"fileInsert\", [insertedData]);\n\n if (mediafileContainer) {\n var fileType = fileInputs.attr(\"data-file-type\"),\n fileTypeShort = fileType.split('/')[0],\n fileUrl = fileInputs.attr(\"data-file-url\"),\n baseUrl = fileInputs.attr(\"data-base-url\"),\n previewOptions = {\n fileType: fileType,\n fileUrl: fileUrl,\n baseUrl: baseUrl\n };\n\n if (fileTypeShort === 'image' || fileTypeShort === 'video' || fileTypeShort === 'audio') {\n previewOptions.main = {width: fileInputs.attr(\"data-original-preview-width\")};\n }\n\n var preview = getPreview(previewOptions);\n mediafileContainer.html(preview);\n\n /* Set title */\n if (titleContainer) {\n var titleValue = $(fileInputs.contents().find('[role=\"file-title\"]')).val();\n titleContainer.html(titleValue);\n }\n\n /* Set description */\n if (descriptionContainer) {\n var descriptionValue = $(fileInputs.contents().find('[role=\"file-description\"]')).val();\n descriptionContainer.html(descriptionValue);\n }\n }\n\n mainInput.val(fileInputs.attr(\"data-file-\" + insertedData));\n modal.modal(\"hide\");\n });\n }", "saveFile() {\n lively.warn(\"#TODO implement save\")\n }", "addFile()\n\t{\n\t\t// Obtenemos las filas\n\t\tthis.controlFilas++; // Aumentamos el control\n\n\t\t// Obtenemos la tabla\n\t\tlet table = document.getElementById('dato-agrupado');\n\t\t// Insertamos una fila en la penultima posicion\n\t\tlet row = table.insertRow(parseInt(table.rows.length) - 1);\n\t\t// Agregamos la primer columna\n\t\tlet cell1 = row.insertCell(0);\n\t\tlet text = document.createTextNode(this.letter[this.controlFilas - 1]);\n\t\tcell1.appendChild(text);\n\t\tlet cell2 = row.insertCell(1);\n\t\tcell2.innerHTML = \"De <input type='text' id='\"+this.controlFilas+\"1' class='agrupado' placeholder='Valor' onkeyup=datoAgrupado.moveColumn(event)>A<input type='text' id='\"+this.controlFilas+\"2' class='agrupado' onkeyup=datoAgrupado.moveColumn(event) placeholder='Valor'>\";\n\t\tlet cell3 = row.insertCell(2);\n\t\tcell3.setAttribute('id', this.controlFilas+'f');\n\t\tlet cell4 = row.insertCell(3);\n\t\tcell4.innerHTML = \"<input type='text' id='\"+this.controlFilas+\"3' onkeyup=datoAgrupado.keyAgrupado(event) placeholder='Valor'>\";\n\t\t\n\t\t// Hacemos focus\n\t\tdocument.getElementById(this.controlFilas + '1').focus();\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 escribir(ruta, contenido, callbackDos) {\n // Accedemos al método de writeFile de fs, este necesita los 3 parametros\n fs.writeFile(ruta, contenido, function (err) {\n if (err) {\n console.error(\"No he podido escribirlo\", err)\n } else {\n console.log(\"Se ha escrito correctamente\");\n }\n })\n}", "async uploadTemplateFile(filePath){\n await this.tmTab.getImportTemplateDragNDrop().then(async elem => {\n await elem.sendKeys(process.cwd() + '/' + filePath).then(async () => {\n await this.delay(200); //debug wait - todo better wait\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 fileDialogStart()\n {\n \t$swfUpload.cancelUpload();\n \n if (typeof(handlers.file_dialog_start_handler) == 'function')\n {\n handlers.file_dialog_start_handler();\n }\n }", "function addFile(filepath)\r\n{\r\n var tbl = document.getElementById('myfilebody');\r\n\r\n if ((tbl.rows.length == 1) && (tbl.rows[0].getAttribute(\"id\") == \"nofile\")) {\r\n tbl.deleteRow(0);\r\n }\r\n\r\n var lastRow = tbl.rows.length;\r\n\r\n var box1 = document.getElementById('lineBox1');\r\n var box2 = document.getElementById('lineBox2');\r\n var revBox = document.getElementById('fileRevVal');\r\n\r\n var saveLine = filepath + \",\" + revBox.value + \",\" + box1.value + \",\" + box2.value;\r\n\r\n if(document.getElementById(saveLine + 'id') != null) {\r\n alert(\"Specified combination of filename, revision, and line numbers is already included in the file list.\");\r\n return;\r\n }\r\n\r\n var row = tbl.insertRow(lastRow);\r\n\r\n var files = document.getElementById('FilesSelected');\r\n files.setAttribute('value', files.value + saveLine + \"#\");\r\n\r\n //Create the entry in the actual table in the page\r\n\r\n row.id = saveLine + 'id';\r\n var cellLeft = row.insertCell(0);\r\n cellLeft.innerHTML = \"<\" + \"a href=\\\"javascript:removefile('\" + saveLine + \"')\\\">\" + filepath + \"</a>\";\r\n cellLeft.setAttribute('value', saveLine);\r\n row.appendChild(cellLeft);\r\n cellLeft = row.insertCell(1);\r\n cellLeft.innerHTML = box1.value;\r\n row.appendChild(cellLeft);\r\n cellLeft = row.insertCell(2);\r\n cellLeft.innerHTML = box2.value;\r\n row.appendChild(cellLeft);\r\n cellLeft = row.insertCell(3);\r\n cellLeft.innerHTML = revBox.value;\r\n row.appendChild(cellLeft);\r\n\r\n colorTable('myfilebody');\r\n}", "function writeFile() {\r\n if (!'indexedDB' in window) {\r\n console.log(\" your browser doesnt support indexDB\");\r\n // return;\r\n }\r\n const databaseName = \"TextEditorDB\";\r\n const DBname = window.indexedDB.open(databaseName);\r\n DBname.onupgradeneeded = () => {\r\n let db = DBname.result;\r\n let store = db.createObjectStore(\"Files\", { autoIncrement: true });\r\n // put method\r\n store.put({ name: \"file1\", format: \"text\" });\r\n }\r\n DBname.onsuccess = () => {\r\n if (DBname.readyState == \"done\") {\r\n console.log(\"Data is successfully loaded\");\r\n }\r\n }\r\n}", "function upload(source, child){\n var trendinfo;\n try{\n trendinfo = JSON.parse(fs.readFileSync(source, 'utf8'));\n }catch (e) {\n console.log(\"\\n\"+source + \" is not exist. check json file again\\n\");\n process.exit(0);\n }\n\n var db = accessApp.database();\n var ref = db.ref(child);\n\n setTimeout (function () {\n ref.set(trendinfo);\n l = source.split(\"/\")\n filename = l[l.length-1]\n console.log ( \"finish set \"+filename);\n process.exit(0);\n }, 2000);\n\n}", "function saveFile(filename, content) {\n filesystem.root.getFile(\n filename,\n { create: true },\n function (fileEntry) {\n fileEntry.createWriter(function (fileWriter) {\n fileWriter.onwriteend = function (e) {\n // Update the file browser.\n listFiles();\n\n // Clean out the form field.\n filenameInput.value = \"\";\n contentTextArea.value = \"\";\n\n // Show a saved message.\n messageBox.innerHTML = \"File saved!\";\n };\n\n fileWriter.onerror = function (e) {\n console.log(\"Write error: \" + e.toString());\n alert(\"An error occurred and your file could not be saved!\");\n };\n\n var contentBlob = new Blob([content], { type: \"text/plain\" });\n\n fileWriter.write(contentBlob);\n }, errorHandler);\n },\n errorHandler\n );\n}", "function addDefferedFileAction(success, error) {\n actions.success.push(success);\n actions.error.push(error); \n}", "function actionFileExists() {\r\n // We want to delete the file\r\n fs.unlink(realPathFile, (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 file was deleted');\r\n // Now we want to write the content of the file to the file\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 }\r\n });\r\n}", "function sendFile(file, editor, welEditable) {\n data = new FormData();\n data.append(\"file\", file);\n $.ajax({\n data: data,\n type: \"POST\",\n url: root_url + \"/product/uploadimage\",\n cache: false,\n contentType: false,\n processData: false,\n success: function(response) {\n var url = static_url + response._result.file.path;\n editor.insertImage(welEditable, url);\n }\n });\n }", "onSaveAsFile() {\n this.setState({ showModal: false, isMnemonicCopied: true });\n }", "function removeFile(thisFile, data) {\n thisFile.closest('.upload-wrapper').find('.upload-file .file-name').text(data);\n }", "function onItemFileDrop( event ){\n ctrl.addFile( event.dataTransfer.files[0] );\n }", "function moveToNewFile(message) {\n console.log(message);\n}", "create() {\n this.proc.args.file = null;\n\n this.emit('new-file');\n\n this.updateWindowTitle();\n }", "function saveAs() {\n\tlet content = editor.getText();\n\n\tdialog.showSaveDialog(\n\t\trequire(\"electron\").remote.getCurrentWindow(),\n\t\t{\n\t\t\tfilters: [\n\t\t\t\t{ name: \"BTML files\", extensions: [\"btml\"] },\n\t\t\t\t{ name: \"All Files\", extensions: [\"*\"] }\n\t\t\t]\n\t\t},\n\t\tfilename => {\n\t\t\tif (filename === undefined) {\n\t\t\t\tdebug.log(\"No file selected\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfs.writeFile(filename, content, err => {\n\t\t\t\tif (err) {\n\t\t\t\t\tdebug.error(\n\t\t\t\t\t\t\"An error ocurred creating the file \" + err.message\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tpathToFileBeingEdited = filename;\n\t\t\t\tdebug.log(\"The file has been succesfully saved\");\n\t\t\t});\n\t\t}\n\t);\n}", "function upload(evt) {\n\t file = evt.target.files[0];\n\t console.log(\"yikes!!!\", file);\n\t var reader = new FileReader();\n\t reader.readAsText(file);\n\t \treader.onload = loaded;\n\t}", "goodFile() {\n $('.pcm_importStatus').html('Data from file ready to be imported.').css('color','#dbfd23');\n $('.pcm_importButton').removeClass('disabled').prop(\"disabled\",false);\n }", "function userSavesHandler() {\n\tif (!filepath) {\n\t\tdialog.showSaveDialog(savePathChosenHandler);\n\t} else {\n\t\twriteToFile(filepath)\n\t}\n}", "function onWriteEnd() {\n chrome.storage.sync.get( [ 'token' ] , function( config ) {\n\n chrome.tabs.query({ active: true, currentWindow: true }, function( tabs ) {\n chrome.tabs.sendMessage( tabs[0].id, { 'type': 'openCloudAppDashboard' });\n });\n\n CloudAppApi.setFileBlob( blob );\n CloudAppApi.setFileName( filename );\n var res = CloudAppApi.upload(\n config.token,\n function ( response ) {\n // Open a new tab as soon as we get the slug.\n if ( response.slug != null ) {\n chrome.tabs.query({ active: true, currentWindow: true }, function( tabs ) {\n chrome.tabs.sendMessage( tabs[0].id, { 'type': 'uploadProgressComplete' });\n });\n chrome.tabs.create( { url: dropUrlBase + response.slug } );\n }\n else {\n _createNotification( 'failure', null, 'Video uploaded but the app failed to redirect. Please refresh page and try again.' );\n }\n },\n function( response ) {\n // Upload successfully complete.\n _createNotification( 'Upload Complete!', 'success', response);\n },\n function( message ) {\n // Could not upload the file.\n _createNotification( 'Upload Failed', 'failure', null, 'Upload failed, please give another try' );\n },\n function( total, loaded, drop ) {\n var progressPercentage = Math.floor((loaded / total) * 100);\n chrome.tabs.query({ active: true, currentWindow: true }, function( tabs ) {\n chrome.tabs.sendMessage( tabs[0].id, { 'type': 'uploadProgress', 'percentage': progressPercentage, 'filename': filename, 'drop': drop });\n });\n },\n mimeType,\n actionType\n );\n });\n }", "function gotFileEntry(fileEntry) {\n\t\t\t\tfileEntry.moveTo(fs.root, fileEntry.name , fsSuccess, deuerro);\n\t\t\t}", "function importBM(){\n var impbutton = document.getElementById('importhead')\n impbutton.addEventListener('click', (ev)=>{\n var msg = document.getElementById('message')\n msg.style.display = 'block'\n msg.innerHTML = \"Importing... This can take a while!\"\n window.printBookmarks('0')\n window.postImportData(window.bookmarks_arr) \n })\n}", "runUserUpload() {\n\t\tconst input = document.createElement(\"input\");\n\t\tinput.type = \"file\";\n\t\tinput.onchange = (evt) => {\n\t\t\tconst reader = new FileReader();\n\t\t\treader.onloadend = (evt) => {\n\t\t\t\tthis.loadStoredCircuit(JSON.parse(evt.target.result));\n\t\t\t};\n\t\t\treader.readAsText(evt.target.files[0]);\n\t\t};\n\t\tinput.click();\n\t}", "function deleteFile(id) {\n chrome.runtime.sendMessage({\n type: \"remove\",\n id: id\n });\n}", "function deleteFile(mommy, fileList, deadFile) {\n\tfor (let i = deadFile; i < fileList.length-1; i++) {\n\t\tfileList[i] = fileList[i + 1]\n\t\tmommy.children[i].innerHTML = mommy.children[i + 1].innerHTML;\n\t\tmommy.children[i].classList = mommy.children[i + 1].classList;\n\t}\n\tmommy.children[mommy.children.length - 1].innerHTML = \"untitled\";\n\tmommy.children[mommy.children.length - 1].classList.add(\"off\");\n\tfileList[fileList.length -1 ] = ace.createEditSession(NEWSOURCE);\n\tfileList[fileList.length -1 ].setMode(\"ace/mode/minitab\");\n\treturn fileList;\n}", "function setText(){\n var bouton = document.getElementById('btn_file');\n var tabCheminfichier= bouton.value.split('\\\\'); \n document.getElementById('file_name').innerHTML = tabCheminfichier[tabCheminfichier.length-1];\n document.getElementById('url').value='';\n}", "function updateDropboxFile(newExpense) {\n dbx.filesDownload({ path: conf.get('filePath') })\n .then(function(response) {\n var buff = new Buffer(response.fileBinary);\n uploadFile(Buffer.concat([buff, new Buffer(newExpense)])); \n })\n .catch(function(error) {\n //console.log(error);\n });\n}", "function viewFile(file_id, file_nome, utente_id){\n $('#popup-file-nome').empty().append( file_nome );\n $('#popup-file-id').val( file_id );\n $('#popup-file-utente_id').val( utente_id );\n\n $('#popup-file').popup('open');\n}", "function uploadFile(){\n localUpload();\n publicUpload();\n alert(\"File uploaded.\\nWaiting to get analyze result.\");\n window.location.href = \"index.php?upload&filename=\" + fileName;\n }", "function uploadFile(mediaFile) {\r\n var ft = new FileTransfer(),\r\n path = mediaFile.fullPath,\r\n name = mediaFile.name;\r\n alert('gé3ed yab3ath');\r\n ft.upload(path,\"http://un.serveur.com/upload.php\",\r\n function(result) {\r\n console.log('Réussite du transfert : ' + result.responseCode);\r\n console.log(result.bytesSent + ' octets envoyés');\r\n },\r\n function(error) {\r\n console.log('Erreur lors du transfert du fichier ' + path + ' : ' + error.code);\r\n },\r\n { fileName: name }); \r\n }", "function done() {\n\t$destination.innerHTML = store + fileName;\n\t$status.innerHTML = \"Done\";\n}", "uploadPicturl () {\n const uploadTask = wx.uploadFile({\n url: this.data.uploadUrl,\n filePath: this.data.uploadImagePath,\n name: \"image\",\n success: res => {\n console.log(res);\n }\n });\n // 终止上传\n // uploadTask.abort();\n\n // Listen Upload Task\n uploadTask.onProgressUpdate(pro => {\n this.setData({\n progress: pro.progress\n })\n if (pro.progress === 100) {\n setTimeout(() => {\n this.setData({ progress: 0 });\n }, 1200)\n }\n });\n }" ]
[ "0.68735355", "0.64927906", "0.62077713", "0.61448157", "0.6049083", "0.5986293", "0.5915053", "0.58955085", "0.587885", "0.58744836", "0.58110887", "0.5807969", "0.57775176", "0.5752871", "0.57418543", "0.5734034", "0.5730628", "0.5725759", "0.57099086", "0.56894624", "0.5618207", "0.5613185", "0.5610628", "0.558902", "0.55885977", "0.5572515", "0.5565153", "0.5555773", "0.5550962", "0.55354065", "0.5534485", "0.55150783", "0.5512893", "0.5511685", "0.54983926", "0.5476593", "0.54585487", "0.5458051", "0.54553115", "0.54466", "0.5428256", "0.53967255", "0.5392487", "0.5377365", "0.5373525", "0.5371393", "0.5363329", "0.53589857", "0.53372985", "0.5336244", "0.5327601", "0.5320082", "0.5304656", "0.52803516", "0.52791214", "0.5275775", "0.526874", "0.5255623", "0.5251131", "0.5245794", "0.52452445", "0.52451587", "0.52447927", "0.5244274", "0.5240123", "0.52133757", "0.52104837", "0.52100456", "0.5209275", "0.5205061", "0.520458", "0.5201573", "0.5200637", "0.51941615", "0.51924556", "0.5191649", "0.51876605", "0.51824594", "0.5178652", "0.51701844", "0.51683867", "0.5167399", "0.5160786", "0.5155925", "0.51540464", "0.51507795", "0.5147953", "0.5147672", "0.5143599", "0.5138909", "0.5138404", "0.51328486", "0.5125671", "0.5120036", "0.5119191", "0.51152277", "0.5110708", "0.510319", "0.50968236", "0.5096707", "0.50928193" ]
0.0
-1
escucha del Boton para insertar un file
function clickFileItenAdmin(id) { var idchan = '#imgLog' + id; var idchankey = 'imgLog' + id; $(idchan).click(); const imgFile = document.getElementById(idchankey); imgFile.addEventListener("change", function () { const file = this.files[0]; var tmppath = URL.createObjectURL(this.files[0]); var yave = '#ImganItenAdmin' + id; if (file) { const render = new FileReader(); render.addEventListener("load", function (event) { console.log(this.result); $(yave).attr("src", this.result); $(yave).attr("value", $(idchan).val()); }); render.readAsDataURL(file); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function insertFile(file) {\n uploadFile(file, function (url) {\n var text = \"[img]\" + url + \"[/img]\";\n typeInTextarea(text);\n });\n }", "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 guardarTextoComoArchivo() {\n // Sacar el texto que actualmente esta en el area de texto\n var texto = document.getElementById(\"textoAGuardar\").value;\n\n // Convertir el texto en un tipo de data BLOB\n var textoBlob = new Blob([texto], { type: \"text/plain\" });\n // Crear el URL para descargar el archivo con el BLOB\n var textoURL = window.URL.createObjectURL(textoBlob);\n //Sacar el nombre que el usuario quiera asignar al archivo\n var nombreArchivoAGuardar = document.getElementById(\"nombreArchivoAGuardar\").value;\n\n // Crear elemento para construir el link de descarga\n var linkDescarga = document.createElement(\"a\");\n // Crear el atributo de descarga con el URL y agregar .txt para descargarlo de formato correcto\n linkDescarga.download = nombreArchivoAGuardar + \".txt\";\n // Configuraciones internas del HTML para que funcione como link de descarga\n linkDescarga.innerHTML = \"Descargar Archivo\";\n // Apuntar el elemento HTML creado al URL creada\n linkDescarga.href = textoURL;\n // Despues de hacerle click al element destruirlo para volver a descargar\n linkDescarga.onclick = destruirElemento;\n // Omitir estilos para mantener mismo boton\n linkDescarga.style.display = \"none\";\n //Agregar link de descarga al codigo HTML\n document.body.appendChild(linkDescarga);\n\n // Hacer el llamado de click para iniciar la descarga\n linkDescarga.click();\n}", "saveToFile() {\r\n saveFile({\r\n idParent: this.currentOceanRequest.id,\r\n fileType: this.fileType,\r\n strFileName: this.fileName\r\n })\r\n .then(() => {\r\n // refreshing the datatable\r\n this.getRelatedFiles();\r\n })\r\n .catch(error => {\r\n // Showing errors if any while inserting the files\r\n this.dispatchEvent(\r\n new ShowToastEvent({\r\n title: \"Error while uploading File\",\r\n message: error.message,\r\n variant: \"error\"\r\n })\r\n );\r\n });\r\n }", "function uploadSavedataPending(file) {\n runCommands.push(function () { \n gba.loadSavedataFromFile(file) \n });\n }", "_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 onEditDialogSave(){\r\n\t\t\r\n\t\tif(!g_codeMirror)\r\n\t\t\tthrow new Error(\"Codemirror editor not found\");\r\n\t\t\r\n\t\tvar content = g_codeMirror.getValue();\r\n\t\tvar objDialog = jQuery(\"#uc_dialog_edit_file\");\r\n\t\t\r\n\t\tvar item = objDialog.data(\"item\");\r\n\t\t\r\n\t\tvar data = {filename: item.file, path: g_activePath, pathkey: g_pathKey, content: content};\r\n\t\t\r\n\t\tg_ucAdmin.setAjaxLoaderID(\"uc_dialog_edit_file_loadersaving\");\r\n\t\tg_ucAdmin.setErrorMessageID(\"uc_dialog_edit_file_error\");\r\n\t\tg_ucAdmin.setSuccessMessageID(\"uc_dialog_edit_file_success\");\r\n\t\t\r\n\t\tassetsAjaxRequest(\"assets_save_file\", data);\r\n\t\t\r\n\t}", "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 addFile(row, col, action) {\n\t\t\tconsole.log(\"add file example\", row);\n\t\t\tvar d = new Date();\n\t\t\tvar modifyItem = row.entity;\n\t\t\tif(modifyItem != undefined){\n\t\t\t\tmodifyItem.filename='newfile.jpg';\n\t\t\t\tmodifyItem.serial=10;\n\t\t\t\tmodifyItem.date = d;\n\t\t\t}\n\t\t\t//update actions\n\t\t\tvar showButton = (modifyItem.filename && modifyItem.filename != \"\") ? false : true;\n\t\t\tmodifyItem.actions = [\n\t\t\t\t{field: modifyItem.filename, actionFieldType: enums.actionFieldType.getName(\"Text\"), cssClass: \"\"},\n\t\t\t\t{field: 'fa fa-search', actionFieldType: enums.actionFieldType.getName(\"Icon\"), function: searchFunc, showControl: !showButton},\n\t\t\t\t{field: 'fa fa-eye', actionFieldType: enums.actionFieldType.getName(\"Icon\"), function: editFunc, showControl: !showButton},\n\t\t\t\t{field: '/ignoreImages/si_close_entity_normal.png', actionFieldType: enums.actionFieldType.getName(\"Image\"), height: \"16\", width: \"16\", function: deleteFunc, cssClass: \"\", showControl: !showButton},\n\t\t\t\t{field: 'Add File', title: 'Add File', actionFieldType: enums.actionFieldType.getName(\"Button\"), function: addFile, showControl: showButton}\n\t\t\t]\n\t\t\tvar showRowLock = modifyItem.isSelected;\n\t\t\tmodifyItem.lock = [\n\t\t\t\t{field: 'fa fa-check', actionFieldType: enums.actionFieldType.getName(\"Icon\"), showControl: showRowLock}\n\t\t\t]\n\t\t}", "saveDialog() {\n content = JSON.stringify(datastore.getDevices());\n dialog.showSaveDialog({ filters: [\n { name: 'TellSec-Dokument', extensions: ['tell'] }\n ]},(fileName) => {\n if (fileName === undefined) {\n console.log(\"Du hast die Datei nicht gespeichert\");\n return;\n }\n fileName = fileName.split('.tell')[0] \n fs.writeFile(fileName+\".tell\", content, (err) => {\n if (err) {\n alert(\"Ein Fehler tritt während der Erstellung der Datei auf \" + err.message)\n }\n alert(\"Die Datei wurde erfolgreich gespeichert\");\n });\n });\n }", "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}", "supprCloudCallback(confirmCallBack) {\n var option = this.saveView.cloudSelectFile.options[this.saveView.cloudSelectFile.selectedIndex];\n var id = option.value;\n this.drive.trashFile(id);\n confirmCallBack();\n }", "putFile(path,data,callback) { this.engine.putFile(path,data,callback); }", "function handleFileUploadSubmit2(e) {\n const uploadTask = storageRef.child(`${idPlace}/2`).put(selectedFile); //create a child directory called images, and place the file inside this directory\n document.querySelector('#file-submit_2').disabled = true;\n document.querySelector('#file-submit_2').innerHTML = 'subiendo';\n uploadTask.on('state_changed', (snapshot) => {\n // Observe state change events such as progress, pause, and resume\n }, (error) => {\n // Handle unsuccessful uploads\n console.log(error);\n }, () => {\n // Do something once upload is complete\n uploadTask.then(snapshot => snapshot.ref.getDownloadURL())\n .then((url) => {\n database.ref('/'+idPlace+'/feed_2').set({\n 'url': url,\n\t\t\t\t\t\t'placeName': placeName\n });\n fileObject.target.value = ''\n document.querySelector('#file-submit_2').innerHTML = 'listo';\n document.querySelector('#file-submit_2').removeAttribute('disabled');\n })\n .catch(console.error);\n });\n }", "function upload()\n {\n messageBox.confirm({\n \"title\": \"Import Tasks\",\n \"message\": \"Do you wish import a file with your tasks?\",\n \"success\": function(e){\n var successFile = function(reason){\n if( window.cordova ){\n window.plugins.toast.show(reason, 'long', 'top');\n }\n BadgeHelper.redirectBadge();\n },\n errorFile = function(reason){\n Log.err(\"$cordovaFile.writeFile.err: \"+reason);\n messageBox.alert('Validation Error', reason, $rootScope, [{\n text: '<b>Ok</b>',\n type: 'button-blue-inverse',\n onTap: function(e){\n BadgeHelper.redirectBadge();\n }\n }]);\n };\n if( 'fileChooser' in window)\n {\n window.fileChooser.open(function(uri) {\n Log.success(\"window.fileChooser.open.success: \"+uri);\n window.FilePath.resolveNativePath(uri, function(fileName){\n Log.success(\"window.FilePath.resolveNativePath.success: \"+fileName);\n window.resolveLocalFileSystemURL(fileName, function (fileEntry)\n {\n Log.success(\"window.resolveLocalFileSystemURL.success: \", fileEntry);\n fileEntry.file(function (file) { \n saveByExport(file).then(successFile, errorFile);\n });\n });\n });\n });\n }\n else{\n var element = document.getElementById('upload-file-item');\n element.value = \"\";\n element.click();\n \n element.onchange = function()\n {\n saveByExport(this.files[0]).then(successFile, errorFile);\n };\n }\n }\n });\n }", "function newFile(){\n var decision = confirm(\"Operacja spowoduje usunięcie danych aktualnego testu. Kontynuować?\");\n if(decision){\n window.localStorage.clear();\n location.reload();\n }\n}", "function saveFile(){\n socket.emit(\"save_file\",\n {\n room:roomname,\n user:username,\n text:editor.getSession().getValue()\n });\n}", "function handleFileUploadSubmit3(e) {\n const uploadTask = storageRef.child(`${idPlace}/3`).put(selectedFile); //create a child directory called images, and place the file inside this directory\n document.querySelector('#file-submit_3').disabled = true;\n document.querySelector('#file-submit_3').innerHTML = 'subiendo';\n uploadTask.on('state_changed', (snapshot) => {\n // Observe state change events such as progress, pause, and resume\n }, (error) => {\n // Handle unsuccessful uploads\n console.log(error);\n }, () => {\n // Do something once upload is complete\n uploadTask.then(snapshot => snapshot.ref.getDownloadURL())\n .then((url) => {\n database.ref('/'+idPlace+'/feed_3').set({\n 'url': url,\n\t\t\t\t\t\t'placeName': placeName\n });\n fileObject.target.value = ''\n document.querySelector('#file-submit_3').innerHTML = 'listo';\n document.querySelector('#file-submit_3').removeAttribute('disabled');\n })\n .catch(console.error);\n });\n }", "importDB() {\r\n document.getElementById('file-upload-import').click();\r\n }", "function loadfile() {\n // pop up a file upload dialog\n // when file is received, send to server and populate db with it\n}", "function uploadComplete(file_id){\n var content = \"<tr class='file' name='\" + fileName + \"'lookup='\" +\n file_id + \"'><td><i class='icon-file'></i>\" +\n fileName + \"</td><td><button class='btn delete'>\"\n + \"<i class='icon-remove'></i>delete</button></td></tr>\";\n $(\"#folder_view\").append(content);\n $(\"#upload_file\").empty();\n}", "function InsertPicture(_1){\r\nif(typeof _editor_picturePath!==\"string\"){\r\n_editor_picturePath=Xinha.getPluginDir(\"InsertPicture\")+\"/demo_pictures/\";\r\n}\r\nInsertPicture.Scripting=\"php\";\r\n_1.config.URIs.insert_image=\"../plugins/InsertPicture/InsertPicture.\"+InsertPicture.Scripting+\"?picturepath=\"+_editor_picturePath;\r\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", "function CrearBtUploadImg(){\n\t\n\t var argv = CrearBtUploadImg.arguments;\n\t var BotonId = argv[0];\n\t var idImgMostrar = argv[1];\n\t var divGuardar = argv[2];\n\t var inputSize = argv[3];\n\t var inputName = argv[4];\n\t var inputFile = argv[5];\n\t\n\t var uploader = new qq.FileUploader({\n element: document.getElementById(BotonId),\n action: 'mul_multimedia_carga_temporal.php',\n multiple: false,\n template: '<div class=\"qq-uploader\">' +\n '<div class=\"qq-upload-drop-area\" style=\"display: none;\"><span>Drop files here to upload</span></div>' +\n '<div class=\"qq-upload-button\" style=\"height:17px;\">Seleccione un archivo</div>' +\n '<div class=\"qq-upload-size\"></div>' +\n '<ul class=\"qq-upload-list\"></ul>' + \n '</div>', \n\n onComplete: function(id, fileName, responseJSON) {\n\t\t\t\t var htmlmostrar = responseJSON.archivo.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');\n\t\t\t\t $(idImgMostrar).html(htmlmostrar);\n\t\t\t\t $(inputSize).val(responseJSON.size);\n\t\t\t\t $(inputName).val(responseJSON.nombrearchivo);\n\t\t\t\t $(inputFile).val(responseJSON.nombrearchivotmp);\n\t\t\t\t $(divGuardar).show();\n },\n messages: {\n },\n debug: false\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 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 fc_UploadFile_Limpiar(idUpload){\n f = document.getElementById(idUpload);\n nuevoFile = document.createElement('input');\n nuevoFile.id = f.id;\n nuevoFile.type = 'file';\n nuevoFile.name = f.name;\n nuevoFile.value = '';\n nuevoFile.className = f.className;\n nuevoFile.onchange = f.onchange;\n nuevoFile.style.width = f.style.width;\n nodoPadre = f.parentNode;\n nodoSiguiente = f.nextSibling;\n nodoPadre.removeChild(f);\n (nodoSiguiente == null) ? nodoPadre.appendChild(nuevoFile):\n nodoPadre.insertBefore(nuevoFile, nodoSiguiente);\n}", "function Update () {\n//System.IO.File.AppendAllText(fileLocation + \"/DINGBAT2.txt\", ArduinoValue.ToString());\n//System.IO.File.AppendAllText(fileLocation + \"/DINGBAT2.txt\", \" \" + Time.time.ToString());\nif (!CreatedFile){\n//print(\"file Not created!\");\nreturn;}\nelse{\nWriteDatatoFile();\n//srs.Close();\n}\n}", "uploadFileFaust(app, module, x, y, e, dsp_code) {\n var files = e.dataTransfer.files;\n var file = files[0];\n this.loadFile(file, module, x, y);\n }", "function upload() {\n\tconst input = document.createElement('input');\n\tinput.type = 'file';\n\tdocument.body.appendChild(input);\n\tinput.classList.add('hidden');\n\tinput.click();\n\tinput.onchange = async () => {\n\t\tconst files = input.files;\n\t\tconst text = await files[0].text()\n\t\tconst savedGame = JSON.parse(text);\n\t\tload(savedGame);\n\t\temptyBlockListeners();\n\t\tdocument.body.removeChild(input);\n\t}\n}", "function handleFileUploadSubmit4(e) {\n const uploadTask = storageRef.child(`${idPlace}/4`).put(selectedFile); //create a child directory called images, and place the file inside this directory\n document.querySelector('#file-submit_4').disabled = true\n document.querySelector('#file-submit_4').innerHTML = 'subiendo'\n uploadTask.on('state_changed', (snapshot) => {\n // Observe state change events such as progress, pause, and resume\n }, (error) => {\n // Handle unsuccessful uploads\n console.log(error);\n }, () => {\n // Do something once upload is complete\n uploadTask.then(snapshot => snapshot.ref.getDownloadURL())\n .then((url) => {\n database.ref('/'+idPlace+'/feed_4').set({\n 'url': url,\n\t\t\t\t\t\t'placeName': placeName\n });\n fileObject.target.value = ''\n document.querySelector('#file-submit_4').innerHTML = 'listo'\n document.querySelector('#file-submit_4').removeAttribute('disabled');\n })\n .catch(console.error);\n });\n }//end handleFileUploadSubmit2", "saveFile(fileName, ext, data) {\r\n fs.writeFile('output/'+fileName+'.'+ext.toLowerCase(), data, (err) => {\r\n if(err) {\r\n fs.mkdir('output', (e) => {\r\n if(!e || (e && e.code === 'EEXIST')){ \r\n fs.writeFile('output/'+fileName+'.'+ext.toLowerCase(), data, (err) => {\r\n if(err) {\r\n alert(err)\r\n } else {\r\n dialog.showMessageBox(null, {\r\n type: 'info',\r\n buttons: ['&Ok'],\r\n defaultId: 0,\r\n title: 'Live Web Editor',\r\n message: 'File '+ext+' saved successfully!',\r\n noLink: true,\r\n normalizeAccessKeys: true\r\n })\r\n }\r\n })\r\n }\r\n })\r\n } else {\r\n dialog.showMessageBox(null, {\r\n type: 'info',\r\n buttons: ['&Ok'],\r\n defaultId: 0,\r\n title: 'Live Web Editor',\r\n message: 'File '+ext+' saved successfully!',\r\n noLink: true,\r\n normalizeAccessKeys: true\r\n })\r\n }\r\n })\r\n // Hide the dropdown\r\n document.getElementsByClassName('dropdown-content')[0].style.display = 'none'\r\n }", "function uploadFile(err, url){\n\n instance.publishState('created_file', url);\n instance.triggerEvent('has_created_your_file')\n\n if (err){\n\n console.log('error '+ err);\n\n }\n\n }", "function uploadFile(fileContent) {\n dbx.filesUpload({\n contents: fileContent,\n path: conf.get('filePath'),\n mode: \"overwrite\"\n }).then(function(response) {\n //console.log(JSON.stringify(response));\n }).catch(function(error) {\n //console.log(JSON.stringify(error.response));\n });\n}", "addFileX(event) {\n let aFile = event.target.files[0];\n if (aFile.type === \"text/plain\"){\n this.files[0] = aFile;\n } \n }", "function deleteThisFile () {\n // only hide the file\n $thisFile.hide();\n // trigger a file deletion operations\n self.emit('_deleteFile', $thisFile.find(ps).text(), function(err) {\n // show back the file on error or remove on success\n if (err) {\n $thisFile.fadeIn();\n } else {\n $thisFile.remove();\n }\n });\n }", "function save() {\n\t\t$$invalidate(1, excluded_files = allExcludedFiles());\n\t\tplugin.settings.set({ exluded_filename_components });\n\t}", "function successMove2(entry) {\n //I do my insert with \"entry.fullPath\" as for the path\n //app.finForm();\n //enable button\n document.getElementById(\"fnFrm\").disabled = false;\n}", "function borradoElemento () {\n\t/*\n\tinit_listener_file_upload();\n\t$(\".combo_tipo_doc\").val(\"\");\n\tfileUploadPreview ();\n\t\n\t\n\t\tcloseFancy();\n\t\n\t*/\n}", "function onDelete() {\n setFileURL(false)\n console.log(\"delete file\");\n }", "function subirArchivo( archivo ) {\n openModalLoader();\n var key = vm.saveKeyUpload;\n // referencia al lugar donde guardaremos el archivo\n var refStorage = storageService.ref(key).child(archivo.name);\n // Comienza la tarea de upload\n var uploadTask = refStorage.put(archivo);\n\n uploadTask.on('state_changed', function(snapshot){\n // aqui podemos monitorear el proceso de carga del archivo\n }, function(error) {\n vm.modalLoader.dismiss();\n swal(\"¡Error al cargar!\", \"No se pudo cargar el archivo\", \"error\");\n }, function() {\n var downloadURL = uploadTask.snapshot.downloadURL;\n firebase.database().ref('rh/tramitesProceso/' + key + '/archivos').push({\n 'nombreArchivo': archivo.name,\n 'rutaArchivo': downloadURL\n }).then(function(){\n vm.modalLoadFile.dismiss();\n vm.modalLoader.dismiss();\n swal(\"¡Carga Realizada!\", \"Carga del archivo exitosa\", \"success\");\n });\n });\n }", "function submitUpload() {\n el(\"divRecordNotFound\").style.display = \"none\";\n if (el(\"hdnFileName\").value != '') {\n var tablename = getQStr(\"tablename\");\n if (tablename.toUpperCase() == \"TARIFF\" || tablename.toUpperCase() == \"TARIFF_CODE_DETAIL\") {\n showConfirmMessage(\"Do you really want to upload this File? This will Delete all the existing data from Database and Insert Data from the File.\",\n \"mfs().yesClickTariff();\", \"\", \"\");\n }\n else {\n hideDiv(\"btnSubmit\");\n showLayer(\"Loading..\");\n setTimeout(insertUploadTable, 0);\n }\n }\n else {\n showErrorMessage('Please Upload a file');\n el(\"divifgGrid\").style.display = \"none\";\n el(\"divlnk\").style.display = \"none\";\n }\n}", "function handleFileImport(evt) {\n var file = evt.target.files[0];\n var reader = new FileReader();\n reader.onload = function(e) {\n editor.setValue(e.target.result);\n };\n reader.onerror = function(e) {\n console.log(\"error\", e);\n };\n reader.readAsText(file);\n setStatusText(\"File imported.\");\n }", "function storeFile(fileRequest, username, callback) {\n db = app.get(\"db_conn\");\n grid = app.get(\"grid_conn\");\n\n // source - Inbox/Outbox/Upload\n // details - Some details about the file (doctor name (sender )for Inbox, user comments for Upload, doctor name (to whom it was sent) for Outbox)\n var source = '';\n var details = '';\n\n if (fileRequest.source) {\n source = fileRequest.source;\n }\n if (fileRequest.details) {\n details = fileRequest.details;\n }\n\n console.log(\"Storage PUT call\");\n //console.log(fileRequest);\n\n if (fileRequest.filename === undefined || fileRequest.filename.length < 1 || fileRequest.filename === null) {\n callback('Error, filname bad.');\n }\n\n if (fileRequest.file === undefined || fileRequest.file.length < 1 || fileRequest.file === null) {\n callback('Error, file bad.');\n }\n\n var fileType = 'binary/octet-stream';\n if (fileRequest.filename && fileRequest.filename.length > 3) {\n var extension = fileRequest.filename.substring(fileRequest.filename.lastIndexOf(\".\") + 1, fileRequest.filename.length);\n if (extension.toLowerCase() === 'xml') {\n fileType = 'text/xml';\n }\n }\n\n //console.log(\"---\");\n //console.log(fileRequest.file);\n //console.log(\"---\");\n\n try {\n var bb = blueButton(fileRequest.file);\n\n var bbMeta = bb.document();\n\n if (bbMeta.type === 'ccda') {\n fileType = \"CCDA\";\n }\n } catch (e) {\n //do nothing, keep original fileType\n console.log(e);\n }\n\n //TODO: Fix once auth is implemented.\n var buffer = new Buffer(fileRequest.file);\n grid.put(buffer, {\n metadata: {\n source: source,\n details: details,\n owner: username,\n parsedFlag: false\n },\n 'filename': fileRequest.filename,\n 'content_type': fileType\n }, function(err, fileInfo) {\n if (err) {\n throw err;\n }\n var recordId = fileInfo._id;\n //console.log(\"Record Stored in Gridfs: \" + recordId);\n callback(err, fileInfo);\n });\n\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 insertUploadTable() {\n var SchemaID = getQStr(\"SchemaID\");\n var oCallback = new Callback();\n oCallback.add(\"SchemaID\", SchemaID);\n oCallback.add(\"DepotId\", el(\"hdnDpt_ID\").value);\n oCallback.add(\"filename\", el(\"hdnFileName\").value);\n oCallback.add(\"USERNAME\", getQStr(\"USERNAME\"));\n oCallback.add(\"TableName\", getQStr(\"tablename\"));\n oCallback.add(\"Size\", getQStr(\"Size\"));\n oCallback.add(\"Type\", getQStr(\"Type\"));\n oCallback.add(\"Cstmr_id\", getQStr(\"Cstmr_id\"));\n oCallback.add(\"TariffId\", getQStr(\"TariffId\"));\n\n oCallback.invoke(\"Upload.aspx\", \"InsertFileUpload\");\n\n if (oCallback.getCallbackStatus()) {\n if (oCallback.getReturnValue('Message') != '' && oCallback.getReturnValue('Message') != null) {\n showInfoMessage(oCallback.getReturnValue('Message'));\n if (typeof (pdfs('wfFrame' + pdf('CurrentDesk')).bindGrid()) != \"undefined\") {\n pdfs('wfFrame' + pdf('CurrentDesk')).bindGrid();\n }\n }\n else {\n showErrorMessage(oCallback.getReturnValue('Error'));\n }\n\n if (oCallback.getReturnValue('Upload') == 'yes') {\n bindGrid(oCallback.getReturnValue('IdCol'), \"Valid\", \"No\");\n el(\"hdnIdColumn\").value = oCallback.getReturnValue('IdCol');\n }\n }\n else {\n showErrorMessage(oCallback.getCallbackError());\n }\n //UIG fix\n if (oCallback.getReturnValue('Error') == 'No')\n pdfs(\"wfFrame\" + pdf(\"CurrentDesk\")).HasChanges = true;\n oCallback = null;\n el(\"hdnFileName\").value = ''\n hideLayer();\n showDiv(\"btnSubmit\");\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 escrever(){\n fs.writeFile(\"./output/dados.txt\",\"Hello World\", (err) => {\n console.log(\"Erro durante o salvamento...\")\n })\n}", "_uploadImage(file) {\n if (!this._isImage(file)) {\n return;\n }\n\n const userFileAttachment = new RB.UserFileAttachment({\n caption: file.name,\n });\n\n userFileAttachment.save()\n .then(() => {\n this.insertLine(\n `![Image](${userFileAttachment.get('downloadURL')})`);\n\n userFileAttachment.set('file', file);\n userFileAttachment.save()\n .catch(err => alert(err.message));\n })\n .catch(err => alert(err.message));\n }", "function insertObject(event) {\n try{\n var fileData = event.target.files[0];\n }\n catch(e) {\n //'Insert Object' selected from the API Commands select list\n //Display insert object button and then exit function\n filePicker.style.display = 'block';\n return;\n }\n const boundary = '-------314159265358979323846';\n const delimiter = \"\\r\\n--\" + boundary + \"\\r\\n\";\n const close_delim = \"\\r\\n--\" + boundary + \"--\";\n\n var reader = new FileReader();\n reader.readAsBinaryString(fileData);\n reader.onload = function(e) {\n var contentType = fileData.type || 'application/octet-stream';\n var metadata = {\n 'name': fileData.name,\n 'mimeType': contentType\n };\n\n var base64Data = btoa(reader.result);\n var multipartRequestBody =\n delimiter +\n 'Content-Type: application/json\\r\\n\\r\\n' +\n JSON.stringify(metadata) +\n delimiter +\n 'Content-Type: ' + contentType + '\\r\\n' +\n 'Content-Transfer-Encoding: base64\\r\\n' +\n '\\r\\n' +\n base64Data +\n close_delim;\n\n //Note: gapi.client.storage.objects.insert() can only insert\n //small objects (under 64k) so to support larger file sizes\n //we're using the generic HTTP request method gapi.client.request()\n var request = gapi.client.request({\n 'path': '/upload/storage/' + API_VERSION + '/b/' + BUCKET + '/o',\n 'method': 'POST',\n 'params': {'uploadType': 'multipart'},\n 'headers': {\n 'Content-Type': 'multipart/mixed; boundary=\"' + boundary + '\"'\n },\n 'body': multipartRequestBody});\n //Remove the current API result entry in the main-content div\n listChildren = document.getElementById('main-content').childNodes;\n if (listChildren.length > 1) {\n listChildren[1].parentNode.removeChild(listChildren[1]);\n }\n try{\n //Execute the insert object request\n executeRequest(request, 'insertObject');\n //Store the name of the inserted object\n object = fileData.name;\n }\n catch(e) {\n alert('An error has occurred: ' + e.message);\n }\n }\n}", "function onUpload(files) {\n\tvar file = files[0]\n\tconsole.log(\"sending to background\")\n\t// Sending the file to background\n\tsendToBackground(file)\n}", "function fileUploadDone() {\n signale.complete('File upload done');\n}", "function insert_asset(){ \t\n try{\n\t\tvar url = getUrl(this.href);\n\t\t$.get(url,{}, function(data){\n\t\t\t//insert into editor(tinyMCE is global)\n\t\t\ttinyMCE.execCommand('mceInsertContent', false, data); \n\t\t});\n\t}catch(e){ alert(\"insert asset: \"+ e);}\n}", "insertSound({commit}, data){\n commit('insertActiveSound', data)\n }", "function syncFile() {\n var insertAtText = '<files>';\n \n for (var i = 0; i < allMissingFiles.length; i++) {\n if (allMissingFiles[i].length) {\n var missingText = '';\n \n for (var x = 0; x < allMissingFiles[i].length; x++) {\n missingText += split + ' <file>/' + allMissingFiles[i][x] + '</file>';\n }\n var index = fileData[i].indexOf(insertAtText);\n fileData[i] = fileData[i].slice(0, (index + insertAtText.length)) + missingText + fileData[i].slice((index + insertAtText.length));\n var fullPath = root + bundleLocation + fileNames[i];\n dialog.logSomething('Writing to location', fullPath);\n file.writeFile(fullPath, fileData[i]);\n }\n }\n \n return ('And done.' + ((allowDialog)?' Please press enter to exit.':''));\n}", "function loadClick(e, data)\n\t{\n\t\t$(data.popup).find('input[type=file]').unbind('change').bind('change', function(e){\n\n\t\t\tvar editor = data.editor;\n\n\t\t\tvar file = this.files[0];\n\n\t\t\tif (typeof file == 'object') {\n\t\t\t\tvar url = uploadUrl;\n\t\t\t\tvar alt = $(data.popup).find('input[name=alt]').val();\n\n\t\t\t\tuploadFile(file, url, function(response){\n\n\t\t\t\t\tvar html = '<img src=\"' + response + '\" alt=\"' + alt + '\"/>';\n\n\t\t\t\t\teditor.execCommand(data.command, html, null, data.button);\n\n\t\t\t\t\teditor.hidePopups();\n\t\t\t\t\teditor.focus();\n\t\t\t\t});\n\t\t\t}\n\n\n\t\t});\n\t}", "SaveAndReimport() {}", "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}", "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 uploadFile(camino,nombre) {\n\t\talert(\"Manda archivo\");\n\t\talert(\"ubicacion:\"+camino);\n\t\tmediaFile.play();\n\t\talert(\"reproduce archivo\");\n var ft = new FileTransfer(),\n path = camino,\n name = nombre;\n\n ft.upload(path,\n \"http://www.swci.com.ar/audio/upload.php\", ///ACÁ va el php\n function(result) {\n alert('Upload success: ' + result.responseCode);\n alert(result.bytesSent + ' bytes sent');\n },\n function(error) {\n alert('Error uploading file ' + path + ': ' + error.code);\n },\n { fileName: name });\n }", "function upldOnlyFile(evt,Route,Ext,FB2ndRoute){\n\tevt.stopPropagation();\n\tevt.preventDefault();\n\n\tvar file = evt.target.files[0];\n\n\t// Prepara Metadata\n\tvar metadata = {'contentType': file.type};\n\t// Subir archivo con nombre nuevo\n\tvar uploadTask = firebase.storage().ref().child(Route+\"/\"+Ext).put(file, metadata);\n\t// Atender cambios de estado, errores, y fin de carga exitosa (almacenar URL).\n\tuploadTask.on('state_changed', function(estado) {\n\t\t// Obtener % de carga, mediante monto de bytes cargados / totales\n\t\tvar carga = (estado.bytesTransferred / estado.totalBytes) * 100;\n\t\tif(tst_logs)console.log('Cargando '+carga+'%...');\n\t\tprogBar.MaterialProgress.setBuffer(carga);\n\t\tswitch (estado.state) {\n\t\t\tcase firebase.storage.TaskState.PAUSED: // or 'paused'\n\t\t\t\tif(tst_logs)console.log('Carga Pausada!');\n\t\t\t\tbreak;\n\t\t\tcase firebase.storage.TaskState.RUNNING: // or 'running'\n\t\t\t\tif(tst_logs)console.log('Carga Corriendo...');\n\t\t\t\tbreak;\n\t\t}\n\t}, function(error) {\n\t\t// Si hay error\n\t\tconsole.error('Carga fallida:', error);\n\t\treject(error);\n\t}, function() {\n\t\tif(tst_logs)console.log('Cargados ',uploadTask.snapshot.totalBytes,'bytes.');\n\t\tprogBar.MaterialProgress.setProgress(30);\n\t\tprogBar.MaterialProgress.setBuffer(100);\n\t\tif(tst_logs)console.log(uploadTask.snapshot.metadata);\n\t\tvar url = uploadTask.snapshot.metadata.downloadURLs[0];\n\t\tvar name = uploadTask.snapshot.metadata.name;\n\t\tif(tst_logs)console.log(name+'- Archivo disponible aqui: ', url);\n\t\tprogBar.MaterialProgress.setProgress(50);\n\n\t\t// Almacenar 2da Referencia de archivos\n\t\tif(FB2ndRoute)firebase.database().ref(FB2ndRoute+\"/\"+Ext).transaction(function(current){\n\t\t\tprogBar.MaterialProgress.setProgress(90);\n\t\t\treturn url;\n\t\t}).catch(function(error){console.error(error.message);});\n\n\t\t// Almacenar Referencia de archivos\n\t\tfirebase.database().ref(Route+\"/\"+Ext).transaction(function(current){\n\t\t\tif(tst_logs)console.log(name+\"- Referencias Guardadas:\", url);\n\t\t\tprogBar.MaterialProgress.setProgress(100);\n\t\t\tsetTimeout('progBar.style.opacity=0',300);\n\t\t\treturn url;\n\t\t}).catch(function(error){console.error(error.message);});\n\n\t});\t// uploadTask\n}", "_controlUploadFile(event) {\n let file = event.target.files[0];\n let fileName = file.name;\n let fileType = fileName.split(\".\")[fileName.split(\".\").length - 1];\n\n if(this.options.tableRender) {\n let table = this._componentRoot.querySelector('[data-component=\"table-custom\"]');\n\n if(table) {\n this._inputData = [];\n table.parentNode.removeChild(table);\n }\n\n this.options.tableRender = false;\n }\n\n let chooseFields = this._componentRoot.querySelector(\"#chooseFields\");\n\n if (chooseFields) {\n chooseFields.parentNode.removeChild(chooseFields);\n }\n\n if(fileType !== 'csv') {\n\n noty({\n text: 'Файл ' + fileName + ' некорректный, выберите корректный файл, формата csv.',\n type: 'error',\n timeout: 3000\n });\n\n return;\n\n } else {\n\n noty({\n text: 'Был выбран файл ' + fileName + '.',\n type: 'success',\n timeout: 3000\n });\n }\n\n this._parseCSV(event, file);\n }", "_savefile (index) {\n const save = this.shadowRoot.querySelector('#save')\n const bind = onClick.bind(this)\n const input = this.shadowRoot.querySelector('input')\n const text = this.shadowRoot.querySelector('textarea')\n save.addEventListener('click', bind)\n function onClick () {\n if (input.value.length !== 0) {\n var d = new Date()\n const hours = d.getHours()\n const minuites = d.getMinutes()\n let time\n if (hours >= 12) {\n time = hours + ':' + minuites + ' PM'\n } else {\n time = hours + ':' + minuites + ' AM'\n }\n this._upload(input.value, text.value, index, time)\n input.value = ''\n text.value = ''\n }\n save.removeEventListener('click', bind)\n }\n }", "handleOnClickFinalize() {\n this.startUpload();\n }", "function frameInsertHandler(e) {\n\n var modal = $(this).parents('[role=\"filemanager-modal\"]');\n\n $(this).contents().find(\".redactor\").on('click', '[role=\"insert\"]', function(e) {\n e.preventDefault();\n\n var fileInputs = $(this).parents('[role=\"file-inputs\"]'),\n mediafileContainer = $(modal.attr(\"data-mediafile-container\")),\n titleContainer = $(modal.attr(\"data-title-container\")),\n descriptionContainer = $(modal.attr(\"data-description-container\")),\n insertedData = modal.attr(\"data-inserted-data\"),\n mainInput = $(\"#\" + modal.attr(\"data-input-id\"));\n\n mainInput.trigger(\"fileInsert\", [insertedData]);\n\n if (mediafileContainer) {\n var fileType = fileInputs.attr(\"data-file-type\"),\n fileTypeShort = fileType.split('/')[0],\n fileUrl = fileInputs.attr(\"data-file-url\"),\n baseUrl = fileInputs.attr(\"data-base-url\"),\n previewOptions = {\n fileType: fileType,\n fileUrl: fileUrl,\n baseUrl: baseUrl\n };\n\n if (fileTypeShort === 'image' || fileTypeShort === 'video' || fileTypeShort === 'audio') {\n previewOptions.main = {width: fileInputs.attr(\"data-original-preview-width\")};\n }\n\n var preview = getPreview(previewOptions);\n mediafileContainer.html(preview);\n\n /* Set title */\n if (titleContainer) {\n var titleValue = $(fileInputs.contents().find('[role=\"file-title\"]')).val();\n titleContainer.html(titleValue);\n }\n\n /* Set description */\n if (descriptionContainer) {\n var descriptionValue = $(fileInputs.contents().find('[role=\"file-description\"]')).val();\n descriptionContainer.html(descriptionValue);\n }\n }\n\n mainInput.val(fileInputs.attr(\"data-file-\" + insertedData));\n modal.modal(\"hide\");\n });\n }", "saveFile() {\n lively.warn(\"#TODO implement save\")\n }", "function escribir(ruta, contenido, callbackDos) {\n // Accedemos al método de writeFile de fs, este necesita los 3 parametros\n fs.writeFile(ruta, contenido, function (err) {\n if (err) {\n console.error(\"No he podido escribirlo\", err)\n } else {\n console.log(\"Se ha escrito correctamente\");\n }\n })\n}", "addFile()\n\t{\n\t\t// Obtenemos las filas\n\t\tthis.controlFilas++; // Aumentamos el control\n\n\t\t// Obtenemos la tabla\n\t\tlet table = document.getElementById('dato-agrupado');\n\t\t// Insertamos una fila en la penultima posicion\n\t\tlet row = table.insertRow(parseInt(table.rows.length) - 1);\n\t\t// Agregamos la primer columna\n\t\tlet cell1 = row.insertCell(0);\n\t\tlet text = document.createTextNode(this.letter[this.controlFilas - 1]);\n\t\tcell1.appendChild(text);\n\t\tlet cell2 = row.insertCell(1);\n\t\tcell2.innerHTML = \"De <input type='text' id='\"+this.controlFilas+\"1' class='agrupado' placeholder='Valor' onkeyup=datoAgrupado.moveColumn(event)>A<input type='text' id='\"+this.controlFilas+\"2' class='agrupado' onkeyup=datoAgrupado.moveColumn(event) placeholder='Valor'>\";\n\t\tlet cell3 = row.insertCell(2);\n\t\tcell3.setAttribute('id', this.controlFilas+'f');\n\t\tlet cell4 = row.insertCell(3);\n\t\tcell4.innerHTML = \"<input type='text' id='\"+this.controlFilas+\"3' onkeyup=datoAgrupado.keyAgrupado(event) placeholder='Valor'>\";\n\t\t\n\t\t// Hacemos focus\n\t\tdocument.getElementById(this.controlFilas + '1').focus();\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 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 }", "async uploadTemplateFile(filePath){\n await this.tmTab.getImportTemplateDragNDrop().then(async elem => {\n await elem.sendKeys(process.cwd() + '/' + filePath).then(async () => {\n await this.delay(200); //debug wait - todo better wait\n });\n });\n }", "function fileDialogStart()\n {\n \t$swfUpload.cancelUpload();\n \n if (typeof(handlers.file_dialog_start_handler) == 'function')\n {\n handlers.file_dialog_start_handler();\n }\n }", "function addFile(filepath)\r\n{\r\n var tbl = document.getElementById('myfilebody');\r\n\r\n if ((tbl.rows.length == 1) && (tbl.rows[0].getAttribute(\"id\") == \"nofile\")) {\r\n tbl.deleteRow(0);\r\n }\r\n\r\n var lastRow = tbl.rows.length;\r\n\r\n var box1 = document.getElementById('lineBox1');\r\n var box2 = document.getElementById('lineBox2');\r\n var revBox = document.getElementById('fileRevVal');\r\n\r\n var saveLine = filepath + \",\" + revBox.value + \",\" + box1.value + \",\" + box2.value;\r\n\r\n if(document.getElementById(saveLine + 'id') != null) {\r\n alert(\"Specified combination of filename, revision, and line numbers is already included in the file list.\");\r\n return;\r\n }\r\n\r\n var row = tbl.insertRow(lastRow);\r\n\r\n var files = document.getElementById('FilesSelected');\r\n files.setAttribute('value', files.value + saveLine + \"#\");\r\n\r\n //Create the entry in the actual table in the page\r\n\r\n row.id = saveLine + 'id';\r\n var cellLeft = row.insertCell(0);\r\n cellLeft.innerHTML = \"<\" + \"a href=\\\"javascript:removefile('\" + saveLine + \"')\\\">\" + filepath + \"</a>\";\r\n cellLeft.setAttribute('value', saveLine);\r\n row.appendChild(cellLeft);\r\n cellLeft = row.insertCell(1);\r\n cellLeft.innerHTML = box1.value;\r\n row.appendChild(cellLeft);\r\n cellLeft = row.insertCell(2);\r\n cellLeft.innerHTML = box2.value;\r\n row.appendChild(cellLeft);\r\n cellLeft = row.insertCell(3);\r\n cellLeft.innerHTML = revBox.value;\r\n row.appendChild(cellLeft);\r\n\r\n colorTable('myfilebody');\r\n}", "function writeFile() {\r\n if (!'indexedDB' in window) {\r\n console.log(\" your browser doesnt support indexDB\");\r\n // return;\r\n }\r\n const databaseName = \"TextEditorDB\";\r\n const DBname = window.indexedDB.open(databaseName);\r\n DBname.onupgradeneeded = () => {\r\n let db = DBname.result;\r\n let store = db.createObjectStore(\"Files\", { autoIncrement: true });\r\n // put method\r\n store.put({ name: \"file1\", format: \"text\" });\r\n }\r\n DBname.onsuccess = () => {\r\n if (DBname.readyState == \"done\") {\r\n console.log(\"Data is successfully loaded\");\r\n }\r\n }\r\n}", "function upload(source, child){\n var trendinfo;\n try{\n trendinfo = JSON.parse(fs.readFileSync(source, 'utf8'));\n }catch (e) {\n console.log(\"\\n\"+source + \" is not exist. check json file again\\n\");\n process.exit(0);\n }\n\n var db = accessApp.database();\n var ref = db.ref(child);\n\n setTimeout (function () {\n ref.set(trendinfo);\n l = source.split(\"/\")\n filename = l[l.length-1]\n console.log ( \"finish set \"+filename);\n process.exit(0);\n }, 2000);\n\n}", "function saveFile(filename, content) {\n filesystem.root.getFile(\n filename,\n { create: true },\n function (fileEntry) {\n fileEntry.createWriter(function (fileWriter) {\n fileWriter.onwriteend = function (e) {\n // Update the file browser.\n listFiles();\n\n // Clean out the form field.\n filenameInput.value = \"\";\n contentTextArea.value = \"\";\n\n // Show a saved message.\n messageBox.innerHTML = \"File saved!\";\n };\n\n fileWriter.onerror = function (e) {\n console.log(\"Write error: \" + e.toString());\n alert(\"An error occurred and your file could not be saved!\");\n };\n\n var contentBlob = new Blob([content], { type: \"text/plain\" });\n\n fileWriter.write(contentBlob);\n }, errorHandler);\n },\n errorHandler\n );\n}", "function addDefferedFileAction(success, error) {\n actions.success.push(success);\n actions.error.push(error); \n}", "function actionFileExists() {\r\n // We want to delete the file\r\n fs.unlink(realPathFile, (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 file was deleted');\r\n // Now we want to write the content of the file to the file\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 }\r\n });\r\n}", "function sendFile(file, editor, welEditable) {\n data = new FormData();\n data.append(\"file\", file);\n $.ajax({\n data: data,\n type: \"POST\",\n url: root_url + \"/product/uploadimage\",\n cache: false,\n contentType: false,\n processData: false,\n success: function(response) {\n var url = static_url + response._result.file.path;\n editor.insertImage(welEditable, url);\n }\n });\n }", "onSaveAsFile() {\n this.setState({ showModal: false, isMnemonicCopied: true });\n }", "function removeFile(thisFile, data) {\n thisFile.closest('.upload-wrapper').find('.upload-file .file-name').text(data);\n }", "function onItemFileDrop( event ){\n ctrl.addFile( event.dataTransfer.files[0] );\n }", "function moveToNewFile(message) {\n console.log(message);\n}", "create() {\n this.proc.args.file = null;\n\n this.emit('new-file');\n\n this.updateWindowTitle();\n }", "function saveAs() {\n\tlet content = editor.getText();\n\n\tdialog.showSaveDialog(\n\t\trequire(\"electron\").remote.getCurrentWindow(),\n\t\t{\n\t\t\tfilters: [\n\t\t\t\t{ name: \"BTML files\", extensions: [\"btml\"] },\n\t\t\t\t{ name: \"All Files\", extensions: [\"*\"] }\n\t\t\t]\n\t\t},\n\t\tfilename => {\n\t\t\tif (filename === undefined) {\n\t\t\t\tdebug.log(\"No file selected\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfs.writeFile(filename, content, err => {\n\t\t\t\tif (err) {\n\t\t\t\t\tdebug.error(\n\t\t\t\t\t\t\"An error ocurred creating the file \" + err.message\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tpathToFileBeingEdited = filename;\n\t\t\t\tdebug.log(\"The file has been succesfully saved\");\n\t\t\t});\n\t\t}\n\t);\n}", "function upload(evt) {\n\t file = evt.target.files[0];\n\t console.log(\"yikes!!!\", file);\n\t var reader = new FileReader();\n\t reader.readAsText(file);\n\t \treader.onload = loaded;\n\t}", "goodFile() {\n $('.pcm_importStatus').html('Data from file ready to be imported.').css('color','#dbfd23');\n $('.pcm_importButton').removeClass('disabled').prop(\"disabled\",false);\n }", "function userSavesHandler() {\n\tif (!filepath) {\n\t\tdialog.showSaveDialog(savePathChosenHandler);\n\t} else {\n\t\twriteToFile(filepath)\n\t}\n}", "function onWriteEnd() {\n chrome.storage.sync.get( [ 'token' ] , function( config ) {\n\n chrome.tabs.query({ active: true, currentWindow: true }, function( tabs ) {\n chrome.tabs.sendMessage( tabs[0].id, { 'type': 'openCloudAppDashboard' });\n });\n\n CloudAppApi.setFileBlob( blob );\n CloudAppApi.setFileName( filename );\n var res = CloudAppApi.upload(\n config.token,\n function ( response ) {\n // Open a new tab as soon as we get the slug.\n if ( response.slug != null ) {\n chrome.tabs.query({ active: true, currentWindow: true }, function( tabs ) {\n chrome.tabs.sendMessage( tabs[0].id, { 'type': 'uploadProgressComplete' });\n });\n chrome.tabs.create( { url: dropUrlBase + response.slug } );\n }\n else {\n _createNotification( 'failure', null, 'Video uploaded but the app failed to redirect. Please refresh page and try again.' );\n }\n },\n function( response ) {\n // Upload successfully complete.\n _createNotification( 'Upload Complete!', 'success', response);\n },\n function( message ) {\n // Could not upload the file.\n _createNotification( 'Upload Failed', 'failure', null, 'Upload failed, please give another try' );\n },\n function( total, loaded, drop ) {\n var progressPercentage = Math.floor((loaded / total) * 100);\n chrome.tabs.query({ active: true, currentWindow: true }, function( tabs ) {\n chrome.tabs.sendMessage( tabs[0].id, { 'type': 'uploadProgress', 'percentage': progressPercentage, 'filename': filename, 'drop': drop });\n });\n },\n mimeType,\n actionType\n );\n });\n }", "function gotFileEntry(fileEntry) {\n\t\t\t\tfileEntry.moveTo(fs.root, fileEntry.name , fsSuccess, deuerro);\n\t\t\t}", "function importBM(){\n var impbutton = document.getElementById('importhead')\n impbutton.addEventListener('click', (ev)=>{\n var msg = document.getElementById('message')\n msg.style.display = 'block'\n msg.innerHTML = \"Importing... This can take a while!\"\n window.printBookmarks('0')\n window.postImportData(window.bookmarks_arr) \n })\n}", "runUserUpload() {\n\t\tconst input = document.createElement(\"input\");\n\t\tinput.type = \"file\";\n\t\tinput.onchange = (evt) => {\n\t\t\tconst reader = new FileReader();\n\t\t\treader.onloadend = (evt) => {\n\t\t\t\tthis.loadStoredCircuit(JSON.parse(evt.target.result));\n\t\t\t};\n\t\t\treader.readAsText(evt.target.files[0]);\n\t\t};\n\t\tinput.click();\n\t}", "function deleteFile(id) {\n chrome.runtime.sendMessage({\n type: \"remove\",\n id: id\n });\n}", "function setText(){\n var bouton = document.getElementById('btn_file');\n var tabCheminfichier= bouton.value.split('\\\\'); \n document.getElementById('file_name').innerHTML = tabCheminfichier[tabCheminfichier.length-1];\n document.getElementById('url').value='';\n}", "function deleteFile(mommy, fileList, deadFile) {\n\tfor (let i = deadFile; i < fileList.length-1; i++) {\n\t\tfileList[i] = fileList[i + 1]\n\t\tmommy.children[i].innerHTML = mommy.children[i + 1].innerHTML;\n\t\tmommy.children[i].classList = mommy.children[i + 1].classList;\n\t}\n\tmommy.children[mommy.children.length - 1].innerHTML = \"untitled\";\n\tmommy.children[mommy.children.length - 1].classList.add(\"off\");\n\tfileList[fileList.length -1 ] = ace.createEditSession(NEWSOURCE);\n\tfileList[fileList.length -1 ].setMode(\"ace/mode/minitab\");\n\treturn fileList;\n}", "function updateDropboxFile(newExpense) {\n dbx.filesDownload({ path: conf.get('filePath') })\n .then(function(response) {\n var buff = new Buffer(response.fileBinary);\n uploadFile(Buffer.concat([buff, new Buffer(newExpense)])); \n })\n .catch(function(error) {\n //console.log(error);\n });\n}", "function viewFile(file_id, file_nome, utente_id){\n $('#popup-file-nome').empty().append( file_nome );\n $('#popup-file-id').val( file_id );\n $('#popup-file-utente_id').val( utente_id );\n\n $('#popup-file').popup('open');\n}", "function uploadFile(){\n localUpload();\n publicUpload();\n alert(\"File uploaded.\\nWaiting to get analyze result.\");\n window.location.href = \"index.php?upload&filename=\" + fileName;\n }", "function uploadFile(mediaFile) {\r\n var ft = new FileTransfer(),\r\n path = mediaFile.fullPath,\r\n name = mediaFile.name;\r\n alert('gé3ed yab3ath');\r\n ft.upload(path,\"http://un.serveur.com/upload.php\",\r\n function(result) {\r\n console.log('Réussite du transfert : ' + result.responseCode);\r\n console.log(result.bytesSent + ' octets envoyés');\r\n },\r\n function(error) {\r\n console.log('Erreur lors du transfert du fichier ' + path + ' : ' + error.code);\r\n },\r\n { fileName: name }); \r\n }", "function done() {\n\t$destination.innerHTML = store + fileName;\n\t$status.innerHTML = \"Done\";\n}", "uploadPicturl () {\n const uploadTask = wx.uploadFile({\n url: this.data.uploadUrl,\n filePath: this.data.uploadImagePath,\n name: \"image\",\n success: res => {\n console.log(res);\n }\n });\n // 终止上传\n // uploadTask.abort();\n\n // Listen Upload Task\n uploadTask.onProgressUpdate(pro => {\n this.setData({\n progress: pro.progress\n })\n if (pro.progress === 100) {\n setTimeout(() => {\n this.setData({ progress: 0 });\n }, 1200)\n }\n });\n }" ]
[ "0.68741524", "0.64936984", "0.62079936", "0.61457", "0.6047881", "0.5987449", "0.5914952", "0.5896543", "0.587927", "0.5875236", "0.5811419", "0.5808281", "0.5778995", "0.5752688", "0.57424104", "0.57340324", "0.57310104", "0.57255894", "0.5709673", "0.5689511", "0.56180185", "0.56138736", "0.5611594", "0.55893207", "0.558914", "0.5572425", "0.5565506", "0.55558324", "0.55519694", "0.55353546", "0.5534485", "0.55156404", "0.55148846", "0.5513096", "0.5498724", "0.5476421", "0.5457723", "0.54576427", "0.5454971", "0.54464483", "0.54297215", "0.5395278", "0.5391653", "0.5377892", "0.5375824", "0.5371013", "0.5364314", "0.5361301", "0.5338494", "0.5335675", "0.5328114", "0.5320597", "0.53048545", "0.52795225", "0.5279347", "0.5275821", "0.5267715", "0.52556765", "0.52517647", "0.52474916", "0.52464026", "0.5245176", "0.5243923", "0.52437884", "0.5239474", "0.5213761", "0.521197", "0.5210894", "0.5210468", "0.5205385", "0.520536", "0.5202463", "0.5199793", "0.51935154", "0.5193509", "0.51926565", "0.5188132", "0.5182171", "0.5179836", "0.51695454", "0.5167894", "0.51672006", "0.516091", "0.51561487", "0.5154834", "0.5151098", "0.51473147", "0.51469576", "0.514321", "0.51393294", "0.5137753", "0.51337105", "0.5126079", "0.5120048", "0.51187503", "0.51167476", "0.51112294", "0.5104215", "0.5098214", "0.5096629", "0.50931805" ]
0.0
-1
codigo directamente extraido de store el cual da la informacion del pedido
function CarritoCompra(id, montoT, depart, city, dis, direc, estd) { console.log(estd + montoT); return '<div class="container">' + ' <div class="row">' + ' <div class="col">' + ' <div class="row">' + ' <div class="col-7">' + ' <h5>Productos en Carrito</h5>' + ' </div>' + ' <div class="col-5">' + ' <div class="form-group" style="width: 100%;">' + ' <div class="input-group">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text" id="basic-addon1">S/.</span>' + ' </div>' + ' <input value="' + montoT + '" type="text" disabled class="form-control" placeholder="00.0" aria-label="Direccion" aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' </div>' + ' <div id="containerprodutIten' + id + '" style="background: #eceff1; width: 100%; height: 250px; display: grid;grid-template-columns:100% ; grid-row-gap: 1px; overflow:scroll;overflow-x: hidden;">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <div class="row my-1">' + ' <select disabled class="custom-select" id="inputGroupSelect01">' + ' <option selected>' + depart + '</option>' + ' </select>' + ' </div>' + ' <div class="row my-1">' + ' <select disabled class="custom-select" id="inputGroupSelect01">' + ' <option selected>' + city + '</option>' + ' </select>' + ' </div>' + ' <div class="row my-1">' + ' <select disabled class="custom-select" id="inputGroupSelect01">' + ' <option selected>' + dis + '</option>' + ' </select>' + ' </div>' + ' <div class="row my-1">' + ' <div class="form-group" style="width: 100%;">' + ' <div class="input-group">' + ' <div class="input-group-prepend">' + ' <span class="input-group-text" id="basic-addon1">🌍</span>' + ' </div>' + ' <input value="' + direc + '" disabled type="text" class="form-control" placeholder="Direccion" aria-label="Direccion" aria-describedby="basic-addon1">' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row">' + ' <div class="col">' + ' <div class="conteSetP ' + id + '" onclick="Setprogressbar3(' + id + ')">' + ' <ul id="stp-dsjdhj" value="0" class="Setprogressbar padre">' + '<li value="1" class="li-iten-sep hijo ' + ((estd > 0) ? 'active' : '') + '">Pedido Recivido</li>' + '<li value="2" class="li-iten-sep hijo ' + ((estd > 1) ? 'active' : '') + '">Enviado</li>' + '<li value="3" class="li-iten-sep hijo ' + ((estd > 2) ? 'active' : '') + '">Paquete entregado</li>' + ' </ul>' + ' </div>' + ' </div>' + ' </div>' + ' <div class="row my-1">' + ' <button onclick="ActualiEstate(' + id + ')" type="button" id="NewProdut" class="btn btn-success btn-block">Actualizar' + ' Estado</button>' + ' </div>' + ' </div>' + ' <div class="row my-1">' + ' </div>' + ' </div>' + ' <div Class="row">' + ' ' + ' </div>' + '</div>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "departamento() {\n return super.informacion('departamento');\n }", "getTransactionID() {\n let length = window.Database.DB.bought.length;\n var lastID = window.Database.DB.bought[length - 1].transaction_id;\n\n return parseInt(lastID) + 1;\n }", "siguiente() {\n this.ultimo += 1; // forma corta de hacer un accumulado \n \n /* mi objeto de 1 ticket a rellenarlo \n * es decir cada vez se llama siguiente en esta linea se crea nueva instancia : nuevo Objeto a rellenar\n */\n const ticket = new Ticket( this.ultimo, null ); \n this.tickets.push( ticket );\n\n this.guardarDB();\n return 'Ticket ' + ticket.numero;\n }", "provincia() {\n return super.informacion('provincia');\n }", "sauvegardePanier(){\n localStorage.setItem('commande', JSON.stringify(this.commandes));\n localStorage.setItem('dateModif', ''+(Date.now()+(3600*1000)) );\n }", "function AjoutArticleProduit() {\n var panier = {};\n // si le panier n'existe pas, il faut le créer\n if (localStorage.getItem(\"Panier\") === null) {\n // on crée l'entrée et on lui assigne une quantité de 1\n panier[id] = 1;\n }\n // si le panier existe\n else {\n //on transforme le panier en objet\n panier = JSON.parse(localStorage.getItem(\"Panier\"));\n // si l'entrée existe ajouter 1 à la quantité\n // sinon on la crée et on lui assigne une quantité de 1\n if (panier[id] > 0) {\n panier[id] += 1;\n } else {\n panier[id] = 1;\n }\n }\n //On enregistre le panier dans le local storage\n localStorage.setItem(\"Panier\", JSON.stringify(panier));\n}", "function getIdOrden(){\n return orden_id;\n}", "distrito() {\n return super.informacion('distrito');\n }", "resultado() {\n return this.local + \"-\" + this.visitante;\n }", "function extraerNodoP(){\r\n\tvar nuevo = this.raiz;\r\n\tif(!this.vacia()){\r\n\t\tthis.raiz = this.raiz.sig;\r\n\t\t//window.alert(nuevo.nombre);\r\n\t}\r\n\treturn nuevo;\r\n\t\r\n}", "productoNuevo(producto){\n this.listaProductos.push({\n id:++this.idNuevo, //incremento el id inicial y lo asigno al producto nuevo\n title: producto.title,\n price: producto.price,\n thumbnail: producto.thumbnail\n })\n return(this.listaProductos[this.id-1]); //retorno el producto creado como objeto\n }", "function addCantidad() {\n let curso = carrito.find(c => c.id == this.id);\n curso.agregarCantidad(1);\n $(this).parent().children()[1].innerHTML = curso.cantidad;\n $(this).parent().children()[2].innerHTML = curso.subtotal();\n\n//GUARDAR EN STORAGE\nlocalStorage.setItem(\"carrito\", JSON.stringify(carrito));\n}", "getOrdreFamille(){\n if (this.appartientFamille()){\n return parseInt(this.donneesUtilisateur.getElementsByTagName(DictionnaireXml.getTagFamille())[0].getAttribute(DictionnaireXml.getAttOrdreFamille()));\n }\n else{\n throw \"Récupération de l'ordre dans la famille impossible : Le QRCode n'appartient à aucune famille\";\n }\n }", "static getLastId() {\r\n let lastId = 0\r\n if (eventos.length > 0) {\r\n lastId = eventos[eventos.length - 1].id\r\n console.log('O lastId do utilizador é = ' + lastId)\r\n }\r\n\r\n return lastId\r\n }", "function ajoutPanier() {\n //verifie si le client à choisi une lentille\n if (!productLense) {\n alert(\"Vous devez choisir une lentille\");\n return;\n }\n\n //créer l'objet\n let panierObj = ({\n id: Request.response[\"_id\"],\n lense: productLense,\n quantity: productQty\n });\n const productKey = `${Request.response._id}-${productLense}`;\n console.log(\"productKey\", productKey);\n console.log('panierObj', panierObj);\n\n //verifie si le produit est déjà dans le localStorage, si oui mets à jour la quantité\n if (!localStorage.getItem(productKey)) {\n localStorage.setItem(productKey, JSON.stringify(panierObj));\n } else {\n let tmpProduct = JSON.parse(localStorage.getItem(productKey));\n let tmpQty = panierObj.quantity + tmpProduct.quantity;\n panierObj.quantity = tmpQty;\n localStorage.setItem(productKey, JSON.stringify(panierObj));\n };\n}", "data(){\n return {\n numeroPadre:0,\n /* La palabra $event, esta trayendo el nombre enviado en el evento emit del componente hijo */\n nombrePadre:''\n }\n }", "nombreCompleeto(){\n //return this._nombre+ ' '+this._apellido+ ', '+this._departamento;\n //super es par aceder metodo padre\n return super.nombreCompleeto()+ ', '+this._departamento;\n }", "esconder(){\n console.log(`${this._nombre} corre a ${this._velocidad}m/s y da un salto de ${this._salto}m y se esconde`)\n }", "getStateTicket() {\n return `Ticket ${this.ultimo}`;\n }", "obtenerIDCuestionario()\n {\n var id=0;\n if(this.props.modo==\"nuevo\")\n {\n $.ajax({\n url: 'UltimoExamen',\n type: 'Post',\n async:false,\n processData: false, // tell jQuery not to process the data\n contentType: false, // tell jQuery not to set contentType\n success: function (data) {\n id= data.toString();\n },\n error: function (data) {\n console.log(data.toString());\n alert(\"ERROR en recepcion de IDCuestionario\");\n }\n });\n }\n else\n {\n id=this.props.id;\n }\n return id;\n }", "function agregarCant() {\r\n const seleccionado = productos.find(producto => producto.id == this.id);\r\n seleccionado.agregarCantidad(1);\r\n let registroUI = $(this).parent().children();\r\n registroUI[2].innerHTML = seleccionado.cantidad;\r\n registroUI[3].innerHTML = seleccionado.subtotal();\r\n $(\"#totalCarrito\").html(`TOTAL ${totalCarrito(carrito)}`);\r\n localStorage.setItem(\"carrito\", JSON.stringify(carrito));\r\n}", "static getId(to,t,p,op,couleur,cb){\n\t\tvar nb= \"nb\"+op.split(\"#\")[1].substr(4);\n\t\tvar cime=\"\";\n\t\tif(couleur==\"N\"){\n\t\t\tcime=\"cimeNoir\";\n\t\t}\n\t\telse{\n\t\t\tcime =\"cimeBlanc\";\n\t\t}\n\t\tquery.execute(conn, 'echec','select ?c where {:'+cime+' :'+nb+' ?c}',\n\t\t'application/sparql-results+json', {\n\t\t\toffset:0,\n\t\t\treasoning: true\n\t\t}).then(({body})=>{\n\t\t\tvar data = body.results.bindings;\n\t\t\tvar id = parseInt(data[0].c.value) +1;\n\t\t\tthis.putInCime(to,t,p,op,couleur,id,cb);\n\t\t\tupdate.deleteOldId(cime, nb, id-1,id);\n\t\t\t//this.deleteOldId(cime,nb,id);\n\t\t}).catch(e=> {console.log(e);});\t\n\t}", "nota(tipo) {\n let valObj = {\n estado: 'P'\n },\n whereObj = {\n id_ticket: this.$stateParams.id\n };\n this.$bi.ticket().update(valObj, whereObj);\n //Async same time\n let hoy = this.moment().format('YYYY[-]MM[-]D'),\n ahora = this.moment().format('h:mm:ss'),\n nombreUsuario = `${this.$cookieStore.get('user').apellido} ${this.$cookieStore.get('user').nombre}`,\n arrVal = [\n hoy,\n ahora,\n this.model.texto,\n tipo,\n nombreUsuario,\n this.$stateParams.id\n ];\n\n if (this.model.images) {\n return this.$bi.documentacion().insert(arrVal).then(response => {\n this.$imagenix.save(this.model.images, response.data[0].id_documentacion)\n });\n } else {\n return this.$bi.documentacion().insert(arrVal);\n }\n }", "function identificarData(codigo, tipoCodigo) {\n codigo = codigo.replace(/[^0-9]/g, '');\n const tipoBoleto = identificarTipoBoleto(codigo);\n\n let fatorData = '';\n let dataBoleto = new Date();\n\n dataBoleto.setFullYear(1997);\n dataBoleto.setMonth(9);\n dataBoleto.setDate(7);\n dataBoleto.setHours(23, 54, 59);\n\n if (tipoCodigo === 'CODIGO_DE_BARRAS') {\n if (tipoBoleto == 'BANCO') {\n fatorData = codigo.substr(5, 4)\n\n dataBoleto.setDate(dataBoleto.getDate() + Number(fatorData));\n dataBoleto.setTime(dataBoleto.getTime() + dataBoleto.getTimezoneOffset() - (3) * 60 * 60 * 1000);\n var dataBoletoform = dataBoleto.getDate() + \"/\" + (dataBoleto.getMonth() + 1) + \"/\" + dataBoleto.getFullYear()\n\n return dataBoletoform;\n } else {\n dataBoleto = null\n\n return dataBoleto;\n }\n } else if (tipoCodigo === 'LINHA_DIGITAVEL') {\n if (tipoBoleto == 'BANCO') {\n fatorData = codigo.substr(33, 4)\n dataBoleto.setDate(dataBoleto.getDate() + Number(fatorData));\n dataBoleto.setTime(dataBoleto.getTime() + dataBoleto.getTimezoneOffset() - (3) * 60 * 60 * 1000);\n var dataBoletoform = dataBoleto.getDate() + \"/\" + (dataBoleto.getMonth() + 1) + \"/\" + dataBoleto.getFullYear()\n\n return dataBoletoform;\n } else {\n dataBoleto = null\n\n return dataBoleto;\n }\n }\n}", "async function pedidogen() {\r\n let pedido_buscar = await Pedidocounter.find({});\r\n let fecha = new Date().toISOString().slice(0, 10);\r\n let verificar = false;\r\n verificar = isEmpty(pedido_buscar);\r\n if (verificar == true) {\r\n let numero = fecha.split(\"-\");\r\n numero.push(\"1\");\r\n numero = numero.join(\"-\");\r\n return numero;\r\n } else {\r\n fecha1 = fecha.split(\"-\");\r\n let counter = pedido_buscar[0];\r\n let counter1 = counter.pedido_counter;\r\n counter1 = counter1.split(\"-\");\r\n /*\r\n mesBd = counter1[1];\r\n diaBd = counter1[2];\r\n mesNow = fecha1[1];\r\n diaNow = fecha1[2];\r\n mes = Math.abs(mesBd - mesNow);\r\n dia = Math.abs(diaBd - diaNow);\r\n */\r\n anioBD = counter1[0];\r\n anioNow = fecha[0];\r\n anio = Math.abs(anioNow - anioBD);\r\n if (anio == 0) {\r\n fechacompro = '\"' + fecha;\r\n let counter2 = parseInt(counter1[3]) + 1;\r\n counter2 = counter2.toString();\r\n let numero = fecha.split(\"-\");\r\n numero.push(counter2);\r\n numero = numero.join(\"-\");\r\n return numero;\r\n } else {\r\n let numero = fecha.split(\"-\");\r\n numero.push(\"1\");\r\n numero = numero.join(\"-\");\r\n return numero;\r\n }\r\n }\r\n}", "function capturaEntradaSalida(id,nombre)\n{\n if (typeof localStorage['jb_reporte_ubicacion'] === 'undefined') {\n myApp.alert('guarda primero tu ubicación');\n $('#id_reporte_'+id).removeAttr('onclick');\n setTimeout(function(){\n $('#id_reporte_'+id).attr('onclick',\"capturaEntradaSalida(\\'\"+id+\"\\',\\'\"+nombre+\"\\')\");\n },1000);\n }else{\n //$('#id_reporte_'+id+' a').attr('href',\"#option-repo\");\n var id_row = genera_id();\n localStorage['idtabla'] = id;\n localStorage['nomRepor'] =nombre;\n var idPlantilla = localStorage['idPlantilla_activa'];\n var id_repor = localStorage['idreporte'];\n var fecha = genFecha();\n var status_row = 1;\n\n window.db.transaction(function(txt2){\n txt2.executeSql(\"SELECT nombre,id,position,content_type,id_table,status FROM jb_dinamic_tables_columns WHERE id_table=\\'\"+id+\"\\' and type_section=\"+localStorage['repSeccion']+\" ORDER BY position ASC\",[],function(txt, results){\n var np=0;\n for (var i = 0; i < results.rows.length; i++) {\n var rp = results.rows.item(i);\n //onsole.log(rp);\n var id2 = genera_id();\n if (rp.position == 0) {\n np += RegistroAlterno(status_row,rp.id_table,id_repor,id_row,rp.id,id2,fecha,localStorage['jb_reporte_ubicacion'],rp.position,rp.content_type); \n }else if (rp.position == 1) {\n np += RegistroAlterno(status_row,rp.id_table,id_repor,id_row,rp.id,id2,fecha,fecha,rp.position,rp.content_type); \n }\n }\n console.log(np);\n //np=np-1;\n if(np == results.rows.length){\n txt2.executeSql(\"INSERT into item_listview(nombre,status) VALUES(\\'\"+nombre+\"\\','2');\");\n console.log('son iguales aqui lo demas')\n myApp.alert('Validando..');\n setTimeout(function(){\n $('#id_reporte_'+id).removeAttr('data').attr('data','2'); \n $('#reportProceso_'+id).empty();\n $('#reportProceso_'+id).append('Terminado');\n $('#reportProceso_'+id).removeAttr('style');\n $('#reportProceso_'+id).attr('style','color:rgb(48, 150, 48);');\n $('#id_reporte_'+id).removeAttr('onclick');\n $('#id_reporte_'+id).attr('onclick','visualisaRepor(\\''+id_repor+'\\',\\''+nombre+'\\',\\''+id+'\\',0)');\n $('#id_reporte_'+id+' a').attr('href','#vistaRepor');\n },800);\n }\n });\n });\n } \n}", "crearUsuario() {\n if (this.lista_usuario.findIndex(usuario => usuario.id == this.usuario.id) === -1) {\n let calculo = (this.usuario.peso / (this.usuario.estatura * this.usuario.estatura)) * 10000;\n this.x = calculo.toFixed(2)\n this.usuario.IMC = this.x\n this.lista_usuario.push(this.usuario)\n this.usuario = {\n tipoidentificacion: \"\",\n id: \"\",\n nombres: \"\",\n apellidos: \"\",\n correo: \"\",\n peso: \"\",\n estatura: \"\",\n IMC: \"\",\n acciones: true\n };\n this.saveLocalStorage();\n this.estado = \"\"\n }\n else {\n alert('Este usuario ya se encuentra Registrado')\n }\n }", "getLastId() {\n /* if(this.travels.length){\n return this.travels[this.travels.length-1].id\n }\n else{\n return 0\n } */\n return this.travels.length ? this.travels[this.travels.length - 1].id : 0\n }", "function GetIDCuento(Cuento){\n\n var sql = \"SELECT rowid,ID_Colecciones FROM Cuentos WHERE NombreCuento = '\"+Cuento.Nombre +\"'\";\n\n function queryDB(tx) {\n tx.executeSql(sql, [], querySuccess, errorCB);\n }\n\n\n\tfunction querySuccess(tx, results) {\n\t\tvar len = results.rows.length;\n\t\tCuentoActual = {\n\t\t\tID : \"Cuento_\" + results.rows.item(0).rowid,\n\t\t\tNombre : Cuento.Nombre,\n\t\t\tN_Pag : 0,\n\t\t\tColeccion : results.rows.item(0).ID_Colecciones\n\t\t};\n\t\tGuardarPagina(0);\n\t\t$('#TabsCuento').append('<div id=\"pag_0\" class=\"PaginaCuento actual ' + CuentoActual.ID + '\" ></div>');\n\t\tPaginas[0] = \"pag_0\";\n\t\t\n\t\tlocalStorage.setItem(\"ID_CuentoUltimo\", CuentoActual.ID.split(\"_\")[1]); \n\t\tUltimaPaginaModificada();\n\t\tAddobjetopopup();\n\t\tAddPersonajepopup();\n\t\tAddBocadillospopup();\n\t\tAddFondospopup();\n}\n\n\n function errorCB(err) {\n alert(\"Error en getidcuento: \"+err.code);\n }\n\n db.transaction(queryDB, errorCB);\n}", "function enviarDestinoPosicion(id) {\n socket.emit('posicion-cliente', {\n pasajero: enFuera, // envio la posicion del cliente\n destinoID: parseInt(id) // envio el id de la estacion de destino\n });\n}", "function getId() {\n\t\t\treturn NewsService.leng();\n\t\t}", "function getId() {\n\t\t\treturn NewsService.leng();\n\t\t}", "function getId() {\n\t\t\treturn NewsService.leng();\n\t\t}", "function getLastCommand() {\n let getCommand=document.querySelector('.recuperer');\n \n let productAdded=localStorage.getItem('productAdded')\n productAdded=JSON.parse(productAdded)\n\n let products=localStorage.getItem('LastCommande')\n products=JSON.parse(products)\n \n \n //ecouter le bouton recuperer\n getCommand.addEventListener('click' , function() {\n if(productAdded!=null){\n \n productAdded={\n ...productAdded, \n ...products, \n }\n \n localStorage.setItem('productAdded', JSON.stringify(productAdded))\n \n }else{\n \n productAdded={\n ...products,\n }\n \n localStorage.setItem('productAdded', JSON.stringify(productAdded))\n }\n\n let productExist=localStorage.getItem('productAdded');\n productExist=JSON.parse(productExist);\n let quantityadded=Object.keys(productExist).length;\n\n localStorage.setItem('quantity', JSON.stringify(quantityadded))\n //relancer la page\n window.location.reload();\n })\n \n}", "toString(){\n //se aplica polimorfismo(el metodo que se ejecuta depende si es una referencia\n // de tipo padre o de tipo hijo)\n return this.nombreCompleto();\n }", "function substraerCant() {\r\n const seleccionado = productos.find(producto => producto.id == this.id);\r\n seleccionado.agregarCantidad(-1);\r\n if (seleccionado.cantidad<=0 || seleccionado.cantidad==undefined) {\r\n eliminarCarrito();\r\n }\r\n let registroUI = $(this).parent().children();\r\n registroUI[2].innerHTML = seleccionado.cantidad;\r\n registroUI[3].innerHTML = seleccionado.subtotal();\r\n $(\"#totalCarrito\").html(`TOTAL ${totalCarrito(carrito)}`);\r\n localStorage.setItem(\"carrito\", JSON.stringify(carrito));\r\n}", "contaGoleiro(){\n let contador = 0;\n\n sorteio.selectJogadoresConfirmados().filter(function(e){\n if(e.goleiro){\n contador++;\n }\n });\n\n return contador;\n }", "async store(aluno_id) {\n try {\n const aluno = await Aluno.findById(aluno_id);\n if (!aluno) {\n return null;\n }\n\n if (!aluno.turma) {\n const turmas = await Turma.find({ datainscricao: { $gte: aluno.createdAt } }).sort({ datainscricao: 1 });\n let turma = turmas[0];\n for (var i = 0, len = turmas.length; i < len; ++i) {\n if (turmas[i].vagas > turmas[i].totalinscritos) {\n turma = turmas[i];\n break;\n }\n }\n turma.totalinscritos += 1;\n await turma.save();\n\n aluno.turma = turma._id;\n await aluno.save();\n\n const alunoturma = await AlunoTurma.create({ aluno: aluno_id, turma: turma._id, estado: \"INSCRITO\", confirmar: turma.confirmar });\n return alunoturma;\n }\n\n const alunoturma = await AlunoTurma.findOne({ aluno: aluno_id, turma: aluno.turma });\n\n return alunoturma;\n } catch (e) {\n console.log(\"InscricaoController:Store \" + e);\n return null;\n }\n }", "function IndicadorRangoEdad () {}", "get id() {\r\n return utils.hash(TX_CONST + JSON.stringify({\r\n proof: this.proof,\r\n cm: this.cm }));\r\n }", "function getOrderNo(req, res) {\n serviceOrder.count({ companyId: req.body.companyId }).exec(function (err, result) {\n if (err) {\n res.json({ code: Constant.ERROR_CODE, message: Constant.INTERNAL_ERROR });\n }\n else {\n res.json({ code: Constant.SUCCESS_CODE, orderNo: 'SO-' + parseInt(100000 + result + 1) });\n }\n });\n}", "as_string() {\n return this.porraID + \" → \" + this.quien + \": \" + this.resultado();\n }", "function recuperarDatosPunto(){\n vm.nuevoPtoInteres.nombre = vm.nombrePunto;\n vm.nuevoPtoInteres.lat = latPuntoCreacion;\n vm.nuevoPtoInteres.lon = lonPuntoCreacion;\n vm.nuevoPtoInteres.idTipo = vm.tipoSeleccionado.id;\n console.log(\" Datos del nuevo punto de interes.\");\n console.log(vm.nuevoPtoInteres);\n }", "getStorageId() {\n return {_id: this._id};\n }", "function restarCantidad(){\n let curso =carrito.find(c => c.id == this.id);\n\n if(curso.cantidad > 1){\n curso.agregarCantidad(-1);\n\n let registroUI = $(this).parent().children();\n registroUI[1].innerHTML = curso.cantidad;\n registroUI[2].innerHTML = curso.subtotal();\n\n //MODIFICAR TOTAL\n $(\"#totalCarrito\").html(`TOTAL ${totalCarrito(carrito)}`);\n\n //GUARDAR EN EL STORAGE\n localStorage.setItem(\"carrito\", JSON.stringify(totalCarrito));\n\n\n }\n\n}", "function pEnviarPlantilla(idOrder, reenvio) {\n\n console.log(\"Enviamos el la plantilla \"+idOrder);\n\n // Recuperar la cabecer\n var s = \"SELECT * FROM ordersPending WHERE idInternalOrder=\" + idOrder;\n\n var res = {};\n var linea = {};\n\n console.log(\"ini ENVIO WS PLANTILLA!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\");\n\n\n db.transaction(function (tx) {\n\n tx.executeSql(s, undefined,\n function (tx, result) {\n\n if (result.rows.length > 0) {\n\n var cab = result.rows.item(0);\n\n console.log(cab);\n\n // operacion= N => Nueva plantilla\n // operacion= M => Modificar plantilla\n var operacion=cab.operacion;\n console.log(\"OPERACION => \" + operacion);\n\n\n //CREAMOS LA CABECERA\n res.internalId = 0;\n\n\n //res.deliveryDate = \"0000-00-00T00:00:00+0200\"; //\"2014-04-02T00:00:00+0200\"; // hora minuto y segundo ???\n var fechaActual = nowBD();\n fechaActual = formatearFechaWS(fechaActual);\n res.documentDate = fechaActual;//formatearFechaWS(cab.documentDate); //\"2014-03-27T00:00:00+0200\";\n res.deliveryZoneId = $(\"#ptxtZonaCabeceraPlantilla\").val();//cab.idDeliveryZone;\n res.isTemplate = 1;\n\n res.number = cab.number; //?? AL sistema\n res.purchaseCenterId = cab.idPurchaseCenter;\n res.reference=\"\"; //cab.reference; NULL\n res.sourceId = cab.sourceId; //?? C Central, D Despatx, T Tablet\n res.status = 0;\n res.type = \"P\"; //?? Proveidor P Magatzem A\n res.vendorId = cab.idVendor;\n res.warehouseId = 999999; //?? 999999\n if (cab.observaciones==\"\" || cab.observaciones==\"undefined\" || cab.observaciones==\"null\" || cab.observaciones==null || cab.observaciones==undefined) {res.comments= $(\"#pedidosPopUpInputNombrePlantilla\").val();}\n else {res.comments= cab.observaciones;}\n\n\n //res.transactionId=\"123234523a1232341232w45==\"+(Math.random() * 100000);\n\n if (reenvio==1) {\n res.transactionId=cab.transactionCode;\n\n } else {\n //res.transactionId=\"123234523a1232341232w45==\"+(Math.random() * 100000);\n var rand=Math.floor(Math.random() * 1000);\n if (rand < 1000 ) { rand=rand*10; }\n\n res.transactionId=localStorage['transactionId']+\"\"+rand+\"\"+idOrder;\n\n\n var u = \" UPDATE ordersPending SET error=0, transactionCode='\"+res.transactionId+\"' WHERE idInternalOrder=\"+idOrder;\n\n console.log(u);\n tx.executeSql (u, undefined, function (tx) { } );\n }\n\n\n var u = \" UPDATE ordersPending SET error=0, transactionCode='\"+res.transactionId+\"' WHERE idInternalOrder=\"+idOrder;\n\n console.log(u);\n tx.executeSql (u, undefined, function (tx) { } );\n\n res.templateLines= new Array();\n\n var d=\"SELECT * FROM ordersPendingDetail WHERE idInternalOrder=\"+idOrder;\n\n //DETALLE del pedido\n tx.executeSql(d, undefined,\n function (tx, result2) {\n\n if (result2.rows.length > 0) {\n for (var i = 0; i < result2.rows.length; i++) {\n\n linea = result2.rows.item(i);\n\n res.templateLines.push({\n internalId: 0,\n itemId: linea.idItem,\n lineNumber: linea.lineNumber,\n logisticsChainId: linea.idLogisticsChain,\n ordinalType: linea.ordinalType,\n quantity: linea.quantity,\n firstSizeId: \"000\",\n secondSizeId: \"000\",\n unitType: linea.unitType\n\n });\n }\n\n insertLog(1,5,\"Plantilla finalizada ok\",linea.idItem);\n\n console.log(\"\");\n console.log(res);\n\n\n pEliminarErroresPedido(idOrder);//eliminamos el error para enviarlo y no duplicar articulos\n\n\n if (operacion ==\"N\") {\n\n res.sourceId = \"T\"; //?? C Central, D Despatx, T Tablet\n res.number = 0;\n\n var uri = \"/templates\";\n var dir = host + uri;\n console.log(\"ANADIR PLANTILLA AL WS \" + dir);\n console.log(JSON.stringify(res));\n $.ajax({\n\n //async: false,\n url: dir,\n beforeSend: function (request) {\n request.setRequestHeader(\"Areas-Token\", token);\n },\n contentType: 'application/json',\n //dataType: \"json\",\n type: 'POST',\n crossDomain: true,\n success: pPlantillaNuevaPostOk,\n error: pPlantillaNuevaPostError,\n data: JSON.stringify(res),\n timeout: 30000\n });\n } else if (operacion ==\"M\") {\n\n console.log(\"VAMOS A BORRAR LA PLANTILLA\");\n pPlantillaBorrar(cab.reference);\n\n var uri = \"/templates\";\n var dir = host + uri;\n console.log(\"MODIFICAR PLANTILLA EN WS \" + dir);\n console.log(JSON.stringify(res));\n $.ajax({\n\n //async: false,\n url: dir,\n beforeSend: function (request) {\n request.setRequestHeader(\"Areas-Token\", token);\n },\n contentType: 'application/json',\n //dataType: \"json\",\n type: 'PUT', // PUT\n crossDomain: true,\n success: pPlantillaModificarPostOk,\n error: pPlantillaModificarPostError,\n data: JSON.stringify(res),\n timeout: 30000\n });\n } else {\n console.log(\"Ninguna operación disponible => \" + operacion + \" - \" +res.operacion);\n }\n console.log(\"FINAL \");\n\n } else {\n\n console.log(\"EL PEDIDO NO TIIENE elementos \");\n }\n\n }, error);\n\n } else {\n console.log(\"Pedido TMP no encontrado = \" + idOrder);\n\n }\n\n }, error);\n\n });\n\n}", "getIdNuevo(e, id) {\n return `nv_${e.getNombreFuncionGeneradora()}_${id}`;\n }", "function numero(key){\n\tif(respuesta == key){\n\n\t\tmostrarMensaje(\"../../imagen/icon/exito.png\",\"matematica/felicitaciones.webm\",\"../../audio/efecto_sonido/felicitaciones.ogg\");\n\n\t\tfin = getActual();\t\n\n\t\tanotarDesempeno();\n\n\t\tsetTimeout(function(){\n\t\t\tcargarActividad();\n\t\t\t$(\"#campoRespuesta\").val(\"\");\n\t\t}, 3000);\n\n\t\t$(\"#intentoCont\").val(0);\t\t\t\n\t}\n\telse{\n\t\tmostrarMensaje(\"../../imagen/icon/fracaso1.png\",\"matematica/error_repetir.webm\",\"../../audio/efecto_sonido/error_repetir.ogg\");\n\n\t\t$(\"#intentoCont\").val( parseInt($(\"#intentoCont\").val()) + 1 );\n\t}\n}", "getNewId(){\r\n this._id = this._id || this.data && this.data.length || 0;\r\n this._id++;\r\n\r\n return this._id;\r\n }", "leerProductosConId(id){\n if (this.listaProductos[id-1]==undefined) {\n return {error:\"Ese producto no existe aun\"}\n } else {\n return this.listaProductos[id-1]\n } \n }", "leerDatosProducto(producto){\n const infoProducto = {\n imagen : producto.querySelector('img').src,\n titulo : producto.querySelector('h2').textContent,\n precio : producto.querySelector('h4').textContent,\n id : producto.querySelector('a').getAttribute('data-id'),\n cantidad : 1\n }\n let productosLS;\n productosLS = this.obtenerProductosLocalStorage();\n productosLS.forEach(function(productoLS){\n if(productoLS.id === infoProducto.id){\n productosLS = productoLS.id;\n }\n });\n if(productosLS === infoProducto.id){\n Swal.fire({\n type: 'Epa chamo',\n title: '!! Epa chamo !!',\n text: 'Ya agregaste esta arepa',\n confirmButtonText: 'Sigue comprando mi pana',\n confirmButtonColor: 'rgba(255, 241, 48)'\n })\n }\n else{\n this.insertarCarrito(infoProducto);\n }\n }", "function enviarCantidad(cantidad, nombre){\n ventas=JSON.parse(localStorage.getItem('carrito'));\n ventas.forEach(element => {\n if (element.titulo==nombre){\n element.cant=cantidad;\n }\n });\n localStorage.setItem('carrito',JSON.stringify(ventas));\n actualizaMonto();\n}", "constructor(){\n this.hasSavedValues = false\n this.publicoAlvoSim= 0,\n this.publicoAlvoNao= 0,\n this.publicoAlvoALVA= 0,\n this.XER= 0,\n this.COP= 0,\n this.listaPrefixos= [],\n this.operacaoNaoVinculada= 0,\n this.operacaoVinculada= 0,\n this.operacaoVinculadaEmOutroNPJ= 0,\n this.acordoRegPortalSim= 0,\n this.acordoRegPortalNao= 0,\n //this.acordoRegPortalDuplicados= 0,\n this.totaisEstoque = 0,\n this.totaisFluxo = 0,\n this.estoqueNumber= 0,\n this.fluxoNumber= 0,\n this.duplicadoSimNao = 0,\n this.analisadoSimNao = 0\n }", "function presionarNumero(numero){\n console.log(\"numero\",numero)\n\n calculadora.agregarNumero(numero)\n actualizarDisplay()\n}", "getCorreo () {\n return this.correo;\n }", "presupuestoRestante(cantidad) {\n const valorRestante = cantidadPresupuesto.presupuestoRestante(cantidad);\n restanteSpan.innerHTML = `${valorRestante}`;\n this.comprobarPresupuesto();\n }", "function preenche(){\n if(comentario.comentario==\"\"){\n c.email.innerText = \"user: \" + comentario.usuario.email;\n c.textoComentario.innerHTML = 'comentario apagado';\n c.botaoEnviarComentario = c.botoes.children[0];\n }else{\n c.email.innerText = \"user: \" + comentario.usuario.email;\n c.textoComentario.innerHTML = comentario.comentario;\n c.botaoEnviarComentario = c.botoes.children[0];\n }\n }", "function modif(elemento){\n\t// obtengo el id actual\n\tvar id = elemento.id;\n\t// le digo que la variable modificar es idual a ese id\n\tmodificar = parseInt(id);\n\t// le coloco el dato del id al localstorage\n\tlocalStorage.setItem(\"id\",modificar);\n}", "function envoieInfo(){\n sendValue(node_url, maxtable());\n}", "async store(req,res){\n let theLoai = new TheLoai();\n theLoai.columns.tenTheLoai = req.body['ten-the-loai'];\n theLoai.columns.moTa = req.body['mt-the-loai'];\n try {\n await theLoai.save(true);\n res.send({complete:true,newTheLoai:theLoai,mess:'Thêm thành công!'});\n } catch (error) {\n res.send({complete:false});\n }\n \n }", "getTracking() {\n return this.trackingPaquete;\n }", "leerDatosProducto(producto){\n const infoProducto = {\n imagen : producto.querySelector('img').src,\n titulo: producto.querySelector('h6').textContent,\n precio: producto.querySelector('.precio span').textContent,\n id: producto.querySelector('a').getAttribute('data-id'),\n cantidad: 1\n }\n let productosLS;\n productosLS = this.obtenerProductosLocalStorage();\n productosLS.forEach(function (productoLS){\n if(productoLS.id === infoProducto.id){\n productosLS = productoLS.id;\n }\n });\n this.insertarCarrito(infoProducto);\n \n }", "__crearDummy(annoMesDia, idLocal, auditor){\n return {\n idDummy: this.idDummy++, // asignar e incrementar\n aud_idAuditoria: null,\n aud_fechaProgramada: annoMesDia,\n aud_fechaProgramadaFbreve: '',\n aud_fechaProgramadaDOW: '',\n aud_idAuditor: auditor,\n local_idLocal: idLocal,\n local_ceco: '-',\n local_direccion: '',\n local_comuna: '',\n local_region: '',\n local_nombre: '-',\n local_stock: '',\n local_horaApertura: '',\n local_horaCierre: '',\n local_fechaStock: '',\n cliente_nombreCorto: ''\n }\n }", "static getLastId() {\r\n let lastId = 0\r\n if (utilizadores.length > 0) {\r\n lastId = utilizadores[utilizadores.length - 1].id\r\n console.log('O lastId do utilizador é = ' + lastId)\r\n }\r\n\r\n return lastId\r\n }", "function cumpleanosModificadonObjeto(persona) {\n persona.edad += 1;\n}", "function subirCantidadProducto(e){\n for (let i = 0; i < carrito.length; i++) {\n if(e.target.dataset.id == carrito[i].nombre && carrito[i].cantidad >0){\n carrito[i].cantidad++;\n localStorage.setItem('datos',JSON.stringify(carrito))\n escribirDatosCarrito(carrito);\n } \n }\n }", "actualizarUsuario() {\n let calculo = (this.usuario.peso / (this.usuario.estatura * this.usuario.estatura)) * 10000;\n this.x = calculo.toFixed(2)\n this.usuario.IMC = this.x\n let posicion = this.lista_usuario.findIndex(\n usuario => usuario.id == this.usuario.id\n );\n this.lista_usuario.splice(posicion, 1, this.usuario);\n localStorage.setItem(posicion, this.usuario);\n this.usuario = {\n tipoidentificacion: \"\",\n id: \"\",\n nombres: \"\",\n apellidos: \"\",\n correo: \"\",\n peso: \"\",\n estatura: \"\",\n IMC: \"\",\n acciones: true\n };\n this.saveLocalStorage();\n this.enEdicion = false\n }", "function getorderId() {\n let response=localStorage.getItem('response');\n response=JSON.parse(response)\n let orderId=response.orderId;\n return orderId\n}", "function addCart(nome, valor, info){\n let list = {\n nome: nome,\n valor: valor,\n informacao: info\n };\n setPedido(oldArray => [...oldArray, list])\n setAcao(!acao)\n //await AsyncStorage.setItem('@pedido', JSON.stringify(pedido));\n }", "function addProduit (id, nom, prix) {\n\tlet detailProduit = [id, nom, prix];\n\tcontenuPanier.push(detailProduit);\n\tlocalStorage.panier = JSON.stringify(contenuPanier);\n\tcountProduits();\n}", "getNewTransactionId()\n {\n let id = this.meta[\"transactions.next-id\"]\n this.meta[\"transactions.next-id\"] = id + 1\n return id\n }", "function adicionarAoCarrinho(livroId,preco){\n\tvar quantidade = 1;\n\tlet carrinho = [];\n\tvar estaNaLista = false;\n\t//Verifica se já tem o mesmo livro no carrinho \n\tif(localStorage.getItem(\"carrinho\")){\n\t\tcarrinho = JSON.parse(localStorage.getItem(\"carrinho\"));\n\t\tcarrinho.forEach(function(item, indice){\n\t\t\tconsole.log(item);\n\t\t\tif(livroId == item.id){\n\t\t\t\t// se tiver, apenas aumenta a quantidade.\n\t\t\t\titem.quantidade += 1;\n\t\t\t\testaNaLista = true;\n\t\t\t}\n\t\t});\n\t}\n\tif(!estaNaLista){\n\t\tjsonLivro = new Object(); \n\t\tjsonLivro['id'] = livroId;\n\t\tjsonLivro['quantidade'] = quantidade;\t\t \t\n\t\tjsonLivro['preco'] = preco;\n\t\tcarrinho.push(jsonLivro);\n\t}\n\t\n\tlocalStorage.setItem(\"carrinho\", JSON.stringify(carrinho));\n\tconsole.log(carrinho);\n\tquantidadeCarrinho.innerHTML = carrinho.length;\n}", "function incrementarID() {\n if (temas.length > 0) {\n topicID = temas[temas.length-1].tema_id+1;\n } else {\n topicID = 1;\n }\n}", "function information(e) {\n let ancestro = Ancestro(e.target, 0);\n var id = ancestro.id;\n id = id.slice(0, -3);\n\n window.location = `../../html/administrador/AlumnoEditar.html?usu_id=${params.get('usu_id')}&alu_id=${id}`;\n}", "async save(objeto) {\n \n\n const contenido = await this.read();\n\n let id = contenido.length + 1;\n\n let item = {\n id: objeto.id,\n timestamp: objeto.timestamp,\n id_producto: objeto.producto.id,\n }; \n try {\n await knex(\"carrito\").insert(item);\n return item;\n } catch (error) {\n throw error;\n } \n \n }", "async function savePedido(){\n try {\n await AsyncStorage.setItem('@Pedido', JSON.stringify(pedido));\n } catch (error) {\n // Error retrieving data\n }\n }", "function getMessageID(data) {\n if (device.platform === \"iOS\") {\n messageRowId = data.Parameter;\n } else {\n messageRowId = data.extras[\"Parameter\"];\n }\n window.localStorage.setItem(\"messageRowId\", messageRowId);\n}", "gsi1key() {\n return{\n 'GSI1PK': 'OrderMail',\n 'GSI1SK': `OrderMail#${this.id}`\n }\n }", "static update_pago_deleted(cadenaDeConexion, idIngreso) {\n\n sqlNegocio(\n cadenaDeConexion,\n \"SELECT * from info_ingresos WHERE idIngreso = \" + idIngreso,\n [],\n function (err, res) {\n sqlNegocio(\n cadenaDeConexion,\n \"UPDATE info_ingresos SET aCuenta = aCuenta-\" + (res[0].aCuenta) + \" WHERE idIngreso = \" + res[0].codOperacion,\n [],\n function (err, res18) {\n if (err) {\n console.log(\"error: \", err);\n result(null, err);\n }\n });\n });\n }", "get darId() {\n return this.id;\n }", "get() {\r\n let courant = this.compteur;\r\n this.compteur++;\r\n if (this.compteur === this.adresses.length) this.compteur = 0;\r\n return this.adresses[courant];\r\n }", "function insertAnuncio(anuncio) {\n\n // Calcula novo Id a partir do último código existente no array para novo cadastro. Se edição, retorna valor salvo\n if (edicao != 1) {\n novoId = (dados.livros.length)+1;\n }\n else {\n novoId = idAtual;\n }\n \n // Organiza os dados na forma do registro\n let novoAnuncio = {\n \"user_id\": usuario_logado,\n \"id\": novoId,\n \"fotAn\": anuncio.fotAn,\n \"titAn\": anuncio.titAn,\n \"descAn\": anuncio.descAn,\n \"locAn\": anuncio.locAn,\n \"contAn\": anuncio.contAn\n };\n\n // Insere o novo objeto no array para novos cadastros, ou atualiza em caso de edição\n if (edicao != 1) {\n dados.livros.push(novoAnuncio);\n displayMessage(\"Anuncio inserido com sucesso!\");\n }\n else {\n dados.livros[novoId-1] = novoAnuncio;\n displayMessage(\"Anuncio atualizado com sucesso!\");\n }\n\n // Atualiza os dados no Local Storage\n localStorage.setItem('dados', JSON.stringify(dados));\n\n // Altera \"edicao\" para diferente de 1, considerando que a próxima tarefa seja novo cadastro\n edicao = 0;\n}", "function actualizarTipoAnterior( ) {\n controlFormStock();\n\tdocument.forms['MWEBNuevaEntregaForm'].tipoAnterior.value=document.forms['MWEBNuevaEntregaForm']['infoEntregaOT.idTipo'].value;\n\tlimpiarFormStock();\n}", "function getStoreId() {\n var id = \"\";\n for(var i in dd.records){\n if(i!=\"remove\"){\n id = dd.records[i].id;\n }\n }\n return id;\n }", "function Verificacion(Objeto, Tipo) {\n var LongitudValor = Objeto.value.length + 1\n var SubCadena = String.fromCharCode(window.event.keyCode).toUpperCase();\n // PARA ACENTOS\n if (window.event.keyCode == 180 ||\n window.event.keyCode == 225 ||\n window.event.keyCode == 233 ||\n window.event.keyCode == 237 ||\n window.event.keyCode == 243 ||\n window.event.keyCode == 250 ||\n window.event.keyCode == 193 ||\n window.event.keyCode == 201 ||\n window.event.keyCode == 205 ||\n window.event.keyCode == 211 ||\n window.event.keyCode == 218 ||\n window.event.keyCode == 13) {\n window.event.keyCode = String.fromCharCode(window.event.keyCode).charCodeAt(0);\n return;\n }\n //aasdfasdf\n\n var Cadena = \"\"\n switch (Tipo) {\n case 1: //Letras\n var cadStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ '\n break;\n case 2: //Números\n var cadStr = \"0123456789\"\n break;\n case 3: //Letras y Números\n var cadStr = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ '\n break;\n case 4: //Decimales RCR\n var cadStr = '0123456789.'\n break;\n case 5: //Hora\n var cadStr = '0123456789:'\n break;\n case 6: //CURP y RFC\n var cadStr = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'\n break;\n case 7: //Especial\n var cadStr = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ- '\n break;\n case 8: //Telefono\n var cadStr = '0123456789-'\n break;\n case 9: //Ffecha\n var cadStr = '0123456789/'\n break;\n case 10: //DOMICILIO\n var cadStr = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ#. '\n break;\n case 11: //NÚMEROS SIN CEROS\n var cadStr = '123456789'\n break;\n case 12: //CFG. 22-MAY-03 SOLO NÚMEROS O PALABRA 'ADMON' SOLO PARA AUTENTIFICACIÓN DE USUARIO\n var cadStr = '0123456789ADMON'\n break;\n case 13: //OBSERVACIONES\n var cadStr = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ#.;-:,()/ %\"$ÁÉÍÓÚáéíóú'\n break;\n case 14: //Decimales RCR\n var cadStr = '0123456789.-'\n break;\n case 18: //Dictamen\n var cadStr = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-/()'\n break;\n case 19: //SOLO LECTURA\n var cadStr = ''\n break;\n }\n if (LongitudValor > 0) {\n for (i = 1; i <= cadStr.length; i++) {\n if ((cadStr.substring(i, i - 1) == SubCadena) || (window.event.keyCode == 209) || (window.event.keyCode == 241)) {\n Cadena = cadStr.substring(i, i - 1);\n }\n }\n if (Cadena.length == 0) {\n window.event.keyCode = 0\n }\n else {\n window.event.keyCode = String.fromCharCode(window.event.keyCode).toUpperCase().charCodeAt(0);\n }\n return;\n }\n}", "_calculateOrderNo(request, forefront) {\n if (request.handledAt)\n return null;\n const timestamp = Date.now();\n return forefront ? -timestamp : timestamp;\n }", "save(receipt) {\n //receipt.id = crypto.randomBytes(20).toString('hex');\n return 1; \n }", "toString(){\r\n //Se aplica poliformismo (multiples formas en tiempo de ejecucion)\r\n //el metodo que se ejecuta depende si es una referencia de tipo padre \r\n //o de tipo hijo\r\n return this.nombreCompleto();\r\n }", "function panggilSimpanRecord(){\n\n }", "nodoHijo(jugada){\n //console.log(\"Jugadas totales: \" + this.hijos.size)\n let hijo = this.hijos.get(jugada.hash())\n //console.log(\"CONTROL \" + hijo.jugada.hash())\n if (hijo === undefined){\n throw new Error (\"No es posible la jugada\")\n }\n else if (hijo.nodo === null){\n throw new Error (\"El hijo no ha sido expandido\")\n }\n\n return hijo.nodo;\n }", "function saveLastArticleNumber(){\n $.ajax({\n url: 'ajax/order.php',\n data: { action: \"saveLastArticleNumber\", data: {'id': defaults_id, 'unit': unit, 'artNr': artNrZaehler, 'service': service } },\n type: \"POST\",\n success: function(){\n //alert( 'saveLastArticleNumber()' );\n },\n error: function(){\n alert( 'Error: saveLastArticleNumber() !' );\n }\n });\n }", "static traktIdFromData(data) {\n if (!data) return 0;\n let movieId = data.movie && data.movie.ids && data.movie.ids.trakt || null;\n if (movieId) return movieId;\n let episodeId = data.episode && data.episode.ids && data.episode.ids.trakt || null;\n if (episodeId) return episodeId;\n return 0;\n }", "function IdCuenta() {\n\n if (usuario.user.id) {\n console.log('entro')\n axios.get(`http://${URL}/api/account/?userId=${usuario.user.id}`)\n .then((resp) => {\n // console.log('LO QUE SERIA LA CUENTA', resp.data.data.id)\n setIdCuenta(resp.data.data.id)\n })\n .catch(error => {\n console.log(error.response)\n })\n\n }\n\n }", "get id(){\n let id = this.data.id;\n if (id === undefined){\n id = this._id = (this._id || ++idCounter);\n }\n return id;\n }", "function soltar(evento){\n\t//Aumentamos el contador de los productos ya que añadimos un producto al carrito\n\tcontadorCompra++;\n\tevento.preventDefault();\n\t//Cojemos el id del producto soltado y lo guardamos en el array\n\tvar id = evento.dataTransfer.getData(\"Text\");\n\tvar nuevoId = ids.push(id);\n\t//Guardamos el array de las id de los productos en un localStorage\n\tlocalStorage[\"ids\"] = JSON.stringify(ids);\n\telemento = document.getElementById(\"contador\");\n\telemento.innerHTML=contadorCompra;\n}", "function bajarCantidadProducto(e){\n for (let i = 0; i < carrito.length; i++) {\n if(e.target.dataset.id == carrito[i].nombre && carrito[i].cantidad >0){\n carrito[i].cantidad--;\n localStorage.setItem('datos',JSON.stringify(carrito))\n escribirDatosCarrito(carrito);\n \n } \n\n if( carrito[i].cantidad ===0){\n carrito.splice(i,1);\n localStorage.setItem('datos',JSON.stringify(carrito))\n escribirDatosCarrito(carrito);\n escribirCarroVacio()\n iconcarrito.textContent=carrito.length;\n }\n \n }\n}", "function GetInfoEmailingCreationFournisseur(){\n return enumParams(COLUMN_INFORMATION_CREATION_FOURNISSEUR).join();\n}", "function exceso_agua(exceso, costo_exceso, uid_condominio, uid_condomino) {\n\n var newCobro = movimientosref.child(uid_condominio).child(uid_condomino).child('EXCESO').push();\n newCobro.set({\n valor: costo_exceso,\n tipo: true,\n detalle: \"Cobro por exceso de agua: \" + exceso,\n fecha: Date.now()\n })\n //Agregar a saldo\n var newSaldo = saldosref.child(uid_condominio).child(uid_condomino).child('EXCESO').push();\n newSaldo.set({\n valor: costo_exceso,\n tipo: true,\n detalle: \"Cobro por exceso de agua: \" + exceso,\n fecha: Date.now()\n })\n\n\n }", "async atualiza_status_descarregamento( request, response ){\n const { ID, Status, Peso, Comentario, Atualizado_por } = request.body;\n\n\n const [{ Unidade, Placa, Dia, Chegada }] = await connection('fDescarregamento')\n .select('*')\n .where('ID','=', ID)\n .catch( () => response.status(404).json({ err: 'Caminhão não encontrado na base de dados' }));\n\n // Reflete a mudança do status na tabela de status do sqlite\n module.exports.on_status_change({ ID, Status, Unidade, Placa, Dia });\n\n /* Se o status for do tipo 'Em carregamento',\n guardar a Hora e o peso da balança na entrada na unidade */\n if ( Status === evento_chegada ) {\n\n const agora = module.exports.agora();\n\n // Atualiza no sqlite\n await connection('fDescarregamento')\n .update({\n Status,\n Chegada: agora,\n Comentario,\n Atualizado: agora,\n Atualizado_por\n })\n .where( 'ID', '=', ID )\n .catch( (err) => {\n return response.status(404).json({ error: err });\n });\n\n return response.status(200).json({ message: 'Dados atualizados com sucesso!' });\n\n } else if ( Status === evento_pos_pesagem_1 ){\n\n const agora = module.exports.agora();\n\n const dados_c_chegada = {\n Status,\n Peso_chegada: Peso,\n Comentario,\n Atualizado: agora,\n Atualizado_por,\n Chegada: agora,\n };\n\n const dados_s_chegada = {\n Status,\n Peso_chegada: Peso,\n Comentario,\n Atualizado: agora,\n Atualizado_por,\n Chegada: agora,\n };\n\n // Atualiza no sqlite\n await connection('fDescarregamento')\n .update( ( [ null, undefined ].includes( Chegada ) )?dados_c_chegada:dados_s_chegada )\n .where( 'ID', '=', ID )\n .catch( (err) => {\n return response.status(404).json({ error: err });\n });\n\n return response.status(200).json({ message: 'Dados atualizados com sucesso!' });\n\n } else if ( Status === evento_pos_pesagem_2 ){\n\n const agora = module.exports.agora();\n\n const dados_c_chegada = {\n Status,\n Peso_saida: Peso,\n Comentario,\n Atualizado: agora,\n Atualizado_por,\n Chegada: agora,\n };\n\n const dados_s_chegada = {\n Status,\n Peso_saida: Peso,\n Comentario,\n Atualizado: agora,\n Atualizado_por\n };\n\n // Atualiza no sqlite\n await connection('fDescarregamento')\n .update( ( [ null, undefined ].includes( Chegada ) )?dados_c_chegada:dados_s_chegada )\n .where( 'ID', '=', ID )\n .catch( (err) => {\n return response.status(404).json({ error: err });\n });\n\n return response.status(200).json({ message: 'Dados atualizados com sucesso!' });\n\n } else if ( Status === evento_saida ){\n\n const agora = module.exports.agora();\n\n const dados_c_chegada = {\n Status,\n Saida: agora,\n Comentario,\n Atualizado: agora,\n Atualizado_por,\n Chegada: agora,\n };\n\n const dados_s_chegada = {\n Status,\n Saida: agora,\n Comentario,\n Atualizado: agora,\n Atualizado_por\n };\n\n // Atualiza no sqlite\n await connection('fDescarregamento')\n .update( ( [ null, undefined ].includes( Chegada ) )?dados_c_chegada:dados_s_chegada )\n .where( 'ID', '=', ID )\n .catch( (err) => {\n return response.status(404).json({ error: err });\n });\n\n return response.status(200).json({ message: 'Dados atualizados com sucesso!' });\n\n } else {\n\n const agora = module.exports.agora();\n\n const dados_c_chegada = {\n Status,\n Atualizado: agora,\n Atualizado_por,\n Chegada: agora,\n };\n\n const dados_s_chegada = {\n Status,\n Atualizado: agora,\n Atualizado_por\n };\n\n // Atualiza no sqlite\n await connection('fDescarregamento')\n .update( ( [ null, undefined ].includes( Chegada ) )?dados_c_chegada:dados_s_chegada )\n .where( 'ID', '=', ID )\n .catch( (err) => {\n return response.status(404).json({ error: err });\n });\n\n return response.status(200).json({ message: 'Dados atualizados com sucesso!' });\n\n };\n\n }", "function ajouterArticle() {\n const [panier, setPanier] = props.etatPanier;\n if(panier[props.id]) {\n panier[props.id].qte++;\n }\n else {\n panier[props.id] = {prix: props.prix, qte: 1}\n }\n // Maintenant il faut changer l'état du panier avec setPanier\n setPanier(panier);\n console.log(panier);\n }", "function mioRuolo(offerta){\r\n return (offerta.ospitato === JSON.parse(localStorage.utente).username)?\"Ospitato\":\"Ospitante\";\r\n}" ]
[ "0.57631433", "0.57293063", "0.56946915", "0.56655455", "0.56218576", "0.5588355", "0.55774826", "0.5539779", "0.5488174", "0.5485053", "0.5478459", "0.5471516", "0.5451059", "0.54306024", "0.54273885", "0.5418395", "0.54030174", "0.5362091", "0.53156966", "0.5313468", "0.5299042", "0.52953875", "0.5287582", "0.5282009", "0.52515334", "0.52507806", "0.5249563", "0.52408636", "0.5239166", "0.5231354", "0.52231014", "0.52231014", "0.52231014", "0.5206658", "0.5203294", "0.5201255", "0.51980466", "0.5190465", "0.5189239", "0.5189125", "0.5183064", "0.5183045", "0.51640517", "0.5155189", "0.514204", "0.5137496", "0.5134984", "0.51324594", "0.51188767", "0.5113731", "0.51128805", "0.51096815", "0.5105946", "0.5103463", "0.5103189", "0.5101355", "0.50984156", "0.509052", "0.50902724", "0.5078124", "0.50711846", "0.5066872", "0.50606", "0.5057404", "0.50546885", "0.5053872", "0.5052266", "0.50499564", "0.5048461", "0.5048064", "0.50452757", "0.5040543", "0.5039443", "0.5038129", "0.5036737", "0.503569", "0.50251967", "0.50084794", "0.50073415", "0.5006659", "0.5005921", "0.5005317", "0.50052315", "0.50033396", "0.49979866", "0.49926588", "0.49893516", "0.4987945", "0.49855763", "0.4985359", "0.49821287", "0.497688", "0.49745932", "0.4973218", "0.4969338", "0.49680218", "0.49679172", "0.49669194", "0.49662068", "0.49640167", "0.49637952" ]
0.0
-1
Make the scroll to top button scroll onto the screen.
function animatedSpawn() { let button = document.getElementById("to-top-button-container"), speed = 2, currentPos = -100; button.style.bottom = -100+"px"; let animateInterval = setInterval(() => { currentPos += speed; if (currentPos >= 20 && speed > 0) { currentPos = 20; speed = -2 * speed; } if (currentPos <= 20 && speed < 0) { clearInterval(animateInterval); } button.style.bottom = currentPos+"px"; }, 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toTheTopButton() {\n window.scrollTo({\n top: 0,\n behavior: \"smooth\",\n });\n }", "function scrollToTop() {\n\troot.scrollTo({\n\t\ttop: 0,\n\t\tbehavior: \"smooth\"\n\t});\n}", "function scrollToTop () {\n //getting the currentPosition position of the button\n let currentPosition = document.documentElement.scrollTop || document.body.scrollTop;\n //if the position is greater than 0 then we'll scroll to the top of the page\n if (currentPosition > 0) {\n //scrolling back to the top of the page\n window.scrollTo(0, currentPosition - currentPosition / 14.6);\n // Animating our scroll with the javascript RequestAnimationFrame function\n RequestAnimationFrame(scrollToTop);\n }\n }", "function setGoToTopBtn() {\n $toTopBtn.click(function( e ) {\n e.preventDefault();\n $( 'html, body' ).animate({ scrollTop: 0 }, 'slow' );\n });\n }", "function scrollToTop() {\n window.scrollTo({\n top: 0,\n behavior: \"smooth\",\n });\n}", "scrollToTop() {\n scroll.scrollToTop();\n }", "function onScrollToTop() {\n ScrollToTop();\n}", "scrollToTop () {\n this.scrollView(Infinity);\n }", "scrollToTop() {\n const that = this;\n let scrollTop =\n window.pageYOffset ||\n document.documentElement.scrollTop ||\n document.body.scrollTop;\n that.scrollTop = scrollTop;\n if (that.scrollTop > 0) {\n that.btnFlag = true;\n } else {\n that.btnFlag = false;\n }\n }", "function toTop() {\n document.body.scrollTop= 0;\n hideButton();\n}", "function scrollToTop() {\n\tvar $btnToTop = $('.btn-to-top');\n\n\tif ($btnToTop.length) {\n\t\tvar $page = $('html'),\n\t\t\tminScrollTop = 300;\n\n\t\t$(window).on('load scroll resizeByWidth', function () {\n\t\t\tvar currentScrollTop = $(window).scrollTop();\n\n\t\t\t$page.toggleClass('to-top-show', (currentScrollTop >= minScrollTop));\n\t\t});\n\n\t\t$btnToTop.on('click', function (e) {\n\t\t\te.preventDefault();\n\n\t\t\tTweenMax.to(window, 0.3, {scrollTo: {y: 0}, ease: Power2.easeInOut});\n\t\t})\n\t}\n}", "function scrollToTop() {\n window.scrollTo({\n top: 0,\n behavior: \"smooth\",\n });\n}", "function scrollToTop () {\n bodyElement.scrollTo({\n top: 0,\n behavior: 'smooth'\n }) ||\n rootElement.scrollTo({\n top: 0,\n behavior: 'smooth'\n })\n}", "goBackToTop() {\n //TODO: Add animation\n scrollTo(undefined, 0);\n }", "ScrollToTop() {\n /** The user is scrolled to the top of the page */\n document.body.scrollTop = 0;\n document.documentElement.scrollTo({\n top: '0',\n behavior: 'smooth',\n });\n }", "function scrollToTop() {\n let friends = document.getElementById(\"friends\");\n friends.scroll({\n top: 0,\n left: 0,\n behavior: \"smooth\",\n });\n}", "function scrollToTop() {\n window.scrollTo({\n top: 0, // could be negative value\n left: 0,\n behavior: 'smooth'\n });\n}", "function scrollToTop() {\n Reporter_1.Reporter.debug('Scroll to the top of the page');\n scrollToPoint(0, 0);\n }", "function scrollToTop() {\n window.scrollTo(0, 0);\n}", "function toTop() {\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: \"smooth\"\n });\n}", "function scrollToTop() {\n window.scroll({\n top: 100,\n left: 100,\n behavior: 'smooth'\n});\n}", "function scrollToTop() {\n\n let scrollHeight = 200;\n\n if (document.body.scrollTop > scrollHeight || document.documentElement.scrollTop > scrollHeight) {\n scrollButton.style.display = \"block\";\n } else {\n scrollButton.style.display = \"none\";\n }\n\n}", "goToTop() {\n this.content.nativeElement.scrollTop = 0;\n this.scrollButton.nativeElement.style.display = \"none\";\n }", "toTop() {\n window.scrollTo(0,0);\n }", "function topFunction() {\r\n \r\n\tconst upBtn = document.getElementById('up');\r\n\tconsole.log(upBtn);\r\n\t\r\n\tupBtn.scrollIntoView({\r\n\t\tbehavior: 'smooth',\r\n\t\tblock: 'start'\r\n\t});\r\n}", "function scrollToTop() {\n\t\tcurrentLocation.hash = '#main';\n\t\twindow.scrollTo(0, this.offSetTop);\n\t}", "scrollToTop() {\n document.documentElement.scrollTop = 500;\n }", "function topFunction() {\n let element = document.getElementById(\"topScroll\");\n element.scrollIntoView({behavior: \"smooth\"});\n}", "function topFunction() {\n window.scrollTo({top: 0, behavior: 'smooth'});\n //document.documentElement.scrollTop = 0;\n }", "function topFunction() {\n\twindow.scrollTo({top: 0, behavior: 'smooth'});\n}", "scrollToTop() {\n window.scrollTo({\n top: 0,\n behavior: 'smooth',\n });\n }", "function scrollToTheTop() {\r\n window.scrollTo({\r\n top: 0,\r\n behavior: 'smooth'\r\n });\r\n}", "function gotoTop() {\n $anchorScroll('add-new-student-button');\n }", "function scrollFunction() {\n if (toTopBtn) {\n toTopBtn.style.display = (toTopBtn && document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) ? \"block\" : \"none\"\n toTopBtn.addEventListener('click', () => window.scrollTo({\n top: 1,\n behavior: 'smooth',\n }))\n }\n}", "function scrollToTop() {\n scrol.innerHTML = `<strong>Top</strong>`;\n scrol.style.cssText = 'position: fixed; bottom : 20; right : 20; background-color: rgba(255, 0, 0, 0.603); color : #fff; width : 50px; height: 25px; text-align: center; cursor: pointer; border-radius: 5px; ';\n scrol.addEventListener('click', function () {\n window.scrollTo({\n top: 0,\n behavior: 'smooth'\n });\n });\n document.body.appendChild(scrol);\n}", "function scrollToTop() {\n if (document.body.scrollTop !== 0 || document.documentElement.scrollTop !== 0) {\n window.scrollBy(0, -150);\n requestAnimationFrame(scrollToTop);\n }\n}", "function toTheTop() {\n\t\t$('#tothetop').click(function(e){\n\t\t\te.preventDefault();\n\t\t\t$(\"html, body\").animate({ scrollTop: 0 }, 800);\n\t\t});\n\t}", "function scrollToTop() {\n window.scroll({top: 0, left: 0, behavior: 'smooth'});\n}", "function topFunction() {\n window.scrollTo({ top: 0, behavior: 'smooth' });\n}", "function topFunction() {\n document.body.scrollTo(0, 3000);\n document.documentElement.scrollTo(0, 3000);\n }", "function GoToTop() {\n\twindow.scrollTo({top: 0, behavior: 'smooth'});\n \t//document.body.scrollTop = 0;\n \t//document.documentElement.scrollTop = 0;\n}", "function toTop(){\n document.body.scrollTop=0\n }", "function topFunction() {\r\n // document.body.scrollTop = 0;\r\n window.scrollTo({ top: 0, behavior: \"smooth\" });\r\n document.documentElement.scrollTo({ top: 0, behavior: \"smooth\" });\r\n}", "function topFunction() {\r\n // document.body.scrollTop = 0;\r\n window.scrollTo({ top: 0, behavior: \"smooth\" });\r\n document.documentElement.scrollTo({ top: 0, behavior: \"smooth\" });\r\n}", "function scrolTop(){\n window.scrollTo(0, 0);\n}", "scrollToTop() {\n this.scrollLines(-this._bufferService.buffer.ydisp);\n }", "function setButtonToTop() {\r\n\t\t//Force to refresh under pjax\r\n\t\t$(\"#go-to-top\").css('left', (Math.max(document.body.clientWidth, 960) - 960) / 2 + 690);\r\n\t\t$(\"#go-to-top\").unbind('click');\r\n\t\t$(\"#go-to-top\").click(function() {\r\n\t\t\t$(\"html, body\").animate({\r\n\t\t\t\t\"scrollTop\": 0\r\n\t\t\t},\r\n\t\t\t400);\r\n\t\t\treturn false;\r\n\t\t});\r\n\r\n\t\tisNotificationPage = isUrlEndWith('/notifications/list');\r\n\t\tisInboxPage = (new RegExp(\"/inbox/[0-9]+$\")).test(window.document.location.pathname);\r\n\t}", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTo({\n top: 0,\n behavior: \"smooth\"\n })\n}", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n var elmntr = document.getElementById(\"quiz_cont\");\n elmntr.scrollTo(0, 0);\n }", "function topFunction() {\n \n elementStorer.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n}", "function toTop(){\n\t$.mobile.silentScroll(0);\n}", "function ScrollToTop() {\n var currentScroll = document.documentElement.scrollTop || document.body.scrollTop;\n if (currentScroll > 0) {\n window.requestAnimationFrame(ScrollToTop);\n window.scrollTo(0, currentScroll - (currentScroll / 5));\n }\n}", "function scrollTop() {\r\n ('body').on('click', '#scroll-top', function() {\r\n $(\"html, body\").animate({\r\n scrollTop: 0\r\n }, '1000');\r\n });\r\n }", "function getTop(){\n $('topbtn').on('click', function(){\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0; \n });\n}", "function gototop(){\t\t\t/*function for the button. when clicked, it goes to top*/\n\twindow.scrollTo({\n\t\ttop:0,\n\t\tleft:0,\n\t\tbehavior:\"smooth\"\n\t});\n\n\t// document.documentElement.scrollTop = 0;\n}", "function topOfPage() {\n window.scrollTo(0, 0);\n }", "function goToTop() {\n if (window.jQuery) {\n\t\t//jQuery().animate(): để tạo hành động tùy chỉnh\n\t\t//Phương thức scrollTop() thiết lập hoặc trả về vị trí thanh cuộn dọc cho các phần tử được chọn.\n \tjQuery('html,body').animate({ scrollTop: 0 }, 'slow');\n } else {\n\t\t//Phương thức scrollIntoView() cuộn phần tử được chỉ định vào vùng hiển thị của cửa sổ trình duyệt.\n document.getElementsByClassName('top')[0].scrollIntoView({\n\t\t\tbehavior: 'smooth', //xác định hình ảnh chuyển tiếp tự động\n\t\t\tblock: 'start',\t\t//chạy theo chiều dọc dừng ở đầu trang.\n\t\t});\n\t\t\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }\n}", "function topFunction() {\n document.body.scrollTo({top: 0, behavior: 'smooth'}) ; // For Safari\n document.documentElement.scrollTo({top: 0, behavior: 'smooth'})// For Chrome, Firefox, IE and Opera\n}", "function topFct(){\r\n window.scrollTo(0, 0);\r\n }", "function goToTop(){\n\tdocument.documentElement.scrollTop = 0;\n}", "function goToTop() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n}", "function toTopFunction() {\n window.scroll({ top: \"0\", behavior: \"smooth\" })\n }", "toTop() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop=0;\n }", "function scrollToTop() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n}", "function scrollFunction_topBtn() {\r\n if (\r\n document.body.scrollTop > 20 ||\r\n document.documentElement.scrollTop > 20\r\n ) {\r\n toTopBtn.style.display = \"block\";\r\n } else {\r\n toTopBtn.style.display = \"none\";\r\n }\r\n }", "function scrollToTopInit() {\r\n\r\n\t\t\t\t\t// Show/hide based on scroll pos\r\n\t\t\t\t\tif ($('.nectar-social.fixed').length == 0) {\r\n\t\t\t\t\t\ttoTopBind();\r\n\t\t\t\t\t} \r\n\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Rounded style\r\n\t\t\t\t\tif ($('body[data-button-style*=\"rounded\"]').length > 0) {\r\n\t\t\t\t\t\tvar $clone = $('#to-top .fa-angle-up').clone();\r\n\t\t\t\t\t\t$clone.addClass('top-icon');\r\n\t\t\t\t\t\t$('#to-top').prepend($clone);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\t// Scroll up click event\r\n\t\t\t\t\t$body.on('click', '#to-top, a[href=\"#top\"]', function () {\r\n\t\t\t\t\t\t$('body,html').stop().animate({\r\n\t\t\t\t\t\t\tscrollTop: 0\r\n\t\t\t\t\t\t}, 800, 'easeOutQuad', function () {\r\n\t\t\t\t\t\t\tif ($('.nectar-box-roll').length > 0) {\r\n\t\t\t\t\t\t\t\t$body.trigger('mousewheel', [1, 0, 0]);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t});\r\n\t\t\t\t\t\r\n\t\t\t\t}", "function topFunction() {\n window.scrollTo({ top: 0, behavior: \"smooth\" }); //working on mobile chrome\n}", "function topFunction() {\n \n document.body.scrollTop = 0;\n \n}", "function toTop() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function gotoTop()\n{\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n}", "function backToTop() {\n\twindow.scrollTo({top: 0, behavior: 'smooth'});\n}", "function toTop(){\n\tif (window.pageYOffset >= bottomPage){\n\t\ttoTopButton.style.display = 'inline';\n\t} else {\n\t\ttoTopButton.style.display = 'none';\n\t}\n}", "function scrollToTop() {\n if( document.body.scrollTop > 0 || document.documentElement.scrollTop > 0 ) {\n TweenMax.to(document.documentElement, 0.5, { \n scrollTop: 0,\n ease: Power3.easeOut\n });\n TweenMax.to(document.body, 0.5, { \n scrollTop: 0,\n ease: Power3.easeOut\n });\n }\n}", "function scrollToTopBookNow() {\n\t\t\t//$(window).scrollTop($('.scrolltobooknow').offset().top);\n\t\t\tdocument.getElementById('scrolltobooknow').scrollIntoView(true);\n\t\t}", "function topFunction() {\n\twindow.scroll({top: 0, behavior: 'smooth'});\n}", "function scrollToTop(evt) {\r\n window.scrollTo(0, 1);\r\n dijit.byId('deals').resize();\r\n}", "scrollToTheTopOfPage() {\r\n browser.executeScript('window.scrollTo(0,0);').then(function () {\r\n logger.Log().debug('++++++SCROLLED UP+++++');\r\n });\r\n }", "function initBackToTopButton() {\n\n $('[data-action=\"go-to-top\"]').on('click', function() {\n\n $(\"body, html\").animate({\n scrollTop: 0\n }, 800)\n\n return false;\n\n }); \n}", "function scrollTop() {\n window.scrollTo({ top: 0, behavior: 'smooth' });\n}", "function topFunction() {\r\n const topsy = document.querySelector(\"#section1\");\r\n topsy.scrollIntoView({ behavior: \"smooth\" });\r\n}", "function scrollToTop() {\r\n\tverticalOffset = typeof(verticalOffset) != 'undefined' ? verticalOffset : 0;\r\n\telement = $('body');\r\n\toffset = element.offset();\r\n\toffsetTop = offset.top;\r\n\t$('html, body').animate({scrollTop: offsetTop}, 500, 'linear');\r\n}", "function toTopFunction() {\n window.scrollTo(0, 0);\n}", "function backToTop() {\n let button = $('.top-btn');\n $(window).on('scroll', () => {\n if ($(this).scrollTop() >= 1000) {\n button.fadeIn();\n } else {\n button.fadeOut();\n }\n });\n button.on('click', (e) => {\n e.preventDefault();\n $('html').animate({ scrollTop: 0 }, 500);\n })\n }", "function scrollToTop(event) {\n event.preventDefault();\n scrollToElem(document.documentElement, document.documentElement.offsetTop, 600);\n scrollToElem(document.body, document.body.offsetTop, 600);\n}", "function go_to_top() {\n document.body.scrollTop = 0; // Safari\n document.documentElement.scrollTop = 0; // Chrome and Firefox\n}", "function scrollToTopBtn() {\n\n\tlet topBtn = document.querySelector('.grid__footer--link'),\n\t\tnavLinks = document.querySelectorAll('.grid__header--nav--item');\n\n\ttopBtn.addEventListener('click', function() {\n\t\tnavLinks[0].classList.add('active');\n\t\tnavLinks[6].classList.remove('active');\n\t});\n}", "function scrollToTop() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n}", "function goToTop(){\n document.documentElement.scrollTop = 0;\n document.body.scrollTop = 0; // for safary users\n}", "backToTopBtn() {\n if (window.scrollY >= 1000) {\n this.show.backToTop = false\n } else {\n this.show.backToTop = true\n }\n }", "function scrollUpToTop() {\n \t\tdocument.body.scrollTop = 0;\n\t\tdocument.documentElement.scrollTop = 0;\n\t\tcreate_search_api();\n\t}", "function gotoAtop () {\n later ( ( () => {\n let t = $ (\"#highUp\").offset ().top;\n scrollTo (null, t);\n //scrollTo (null, 66);\n }), 3999);\n}", "function getScrollToTopBtn() {\n\n if ($(window).scrollTop() > $('.head-section').height() ) {\n\n $('.scroll-to-top').fadeIn();\n\n } else {\n\n $('.scroll-to-top').fadeOut();\n\n }\n\n }", "scrollTop() {\n window.scrollTo({\n top: 0,\n behavior: \"smooth\",\n });\n }", "scrollToTop(animated = true) {\n\tconst scrollHeight = this.contentHeight - this.scrollViewHeight;\n\tif (scrollHeight > 0) {\n\tthis.refs.scrollView.scrollTo({x: 0, y: 0, animated});\n\t}\n\t\n }", "function topScroll() {\r\n\tdocument.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}", "function scrollToTop(value) {\n\t\tvar elmnt = document.getElementById(value);\n\t\telmnt.scrollIntoView();\n\t}", "scrollToTop () {\n // ScrollView with ref\n // scroll to, build in method\n // x 0, y 0, animate true\n this.refs._scrollView.scrollTo({x: 0, y: 0, animated: true})\n }", "function scrollToTop(id) {\n let VBox = document.getElementById(id);\n VBox.scrollTop = 0;\n}", "function topFunction() {\n document.body.scrollTop = 0\n document.documentElement.scrollTop = 0\n }", "function scrollToTop() {\n\n $('body,html').animate({\n scrollTop: 0\n });\n return false;\n }", "function scrollToTop() {\n jQuery(document).on(\"click\", \".scroll-to-top\", function(e) {\n e.preventDefault();\n var top = 0;\n jQuery('body, html').animate({scrollTop: top}, 800); // scroll to top\n });\n}" ]
[ "0.84501475", "0.8380421", "0.8304555", "0.8081443", "0.7991134", "0.79668593", "0.7950554", "0.7948563", "0.7930293", "0.78774136", "0.7875608", "0.78726774", "0.78673387", "0.78286725", "0.7823822", "0.78231", "0.78216136", "0.78036195", "0.77948207", "0.7794795", "0.7771934", "0.77460456", "0.77337646", "0.7731047", "0.77191454", "0.7718124", "0.7713696", "0.7694332", "0.767372", "0.7644778", "0.7644346", "0.76426345", "0.7640097", "0.7623701", "0.7622885", "0.76194245", "0.76162726", "0.7611775", "0.7607694", "0.76011956", "0.7576234", "0.75761557", "0.756073", "0.756073", "0.75132555", "0.7509681", "0.749386", "0.74911815", "0.7490971", "0.7485989", "0.747921", "0.7467573", "0.74572754", "0.7447242", "0.7429524", "0.7423578", "0.741958", "0.7403482", "0.7396609", "0.73835075", "0.7352822", "0.735134", "0.7337642", "0.73351663", "0.7326568", "0.7305739", "0.73029935", "0.7278026", "0.7275558", "0.7264176", "0.7263921", "0.7259248", "0.72476596", "0.7245916", "0.7242525", "0.72284526", "0.7223556", "0.7221964", "0.7213817", "0.7210915", "0.7208033", "0.7206612", "0.7204441", "0.72019005", "0.7199252", "0.71981585", "0.7195013", "0.71931547", "0.7190881", "0.718991", "0.71895456", "0.71858096", "0.7185709", "0.71821934", "0.71696764", "0.7164302", "0.7158419", "0.71412826", "0.71394277", "0.71377", "0.7117346" ]
0.0
-1
Make the scroll to top button scroll off the screen.
function animatedDespawn() { let button = document.getElementById("to-top-button-container"), speed = 2, currentPos = 20; button.style.bottom = 20+"px"; let animateInterval = setInterval(() => { currentPos -= speed; if (currentPos <= -100 && speed > 0) { currentPos = -100; speed = -2 * speed; } if (currentPos >= -100 && speed < 0) { clearInterval(animateInterval); } button.style.bottom = currentPos+"px"; }, 1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toTheTopButton() {\n window.scrollTo({\n top: 0,\n behavior: \"smooth\",\n });\n }", "function toTop() {\n document.body.scrollTop= 0;\n hideButton();\n}", "function setGoToTopBtn() {\n $toTopBtn.click(function( e ) {\n e.preventDefault();\n $( 'html, body' ).animate({ scrollTop: 0 }, 'slow' );\n });\n }", "goToTop() {\n this.content.nativeElement.scrollTop = 0;\n this.scrollButton.nativeElement.style.display = \"none\";\n }", "goBackToTop() {\n //TODO: Add animation\n scrollTo(undefined, 0);\n }", "function scrollToTop() {\n\troot.scrollTo({\n\t\ttop: 0,\n\t\tbehavior: \"smooth\"\n\t});\n}", "scrollToTop () {\n this.scrollView(Infinity);\n }", "function scrollToTop () {\n //getting the currentPosition position of the button\n let currentPosition = document.documentElement.scrollTop || document.body.scrollTop;\n //if the position is greater than 0 then we'll scroll to the top of the page\n if (currentPosition > 0) {\n //scrolling back to the top of the page\n window.scrollTo(0, currentPosition - currentPosition / 14.6);\n // Animating our scroll with the javascript RequestAnimationFrame function\n RequestAnimationFrame(scrollToTop);\n }\n }", "function topFunction() {\n window.scrollTo({top: 0, behavior: 'smooth'});\n //document.documentElement.scrollTop = 0;\n }", "function gototop(){\t\t\t/*function for the button. when clicked, it goes to top*/\n\twindow.scrollTo({\n\t\ttop:0,\n\t\tleft:0,\n\t\tbehavior:\"smooth\"\n\t});\n\n\t// document.documentElement.scrollTop = 0;\n}", "scrollToTop() {\n const that = this;\n let scrollTop =\n window.pageYOffset ||\n document.documentElement.scrollTop ||\n document.body.scrollTop;\n that.scrollTop = scrollTop;\n if (that.scrollTop > 0) {\n that.btnFlag = true;\n } else {\n that.btnFlag = false;\n }\n }", "function scrollToTop() {\n window.scrollTo({\n top: 0,\n behavior: \"smooth\",\n });\n}", "function toTop(){\n document.body.scrollTop=0\n }", "function topFunction() {\n\twindow.scrollTo({top: 0, behavior: 'smooth'});\n}", "function toTop() {\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: \"smooth\"\n });\n}", "backToTopBtn() {\n if (window.scrollY >= 1000) {\n this.show.backToTop = false\n } else {\n this.show.backToTop = true\n }\n }", "function toTop(){\n\t$.mobile.silentScroll(0);\n}", "function onScrollToTop() {\n ScrollToTop();\n}", "toTop() {\n window.scrollTo(0,0);\n }", "function scrollToTop() {\n window.scrollTo({\n top: 0,\n behavior: \"smooth\",\n });\n}", "function topFunction() {\r\n // document.body.scrollTop = 0;\r\n window.scrollTo({ top: 0, behavior: \"smooth\" });\r\n document.documentElement.scrollTo({ top: 0, behavior: \"smooth\" });\r\n}", "function topFunction() {\r\n // document.body.scrollTop = 0;\r\n window.scrollTo({ top: 0, behavior: \"smooth\" });\r\n document.documentElement.scrollTo({ top: 0, behavior: \"smooth\" });\r\n}", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTo({\n top: 0,\n behavior: \"smooth\"\n })\n}", "function topFunction() {\n window.scrollTo({ top: 0, behavior: 'smooth' });\n}", "function backToTop() {\n\twindow.scrollTo({top: 0, behavior: 'smooth'});\n}", "scrollToTop() {\n scroll.scrollToTop();\n }", "function topFunction() {\n document.body.scrollTop = 0\n document.documentElement.scrollTop = 0\n }", "function topScroll() {\r\n\tdocument.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}", "function topFunction() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function topFunction() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function topFunction() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function topFunction() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function topFunction() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function getTop(){\n $('topbtn').on('click', function(){\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0; \n });\n}", "function scrollToTop () {\n bodyElement.scrollTo({\n top: 0,\n behavior: 'smooth'\n }) ||\n rootElement.scrollTo({\n top: 0,\n behavior: 'smooth'\n })\n}", "function topFunction() {\n \n document.body.scrollTop = 0;\n \n}", "function topFunction() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function topFunction() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function GoToTop() {\n\twindow.scrollTo({top: 0, behavior: 'smooth'});\n \t//document.body.scrollTop = 0;\n \t//document.documentElement.scrollTop = 0;\n}", "function topFunction() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function scrollToTop() {\n\tvar $btnToTop = $('.btn-to-top');\n\n\tif ($btnToTop.length) {\n\t\tvar $page = $('html'),\n\t\t\tminScrollTop = 300;\n\n\t\t$(window).on('load scroll resizeByWidth', function () {\n\t\t\tvar currentScrollTop = $(window).scrollTop();\n\n\t\t\t$page.toggleClass('to-top-show', (currentScrollTop >= minScrollTop));\n\t\t});\n\n\t\t$btnToTop.on('click', function (e) {\n\t\t\te.preventDefault();\n\n\t\t\tTweenMax.to(window, 0.3, {scrollTo: {y: 0}, ease: Power2.easeInOut});\n\t\t})\n\t}\n}", "function topFunction() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function scrollToTop() {\n\t\tcurrentLocation.hash = '#main';\n\t\twindow.scrollTo(0, this.offSetTop);\n\t}", "function hideToTop() {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (nectarDOMInfo.scrollTop < 350 || $offCanvasEl.is('.fullscreen.open') ) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tvar $animationTiming = ($('#slide-out-widget-area.fullscreen.open').length > 0) ? 1150 : 350;\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$('#to-top').stop().transition({\r\n\t\t\t\t\t\t\t'bottom': '-30px'\r\n\t\t\t\t\t\t}, $animationTiming, 'easeInOutQuint');\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$window.off('scroll', hideToTop);\r\n\t\t\t\t\t\t$window.on('scroll', showToTop);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "function scrollToTop() {\n\n let scrollHeight = 200;\n\n if (document.body.scrollTop > scrollHeight || document.documentElement.scrollTop > scrollHeight) {\n scrollButton.style.display = \"block\";\n } else {\n scrollButton.style.display = \"none\";\n }\n\n}", "function topFunction() {\r\n document.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n }", "ScrollToTop() {\n /** The user is scrolled to the top of the page */\n document.body.scrollTop = 0;\n document.documentElement.scrollTo({\n top: '0',\n behavior: 'smooth',\n });\n }", "function backToTop() {\n let button = $('.top-btn');\n $(window).on('scroll', () => {\n if ($(this).scrollTop() >= 1000) {\n button.fadeIn();\n } else {\n button.fadeOut();\n }\n });\n button.on('click', (e) => {\n e.preventDefault();\n $('html').animate({ scrollTop: 0 }, 500);\n })\n }", "function topFunction() {\n\twindow.scroll({top: 0, behavior: 'smooth'});\n}", "scrollToTop() {\n window.scrollTo({\n top: 0,\n behavior: 'smooth',\n });\n }", "function scrollToTop() {\n window.scrollTo(0, 0);\n}", "function scrollToTop() {\n window.scrollTo({\n top: 0, // could be negative value\n left: 0,\n behavior: 'smooth'\n });\n}", "function topFunction() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function silentScroll(top){\n if(options.scrollBar){\n container.scrollTop(top);\n }\n else if (options.css3) {\n var translate3d = 'translate3d(0px, -' + top + 'px, 0px)';\n transformContainer(translate3d, false);\n }\n else {\n container.css('top', -top);\n }\n }", "function topFunction() {\n \n elementStorer.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n}", "toTop() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop=0;\n }", "function topFunction() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function topFunction() {\r\n\t\t\tdocument.body.scrollTop = 0;\r\n\t\t\tdocument.documentElement.scrollTop = 0;\r\n\t\t}", "function scrolTop(){\n window.scrollTo(0, 0);\n}", "function topFunction() {\n document.body.scrollTo({top: 0, behavior: 'smooth'}) ; // For Safari\n document.documentElement.scrollTo({top: 0, behavior: 'smooth'})// For Chrome, Firefox, IE and Opera\n}", "function scrollToTheTop() {\r\n window.scrollTo({\r\n top: 0,\r\n behavior: 'smooth'\r\n });\r\n}", "function topFunction () {\n document.body.scrollTop = 0\n document.documentElement.scrollTop = 0\n}", "function toTheTop() {\n\t\t$('#tothetop').click(function(e){\n\t\t\te.preventDefault();\n\t\t\t$(\"html, body\").animate({ scrollTop: 0 }, 800);\n\t\t});\n\t}", "function topFunction() {\n document.body.scrollTop = 0;\n}", "function topFunction() {\n\t\tdocument.body.scrollTop = 0;\n\t\tdocument.documentElement.scrollTop = 0;\n\t}", "function scrollToTop() {\n window.scroll({\n top: 100,\n left: 100,\n behavior: 'smooth'\n});\n}", "function setButtonToTop() {\r\n\t\t//Force to refresh under pjax\r\n\t\t$(\"#go-to-top\").css('left', (Math.max(document.body.clientWidth, 960) - 960) / 2 + 690);\r\n\t\t$(\"#go-to-top\").unbind('click');\r\n\t\t$(\"#go-to-top\").click(function() {\r\n\t\t\t$(\"html, body\").animate({\r\n\t\t\t\t\"scrollTop\": 0\r\n\t\t\t},\r\n\t\t\t400);\r\n\t\t\treturn false;\r\n\t\t});\r\n\r\n\t\tisNotificationPage = isUrlEndWith('/notifications/list');\r\n\t\tisInboxPage = (new RegExp(\"/inbox/[0-9]+$\")).test(window.document.location.pathname);\r\n\t}", "function scrollFunction() {\n if (toTopBtn) {\n toTopBtn.style.display = (toTopBtn && document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) ? \"block\" : \"none\"\n toTopBtn.addEventListener('click', () => window.scrollTo({\n top: 1,\n behavior: 'smooth',\n }))\n }\n}", "function backToTop() {\r\n\r\n var btn = $('#ftrBackToTop');\r\n\r\n if (btn) {\r\n\r\n btn.on('click tap touch', function(e) {\r\n e.preventDefault();\r\n \r\n $('html, body').animate({\r\n scrollTop: 0\r\n }, 1150);\r\n });\r\n\r\n }\r\n }", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function goToTop() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n}", "function topFct(){\r\n window.scrollTo(0, 0);\r\n }", "function scrollToTop() {\n if (document.body.scrollTop !== 0 || document.documentElement.scrollTop !== 0) {\n window.scrollBy(0, -150);\n requestAnimationFrame(scrollToTop);\n }\n}", "function topFunction() {\n document.body.scrollTo(0, 3000);\n document.documentElement.scrollTo(0, 3000);\n }", "function toTopFunction() {\n window.scroll({ top: \"0\", behavior: \"smooth\" })\n }", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function topOfPage() {\n window.scrollTo(0, 0);\n }", "function gotoTop()\n{\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n}", "function scrollToTop() {\n Reporter_1.Reporter.debug('Scroll to the top of the page');\n scrollToPoint(0, 0);\n }", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function topFunction() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function scrollFunction_topBtn() {\r\n if (\r\n document.body.scrollTop > 20 ||\r\n document.documentElement.scrollTop > 20\r\n ) {\r\n toTopBtn.style.display = \"block\";\r\n } else {\r\n toTopBtn.style.display = \"none\";\r\n }\r\n }", "scrollToTop() {\n document.documentElement.scrollTop = 500;\n }", "backToTop(e){\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function topFunction() {\n window.scrollTo({ top: 0, behavior: \"smooth\" }); //working on mobile chrome\n}", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n var elmntr = document.getElementById(\"quiz_cont\");\n elmntr.scrollTo(0, 0);\n }", "function topFunction() {\r\n document.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}", "function topFunction() {\r\n document.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}", "function topFunction() {\r\n document.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}", "function topFunction() {\r\n document.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}", "function topFunction() {\r\n document.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}", "function topFunction() {\r\n document.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}", "function topFunction() {\r\n document.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}", "function topFunction() {\r\n document.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}", "function topFunction() {\r\n document.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}", "function topFunction() {\r\n document.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}" ]
[ "0.81223875", "0.7986207", "0.7811879", "0.77617437", "0.77012914", "0.7694131", "0.76831794", "0.7659606", "0.762973", "0.7610274", "0.76081365", "0.7532701", "0.7500178", "0.74892294", "0.7474345", "0.7461487", "0.7458119", "0.7449892", "0.74492997", "0.74432147", "0.7434653", "0.7434653", "0.7406142", "0.73908323", "0.73892224", "0.73882955", "0.7386132", "0.73716", "0.73586655", "0.73586655", "0.73586655", "0.73586655", "0.73586655", "0.7339256", "0.73364455", "0.7334814", "0.7321814", "0.7321814", "0.7319475", "0.73152554", "0.7310785", "0.72980475", "0.72957325", "0.7295369", "0.72920763", "0.7290213", "0.7288067", "0.72872436", "0.7280145", "0.7278665", "0.7276484", "0.7266649", "0.725266", "0.7250134", "0.7239955", "0.72359484", "0.72306955", "0.721787", "0.7210462", "0.72099626", "0.72096664", "0.7206821", "0.72022796", "0.71989226", "0.71988785", "0.7198715", "0.7197389", "0.7191416", "0.71878624", "0.7186208", "0.7186208", "0.7185065", "0.71822524", "0.71821654", "0.7178887", "0.7177394", "0.7177042", "0.7173042", "0.71730065", "0.7167815", "0.71650976", "0.7163295", "0.7160999", "0.71609217", "0.716053", "0.7160453", "0.7159301", "0.7159301", "0.7159301", "0.7159301", "0.7157959", "0.7156763", "0.7156763", "0.7156763", "0.7156763", "0.7156763", "0.7156763", "0.7156763", "0.7156763", "0.7156763", "0.7156763" ]
0.0
-1
Scroll user to top of page
function scrollToTop() { // safari document.body.scrollTop = 0; // other browsers document.documentElement.scrollTop = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scrollToTop() {\n Reporter_1.Reporter.debug('Scroll to the top of the page');\n scrollToPoint(0, 0);\n }", "ScrollToTop() {\n /** The user is scrolled to the top of the page */\n document.body.scrollTop = 0;\n document.documentElement.scrollTo({\n top: '0',\n behavior: 'smooth',\n });\n }", "function scrollToTop() {\n\troot.scrollTo({\n\t\ttop: 0,\n\t\tbehavior: \"smooth\"\n\t});\n}", "function goToTop(){\n\tdocument.documentElement.scrollTop = 0;\n}", "function scrollToTop() {\n window.scrollTo({\n top: 0,\n behavior: \"smooth\",\n });\n}", "function topOfPage() {\n window.scrollTo(0, 0);\n }", "function scrollToTop() {\n\t\tcurrentLocation.hash = '#main';\n\t\twindow.scrollTo(0, this.offSetTop);\n\t}", "function scrollToTop() {\n window.scrollTo({\n top: 0, // could be negative value\n left: 0,\n behavior: 'smooth'\n });\n}", "function scrollToTop() {\n let friends = document.getElementById(\"friends\");\n friends.scroll({\n top: 0,\n left: 0,\n behavior: \"smooth\",\n });\n}", "function GoToTop() {\n\twindow.scrollTo({top: 0, behavior: 'smooth'});\n \t//document.body.scrollTop = 0;\n \t//document.documentElement.scrollTop = 0;\n}", "function onScrollToTop() {\n ScrollToTop();\n}", "function scrollToTop() {\n window.scrollTo({\n top: 0,\n behavior: \"smooth\",\n });\n}", "scrollToTop() {\n document.documentElement.scrollTop = 500;\n }", "function scrollToTop() {\n window.scrollTo(0, 0);\n}", "function scrollToTheTop() {\n\t// https://stackoverflow.com/questions/1144805/scroll-to-the-top-of-the-page-using-javascript-jquery\n\tvar scrollToTop = window.setInterval(function() {\n\t\t\tvar pos = window.pageYOffset;\n\t\t\tif ( pos > 0 ) {\n\t\t\t\twindow.scrollTo( 0, pos - 20 ); // how far to scroll on each step\n\t\t\t} else {\n\t\t\t\twindow.clearInterval( scrollToTop );\n\t\t\t}\n\t\t}, 16); // how fast to scroll (this equals roughly 60 fps)\n}", "function gotoTop()\n{\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n}", "function goToTop() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n}", "function scrollToTop() {\r\n\tverticalOffset = typeof(verticalOffset) != 'undefined' ? verticalOffset : 0;\r\n\telement = $('body');\r\n\toffset = element.offset();\r\n\toffsetTop = offset.top;\r\n\t$('html, body').animate({scrollTop: offsetTop}, 500, 'linear');\r\n}", "function scrollToTop() {\n window.scroll({top: 0, left: 0, behavior: 'smooth'});\n}", "function scrollToTop() {\n window.scroll({\n top: 100,\n left: 100,\n behavior: 'smooth'\n});\n}", "function scrollToTheTop() {\r\n window.scrollTo({\r\n top: 0,\r\n behavior: 'smooth'\r\n });\r\n}", "goBackToTop() {\n //TODO: Add animation\n scrollTo(undefined, 0);\n }", "function go_to_top() {\n document.body.scrollTop = 0; // Safari\n document.documentElement.scrollTop = 0; // Chrome and Firefox\n}", "function ScrollToTop() {\n var currentScroll = document.documentElement.scrollTop || document.body.scrollTop;\n if (currentScroll > 0) {\n window.requestAnimationFrame(ScrollToTop);\n window.scrollTo(0, currentScroll - (currentScroll / 5));\n }\n}", "function goToTop(){\n document.documentElement.scrollTop = 0;\n document.body.scrollTop = 0; // for safary users\n}", "scrollToTheTopOfPage() {\r\n browser.executeScript('window.scrollTo(0,0);').then(function () {\r\n logger.Log().debug('++++++SCROLLED UP+++++');\r\n });\r\n }", "function scrollToTop() {\n if (document.body.scrollTop !== 0 || document.documentElement.scrollTop !== 0) {\n window.scrollBy(0, -150);\n requestAnimationFrame(scrollToTop);\n }\n}", "function toTop(){\n document.body.scrollTop=0\n }", "function scrollToTop() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n}", "function scrollToTop() {\n\n $('body,html').animate({\n scrollTop: 0\n });\n return false;\n }", "function scrollToTop() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n}", "function scrollToTop() {\n if( document.body.scrollTop > 0 || document.documentElement.scrollTop > 0 ) {\n TweenMax.to(document.documentElement, 0.5, { \n scrollTop: 0,\n ease: Power3.easeOut\n });\n TweenMax.to(document.body, 0.5, { \n scrollTop: 0,\n ease: Power3.easeOut\n });\n }\n}", "function jumpToTop() {\n document.body.scrollTop = 0; // For Safari (who cares? I sure don't! LOL get a REAL computer!)\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n}", "function scrollToTop () {\n //getting the currentPosition position of the button\n let currentPosition = document.documentElement.scrollTop || document.body.scrollTop;\n //if the position is greater than 0 then we'll scroll to the top of the page\n if (currentPosition > 0) {\n //scrolling back to the top of the page\n window.scrollTo(0, currentPosition - currentPosition / 14.6);\n // Animating our scroll with the javascript RequestAnimationFrame function\n RequestAnimationFrame(scrollToTop);\n }\n }", "function topFunction() {\n document.body.scrollTo(0, 3000);\n document.documentElement.scrollTo(0, 3000);\n }", "function toTheTop() {\n\t\t$('#tothetop').click(function(e){\n\t\t\te.preventDefault();\n\t\t\t$(\"html, body\").animate({ scrollTop: 0 }, 800);\n\t\t});\n\t}", "function scrollUpToTop() {\n \t\tdocument.body.scrollTop = 0;\n\t\tdocument.documentElement.scrollTop = 0;\n\t\tcreate_search_api();\n\t}", "function scrollToTop(value) {\n\t\tvar elmnt = document.getElementById(value);\n\t\telmnt.scrollIntoView();\n\t}", "function goTop() \n{\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n}", "function goToTop() {\n if (window.jQuery) {\n\t\t//jQuery().animate(): để tạo hành động tùy chỉnh\n\t\t//Phương thức scrollTop() thiết lập hoặc trả về vị trí thanh cuộn dọc cho các phần tử được chọn.\n \tjQuery('html,body').animate({ scrollTop: 0 }, 'slow');\n } else {\n\t\t//Phương thức scrollIntoView() cuộn phần tử được chỉ định vào vùng hiển thị của cửa sổ trình duyệt.\n document.getElementsByClassName('top')[0].scrollIntoView({\n\t\t\tbehavior: 'smooth', //xác định hình ảnh chuyển tiếp tự động\n\t\t\tblock: 'start',\t\t//chạy theo chiều dọc dừng ở đầu trang.\n\t\t});\n\t\t\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }\n}", "function scrollToTop() {\n document.body.scrollTop = 0; // For Chrome, Safari and Opera\n document.documentElement.scrollTop = 0; // For IE and Firefox\n}", "function scrollToTop()\n{\n\t$(\"html, body\").animate({scrollTop:0}, 400, 'swing');\n}", "function scrollToTopBookNow() {\n\t\t\t//$(window).scrollTop($('.scrolltobooknow').offset().top);\n\t\t\tdocument.getElementById('scrolltobooknow').scrollIntoView(true);\n\t\t}", "function topFunction() {\n window.scrollTo({top: 0, behavior: 'smooth'});\n //document.documentElement.scrollTop = 0;\n }", "function forceTop() {\n $('html, body').animate({\n scrollTop: $('body').offset().top,\n }, 200);\n}", "function scrollToTop(event) {\n event.preventDefault();\n scrollToElem(document.documentElement, document.documentElement.offsetTop, 600);\n scrollToElem(document.body, document.body.offsetTop, 600);\n}", "function toTop() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function scrollToTop () {\n bodyElement.scrollTo({\n top: 0,\n behavior: 'smooth'\n }) ||\n rootElement.scrollTo({\n top: 0,\n behavior: 'smooth'\n })\n}", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTo({\n top: 0,\n behavior: \"smooth\"\n })\n}", "redirectAtTop(){\n $(document).ready(function(){\n $(this).scrollTop(0);\n });\n }", "function toTop() {\n window.scrollTo({\n top: 0,\n left: 0,\n behavior: \"smooth\"\n });\n}", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n var elmntr = document.getElementById(\"quiz_cont\");\n elmntr.scrollTo(0, 0);\n }", "function topFunction() {\r\n // document.body.scrollTop = 0;\r\n window.scrollTo({ top: 0, behavior: \"smooth\" });\r\n document.documentElement.scrollTo({ top: 0, behavior: \"smooth\" });\r\n}", "function topFunction() {\r\n // document.body.scrollTop = 0;\r\n window.scrollTo({ top: 0, behavior: \"smooth\" });\r\n document.documentElement.scrollTo({ top: 0, behavior: \"smooth\" });\r\n}", "function scrollToTop() {\r\n document.body.scrollTop = 0; /*pt. safari*/\r\n document.documentElement.scrollTop = 0; /*pt. chrome...*/\r\n}", "function gotoTop() {\n $anchorScroll('add-new-student-button');\n }", "function topFct(){\r\n window.scrollTo(0, 0);\r\n }", "function gotoAtop () {\n later ( ( () => {\n let t = $ (\"#highUp\").offset ().top;\n scrollTo (null, t);\n //scrollTo (null, 66);\n }), 3999);\n}", "function returnToTop(){\n window.scroll({ top:0, behavior: \"smooth\" })\n}", "function topFunction() {\n document.body.scrollTo({top: 0, behavior: 'smooth'}) ; // For Safari\n document.documentElement.scrollTo({top: 0, behavior: 'smooth'})// For Chrome, Firefox, IE and Opera\n}", "function toTop() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n}", "toTop() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop=0;\n }", "function upTop() {\r\n document.body.scrollTop = 0; // Za Safari\r\n document.documentElement.scrollTop = 0; // Za Chrome, Firefox, IE and Opera\r\n}", "function getToTop() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n}", "function topFunction() {\n\twindow.scrollTo({top: 0, behavior: 'smooth'});\n}", "function topFunction() {\n document.documentElement.scrollTop = 3200;\n}", "toTop() {\n window.scrollTo(0,0);\n }", "backToTop(e){\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 0;\n }", "function topScroll() {\r\n\tdocument.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}", "scrollToTop() {\n scroll.scrollToTop();\n }", "function topOfPage() {\n document.body.scrollTop = 0; // Safari\n document.documentElement.scrollTop = 0; // Chrome, Firefox, IE and Opera.\n}", "function backToTop() {\r\n if (window.pageYOffset > 0) {\r\n window.scrollBy(0, -2000);\r\n setTimeout(backToTop, 0);\r\n }\r\n }", "function scrolTop(){\n window.scrollTo(0, 0);\n}", "function toTop(){\n\t$.mobile.silentScroll(0);\n}", "function scrollToTop(){\n\t$('html, body').animate({scrollTop : 0},800);\t\n}", "function topFunction() {\n let element = document.getElementById(\"topScroll\");\n element.scrollIntoView({behavior: \"smooth\"});\n}", "function toTheTopButton() {\n window.scrollTo({\n top: 0,\n behavior: \"smooth\",\n });\n }", "function backToTop() {\r\n document.body.scrollTop = 0;\r\n document.documentElement.scrollTop = 0;\r\n}", "function topFunction() {\n document.body.scrollTop = 0;\n document.documentElement.scrollTop = 870;\n}", "function scrollToTop() {\n const offset = document.querySelector('header').scrollHeight;\n if (document.documentElement.scrollTop > offset) {\n document.documentElement.scrollTop = `${offset}`;\n }\n}", "function scrollTop() {\n window.scrollTo({ top: 0, behavior: 'smooth' });\n}", "function scrollTop() {\r\n ('body').on('click', '#scroll-top', function() {\r\n $(\"html, body\").animate({\r\n scrollTop: 0\r\n }, '1000');\r\n });\r\n }", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function scrolTop(){\n window.scroll(0,0);\n setTimeout(function(){\n window.scroll(0,0);\n window.scroll(0,0);\n window.scroll(0,0);\n },1000)\n\n}", "function topFunction() {\r\n document.body.scrollTop = 0; // For Safari\r\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\r\n }", "scrollToTop() {\n window.scrollTo({\n top: 0,\n behavior: 'smooth',\n });\n }", "function topFunction() {\n\t\t\tdocument.body.scrollTop = 0; // For Chrome, Safari and Opera \n\t\t\t\tdocument.documentElement.scrollTop = 0; // For IE and Firefox\n\t\t}", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function backToTop() {\n\twindow.scrollTo({top: 0, behavior: 'smooth'});\n}", "function backToTop() {\n\t\t document.body.scrollTop = 0;\n\t\t document.documentElement.scrollTop = 0;\n\t\t}", "function ScrollToTop() {\n jQuery('body,html').animate({ scrollTop: 0 }, 820);\n return false;\n}", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function scrollTop() {\n document.body.scrollTop = document.documentElement.scrollTop = 0;\n }", "function scrollToTop() {\n $('html, body').animate({scrollTop:0}, 'slow');\n}", "function topFunction() {\n document.body.scrollTop = 0; // For Safari\n document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera\n }", "function topFunction() {\n \n document.body.scrollTop = 0;\n \n}" ]
[ "0.8427779", "0.8401175", "0.8137684", "0.8025861", "0.8018002", "0.80142736", "0.7993937", "0.79847014", "0.7970048", "0.79540867", "0.7936717", "0.79301775", "0.792929", "0.79064053", "0.79057753", "0.7903937", "0.79021", "0.7886774", "0.7884233", "0.78811276", "0.78683335", "0.78494674", "0.78482586", "0.78411734", "0.7823094", "0.7812189", "0.7808813", "0.7808696", "0.77918714", "0.7768573", "0.77447027", "0.7721462", "0.7716322", "0.77128994", "0.7694617", "0.7693446", "0.76902", "0.7688915", "0.768476", "0.7681786", "0.7680724", "0.76537764", "0.7646801", "0.7629516", "0.76020265", "0.7586537", "0.758341", "0.75829256", "0.7578266", "0.75759935", "0.75717187", "0.7561213", "0.75510603", "0.75510603", "0.75303817", "0.7520758", "0.75154054", "0.7508487", "0.74980795", "0.74934417", "0.74932057", "0.74887204", "0.74775875", "0.7473063", "0.74632734", "0.74581647", "0.7458108", "0.7456143", "0.7455315", "0.74472815", "0.7437352", "0.74341625", "0.7433954", "0.74205005", "0.7416065", "0.7403847", "0.74028313", "0.74027944", "0.7400275", "0.7394726", "0.73905814", "0.7390077", "0.7387917", "0.7387917", "0.73809564", "0.7372662", "0.73579496", "0.7352859", "0.7349663", "0.7349663", "0.7349663", "0.7349663", "0.73494786", "0.73435175", "0.7341159", "0.73381764", "0.7336858", "0.7329148", "0.7327072", "0.7324792" ]
0.74897224
61
find the (or one of them) smallest square who have A as a corner and B on a side
function findSquare (lineA, colA, lineB, colB) { // length of a side of that square let line, col; let dim = max(abs(lineA - lineB), abs(colA - colB)); if (lineB >= lineA) line = lineA; else line = lineA - dim; if (colB >= colA) col = colA; else col = colA - dim; return [line, col, dim + 1]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "minSquare() {\n var ind = -1;\n var min = L + 1;\n for (let i = 0; i < B; i++) {\n if (this.choices[i] != -1 && this.choices[i] < min) {\n min = this.choices[i];\n ind = i;\n }\n }\n return ind;\n }", "function getMinBox() {\n //get coordinates \n var coorX = coords.map(function(p) {\n return p.x\n });\n var coorY = coords.map(function(p) {\n return p.y\n });\n\n //find top left and bottom right corners \n var min_coords = {\n x: Math.min.apply(null, coorX),\n y: Math.min.apply(null, coorY)\n }\n var max_coords = {\n x: Math.max.apply(null, coorX),\n y: Math.max.apply(null, coorY)\n }\n\n //return as strucut \n return {\n min: min_coords,\n max: max_coords\n }\n}", "function getMinBox() {\n //get coordinates \n var coorX = coords.map(function(p) {\n return p.x\n });\n var coorY = coords.map(function(p) {\n return p.y\n });\n\n //find top left and bottom right corners \n var min_coords = {\n x: Math.min.apply(null, coorX),\n y: Math.min.apply(null, coorY)\n }\n var max_coords = {\n x: Math.max.apply(null, coorX),\n y: Math.max.apply(null, coorY)\n }\n\n //return as strucut \n return {\n min: min_coords,\n max: max_coords\n }\n}", "function minDistance(square, goal) {\n var horizDiff = Math.abs(goal.x - square.x);\n var vertDiff = Math.abs(goal.y - square.y);\n return Math.min(horizDiff, vertDiff);\n}", "function _scanWinSizeB(side) {\r\n var x, y, count;\r\n var startX, startY;\r\n // scan the left-bottom half until y == GRID_SIZE-1\r\n // only need scan to the last possible position\r\n for (y = GRID_SIZE - WIN_SIZE; y >= 0; --y) {\r\n x = 0;\r\n count = 0;\r\n for (var p = x, q = y; p < GRID_SIZE && q < GRID_SIZE; ++p, ++q) {\r\n if (positions[p][q].getValue() === side) {\r\n count++;\r\n if (count == 1) { // record the start position(x,y)\r\n startX = p; // we can reuse x BTW\r\n startY = q;\r\n } else if (count == WIN_SIZE) { // found WIN_SIZE link\r\n return positions[startX][startY];\r\n }\r\n } else {\r\n count = 0;\r\n }\r\n }\r\n }\r\n \r\n // scan the right-bottom half until x == GRID_SIZE-1\r\n // only need scan to the last possible position\r\n for (x = 1; x < GRID_SIZE-(WIN_SIZE-1); ++x) {\r\n y = 0;\r\n count = 0;\r\n for (var p = x, q = y; p < GRID_SIZE && q < GRID_SIZE; ++p, ++q) {\r\n if (positions[p][q].getValue() === side) {\r\n count++;\r\n if (count == 1) { // record the start position(x,y)\r\n startX = p;\r\n startY = q; // we can reuse y BTW\r\n } else if (count == WIN_SIZE) { // found WIN_SIZE link\r\n return positions[startX][startY];\r\n }\r\n } else {\r\n count = 0;\r\n }\r\n }\r\n }\r\n return null;\r\n }", "function squaresquare(a, b){\n\n a.left = a.x\n b.left = b.x\n a.right = a.x + a.width\n b.right = b.x + b.width\n a.top = a.y \n b.top = b.y\n a.bottom = a.y + a.height\n b.bottom = b.y + b.height\n\n\n\n if (a.left > b.right || a.top > b.bottom || \n a.right < b.left || a.bottom < b.top)\n {\n return false\n }\n else\n {\n return true\n }\n}", "function heuristic(a, b) {\n return dist(a.row, a.col, b.row, b.col);;\n}", "function solution(A) {\n const arr = A;\n const len = arr.length;\n let sum = 0;\n\n for (let i = 0; i < len; i++) {\n sum += arr[i];\n }\n\n let curLeft = 0;\n let curRight = 0;\n let lowest;\n for (let i = 0; i < len; i++) {\n curLeft += arr[i];\n curRight = sum - curLeft;\n const diff = Math.abs(curLeft - curRight);\n if (diff < lowest || lowest === undefined) {\n lowest = diff;\n }\n }\n\n return lowest;\n}", "function cobminRec(w,h){\n // first calculate the perimeter\n var p = 2*w + 2*h;\n\n var a = w*h\n\n //retruned both values\n retrun [p,a];\n}", "function bestSquareTiles(x, y, n) {\n //prevent div/0\n if (n === 0 || x === 0 || y === 0)\n return 0;\n var px = Math.ceil(Math.sqrt((n * x) / y));\n var sx = undefined;\n var sy = undefined;\n if (Math.floor((px * y) / x) * px < n) {\n sx = y / Math.ceil((px * y) / x);\n }\n else {\n sx = x / px;\n }\n var py = Math.ceil(Math.sqrt((n * y) / x));\n if (Math.floor((py * x) / y) * py < n) {\n sy = x / Math.ceil((x * py) / y);\n }\n else {\n sy = y / py;\n }\n var ret = Math.max(sx, sy);\n // console.log(\"kkkkkkkkkkkkkk ret\" + ret);\n return ret;\n}", "function _scanWinSizeS(side) {\r\n var x, y, count;\r\n var startX, startY;\r\n // scan the left-top half until y == GRID_SIZE-1\r\n // only need scan to the last possible position\r\n for (y = WIN_SIZE-1; y < GRID_SIZE; ++y) {\r\n x = 0;\r\n count = 0;\r\n for (var p = x, q = y; p < GRID_SIZE && q >= 0; ++p, --q) {\r\n if (positions[p][q].getValue() === side) {\r\n count++;\r\n if (count == 1) { // record the start position(x,y)\r\n startX = p; // we can reuse x BTW\r\n startY = q;\r\n } else if (count == WIN_SIZE) { // found WIN_SIZE link\r\n return positions[startX][startY];\r\n }\r\n } else {\r\n count = 0;\r\n }\r\n }\r\n }\r\n \r\n // scan the right-bottom half until x == GRID_SIZE-1\r\n // only need scan to the last possible position\r\n for (x = 1; x < GRID_SIZE-(WIN_SIZE-1); ++x) {\r\n y = GRID_SIZE-1;\r\n count = 0;\r\n for (var p = x, q = y; p < GRID_SIZE && q >= 0; ++p, --q) {\r\n if (positions[p][q].getValue() === side) {\r\n count++;\r\n if (count == 1) { // record the start position(x,y)\r\n startX = p;\r\n startY = q; // we can reuse y BTW\r\n } else if (count == WIN_SIZE) { // found WIN_SIZE link\r\n return positions[startX][startY];\r\n }\r\n } else {\r\n count = 0;\r\n }\r\n }\r\n }\r\n return null;\r\n }", "function tresureIsland2(grid) {\n\tif (grid == null || grid.length === 0) return false;\n\n\tlet queueStart = []; //all start points\n\tconst ROW = grid.length;\n\tconst directions = [\n\t\t[-1, 0],\n\t\t[1, 0],\n\t\t[0, 1],\n\t\t[0, -1]\n\t];\n\n\tlet min = 0;\n\n\t//fill queue with all starts\n\tgrid.forEach((row, r) => {\n\t\trow.forEach((col, c) => {\n\t\t\tif (grid[r][c] === 'S') {\n\t\t\t\tqueueStart.push([r, c]);\n\t\t\t}\n\t\t});\n\t});\n\n\twhile (queueStart.length) {\n\t\tmin++;\n\t\tlet len = queueStart.length;\n\t\tfor (let i = 0; i < len; i++) {\n\t\t\tlet [sr, sc] = queueStart.shift();\n\t\t\tfor (let [dr, dc] of directions) {\n\t\t\t\tlet r = sr + dr;\n\t\t\t\tlet c = sc + dc;\n\t\t\t\tif (r >= 0 && r < ROW && c >= 0 && c < grid[r].length) {\n\t\t\t\t\tif (grid[r][c] === 'X') {\n\t\t\t\t\t\treturn min;\n\t\t\t\t\t}\n\t\t\t\t\tif (grid[r][c] === 'O') {\n\t\t\t\t\t\tgrid[r][c] = 'D';\n\t\t\t\t\t\tqueueStart.push([r, c]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}", "function findMines() {\n for (let i = 0; i < numSquaresY; i++) {\n for (let j = 0; j < numSquaresX; j++) {\n board[i][j].calculateAdjacentMines();\n }\n }\n}", "function solution(A) {\n // write your code in JavaScript (Node.js 8.9.4)\n\n let left = 0;\n let right = A.reduce((acc, cur) => acc + cur);\n let min = null;\n\n for (let p = 1; p < A.length; p++) {\n left += A[p - 1];\n right -= A[p - 1];\n\n let temp = left - right;\n temp = temp < 0 ? -1 * temp : temp;\n\n if (min === null || temp < min) {\n min = temp;\n }\n }\n\n return min;\n}", "function csquareintsbetween (a, b) {\n return Math.floor(Math.sqrt(b)) - Math.ceil(Math.sqrt(a)) + 1;\n}", "function whichBox(whereRowY, whereColX) {\n let rowAdj, colAdj, boxRow, boxCol, box;\n\n // adjusting values to start at 1 not 0 do that the '(rowAdj % size) != 0' work properly\n rowAdj = (whereRowY).valueOf() + 1;\n colAdj = whereColX + 1;\n\n console.log(colAdj)\n\n // box row Y\n if ((rowAdj % size) != 0) {\n rowAdj += (rowAdj % size);\n }\n boxRow = rowAdj - size;\n\n // box column X\n if ((colAdj % size) != 0) {\n colAdj += (colAdj % size);\n }\n boxCol = colAdj / size;\n\n\n\n //which box\n box = boxRow + boxCol;\n\n return box;\n}", "static whichCorner(sideSize, idx) {\n let square = sideSize ** 2;\n\n if (idx < 0 || idx > square - 1) {\n return false; // out of scope\n }\n\n if (idx === 0) {\n // LEFT_TOP\n return 1;\n }\n\n if ((idx + 1) === sideSize) {\n // RIGHT_TOP\n return 2;\n }\n\n if ((idx + 1) === square) {\n // RIGHT_BOTTOM\n return 3;\n }\n\n if (idx === (square - sideSize)) {\n // LEFT_BOTTOM\n return 4;\n }\n\n return false;\n }", "getNearestTower(board, x, y, mine) {\n var towers_to_check = [];\n var result = [];\n if(mine == 0) {\n // get all towers on the board that are not mine\n for (let i = 0; i < board_size; i++) {\n for (let j = 0; j < board_size; j++ ) {\n if (board[i][j].tower == 1 && board[i][j].faction != this.faction) {\n if(j == x && i == y)\n continue;\n towers_to_check.push([j, i]);\n }\n }\n }\n } else {\n // i check just in my towers\n // is this how this works?\n for (let m = 0; m < this.towers.length; m++) {\n if(this.towers[m][0] == x && this.towers[m][1] == y)\n continue;\n towers_to_check.push(this.towers[m]);\n }\n\n }\n var min = 25;\n var new_x = 0;\n var new_y = 0;\n for (let i = 0; i < towers_to_check.length; i++) {\n let x1 = towers_to_check[i][0];\n let y1 = towers_to_check[i][1];\n let sum = Math.min(Math.abs(x - x1) + Math.abs(y - y1));\n if (sum < min) {\n min = sum;\n if (x1 == x) { //ox axis\n if(y == y1 ) {\n new_y = y;\n }\n if (y < y1 ) {\n new_y = y + 1;\n } else {\n new_y = y - 1;\n }\n new_x = x;\n } else if (y1 == y) { // on oy axis\n if (x < x1 ) {\n new_x = x + 1;\n } else {\n new_x = x - 1;\n }\n new_y = y;\n // // i check the 4 quadrants -> I am not sure here\n } else if ( x < x1 && y < y1) {\n new_x = x + 1;\n new_y = y + 1;\n } else if ( x < x1 && y > y1) {\n new_x = x + 1;\n new_y = y - 1;\n } else if ( x > x1 && y < y1) {\n new_x = x - 1;\n new_y = y + 1;\n } else if ( x > x1 && y > y1) {\n new_x = x - 1;\n new_y = y - 1;\n }\n }\n }\n result.push(new_x);\n result.push(new_y);\n result.push(min);\n return result;\n }", "calculateWinner(squares) {\n const lines = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [0, 3, 6],\n [1, 4, 7],\n [2, 5, 8],\n [0, 4, 8],\n [2, 4, 6],\n ];\n for (let i = 0; i < lines.length; i++) {\n const [a, b, c] = lines[i];\n if (squares[a] && squares[a] === squares[b] && squares[a] === squares[c]) {\n return lines[i];\n }\n }\n return null;\n}", "function winnerHorizontal(grid, row, lig) {\n if ((grid[row][lig] === grid[row + 1][lig]) && (grid[row][lig] === grid[row + 2][lig]) && (grid[row][lig] === grid[row + 3][lig])) {\n return grid[row][lig];\n } else {\n return NOBODY;\n }\n}", "function squareCorner(square, box) {\n var x = square.x,\n y = square.y,\n side = square.side;\n return ((box.x == x && box.y == y) || (box.x == x + side && box.y == y) || (box.x == x && box.y == y + side) || (box.x == x + side && box.y == y + side));\n}", "function calculateWinner(squares) {\r\n const lines = [\r\n [0, 1, 2],\r\n [3, 4, 5],\r\n [6, 7, 8],\r\n [0, 3, 6],\r\n [1, 4, 7],\r\n [2, 5, 8],\r\n [0, 4, 8],\r\n [2, 4, 6],\r\n ];\r\n for (let i = 0; i < lines.length; i++) {\r\n const [a, b, c] = lines[i];\r\n if (squares[a] && squares[a] === squares[b] && squares[a] === squares[c]) {\r\n return squares[a];\r\n }\r\n }\r\n return null;\r\n}", "calculateWinner(squares) {\r\n const lines = [\r\n [0, 1, 2],\r\n [3, 4, 5],\r\n [6, 7, 8],\r\n [0, 3, 6],\r\n [1, 4, 7],\r\n [2, 5, 8],\r\n [0, 4, 8],\r\n [2, 4, 6],\r\n ];\r\n for (let i = 0; i < lines.length; i++) {\r\n const [a, b, c] = lines[i];\r\n if (\r\n squares[a] &&\r\n squares[a] === squares[b] &&\r\n squares[a] === squares[c]\r\n ) {\r\n return squares[a];\r\n }\r\n }\r\n return null;\r\n }", "function sqInRect(l, w){\n if (l === w) {\n return null;\n };\n let tempArray = [l, w];\n let newArray = [];\n if (l > w) {\n tempArray = [w, l];\n };\n\n while(true) {\n while (tempArray[1] >= tempArray[0]) {\n newArray.push(tempArray[0]);\n let diff = tempArray[1] - tempArray[0];\n tempArray = [tempArray[0], diff];\n };\n\n if (tempArray[1] === 0) {\n return newArray;\n };\n tempArray = [tempArray[1], tempArray[0]];\n };\n}", "function calculate_snapping( intersection ){\n\tvar shortest = 65535; //shortest distance to a new square\n\tfor( move in possible_moves ){\n\t\tvar possible_x = possible_moves[ move ].x;\n\t\tvar possible_z = possible_moves[ move ].z;\n\n\t\tvar x_dist = board[ possible_x ][ possible_z ].position.x - intersection[ 0 ].point.x;\n\t\tvar z_dist = board[ possible_x ][ possible_z ].position.z - intersection[ 0 ].point.z;\n\n\t\tvar distance = Math.sqrt( x_dist*x_dist + z_dist*z_dist);\n\t\tvar candidate_x;\n\t\tvar candidate_z;\n\n\t\tif( distance < shortest ){\n\t\t\tshortest = distance;\n\t\t\tcandidate_x = possible_x;\n\t\t\tcandidate_z = possible_z;\n\t\t}\n\n\t\tsnap_to( candidate_x, candidate_z );\n\t}\n}", "function s(grid) {\n const directions = [\n [1, 0],\n [0, 1],\n [-1, 0],\n [0, -1],\n ];\n let max = 0;\n const set = new Set();\n for (let r = 0; r < grid.length; r++) {\n for (let c = 0; c < grid[r].length; c++) {\n if (grid[r][c] === 1 && !set.has(`${r} ${c}`)) {\n set.add(`${r} ${c}`);\n max = Math.max(max, helper(r, c));\n }\n }\n }\n return max;\n\n function helper(r, c) {\n if (!grid[r] || !grid[r][c]) return 0;\n let size = 1;\n for (let [r1, c1] of directions) {\n if (!set.has(`${r + r1} ${c + c1}`)) {\n set.add(`${r + r1} ${c + c1}`);\n size += helper(r + r1, c + c1);\n }\n }\n return size;\n }\n}", "function findSmallest(a, b, c){\n if (a < b && a < c){\n return a;\n } else if (b < a && b < c) {\n return b;\n} else {\n return c;\n }\n}", "function determineWinner(squares) {\n const lines = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [0, 3, 6],\n [1, 4, 7],\n [2, 5, 8],\n [0, 4, 8],\n [2, 4, 6],\n ];\n for (let i = 0; i < lines.length; i++) {\n const [a, b, c] = lines[i];\n if (squares[a] && squares[a] === squares[b] && squares[a] === squares[c]) {\n return squares[a];\n }\n }\n return null;\n}", "function getNearestCell(x, y, cells) {\r\n var min = Infinity;\r\n var result;\r\n $.each(cells, function(index, cell) { \r\n var d = distance(x, y, cell.center_x, cell.center_y);\r\n // Update minimum.\r\n if (d < min) {\r\n min = d;\r\n result = cell;\r\n }\r\n });\r\n return result;\r\n}", "function getClosestCorner(pt1, pt2) {\n var dx = pt2[0] - pt1[0];\n var m = (pt2[1] - pt1[1]) / dx;\n var b = (pt1[1] * pt2[0] - pt2[1] * pt1[0]) / dx;\n if (b > 0) return [m > 0 ? xEdge0 : xEdge1, yEdge1];else return [m > 0 ? xEdge1 : xEdge0, yEdge0];\n }", "function calculateWinner(squares) {\n const lines = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [0, 3, 6],\n [1, 4, 7],\n [2, 5, 8],\n [0, 4, 8],\n [2, 4, 6],\n ];\n for (let i = 0; i < lines.length; i++) {\n const [a, b, c] = lines[i];\n if (squares[a] && squares[a] === squares[b] && squares[a] === squares[c]) {\n return squares[a];\n }\n }\n return null;\n}", "function calculateWinner(squares) {\n const lines = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [0, 3, 6],\n [1, 4, 7],\n [2, 5, 8],\n [0, 4, 8],\n [2, 4, 6],\n ];\n for (let i = 0; i < lines.length; i++) {\n const [a, b, c] = lines[i];\n if (squares[a] && squares[a] === squares[b] && squares[a] === squares[c]) {\n return squares[a];\n }\n }\n return null;\n}", "function _scanWinSizeX(side) {\r\n var count;\r\n for (var y = 0; y < GRID_SIZE; ++y) {\r\n // only need scan to the last possible position in a row\r\n for (var x = 0; x < GRID_SIZE-(WIN_SIZE-1); ++x) {\r\n count = 0;\r\n for (var p = x; p < GRID_SIZE; ++p) {\r\n if (positions[p][y].getValue() === side) {\r\n count++;\r\n if (count == 1) {\r\n x = p; // the start x\r\n } else if (count == WIN_SIZE) { // found WIN_SIZE link\r\n return positions[x][y];\r\n }\r\n } else {\r\n count = 0; // link break!\r\n }\r\n }\r\n }\r\n }\r\n return null;\r\n }", "function _oneOfPointsWithinRect(aX, aY, aW, aH, bX, bY, bW, bH) {\n\t// calculate corner points\n\tvar aTopLeft = {'x':aX, 'y':aY};\n\tvar aTopRight = {'x':aX + aW,'y':aY};\n\tvar aBotLeft = {'x':aX, 'y':aY + aH};\n\tvar aBotRight = {'x':aX + aW,'y':aY + aH};\n\n\tvar aPoints = [aTopLeft, aTopRight, aBotLeft, aBotRight];\n\n\t// go through aPoints from end to start because\n\t// presumed most common collision is player\n\t// with front to something, and just why not\n\tfor (var i = aPoints.length - 1; i >= 0; i--) {\n\t\tvar x = aPoints[i].x;\n\t\tvar y = aPoints[i].y;\n\t\tif (y >= bY && y <= bY + bH) {\n\t\t\t// we have vertical collision\n\t\t\tif (x >= bX && x <= bX + bW) {\n\t\t\t\t// we have horizontal collision as well\n\t\t\t\t// and therefore a total collision\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false;\n}", "function findOptimalRhombus(pointCurrent, pointPrevious) {\n // Find midpoint between two points\n var midPoint = midPointBtw(pointPrevious, pointCurrent)\n\n // Exten d points to coordinates\n var pointCurrentCoordinates = constructCoordinates(pointCurrent),\n pointPreviousCoordinates = constructCoordinates(pointPrevious)\n\n // Arrays and Objects\n var allPoints = [], // All points are placed into this array\n counts = {}, // count distinct of distances\n limitedPoints // subset of correct points\n\n // Load the points into allpoints with a field documenting their origin and corner\n for (var key in pointCurrentCoordinates) {\n pointCurrentCoordinates[key].corner = key;\n pointCurrentCoordinates[key].version = 2;\n allPoints.push(pointCurrentCoordinates[key])\n }\n for (var key in pointPreviousCoordinates) {\n pointPreviousCoordinates[key].corner = key;\n pointPreviousCoordinates[key].version = 1;\n allPoints.push(pointPreviousCoordinates[key])\n }\n\n // For each point find the distance between the cord and the midpoint\n for (var j = 0, allPointsLength = allPoints.length; j < allPointsLength; j++) {\n allPoints[j].distance = distanceBetweenCords(midPoint, allPoints[j]).toFixed(10)\n }\n\n // count distinct distances into counts object\n allPoints.forEach(function (x) {\n var distance = x.distance;\n counts[distance] = (counts[distance] || 0) + 1;\n });\n\n // Sort allPoints by distance\n allPoints.sort(function (a, b) {\n return a.distance - b.distance;\n });\n\n // There are three scenarios\n // 1. the squares are perfectly vertically or horizontally aligned:\n //// In this case, there will be two distinct lengths between the mid point, In this case, we want to take\n //// the coordinates with the shortest distance to the midpoint\n // 2. The squares are offset vertically and horizontally. In this case, there will be 3 or 4 distinct lengths between\n //// the coordinates, 2 that are the shortest, 4 that are in the middle, and 2 that are the longest. We want\n //// the middle 4\n\n // Determine the number of distances\n var numberOfDistances = Object.keys(counts).length;\n\n if (numberOfDistances == 2) {\n limitedPoints = allPoints.slice(0, 4)\n }\n\n else if (numberOfDistances == 3 || numberOfDistances == 4) {\n limitedPoints = allPoints.slice(2, 6)\n }\n else {\n // if the distance is all the same, the square masks haven't moved, so just return\n return\n }\n\n // error checking\n if (limitedPoints.length != 4) {\n throw new Error('unexpected number of points')\n }\n\n var limitedPointsSorted = limitedPoints.sort(orderByProperty('corner', 'version'));\n if (numberOfDistances > 2) {\n // for horizontally and verically shifted, the sort order needs a small hack so the drawing of the\n // rectangle works correctly\n var temp = limitedPointsSorted[2];\n limitedPointsSorted[2] = limitedPointsSorted[3];\n limitedPointsSorted[3] = temp\n }\n return limitedPointsSorted\n }", "function CalcWinnerSquares(squares) {\n const lines = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [0, 3, 6],\n [1, 4, 7],\n [2, 5, 8],\n [0, 4, 8],\n [2, 4, 6],\n ];\n for (let i = 0; i < lines.length; i++) {\n const [a, b, c] = lines[i];\n if (squares[a] && squares[a] === squares[b] && squares[a] === squares[c]) {\n return lines[i];\n }\n }\n return [null, null, null];\n}", "function perfect_sq(candidate){\n var lo = BigInteger.ZERO,\n hi = candidate,\n mid,\n element;\n while (lo.compare(hi) <=0) {\n mid = lo.add(hi).divide(BigInteger.small[2]);\n if (mid.square().compare(candidate)<0) {\n lo = mid.next();\n } else if (mid.square().compare(candidate)>0) {\n hi = mid.prev();\n } else {\n return true;;\n }\n }\n return false;\n}", "getCollisionUp(top, x, halfwidth) {\n let r = Math.round(top) - 1; //row above top\n if (r >= WH || r < 0) return null; //world borders\n x = Math.round(x) - halfwidth; //left\n for (let c = x; c < x + halfwidth*2; c++) {\n if (this.collMatrix[r][c] == 1) {\n return c;\n }\n }\n return null;\n }", "function sol29(\n matrix = [\n [1, 3, 5, 8],\n [4, 2, 1, 7],\n [4, 3, 2, 3],\n ],\n start = [0, 0],\n end = [3, 2]\n) {\n let min = Infinity;\n helper();\n // add end coords\n return min + matrix[end[1]][end[0]];\n\n function helper(cur = start.slice(), cost = 0) {\n const [a, b] = cur;\n const [x, y] = end;\n if (a === x && b === y) {\n min = Math.min(min, cost);\n return;\n }\n\n if (!matrix[a] || !matrix[a][b]) return;\n\n cost += matrix[a][b];\n\n helper([a + 1, b], cost);\n helper([a, b + 1], cost);\n }\n}", "function getMinMaxCorners(points) {\n\tvar ul = points[0],\n\t\t\tur = points[0],\n\t\t\tll = points[0],\n\t\t\tlr = points[0];\n\n\tpoints.forEach(function(p) {\n\t\tif (-p.x - p.y > -ul.x - ul.y) ul = p;\n\t\tif ( p.x - p.y > ur.x - ur.y) ur = p;\n\t\tif (-p.x + p.y > -ll.x + ll.y) ll = p;\n\t\tif ( p.x + p.y > lr.x + lr.y) lr = p;\n\t});\n\n\treturn { ul: ul, ur: ur, ll: ll, lr: lr };\n}", "function nearest(ctx) {\n var _a = ctx.structure, _b = _a.min, minX = _b[0], minY = _b[1], minZ = _b[2], _c = _a.size, sX = _c[0], sY = _c[1], sZ = _c[2], bucketOffset = _a.bucketOffset, bucketCounts = _a.bucketCounts, bucketArray = _a.bucketArray, grid = _a.grid, positions = _a.positions;\n var r = ctx.radius, rSq = ctx.radiusSq, _d = ctx.pivot, x = _d[0], y = _d[1], z = _d[2];\n var loX = Math.max(0, (x - r - minX) >> 3 /* Exp */);\n var loY = Math.max(0, (y - r - minY) >> 3 /* Exp */);\n var loZ = Math.max(0, (z - r - minZ) >> 3 /* Exp */);\n var hiX = Math.min(sX, (x + r - minX) >> 3 /* Exp */);\n var hiY = Math.min(sY, (y + r - minY) >> 3 /* Exp */);\n var hiZ = Math.min(sZ, (z + r - minZ) >> 3 /* Exp */);\n for (var ix = loX; ix <= hiX; ix++) {\n for (var iy = loY; iy <= hiY; iy++) {\n for (var iz = loZ; iz <= hiZ; iz++) {\n var idx = (((ix * sY) + iy) * sZ) + iz;\n var bucketIdx = grid[idx];\n if (bucketIdx > 0) {\n var k = bucketIdx - 1;\n var offset = bucketOffset[k];\n var count = bucketCounts[k];\n var end = offset + count;\n for (var i = offset; i < end; i++) {\n var idx_1 = bucketArray[i];\n var dx = positions[3 * idx_1 + 0] - x;\n var dy = positions[3 * idx_1 + 1] - y;\n var dz = positions[3 * idx_1 + 2] - z;\n var distSq = dx * dx + dy * dy + dz * dz;\n if (distSq <= rSq) {\n Query3D.QueryContext.add(ctx, distSq, idx_1);\n }\n }\n }\n }\n }\n }\n }", "function intersectRadius(x, y, mouseX, mouseY) {\n\t\tvar minX = x * gridSize;\n\t\tvar maxX = (x + 1) * gridSize;\n\t\tvar minY = y * gridSize;\n\t\tvar maxY = (y + 1) * gridSize;\n\t\t// case distinction to determine the closest corner of the grid cell to\n\t\t// the mouse cursor\n\t\t/*\n\t\t * 1 | 2 | 3 \n\t\t * ---|-----|--- \n\t\t * 8 |Mouse| 4 \n\t\t * ---|-----|--- \n\t\t * 7 | 6 | 5 \n\t\t * Mouse is the mouse location, 1-8 are possible locations the square can be in.\n\t\t * The corner cases represent a situation where all x- and y values of\n\t\t * the square are either greater or smaller than the mouse location. The\n\t\t * other cases represent when this is not the case.\n\t\t */\n\n\t\tif (minX >= mouseX) {\n\t\t\tif (minY >= mouseY) {\n\t\t\t\treturn pythagoras(minX - mouseX, minY - mouseY) < cursorSize; // case\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// 5\n\t\t\t} else {// ignoring case 4, minY < mouseY < maxY for convenience;\n\t\t\t\treturn pythagoras(minX - mouseX, mouseY - maxY) < cursorSize; // case\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// 3\n\t\t\t}\n\t\t} else {// ignoring case 2&6, minX < mouseX < maxX for convenience\n\t\t\tif (minY >= mouseY) {\n\t\t\t\treturn pythagoras(mouseX - maxX, minY - mouseY) < cursorSize; // case\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// 7\n\t\t\t} else {// ignoring case 8, minY < mouseY < maxY for convenience\n\t\t\t\treturn pythagoras(mouseX - maxX, mouseY - maxY) < cursorSize; // case\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// 1\n\t\t\t}\n\t\t}\n\t}", "function formingMagicSquare(s) {\n /*\n I tend to approach math questions by first wanting to understand the forumal on paper. For me\n it just workes easier because if I can write the problem out, then I can figure out the best\n way to code it from there.\n\n In this case I started researching what magic squares were, and it turns out there are only 9\n possible combinations of a 3x3 magic square.\n\n From there it was really just a matter of taking the provided data, and comparing it to each\n of the possible solutions and taking the lowest option from those comparisons.\n */\n\n // combine the matrix into a simple 2D array\n let arr=s.reduce((a,b)=>{ return a.concat(b) }),\n lowest=1000;\n \n // hard coded the possible options as a single array as well\n let ms = [\n [8, 1, 6, 3, 5, 7, 4, 9, 2],\n [6, 1, 8, 7, 5, 3, 2, 9, 4],\n [4, 9, 2, 3, 5, 7, 8, 1, 6],\n [2, 9, 4, 7, 5, 3, 6, 1, 8],\n [8, 3, 4, 1, 5, 9, 6, 7, 2],\n [4, 3, 8, 9, 5, 1, 2, 7, 6],\n [6, 7, 2, 1, 5, 9, 8, 3, 4],\n [2, 7, 6, 9, 5, 1, 4, 3, 8]\n ];\n\n // loop through each option\n for(let x=0; x<ms.length; x++){\n let total=0;\n // compare one value at a time against the provided data\n for(let y=0; y<ms[x].length; y++){\n total+=Math.abs((arr[y]-ms[x][y]));\n }\n // keep only the lowest\n if(total<lowest) lowest=total;\n }\n\n return lowest;\n}", "function findBestPointInSubCell(c, r, c1, r1, z) {\n // using a 3x3 grid instead of 2x2 ... testing showed that 2x2 was more\n // likely to misidentify the sub-cell with the optimal point\n var q = 3;\n var perSide = Math.pow(q, z); // number of cell divisions per axis at this z\n var maxDist = 0;\n var c2, r2, p, best, dist;\n for (var i=0; i<q; i++) {\n for (var j=0; j<q; j++) {\n p = getGridPointInCell(c, r, c1 + i, r1 + j, perSide);\n dist = findDistanceFromNearbyFeatures(maxDist, p, c, r);\n if (dist > maxDist) {\n maxDist = dist;\n best = p;\n c2 = i;\n r2 = j;\n }\n }\n }\n if (z == 2) { // stop subdividing the cell at this level\n best.push(maxDist); // return distance as third element\n return best;\n } else {\n return findBestPointInSubCell(c, r, (c1 + c2)*q, (r1 + r2)*q, z + 1);\n }\n }", "static _getClosest(dungeon, openSpaces){\n var bestValue = Infinity;\n var bestIndex = -1;\n for (var i = 0; i < openSpaces.length; i++) {\n var test = Utils.coordinateHypo(openSpaces[i], dungeon.hero.location);\n if (test < bestValue){\n bestValue = test;\n bestIndex = i;\n }\n }\n return openSpaces[bestIndex];\n }", "function getClosestCorner(pt1, pt2) {\n var dx = pt2[0] - pt1[0];\n var m = (pt2[1] - pt1[1]) / dx;\n var b = (pt1[1] * pt2[0] - pt2[1] * pt1[0]) / dx;\n\n if(b > 0) return [m > 0 ? xEdge0 : xEdge1, yEdge1];\n else return [m > 0 ? xEdge1 : xEdge0, yEdge0];\n }", "function findPlacementRow (leftmostCol, piece, board) {\n let r = 0\n\n for (r; r <= 20 - piece.length; r++) {\n if (!doesPieceFit([r, leftmostCol], piece, board)) break\n }\n\n return r - 1\n}", "closestIntersectionWith(wire)\n {\n const manhattan = (y, x) => Math.abs(y) + Math.abs(x);\n return this.intersectionsWith(wire).reduce((min, i) => Math.min(min, manhattan(i.y, i.x)), Number.MAX_SAFE_INTEGER);\n }", "function computerDeterminesOptimalMove(board, marker) {\n let square = null;\n for (let index = 0; index < WINNING_LINES.length; index++) {\n let line = WINNING_LINES[index];\n let markedSquares = line.filter(square => board[square] === marker);\n if (markedSquares.length === 2) {\n square = line.find(square => board[square] === INITIAL_MARKER);\n if (square !== undefined) return square;\n }\n }\n return square;\n}", "function findLineByLeastSquare(values_x, values_y) {\n\n let sum_x = 0;\n let sum_y = 0;\n let sum_xy = 0;\n let sum_xx = 0;\n let count = 0;\n\n // We'll use those variables for faster read/write access.\n let x = 0;\n let y = 0;\n let values_length = values_x.length;\n\n // calculate the sum for each of the parts necessary.\n for (let v = 0; v < values_length; v++) {\n x = values_x[v];\n y = values_y[v];\n sum_x += x;\n sum_y += y;\n sum_xx += x*x;\n sum_xy += x*y;\n count++;\n }\n\n // y = x * m + b\n let m = (count*sum_xy - sum_x*sum_y) / (count*sum_xx - sum_x*sum_x);\n let b = (sum_y/count) - (m*sum_x)/count;\n\n // We will make the x and y result line now\n let result_values_x = [];\n let result_values_y = [];\n\n for (let v = 0; v < values_length; v++) {\n x = values_x[v];\n y = x * m + b;\n result_values_x.push(x);\n result_values_y.push(y);\n }\n\n // This part I added to get the coordinates for the line\n x1 = Math.min.apply(Math, result_values_x);\n x2 = Math.max.apply(Math, result_values_x);\n y1 = Math.min.apply(Math, result_values_y);\n y2 = Math.max.apply(Math, result_values_y);\n\n return [x1, x2, y1, y2];\n}", "function calculateWinner(squares) {\n // lines is all the winning line formation \n const lines = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [0, 3, 6],\n [1, 4, 7],\n [2, 5, 8],\n [0, 4, 8],\n [2, 4, 6]\n ];\n //Check to see if there are in winning squares and return X or O or null \n for (let i = 0; i < lines.length; i++) {\n const [a, b, c] = lines[i];\n if (squares[a] && squares[a] === squares[b] && squares[a] === squares[c]) {\n return squares[a];\n }\n }\n return null;\n }", "findMinSpanningTree() {\n let vertexCount = 0\n let weight = 0\n\n let current = this.g[0]\n current.visited = true\n vertexCount++\n\n while (vertexCount < this.g.length) {\n let smallest = null\n\n for (let i = 0; i < this.e.length; i++) {\n if (!this.e[i].visited) {\n if (this.e[i].src.visited && !this.e[i].dest.visited) {\n if (!smallest || this.e[i].weight < smallest.weight) {\n smallest = this.e[i]\n }\n }\n }\n }\n\n smallest.visited = true\n smallest.dest.visited = true\n weight += smallest.weight\n vertexCount++\n }\n return weight\n }", "closest(points) {\n if (points.length === 1) {\n return Point.create(points[0]);\n }\n let ret = null;\n let min = Infinity;\n points.forEach((p) => {\n const dist = this.squaredDistance(p);\n if (dist < min) {\n ret = p;\n min = dist;\n }\n });\n return ret ? Point.create(ret) : null;\n }", "findSmallest() {\n if (this.left) return this.left.findSmallest();\n return this.value;\n }", "function detectNextBlock_CornerDownLeft (x,y,h,w)\n {\n var mapCoordY = (y + h)/ h;\n var mapCoordX = (x -1) / w;\n \n mapCoordX = Math.floor(mapCoordX);\n mapCoordY = Math.floor(mapCoordY);\n \n return map[mapCoordY-1][mapCoordX-1];\n }", "findCell(x, y) {\n // `Number >> 4` effectively does an integer division by 16\n // and `Number << 4` multiplies by 16 this notation is used to avoid floats\n x = (x >> 4) << 4; // x = Math.floor((x / this.root.min) * this.root.min)\n y = (y >> 4) << 4; // y = Math.floor((y / this.root.min) * this.root.min)\n\n return this._findCell(x, y, this.root);\n }", "function getNeighbor(current, all) {\n 'use strict';\n var closest = -1,\n minDistance = Infinity,\n col = Infinity, row = Infinity;\n for (var i = 0; i < all.length; i += 1) {\n var d = getDistance(current, all[i]);\n if (d < minDistance && d !== 0) {\n if ((minDistance !== d) ||\n (minDistance === d && all[i][0] < row) ||\n (minDistance === d && all[i][0] === row && all[i][1] < col)) {\n closest = i;\n minDistance = d;\n col = all[i][1];\n row = all[i][0];\n }\n }\n }\n return closest;\n}", "function findNeighbors(x, y, max) {\n if (x === 0 && y === 0) {\n return [[0, 1], [1, 0], [1, 1]];\n }\n else if (x === max && y === 0) {\n return [[x-1, 0], [x-1, y+1], [x, y+1]];\n }\n else if (x === 0 && y === max) {\n return [[0, y-1], [x+1, y-1], [x+1, y]];\n }\n else if (x === max && y === max) {\n return [[x-1, y], [x-1, y-1], [x, y-1]];\n }\n else if (x === 0) {\n return [[0, y-1], [0, y+1], [1, y-1], [1, y], [1, y+1]];\n }\n else if (y === 0) {\n return [[x+1, 0], [x-1, 0], [x-1, 1], [x, 1], [x+1, 1]];\n }\n else if (x === max) {\n return [[x, y-1], [x, y+1], [x-1, y-1], [x-1, y], [x-1, y+1]];\n }\n else if (y === max) {\n return [[x-1, y], [x+1, y], [x-1, y-1], [x, y-1], [x+1, y-1]];\n }\n else {\n return [[x-1, y-1], [x-1, y], [x-1, y+1], [x, y-1], [x, y+1], [x+1, y-1], [x+1, y], [x+1, y+1]];\n }\n}", "function getBestPosition(side) {\r\n // demo: randomly choose one from all available positions(positions[x][y] == null)\r\n // it's 1-dimentional array, and each element hold one available position\r\n var blankPositions = new Array();\r\n for (var x = 0; x < positions.length; ++x) {\r\n for (var y = 0; y < positions[x].length; ++y) {\r\n // this one scan by column\r\n if (positions[x][y].isBlank()) {\r\n blankPositions.push(positions[x][y]);\r\n }\r\n }\r\n }\r\n \r\n function orderBySide(pos1, pos2) { return pos2.getPriority(side) - pos1.getPriority(side); }\r\n blankPositions.sort(orderBySide);\r\n \r\n var highestP = blankPositions[0].getPriority(side);\r\n var availablePositions = new Array();\r\n for (var i = 0; i < blankPositions.length; ++i) {\r\n if (blankPositions[i].getPriority(side) === highestP) {\r\n availablePositions.push(blankPositions[i]);\r\n } else {\r\n break;\r\n }\r\n }\r\n // debug: display available positions array!\r\n //_displayPositions(availablePositions);\r\n \r\n // randomly select one\r\n if (availablePositions.length > 0) {\r\n var index = Math.floor(Math.random() * availablePositions.length);\r\n return availablePositions[index];\r\n } else {\r\n alert(\"The game board is full, try another round please.\");\r\n return null;\r\n }\r\n }", "function quickHullInner(S, a, b) {\n if (S.length == 0) {\n return []\n }\n\n var d = S.map(function(p) {return {dist: lr(a,b,p)*distLineToPoint(a, b, p), point: p}})\n d.sort(function(a,b) { return a.dist > b.dist ? 1 : -1 })\n var dd = d.map(function(pp) { return pp.point })\n\n var c = d.pop()\n if (c.dist <= 0) {\n return []\n }\n c = c.point\n\n // seems like these should be reversed, but this works\n var A = dd.filter(isStrictlyRight, {a:c, b:a})\n var B = dd.filter(isStrictlyRight, {a:b, b:c})\n\n // FIXME need better way in case qHI returns []\n var ress = quickHullInner(A, a, c).concat([c], quickHullInner(B, c, b))\n return ress\n\n}", "function calculateWinner(squares) {\n const lines = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [0, 3, 6],\n [1, 4, 7],\n [2, 5, 8],\n [0, 4, 8],\n [2, 4, 6],\n ]\n for (let i = 0; i < lines.length; i++) {\n const [a, b, c] = lines[i];\n if (squares[a] && squares[a] === squares[b] && squares[a] === squares[c]) {\n return [squares[a], lines[i]]\n }\n }\n return null\n}", "function indexOfSmallest(a) {\n return a.indexOf(Math.min.apply(Math, a))\n }", "getSquare(x, y){\n\t\tfor(var i=0;i<this.squares.length;i++){\n\t\t\tif(this.squares[i].x==x && this.squares[i].y==y){\n\t\t\t\treturn this.squares[i];\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "getPrimaryCellsInSquareTo(cell) {\r\n if (!cell || !this.role == 'primary' || !cell.role == 'primary') return [];\r\n\r\n const startCellKey =\r\n CellMap.primaryCellKey(\r\n Math.min(this.row, cell.row), Math.min(this.column, cell.column));\r\n const endCellKey =\r\n CellMap.primaryCellKey(\r\n Math.max(this.row, cell.row), Math.max(this.column, cell.column));\r\n const startCell = state.theMap.cells.get(startCellKey);\r\n if (!startCell) return [];\r\n const endCell = state.theMap.cells.get(endCellKey);\r\n if (!endCell) return [];\r\n const width = 1 + endCell.column - startCell.column;\r\n const height = 1 + endCell.row - startCell.row;\r\n\r\n const result = [];\r\n let rowStart = startCell;\r\n for (let i = 0; i < height; i++) {\r\n let currCell = rowStart;\r\n for (let j = 0; j < width; j++) {\r\n result.push(currCell);\r\n currCell = currCell.getNeighbors('right').cells[0];\r\n if (!currCell) break;\r\n }\r\n rowStart = rowStart.getNeighbors('bottom').cells[0];\r\n if (!rowStart) break;\r\n }\r\n return result;\r\n }", "_findSquares(tunnelDirection) {\n let x, y\n const result = []\n if (tunnelDirection === 'NORTH') {\n for (({ x } = this), end = (this.x+this.tunnelWidth)-1, asc = this.x <= end; asc ? x <= end : x >= end; asc ? x++ : x--) {\n var asc, end\n result.push({ x, y: this.y-1, width: 1, height: 1 }) }\n } else if (tunnelDirection === 'SOUTH') {\n for (({ x } = this), end1 = (this.x+this.tunnelWidth)-1, asc1 = this.x <= end1; asc1 ? x <= end1 : x >= end1; asc1 ? x++ : x--) { var asc1, end1;\n result.push({ x, y: this.y+this.height, width: 1, height: 1 }) }\n } else if (tunnelDirection === 'EAST') {\n for (({ y } = this), end2 = (this.y+this.tunnelWidth)-1, asc2 = this.y <= end2; asc2 ? y <= end2 : y >= end2; asc2 ? y++ : y--) { var asc2, end2;\n result.push({x: this.x+this.width, y, width: 1, height: 1 }) }\n } else {\n for (({ y } = this), end3 = (this.y+this.tunnelWidth)-1, asc3 = this.y <= end3; asc3 ? y <= end3 : y >= end3; asc3 ? y++ : y--) { var asc3, end3;\n result.push({x: this.x-1, y, width: 1, height: 1 }) }\n }\n return result\n }", "static findMinimumAreaFace(nodes) {\n let mostNegativeAreaNode = nodes[0];\n let mostNegArea = Number.MAX_VALUE;\n for (const node of nodes) {\n const area = node.signedFaceArea();\n if (area < 0 && area < mostNegArea) {\n mostNegArea = area;\n mostNegativeAreaNode = node;\n }\n }\n return mostNegativeAreaNode;\n }", "static locallyInside(a, b) {\n return GraphicsGeometry.area(a.prev, a, a.next) < 0 ?\n GraphicsGeometry.area(a, b, a.next) >= 0 && GraphicsGeometry.area(a, a.prev, b) >= 0 :\n GraphicsGeometry.area(a, b, a.prev) < 0 || GraphicsGeometry.area(a, a.next, b) < 0;\n }", "function sqSegBoxDist(a, b, bbox) {\n if (inside(a, bbox) || inside(b, bbox)) return 0;\n var d1 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox.minX, bbox.minY, bbox.maxX, bbox.minY);\n if (d1 === 0) return 0;\n var d2 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox.minX, bbox.minY, bbox.minX, bbox.maxY);\n if (d2 === 0) return 0;\n var d3 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox.maxX, bbox.minY, bbox.maxX, bbox.maxY);\n if (d3 === 0) return 0;\n var d4 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox.minX, bbox.maxY, bbox.maxX, bbox.maxY);\n if (d4 === 0) return 0;\n return Math.min(d1, d2, d3, d4);\n}", "function sqSegBoxDist(a, b, bbox) {\n if (inside(a, bbox) || inside(b, bbox)) return 0;\n var d1 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox.minX, bbox.minY, bbox.maxX, bbox.minY);\n if (d1 === 0) return 0;\n var d2 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox.minX, bbox.minY, bbox.minX, bbox.maxY);\n if (d2 === 0) return 0;\n var d3 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox.maxX, bbox.minY, bbox.maxX, bbox.maxY);\n if (d3 === 0) return 0;\n var d4 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox.minX, bbox.maxY, bbox.maxX, bbox.maxY);\n if (d4 === 0) return 0;\n return Math.min(d1, d2, d3, d4);\n}", "function findHints(a, b, x, y) {\n let res = [];\n\n //check if selected positions are treasure, set hints value\n if (arr[a][b] == 0 || arr[x][y] == 0) {\n \n if (arr[a][b] == 0) {\n res.push([a, b]);\n }\n \n if (arr[x][y] == 0) {\n res.push([x, y]);\n }\n \n } else {\n //swap values\n [arr[a][b], arr[x][y]] = [arr[x][y], arr[a][b]];\n \n let pos1 = checkCombo(a, b);\n let pos2 = checkCombo(x, y);\n //check at position [m,n]\n if (pos1.combo >= 3) {\n if (pos1.horizontal >= 3) {\n let row = [];\n for (let j = b - pos1.left; j <= b + pos1.right; j++) {\n if (j == b) {\n row.push([x, y]);\n } else row.push([a, j]);\n }\n res.push(row);\n }\n \n if (pos1.vertical >= 3) {\n let col = [];\n for (let i = a - pos1.top; i <= a + pos1.bottom; i++) {\n if (i == a) {\n col.push([x, y]);\n } else col.push([i, b]);\n }\n res.push(col);\n }\n }\n //check at position [x,y]\n if (pos2.combo >= 3) {\n if (pos2.horizontal >= 3) {\n let row = [];\n for (let j = y - pos2.left; j <= y + pos2.right; j++) {\n if (j == y) {\n row.push([a, b])\n } else row.push([x, j]);\n }\n res.push(row);\n }\n \n if (pos2.vertical >= 3) {\n let col = [];\n for (let i = x - pos2.top; i <= x + pos2.bottom; i++) {\n if (i == x) {\n col.push([a, b])\n } else col.push([i, y]);\n }\n res.push(col);\n }\n }\n\n //swap back values to original\n [arr[a][b], arr[x][y]] = [arr[x][y], arr[a][b]];\n }\n \n return res;\n}", "function magicSquare(arr) {\n let flattenedArr = [].concat(...arr)\n let cost = Infinity\n\n const possibilities = [\n [\n [8, 1, 6],\n [3, 5, 7],\n [4, 9, 2],\n ],\n [\n [6, 1, 8],\n [7, 5, 3],\n [2, 9, 4],\n ],\n [\n [4, 9, 2],\n [3, 5, 7],\n [8, 1, 6],\n ],\n [\n [2, 9, 4],\n [7, 5, 3],\n [6, 1, 8],\n ],\n [\n [8, 3, 4],\n [1, 5, 9],\n [6, 7, 2],\n ],\n [\n [4, 3, 8],\n [9, 5, 1],\n [2, 7, 6],\n ],\n [\n [6, 7, 2],\n [1, 5, 9],\n [8, 3, 4],\n ],\n [\n [2, 7, 6],\n [9, 5, 1],\n [4, 3, 8],\n ],\n ]\n\n return possibilities.reduce((cost, magicSquare) => {\n const flatSquare = [].concat(...magicSquare)\n let tempCost = 0\n\n for (let i = 0; i < flatSquare.length; i++) {\n tempCost += Math.abs(flatSquare[i] - flattenedArr[i])\n if (tempCost > cost) return cost\n }\n\n return tempCost\n }, cost)\n}", "static middleInside(a, b) {\n var p = a, inside = false, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) {\n inside = !inside;\n }\n p = p.next;\n } while (p !== a);\n return inside;\n }", "distanceToFarthestCorner({ x = 0, y = 0 }) {\n return Math.max(ElementRect.euclideanDistance({ x, y }, { x: 0, y: 0 }), ElementRect.euclideanDistance({ x, y }, { x: this.width, y: 0 }), ElementRect.euclideanDistance({ x, y }, { x: 0, y: this.height }), ElementRect.euclideanDistance({ x, y }, { x: this.width, y: this.height }));\n }", "function calculateWinner(squares) {\n const lines = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [0, 3, 6],\n [1, 4, 7],\n [2, 5, 8],\n [0, 4, 8],\n [2, 4, 6]\n ];\n for (let i = 0; i < lines.length; i++) {\n const [a, b, c] = lines[i];\n if (squares[a] && squares[a] === squares[b] && squares[a] === squares[c]) {\n return [squares[a], a, b, c]\n }\n }\n return null;\n}", "function insideBoard(x,y) {\n if (x >= 154 && x <= 554) {\n board.size;\n return x / board.size;\n }\n else {\n return -1;\n }\n}", "function squareDistance (squareA, squareB) {\n var squareAArray = squareA.split('')\n var squareAx = COLUMN_IDS.indexOf(squareAArray[0]) + 1\n var squareAy = parseInt(squareAArray[1], 10)\n\n var squareBArray = squareB.split('')\n var squareBx = COLUMN_IDS.indexOf(squareBArray[0]) + 1\n var squareBy = parseInt(squareBArray[1], 10)\n\n var xDelta = Math.abs(squareAx - squareBx)\n var yDelta = Math.abs(squareAy - squareBy)\n\n if (xDelta >= yDelta) return xDelta\n return yDelta\n }", "function select_corner_cell_available(){\n return select_available_cell_in_array([left_upper_cell, right_upper_cell, left_lower_cell, right_lower_cell]);\n }", "bestPlaceToStart(incomingClues) {\n\n // penalize clues that have more zeros\n function weightedClue(clue) {\n return clue ? clue : -10;\n }\n\n const sideLength = this.size;\n const lastCell = this.size * 4 - 1;\n\n const sideClues = [\n {\n direction: 'top',\n count:\n weightedClue(incomingClues[sideLength]) + weightedClue(incomingClues[sideLength + 1]) +\n weightedClue(incomingClues[lastCell - 1]) + weightedClue(incomingClues[lastCell])\n },\n {\n direction: 'bottom',\n count:\n weightedClue(incomingClues[sideLength * 2 - 2]) + weightedClue(incomingClues[sideLength * 2 - 1]) +\n weightedClue(incomingClues[sideLength * 3]) + weightedClue(incomingClues[sideLength * 3 + 1])\n },\n {\n direction: 'left',\n count:\n weightedClue(incomingClues[0]) + weightedClue(incomingClues[1]) +\n weightedClue(incomingClues[sideLength * 3 - 2]) + weightedClue(incomingClues[sideLength * 3 - 1])\n },\n {\n direction: 'right',\n count:\n weightedClue(incomingClues[sideLength - 2]) + weightedClue(incomingClues[sideLength - 1]) +\n weightedClue(incomingClues[sideLength * 2]) + weightedClue(incomingClues[sideLength * 2 + 1])\n }\n ];\n sideClues.sort((a, b) => b.count - a.count);\n const bestDirection = sideClues[0].direction;\n\n let clues;\n let c1;\n let c2;\n let c3;\n let c4;\n switch(bestDirection) {\n case 'top':\n clues = incomingClues;\n break;\n case 'bottom': // shift bottom to the first row\n c1 = incomingClues.slice(sideLength * 2, sideLength * 3).reverse();\n c2 = incomingClues.slice(sideLength, sideLength * 2).reverse();\n c3 = incomingClues.slice(0, sideLength).reverse();\n c4 = incomingClues.slice(sideLength * 3, sideLength * 4).reverse();\n clues = c1.concat(c2).concat(c3).concat(c4);\n break;\n case 'left': // shift left side to the first row\n c1 = incomingClues.slice(sideLength * 3, sideLength * 4);\n c2 = incomingClues.slice(0, sideLength * 3);\n clues = c1.concat(c2);\n break;\n case 'right': // shift right side to the first row\n c1 = incomingClues.slice(sideLength, sideLength * 4);\n c2 = incomingClues.slice(0, sideLength);\n clues = c1.concat(c2);\n break;\n }\n return { startAt: bestDirection, clues };\n }", "function minPathSum(grid, x=0, y=0) {\n let firstEle = grid[y][x];\n // console.log('firstEle: ', firstEle);\n // console.log('y: ', y, 'x: ', x);\n if (y === grid.length - 1 && x === grid[0].length - 1){\n return firstEle;\n } else if (y === grid.length - 1){\n return firstEle + minPathSum(grid, x + 1, y);\n } else if (x === grid[0].length - 1){\n return firstEle + minPathSum(grid, x, y+1)\n } else {\n console.log(minPathSum(grid, x + 1, y))\n return Math.min(firstEle + minPathSum(grid, x + 1, y), firstEle + minPathSum(grid, x, y+1));\n }\n}", "getNear(p) {\n\n //first x (going left to right)\n const x1 = Math.floor(p.x / width * 10);\n\n //second x\n const x2 = Math.floor((p.x + p.width) / width * 10);\n\n //first y (going left to right)\n const y1 = Math.floor(p.y / height * 10);\n\n //second y\n const y2 = Math.floor((p.y + p.height) / height * 10);\n\n const min = x1 + y1;\n const max = x2 + y2;\n const s = new Set();\n for (let i = min; i <= max; i++) {\n if (this.pos[i]) this.pos[i].forEach(item => s.add(item));\n }\n\n //get array and return it from the set\n return Array.from(s);\n }", "function sqSegBoxDist(a, b, bbox) {\r\n if (inside(a, bbox) || inside(b, bbox)) return 0;\r\n var d1 = sqSegSegDist(\r\n a[0],\r\n a[1],\r\n b[0],\r\n b[1],\r\n bbox.minX,\r\n bbox.minY,\r\n bbox.maxX,\r\n bbox.minY\r\n );\r\n if (d1 === 0) return 0;\r\n var d2 = sqSegSegDist(\r\n a[0],\r\n a[1],\r\n b[0],\r\n b[1],\r\n bbox.minX,\r\n bbox.minY,\r\n bbox.minX,\r\n bbox.maxY\r\n );\r\n if (d2 === 0) return 0;\r\n var d3 = sqSegSegDist(\r\n a[0],\r\n a[1],\r\n b[0],\r\n b[1],\r\n bbox.maxX,\r\n bbox.minY,\r\n bbox.maxX,\r\n bbox.maxY\r\n );\r\n if (d3 === 0) return 0;\r\n var d4 = sqSegSegDist(\r\n a[0],\r\n a[1],\r\n b[0],\r\n b[1],\r\n bbox.minX,\r\n bbox.maxY,\r\n bbox.maxX,\r\n bbox.maxY\r\n );\r\n if (d4 === 0) return 0;\r\n return Math.min(d1, d2, d3, d4);\r\n}", "function smallerSquareOnBiggerSquare(smallerX, smallerY, smallerOffset, biggerX, biggerY, biggerOffset)\n{\n\t//A more \"central\" hit of a smaller bullet on a bigger robot (as an example)\n\t/*\n\tif(bullet.x >= (game._robots[robotId].x - game._robots[robotId].offset) && bullet.x <= (game._robots[robotId].x + game._robots[robotId].offset))\n\t{\n\t\tif(bullet.y >= (game._robots[robotId].y - game._robots[robotId].offset) && bullet.y <= (game._robots[robotId].y + game._robots[robotId].offset))\n\t\t{\n\t\t\tgame._robots[robotId]._damage += bullet.damage;\n\t\t\tbullet.remove = true;\n\t\t}\n\t}\n\t*/\n\t\n\tif((smallerX + smallerOffset) >= (biggerX - biggerOffset) && (smallerX - smallerOffset) <= (biggerX + biggerOffset))\n\t{\n\t\tif((smallerY + smallerOffset) >= (biggerY - biggerOffset) && (smallerY - smallerOffset) <= (biggerY + biggerOffset))\n\t\t{\n\t\t\treturn true;\n\t\t}\n\t}\n\t\n\treturn false;\n}", "lowestCommonAncestor(a, b) {\n if (this.key === a || this.key === b) {\n return this.key;\n }\n\n const left = this.left ? this.left.lowestCommonAncestor(a, b) : null;\n const right = this.right ? this.right.lowestCommonAncestor(a, b) : null;\n\n if (left && right) {\n return this.key;\n }\n\n return left ? left : right;\n }", "getSimilarity(y, x, board) {\n let neighbors = 0;\n let sameNeighbors = 0;\n //check clockwise, starting at 12 (one above)\n if (y - 1 >= 0 && board[y - 1][x][0] != \"x\") {\n neighbors++;\n if (board[y][x][0] == board[y - 1][x][0]) {\n sameNeighbors++;\n }\n }\n //one above and one to the right\n if (\n y - 1 >= 0 &&\n x + 1 <= board[x].length - 1 &&\n board[y - 1][x + 1][0] != \"x\"\n ) {\n neighbors++;\n if (board[y][x][0] == board[y - 1][x + 1][0]) {\n sameNeighbors++;\n }\n }\n //one to the right\n if (x + 1 <= board[x].length - 1 && board[y][x + 1][0] != \"x\") {\n neighbors++;\n if (board[y][x][0] == board[y][x + 1][0]) {\n sameNeighbors++;\n }\n }\n //one below and one to the right\n if (\n y + 1 <= board.length - 1 &&\n x + 1 <= board[x].length - 1 &&\n board[y + 1][x + 1][0] != \"x\"\n ) {\n neighbors++;\n if (board[y][x][0] == board[y + 1][x + 1][0]) {\n sameNeighbors++;\n }\n }\n //one below\n if (y + 1 <= board.length - 1 && board[y + 1][x][0] != \"x\") {\n neighbors++;\n if (board[y][x][0] == board[y + 1][x][0]) {\n sameNeighbors++;\n }\n }\n //one below and one to the left\n if (\n y + 1 <= board.length - 1 &&\n x - 1 >= 0 &&\n board[y + 1][x - 1][0] != \"x\"\n ) {\n neighbors++;\n if (board[y][x][0] == board[y + 1][x - 1][0]) {\n sameNeighbors++;\n }\n }\n //one to the left\n if (x - 1 >= 0 && board[y][x - 1][0] != \"x\") {\n neighbors++;\n if (board[y][x][0] == board[y][x - 1][0]) {\n sameNeighbors++;\n }\n }\n //one above and to the left (last one)\n if ((y - 1 >= 0) & (x - 1 >= 0) && board[y - 1][x - 1][0] != \"x\") {\n neighbors++;\n if (board[y][x][0] == board[y - 1][x][0]) {\n sameNeighbors++;\n }\n }\n return sameNeighbors / neighbors;\n }", "function nearestIntersectedSnapObj(){\n\t\n\tgetIntersectedSnapObjs();\n\tif ( snapObjsIntersectedByRay.length > 0 ){ \n\t\treturn snapObjsIntersectedByRay[ 0 ]; \n\t}\t\t\n}", "function main() {\n var s = [];\n for(s_i = 0; s_i < 3; s_i++){\n s[s_i] = readLine().split(' ');\n s[s_i] = s[s_i].map(Number);\n }\n // List of magic squares;\n const magicSquares = [\n [[8, 1, 6], [3, 5, 7], [4, 9, 2]],\n [[6, 1, 8], [7, 5, 3], [2, 9, 4]],\n [[4, 9, 2], [3, 5, 7], [8, 1, 6]],\n [[2, 9, 4], [7, 5, 3], [6, 1, 8]], \n [[8, 3, 4], [1, 5, 9], [6, 7, 2]],\n [[4, 3, 8], [9, 5, 1], [2, 7, 6]], \n [[6, 7, 2], [1, 5, 9], [8, 3, 4]], \n [[2, 7, 6], [9, 5, 1], [4, 3, 8]],\n ];\n \n let diff = [];\n for (let i = 0; i < magicSquares.length; ++i) {\n let differences = 0;\n for (let j = 0; j < s.length; ++j) {\n for (let k = 0; k < s[j].length; ++k) {\n if (s[j][k] !== magicSquares[i][j][k]) {\n differences += Math.abs(s[j][k] - magicSquares[i][j][k])\n }\n }\n }\n diff.push(differences);\n }\n console.log(Math.min.apply(null, diff));\n}", "function findNeighborsSquare(height, width) {\n var customPicture = new Picture(null, height, width, 1);\n var arrClone = pictures.map(function (x) { return x; });\n arrClone.push(customPicture);\n pictures.sort(compareObject);\n arrClone.sort(compareObject);\n var index = arrClone.findIndex(function (e) { return e.square === customPicture.square; });\n if (index === 0) {\n addErrorMassage(\"min square = \" + Math.ceil(pictures[index].square));\n return [null, null];\n }\n if (index === arrClone.length - 1) {\n addErrorMassage(\"max square = \" + Math.ceil(pictures[index - 1].square));\n return [null, null];\n }\n card.classList.remove('wrong-size');\n var lessPrice = arrClone[index - 1];\n var biggerPrice = arrClone[index + 1];\n return [lessPrice, biggerPrice];\n }", "function calculateCorners(square) {\n let result = [];\n result[0] = square.x - square.width / 2;\n result[1] = square.y - square.height / 2;\n result[2] = result[0] + square.width;\n result[3] = result[1];\n result[4] = result[2];\n result[5] = result[3] + square.height;\n result[6] = result[0];\n result[7] = result[5];\n return result;\n}", "function findQuadrant() {\n var area = 0;\n var slot = null;\n function find(node) {\n if (node instanceof Desktop) {\n find(node.child);\n }\n else if (node instanceof Split) {\n find(node.first);\n find(node.second);\n }\n else if (node instanceof Window) {\n var winArea = node.width * node.height / 2;\n if (winArea > area) {\n area = winArea;\n slot = node;\n node.quadrant = (node.width > node.height) ?\n 'right' : 'bottom';\n }\n }\n else if (node instanceof Empty) {\n var newArea = node.width * node.height;\n if (newArea > area) {\n area = newArea;\n slot = node;\n }\n }\n }\n find(desktop);\n return slot;\n }", "function hasAChance() {\n var aX = A.x, aY = A.y,\n bX = B.x, bY = B.y;\n \n if ((aX < r.left) && (bX < r.left)) {\n return false;\n }\n \n if ((aX > r.right) && (bX > r.right)) {\n return false;\n }\n\n if ((aY < r.top) && (bY < r.top)) {\n return false;\n }\n\n if ((aY > r.bottom) && (bY > r.bottom)) {\n return false;\n }\n \n return true;\n }", "function calculateWinner(squares) {\n /* Squares indexes as they appear in UI:\n 0 1 2\n 3 4 5\n 6 7 8\n */\n const lines = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [0, 3, 6],\n [1, 4, 7],\n [2, 5, 8],\n [0, 4, 8],\n [2, 4, 6]\n ]; // shows all of the winning combinations (\"lines\")\n\n // Iterate over all the winning line combinations to see if the\n // input squares array has one of the with all 'X's or all 'O's.\n // If it does, return 'X' or 'O'.\n for (let line of lines) {\n const [a, b, c] = line;\n if (squares[a] && squares[a] === squares[b] && squares[a] === squares[c]) {\n return squares[a];\n }\n }\n // If none of the winning line combinations is contained in\n // input squares array, return null...\n return null;\n}", "function squareCornerWin(){\n}", "function areaSquare(side){\n return -1;\n }", "function solequa(n) {\n // (x - 2y)*(x + 2y) = n\n const findDividers = (n) => {\n const results = []\n \n for (let i = 1; i <= Math.sqrt(n); i++) {\n if (Number.isInteger(n / i)) {\n results.push([i, n / i])\n }\n }\n \n return results\n }\n \n const solve = (m1, m2) => {\n // {x - 2y = m1; x + 2y = m2;} => {x = m1 + 2y; 4y = m2 - m1} => {x = (m1 + m2)/2; y = (m2 - m1)/4}\n const y = (m1 + m2) / 2\n const x = (m2 - m1) / 4\n \n if (Number.isInteger(x) && Number.isInteger(y)) {\n return (x > y) ? [x, y] : [y, x]\n }\n \n return null\n }\n \n const dividers = findDividers(n)\n const solutions = dividers.map(([d1, d2]) => solve(d1, d2)).filter(s => s !== null)\n \n return solutions\n}", "function calculateWinner (squares) {\n /* Squares indexes as they appear in UI:\n 0 1 2\n 3 4 5\n 6 7 8\n */\n const lines = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8],\n [0, 3, 6],\n [1, 4, 7],\n [2, 5, 8],\n [0, 4, 8],\n [2, 4, 6]\n ] // shows all of the winning combinations (\"lines\")\n\n // Iterate over all the winning line combinations to see if the\n // input squares array has one of the with all 'X's or all 'O's.\n // If it does, return 'X' or 'O'.\n for (let line of lines) {\n const [a, b, c] = line\n if (squares[a] && squares[a] === squares[b] && squares[a] === squares[c]) {\n return squares[a]\n }\n }\n // If none of the winning line combinations is contained in\n // input squares array, return null...\n return null\n}", "function bestFirstS(start) {\n\n board.findDistances();\n let pq = [];\n pq.unshift(start);\n start.isVisited = true;\n board.visited.push(start);\n\n while(pq.length) {\n let v = minManhattan(pq);\n board.visited.push(v);\n \n if(v === board.goal) {\n board.setPath();\n return v;\n }\n for(let i = 0; i < v.neighbors.length; i++) {\n let neighbor = v.neighbors[i];\n if(neighbor.isVisited === false) {\n neighbor.isVisited = true;\n\n if(!neighbor.isWall) {\n neighbor.parent = v;\n pq.unshift(neighbor);\n }\n }\n }\n }\n return false;\n }", "function getNeighborCoordsTopRow(j, jMax) {\n let neighborCoords;\n // Is top-left of grid\n if (j === 0) {\n neighborCoords = [\n [0, j + 1], // The cell to the right.\n [0 + 1, j], // The cell directly below.\n [0 + 1, j + 1] // The cell below-right.\n ];\n // Is top-right of grid\n } else if (j === jMax) {\n neighborCoords = [\n [0, j - 1], // The cell to the left.\n [1, j], // The cell directly below.\n [1, j - 1] // The cell below-left.\n ];\n // Is just in top row but not top-left or top-right\n } else {\n neighborCoords = [\n [0, j - 1], // The two cells in the same row, to the left and right.\n [0, j + 1],\n [1, j - 1], // The three cells in the row below.\n [1, j],\n [1, j + 1]\n ];\n }\n return neighborCoords;\n}", "findNearestCollision(boxes, to_ignore){\n var closest_box = null;\n var lowest_mag = this.trajectory.getMagnitude();\n for(var b of boxes){\n if(b == to_ignore){ continue;}\n //use fast/efficient method before the most costly point-finding algorithm\n if(this.trajectory.checkBoxIntersect(b)){\n var collision_point = this.trajectory.boxIntersectAt(b);\n if(!collision_point){\n console.log(\"A collision was detected but no intersection point \\\n was found. There must be a bug.\");\n }\n var old_end_point = this.trajectory.end;\n this.trajectory.end = collision_point;\n var new_mag = this.trajectory.getMagnitude();\n if(new_mag < lowest_mag){\n lowest_mag = new_mag;\n closest_box = b;\n }\n else{\n this.trajectory.end = old_end_point;\n }\n }\n }\n return closest_box;\n }", "function findNeighboring (thing, i , j) {\n var coords = {};\n\n if (A.world[i-1]) {\n // the row above exists....\n if (A.world[i-1][j-1] && A.world[i-1][j-1] === thing) { coords.row = i - 1; coords.col = j - 1; };\n if (A.world[i-1][j] === thing) { coords.row = i - 1; coords.col = j; };\n if (A.world[i-1][j+1] && A.world[i-1][j+1] === thing) { coords.row = i - 1; coords.col = j + 1; };\n }\n if (A.world[i][j-1] && A.world[i][j-1] === thing) { coords.row = i; coords.col = j - 1; }; // the 'current' row\n if (A.world[i][j+1] && A.world[i][j+1] === thing) { coords.row = i; coords.col = j + 1; };\n if (A.world[i+1]) {\n // the row below exists...\n if (A.world[i+1][j-1] && A.world[i+1][j-1] === thing) { coords.row = i + 1; coords.col = j - 1; };\n if (A.world[i+1][j] === thing) { coords.row = i + 1; coords.col = j; };\n if (A.world[i+1][j+1] && A.world[i+1][j+1] === thing) { coords.row = i + 1; coords.col = j + 1; };\n }\n return coords;\n}", "function minwidth(shape){\n //default first to false\n var first = false\n var count = 0\n //whilst theres nothing found then keep looping\n while (first == false && count < (shape.length -1)){\n for(var row = 0; row < shape.length; row++){\n //checks if first collum for that row is filled\n if(shape[row][0] !== 0){\n first = true\n return(0)\n }\n }\n count++\n }\n if (first == false){\n return(1)\n }\n}" ]
[ "0.69085807", "0.6315294", "0.6315294", "0.6236337", "0.6224419", "0.6206841", "0.612851", "0.6127941", "0.6090618", "0.60611093", "0.5930872", "0.58946407", "0.58901054", "0.58175117", "0.5788505", "0.577618", "0.5757049", "0.573049", "0.5715967", "0.57059723", "0.5675279", "0.5667267", "0.56563485", "0.56456953", "0.56146896", "0.560322", "0.5595735", "0.5591653", "0.5577458", "0.55733556", "0.55672026", "0.55672026", "0.5561007", "0.5557877", "0.55574214", "0.55554974", "0.5543526", "0.5533983", "0.5530566", "0.55257714", "0.55208206", "0.55151063", "0.5507909", "0.5504506", "0.5503972", "0.5487001", "0.5483825", "0.54806346", "0.54793066", "0.54704154", "0.54698277", "0.5467716", "0.54675406", "0.5466691", "0.5463092", "0.54624146", "0.54573196", "0.5449803", "0.54419345", "0.54279494", "0.5418455", "0.5417737", "0.5417189", "0.5416552", "0.54086626", "0.54081506", "0.54067403", "0.5406619", "0.5406619", "0.5403286", "0.5397691", "0.5385382", "0.5375933", "0.53733194", "0.53726596", "0.5368501", "0.53670204", "0.5360842", "0.53490174", "0.53425115", "0.53409594", "0.5334608", "0.5322887", "0.53226477", "0.53187907", "0.5316516", "0.5316506", "0.5312883", "0.5312845", "0.5310327", "0.530837", "0.52993166", "0.52936566", "0.52915514", "0.5291247", "0.52893966", "0.5285605", "0.52816266", "0.5278569", "0.52775186" ]
0.6543187
1
We want to approximate the length of a curve representing a function y = f(x) with a<= x <= b. First, we split the interval [a, b] into n subintervals with widths h1, h2, ... , hn by defining points x1, x2 , ... , xn1 between a and b. This defines points P0, P1, P2, ... , Pn on the curve whose xcoordinates are a, x1, x2 , ... , xn1, b and ycoordinates f(a), f(x1), ..., f(xn1), f(b) . By connecting these points, we obtain a polygonal path approximating the curve. Our task is to approximate the length of a parabolic arc representing the curve y = x x with x in the interval [0, 1]. We will take a common step h between the points xi: h1, h2, ... , hn = h = 1/n and we will consider the points P0, P1, P2, ... , Pn on the curve. The coordinates of each Pi are (xi, yi = xi xi). The function len_curve (or similar in other languages) takes n as parameter (number of subintervals) and returns the length of the curve. You can truncate it to 9 decimal places. alternative text
function lenCurve(n) { function seglg() { return Math.sqrt(Math.pow(n, 2) + 4 * Math.pow(k, 2) + 4 * k + 1) / Math.pow(n, 2); } var s = 0; for (var k = 0; k < n; k++) { s += seglg(); } return Math.floor(s * 1e9) / 1e9; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function curveLength({\n fun,\n curveStartParam,\n curveEndParam,\n\n //optionals:\n funIsAVector, //true for t |-> [x,y], false for y=f(x) \n INTEGRATION_POINTS_LIM,\n calculationAccuracy,\n STARTING_EXPONENT_FOR_2,\n SAFETY_INTERACTIONS_LIM,\n }){\n\n //value 10 gives limit = 2^10, possibly accuracy = 0.001\n //SAFETY_INTERACTIONS_LIM = 25; //experiment: 25 seems ~ 180 Meg, accuracy ~ 10^-11\n //SAFETY_INTERACTIONS_LIM = 23; //23 must be safe, 30 - danger\n SAFETY_INTERACTIONS_LIM = SAFETY_INTERACTIONS_LIM || 20; //30 - danger\n\n INTEGRATION_POINTS_LIM = INTEGRATION_POINTS_LIM || 1000;\n calculationAccuracy = calculationAccuracy || 0.000000001;\n STARTING_EXPONENT_FOR_2 = STARTING_EXPONENT_FOR_2 || 4;\n\n\n var expo = STARTING_EXPONENT_FOR_2;\n var basePointsCount = mat.powersOf2[ expo ];\n basePoints = [];\n funPoints = [];\n var currentBasePoints = basePoints[ expo ] = [];\n funPoints[ expo ] = [];\n var currentStep = ( curveEndParam - curveStartParam ) / basePointsCount;\n\n for( var it=0; it<=basePointsCount; it++ ) {\n currentBasePoints[ it ] = curveStartParam + currentStep * it;\n var tt = currentBasePoints[ it ];\n var funPoint = fun( currentBasePoints[ it ] );\n if( !funIsAVector ) {\n funPoint = [ tt, funPoint ];\n }\n funPoints[ expo ][ it ] = funPoint;\n }\n var prevLen = calculates_curvePoints2chordsSum( funPoints[ expo ] );\n\n\n function calculates_curvePoints2chordsSum( curvePoints )\n {\n var lenSum = 0;\n var curPLen = curvePoints.length;\n for( var it=1; it<curPLen; it++ ) {\n var prevP = curvePoints[ it-1 ];\n var curP = curvePoints[ it ];\n var dx = curP[0]-prevP[0];\n var dy = curP[1]-prevP[1];\n lenSum += Math.sqrt( dx*dx + dy*dy );\n }\n return lenSum;\n }\n\n for( var expo = STARTING_EXPONENT_FOR_2 + 1;\n expo < SAFETY_INTERACTIONS_LIM; expo++\n ) {\n var prevPC = mat.powersOf2[ expo-1 ];\n var prevBP = basePoints[ expo-1 ];\n var prevFP = funPoints[ expo-1 ];\n var currentBasePoints = basePoints[ expo ] = [];\n var funP = funPoints[ expo ] = [];\n\n for( var ip = 0; ip <= prevPC; ip++ ) {\n var it = ip*2;\n var fP = funP[ it ] = prevFP[ ip ];\n var tLeft = currentBasePoints[ it ] = prevBP[ ip ];\n var tRight = prevBP[ ip + 1 ];\n\n if( ip === prevPC ) break;\n var tMiddle = currentBasePoints[ it + 1 ] =\n ( tLeft + tRight ) * 0.5;\n var funPoint = fun( tMiddle );\n if( !funIsAVector ) {\n funPoint = [ tMiddle, funPoint ];\n }\n funP[ it + 1 ] = funPoint;\n }\n var newLen = calculates_curvePoints2chordsSum( funP );\n\n var reachedAccuracy = Math.abs( prevLen - newLen );\n if( calculationAccuracy > reachedAccuracy ) {\n /*\n ccc( 'reached accuracy=' + reachedAccuracy +\n 'value=', newLen, 'expo=', expo, 'memory~' + funP.length\n );\n */\n return newLen;\n }\n prevLen = newLen;\n }\n\n /*\n ccc( 'missed accuracy: reached only this =' + reachedAccuracy +\n 'value=', newLen, 'expo=', expo, 'memory~' + funP.length\n );\n */\n\n //we did not reach preset accuracy, so do return\n //what we have:\n return prevLen;\n }", "totalLength(){\n\n let clen = 0;\n let pts;\n\n for(let i = 0; i < this.nCurves; i++){\n let idx = i*2;\n pts = [ p5.Vector.add(this.cpts[idx], this.cpts[idx+1]).mult(0.5),\n this.cpts[idx+1],\n this.cpts[idx+2],\n p5.Vector.add(this.cpts[idx+2], this.cpts[idx+3]).mult(0.5)\n ];\n \n clen += this.segmentLength(pts);\n }\n\n return clen;\n\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 calculate_the_length(x1,y1,x2,y2){\n let length_AB = Math.sqrt ((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));\n console.log(length_AB)\n}", "function PathLength(points) {\n let length = 0.0;\n for (let i = 1; i < points.length - 1; i += 1) {\n length += EuclideanDistance(points[i - 1], points[i]);\n }\n return length;\n }", "function lenFromRATri(hyp, len) {\n return Math.pow(Math.pow(hyp, 2) - Math.pow(len, 2), 0.5);\n}", "function computeLineLength( x1, y1, x2, y2 ) {\n let xdiff = subtract( x2, x1 );\n let ydiff = subtract( y2, y1 );\n let total = add( square( xdiff ), square( ydiff ) );\n return Math.sqrt( total );\n}", "function getLength(a, b) {\n return Math.sqrt((Math.pow(b[0] - a[0], 2) + Math.pow(b[1] - a[1], 2) + Math.pow(b[2] - a[2], 2)));\n}", "function curveIncrement(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y, t) {\n\tvar v1x = -3*p0x + 9*p1x - 9*p2x + 3*p3x;\n\tvar v1y = -3*p0y + 9*p1y - 9*p2y + 3*p3y;\n\tvar v2x = 6*p0x - 12*p1x + 6*p2x;\n\tvar v2y = 6*p0y - 12*p1y + 6*p2y;\n\tvar v3x = -3*p0x + 3*p1x;\n\tvar v3y = -3*p0y + 3*p1y;\n\n\tvar x = t*t*v1x + t*v2x + v3x;\n\tvar y = t*t*v1y + t*v2y + v3y;\n\tvar length = Math.sqrt(x*x + y*y);\n\treturn length;\n}", "function chordLength(radius, angle) {\n return 2.0 * radius * Math.sin(angle / 2.0);\n}", "function lineLength(x, y, x0, y0){\n return Math.sqrt((x -= x0) * x + (y -= y0) * y);\n}", "function chord_length_parameterize(points, first, last) {\n var u = [0];\n for (var i = first + 1; i <= last; i++) {\n u[i - first] = u[i - first - 1] + distance(points[i], points[i - 1]);\n }\n for (var i = 1, m = last - first; i <= m; i++) u[i] /= u[m];\n return u;\n }", "function getLineLength(x1, y1, x2, y2) {\n var res = Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2));\n return res;\n}", "function getLength(time, result) {\n // Get the end position from the polyLine's callback.\n var endPoint = redLine.polyline.positions.getValue(time, result)[1];\n endCartographic = Cesium.Cartographic.fromCartesian(endPoint);\n\n geodesic.setEndPoints(startCartographic, endCartographic);\n var lengthInMeters = Math.round(geodesic.surfaceDistance);\n return (lengthInMeters / 1000).toFixed(1) + \" km\";\n}", "function describeArcs(p,r,start,end, totalLength){\n\t\t\tvar paragraphFraction = p.words.length/totalLength;\n\t\t\tvar paragraphArea = Math.PI * r * r * paragraphFraction;\n\n\t\t\t// These will get incremented\n\t\t\tvar rPos = 0;\n\t\t\tvar currentVal = 0;\n\t\t\t\n\t\t\t// describe each ring\n\t\t\treturn function(s){\n\t\t\t\tvar innerRadius = rPos;\n\t\t\t\t\n\t\t\t\tcurrentVal += s.words.length;\n\t\t\t\tvar currentArea = paragraphArea * (currentVal/p.words.length);\n\t\t\t\trPos = Math.sqrt((currentArea*(1/paragraphFraction))/Math.PI);\n\n\t\t\t\touterRadius = rPos;\n\t\t\t\treturn {\n\t\t\t\t\t'innerRadius':innerRadius,\n\t\t\t\t\t'outerRadius':outerRadius,\n\t\t\t\t\t'startAngle':start,\n\t\t\t\t\t'endAngle':end,\n\t\t\t\t}\n\t\t\t}\n\t\t}", "function calculateArea(f, startX, endX) {\n return trapeziumRule(0.1, 2000, f, startX, endX);\n}", "function rectangles(f, a, b, n, pos = \"l\"){\r\n //f is the function, [a,b] is the interval, n is the number of strips, and pos is which part of the rectangle should touch the curve\r\n\r\n fill(0, 0, 255, 200);\r\n stroke(0, 0, 0, 50);\r\n let w = (b-a)/n; //Width of rectangles\r\n let s = 0; // Sum variable\r\n\r\n let delta = 0; //This determines what part of the curve on the interval from xi to xi+1 will be the height of the rectangle\r\n if(pos == \"l\"){\r\n delta = 0;\r\n } else if(pos == \"m\"){\r\n delta = w/2;\r\n } else if (pos == \"r\"){\r\n delta = w;\r\n }\r\n\r\n for(let i = 0; i < n; i++){\r\n //Note we do up to i = n - 1 because the final rectangle will have its right side on x = b\r\n let xi = a + i * w;\r\n s += f(xi + delta)\r\n rect(xi * sclx, -f(xi + delta) * scly, w * sclx, f(xi + delta) * scly); //Negative height for rectangle means we want it to be above the given corner\r\n }\r\n return s * w;\r\n}", "function polypoint(w, h, sides, steps) {\n\n let centerX, centerY, lengthX, lengthY;\n let d, endpoint\n\n // find center point\n centerX = ( h/2 );\n centerY = ( w/2 );\n lengthX = (centerX-(h%steps) );\n lengthY = (centerY-(w%steps) );\n stepX = lengthX/steps\n stepY = lengthY/steps\n //_______ find end points_______\n // d = (2*pi/side) => d = ( 2*(Math.PI/side) )\n // will return the angle for\n d = angles(sides)\n // find the coords for each one. and return them as a tuple array to 2 decimals\n endpoints= new Array(sides).fill([])\n data = new Object\n\n for (let i = 0; i < sides; i++) {\n\n data[`_${i}`]={\n x:[Math.round( (lengthX*Math.cos(d*i)) +centerX)],\n y:[Math.round( (lengthY*Math.sin(d*i)) +centerY)]\n }\n\n endpoints[i] = [\n Math.round( (lengthX*Math.cos(d*i)) +centerX),\n Math.round( (lengthY*Math.sin(d*i)) +centerY)\n ];\n }\n endpoints.reverse()\n console.log(`endpoints ${endpoints}`.red);\n console.log(`data`.red, data);\n console.log(`variables lengthX ${lengthX}, lengthY ${lengthY}`.blue);\n console.log(`variables centerX ${centerX}, centerY ${centerY}`.blue);\n\n // there are steps involving changing it to a SVG coord system\n\n // create the step arrays.\n // find step length\nconsole.log(\"endpoints\".blue,endpoints);\n for (let i = 0; i < endpoints.length; i++) {\n for (let j = 1; j < sides; j++) {\n if (centerX < endpoints[i][0]) {//\n\n endpoints[i].push(centerX,endpoints[i][1]-j*stepX)\n\n }else if (centerX > endpoints[i][0]) {//\n\n endpoints[i].push(centerX,endpoints[i][1]+j*stepX)\n\n }else if (centerX == endpoints[i][0] ) {\n\n endpoints[i].push(endpoints[i][0]+j*stepX,centerX)\n\n }else if (centerY < endpoints[i][1]) {\n\n endpoints[i].push(endpoints[i][1]-j*stepY,centerY)\n\n }\n else if (centerY > endpoints[i][1]) {\n\n endpoints[i].push(endpoints[i][1]+j*stepY,centerY)\n\n }else if (centerY == endpoints[i][1] ) {\n\n endpoints[i].push(endpoints[i][1]+j*stepY,centerY)\n\n }\n }\n }\n console.log(\"endpoints\".green,endpoints);\n for (let i = 0; i < endpoints.length; i++) {\n if (i%2 == 0) {// reverse in pairs\n endpoints[i].reverse()\n }\n }\n console.log(\"endpoints\".green,endpoints);\n /*\n\n console.log(`endpoints`.red,endpoints );\n console.log(`variables lengthX ${lengthX}, lengthY ${lengthY}`.blue);\n console.log(`variables centerX ${centerX}, centerY ${centerY}`.blue);\n\n*/\n\n/*\n{\n _1:{ x:[1,2,4,5],y:[1,2,3,4] },\n _2:{ x:[1,2,4,5],y:[1,2,3,4] },\n _3:{ x:[1,2,4,5],y:[1,2,3,4] },\n _4:{ x:[1,2,4,5],y:[1,2,3,4] }\n}\n*/\n\n\n console.log(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${w}px\" height=\"${h}\" viewbox=\"0 0 ${w} ${h}\">\n <g class=\"polypoint\" id=\"_${sides}_${steps}\">`.green\n +\n `<polygon points=\"${endpoints}\" />`.green\n +\n `</g>\n </svg>`.green);\n}", "function polygonLength(vertices){\n var i = -1,\n n = vertices.length,\n b = vertices[n - 1],\n xa,\n ya,\n xb = b[0],\n yb = b[1],\n perimeter = 0;\n\n while (++i < n) {\n xa = xb;\n ya = yb;\n b = vertices[i];\n xb = b[0];\n yb = b[1];\n xa -= xb;\n ya -= yb;\n perimeter += Math.sqrt(xa * xa + ya * ya);\n }\n\n return perimeter;\n }", "function computeLength(path) {\n path = common.convertToPositionArray(path);\n if (path.length < 2) {\n return 0;\n }\n var length = 0;\n var prev = path[0];\n var prevLat = toRadians(prev.lat);\n var prevLng = toRadians(prev.lng);\n path.forEach(function (point) {\n var lat = toRadians(point.lat);\n var lng = toRadians(point.lng);\n length += distanceRadians(prevLat, prevLng, lat, lng);\n prevLat = lat;\n prevLng = lng;\n });\n return length * EARTH_RADIUS;\n}", "function f(t) {\n\t\t\t\t\tvar count = getIterations(start, t);\n\t\t\t\t\tif (start < t) {\n\t\t\t\t\t\tlen += Numerical.integrate(ds, start, t, count);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlen -= Numerical.integrate(ds, t, start, count);\n\t\t\t\t\t}\n\t\t\t\t\tstart = t;\n\t\t\t\t\treturn len - length;\n\t\t\t\t}", "function getInnerPctCalcFunction(arcs, shapes) {\n var calcSegLen = arcs.isPlanar() ? geom.distance2D : geom.greatCircleDistance;\n var arcIndex = new ArcTopologyIndex(arcs, shapes);\n var outerLen, innerLen, arcLen; // temp variables\n\n return function(shp) {\n outerLen = 0;\n innerLen = 0;\n if (shp) shp.forEach(procRing);\n return innerLen > 0 ? innerLen / (innerLen + outerLen) : 0;\n };\n\n function procRing(ids) {\n ids.forEach(procArc);\n }\n\n function procArc(id) {\n arcLen = 0;\n arcs.forEachArcSegment(id, addSegLen);\n if (arcIndex.isInnerArc(id)) {\n innerLen += arcLen;\n } else {\n outerLen += arcLen;\n }\n }\n\n function addSegLen(i, j, xx, yy) {\n arcLen += calcSegLen(xx[i], yy[i], xx[j], yy[j]);\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 }", "getLineLengthBetweenPoints (x, y, x0, y0){\n return Math.sqrt((x -= x0) * x + (y -= y0) * y);\n }", "getCurveLengths() {\n\n\t\t// We use cache values if curves and cache array are same length\n\n\t\tif ( this.cacheLengths && this.cacheLengths.length === this.curves.length ) {\n\n\t\t\treturn this.cacheLengths;\n\n\t\t}\n\n\t\t// Get length of sub-curve\n\t\t// Push sums into cached array\n\n\t\tconst lengths = [];\n\t\tlet sums = 0;\n\n\t\tfor ( let i = 0, l = this.curves.length; i < l; i ++ ) {\n\n\t\t\tsums += this.curves[ i ].getLength();\n\t\t\tlengths.push( sums );\n\n\t\t}\n\n\t\tthis.cacheLengths = lengths;\n\n\t\treturn lengths;\n\n\t}", "function pathLength(path) {\n var i, sum = 0, a, b, dx, dy;\n for (i = 1; i < path.length; ++i) {\n a = path[i - 1];\n b = path[i];\n dx = a[0] - b[0];\n dy = a[1] - b[1];\n sum += Math.sqrt(dx * dx + dy * dy);\n }\n return sum;\n}", "function getLength(q){\n h = 1 / 128;\n var hh = h * 2;\n var m = [q[3][0] - q[0][0] + 3 * (q[1][0] - q[2][0]),\n q[0][0] - 2 * q[1][0] + q[2][0],\n q[1][0] - q[0][0]];\n var n = [q[3][1] - q[0][1] + 3 * (q[1][1] - q[2][1]),\n q[0][1] - 2 * q[1][1] + q[2][1],\n q[1][1] - q[0][1]];\n var k = [ m[0] * m[0] + n[0] * n[0],\n 4 * (m[0] * m[1] + n[0] * n[1]),\n 2 * ((m[0] * m[2] + n[0] * n[2]) + 2 * (m[1] * m[1] + n[1] * n[1])),\n 4 * (m[1] * m[2] + n[1] * n[2]), m[2] * m[2] + n[2] * n[2] ];\n var fc = function(t, k){\n return Math.sqrt(t * (t * (t * (t * k[0] + k[1]) + k[2]) + k[3]) + k[4]) || 0 };\n var sm = (fc(0, k) - fc(1, k)) / 2;\n for(var t = h; t < 1; t += hh) sm += 2 * fc(t, k) + fc(t + h, k);\n return sm * hh;\n}", "function polyArea(points){\n var p1,p2;\n for(var area=0,len=points.length,i=0;i<len;++i){\n p1 = points[i];\n p2 = points[(i-1+len)%len]; // Previous point, with wraparound\n area += (p2.x+p1.x) * (p2.y-p1.y);\n }\n return Math.abs(area/2);\n }", "getLength() {\n\n\t\tconst lens = this.getCurveLengths();\n\t\treturn lens[ lens.length - 1 ];\n\n\t}", "function rectangleRotation(a, b) {\n let count = 0;\n let midright = a / 2 / Math.sqrt(2);\n let midleft = -1 * midright;\n let x = b / 2 / Math.sqrt(2);\n let p1 = [midleft - x, midleft + x];\n let p2 = [midleft + x, midleft - x];\n let p3 = [midright - x, midright + x];\n let p4 = [midright + x, midright - x];\n let startx = Math.ceil(p1[0]);\n let endx = Math.floor(p4[0]);\n for (let i = startx; i <= endx; i++) {\n if (a > b) {\n if (i <= p2[0]) {\n count +=\n Math.floor(getyvaluefromline(p1, i, 1)) -\n Math.ceil(getyvaluefromline(p1, i, -1)) +\n 1;\n } else if (i > p2[0] && i <= p3[0]) {\n count +=\n Math.floor(getyvaluefromline(p1, i, 1)) -\n Math.ceil(getyvaluefromline(p2, i, 1)) +\n 1;\n } else {\n count +=\n Math.floor(getyvaluefromline(p3, i, -1)) -\n Math.ceil(getyvaluefromline(p2, i, 1)) +\n 1;\n }\n } else {\n if (i <= p3[0]) {\n count +=\n Math.floor(getyvaluefromline(p1, i, 1)) -\n Math.ceil(getyvaluefromline(p1, i, -1)) +\n 1;\n } else if (i > p3[0] && i <= p2[0]) {\n count +=\n Math.floor(getyvaluefromline(p3, i, -1)) -\n Math.ceil(getyvaluefromline(p1, i, -1)) +\n 1;\n } else {\n count +=\n Math.floor(getyvaluefromline(p3, i, -1)) -\n Math.ceil(getyvaluefromline(p2, i, 1)) +\n 1;\n }\n }\n }\n return count;\n}", "function length(point) {\n return Math.sqrt(point.x * point.x + point.y * point.y);\n }", "function createPiecewiseCurve() {\n\n var fns = arguments;\n\n return function(t) {\n var n = fns.length;\n // increase the interval from (0, 1) to (0, n)\n var tscale = t * n;\n // pick the i'th function for the interval (i, i + 1)\n var i = constrain(floor(tscale), 0, n - 1);\n var fn = fns[i];\n // re-normalize parameter to the range (0, 1)\n var u = tscale - i;\n // apply the selected function\n return fn(u);\n };\n\n}", "function lineLength(line){\n return Math.sqrt(Math.pow(line[1][0] - line[0][0], 2) + Math.pow(line[1][1] - line[0][1], 2));\n }", "function pointLineDistance(p, lstart, lend, overLine) {\n\tvar points = normalizeArguments(\"pppb\", arguments);\n\tvar x = points[0].x;\n\tvar y = points[0].y;\n\tvar x0 = points[1].x;\n\tvar y0 = points[1].y;\n\tvar x1 = points[2].x;\n\tvar y1 = points[2].y;\n\tvar o = points[3];\n\tif(o && !(o = function(x, y, x0, y0, x1, y1) {\n\t\tif(!(x1 - x0)) return {x: x0, y: y};\n\t\telse if(!(y1 - y0)) return {x: x, y: y0};\n\t\tvar left, tg = -1 / ((y1 - y0) / (x1 - x0));\n\t\treturn {x: left = (x1 * (x * tg - y + y0) + x0 * (x * - tg + y - y1)) / (tg * (x1 - x0) + y0 - y1), y: tg * left - tg * x + y};\n\t}(x, y, x0, y0, x1, y1), o.x >= Math.min(x0, x1) && o.x <= Math.max(x0, x1) && o.y >= Math.min(y0, y1) && o.y <= Math.max(y0, y1))) {\n\t\tvar l1 = lineLength(x, y, x0, y0), l2 = lineLength(x, y, x1, y1);\n\t\treturn l1 > l2 ? l2 : l1;\n\t}\n\telse {\n\t\tvar a = y0 - y1, b = x1 - x0, c = x0 * y1 - y0 * x1;\n\t\treturn Math.abs(a * x + b * y + c) / Math.sqrt(a * a + b * b);\n\t}\n}", "function calculateLengthAbsolute( point1, point2){\r\n return Math.abs(point1-point2);\r\n}", "function curveDim(x0, y0, x1, y1, x2, y2, x3, y3) {\n var tvalues = [],\n bounds = [[], []],\n a, b, c, t, t1, t2, b2ac, sqrtb2ac;\n for (var i = 0; i < 2; ++i) {\n if (i == 0) {\n b = 6 * x0 - 12 * x1 + 6 * x2;\n a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;\n c = 3 * x1 - 3 * x0;\n } else {\n b = 6 * y0 - 12 * y1 + 6 * y2;\n a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;\n c = 3 * y1 - 3 * y0;\n }\n if (abs(a) < 1e-12) {\n if (abs(b) < 1e-12) {\n continue;\n }\n t = -c / b;\n if (0 < t && t < 1) {\n tvalues.push(t);\n }\n continue;\n }\n b2ac = b * b - 4 * c * a;\n sqrtb2ac = math.sqrt(b2ac);\n if (b2ac < 0) {\n continue;\n }\n t1 = (-b + sqrtb2ac) / (2 * a);\n if (0 < t1 && t1 < 1) {\n tvalues.push(t1);\n }\n t2 = (-b - sqrtb2ac) / (2 * a);\n if (0 < t2 && t2 < 1) {\n tvalues.push(t2);\n }\n }\n\n var x, y, j = tvalues.length,\n jlen = j,\n mt;\n while (j--) {\n t = tvalues[j];\n mt = 1 - t;\n bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;\n bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;\n }\n\n bounds[0][jlen] = x0;\n bounds[1][jlen] = y0;\n bounds[0][jlen + 1] = x3;\n bounds[1][jlen + 1] = y3;\n bounds[0].length = bounds[1].length = jlen + 2;\n\n\n return {\n min: {x: mmin.apply(0, bounds[0]), y: mmin.apply(0, bounds[1])},\n max: {x: mmax.apply(0, bounds[0]), y: mmax.apply(0, bounds[1])}\n };\n }", "function interpolate(length, totalLength, start, end) {\n var xy = [\n start[0] + (end[0] - start[0]) * length / totalLength,\n start[1] + (end[1] - start[1]) * length / totalLength\n ];\n return xy;\n }", "function calcTripLength([x1, y1, x2, y2, x3, y3]) {\n [x1, y1, x2, y2, x3, y3] = [x1, y1, x2, y2, x3, y3].map(Number);\n let distance1 = Math.sqrt(Math.pow(x1 - x2, 2) + (Math.pow(y1 - y2, 2)));\n let distance2 = Math.sqrt(Math.pow(x2 - x3, 2) + (Math.pow(y2 - y3, 2)));\n let distance3 = Math.sqrt(Math.pow(x1 - x3, 2) + (Math.pow(y1 - y3, 2)));\n let distances = [distance1, distance2, distance3].sort();\n let first = distances[0];\n let second = distances[1];\n let sum = first + second;\n if (first == distance1 && second == distance2) {\n console.log('1->2->3: ' + sum);\n } else if (first == distance1 && second == distance3) {\n console.log('2->1->3: ' + sum);\n } else if (first == distance2 && second == distance3) {\n console.log('1->3->2: ' + sum);\n }\n}", "function length_v2(v) { return Math.sqrt(v[0] * v[0] + v[1] * v[1]); }", "function curveDim(x0, y0, x1, y1, x2, y2, x3, y3) {\n var tvalues = [],\n bounds = [[], []],\n a, b, c, t, t1, t2, b2ac, sqrtb2ac;\n for (var i = 0; i < 2; ++i) {\n if (i == 0) {\n b = 6 * x0 - 12 * x1 + 6 * x2;\n a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;\n c = 3 * x1 - 3 * x0;\n } else {\n b = 6 * y0 - 12 * y1 + 6 * y2;\n a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;\n c = 3 * y1 - 3 * y0;\n }\n if (abs(a) < 1e-12) {\n if (abs(b) < 1e-12) {\n continue;\n }\n t = -c / b;\n if (0 < t && t < 1) {\n tvalues.push(t);\n }\n continue;\n }\n b2ac = b * b - 4 * c * a;\n sqrtb2ac = math.sqrt(b2ac);\n if (b2ac < 0) {\n continue;\n }\n t1 = (-b + sqrtb2ac) / (2 * a);\n if (0 < t1 && t1 < 1) {\n tvalues.push(t1);\n }\n t2 = (-b - sqrtb2ac) / (2 * a);\n if (0 < t2 && t2 < 1) {\n tvalues.push(t2);\n }\n }\n\n var x, y, j = tvalues.length,\n jlen = j,\n mt;\n while (j--) {\n t = tvalues[j];\n mt = 1 - t;\n bounds[0][j] = (mt * mt * mt * x0) + (3 * mt * mt * t * x1) + (3 * mt * t * t * x2) + (t * t * t * x3);\n bounds[1][j] = (mt * mt * mt * y0) + (3 * mt * mt * t * y1) + (3 * mt * t * t * y2) + (t * t * t * y3);\n }\n\n bounds[0][jlen] = x0;\n bounds[1][jlen] = y0;\n bounds[0][jlen + 1] = x3;\n bounds[1][jlen + 1] = y3;\n bounds[0].length = bounds[1].length = jlen + 2;\n\n\n return {\n min: {x: mmin.apply(0, bounds[0]), y: mmin.apply(0, bounds[1])},\n max: {x: mmax.apply(0, bounds[0]), y: mmax.apply(0, bounds[1])}\n };\n }", "function curveDim(x0, y0, x1, y1, x2, y2, x3, y3) {\n var tvalues = [],\n bounds = [[], []],\n a, b, c, t, t1, t2, b2ac, sqrtb2ac;\n for (var i = 0; i < 2; ++i) {\n if (i == 0) {\n b = 6 * x0 - 12 * x1 + 6 * x2;\n a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;\n c = 3 * x1 - 3 * x0;\n } else {\n b = 6 * y0 - 12 * y1 + 6 * y2;\n a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;\n c = 3 * y1 - 3 * y0;\n }\n if (abs(a) < 1e-12) {\n if (abs(b) < 1e-12) {\n continue;\n }\n t = -c / b;\n if (0 < t && t < 1) {\n tvalues.push(t);\n }\n continue;\n }\n b2ac = b * b - 4 * c * a;\n sqrtb2ac = math.sqrt(b2ac);\n if (b2ac < 0) {\n continue;\n }\n t1 = (-b + sqrtb2ac) / (2 * a);\n if (0 < t1 && t1 < 1) {\n tvalues.push(t1);\n }\n t2 = (-b - sqrtb2ac) / (2 * a);\n if (0 < t2 && t2 < 1) {\n tvalues.push(t2);\n }\n }\n\n var x, y, j = tvalues.length,\n jlen = j,\n mt;\n while (j--) {\n t = tvalues[j];\n mt = 1 - t;\n bounds[0][j] = (mt * mt * mt * x0) + (3 * mt * mt * t * x1) + (3 * mt * t * t * x2) + (t * t * t * x3);\n bounds[1][j] = (mt * mt * mt * y0) + (3 * mt * mt * t * y1) + (3 * mt * t * t * y2) + (t * t * t * y3);\n }\n\n bounds[0][jlen] = x0;\n bounds[1][jlen] = y0;\n bounds[0][jlen + 1] = x3;\n bounds[1][jlen + 1] = y3;\n bounds[0].length = bounds[1].length = jlen + 2;\n\n\n return {\n min: {x: mmin.apply(0, bounds[0]), y: mmin.apply(0, bounds[1])},\n max: {x: mmax.apply(0, bounds[0]), y: mmax.apply(0, bounds[1])}\n };\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 }", "get length() {\n return Math.sqrt(Math.pow(this.x, 2) + Math.pow(this.y, 2));\n }", "function curveDim(x0, y0, x1, y1, x2, y2, x3, y3) {\n\t var tvalues = [],\n\t bounds = [[], []],\n\t a, b, c, t, t1, t2, b2ac, sqrtb2ac;\n\t for (var i = 0; i < 2; ++i) {\n\t if (i == 0) {\n\t b = 6 * x0 - 12 * x1 + 6 * x2;\n\t a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;\n\t c = 3 * x1 - 3 * x0;\n\t } else {\n\t b = 6 * y0 - 12 * y1 + 6 * y2;\n\t a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;\n\t c = 3 * y1 - 3 * y0;\n\t }\n\t if (abs(a) < 1e-12) {\n\t if (abs(b) < 1e-12) {\n\t continue;\n\t }\n\t t = -c / b;\n\t if (0 < t && t < 1) {\n\t tvalues.push(t);\n\t }\n\t continue;\n\t }\n\t b2ac = b * b - 4 * c * a;\n\t sqrtb2ac = math.sqrt(b2ac);\n\t if (b2ac < 0) {\n\t continue;\n\t }\n\t t1 = (-b + sqrtb2ac) / (2 * a);\n\t if (0 < t1 && t1 < 1) {\n\t tvalues.push(t1);\n\t }\n\t t2 = (-b - sqrtb2ac) / (2 * a);\n\t if (0 < t2 && t2 < 1) {\n\t tvalues.push(t2);\n\t }\n\t }\n\t\n\t var x, y, j = tvalues.length,\n\t jlen = j,\n\t mt;\n\t while (j--) {\n\t t = tvalues[j];\n\t mt = 1 - t;\n\t bounds[0][j] = (mt * mt * mt * x0) + (3 * mt * mt * t * x1) + (3 * mt * t * t * x2) + (t * t * t * x3);\n\t bounds[1][j] = (mt * mt * mt * y0) + (3 * mt * mt * t * y1) + (3 * mt * t * t * y2) + (t * t * t * y3);\n\t }\n\t\n\t bounds[0][jlen] = x0;\n\t bounds[1][jlen] = y0;\n\t bounds[0][jlen + 1] = x3;\n\t bounds[1][jlen + 1] = y3;\n\t bounds[0].length = bounds[1].length = jlen + 2;\n\t\n\t\n\t return {\n\t min: {x: mmin.apply(0, bounds[0]), y: mmin.apply(0, bounds[1])},\n\t max: {x: mmax.apply(0, bounds[0]), y: mmax.apply(0, bounds[1])}\n\t };\n\t }", "function length(v) {\n return sqrt(v[0] * v[0] + v[1] * v[1]);\n}", "static polar (len, angle) {\n return new Point (Math.cos(angle)*len, Math.sin(angle)*len);\n }", "function lengthSquaredUpperBound(ps) {\n let totalLength = 0;\n for (let i = 0; i < ps.length - 1; i++) {\n totalLength += flo_vector2d_1.squaredDistanceBetween(ps[i], ps[i + 1]);\n }\n return totalLength;\n}", "get length() {\r\n return function(a) {\r\n return this.max(a) - this.min(a)\r\n }\r\n }", "function area2D(poly, n) {\n let area = 0.0;\n let i, j, k;\n\n if (n < 3) return 0;\n\n for (i = 1, j = 2, k = 0; i < n; i++, j++, k++) {\n area += poly.get(i)[0] * (poly.get(j)[1] - poly.get(k)[1]);\n }\n area += poly.get(n)[0] * (poly.get(1)[1] - poly.get(n - 1)[1]); // wrap-around term\n return area / 2.0;\n}", "function lengthOfHypotenuse(side1, side2){\n \n //hypotenuse squared = side1 squared + side2 squared\n var hypotenuse = Math.sqrt((side1 * side1) + (side2 * side2));\n return hypotenuse;\n}", "length() {\n return Math.hypot(this.x, this.y);\n }", "get length() {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }", "function triArea(base, height) {\n return (base*height)/2;\n}", "function PlanarCoordinates() {\n var x1 = parseFloat(document.getElementById('x1').value);\n var y1 = parseFloat(document.getElementById('y1').value);\n var x2 = parseFloat(document.getElementById('x2').value);\n var y2 = parseFloat(document.getElementById('y2').value);\n var x3 = parseFloat(document.getElementById('x3').value);\n var y3 = parseFloat(document.getElementById('y3').value);\n\n var length = {\n lineLengthAtoB: countDistance(x1, y1, x2, y2),\n lineLengthBtoC: countDistance(x2, y2, x3, y3),\n lineLengthAtoC: countDistance(x1, y1, x3, y3)\n }\n\n function countDistance(varX1, varY1, varX2, varY2) {\n var result = Math.sqrt(((varX2 - varX1) * (varX2 - varX1)) +\n ((varY2 - varY1) * (varY2 - varY1)));\n\n return result;\n }\n\n var resultAtoB = Count(length.lineLengthAtoB.toString());\n var resultBtoC = Count(length.lineLengthBtoC.toString());\n var resultAtoC = Count(length.lineLengthAtoC.toString());\n\n function Count(str) {\n var i;\n var index = str.length;\n\n for (i = 0; i < str.length; i++) {\n if (str[i] === '.'.toString()) {\n index = i + 4;\n\n break;\n }\n }\n\n return str.substring(0, index);\n }\n\n var form = formTriangle(parseFloat(resultAtoB), parseFloat(resultBtoC), parseFloat(resultAtoC));\n\n function formTriangle(a, b, c) {\n var biggest = a;\n var second = b;\n var third = c;\n if (b > a && b > c) {\n biggest = b;\n second = a;\n } else if (c > a && c > b) {\n biggest = c;\n second = a;\n }\n\n var val = second + third;\n\n if (val > biggest) {\n return true;\n } else {\n return false;\n }\n }\n\n var endResult = 'Distanance:<br />A to B = <span style=\"color: red;\">' + resultAtoB + \n '</span><br />B to C = <span style=\"color: red;\">' + resultBtoC + '</span><br />A to C = <span style=\"color: red;\">' + \n resultAtoC + '</span><br />';\n endResult += 'Can the lines form a triangle? <span style=\"color: red;\">' + form + '</span>';\n\n document.getElementById('result1').innerHTML = '<h4>Result Task 1:</h4> ' + endResult;\n}", "function curveDim(x0, y0, x1, y1, x2, y2, x3, y3) {\n\t var tvalues = [],\n\t bounds = [[], []],\n\t a, b, c, t, t1, t2, b2ac, sqrtb2ac;\n\t for (var i = 0; i < 2; ++i) {\n\t if (i == 0) {\n\t b = 6 * x0 - 12 * x1 + 6 * x2;\n\t a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;\n\t c = 3 * x1 - 3 * x0;\n\t } else {\n\t b = 6 * y0 - 12 * y1 + 6 * y2;\n\t a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;\n\t c = 3 * y1 - 3 * y0;\n\t }\n\t if (abs(a) < 1e-12) {\n\t if (abs(b) < 1e-12) {\n\t continue;\n\t }\n\t t = -c / b;\n\t if (0 < t && t < 1) {\n\t tvalues.push(t);\n\t }\n\t continue;\n\t }\n\t b2ac = b * b - 4 * c * a;\n\t sqrtb2ac = math.sqrt(b2ac);\n\t if (b2ac < 0) {\n\t continue;\n\t }\n\t t1 = (-b + sqrtb2ac) / (2 * a);\n\t if (0 < t1 && t1 < 1) {\n\t tvalues.push(t1);\n\t }\n\t t2 = (-b - sqrtb2ac) / (2 * a);\n\t if (0 < t2 && t2 < 1) {\n\t tvalues.push(t2);\n\t }\n\t }\n\n\t var x, y, j = tvalues.length,\n\t jlen = j,\n\t mt;\n\t while (j--) {\n\t t = tvalues[j];\n\t mt = 1 - t;\n\t bounds[0][j] = (mt * mt * mt * x0) + (3 * mt * mt * t * x1) + (3 * mt * t * t * x2) + (t * t * t * x3);\n\t bounds[1][j] = (mt * mt * mt * y0) + (3 * mt * mt * t * y1) + (3 * mt * t * t * y2) + (t * t * t * y3);\n\t }\n\n\t bounds[0][jlen] = x0;\n\t bounds[1][jlen] = y0;\n\t bounds[0][jlen + 1] = x3;\n\t bounds[1][jlen + 1] = y3;\n\t bounds[0].length = bounds[1].length = jlen + 2;\n\n\n\t return {\n\t min: {x: mmin.apply(0, bounds[0]), y: mmin.apply(0, bounds[1])},\n\t max: {x: mmax.apply(0, bounds[0]), y: mmax.apply(0, bounds[1])}\n\t };\n\t }", "function numRootsInRange(p, a, b) {\n const ps = sturmChain(p);\n const as = ps.map(p => eHorner(p, a));\n const bs = ps.map(p => eHorner(p, b));\n return eSignChanges(as) - eSignChanges(bs);\n}", "function distLineToPoint(a, b, p) {\n var n = vectDiff(b, a)\n n = vectScale(n, 1/Math.sqrt(n[0]*n[0]+n[1]*n[1]))\n \n var amp = vectDiff(a, p)\n var d = vectDiff(amp, vectScale(n,(dot(amp, n))))\n //return { d:d, a:amp, nn:n, n:dot(amp,n)}\n return Math.sqrt(d[0]*d[0]+d[1]*d[1])\n}", "function curveTo(cx, cy, rx, ry, start, end, dx, dy) {\n var result = [],\n arcAngle = end - start;\n if ((end > start) && (end - start > Math.PI / 2 + 0.0001)) {\n result = result.concat(curveTo(cx, cy, rx, ry, start, start + (Math.PI / 2), dx, dy));\n result = result.concat(curveTo(cx, cy, rx, ry, start + (Math.PI / 2), end, dx, dy));\n return result;\n }\n if ((end < start) && (start - end > Math.PI / 2 + 0.0001)) {\n result = result.concat(curveTo(cx, cy, rx, ry, start, start - (Math.PI / 2), dx, dy));\n result = result.concat(curveTo(cx, cy, rx, ry, start - (Math.PI / 2), end, dx, dy));\n return result;\n }\n return [[\n 'C',\n cx + (rx * Math.cos(start)) -\n ((rx * dFactor * arcAngle) * Math.sin(start)) + dx,\n cy + (ry * Math.sin(start)) +\n ((ry * dFactor * arcAngle) * Math.cos(start)) + dy,\n cx + (rx * Math.cos(end)) +\n ((rx * dFactor * arcAngle) * Math.sin(end)) + dx,\n cy + (ry * Math.sin(end)) -\n ((ry * dFactor * arcAngle) * Math.cos(end)) + dy,\n cx + (rx * Math.cos(end)) + dx,\n cy + (ry * Math.sin(end)) + dy\n ]];\n }", "function shapeArea(n) {\n let temp = 1;\n let count = 1;\n if (n === 1) {\n return count;\n } else {\n for (let i = 0; i < n - 1; i++) {\n temp += 2;\n count += temp;\n }\n for (let i = n; i > 1; i--) {\n temp -= 2;\n count += temp;\n }\n }\n return count\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 curve4(x1, y1, //Anchor1\n x2, y2, //Control1\n x3, y3, //Control2\n x4, y4, //Anchor2\n nSteps // Flattening value\n\t\t)\n{\n\tvar pointList = new Array();\n var dx1 = x2 - x1;\n var dy1 = y2 - y1;\n var dx2 = x3 - x2;\n var dy2 = y3 - y2;\n var dx3 = x4 - x3;\n var dy3 = y4 - y3;\n\n var subdiv_step = 1.0 / (nSteps + 1);\n var subdiv_step2 = subdiv_step*subdiv_step;\n var subdiv_step3 = subdiv_step*subdiv_step*subdiv_step;\n\n var pre1 = 3.0 * subdiv_step;\n var pre2 = 3.0 * subdiv_step2;\n var pre4 = 6.0 * subdiv_step2;\n var pre5 = 6.0 * subdiv_step3;\n\n var tmp1x = x1 - x2 * 2.0 + x3;\n var tmp1y = y1 - y2 * 2.0 + y3;\n\n var tmp2x = (x2 - x3)*3.0 - x1 + x4;\n var tmp2y = (y2 - y3)*3.0 - y1 + y4;\n\n var fx = x1;\n var fy = y1;\n\n var dfx = (x2 - x1)*pre1 + tmp1x*pre2 + tmp2x*subdiv_step3;\n var dfy = (y2 - y1)*pre1 + tmp1y*pre2 + tmp2y*subdiv_step3;\n\n var ddfx = tmp1x*pre4 + tmp2x*pre5;\n var ddfy = tmp1y*pre4 + tmp2y*pre5;\n\n var dddfx = tmp2x*pre5;\n var dddfy = tmp2y*pre5;\n\n var step = nSteps;\n\n\tpointList.push ([x1, y1]);\t// Start Here\n while(step--)\n {\n fx += dfx;\n fy += dfy;\n dfx += ddfx;\n dfy += ddfy;\n ddfx += dddfx;\n ddfy += dddfy;\n pointList.push ([fx, fy]);\n }\n// pointList.push ([x4, y4]); // Last step must go exactly to x4, y4\n return pointList;\n}", "function bezier_bounds(p0, p1, p2, p3, width)\n{\n\t// This computes the coefficients of the derivative of the bezier curve.\n\t// We will use this to compute the zeroes to get the maxima.\n\tlet a = -p0 + 3 * p1 - 3 * p2 + p3;\n\tlet b = 2 * p0 - 4 * p1 + 2 * p2;\n\tlet c = p1 - p0;\n\n\t// Compute the discriminant.\n\tlet d = b*b - 4*a*c;\n\t// If there are no maxima or minima, just return the end points.\n\tif(d < 0 || a == 0)\n\t{\n\t\treturn {min: Math.min(p0, p3) - width, max: Math.max(p0, p3) + width};\n\t}\n\t// Square root the discriminant so we don't need to recompute it.\n\td = Math.sqrt(d);\n\t// Compute the \"time\" of the critical points by solving the quadrating equation.\n\tlet crit1 = (-b + d) / (2*a);\n\tlet crit2 = (-b - d) / (2*a);\n\t// Use the \"time\" of the critical points to compute the critical points themselves..\n\tif(crit1 >= 0 && crit1 <= 1)\n\t{\n\t\tcrit1 = compute_bezier(p0, p1, p2, p3, crit1, 1 - crit1);\n\t}\n\telse\n\t{\n\t\tcrit1 = undefined;\n\t}\n\tif(crit2 >= 0 && crit2 <= 1)\n\t{\n\t\tcrit2 = compute_bezier(p0, p1, p2, p3, crit2, 1 - crit2);\n\t}\n\telse\n\t{\n\t\tcrit2 = undefined;\n\t}\n\n\t// Start by just using the end points as the bounds.\n\tlet m = Math.min(p0, p3);\n\tlet M = Math.max(p0, p3);\n\t// If the critical point is valid, ensure it is included in the bounds.\n\tif(crit1)\n\t{\n\t\tm = Math.min(m, crit1);\n\t\tM = Math.max(M, crit1);\n\t}\n\t// If the critical point is valid, ensure it is included in the bounds.\n\tif(crit2)\n\t{\n\t\tm = Math.min(m, crit2);\n\t\tM = Math.max(M, crit2);\n\t}\n\t// Return the bounds.\n\treturn {min: m - width, max: M + width};\n}", "function getCurve(startX, startY, endX, endY) {\n var w = endX - startX;\n var halfWidth = startX + (w / 2);\n\n // position it at the initial x,y coords\n var curve = 'M ' + startX + ' ' + startY +\n\n // now create the curve. This is of the form \"C M,N O,P Q,R\" where C is a directive for SVG (\"curveto\"),\n // M,N are the first curve control point, O,P the second control point and Q,R are the final coords\n ' C ' + halfWidth + ',' + startY + ' ' + halfWidth + ',' + endY + ' ' + endX + ',' + endY;\n\n return curve;\n }", "function lerp(tlRange, tlLen, point1, point2) {\n date1 = new Date(point1);\n date2 = new Date(point2);\n return (tlLen * (date2 - date1)/tlRange);\n }", "function getCurve (svgPath, n = 50) { // parameters are a SVGjs path and number of points to be get that defaults to 50\n let curve = []\n for (let i = 1; i <= n; i++) {\n let point = svgPath.pointAt(svgPath.length() * (i / n))\n curve.push({ x: point.x, y: point.y })\n }\n return curve\n}", "static poly(n) {\n return (t) => Math.pow(t, n);\n }", "function triArea(base, height) {\n return (base * height) / 2;\n}", "function triArea(base, height) {\n return (base * height) / 2;\n}", "function computeTripledAreaOfARectangle(length, width) {\n // your code here\n var area = length * width\n return area * 3;\n}", "function curveGeometry(curve0, radius) // returning PIXI.Geometry object\n {\n // osu relative coordinate -> osu pixels\n curve = new Array();\n // filter out coinciding points\n for (let i=0; i<curve0.length; ++i)\n if (i==0 || \n Math.abs(curve0[i].x - curve0[i-1].x) > 0.00001 || \n Math.abs(curve0[i].y - curve0[i-1].y) > 0.00001)\n curve.push(curve0[i]);\n\n let vert = new Array();\n let index = new Array();\n\n vert.push(curve[0].x, curve[0].y, curve[0].t, 0.0); // first point on curve\n\n // add rectangles around each segment of curve\n for (let i = 1; i < curve.length; ++i) {\n let x = curve[i].x;\n let y = curve[i].y;\n let t = curve[i].t;\n let lx = curve[i-1].x;\n let ly = curve[i-1].y;\n let lt = curve[i-1].t;\n let dx = x - lx;\n let dy = y - ly;\n let length = Math.hypot(dx, dy);\n let ox = radius * -dy / length;\n let oy = radius * dx / length;\n\n vert.push(lx+ox, ly+oy, lt, 1.0);\n vert.push(lx-ox, ly-oy, lt, 1.0);\n vert.push(x+ox, y+oy, t, 1.0);\n vert.push(x-ox, y-oy, t, 1.0);\n vert.push(x, y, t, 0.0);\n\n let n = 5*i+1;\n // indices for 4 triangles composing 2 rectangles\n index.push(n-6, n-5, n-1, n-5, n-1, n-3);\n index.push(n-6, n-4, n-1, n-4, n-1, n-2);\n }\n\n function addArc(c, p1, p2, t) // c as center, sector from c-p1 to c-p2 counterclockwise\n {\n let theta_1 = Math.atan2(vert[4*p1+1]-vert[4*c+1], vert[4*p1]-vert[4*c])\n let theta_2 = Math.atan2(vert[4*p2+1]-vert[4*c+1], vert[4*p2]-vert[4*c])\n if (theta_1 > theta_2)\n theta_2 += 2*Math.PI;\n let theta = theta_2 - theta_1;\n let divs = Math.ceil(DIVIDES * Math.abs(theta) / (2*Math.PI));\n theta /= divs;\n let last = p1;\n for (let i=1; i<divs; ++i) {\n vert.push(vert[4*c] + radius * Math.cos(theta_1 + i * theta),\n vert[4*c+1] + radius * Math.sin(theta_1 + i * theta), t, 1.0);\n let newv = vert.length/4 - 1;\n index.push(c, last, newv);\n last = newv;\n }\n index.push(c, last, p2);\n }\n\n // add half-circle for head & tail of curve\n addArc(0,1,2, curve[0].t);\n addArc(5*curve.length-5, 5*curve.length-6, 5*curve.length-7, curve[curve.length-1].t);\n\n // add sectors for turning points of curve\n for (let i=1; i<curve.length-1; ++i) {\n let dx1 = curve[i].x - curve[i-1].x;\n let dy1 = curve[i].y - curve[i-1].y;\n let dx2 = curve[i+1].x - curve[i].x;\n let dy2 = curve[i+1].y - curve[i].y;\n let t = dx1*dy2 - dx2*dy1; // d1 x d2\n if (t > 0) { // turning counterclockwise\n addArc(5*i, 5*i-1, 5*i+2);\n }\n else { // turning clockwise or straight back\n addArc(5*i, 5*i+1, 5*i-2);\n }\n }\n return new PIXI.Geometry().addAttribute('position', vert, 4).addIndex(index)\n }", "function pizzaArea1(r){\n // radius of circle r*r*PI\n var area= Math.pow(r,2)*Math.PI;\n return area;\n}", "function curve(pts, size, skipPad) {\n \n if (pts.length > 4) {\n return spline(pts,size,skipPad);\n }\n var ts = [];\n for (var t = 0.0; t < 1; t+=1/size) {\n if (pts.length==4) {\n var bx = cubic(pts[0].x,pts[1].x,pts[2].x,pts[3]\n .x, t);\n var by = cubic(pts[0].y,pts[1].y,pts[2].y,pts[3].y, t);\n ts.push({x: bx, y: by});\n } else if(pts.length == 3) {\n var bx = quad(pts[0].x,pts[1].x,pts[2].x, t);\n var by = quad(pts[0].y,pts[1].y,pts[2].y, t);\n ts.push({x: bx, y: by});\n }\n }\n return ts;\n}", "function forLength(func, value, iterations) {\n return forValue(\n function() {\n return func()\n .then(function(result) {\n return result.length\n })\n },\n value, iterations);\n }", "function shapeArea(n) {\n // Start with a base case. shapeArea(1) is supposed to equal 1\n // So this is a good starting point\n let start = 1;\n // From here, we can run a loop to solve for the current n and add the results\n // of n-1 until we get to the base case\n while (n > 1) {\n start += 4 * --n;\n }\n return start;\n}", "function drawCurve(fn, steps) {\n noFill();\n stroke(0, 150);\n beginShape();\n for(var i = 0; i <= steps; i++) {\n // normalize i to the range (0, 1)\n var t = norm(i, 0, steps);\n // compute function\n var pt = fn(t);\n vertex(pt.x, pt.y);\n }\n endShape();\n}", "function circleArea(r, width) {\n return r * r * Math.acos(1 - width/r) - (r - width) * Math.sqrt(width * (2 * r - width));\n}", "function opp_cong(njd,np){\n\n // by Salvatore Ruiu Irgoli-Sardegna (Italy) maggio 2012.\n // funzione per il calcolo delle opposizioni/congiunzioni.\n // njd=numero del giorno giuliano.\n // np=numero identificativo pianeta.\n \n var x=100; // valore iniziale per le iterazioni\n \n var periodo= new Array(0.24085000, 0.6152100, 1.000040, 1.8808900, 11.8622400, 29.457710, 84.0124700, 164.7955800, 250.90000);\n\n // calcola il periodo sinodico del pianeta in giorni.\n \n var ps=Math.abs(periodo[2]*periodo[np]/(periodo[2]-periodo[np])); \n ps=ps*365.25636; // periodo sinodico in giorni.\n\n// ********************* PRIMA VERIFICA ************************** - INIZIO \n\n var le=pos_pianeti(njd,np); // trova le longitudini eliocentriche della Terra e del pianeta (np).\n var LT=gradi_360(le[7]+180); // longitudine eliocentrica della Terra.\n var LP=gradi_360(le[9]); // longitudine eliocentrica del pianeta (np).\n \n var delta_L1= Math.abs(LP-LT);\n var delta_L2= 360-Math.abs(LP-LT);\n \n// ******************************************************************* PER I PIANETI ESTERNI. \n\n if(LP>LT && periodo[np]>periodo[2]) { x=(delta_L1/360)*ps; }\n\n else if(LP<LT && periodo[np]>periodo[2]) { x=(delta_L2/360)*ps; }\n\n\n// ******************************************************************* PER I PIANETI INTERNI. \n\n if(LP>LT && periodo[np]<periodo[2]) { x=(delta_L2/360)*ps; }\n\n else if(LP<LT && periodo[np]<periodo[2]) { x=(delta_L1/360)*ps; }\n\n\n// ******************************************************************************************\n\n njd=njd+x; \n\n// inizia il ciclo delle iterazioni.\n\n while (Math.abs(x)>0.00001){\n\n le=pos_pianeti(njd,np); // trova le longitudini eliocentriche della terra e del pianeta (np). \n LT=gradi_360(le[7]+180); // longitudine eliocentrica della Terra.\n LP=gradi_360(le[9]); // longitudine eliocentrica del pianeta (np).\n\n // per i pianeti esterni.\n\n if (periodo[np]>periodo[2]){ x=((LP-LT)/360)*ps;} \n\n // per i pianeti interni.\n\n if (periodo[np]<periodo[2]){ x=((LT-LP)/360)*ps;} \n\n njd=njd+x; // giorno giuliano dell'evento.\n}\n\n // fine il ciclo di iterazioni.\n\n var dati=new Array (njd,LT,LP,ps); // risultati\n\nreturn dati;\n\n}", "length () {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }", "length () {\n return Math.sqrt(this.x * this.x + this.y * this.y);\n }", "function draw_adjusted_sin_fn(){\n\n\tvar x_increments = parseFloat(document.getElementById('x_inc').value)\n\tvar y_increments = parseFloat(document.getElementById('y_inc').value)\n\tvar min = parseFloat(-1)*25*x_increments; // Minimum x\n\tvar max = 25*x_increments; // Maximum x\n\tvar xstep = 0.1; // How smooth the curve should be\n\tvar trig_a = document.getElementById('trig_a').value\n\tvar trig_b = document.getElementById('trig_b').value\n\n// ctx is the context object\n\n\tfor (var x = min; x < max; x = x + xstep) {\n \tvar y = trig_a*Math.sin(trig_b*x)\n \tif (x == min) {\n \t\tctx.moveTo((x/x_increments)*20+parseFloat(WIDTH/2), HEIGHT/2 - (y/y_increments)*20); // First point\n \t}\n\n\t\telse {\n \t\tctx.lineTo((x/x_increments)*20+parseFloat(WIDTH/2), HEIGHT/2 - (y/y_increments)*20); // Subsequent points\n \t}\n\n\t}\n\n\tctx.stroke();\n\n}", "function calcArea(r) {\r\n area = (Math.PI * Math.pow(r, 2));\r\n console.log(\"The Area Is: \" + Math.round(area)); \r\n}", "function circleArea(r, width) {\n\t return r * r * Math.acos(1 - width / r) - (r - width) * Math.sqrt(width * (2 * r - width));\n\t}", "function makeTriangle(pts, step) {\n var ax = pts[0][0];\n var ay = pts[0][1];\n var bx = pts[1][0];\n var by = pts[1][1];\n var cx = pts[2][0];\n var cy = pts[2][1];\n\n // Get AC line length\n var a_dx = cx - ax,\n a_dy = cy - ay;\n var ac_len = Math.sqrt(a_dx * a_dx + a_dy * a_dy);\n // Get BC line length\n var b_dx = cx - bx,\n b_dy = cy - by;\n bc_len = Math.sqrt(b_dx * b_dx + b_dy * b_dy);\n\n // Whichever line is shortest will determine the number of steps\n var len = (ac_len < bc_len) ? ac_len : bc_len;\n\n // ac step amounts\n a_dx = step * a_dx / len;\n a_dy = step * a_dy / len;\n\n // bc step amounts\n b_dx = step * b_dx / len;\n b_dy = step * b_dy / len;\n\n var poly = [];\n // first two points\n poly.push(ax);\n poly.push(ay);\n poly.push(bx);\n poly.push(by);\n while (len > step) {\n // step along the ac and bc lines\n ax += a_dx;\n ay += a_dy;\n bx += b_dx;\n by += b_dy;\n // add the line going from the bc line to the ac line\n poly.push(bx);\n poly.push(by);\n poly.push(ax);\n poly.push(ay);\n len -= step;\n if (len < step) break;\n // step again\n ax += a_dx;\n ay += a_dy;\n bx += b_dx;\n by += b_dy;\n // add line going back again\n poly.push(ax);\n poly.push(ay);\n poly.push(bx);\n poly.push(by);\n len -= step;\n }\n poly.push(cx);\n poly.push(cy);\n\n var tri = document.createElementNS(\"http://www.w3.org/2000/svg\", \"polyline\");\n tri.setAttribute(\"fill\", \"none\");\n tri.setAttribute(\"stroke\", \"black\");\n tri.setAttribute(\"stroke-width\", 0.5);\n tri.setAttribute(\"points\", poly.join(\",\"));\n return tri;\n}", "function interpolateEnding({t, polyline, decreasing, rightToLeft}) {\n\n var reverse = Boolean(decreasing) !== Boolean(rightToLeft);\n\n var result = (function getLinePiece(t, line) {\n var q = 0;\n if (t > 0) {\n var distance = [0];\n var totalDistance = 0;\n for (var i = 1, x, y, x0, y0, d; i < line.length; i++) {\n x0 = line[i - 1].x;\n y0 = line[i - 1].y;\n x = line[i].x;\n y = line[i].y;\n d = Math.sqrt((x - x0) * (x - x0) + (y - y0) * (y - y0));\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 (line.length - 1)\n );\n break;\n }\n }\n }\n\n var existingCount = Math.floor((line.length - 1) * q) + 1;\n var tempCount = line.length - existingCount;\n var tempStartIdIndex = existingCount;\n var result = line.slice(0, existingCount);\n if (q < 1) {\n var qi = (q * (line.length - 1)) % 1;\n var midPt = interpolatePoint(\n line[existingCount - 1],\n line[existingCount],\n qi\n );\n push(result, utils.range(tempCount).map((i) => Object.assign(\n {}, midPt,\n {\n id: line[tempStartIdIndex + i].id,\n isInterpolated: true\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}", "getPathLength(lat1, lng1, lat2, lng2) {\n var lat1rads, lat2rads, deltaLat, lat2rads, deltaLng,\n a, c, dist_metre, R;\n\n // Avoid to return NAN, if finding distance between same lat long.\n if (lat1 == lat2 && lng1 == lng2) {\n return 0;\n }\n\n //Earth Radius (in metre)\n R = 6371000\n\n lat1rads = this.degreesToRadians(lat1)\n lat2rads = this.degreesToRadians(lat2)\n deltaLat = this.degreesToRadians((lat2 - lat1))\n deltaLng = this.degreesToRadians((lng2 - lng1))\n\n a = Math.sin(deltaLat / 2) * Math.sin(deltaLat / 2) +\n Math.cos(lat1rads) * Math.cos(lat2rads) * Math.sin(deltaLng / 2) * Math.sin(deltaLng / 2)\n c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))\n\n dist_metre = R * c;\n\n if (isNaN(dist_metre)) {\n return 0;\n }\n\n return dist_metre\n }", "function solution(a, b){\n const isPower = (n) => {\n let arr = [];\n let f = Math.floor(Math.sqrt(n));\n for (let i = 2; i < 100 && i <= f; i++){\n if (n % i == 0){\n let g = Math.log(n)/Math.log(i);\n if (Math.abs(g - Math.floor(g)) <= 0.0000000001){\n arr.push(Math.floor(g));\n }\n }\n }\n\n return arr;\n };\n\n let count = (a - 1) * (b - 1);\n\n for (let i = 2; i <= a; i++){\n let g = isPower(i);\n if (g.length){\n for (let j in g){\n let h = Math.floor((b)/(g[j]));\n let f = h - 1;\n if (h == b/g[j] && g[j] & 1) f--;\n count -= f;\n }\n }\n }\n\n return count;\n}", "function length(v) {\n return Object(__WEBPACK_IMPORTED_MODULE_0__math__[\"B\" /* sqrt */])(v[0] * v[0] + v[1] * v[1]);\n}", "function length(v) {\n return Object(__WEBPACK_IMPORTED_MODULE_0__math__[\"B\" /* sqrt */])(v[0] * v[0] + v[1] * v[1]);\n}", "function circleArea(r, width) {\n return r * r * Math.acos(1 - width / r) - (r - width) * Math.sqrt(width * (2 * r - width));\n }", "function polarTriangleArea(tan1, lng1, tan2, lng2) {\n\n var deltaLng = lng1 - lng2;\n var t = tan1 * tan2;\n return 2 * Math.atan2(t * Math.sin(deltaLng), 1 + t * Math.cos(deltaLng));\n}", "function triArea(base, height) {\n var triangle = base * height / 2\n return triangle\n}", "function mathCurveToSvgCurve(ptArray, coordFunc, curveWidth, color) {\n if (ptArray.length == 2) {\n const { x: x1, y: y1 } = coordFunc({ x: ptArray[0][0], y: ptArray[0][1] });\n const { x: x2, y: y2 } = coordFunc({ x: ptArray[1][0], y: ptArray[1][1] });\n\n return (\n <line\n x1={`${x1}`}\n x2={`${x2}`}\n y1={`${y1}`}\n y2={`${y2}`}\n fill='none'\n stroke={`${color}`}\n strokeWidth={`${curveWidth}`}\n key={`l${ptArray[0][0]},${ptArray[0][1]}`}\n />\n );\n }\n\n const newPtArray = ptArray.map(([x, y]) => [coordFunc({ x, y }).x, coordFunc({ x, y }).y]);\n\n let d = `M${newPtArray[0][0]} ${newPtArray[0][1]}`;\n let i = 1;\n while (i + 2 < newPtArray.length) {\n d += ` C${newPtArray[i][0]} ${newPtArray[i][1]},`;\n d += `${newPtArray[i + 1][0]} ${newPtArray[i + 1][1]},`;\n d += `${newPtArray[i + 2][0]} ${newPtArray[i + 2][1]}`;\n i += 3;\n }\n\n return (\n <path\n d={d}\n fill='none'\n stroke={`${color}`}\n strokeWidth={`${curveWidth}`}\n key={`c${ptArray}`}\n />\n );\n}", "function draw_adjusted_cos_fn(){\n\n\tvar x_increments = parseFloat(document.getElementById('x_inc').value)\n\tvar y_increments = parseFloat(document.getElementById('y_inc').value)\n\tvar min = parseFloat(-1)*25*x_increments; // Minimum x\n\tvar max = 25*x_increments; // Maximum x\n\tvar xstep = 0.1; // How smooth the curve should be\n\tvar trig_a = document.getElementById('trig_a').value\n\tvar trig_b = document.getElementById('trig_b').value\n\n// ctx is the context object\n\n\t\tfor (var x = min; x < max; x = x + xstep) {\n\t\t var y = trig_a*Math.cos(trig_b*x)\n\t\t if (x == min) {\n\t\t \tctx.moveTo((x/x_increments)*20+parseFloat(WIDTH/2), HEIGHT/2 - (y/y_increments)*20); // First point\n\t\t }\n\t\t\telse {\n\t\t \tctx.lineTo((x/x_increments)*20+parseFloat(WIDTH/2), HEIGHT/2 - (y/y_increments)*20); // Subsequent points\n\t\t }\n\t\t}\n\n\tctx.stroke();\n}", "function lp(p, radius_) {\n if(p === Number.POSITIVE_INFINITY) {\n return moore(radius_);\n }\n var result = []\n , radius = Math.ceil(radius_)|0\n , rp = Math.pow(radius_, p);\n for(var i=-radius; i<=radius; ++i) {\n for(var j=-radius; j<=radius; ++j) {\n for(var k=-radius; k<=radius; ++k) {\n if(Math.pow(Math.abs(i), p) + Math.pow(Math.abs(j), p) + Math.pow(Math.abs(k), p) <= rp) {\n result.push(i);\n result.push(j);\n result.push(k);\n }\n }\n }\n }\n return result;\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 pathToPolygonViaSubdivision(path,threshold,segments){\n if (!threshold) threshold = 0.0001; // Get really, really close\n if (!segments) segments = 3; // 2 segments creates 0-area triangles\n\n var points = subdivide( ptWithLength(0), ptWithLength( path.node().getTotalLength() ) );\n for (var i=points.length;i--;) points[i] = [points[i].x,points[i].y];\n\n var poly = document.createElementNS('http://www.w3.org/2000/svg','polygon');\n poly.setAttribute('points',points.join(' '));\n return poly;\n\n // Record the distance along the path with the point for later reference\n function ptWithLength(d) {\n var pt = path.node().getPointAtLength(d); pt.d = d; return pt;\n }\n\n // Create segments evenly spaced between two points on the path.\n // If the area of the result is less than the threshold return the endpoints.\n // Otherwise, keep the intermediary points and subdivide each consecutive pair.\n 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 }\n\n // Calculate the area of an polygon represented by an array of points\n function polyArea(points){\n var p1,p2;\n for(var area=0,len=points.length,i=0;i<len;++i){\n p1 = points[i];\n p2 = points[(i-1+len)%len]; // Previous point, with wraparound\n area += (p2.x+p1.x) * (p2.y-p1.y);\n }\n return Math.abs(area/2);\n }\n}", "function findPerimeter(length, width) {\n\tvar p = 2 * length + 2 * width\n return p\n}", "function areaCalculator(length, width) {\n let area = length * width;\n return area;\n}", "function calculate_area(start, end, fx) \n{\n if (arguments.length < 3) \n {\n throw ('please provide start, end, and function for integration.');\n }\n\n fx = y(fx);\n let sample_number = 10 * thousand;\n let xrange = end - start;\n let max = fx(end);\n let generator = mc.d2(start, xrange, zero, max);\n let estimator_function = check_inside(fx);\n let area_of_square = (end - start) * max;\n return mc.run(sample_number, generator, estimator_function) * area_of_square;\n}", "function arcToBeziers(angleStart, angleExtent) {\n var numSegments = Math.ceil(Math.abs(angleExtent) / 90.0);\n\n var angleIncrement = (angleExtent / numSegments);\n\n // The length of each control point vector is given by the following formula.\n var controlLength = 4.0 / 3.0 * Math.sin(angleIncrement / 2.0) / (1.0 + Math.cos(angleIncrement / 2.0));\n\n var commands = [];\n\n for (var i = 0; i < numSegments; i++) {\n var cmd = { command: 'curveTo', code: 'C' };\n var angle = angleStart + i * angleIncrement;\n // Calculate the control vector at this angle\n var dx = Math.cos(angle);\n var dy = Math.sin(angle);\n // First control point\n cmd.x1 = (dx - controlLength * dy);\n cmd.y1 = (dy + controlLength * dx);\n // Second control point\n angle += angleIncrement;\n dx = Math.cos(angle);\n dy = Math.sin(angle);\n cmd.x2 = (dx + controlLength * dy);\n cmd.y2 = (dy - controlLength * dx);\n // Endpoint of bezier\n cmd.x = dx;\n cmd.y = dy;\n commands.push(cmd);\n }\n return commands;\n}" ]
[ "0.6769427", "0.58905506", "0.5680087", "0.56241846", "0.5448378", "0.54405534", "0.5429641", "0.5369592", "0.53184587", "0.5288144", "0.5247235", "0.5210314", "0.5191495", "0.5182685", "0.5181171", "0.51801234", "0.5155166", "0.509476", "0.50758535", "0.5073273", "0.50525904", "0.50503427", "0.50421834", "0.5035627", "0.4988329", "0.49464884", "0.4919459", "0.49177265", "0.49122578", "0.48940995", "0.4891316", "0.48796445", "0.4852123", "0.48407227", "0.48012638", "0.47884613", "0.47781345", "0.47676566", "0.4751355", "0.4741311", "0.4741311", "0.4732012", "0.47031146", "0.469737", "0.46958506", "0.4679954", "0.4663425", "0.46599078", "0.46536815", "0.46415356", "0.4623941", "0.46205202", "0.4614849", "0.46146291", "0.45964873", "0.4595643", "0.459351", "0.45889413", "0.4583237", "0.45814246", "0.45765385", "0.4564967", "0.45585838", "0.45555475", "0.4547464", "0.45469353", "0.45454016", "0.45454016", "0.45402998", "0.45330155", "0.45258507", "0.45247763", "0.45138603", "0.45109767", "0.4508427", "0.4504691", "0.44987682", "0.44974908", "0.44974908", "0.4494575", "0.44889992", "0.44810623", "0.44760537", "0.4476039", "0.4475444", "0.4475136", "0.4472612", "0.4472612", "0.44677743", "0.4467621", "0.44676176", "0.44657645", "0.44610918", "0.44607317", "0.44588405", "0.4458047", "0.44526196", "0.44392842", "0.4435596", "0.44184336" ]
0.6514496
1
This is required to get the initial backgroundcolor of an element. The element might have it's bgcolor already set before the transition. Transition should continue/start from this color. This will be used only once.
function getElementBG(elm) { var bg = getComputedStyle(elm).backgroundColor; bg = bg.match(/\((.*)\)/)[1]; bg = bg.split(","); for (var i = 0; i < bg.length; i++) { bg[i] = parseInt(bg[i], 10); } if (bg.length > 3) { bg.pop(); } return bg; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_background_color(element) {\n\t\t\tvar rgb = $(element).css('background-color');\n\t\t\trgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n\t\t function hex(x) {return (\"0\" + parseInt(x).toString(16)).slice(-2);}\n\t\t return \"0x\" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);\n\t\t}", "function get_background_color( elem ) {\n var result = '#fff';\n \n elem.add( elem.parents() ).each(function(){\n var c = $(this).css('background-color');\n if ( c !== 'transparent' && c !== 'rgba(0, 0, 0, 0)' ) {\n result = c;\n return false;\n }\n });\n \n return result;\n }", "function bs_findBackgroundColor(elm) {\n\tif (typeof(elm) == 'string') {\n\t\telm = document.getElementById(elm);\n\t}\n\tif (typeof(elm) == 'undefined') return false;\n\tif (moz) {\n\t\ttry {\n\t\t\tvar col = document.defaultView.getComputedStyle(elm, null).getPropertyValue(\"background-color\");\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t} else {\n\t\tif (typeof(elm.currentStyle) == 'undefined') return false;\n\t\tvar col = elm.currentStyle.backgroundColor;\n\t}\n\tif ((typeof(col) != 'undefined') && (col != 'transparent') && (col != '')) {\n\t\treturn col;\n\t} else {\n\t\treturn bs_findBackgroundColor(elm.parentNode);\n\t}\n}", "get backgroundColor() { return this._backgroundColor; }", "get backgroundColor() { return this._backgroundColor; }", "function internalizeBackgroundColor() {\n var background_color = $('body').css('backgroundColor');\n $(\".tdcss-dom-example\").css('backgroundColor', background_color);\n }", "function bgColor(color) {\n $element.find('div').css(\"background-color\", color);\n }", "function extractColor(element){\n\t\tvar color;\n\t\t/**\n\t\t * Loop until we find an element with a background color and stop when we hit the body element. \n\t\t */\n\t\tdo{\n\t\t\tcolor = element.getStyle('background-color').toLowerCase();\n\t\t\tif (color != '' && color != 'transparent') break;\t\t\t\n\t\t\telement = element.up(0);\n\t\t}while(element.nodeName.toLowerCase() != 'body');\n\n\t\t/**\n\t\t * Catch Safari's way of signalling transparent\n\t\t */ \n\t\tif(color == 'rgba(0, 0, 0, 0)') return 'transparent';\t\t\n\t\treturn color;\n\t}", "function manualBackgroundColorSetter(e) {\n var bc = e.srcElement.value;\n var latestBGC = \"\";\n if (bc != \"\") {\n try {\n if (isNaN(bc)) {\n latestBGC = tooltipBackgroundColourChanger(bc);\n }\n if (LastFocusedBC != latestBGC) {\n LastFocusedBC = undefined;\n finalizedColor = zdttEditorBGColorFinder(zdttContainers.zdtt_sidepanelSwitchingComp.querySelector(\".KB_Editor_iframe\").contentDocument.body);\n lastSelectedColorOptionNode.style.borderColor = \"\";\n }\n } catch (error) {\n console.log(error);\n }\n }\n}", "get backgroundColor() {}", "function getEltBackgroundColor (elt) \n{\n if (is.nav4) return (elt.bgColor);\n else if (is.ie4up) \n {\n var colorVal = elt.style.backgroundColor;\n if (isColorName(colorVal)) return colorNameToNumber (colorVal);\n else if (typeof(colorVal) == \"string\") \n return ((\"0x\" + colorVal.substring(1)) - 0);\n else return colorVal;\n }\n else if (is.gecko) {\n var colorVal = elt.style.backgroundColor;\n \n\t if (typeof(colorVal) == \"string\")\n\t { \t\n\t\tif (isColorName(colorVal)) \t\n\t\t{\n\t\t\treturn colorNameToNumber (colorVal);\n\t\t}\n\t\telse if (colorVal.indexOf([\"rgb\"]) != -1) \n\t\t{\t\n\t\t\tvar sR,sG,sB;\n\t\t\tvar iR,iG,iB;\n\t\t\tvar i=0;\n\n\t\t\tColorString = (elt.style.backgroundColor);\n\t\t\t//ColorString = \"rgb(255,20,255)\";\n\t\t\tColorString = ColorString.slice(4,-1);\n\n\t\t\twhile(ColorString[i] != ',' && i < 20){i++;}\n\t\t\tsR = ColorString.slice(0,-(ColorString.length - i));\n\t\t\ti++;\n\t\t\tj = i;\n\t\t\twhile(ColorString[j] != ',' && j < 20){j++;}\n\t\t\tsG = ColorString.slice(i,0-(ColorString.length - j));\n\t\t\tj++;\n\t\t\tsB = ColorString.slice(j);\n\t\t\tiR = stringToNumber(sR);\n\t\t\tiG = stringToNumber(sG);\n\t\t\tiB = stringToNumber(sB);\n\t\t\tsR = iR.toString(16);if(sR.length < 2)sR = \"0\" + sR;if(sR.length < 2)sR = \"0\" + sR;\n\t\t\tsG = iG.toString(16);if(sG.length < 2)sG = \"0\" + sG;if(sG.length < 2)sG = \"0\" + sG;\n\t\t\tsB = iB.toString(16);if(sB.length < 2)sB = \"0\" + sB;if(sB.length < 2)sB = \"0\" + sB;\n\n\t\t\tsRGB = sR.toUpperCase()+sG.toUpperCase()+sB.toUpperCase();\n\t\t\treturn ((\"0x\" + sRGB)-0);\n\t\t}\n\t }\n else return colorVal;\n }\n}", "getBackgroundColor(){return this.__background.color}", "function resetColor(el) {\n el.css(\"transition\",\"\");\n el.css(\"transition\");\n el.css(\"background-color\",\"\");\n el.css(\"background-color\");\n}", "function backgroundColor() {\n if($(\"body\").css(\"backgroundColor\") === \"rgb(128, 0, 128)\") {\n \n $(\"body\").css(\"backgroundColor\", \"green\")\n\n } else {\n\n $(\"body\").css(\"backgroundColor\", \"purple\");\n\n };\n // if () {\n // } else {\n // // change to a different color\n // }\n\n var background = setTimeout(backgroundColor, 300000);\n\n }", "get backgroundColor() {\n if (!(this.fields.backgroundColor instanceof pass_color_1.PassColor))\n return undefined;\n return this.fields.backgroundColor;\n }", "get color () {\n return this.el.style.backgroundColor;\n }", "function getBackgroundColor(node, // @param Node:\r\n ancestor, // @param Boolean(= false):\r\n toRGBA) { // @param Boolean(= false):\r\n // true = return RGBAHash\r\n // false = return Array\r\n // @return Array: [HexColorString, Alpha]\r\n function isZero(color) {\r\n return color === \"transparent\" || color === \"rgba(0, 0, 0, 0)\";\r\n }\r\n var bgc = \"backgroundColor\", n = node, color = \"transparent\",\r\n doc = document;\r\n\r\n if (!ancestor) {\r\n return _ua.ie ? (n.style[bgc] || n.currentStyle[bgc])\r\n : getComputedStyle(n, null)[bgc];\r\n }\r\n while (n && n !== doc && isZero(color)) {\r\n if ((_ua.ie && n.currentStyle) || !_ua.ie) {\r\n color = _ua.ie ? n.currentStyle[bgc]\r\n : getComputedStyle(n, null)[bgc];\r\n }\r\n n = n.parentNode;\r\n }\r\n if (toRGBA) {\r\n return isZero(color) ? { r: 255, g: 255, b: 255, a: 1 }\r\n : _mm.color.parse(color, 1);\r\n }\r\n return isZero(color) ? [\"white\", 1]\r\n : _mm.color.parse(color);\r\n}", "setDefaultBackround(){\n \t$(this.element).css(\"background-color\",\"#fafafa\");\n\t}", "function gradinit() {\n let str1 = \"\";\n\n $(\".boxTp1\").each(\n function() {\n str1 = $(this).css(\"background-color\");\n $(this).css(\"background-color\", convToRGBA(str1) );\n }\n );\n}", "function fade_in_background(color, duration)\n {\n if (duration > 0)\n {\n DOM.background.style.transition =\n `background-color ${duration}s ease`;\n\n // Allow the DOM some time to update before initiating animation,\n // otherwise it may be skipped.\n setTimeout(() =>\n {\n DOM.background.style.backgroundColor = color;\n }, 50);\n }\n else\n {\n DOM.background.style.backgroundColor = color;\n }\n }", "static DefaultBackgroundColor(){return \"#FFFFFFFF\";}", "function setColor(color)\n{\n document.getElementById(color+\"ID\").addEventListener(\"click\", function(){\n document.getElementById(\"borderImageID\").style.backgroundColor = color;\n document.getElementById(\"borderImageID\").style.transitionProperty = \"background-color\";\n document.getElementById(\"borderImageID\").style.transitionDuration = \"1.5s\";\n if(document.getElementById(\"borderImageID\").style.backgroundImage !== \"\")\n {\n document.getElementById(\"borderImageID\").style.backgroundImage = \"\";\n }\n })\n}", "setBackgroundColor(valueNew){let t=e.ValueConverter.toObject(valueNew);null===t&&(t=this.getAttributeDefaultValueInternal(\"BackgroundColor\"));let r=this.__objectResolvers.get(\"backgroundColor\");r&&(r.watchDestroyer&&r.watchDestroyer(),r.resolver.destroy());let s=new e.Symbol.ObjectResolver(t);this.__objectResolvers.set(\"backgroundColor\",{resolver:s,watchCallback:this.__onResolverForBackgroundColorWatchCallback,watchDestroyer:s.watch(this.__onResolverForBackgroundColorWatchCallback)})}", "function setContentBgColor(rgbColor)\n{\n\tdocument.getElementById('scrolldiv_parentContainer').style.backgroundColor = rgbColor;\n}", "function getRandomColorIncrementValueForBackground() {\n return calcRndGenMinMax(1, 2);\n }", "function pickedBackgroundColor() {\n document.querySelector(\"body\").style.backgroundColor = pickedColor;\n}", "function xBackground(e,c,i)\r\n{\r\n if(!(e=xGetElementById(e))) return '';\r\n var bg='';\r\n if(e.style) {\r\n if(xStr(c)) {e.style.backgroundColor=c;}\r\n if(xStr(i)) {e.style.backgroundImage=(i!='')? 'url('+i+')' : null;}\r\n bg=e.style.backgroundColor;\r\n }\r\n return bg;\r\n}", "function colorFull(element) {\n let color = pickColor.val();\n $(element).css(\"background-color\",color);\n}", "function setBg(elColor){\n\tconst randomColor = Math.floor(Math.random()*16777215).toString(16);\n\telColor.style.backgroundColor = \"#\" + randomColor;\n}", "function changeCouleur(element,couleur){\n\t\t\t\t\telement.style.backgroundColor=couleur;\n\t\t\t\t}", "function bgColor () {\n if (color == 'black')\n {\n this.style.backgroundColor = 'black';\n }\n else if (color == 'rainbow')\n {\n let randomColor = Math.floor(Math.random()*16777215).toString(16);\n this.style.backgroundColor = \"#\" + randomColor;\n }\n else if (color == 'shader')\n {\n shade = this.style.opacity;\n shade = shade - 0.1;\n this.style.opacity = shade;\n }\n else if (color == 'eraser')\n {\n this.style.backgroundColor = 'white';\n this.style.opacity = 1;\n }\n}", "addBackgroundColor(){\n this.setState((previousState)=>{\n return({\n colors: [...previousState.colors, \"#ffffff\"],\n maxIndex: previousState.maxIndex+1,\n })\n });\n }", "function changebackground(element)\n{\n\tvar red = element.getAttribute(\"data-red\");\n\tvar green = element.getAttribute(\"data-green\");\n\tvar blue = element.getAttribute(\"data-blue\");\n\n\telement.style.backgroundColor = `rgb(${red},${green},${blue}`;\n\telement.setAttribute(\"data-revealed\" ,\"true\");\n\tcheckgame($(element).index());\n\t\n}", "function setBaseColor(){\n //set the default color to be the picked value\n let defaultColor = colorPicker.value;\n\n console.log(defaultColor); //for testing\n\n //style the first div in picked color\n baseColor.style.backgroundColor = defaultColor; \n}", "function getBgColorUponNewMessage() {\r\n\treturn \"6699CC\";\r\n}", "set backgroundColor(value) {}", "function bgcolor(fn){\n\t// body.style.background = \"rgb(\"+r+\",\"+g+\",\"+b+\")\"; //Single color\n\tbody.style.background=fn();\n\tif(r===225 && g<225){\n\t\tif(b!=0)b--;\n\t\telse g++;\n\t}else if(g===225 && b<225)\t{\n\t\tif(r!=0)r--;\n\t\telse b++;\n\t}else if(b===225 && r<225){\n\t\tif(g!=0)g--;\n\t\telse r++;\n\t}\n\t\t\n}", "function cC(element, color) {\r\n document.getElementById(element).style.backgroundColor = color;\r\n}", "function change_background(){\r\n\r\n for(x=0;x<6;x++){\r\n generated = hexa[color_generator()];\r\n color += generated;\r\n\r\n };\r\n body.style.backgroundColor = color;\r\n span.innerText = color;\r\n color = \"#\"; // reinitialize the value of color to '#'\r\n \r\n\r\n \r\n\r\n \r\n}", "setBackgroundColor(color) {\n\t\tthis.element.style.setProperty(\"background-color\", color, \"important\");\n\t\tthis.backgroundColor = color;\n\t}", "function ChangeBG(el) {\n prox[\"bgcolor\"] = el.value;\n}", "async function getBgColor() {\n const {view, layer} = state;\n try {\n // make sure there's a layerView, then\n var bgColor = view.whenLayerView(layer).then(\n // get and return the theme\n async () => await viewColorUtils.getBackgroundColorTheme(view).then(theme => theme));\n } catch(e) {\n console.warn(`Couldn't detect basemap color theme - tab must be in foreground. Choosing \"light.\"\\n`, e)\n bgColor = \"light\"; // set default bgColor\n }\n return bgColor;\n }", "function getBackgroundColor(i, j) {\n var number = matrix[i][j];\n\n if (number === 0) {\n return DEFAULT_TILE_BG_COLOR;\n } else {\n var index = getBaseLog(DIGIT_TWO, number) - 1;\n return tileBackgroundColor[index];\n }\n }", "function getBgColorUponFlashingStopped() {\r\n\treturn \"transparent\";\r\n}", "function changeBackgroundColor() {\n let color;\n if (img.complete) {\n color = colorThief.getColor(img, 9);\n content_wrapper[0].style.backgroundColor = `rgba(${color}, 0.94)`;\n } else {\n img.addEventListener('load', function () {\n color = colorThief.getColor(img, 9);\n content_wrapper[0].style.backgroundColor = `rgba(${color}, 0.94)`;\n let dark = color.reduce(\n (accumulated, currentValue) => accumulated + currentValue,\n 0\n );\n\n if (dark < 168) {\n content_wrapper[0].classList.add('content-light');\n } else {\n content_wrapper[0].classList.remove('content-light');\n }\n });\n }\n }", "function bgChanger() {\n var colorArr = ['red', 'blue', 'yellow', 'gold', 'pink']\n var colorIndex = Math.floor(Math.random() * 6)\n var $body = $('body')\n\n var hue = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ')';\n\n $body.css('backgroundColor', hue)\n $body.css('transition', 'all, 0.5s ease-out')\n\n}", "function returnColor(){\n document.body.style.backgroundColor = \"var(--bg-col)\";\n}", "function colorMate() {\n var colour = pickColor()\n $('body').animate({\n \"background-color\": colour\n }, 2000);\n $('html').animate({\n \"background-color\": colour\n }, 2000);\n $('html').animate({\n \"background-color\": colour\n }, 2000);\n}", "function getBackground() {\n var selectColor = [\"BlueViolet\", \"BlanchedAlmond\", \"CornflowerBlue\",\n \"DarkCyan\", \"DeepPink\", \"IndianRed\"\n ];\n var theColor = selectColor[Math.floor(Math.random() * 6)];\n document.body.style.backgroundColor = theColor;\n}", "function fillU(){\n var defaultColor = \"\";\n // Loop through all table to check which cells' background color is undefine and fill it in with color. \n for (var i =0; i < numRows; i++){\n for (var j =0; j < numCols; j++){\n defaultColor =document.getElementById(\"grid\").children[i].children[j].style.backgroundColor;\n if(defaultColor == \"\" ){\n document.getElementById(\"grid\").children[i].children[j].style.backgroundColor= colorSelected;\n }\n }\n }\n}", "getBackgroundColor() {\n switch (this.config.background) {\n case Config_1.Background.BLACK:\n return exports.BLACK_BACKGROUND;\n case Config_1.Background.AUTHENTIC:\n default:\n return exports.AUTHENTIC_BACKGROUND;\n }\n }", "function getColor() {\n const colorNode = document.getElementsByClassName(\"selected\")[0];\n rgbString = colorNode.style.backgroundColor;\n return rgbString\n .substr(4, rgbString.length - 5)\n .replace(\" \", \"\")\n .split(\",\");\n}", "function bgBoxColors() {\r\n for (let i = 0; i < document.box_colors.children.length; i++) {\r\n\r\n document.box_colors.children[i].style.backgroundColor = document.box_colors.elements[i].value;\r\n\r\n\r\n }\r\n}", "function applyBackgroundColor(getColor) {\n return function() {\n this.style.backgroundColor = getColor();\n }\n}", "function bgChange(e) {\n const rndCol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')';\n e.target.style.backgroundColor = rndCol;\n}", "getBackgroundColor( hue, layer, topLayer, hueOffset = 0 ) {\n if ( this.cfg.mode == 'transparent' ) return this.getTransparent(); //XXX: Still not sure about the 'transparent' mode\n\n let color = this._getBackgroundColorObject( hue, layer, topLayer );\n\n return this.getColorFromPalette( color.palette, color.hue, color.alpha, hueOffset );\n }", "updateInputBackground(element) {\n element.style.backgroundColor = this.hslFromHue(element.value);\n }", "function setBGColor(id, value) {\n getElm(id).style.backgroundColor = value;\n}", "function setBackground(elements) {\n elements.each(function (k, element) {\n var element = $(element);\n var parent = $(element).parent();\n\n var elementBackground = element.css(\"background-color\");\n elementBackground = (elementBackground == \"transparent\" || elementBackground == \"rgba(0, 0, 0, 0)\") ? null : elementBackground;\n\n var parentBackground = parent.css(\"background-color\");\n parentBackground = (parentBackground == \"transparent\" || parentBackground == \"rgba(0, 0, 0, 0)\") ? null : parentBackground;\n\n var background = parentBackground ? parentBackground : \"white\";\n background = elementBackground ? elementBackground : background;\n\n element.css(\"background-color\", background);\n });\n }", "setBGColor(row) {\r\n let colorObj = JSON.parse(row[\"ColorCode\"]);\r\n return hexToRgba(colorObj.color, colorObj.alpha);\r\n }", "function colorChange() {\n jumbotron.style.backgroundColor = getRandomColor();\n}", "function setAsCurrent(ele) {\n ele.style.backgroundColor = '#F1F1F1';\n}", "function bgMaterial() {\n return backgroundColor == whiteBackgroundColor ? whiteMaterial : blackMaterial;\n }", "function getColors($e){\n\tvar tmp\n\t, undef\n\t, frontcolor = $e.css('color')\n\t, backcolor\n\t, e = $e[0];\n\n\tvar toOfDOM = false;\n\twhile(e && !backcolor && !toOfDOM){\n\t\ttry{\n\t\t\ttmp = $(e).css('background-color');\n\t\t} catch (ex) {\n\t\t\ttmp = 'transparent';\n\t\t}\n\t\tif (tmp !== 'transparent' && tmp !== 'rgba(0, 0, 0, 0)'){\n\t\t\tbackcolor = tmp;\n\t\t}\n\t\ttoOfDOM = e.body;\n\t\te = e.parentNode;\n\t}\n\n\tvar rgbaregex = /rgb[a]*\\((\\d+),\\s*(\\d+),\\s*(\\d+)/ // modern browsers\n\t, hexregex = /#([AaBbCcDdEeFf\\d]{2})([AaBbCcDdEeFf\\d]{2})([AaBbCcDdEeFf\\d]{2})/ // IE 8 and less.\n\t, frontcolorcomponents;\n\n\t// Decomposing Front color into R, G, B ints\n\ttmp = undef;\n\ttmp = frontcolor.match(rgbaregex);\n\tif (tmp){\n\t\tfrontcolorcomponents = {'r':parseInt(tmp[1],10),'g':parseInt(tmp[2],10),'b':parseInt(tmp[3],10)};\n\t} else {\n\t\ttmp = frontcolor.match(hexregex);\n\t\tif (tmp) {\n\t\t\tfrontcolorcomponents = {'r':parseInt(tmp[1],16),'g':parseInt(tmp[2],16),'b':parseInt(tmp[3],16)};\n\t\t}\n\t}\n//\t\tif(!frontcolorcomponents){\n//\t\t\tfrontcolorcomponents = {'r':255,'g':255,'b':255}\n//\t\t}\n\n\tvar backcolorcomponents\n\t// Decomposing back color into R, G, B ints\n\tif(!backcolor){\n\t\t// HIghly unlikely since this means that no background styling was applied to any element from here to top of dom.\n\t\t// we'll pick up back color from front color\n\t\tif(frontcolorcomponents){\n\t\t\tif (Math.max.apply(null, [frontcolorcomponents.r, frontcolorcomponents.g, frontcolorcomponents.b]) > 127){\n\t\t\t\tbackcolorcomponents = {'r':0,'g':0,'b':0};\n\t\t\t} else {\n\t\t\t\tbackcolorcomponents = {'r':255,'g':255,'b':255};\n\t\t\t}\n\t\t} else {\n\t\t\t// arg!!! front color is in format we don't understand (hsl, named colors)\n\t\t\t// Let's just go with white background.\n\t\t\tbackcolorcomponents = {'r':255,'g':255,'b':255};\n\t\t}\n\t} else {\n\t\ttmp = undef;\n\t\ttmp = backcolor.match(rgbaregex);\n\t\tif (tmp){\n\t\t\tbackcolorcomponents = {'r':parseInt(tmp[1],10),'g':parseInt(tmp[2],10),'b':parseInt(tmp[3],10)};\n\t\t} else {\n\t\t\ttmp = backcolor.match(hexregex);\n\t\t\tif (tmp) {\n\t\t\t\tbackcolorcomponents = {'r':parseInt(tmp[1],16),'g':parseInt(tmp[2],16),'b':parseInt(tmp[3],16)};\n\t\t\t}\n\t\t}\n//\t\t\tif(!backcolorcomponents){\n//\t\t\t\tbackcolorcomponents = {'r':0,'g':0,'b':0}\n//\t\t\t}\n\t}\n\n\t// Deriving Decor color\n\t// THis is LAZY!!!! Better way would be to use HSL and adjust luminocity. However, that could be an overkill.\n\n\tvar toRGBfn = function(o){return 'rgb(' + [o.r, o.g, o.b].join(', ') + ')'}\n\t, decorcolorcomponents\n\t, frontcolorbrightness\n\t, adjusted;\n\n\tif (frontcolorcomponents && backcolorcomponents){\n\t\tvar backcolorbrightness = Math.max.apply(null, [frontcolorcomponents.r, frontcolorcomponents.g, frontcolorcomponents.b]);\n\n\t\tfrontcolorbrightness = Math.max.apply(null, [backcolorcomponents.r, backcolorcomponents.g, backcolorcomponents.b]);\n\t\tadjusted = Math.round(frontcolorbrightness + (-1 * (frontcolorbrightness - backcolorbrightness) * 0.75)); // \"dimming\" the difference between pen and back.\n\t\tdecorcolorcomponents = {'r':adjusted,'g':adjusted,'b':adjusted}; // always shade of gray\n\t} else if (frontcolorcomponents) {\n\t\tfrontcolorbrightness = Math.max.apply(null, [frontcolorcomponents.r, frontcolorcomponents.g, frontcolorcomponents.b]);\n\t\tvar polarity = +1;\n\t\tif (frontcolorbrightness > 127){\n\t\t\tpolarity = -1;\n\t\t}\n\t\t// shifting by 25% (64 points on RGB scale)\n\t\tadjusted = Math.round(frontcolorbrightness + (polarity * 96)); // \"dimming\" the pen's color by 75% to get decor color.\n\t\tdecorcolorcomponents = {'r':adjusted,'g':adjusted,'b':adjusted}; // always shade of gray\n\t} else {\n\t\tdecorcolorcomponents = {'r':191,'g':191,'b':191}; // always shade of gray\n\t}\n\n\treturn {\n\t\t'color': frontcolor\n\t\t, 'background-color': backcolorcomponents? toRGBfn(backcolorcomponents) : backcolor\n\t\t, 'decor-color': toRGBfn(decorcolorcomponents)\n\t};\n}", "function NewBackgroundColors() {\n return backgroundColors[Math.floor(Math.random() * backgroundColors.length)];\n}", "function backgroundColor() {\n return Math.floor(Math.random() * 256);\n}", "function bckgColor(){\n if (i > bgcolors.length) {i = 0; }\n document.getElementById(\"batman\").style.backgroundColor = bgcolors[i];\n i++;\n}", "getBackgroundColor(index) {\n const colors = [\"#FF5154\", \"#50C9CE\", \"#8093F1\", \"292F36\", \"CB48B7\"];\n return colors[index];\n }", "function backgroundColor(color) {\n $(\".preview\").css(\"background\", color);\n}", "function backgroundColor(div) {\n document.body.style.backgroundColor = \"pink\";\n }", "function chooseProjectColor(){\n\n const style = getComputedStyle(this);\n chosenColor = style.backgroundColor;\n \n}", "function adjustBGColor(amp) {\n\n if(amp < 0.1) {\n backgroundColor = int(map(amp, 0.0, 0.5, initialBackgroundColor, initialBackgroundColor + 20));\n } else {\n backgroundColor = int(map(amp, 0.0, 0.5, initialBackgroundColor, initialBackgroundColor + 50));\n }\n}", "function colourRandom(el){\n el.style.backgroundColor=generateRandomColour();\n}", "function changeBackground(color=this.origColor) {\n if (!color) { color = composeColor(); }\n this.origColor = color;\n document.body.style.background = makeRGB(color);\n console.log('Current background color: ', color);\n}", "function addBgColorToBtn( element, randomColor ) {\n let btnElement = element;\n const rootElementId = \"root\";\n while (btnElement.parentElement.id.toLowerCase() != rootElementId ) {\n btnElement.style.background = randomColor;\n btnElement = btnElement.parentElement;\n }\n btnElement.style.background = randomColor;\n return btnElement\n }", "function colorSelCurrent() {\r\n if(nOrU(document.getElementById(ICON_ID + currentDiv))) return;\r\n document.getElementById(ICON_ID + currentDiv).style.backgroundColor = BMDIV_BG_SEL;\r\n document.getElementById(TITLE_ID + currentDiv).style.backgroundColor = BMDIV_BG_SEL;\r\n document.getElementById(URL_ID + currentDiv).style.backgroundColor = BMDIV_BG_SEL;\r\n}", "function changeBGColor(color) {\n observeDOM(document.querySelector(\"body\"), (m) => {\n let addedNodes = [];\n let removedNodes = [];\n\n m.forEach(\n (record) =>\n record.addedNodes.length & addedNodes.push(...record.addedNodes)\n );\n\n m.forEach(\n (record) =>\n record.removedNodes.length & removedNodes.push(...record.removedNodes)\n );\n let divs = document.querySelectorAll(\"div\");\n divs.forEach((div) => {\n if (\n div.style.backgroundColor === \"rgb(47, 52, 55)\" ||\n div.style.backgroundColor === \"rgb(63, 68, 71)\" ||\n div.style.backgroundColor === \"rgb(55, 60, 63)\" ||\n div.style.backgroundColor === \"rgb(64, 68, 71)\" ||\n div.style.background === \"white\" ||\n div.style.backgroundColor === \"white\" ||\n div.style.backgroundColor === \"rgb(247, 246, 243)\" ||\n div.style.backgroundColor === \"rgb(251, 250, 249)\"\n ) {\n div.style.backgroundColor = color;\n }\n });\n });\n}", "function backchanger(){\r\n\tbody.style.background = \"linear-gradient(to right,\"+color1.value+\",\"+color2.value+\")\";\r\n\th3.textContent = body.style.background;\r\n\tconsole.log(color1.value)\r\n}", "function randomFinalColor (){\n let colorR = randomColor();\n let colorG = randomColor();\n let colorB = randomColor();\n //once red, green, and blue variables have been assigned an intensity we need to concatenate these values into the rgb combination \n let mixColor = `rgb(${colorR},${colorG},${colorB})`;\n //which is then returned directly to the background-color value in CSS\n return document.body.style.setProperty('background-color', mixColor);\n}", "function revertColorEvent(event){\n document.getElementById(`${event.target.id}`).style.backgroundColor = defaultColor\n}", "function applyBackgroundColor(element,state){\t\n\tif (state) {\n\t\telement.css(\"background\",\"#fceabb\");\n\t\telement.css(\"background\",\"-moz-linear-gradient(top, #fceabb 0%, #fccd4d 50%, #f8b500 51%, #fbdf93 100%)\");\n\t\telement.css(\"background\",\"-webkit-gradient(linear, left top, left bottom, color-stop(0%,#fceabb), color-stop(50%,#fccd4d), color-stop(51%,#f8b500), color-stop(100%,#fbdf93))\");\n\t\telement.css(\"background\",\"-webkit-linear-gradient(top, #fceabb 0%,#fccd4d 50%,#f8b500 51%,#fbdf93 100%)\");\n\t\telement.css(\"background\",\"-o-linear-gradient(top, #fceabb 0%,#fccd4d 50%,#f8b500 51%,#fbdf93 100%)\");\n\t\telement.css(\"background\",\"-ms-linear-gradient(top, #fceabb 0%,#fccd4d 50%,#f8b500 51%,#fbdf93 100%)\");\n\t\telement.css(\"background\",\"linear-gradient(to bottom, #fceabb 0%,#fccd4d 50%,#f8b500 51%,#fbdf93 100%)\");\n\t} else {\n\t\telement.css(\"background\",\"#1e5799\");\n\t\telement.css(\"background\",\"-moz-linear-gradient(top, #1e5799 0%, #2989d8 50%, #207cca 51%, #7db9e8 100%)\"); /* FF3.6+ */\n\t\telement.css(\"background\",\"-webkit-gradient(linear, left top, left bottom, color-stop(0%,#1e5799), color-stop(50%,#2989d8), color-stop(51%,#207cca), color-stop(100%,#7db9e8))\"); /* Chrome,Safari4+ */\n\t\telement.css(\"background\",\"-webkit-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%)\"); /* Chrome10+,Safari5.1+ */\n\t\telement.css(\"background\",\"-o-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%)\"); /* Opera 11.10+ */\n\t\telement.css(\"background\",\"-ms-linear-gradient(top, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%)\"); /* IE10+ */\n\t\telement.css(\"background\",\"linear-gradient(to bottom, #1e5799 0%,#2989d8 50%,#207cca 51%,#7db9e8 100%)\"); /* W3C */\n\t}\n}", "function backgroundColor () {\n let randomColor = Math.floor(Math.random()*16777215).toString(16);\n\n dispatch({\n type: 'SET_RANDOM_COLOR',\n randomColor: randomColor,\n })\n }", "function setElementBGColor(element, red, green, blue) {\n // An array containing the three primary colors\n // .join(',') adds commas between the indices\n let rgbVal = [red, green, blue].join(',');\n // the color box sends the rgb values to the background-color built-in function in the CSS file\n element.style.backgroundColor = \"rgb(\" + rgbVal + \")\";\n}", "function loadBgColor() {\n // loadBgColor run on the main front page\n // Uses the stored bgColor or white\n \"use strict\";\n // Some helpers\n var isAlpha = function (str) {\n // because security\n // https://stackoverflow.com/questions/2450641/validating-alphabetic-only-string-in-javascript\n return /^[a-zA-Z]+$/.test(str);\n };\n var isHex = function (str) {\n // because security\n // https://stackoverflow.com/questions/8027423/how-to-check-if-a-string-is-a-valid-hex-color-representation/8027444\n return /^#[0-9A-F]{6}$/.test(str);\n }\n var isMenu = function (str) {\n return /menu$/.test(str);\n }\n\n if (Storage === undefined) {\n console.log(\"browser does not support Web Storage for bgColor either..\");\n } else {\n var localbgcolor = localStorage.bgcolor;\n var isitAlpha = isAlpha(localbgcolor);\n var isitHex = isHex(localbgcolor);\n var isitMenu = isMenu(window.location.href);\n if (isitHex || isitAlpha){\n // example how to only adjust one div with id \"content\"\n\t // document.getElementById(\"content\").style.backgroundColor = localbgcolor;\n\t document.body.style.backgroundColor = localbgcolor;\n\t if (isitMenu){\n\t document.getElementById('wrapper').style.backgroundColor = localbgcolor;\n\t }\n }\n\n }\n\n}", "function getNodesBackgroundColors() {\r\n\tvar backgroundColors = [];\r\n\tfor (var i = 0; i < nodesPayload.length; i++) {\r\n\t\tbackgroundColors.push(getRandomColor());\r\n\t}\r\n\treturn backgroundColors;\r\n}", "function pickColor() {\n if (colorArray.length > 1) {\n var oldColorIndex = colorArray.indexOf(document.getElementById(\"center-tile\").style.backgroundColor);\n if (freshStart == true) {\n oldColorIndex = -1;\n }\n if (oldColorIndex > -1) {\n var oldColor = colorArray[oldColorIndex];\n colorArray.splice(oldColorIndex, 1);\n }\n var colorToReturn = colorArray[Math.floor(Math.random() * colorArray.length)];\n if (oldColorIndex > -1) {\n colorArray.push(oldColor);\n }\n return colorToReturn;\n } else {\n return colorArray[Math.floor(Math.random() * colorArray.length)];\n }\n }", "function bkcolor (input)\n{\n document.body.style.backgroundColor = input;\n}", "function changeBGColor() {\n // Gets the selected backgrounds value and assigns it to a variable\n var bgVal = getValue(bgSelect);\n\n // Removes the 2nd item in the card classList\n card.classList.remove(card.classList[1]);\n\n // Adds a background class to the card classList using the\n // bgVal variable and concatenation\n card.classList.add(bgVal + \"Background\");\n }", "function changeBackgroundColor(){\n document.body.style.backgroundColor = getRandomItem(colors);\n}", "function changeBgColor(color) {\n let element = document.getElementById(\"myPage\");\n element.style.backgroundColor=color;\n return element;\n}", "handleBackgroundColorChange(color) {\n const updatedState = { svgNeedsUpdating: true, options: this.state.options };\n updatedState.options.backgroundColor = color.hex;\n this.setState(updatedState);\n }", "function click() {\r\n /* i need to check if the current color is the last object\r\n in the array. If it is, i set the value back to 0 (the\r\n first color in the array. Otherwise, i have to increment the\r\n current color by 1. */\r\n \r\n if (presentColor == colors.length-1) presentColor = 0;\r\n else presentColor++; \r\n // here now i can set the body's style - backgroundColor to the new color. \r\n document.body.style.backgroundColor = colors[presentColor];\r\n }", "function updateBackground() {\n\n // Update the classes of all backgrounds to match the \n // states of their slides (past/present/future)\n toArray(dom.background.childNodes).forEach(function (backgroundh, h) {\n\n // Reverse past/future classes when in RTL mode\n var horizontalPast = config.rtl ? 'future' : 'past',\n horizontalFuture = config.rtl ? 'past' : 'future';\n\n backgroundh.className = 'slide-background ' + ( h < indexh ? horizontalPast : h > indexh ? horizontalFuture : 'present' );\n\n toArray(backgroundh.childNodes).forEach(function (backgroundv, v) {\n\n backgroundv.className = 'slide-background ' + ( v < indexv ? 'past' : v > indexv ? 'future' : 'present' );\n\n });\n\n });\n\n // Allow the first background to apply without transition\n setTimeout(function () {\n dom.background.classList.remove('no-transition');\n }, 1);\n\n }", "function revertColor(tag){\n document.getElementById(`${tag.id}`).style.backgroundColor = defaultColor\n}", "function plainBackground(){\n document.body.style.backgroundColor = \"#ffffff\";\n}", "function extractRGBfromString(element) {\n const rgb = element.style.backgroundColor\n var matchColors = /rgb\\((\\d{1,3}), (\\d{1,3}), (\\d{1,3})\\)/;\n var match = matchColors.exec(rgb);\n return match.slice(1)\n}", "function changecolor(item){\r\n\r\n if(item.style.backgroundColor != \"black\"){\r\n item.style.backgroundColor = \"black\";\r\n item.style.color = \"white\";\r\n }\r\n else{\r\n item.style.backgroundColor = \"white\";\r\n item.style.color = \"black\";\r\n }\r\n\r\n saveBGColor(item);\r\n\r\n}", "function invertColors() {\n var color_bkg = window.getComputedStyle(this, null).getPropertyValue(\"background-color\");\n var color = window.getComputedStyle(this, null).getPropertyValue(\"color\");\nconsole.log(\"test\");\n this.style.color = color_bkg;\n this.style.backgroundColor = color;\n this.style.borderColor = color_bkg;\n}", "function changeColor() {\n change.style.background = getRandomColor();\n}", "function cambiacolor(color){ // CON LA FUNCION MODIFICAMOS \ncaja.style.background = color;\n}" ]
[ "0.67202586", "0.66573995", "0.6308161", "0.624183", "0.624183", "0.6237227", "0.61843956", "0.6155856", "0.61313987", "0.607703", "0.60034966", "0.59706646", "0.59679496", "0.5951827", "0.59298515", "0.5918471", "0.5871218", "0.5788366", "0.57687056", "0.57489926", "0.57366353", "0.5723004", "0.56963664", "0.56742316", "0.5666725", "0.56632763", "0.5634536", "0.561806", "0.5598895", "0.5579882", "0.55619043", "0.55557215", "0.55490434", "0.55333996", "0.5519957", "0.5512919", "0.5512568", "0.5505591", "0.55052775", "0.5504715", "0.5503429", "0.55029684", "0.5500035", "0.5498122", "0.5494776", "0.5491411", "0.548607", "0.5485572", "0.5484202", "0.548282", "0.54686147", "0.5461075", "0.54591995", "0.5458922", "0.54584324", "0.54487115", "0.5444142", "0.5429948", "0.5429326", "0.54251814", "0.5417549", "0.54123116", "0.54072577", "0.5401783", "0.5398513", "0.53973097", "0.5395608", "0.5393988", "0.53898793", "0.5389092", "0.5386605", "0.5385349", "0.5376659", "0.53684866", "0.5367528", "0.53578365", "0.53557193", "0.5350198", "0.5348459", "0.5343083", "0.5334077", "0.53335226", "0.533334", "0.5328287", "0.5319464", "0.53169173", "0.5311325", "0.5310709", "0.53036565", "0.52991474", "0.52978176", "0.5294416", "0.5278796", "0.52695745", "0.5267786", "0.5259449", "0.52572584", "0.5249456", "0.5249319", "0.52465266" ]
0.5929184
15
A function to generate random numbers. Will be needed to generate random RGB value between 0255.
function random() { if (arguments.length > 2) { return 0; } switch (arguments.length) { case 0: return Math.random(); case 1: return Math.round(Math.random() * arguments[0]); case 2: var min = arguments[0]; var max = arguments[1]; return Math.round(Math.random() * (max - min) + min); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateRGB() {\n\tvar temp = Math.floor(Math.random() * 256 + 0);\t\t\t \n\treturn temp;\n}", "function randomRgb(){\n\treturn Math.floor(Math.random() * 256) + 1;\n}", "function generateRandomRGB() {\n return (Math.floor(Math.random() * 250) + 1);\n}", "function randomRGB() {\n return Math.floor(Math.random() * 256);\n}", "function randomRGB() {\n return Math.floor(Math.random() * 256);\n}", "function randomRGB() {\n return Math.floor(Math.random() * 256);\n}", "function genColorVal(){\r\n return Math.floor(Math.random() * 256);\r\n }", "function generateRandomColorValues () {\n r = Math.round(Math.random() * (256));\n g = Math.round(Math.random() * (256));\n b = Math.round(Math.random() * (256));\n}", "function randomRGB() {\n\treturn Math.floor(Math.random() * 256);\n}", "function randomRGB(){\n return Math.floor(Math.random() * 256 );\n}", "function randomRGB(){\n return Math.floor(Math.random()*256);\n}", "function random_rgb() {\n var o = Math.round, r = Math.random, s = 255;\n return 'rgb(' + o(r()*s) + ',' + o(r()*s) + ',' + o(r()*s) + ',' + 0.5 + ')';\n }", "function randomRGB(num){\n return \"rgb(\" + random255() + \", \" + random255() + \", \" + random255() + \")\"\n}", "function rgbGenerator()\r\n{\r\n\tvar r= Math.floor(Math.random()*256);\r\n\tvar g= Math.floor(Math.random()*256);\r\n\tvar b= Math.floor(Math.random()*256);\r\n\r\n\treturn \"rgb(\"+r+\", \"+g+\", \"+b+\")\" ;\r\n}", "function randomNumber() {\r\n let r = Math.floor(Math.random() * 256);\r\n let g = Math.floor(Math.random() * 256);\r\n let b = Math.floor(Math.random() * 256);\r\n return `rgb(${r},${g},${b})`;\r\n}", "function rgbGenerator(){\n\treturn \"rgb(\" + randomizer() + \", \" + randomizer() + \", \" + randomizer() + \")\";\n}", "function randomRGB() {\n // Use math.floor to generate random value btween 1-255\n return Math.floor(Math.random() * 255)\n}", "function generateRandomNumber() {\n return Math.floor(Math.random() * 255)\n}", "function randomRGB () {\n let red = randomNum()\n let green = randomNum()\n let blue = randomNum()\n return [red, green, blue]\n }", "function getRandomColorRGB() {\n return 'rgb(' + calcRndGen(255, true).toString() + \",\" + calcRndGen(255, true).toString() + \",\" + calcRndGen(255, true).toString() + ')';\n }", "function randomRGB() {\n return `rgb(${random(0, 255)},${random(0, 255)},${random(0, 255)})`;\n}", "function generateColor() {\n const ranges = [\n [150, 256],\n [0, 190],\n [0, 30]\n ];\n var g = function() {\n var range = ranges.splice(Math.floor(Math.random() * ranges.length), 1)[0];\n return Math.floor(Math.random() * (range[1] - range[0])) + range[0];\n }\n return \"rgb(\" + g() + \",\" + g() + \",\" + g() + \")\";\n }", "function generateRGB() {\n const color = chroma.random();\n return color;\n}", "function getRandomRgb() {\n var num = Math.round(0xffffff * Math.random());\n var r = num >> 16;\n var g = num >> 8 & 255;\n var b = num & 255;\n return 'rgb(' + r + ', ' + g + ', ' + b + ')';\n}", "function generateColor() {\n\tvar array = [];\n\tfor (var i = 0; i < 3; i++) {\n\t\tvar number = Math.floor(Math.random() * 256);\n\t\tarray.push(number);\n\t} \n\tvar newRgb = \"rgb(\" + array[0] + \",\" + array[1] + \",\" + array[2] + \")\";\n\treturn newRgb;\n}", "function colorGeneration () {\n\tvar rgb = []; \n\tfor (var i=0; i<3;i++){\n\t\trgb[i] = Math.floor(Math.random() * 256); // gera numeros aleatorios entre 0 e 255\n\t}\n\treturn rgb; \n}", "function randColor() {\n return Math.floor(Math.random() * 256);\n}", "function randomrgb() {\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 return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n\n}", "static random_color () {\n let r = rand_in_range(0, 256)\n let g = rand_in_range(0, 256)\n let b = rand_in_range(0, 256)\n let a = rand_in_range(0, 128)\n\n return [r, g, b, a]\n }", "function randomRGB() {\r\n let r = randomInt(0, 256);\r\n let g = randomInt(0, 256);\r\n let b = randomInt(0, 256);\r\n return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\r\n}", "function rgbRand() {\n var val1 = randRGB();\n var val2 = randRGB();\n var val3 = randRGB();\n return \"rgb(\" + val1 + \", \" + val2 + \", \" + val3 + \")\";\n}", "function getRandomRGB() {\n var red = getRandomInt(255);\n var green = getRandomInt(255);\n var blue = getRandomInt(255);\n return \"rgb(\" + red + \", \" + blue + \", \" + green + \")\";\n}", "function getRandomRGB() {\n var red = getRandomInt(255);\n var green = getRandomInt(255);\n var blue = getRandomInt(255);\n return \"rgb(\" + red + \", \" + blue + \", \" + green + \")\";\n}", "function randomColorGenerator() {\n\tvar randomColor;\n\tred = Math.floor(Math.random() * 256 );\n\tgreen = Math.floor(Math.random() * 256 );\n\tblue = Math.floor(Math.random() * 256 );\n\trandomColor = 'rgb(' + red + ',' + green + ',' + blue + ')';\n\treturn randomColor;\n}", "function randomColor(){ \n num = Math.floor(Math.random() * 255);\n return num\n}", "function randomize(){\n let rgb = [];\n for(let i = 0; i < 3; i++){\n rgb.push(Math.floor(Math.random() * 255));\n }\n return rgb;\n}", "function rgbColorGenerator() {\n let r = Math.floor(Math.random() * 255);\n let g = Math.floor(Math.random() * 255);\n let b = Math.floor(Math.random() * 255);\n\n return console.log(`rgb(${r}, ${g}, ${b})`);\n}", "function randomRGB(){\n let r = randomNum(256);\n let g = randomNum(256);\n let b = randomNum(256);\n return \"rgb(\"+r+\", \"+g+\", \"+b+\")\";\n}", "function randomColor() {\n // Generate random integer between 0 and 255\n function generateNumber() {\n return Math.floor(Math.random() * 256);\n }\n return \"rgb(\" + generateNumber() + \", \" + generateNumber() + \", \" + generateNumber() + \")\";\n}", "function generateColor() {\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 return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function randomColor () {\nreturn Math.floor (Math.random() * 256) ;\n}", "function GetRandomColor() {\r\n var r = 0,\r\n g = 0,\r\n b = 0;\r\n while (r < 100 && g < 100 && b < 100) {\r\n r = Math.floor(Math.random() * 256);\r\n g = Math.floor(Math.random() * 256);\r\n b = Math.floor(Math.random() * 256);\r\n }\r\n return \"rgb(\" + r + \",\" + g + \",\" + b + \")\";\r\n}", "function generateRandomColour(){\n var r = Math.random()*254 +1;\n var g = Math.random()*254 +1;\n var b = Math.random()*254 +1;\n\n return `rgb(${r},${g},${b})`;\n}", "function rndRGB() {\n var num1 = Math.floor(Math.random() *256);\n var num2 = Math.floor(Math.random() *256);\n var num3 = Math.floor(Math.random() *256);\n return 'rgb(' + num1 +', ' + num2 + ', ' + num3 +')';\n}", "function rand() {\r\n if(!gnt--) {\r\n prng(); gnt = 255;\r\n }\r\n return r[gnt];\r\n }", "function randomRgbaColor() {\n var o = Math.round,\n r = Math.random,\n s = 255;\n return (\n 'rgba(' +\n o(r() * s) +\n ', ' +\n o(r() * s) +\n ', ' +\n o(r() * s) +\n ', ' +\n r().toFixed(1) +\n ')'\n );\n}", "function randomRgbVal() {\n let rValue = Math.floor(Math.random() * 256);\n let gValue = Math.floor(Math.random() * 256);\n let bValue = Math.floor(Math.random() * 256);\n return `rgb(${rValue}, ${gValue}, ${bValue})`;\n}", "function randomColor (){\n\tvar color = \"rgb(\";\n\tfor(var i=0; i<2; i++){\n\t\tcolor+=\"\"+Math.floor(255-parseInt(Math.random()*10)*25.5);\n\t\tcolor+=\",\";\n\t}\n\tcolor+=\"0)\";\n\treturn color;\n}", "function randomColor(){ \n return rgbToHex(random255(),random255(),random255())\n}", "function generateColor(){\r\n\tvar i,j,k;\r\n\t i=Math.floor(Math.random()*255 + 1);\r\n\t j=Math.floor(Math.random()*255 + 1);\r\n\t k=Math.floor(Math.random()*255 + 1);\r\n\r\n\t \r\n\t return \"rgb(\" + i + \", \" + j +\", \" + k + \")\" ;\r\n}", "function getRandomRgb() { \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 return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "randomRGBValue() {\n return Math.floor((Math.random() * 128) + 128);\n }", "function gencolor() {\n len = _COLOR.length;\n rand = Math.floor(Math.random()*len); \n return _COLOR[rand];\n }", "function randomColor(){\n return `rgb(${randomInt(0,256)},${randomInt(0,256)},${randomInt(0,256)})`;\n}", "function createRandomRGB(){\n const r = Math.floor(Math.random()*256);\n const g = Math.floor(Math.random()*256);\n const b = Math.floor(Math.random()*256);\n return `rgb(${r},${g},${b})`;\n}", "function random_rgba() {\n var o = Math.round, r = Math.random, s = 255;\n return 'rgb(' + o(r() * s) + ',' + o(r() * s) + ',' + o(r() * s) + ')';\n}", "function randomColorGenerator() {\n\t\t\t\t\t\t\treturn '#'\n\t\t\t\t\t\t\t\t\t+ (Math.random().toString(16) + '0000000')\n\t\t\t\t\t\t\t\t\t\t\t.slice(2, 8);\n\t\t\t\t\t\t}", "function genRandomColors(num){\n var arr=[]\n for (var i=0; i<num; i++){\n arr.push(randomRGB());\n }\n return arr;\n}", "function newRGB() {\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 rgbValue = \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n return rgbValue;\n}", "function generateRandomColor(limit)\r\n{\r\n\tvar color=[];\r\n\tfor(var i=0;i<limit;i++)\r\n\t\tcolor.push(rgbGenerator());\r\n\treturn color;\r\n\r\n}", "function random() {\n const randomNumber = Math.round(Math.random() * 255);\n return randomNumber;\n}", "function randomRGB() {\n return {r: Math.round(Math.random() * 255),\n g: Math.round(Math.random() * 255),\n b: Math.round(Math.random() * 255)}\n }", "function randomColor() {\n var r = random(256) | 0,\n g = random(256) | 0,\n b = random(256) | 0;\n return 'rgb(' + r + ',' + g + ',' + b + ')';\n }", "function color_rand() {\n return color(random(127,255),random(127,255),random(127,255));\n}", "function randomColour() {\n\n\tfunction value() {\n\t\treturn Math.floor(Math.random() * Math.floor(255)) \n\t}\n\treturn 'rgb(' + value() + ',' + value() + ',' + value() + ')';\n}", "function randomColor(){\n\tval = Math.floor(Math.random()*255);\n\treturn val;\n}", "function randomColor() { return Array.from({ length: 3 }, () => Math.floor(Math.random() * 256)); }", "function getRandomRGB() {\n return {\n red: rangedRandomVal(31, 223),\n green: rangedRandomVal(31, 223),\n blue: rangedRandomVal(31, 223),\n };\n}", "function getRandomColor() {\n let r = 0;\n let b = 255;\n let g = 0; //Math.round(Math.random()*255);\n return \"rgb(\" + r + \",\" + g + \",\" + b + \")\";\n}", "function generateRandomColour(){\n\n var colour=[];\n\n for(var i=0;i<3;i++){\n colour.push(Math.floor(Math.random() * 255));\n }\n\n\n return `rgb(${colour[0]},${colour[1]},${colour[2]},0.8)`;\n\n\n}", "function getRandomColorIncrementValue() {\n return calcRndGenMinMax(1, 8);\n }", "function randomColor() {\n return Math.floor(Math.random() * 255);\n}", "function generateRandomColors(num){\n var arr = [];\n for(var i = 0; i<num; i++){\n arr.push(generateRGB());\n }\n function generateRGB(){\n r= Math.floor(Math.random()*256);\n g= Math.floor(Math.random()*256);\n b= Math.floor(Math.random()*256);\n return \"rgb(\"+r+\", \"+g+\", \"+b+\")\"; \n }\n return arr;\n}", "function randomColor(){\n\tvar r=Math.floor(Math.random()*256);\n\tvar g=Math.floor(Math.random()*256);\n\tvar b=Math.floor(Math.random()*256);\n\treturn \"rgb(\"+r+\", \"+g+\", \"+b+\")\";\n\n}", "function randomColor(){\n\tvar red = getRandomNumber(255);\n\tvar green = getRandomNumber(255);\n\tvar blue = getRandomNumber(255);\n\treturn \"rgb(\" + red +\", \" + green + \", \"+ blue + \")\";\n}", "function randomColor() {\n // pick a red from 0 - 255\n // need to multiply by 256 for 255 to be the greatest number possible\n var r = Math.floor(Math.random() * 256);\n // pick green from 0 - 255\n var g = Math.floor(Math.random() * 256);\n // pick a blue from 0 - 255\n var b = Math.floor(Math.random() * 256);\n // make into string\n return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function randomColorNumber(){\n // this is red color\n let red = Math.floor(Math.random() * 255) + 1;\n //this is green color\n let green = Math.floor(Math.random() * 255) + 1;\n //this is blue color\n let blue = Math.floor(Math.random() * 255) + 1;\n //it will return the RGB colors\n return `rgb(${red}, ${green}, ${blue})`;\n}", "function randomColor()\n{\n\treturn \"rgb(\" + Math.floor(Math.random()*255)+\",\"+\n\t\t\t\t Math.floor(Math.random()*255)+\",\"+\n\t\t\t\t Math.floor(Math.random()*255)+\")\";\n}", "function generateRandomColor() {\n // return '#'+Math.floor(Math.random()*16777215).toString(16);\n return myColors[Math.floor(Math.random()*myColors.length)];\n}", "function generateRandomColor() {\n var r = Math.floor(Math.random() * 256); //a random number bet. 0 - 255 for red\n var g = Math.floor(Math.random() * 256); //a random number bet. 0 - 255 for green\n var b = Math.floor(Math.random() * 256); //a random number bet. 0 - 255 for blue\n\n return \"rgb(\" + r + \", \" + g + \", \" + b + \")\" //return the string with all values inserted\n}", "function ranColor(){\n\tvar red = Math.floor(Math.random() * 256);\n\tvar green = Math.floor(Math.random() * 256);\n\tvar blue = Math.floor(Math.random() * 256);\n\t\n\treturn \"rgb(\" + red + \",\" + green + \",\" + blue + \")\";\n\n}", "function generateColors00(num){\n\tfor(i=0; i<num; i++){\n\t\tvar r = Math.floor(Math.random()*256);\n\t\tvar g = Math.floor(Math.random()*256);\n\t\tvar b = Math.floor(Math.random()*256);\n\t\tvar randomColor = \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n\t\tcolors.push(randomColor);\n\t}\n}", "function randomColor() {\n\t//pick r, g, b from 0 - 255\n\tvar r = Math.floor(Math.random() * 256);\n\tvar g = Math.floor(Math.random() * 256);\n\tvar b = Math.floor(Math.random() * 256);\n\treturn \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function getRandomColor() {\n return 'rgb(' + Math.floor(Math.random() * 256) + ',' + Math.floor(Math.random() * 256) + ',' + Math.floor(Math.random() * 256) + ')';\n}", "function randColor()\n {\n return '#'+ Math.floor(Math.random()*16777215).toString(16);\n }", "function getRandomRGB() {\n let r = Math.floor(Math.random() * Math.floor(256));\n let g = Math.floor(Math.random() * Math.floor(256));\n let b = Math.floor(Math.random() * Math.floor(256));\n return `rgb(${r}, ${g}, ${b})`;\n}", "function randomColorGen(){\n // return `#${Math.floor(Math.random()*16777215).toString(16)}`;\n return \"#\" + Math.random().toString(16).slice(2, 8)\n}", "function randomColor(){\r\n var r= Math.floor(Math.random() * 256);\r\n var g= Math.floor(Math.random() * 256);\r\n var b= Math.floor(Math.random() * 256);\r\n return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\r\n}", "function randomColor() {\n return (\n \"rgb(\" +\n Math.round(Math.random() * 250) + \",\" +\n Math.round(Math.random() * 250) + \",\" +\n Math.round(Math.random() * 250)\n + \")\"\n );\n}", "static random() {\n return new Color(random(255), random(255), random(255))\n }", "function getRandomColorDigit() {\n\treturn Math.floor(Math.random() * window.colors.length);\n}", "function randomColor(){\n return color3(Math.floor(Math.random()*256),\n Math.floor(Math.random()*256),\n Math.floor(Math.random()*256));\n}", "function generateRandomColor(num){\r\n var arr=[];\r\n for(var i=0; i< num; i++){\r\n arr.push(arrRandomColor());\r\n }\r\n return arr;\r\n}", "function randomRGB() {\n const red = Math.floor(Math.random() * 255);\n const green = Math.floor(Math.random() * 255);\n const blue = Math.floor(Math.random() * 255);\n return (`rgb(${red}, ${green}, ${blue})`);\n}", "function randomColor() {\n r = random(255);\n g = random(255);\n b = random(255);\n}", "function random(){\n\treturn Math.floor((Math.random() * 255) + 1);\n}", "function arrRandomColor(){\r\n var red = Math.floor(Math.random() * 256); // random number for red\r\n var green = Math.floor(Math.random() * 256); // random number for green\r\n var blue = Math.floor(Math.random() * 256); // random number for blue;\r\n return \"rgb(\" +red + \", \" + green+ \", \" + blue+ \")\";\r\n}", "function randColor() {\r\n var r = Math.floor(Math.random() * (256)),\r\n g = Math.floor(Math.random() * (256)),\r\n b = Math.floor(Math.random() * (256));\r\n return '#' + r.toString(16) + g.toString(16) + b.toString(16);\r\n}", "function randomColor(){\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 return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function makeRGB() {\r\n let i = 0;\r\n let rgb = getRandomNumber();\r\n //console.log(rgb);\r\n do {\r\n i = i + 1;\r\n let rgbNumber = \", \" + getRandomNumber();\r\n rgb = rgb + rgbNumber; \r\n } while (i < 2);\r\n return rgb;\r\n //console.log(rgb);\r\n }", "function randomRgb()\n{\n\tvar rgb = {\n\t\tr: 0,\n\t\tg: 0,\n\t\tb: 0\n\t};\n\t\n\tfor (var i in rgb)\n\t{\n\t\trgb[i] = Math.floor(Math.random() * 255);\n\t}\n\t\n\t$('#random').css('background-color', 'rgb(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ')');\n\t\n\treturn rgb;\n}" ]
[ "0.84629315", "0.8441063", "0.8434318", "0.8310729", "0.8310729", "0.8310729", "0.83100295", "0.8299048", "0.82989496", "0.8291947", "0.82895803", "0.82887584", "0.8250796", "0.8248388", "0.81949645", "0.8120089", "0.8116231", "0.80770665", "0.8058588", "0.8044184", "0.80412537", "0.8038887", "0.80361813", "0.8033823", "0.8014581", "0.801107", "0.7998923", "0.79941493", "0.7990086", "0.79806644", "0.7953595", "0.7947768", "0.7947768", "0.7920038", "0.79182637", "0.78979915", "0.7896003", "0.78959364", "0.7878533", "0.78723884", "0.7861686", "0.7858492", "0.78550726", "0.7854392", "0.78367674", "0.7828243", "0.78275114", "0.7820454", "0.78102726", "0.78048724", "0.78007215", "0.7799704", "0.779185", "0.77886605", "0.77768457", "0.77738476", "0.77736014", "0.7770555", "0.7746475", "0.77287865", "0.7725296", "0.771467", "0.7713037", "0.7695232", "0.7679733", "0.7679729", "0.7677597", "0.7677365", "0.76733226", "0.76705164", "0.76659065", "0.76654863", "0.76589495", "0.76570797", "0.7648214", "0.7644374", "0.76352084", "0.76333165", "0.76274276", "0.76257783", "0.76242495", "0.7618067", "0.76109195", "0.7610256", "0.76068896", "0.7606681", "0.7604621", "0.76017797", "0.7599221", "0.75986135", "0.7597926", "0.75964195", "0.7594625", "0.7586345", "0.7585119", "0.75816613", "0.7581506", "0.75731516", "0.7568382", "0.756271", "0.7556542" ]
0.0
-1
Generates a random RGB value.
function generateRGB(min, max) { var min = min || 0; var max = min || 255; var color = []; for (var i = 0; i < 3; i++) { var num = random(min, max); color.push(num); } return color; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function random_rgb() {\n var o = Math.round, r = Math.random, s = 255;\n return 'rgb(' + o(r()*s) + ',' + o(r()*s) + ',' + o(r()*s) + ',' + 0.5 + ')';\n }", "function randomRGB() {\n\treturn Math.floor(Math.random() * 256);\n}", "function randomRGB() {\n return Math.floor(Math.random() * 256);\n}", "function randomRGB() {\n return Math.floor(Math.random() * 256);\n}", "function randomRGB() {\n return Math.floor(Math.random() * 256);\n}", "function randomRGB() {\r\n let r = randomInt(0, 256);\r\n let g = randomInt(0, 256);\r\n let b = randomInt(0, 256);\r\n return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\r\n}", "function generateRandomRGB() {\n return (Math.floor(Math.random() * 250) + 1);\n}", "function genColorVal(){\r\n return Math.floor(Math.random() * 256);\r\n }", "function getRandomColorRGB() {\n return 'rgb(' + calcRndGen(255, true).toString() + \",\" + calcRndGen(255, true).toString() + \",\" + calcRndGen(255, true).toString() + ')';\n }", "function rgbGenerator()\r\n{\r\n\tvar r= Math.floor(Math.random()*256);\r\n\tvar g= Math.floor(Math.random()*256);\r\n\tvar b= Math.floor(Math.random()*256);\r\n\r\n\treturn \"rgb(\"+r+\", \"+g+\", \"+b+\")\" ;\r\n}", "function randomRgbVal() {\n let rValue = Math.floor(Math.random() * 256);\n let gValue = Math.floor(Math.random() * 256);\n let bValue = Math.floor(Math.random() * 256);\n return `rgb(${rValue}, ${gValue}, ${bValue})`;\n}", "function generateRGB() {\n const color = chroma.random();\n return color;\n}", "function randomrgb() {\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 return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n\n}", "function generateRGB() {\n\tvar temp = Math.floor(Math.random() * 256 + 0);\t\t\t \n\treturn temp;\n}", "function generateColor() {\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 return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function randomRgb(){\n\treturn Math.floor(Math.random() * 256) + 1;\n}", "function getRandomRGB() {\n var red = getRandomInt(255);\n var green = getRandomInt(255);\n var blue = getRandomInt(255);\n return \"rgb(\" + red + \", \" + blue + \", \" + green + \")\";\n}", "function getRandomRGB() {\n var red = getRandomInt(255);\n var green = getRandomInt(255);\n var blue = getRandomInt(255);\n return \"rgb(\" + red + \", \" + blue + \", \" + green + \")\";\n}", "function gencolor() {\n len = _COLOR.length;\n rand = Math.floor(Math.random()*len); \n return _COLOR[rand];\n }", "function randomRGB(){\n let r = randomNum(256);\n let g = randomNum(256);\n let b = randomNum(256);\n return \"rgb(\"+r+\", \"+g+\", \"+b+\")\";\n}", "function createRandomRGB(){\n const r = Math.floor(Math.random()*256);\n const g = Math.floor(Math.random()*256);\n const b = Math.floor(Math.random()*256);\n return `rgb(${r},${g},${b})`;\n}", "function rgbGenerator(){\n\treturn \"rgb(\" + randomizer() + \", \" + randomizer() + \", \" + randomizer() + \")\";\n}", "function getRandomRgb() {\n var num = Math.round(0xffffff * Math.random());\n var r = num >> 16;\n var g = num >> 8 & 255;\n var b = num & 255;\n return 'rgb(' + r + ', ' + g + ', ' + b + ')';\n}", "function getRandomRGB() {\n let r = Math.floor(Math.random() * Math.floor(256));\n let g = Math.floor(Math.random() * Math.floor(256));\n let b = Math.floor(Math.random() * Math.floor(256));\n return `rgb(${r}, ${g}, ${b})`;\n}", "function generateRandomColorValues () {\n r = Math.round(Math.random() * (256));\n g = Math.round(Math.random() * (256));\n b = Math.round(Math.random() * (256));\n}", "function rndRGB() {\n var num1 = Math.floor(Math.random() *256);\n var num2 = Math.floor(Math.random() *256);\n var num3 = Math.floor(Math.random() *256);\n return 'rgb(' + num1 +', ' + num2 + ', ' + num3 +')';\n}", "function newRGB() {\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 rgbValue = \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n return rgbValue;\n}", "function randomRGB() {\n return `rgb(${random(0, 255)},${random(0, 255)},${random(0, 255)})`;\n}", "function randomRGB(num){\n return \"rgb(\" + random255() + \", \" + random255() + \", \" + random255() + \")\"\n}", "function getRandomRgb() { \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 return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function rgbColorGenerator() {\n let r = Math.floor(Math.random() * 255);\n let g = Math.floor(Math.random() * 255);\n let b = Math.floor(Math.random() * 255);\n\n return console.log(`rgb(${r}, ${g}, ${b})`);\n}", "function randomColor() {\n var r = random(256) | 0,\n g = random(256) | 0,\n b = random(256) | 0;\n return 'rgb(' + r + ',' + g + ',' + b + ')';\n }", "function randomRGB(){\n return Math.floor(Math.random()*256);\n}", "function randomRGB() {\n const red = Math.floor(Math.random() * 255);\n const green = Math.floor(Math.random() * 255);\n const blue = Math.floor(Math.random() * 255);\n return (`rgb(${red}, ${green}, ${blue})`);\n}", "function randomColorGenerator() {\n\tvar randomColor;\n\tred = Math.floor(Math.random() * 256 );\n\tgreen = Math.floor(Math.random() * 256 );\n\tblue = Math.floor(Math.random() * 256 );\n\trandomColor = 'rgb(' + red + ',' + green + ',' + blue + ')';\n\treturn randomColor;\n}", "function generateRandomColour(){\n var r = Math.random()*254 +1;\n var g = Math.random()*254 +1;\n var b = Math.random()*254 +1;\n\n return `rgb(${r},${g},${b})`;\n}", "function getRandomRGB() {\n return {\n red: rangedRandomVal(31, 223),\n green: rangedRandomVal(31, 223),\n blue: rangedRandomVal(31, 223),\n };\n}", "function randomRGB(){\n return Math.floor(Math.random() * 256 );\n}", "function randomNumber() {\r\n let r = Math.floor(Math.random() * 256);\r\n let g = Math.floor(Math.random() * 256);\r\n let b = Math.floor(Math.random() * 256);\r\n return `rgb(${r},${g},${b})`;\r\n}", "function generateColor() {\n const ranges = [\n [150, 256],\n [0, 190],\n [0, 30]\n ];\n var g = function() {\n var range = ranges.splice(Math.floor(Math.random() * ranges.length), 1)[0];\n return Math.floor(Math.random() * (range[1] - range[0])) + range[0];\n }\n return \"rgb(\" + g() + \",\" + g() + \",\" + g() + \")\";\n }", "function randomRGB() {\n // Use math.floor to generate random value btween 1-255\n return Math.floor(Math.random() * 255)\n}", "function GetRandomColor() {\r\n var r = 0,\r\n g = 0,\r\n b = 0;\r\n while (r < 100 && g < 100 && b < 100) {\r\n r = Math.floor(Math.random() * 256);\r\n g = Math.floor(Math.random() * 256);\r\n b = Math.floor(Math.random() * 256);\r\n }\r\n return \"rgb(\" + r + \",\" + g + \",\" + b + \")\";\r\n}", "function randomRGB () {\n let red = randomNum()\n let green = randomNum()\n let blue = randomNum()\n return [red, green, blue]\n }", "function rgbRand() {\n var val1 = randRGB();\n var val2 = randRGB();\n var val3 = randRGB();\n return \"rgb(\" + val1 + \", \" + val2 + \", \" + val3 + \")\";\n}", "function randColor() {\n return Math.floor(Math.random() * 256);\n}", "function randomRGB() {\n return {r: Math.round(Math.random() * 255),\n g: Math.round(Math.random() * 255),\n b: Math.round(Math.random() * 255)}\n }", "function generateRandomColor() {\n const r = Math.floor(Math.random() * 256);\n const g = Math.floor(Math.random() * 256);\n const b = Math.floor(Math.random() * 256);\n return `rgb(${r}, ${g}, ${b})`;\n }", "function generateColor() {\n\tvar array = [];\n\tfor (var i = 0; i < 3; i++) {\n\t\tvar number = Math.floor(Math.random() * 256);\n\t\tarray.push(number);\n\t} \n\tvar newRgb = \"rgb(\" + array[0] + \",\" + array[1] + \",\" + array[2] + \")\";\n\treturn newRgb;\n}", "function generateColor(){\r\n\tvar i,j,k;\r\n\t i=Math.floor(Math.random()*255 + 1);\r\n\t j=Math.floor(Math.random()*255 + 1);\r\n\t k=Math.floor(Math.random()*255 + 1);\r\n\r\n\t \r\n\t return \"rgb(\" + i + \", \" + j +\", \" + k + \")\" ;\r\n}", "function randomColor() {\n // Generate random integer between 0 and 255\n function generateNumber() {\n return Math.floor(Math.random() * 256);\n }\n return \"rgb(\" + generateNumber() + \", \" + generateNumber() + \", \" + generateNumber() + \")\";\n}", "function randomColour() {\n\n\tfunction value() {\n\t\treturn Math.floor(Math.random() * Math.floor(255)) \n\t}\n\treturn 'rgb(' + value() + ',' + value() + ',' + value() + ')';\n}", "function getRandomColor() {\n let r = 0;\n let b = 255;\n let g = 0; //Math.round(Math.random()*255);\n return \"rgb(\" + r + \",\" + g + \",\" + b + \")\";\n}", "function randomColor() {\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\n return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function getRandomColor() {\r\n var rand = function() {\r\n return Math.floor(Math.random() * 256);\r\n };\r\n return `rgb(${rand()}, ${rand()}, ${rand()})`;\r\n }", "function randomRGBColour() {\n var red = Math.floor( Math.random() * 256 ),\n green = Math.floor( Math.random() * 256 ),\n blue = Math.floor( Math.random() * 256 );\n return \"rgb(\" + red + \", \" + green + \", \" + blue + \")\";\n}", "function color_rand() {\n return color(random(127,255),random(127,255),random(127,255));\n}", "static random_color () {\n let r = rand_in_range(0, 256)\n let g = rand_in_range(0, 256)\n let b = rand_in_range(0, 256)\n let a = rand_in_range(0, 128)\n\n return [r, g, b, a]\n }", "function getRandomColor() {\n return 'rgb(' + Math.floor(Math.random() * 256) + ',' + Math.floor(Math.random() * 256) + ',' + Math.floor(Math.random() * 256) + ')';\n}", "randomRGBValue() {\n return Math.floor((Math.random() * 128) + 128);\n }", "function getRandomRGBColor() {\n let randomColor = {\n r: random(255),\n g: random(255),\n b: random(255)\n }\n\n return randomColor;\n}", "function randColor() {\r\n var r = Math.floor(Math.random() * (256)),\r\n g = Math.floor(Math.random() * (256)),\r\n b = Math.floor(Math.random() * (256));\r\n return '#' + r.toString(16) + g.toString(16) + b.toString(16);\r\n}", "function randomColor() {\n\t//pick r, g, b from 0 - 255\n\tvar r = Math.floor(Math.random() * 256);\n\tvar g = Math.floor(Math.random() * 256);\n\tvar b = Math.floor(Math.random() * 256);\n\treturn \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function getRandomColor() {\n let r = getRandomInt(0, 256);\n let g = getRandomInt(0, 256);\n let b = getRandomInt(0, 256);\n return `rgb(${r},${g},${b})`;\n}", "function randomColour() {\n return new rgb(\n Math.floor(Math.random() * 255),\n Math.floor(Math.random() * 255),\n Math.floor(Math.random() * 255)\n );\n}", "function randomColor(){\r\n var r= Math.floor(Math.random() * 256);\r\n var g= Math.floor(Math.random() * 256);\r\n var b= Math.floor(Math.random() * 256);\r\n return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\r\n}", "function randomColor(){\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 return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function randomColor(){\n return `rgb(${randomInt(0,256)},${randomInt(0,256)},${randomInt(0,256)})`;\n}", "function randomColorGenerator() {\n\t\t\t\t\t\t\treturn '#'\n\t\t\t\t\t\t\t\t\t+ (Math.random().toString(16) + '0000000')\n\t\t\t\t\t\t\t\t\t\t\t.slice(2, 8);\n\t\t\t\t\t\t}", "function randomColor() {\n let red = Math.floor(Math.random() * 256);\n let green = Math.floor(Math.random() * 256);\n let blue = Math.floor(Math.random() * 256);\n let rgb = \"rgb(\" + red + \",\" + green + \",\" + blue + \")\";\n return rgb;\n}", "function randomColor(){\n\tvar red = getRandomNumber(255);\n\tvar green = getRandomNumber(255);\n\tvar blue = getRandomNumber(255);\n\treturn \"rgb(\" + red +\", \" + green + \", \"+ blue + \")\";\n}", "function ranColor(){\n\tvar red = Math.floor(Math.random() * 256);\n\tvar green = Math.floor(Math.random() * 256);\n\tvar blue = Math.floor(Math.random() * 256);\n\t\n\treturn \"rgb(\" + red + \",\" + green + \",\" + blue + \")\";\n\n}", "function randomColor() {\n r = random(255);\n g = random(255);\n b = random(255);\n}", "function randomColor(){\n\tvar r=Math.floor(Math.random()*256);\n\tvar g=Math.floor(Math.random()*256);\n\tvar b=Math.floor(Math.random()*256);\n\treturn \"rgb(\"+r+\", \"+g+\", \"+b+\")\";\n\n}", "function randomColor() {\n\n let r = Math.floor(Math.random(256) * 256);\n let g = Math.floor(Math.random(256) * 256);\n let b = Math.floor(Math.random(256) * 256);\n return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function randomColor() {\n var rColor;\n var red = Math.floor(Math.random() * 256 );\n \tvar green = Math.floor(Math.random() * 256 );\n \tvar blue = Math.floor(Math.random() * 256 );\n\n rColor = 'rgb(' + red + ',' + green + ',' + blue + ')';\n\n return rColor;\n }", "function randomColor () {\nreturn Math.floor (Math.random() * 256) ;\n}", "function generateRandomColor() {\n var r = Math.floor(Math.random() * 256); //a random number bet. 0 - 255 for red\n var g = Math.floor(Math.random() * 256); //a random number bet. 0 - 255 for green\n var b = Math.floor(Math.random() * 256); //a random number bet. 0 - 255 for blue\n\n return \"rgb(\" + r + \", \" + g + \", \" + b + \")\" //return the string with all values inserted\n}", "function randomColor() {\n // Pick red, green, and blue from 0 - 255\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 return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function randomColor() {\n // pick a red from 0 - 255\n // need to multiply by 256 for 255 to be the greatest number possible\n var r = Math.floor(Math.random() * 256);\n // pick green from 0 - 255\n var g = Math.floor(Math.random() * 256);\n // pick a blue from 0 - 255\n var b = Math.floor(Math.random() * 256);\n // make into string\n return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function generateRandomColor() {\n let r = Math.floor(Math.random() * 255);\n let g = Math.floor(Math.random() * 255);\n let b = Math.floor(Math.random() * 255);\n let color = \"rgba(\" + r + \",\" + g + \",\" + b + \",\" + 1 + \")\";\n return color;\n }", "function generateRandomColor() {\n // return '#'+Math.floor(Math.random()*16777215).toString(16);\n return myColors[Math.floor(Math.random()*myColors.length)];\n}", "function randomColor() {\r\n let red = randomNumber(0, 255)\r\n let green = randomNumber(0, 255)\r\n let blue = randomNumber(0, 255)\r\n return `rgb(${red},${green},${blue})`\r\n}", "function randomRgbaColor() {\n var o = Math.round,\n r = Math.random,\n s = 255;\n return (\n 'rgba(' +\n o(r() * s) +\n ', ' +\n o(r() * s) +\n ', ' +\n o(r() * s) +\n ', ' +\n r().toFixed(1) +\n ')'\n );\n}", "function randomColor() {\n //pick a red from 0 - 255\n var R = random(0, 255);\n //pick a green from 0 - 255\n var G = random(0, 255);\n //pick a blue from 0 - 255\n var B = random(0, 255);\n return `rgb(${R}, ${G}, ${B})`;\n}", "function randomColor()\n{\n\treturn \"rgb(\" + Math.floor(Math.random()*255)+\",\"+\n\t\t\t\t Math.floor(Math.random()*255)+\",\"+\n\t\t\t\t Math.floor(Math.random()*255)+\")\";\n}", "function getRandomColor() {\n let r = 0;\n let g = 0;\n let b = 0;\n while (r < 100 && g < 100 && b < 100) {\n r = Math.floor(Math.random() * 256);\n g = Math.floor(Math.random() * 256);\n b = Math.floor(Math.random() * 256);\n }\n return `rgba(${r},${g},${b},0.6)`;\n}", "function randColor()\n {\n return '#'+ Math.floor(Math.random()*16777215).toString(16);\n }", "function randomColor() {\n return (\n \"rgb(\" +\n Math.round(Math.random() * 250) + \",\" +\n Math.round(Math.random() * 250) + \",\" +\n Math.round(Math.random() * 250)\n + \")\"\n );\n}", "function randomColor() {\n //pick a \"red\" from 0 -255\n const r = Math.floor(Math.random() * 256);\n //pick a \"green\" from 0 -255\n const g = Math.floor(Math.random() * 256);\n //pick a \"blue\" from 0 -255\n const b = Math.floor(Math.random() * 256);\n\n return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function randomColor() {\n //pick a red from 0 to 255\n var R = Math.floor(Math.random() * 256);\n //pick a green from 0 to 255\n var G = Math.floor(Math.random() * 256);\n //pick a blue from 0 to 255\n var B = Math.floor(Math.random() * 256);\n (\"rgb(R, G, B)\");\n return \"rgb(\" + R + \", \" + G + \", \" + B + \")\";\n}", "function randomColor() {\n\t//pick a \"red\" from 0 - 255\n\tvar red = Math.floor(Math.random() * 256);\n\tvar green = Math.floor(Math.random() * 256);\n\tvar blue = Math.floor(Math.random() * 256);\n\treturn \"rgb(\" + red + \", \" + green + \", \" + blue + \")\";\n}", "function randomColor() {\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 return (`rgb(${r},${g},${b})`);\n}", "function randomColor() {\n var r = random(0, 255);\n var b = random(0, 255);\n var g = random(0, 255);\n\n\n return color(r, b, g);\n}", "function CreateColor()\n{\n\tr=Math.floor((Math.random() * 256) + 0);\n\tg=Math.floor((Math.random() * 256) + 0);\n\tb=Math.floor((Math.random() * 256) + 0);\n\treturn \"rgb(\"+r+\", \"+g+\", \"+b+\")\"\n}", "function randomColor() {\n //pick red/blue/green from 0 to 255\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 return \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function randomColor(){\n\tlet r = Math.floor(Math.random() * 256);\n\tlet g = Math.floor(Math.random() * 256);\n\tlet b = Math.floor(Math.random() * 256);\n\n\treturn \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n\n}", "function randomColor(){\n\t// pick a red from 0 to 255\n\tvar r = Math.floor(Math.random() * 255 + 1);\n\n\t// pick a green from 0 to 255\n\tvar g = Math.floor(Math.random() * 255 + 1);\n\n\t// pick a blue from 0 to 255\n\tvar b = Math.floor(Math.random() * 255 + 1);\n\treturn \"rgb(\" + r + \", \" + g + \", \" + b + \")\";\n}", "function randomColor() {\r\n let red = Math.floor(Math.random()*256);\r\n let green = Math.floor(Math.random()*256);\r\n let blue = Math.floor(Math.random()*256);\r\n\r\n return `rgb(${red}, ${green}, ${blue})`;\r\n}", "function randomColor(){\n\t//pick a \"red\" from 0 - 255\n\tvar red = Math.floor(Math.random() * 256);\n\t//pick a \"green\" from 0 - 255\n\tvar green = Math.floor(Math.random() * 256);\n\t//pick a \"blue\" from 0 - 255\n\tvar blue = Math.floor(Math.random() * 256);\n\n\treturn \"rgb(\"+ red + \", \" + green + \", \" + blue + \")\";\n}", "function random_rgba() {\n var o = Math.round, r = Math.random, s = 255;\n return 'rgb(' + o(r() * s) + ',' + o(r() * s) + ',' + o(r() * s) + ')';\n}", "function randomColor() {\n let r = Math.floor(Math.random() * 256),\n g = Math.floor(Math.random() * 256),\n b = Math.floor(Math.random() * 256);\n return `rgb(${r}, ${g}, ${b})`;\n}" ]
[ "0.85708714", "0.8509267", "0.85029066", "0.85029066", "0.85029066", "0.8496365", "0.8478096", "0.8449106", "0.8444731", "0.8441071", "0.84302837", "0.8419111", "0.841833", "0.84080756", "0.8392647", "0.83915836", "0.8388949", "0.8388949", "0.83758664", "0.8332442", "0.83256817", "0.8323038", "0.83191615", "0.8310268", "0.8307996", "0.83060724", "0.83020025", "0.82652617", "0.82469314", "0.8245673", "0.824543", "0.8208235", "0.8205316", "0.82025886", "0.8202348", "0.8201427", "0.819705", "0.8196798", "0.8194462", "0.8187186", "0.81853807", "0.817593", "0.8158332", "0.814905", "0.8137329", "0.8123272", "0.81122804", "0.8086485", "0.8078739", "0.805358", "0.80530155", "0.80390173", "0.8030088", "0.80299556", "0.8022952", "0.8022839", "0.80161846", "0.80094343", "0.7996572", "0.799547", "0.79890907", "0.798593", "0.7979905", "0.7973418", "0.79714745", "0.79573864", "0.7955456", "0.7954511", "0.794158", "0.79396206", "0.7937145", "0.7935441", "0.7932306", "0.79265916", "0.7919785", "0.7918002", "0.79170585", "0.7910052", "0.7909026", "0.79007816", "0.7886904", "0.78808963", "0.7880406", "0.7878975", "0.78766584", "0.7869533", "0.78672177", "0.78664076", "0.78651637", "0.7861869", "0.78617585", "0.7861757", "0.78596896", "0.784188", "0.7838626", "0.78361756", "0.7834478", "0.783219", "0.7830068", "0.78289014", "0.78274953" ]
0.0
-1
Calculates the distance between the RGB values. We need to know the distance between two colors so that we can calculate the increment values for R, G, and B.
function calculateDistance(colorArray1, colorArray2) { var distance = []; for (var i = 0; i < colorArray1.length; i++) { distance.push(Math.abs(colorArray1[i] - colorArray2[i])); } return distance; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "rgbDistance (r, g, b) {\n const [r1, g1, b1] = this\n const rMean = Math.round((r1 + r) / 2)\n const [dr, dg, db] = [r1 - r, g1 - g, b1 - b]\n const [dr2, dg2, db2] = [dr * dr, dg * dg, db * db]\n const distanceSq =\n (((512 + rMean) * dr2) >> 8) + (4 * dg2) + (((767 - rMean) * db2) >> 8)\n return distanceSq // Math.sqrt(distanceSq)\n }", "function colorDistance(e1, e2) {\n //console.log(\"e1e2a: \", e1, e2);\n e1 = tinycolor(e1);\n e2 = tinycolor(e2);\n //console.log(\"e1e2b: \", e1, e2);\n var rmean = (e1._r + e2._r) / 2;\n var r = e1._r - e2._r;\n var g = e1._g - e2._g;\n var b = e1._b - e2._b;\n\n return Math.sqrt((((512 + rmean) * r * r) / 256) + 4 * g * g + (((767 - rmean) * b * b) / 256));\n }", "function calcGreenDistance(px){\n var red = px.getRed();\n var green = px.getGreen();\n var blue = px.getBlue();\n var redDiff = 0 - red;\n var greenDiff = 255 - green;\n var blueDiff = 0 - blue;\n var greenDistance = Math.sqrt(redDiff * redDiff + greenDiff * greenDiff + blueDiff * blueDiff);\n return greenDistance;\n}", "function lumaDistance(r1, g1, b1, r2, g2, b2){\n const redDistance = r1 - r2;\n const greenDistance = g1 - g2;\n const blueDistance = b1 - b2;\n\n return redDistance * redDistance * 0.299 + greenDistance * greenDistance * 0.587 + blueDistance * blueDistance * 0.114;\n}", "function distanceColors(color1, color2) {\n var i,\n d = 0;\n\n for (i = 0; i < color1.length; i++) {\n d += (color1[i] - color2[i]) * (color1[i] - color2[i]);\n }\n return Math.sqrt(d);\n}", "function deltaRgb() {\n var STEPS = 60;\n var delta = {}\n for (var key in Colour) {\n delta[key] = Math.abs(Math.floor((colour[key] - nextColour[key]) / STEPS));\n if(delta[key] === 0) {\n delta[key]++;\n }\n }\n return delta;\n }", "function getColorDistance(target, actual) {\n return Math.sqrt(\n (target.r - actual.r) * (target.r - actual.r) +\n (target.g - actual.g) * (target.g - actual.g) +\n (target.b - actual.b) * (target.b - actual.b)\n );\n }", "function getColorDistance(target, actual) {\n return Math.sqrt(\n (target.r - actual.r) * (target.r - actual.r) +\n (target.g - actual.g) * (target.g - actual.g) +\n (target.b - actual.b) * (target.b - actual.b)\n );\n}", "function getColorDistance(target, actual) {\n return Math.sqrt(\n (target.r - actual.r) * (target.r - actual.r) +\n (target.g - actual.g) * (target.g - actual.g) +\n (target.b - actual.b) * (target.b - actual.b)\n );\n}", "function colorDiff(reference, pixel) {\n var r = reference[0] - pixel[0]\n var g = reference[1] - pixel[1]\n var b = reference[2] - pixel[2]\n\n return Math.abs(r) + Math.abs(g) + Math.abs(b)\n}", "function countingDistance() {\n setTimeout(function () {\n let color1 = document.querySelector(\"#RGBvalue> span\").innerHTML.split(\" \");\n let color2 = document.querySelector(\"#RGBvalue2>span\").innerHTML.split(\" \");\n color1 = color1.map((elem) => (elem = parseInt(elem)));\n color2 = color2.map((elem) => (elem = parseInt(elem)));\n console.log(226, color1, color2);\n let distance = Math.sqrt(\n (color2[0] - color1[0]) ** 2 +\n (color2[1] - color1[1]) ** 2 +\n (color2[2] - color1[2]) ** 2\n ).toFixed(1);\n // console.log(232, \"distance:\", distance);\n let putDistance = document.querySelector(\"p.fetched>span\").innerHTML;\n // console.log(234, putDistance);\n putDistance = putDistance.concat(\" [\", distance, \"]\");\n console.log(236, putDistance);\n document.querySelector(\"p.fetched>span\").innerHTML = putDistance;\n }, 150);\n}", "function rgbTargetDistance(target) {\n let dist = Math.pow(target[0] - target[1], 2) + Math.pow(target[0] - target[2], 2) + Math.pow(target[1] - target[2], 2);\n return dist;\n}", "function calculateDistance(colorArray1, colorArray2) {\n var distance = [];\n for (var i = 0; i < colorArray1.length; i++) {\n distance.push(Math.abs(colorArray1[i] - colorArray2[i]));\n }\n return distance;\n }", "function findColorDifference(dif, dest, src) {\n\t\treturn (dif * dest + (1 - dif) * src);\n\t}", "function diff(img1, img2) {\n return blend(img1, img2, function(a, b){\n var c = new Color();\n c.r = Math.abs(a.r - b.r);\n c.g = Math.abs(a.g - b.g);\n c.b = Math.abs(a.b - b.b);\n c.a = 255;\n return c;\n });\n}", "function colorStep(c1, c2, t) {\n if (t < 0) {\n t = 0;\n } else if (t > 1) {\n t = 1;\n }\n\n return {\n r: parseInt(c1['r'] + (c2['r'] - c1['r']) * t),\n g: parseInt(c1['g'] + (c2['g'] - c1['g']) * t),\n b: parseInt(c1['b'] + (c2['b'] - c1['b']) * t)\n };\n }", "function hexColorDelta(hex1, hex2) {\n // get red/green/blue int values of hex1\n var r1 = parseInt(hex1.substring(0, 2), 16);\n var g1 = parseInt(hex1.substring(2, 4), 16);\n var b1 = parseInt(hex1.substring(4, 6), 16);\n // get red/green/blue int values of hex2\n var r2 = parseInt(hex2.substring(0, 2), 16);\n var g2 = parseInt(hex2.substring(2, 4), 16);\n var b2 = parseInt(hex2.substring(4, 6), 16);\n // calculate differences between reds, greens and blues\n var r = 255 - Math.abs(r1 - r2);\n var g = 255 - Math.abs(g1 - g2);\n var b = 255 - Math.abs(b1 - b2);\n // limit differences between 0 and 1\n r /= 255;\n g /= 255;\n b /= 255;\n // 0 means opposit colors, 1 means same colors\n return (r + g + b) / 3;\n}", "calcRGB() {\r\n let h = this.h/360;\r\n let s = this.s/100;\r\n let l = this.l/100;\r\n let r, g, b;\r\n if (s == 0){\r\n r = g = b = l; // achromatic\r\n } else {\r\n let q = l < 0.5 ? l * (1 + s) : l + s - l * s;\r\n let p = 2 * l - q;\r\n r = this.hue2rgb(p, q, h + 1/3);\r\n g = this.hue2rgb(p, q, h);\r\n b = this.hue2rgb(p, q, h - 1/3);\r\n }\r\n this._r = Math.round(r * 255); \r\n this._g = Math.round(g * 255); \r\n this._b = Math.round(b * 255);\r\n }", "function calcEuclideanDistance(c1, c2) {\n\t\treturn (c1.r - c2.r) ** 2 + (c1.g - c2.g) ** 2 + (c1.b - c2.b) ** 2;\n\t}", "function calcGreenAdvantege(px){\n var red = px.getRed();\n var green = px.getGreen();\n var blue = px.getBlue();\n var secondStrongestColor;\n var diff = 0;\n if (red < green && blue < green){\n if (red >= blue){\n secondStrongestColor = red;\n }\n else{\n secondStrongestColor = blue;\n }\n diff = green - secondStrongestColor;\n }\n return diff; \n}", "calculateRatio() {\n // Get currently set colors\n let bgColor = hexRgb(this.props.bgColor)\n let fgColor = hexRgb(this.props.fgColor)\n var colors = [bgColor, fgColor];\n var lumis = [];\n var ratio;\n\n for(var i = 0; i <colors.length; i++) {\n var currColor = colors[i];\n\n // Convert RGB values of colors to sRGB\n // Then do claculations as specified in WCAG 2.0 G18\n // https://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20160317/G18#G18-tests\n for (var singleColor in currColor) {\n if (currColor.hasOwnProperty(singleColor)) {\n currColor[singleColor] = currColor[singleColor] / 255;\n\n if (currColor[singleColor] <= 0.03928) {\n currColor[singleColor] = currColor[singleColor] / 12.92;\n } else {\n currColor[singleColor] = Math.pow(((currColor[singleColor] + 0.055) / 1.055), 2.4);\n }\n }\n }\n\n // Store luminances of foreground and background color\n lumis.push((0.2126 * currColor[0] + 0.7152 * currColor[1] + 0.0722 * currColor[2]) + 0.05);\n }\n\n // Normalize luminances so that the darker one is 1\n if(lumis[0] > lumis[1]) {\n var multiplicator = 1 / lumis[1];\n lumis[0] = lumis[0] * multiplicator;\n ratio = lumis[0];\n } else {\n var multiplicator = 1 / lumis[0];\n lumis[1] = lumis[1] * multiplicator;\n ratio = lumis[1];\n }\n\n return ratio\n }", "function compareColorsNormalized(r1,g1,b1,r2,g2,b2){\n var d = Math.sqrt((r2 - r1) * (r2 - r1) + (g2 - g1) * (g2 - g1) + (b2 - b1) * (b2 - b1));\n var p = d / Math.sqrt(3 * 255 * 255);\n return 100*p;\n}", "function rgbBlockieDistance(blockie) {\n let dist = Math.pow(blockie.r - blockie.g, 2) + Math.pow(blockie.r - blockie.b, 2) + Math.pow(blockie.g - blockie.b, 2);\n return dist;\n}", "function luminanace(r, g, b) {\n var a = [r, g, b].map(function (v) {\n v /= 255;\n return v <= 0.03928 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\n });\n return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;\n} //calculate contrast between two rgb colors", "function colorDelta(img1, img2, k, m, yOnly) {\n var a1 = img1[k + 3] / 255,\n a2 = img2[m + 3] / 255,\n\n r1 = blend(img1[k + 0], a1),\n g1 = blend(img1[k + 1], a1),\n b1 = blend(img1[k + 2], a1),\n\n r2 = blend(img2[m + 0], a2),\n g2 = blend(img2[m + 1], a2),\n b2 = blend(img2[m + 2], a2),\n\n y = rgb2y(r1, g1, b1) - rgb2y(r2, g2, b2);\n\n if (yOnly) return y; // brightness difference only\n\n var i = rgb2i(r1, g1, b1) - rgb2i(r2, g2, b2),\n q = rgb2q(r1, g1, b1) - rgb2q(r2, g2, b2);\n\n return 0.5053 * y * y + 0.299 * i * i + 0.1957 * q * q;\n}", "function distanceLuma(item1, item2){\n const distR = item1[0] - item2[0];\n const distG = item1[1] - item2[1];\n const distB = item1[2] - item2[2];\n return distR * distR * 0.299 + distG * distG * 0.587 + distB * distB * 0.114;\n}", "ratioColor(fromColor, toColor, ratio) {\n // Turn string hashcode into triplet of base 10 values\n let coordify10 = function(hexCode) {\n // Strip pound sign\n if (hexCode.charAt(0) === '#') hexCode = hexCode.substring(1);\n\n return [\n parseInt(hexCode.substring(0, 2), 16),\n parseInt(hexCode.substring(2, 4), 16),\n parseInt(hexCode.substring(4, 6), 16)\n ];\n }\n\n // Turn coordinates back into hex code\n let hexify = function(coordinates) {\n return _.reduce(coordinates, (hexCode, coordinate) => {\n let code = coordinate.toString(16)\n if (code.length < 2) code = '0' + code;\n return hexCode + code;\n }, '#')\n }\n\n let ri = function(from, to, ratio) {\n return Math.round(((to - from) * ratio) + from)\n }\n\n let hexFrom = coordify10(fromColor);\n let hexTo = coordify10(toColor);\n\n let red = ri(hexFrom[0], hexTo[0], ratio)\n let green = ri(hexFrom[1], hexTo[1], ratio)\n let blue = ri(hexFrom[2], hexTo[2], ratio)\n\n return hexify([red, green, blue])\n }", "function searchColors(r, g, b) {\n var nearestColor = -1;\n var distance = 10000000;\n for (var i = 0; i < 100; i++) {\n\tvar color = getcolor(i);\n var r1 = parseInt(color[2].substr(1, 2), 16);\n var g1 = parseInt(color[2].substr(3, 2), 16);\n var b1 = parseInt(color[2].substr(5, 2), 16);\n\tvar distSquared = (r1 - r) * (r1 - r) + (g1 - g) * (g1 - g) + (b1 - b) * (b1 - b);\n\tif (distSquared < distance) {\n\t distance = distSquared;\n\t nearestColor = i;\n\t}\n }\n return nearestColor;\n}", "function computeLabDistances(ramp) {\n var distances = [0];\n for (var i = 0; i < ramp.colors.length - 1; i++) {\n var c1 = d3.lab(ramp.colors[i]);\n var c2 = d3.lab(ramp.colors[i+1]);\n distances.push(Math.sqrt((c1.l - c2.l)*(c1.l - c2.l) + (c1.a - c2.a)*(c1.a - c2.a) + (c1.b - c2.b)*(c1.b - c2.b)));\n }\n\n return distances;\n}", "function getpixelamount(r, g, b) {\r\n var pixels = ctx.getImageData(0, 0, canvas.width, canvas.height);\r\n var all = pixels.data.length;\r\n var amount = 0;\r\n for (i = 0; i < all; i += 4) {\r\n if (pixels.data[i] === r &&\r\n pixels.data[i + 1] === g &&\r\n pixels.data[i + 2] === b) {\r\n amount++;\r\n }\r\n }\r\n return amount;\r\n }", "function similarColors(rgb1, rgb2, tolerance) {\n var r = Math.abs(rgb1[0] - rgb2[0]) < tolerance,\n g = Math.abs(rgb1[1] - rgb2[1]) < tolerance,\n b = Math.abs(rgb1[2] - rgb2[2]) < tolerance;\n return (r && g && b);\n}", "getColorFromDistanceFromNearestCircle(distance) {\n if (distance <= 0) {\n return [0, 0, 0, 255];\n }\n else if (distance <= this.cutOff && this.cutOff > 0.00001) { // Interpolate from black to red.\n const val = Math.max(Math.min(Math.round(255*distance/this.cutOff), 255), 0);\n return [val, 0, 0, 255];\n }\n else { // Interpolate from red to blue.\n const val = Math.max(Math.min(Math.round(255*(distance-this.cutOff)/(this.maximumDistance-this.cutOff)), 255), 0);\n return [255-val, 0, val, 255];\n }\n }", "function getContrastRatio(color1, color2) {\n // Formula defined by: http://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html#contrast-ratiodef\n // relative luminance: http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef\n /* calculate the intermediate value needed to calculating relative luminance */\n function _getThing(x) {\n if (x <= 0.03928) {\n return x / 12.92;\n }\n else {\n return Math.pow((x + 0.055) / 1.055, 2.4);\n }\n }\n var r1 = _getThing(color1.r / _consts__WEBPACK_IMPORTED_MODULE_0__.MAX_COLOR_RGB);\n var g1 = _getThing(color1.g / _consts__WEBPACK_IMPORTED_MODULE_0__.MAX_COLOR_RGB);\n var b1 = _getThing(color1.b / _consts__WEBPACK_IMPORTED_MODULE_0__.MAX_COLOR_RGB);\n var L1 = 0.2126 * r1 + 0.7152 * g1 + 0.0722 * b1; // relative luminance of first color\n L1 += 0.05;\n var r2 = _getThing(color2.r / _consts__WEBPACK_IMPORTED_MODULE_0__.MAX_COLOR_RGB);\n var g2 = _getThing(color2.g / _consts__WEBPACK_IMPORTED_MODULE_0__.MAX_COLOR_RGB);\n var b2 = _getThing(color2.b / _consts__WEBPACK_IMPORTED_MODULE_0__.MAX_COLOR_RGB);\n var L2 = 0.2126 * r2 + 0.7152 * g2 + 0.0722 * b2; // relative luminance of second color\n L2 += 0.05;\n // return the lighter color divided by darker\n return L1 / L2 > 1 ? L1 / L2 : L2 / L1;\n}", "function colorMagnitude(color) {\n var r = (color & 0xFF0000) >>> 16;\n var g = (color & 0x00FF00) >>> 8;\n var b = (color & 0x0000FF);\n return (r+g+b) / (3*0xFF);\n}", "function calcColor(c) {\n c = tinycolor(c);\n var diff = Number.MAX_VALUE;\n var tDiff, closest, obj, key, tint, anRGB;\n for (key in mdColors.md) {\n if (mdColors.md.hasOwnProperty(key)) {\n obj = mdColors.md[key];\n for (tint in obj) {\n if (obj.hasOwnProperty(tint)) {\n // need to fix this ... always searches all mdColors...\n if (mdm.checked == true && tint.substr(0, 4) == \"P500\") {\n anRGB = tinycolor(obj[tint]);\n }\n else if (mdm.checked == false /*&& tint.substr(0, 1) == \"A\" */ ) {\n anRGB = tinycolor(obj[tint]);\n }\n else {\n continue;\n }\n // unweighted rgb...\n //tDiff = Math.sqrt(Math.pow(((clr.r - anRGB[\"r\"])), 2) + Math.pow(((clr.g - anRGB[\"g\"])), 2) + Math.pow(((clr.b - anRGB[\"b\"])), 2));\n // weighted rgb...\n //tDiff = Math.sqrt(Math.pow(((clr.r - anRGB[\"r\"])), 2) * 3 + Math.pow(((clr.g - anRGB[\"g\"])), 2) * 4 + Math.pow(((clr.b - anRGB[\"b\"])), 2) * 2);\n // special calc...\n tDiff = colorDistance(c, anRGB);\n //console.log(\"tdiff: \", tDiff);\n if (tDiff < diff) {\n diff = tDiff;\n closest = [anRGB, key, tint];\n //console.log(\"closest: \", closest);\n }\n }\n }\n }\n }\n // tinycolor, keyColor, tinkColor, izeLabel...\n return ([closest[0], closest[1] + \" (\" + closest[2] + \") materializecss: \" + closest[1].toLowerCase() + \" \" + mdColors.ize[closest[2]]]);\n }", "function calculateRGB(){\n\n // check whether the saturation is zero\n if (hsl.s == 0){\n\n // store the RGB components representing the appropriate shade of grey\n rgb =\n {\n 'r' : hsl.l * 2.55,\n 'g' : hsl.l * 2.55,\n 'b' : hsl.l * 2.55\n };\n\n }else{\n\n // set some temporary values\n var p = hsl.l < 50\n ? hsl.l * (1 + hsl.s / 100)\n : hsl.l + hsl.s - hsl.l * hsl.s / 100;\n var q = 2 * hsl.l - p;\n\n // initialise the RGB components\n rgb =\n {\n 'r' : (h + 120) / 60 % 6,\n 'g' : h / 60,\n 'b' : (h + 240) / 60 % 6\n };\n\n // loop over the RGB components\n for (var key in rgb){\n\n // ensure that the property is not inherited from the root object\n if (rgb.hasOwnProperty(key)){\n\n // set the component to its value in the range [0,100]\n if (rgb[key] < 1){\n rgb[key] = q + (p - q) * rgb[key];\n }else if (rgb[key] < 3){\n rgb[key] = p;\n }else if (rgb[key] < 4){\n rgb[key] = q + (p - q) * (4 - rgb[key]);\n }else{\n rgb[key] = q;\n }\n\n // set the component to its value in the range [0,255]\n rgb[key] *= 2.55;\n\n }\n\n }\n\n }\n\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 hex_distance(x1, z1, x2, z2) {\n\t// Convert to cube-coordinates first.\n\t// Derive the missing coordinate.\n y1 = -x1 - z1;\n y2 = -x2 - z2;\n return (Math.abs(x1 - x2) + Math.abs(y1 - y2) + Math.abs(z1 - z2)) / 2;\n}", "step() {\n this.currentColor += (this.redComponentRatio * (this.redDiff / this.steps)) & RED;\n this.currentColor += (this.greenComponentRatio * (this.greenDiff / this.steps)) & GREEN;\n this.currentColor += (this.blueComponentRatio * (this.blueDiff / this.steps)) & BLUE;\n return Math.floor(this.currentColor);\n }", "function colorTracker(arg){\n\tcapture.loadPixels();\n\n\tlet colLoc = [0,0];\n\tlet colDist = 600;\n\n\t for(let bY =0; bY < capture.height; bY++){\n\t \tfor(let bX=0;bX<capture.width;bX++){\n\t \t\tlet index = 4 * bX +(bY * capture.width);\n\t \t\t\n\t \t\tlet r = capture.pixels[index];\n\t \t\tlet g = capture.pixels[index + 1];\n\t \t\tlet b = capture.pixels[index + 2];\n\n\t \t\tlet newDist = dist(r,g,b,arg[0],arg[1],arg[2]);\n\t \t\tif(newDist<colDist){\n\t \t\t\tcolDist = newDist;\n\t \t\t\tcolLoc = [bX,bY];\n\t \t\t}\n\t \t}\n \t}\n return colLoc;\n}", "function Distance(a, b) {\n return Mathf.Sqrt(((Mathf.Pow((a.x - b.x) , 2)) + (Mathf.Pow((a.y - b.y) , 2))))\n}", "function colorGradient( color1, color2, ratio) {\n\n\tvar r = Math.ceil( parseInt(color1.substring(0,2), 16) * ratio + parseInt(color2.substring(0,2), 16) * (1-ratio));\n\tvar g = Math.ceil( parseInt(color1.substring(2,4), 16) * ratio + parseInt(color2.substring(2,4), 16) * (1-ratio));\n\tvar b = Math.ceil( parseInt(color1.substring(4,6), 16) * ratio + parseInt(color2.substring(4,6), 16) * (1-ratio));\n\n\t/*var r = Math.ceil( color1.r * ratio + color2.r * (1-ratio) );\n\tvar g = Math.ceil( color1.g * ratio + color2.g * (1-ratio) );\n\tvar b = Math.ceil( color1.b * ratio + color2.b * (1-ratio) );*/\n\t\n\treturn valToHex(r) + valToHex(g) + valToHex(b);\n\n\t//return rgb(r, g, b);\n\t}", "function mapColorToPalette(red,green,blue){\n var color,diffR,diffG,diffB,diffDistance,mappedColor;\n var distance=250000;\n for(var i=0;i<palette.length;i++){\n color=palette[i];\n diffR=( color.r - red );\n diffG=( color.g - green );\n diffB=( color.b - blue );\n diffDistance = diffR*diffR + diffG*diffG + diffB*diffB;\n if( diffDistance < distance ){\n distance=diffDistance;\n mappedColor=palette[i];\n };\n }\n return(mappedColor);\n }", "function hue2rgb(p,q,h){h = (h + 1) % 1;if(h * 6 < 1){return p + (q - p) * h * 6;}if(h * 2 < 1){return q;}if(h * 3 < 2){return p + (q - p) * (2 / 3 - h) * 6;}return p;}", "function hue2rgb(p,q,h){h = (h + 1) % 1;if(h * 6 < 1){return p + (q - p) * h * 6;}if(h * 2 < 1){return q;}if(h * 3 < 2){return p + (q - p) * (2 / 3 - h) * 6;}return p;}", "findRGB(c){\n if ((typeof c) == \"number\"){return c;}\n let rgb = [];\n if ((typeof c) == \"string\" && c.length == 7){\n rgb = [parseInt(c.substr(1, 2), 16), parseInt(c.substr(3, 2), 16), parseInt(c.substr(5, 2), 16)];\n }\n if (c instanceof Array){rgb = c;}\n if (!rgb.length){\n console.log(\"Invalid color lookup argument: \", c);\n return 0;\n }\n //ACNH has no palette colors - just plain RGB\n if (this.pattern instanceof ACNHFormat){return \"#\"+toHex(rgb[0])+toHex(rgb[1])+toHex(rgb[2]);}\n //Find the closest match\n let best = 255*255*3;\n let bestno = 0;\n for (let i = 0; i < 256; i++){\n let m = ACNLFormat.RGBLookup[i];\n if (m === null){continue;}\n let rD = (m[0] - rgb[0]);\n let gD = (m[1] - rgb[1]);\n let bD = (m[2] - rgb[2]);\n let match = (rD*rD + gD*gD + bD*bD);\n if (match < best){\n if (!match){return i;}//perfect match - we can stop immediately\n best = match;\n bestno = i;\n }\n }\n return bestno;\n }", "function hsl2rgb(h,m1,m2){return(h<60?m1+(m2-m1)*h/60:h<180?m2:h<240?m1+(m2-m1)*(240-h)/60:m1)*255;}", "function hsl2rgb(h,m1,m2){return(h<60?m1+(m2-m1)*h/60:h<180?m2:h<240?m1+(m2-m1)*(240-h)/60:m1)*255;}", "getConstrastRatioWith(c2) {\n let l1 = this.getRelativeLuminance();\n let l2 = (new Color(c2)).getRelativeLuminance();\n return (l1 + 0.05) / (l2 + 0.05);\n }", "function getDisOf(b1, b2){\r\n var delta_x = Math.abs(b1.x - b2.x),\r\n delta_y = Math.abs(b1.y - b2.y);\r\n\r\n return Math.sqrt(delta_x*delta_x + delta_y*delta_y);\r\n}", "function hsl2rgb(h,m1,m2){return(h<60?m1+(m2-m1)*h/60:h<180?m2:h<240?m1+(m2-m1)*(240-h)/60:m1)*255}", "function calculateGradient(nrSteps, startColor, endColor) {\n // Get RGB values\n startRGB = hexToDec(startColor);\n endRGB = hexToDec(endColor);\n \n // Return steps\n return Array((endRGB[0] - startRGB[0])/nrSteps, (endRGB[1] - startRGB[1])/nrSteps, (endRGB[2] - startRGB[2])/nrSteps);\n }", "function hue2rgb(p,q,h){h=(h+1)%1;if(h*6<1){return p+(q-p)*h*6;}if(h*2<1){return q;}if(h*3<2){return p+(q-p)*(2/3-h)*6;}return p;}", "function hue2rgb(p,q,h){h=(h+1)%1;if(h*6<1){return p+(q-p)*h*6;}if(h*2<1){return q;}if(h*3<2){return p+(q-p)*(2/3-h)*6;}return p;}", "function hue2rgb(p,q,h){h=(h+1)%1;if(h*6<1){return p+(q-p)*h*6;}if(h*2<1){return q;}if(h*3<2){return p+(q-p)*(2/3-h)*6;}return p;}", "function getDisOf(b1, b2){\n\t var delta_x = Math.abs(b1.x - b2.x),\n\t delta_y = Math.abs(b1.y - b2.y);\n\n\t return Math.sqrt(delta_x*delta_x + delta_y*delta_y);\n\t}", "function calculateNormalColor(r, g, b) {\n var intValue = 0;\n intValue = intValue | (r & 255);\n intValue = intValue << 8;\n intValue = intValue | (g & 255);\n intValue = intValue << 8;\n intValue = intValue | (b & 255);\n return intValue;\n }", "function reducePaletteSize(palette, numColors){\n const numPaletteColors = palette.length / 3;\n const numColorsToCut = numPaletteColors - numColors;\n\n const colorIndexes = ArrayUtil.create(numPaletteColors, (i)=>{\n return i * 3;\n }, Uint16Array);\n let colorIndexesLength = colorIndexes.length;\n //keep track of color total distances, so when culling colors, we keep the color that has the greatest total\n //distance from everything, as it will be the most unique\n const colorTotalDistances = new Float32Array(colorIndexesLength);\n\n for(let i=0;i<numColorsToCut;i++){\n let shortestDistance = Infinity;\n //shortestIndex1 only needed if we are reducing by averaging 2 closest indexes, instead of just discarding second\n let shortestIndex1 = -1;\n let shortestIndex2 = -1;\n\n //technically this has a bug, in that not all the distances are calculated\n //(e.g. the last index total distance will always be 0), but somehow fixing this causes the results to be worse for images with wide ranges of color (most images), though slightly better on images with a reduced color palette\n for(let j=0;j<colorIndexesLength-1;j++){\n const color1Index = colorIndexes[j];\n const color1Red = palette[color1Index];\n const color1Green = palette[color1Index+1];\n const color1Blue = palette[color1Index+2];\n let totalDistance = 0;\n for(let k=j+1;k<colorIndexesLength;k++){\n const color2Index = colorIndexes[k];\n const color2Red = palette[color2Index];\n const color2Green = palette[color2Index+1];\n const color2Blue = palette[color2Index+2];\n\n const distance = lumaDistance(color1Red, color1Green, color1Blue, color2Red, color2Green, color2Blue);\n totalDistance += distance;\n if(distance < shortestDistance){\n shortestDistance = distance;\n shortestIndex1 = j;\n shortestIndex2 = k;\n\n if(distance === 0){\n break;\n }\n }\n }\n colorTotalDistances[j] = totalDistance;\n if(shortestDistance === 0){\n break;\n }\n }\n //delete the index with shortest distance, as it is less unique\n const keyToDelete = shortestDistance > 0 && colorTotalDistances[shortestIndex2] > colorTotalDistances[shortestIndex1] ? shortestIndex1 : shortestIndex2;\n //delete key by swapping the last value with value at the index to be deleted\n colorIndexesLength--;\n colorIndexes[keyToDelete] = colorIndexes[colorIndexesLength];\n //don't need to swap colorTotalDistances, since we reset it at each iteration of the loop\n }\n const reducedPalette = new Uint8Array(numColors * 3);\n for(let i=0,reducedPaletteIndex=0;i<colorIndexesLength;i++){\n let colorIndex = colorIndexes[i];\n reducedPalette[reducedPaletteIndex++] = palette[colorIndex++];\n reducedPalette[reducedPaletteIndex++] = palette[colorIndex++];\n reducedPalette[reducedPaletteIndex++] = palette[colorIndex];\n }\n return reducedPalette;\n}", "function interpolate(val, rgb1, rgb2) {\n if (val > 1) {\n val = 1;\n }\n val = Math.sqrt(val);\n var rgb = [0,0,0];\n var i;\n for (i = 0; i < 3; i++) {\n rgb[i] = Math.round(rgb1[i] * (1.0 - val) + rgb2[i] * val);\n }\n return rgb;\n}", "function getDisOf(b1, b2){\n var delta_x = Math.abs(b1.x - b2.x),\n delta_y = Math.abs(b1.y - b2.y);\n\n return Math.sqrt(delta_x*delta_x + delta_y*delta_y);\n}", "get blendDistance() {}", "function calculateRGB(){\n\n // check whether the saturation is zero\n if (hsv.s == 0){\n\n // set the colour to the appropriate shade of grey\n var r = hsv.v;\n var g = hsv.v;\n var b = hsv.v;\n\n }else{\n\n // set some temporary values\n var f = hsv.h / 60 - Math.floor(hsv.h / 60);\n var p = hsv.v * (1 - hsv.s / 100);\n var q = hsv.v * (1 - hsv.s / 100 * f);\n var t = hsv.v * (1 - hsv.s / 100 * (1 - f));\n\n // set the RGB colour components to their temporary values\n switch (Math.floor(hsv.h / 60)){\n case 0: var r = hsv.v; var g = t; var b = p; break;\n case 1: var r = q; var g = hsv.v; var b = p; break;\n case 2: var r = p; var g = hsv.v; var b = t; break;\n case 3: var r = p; var g = q; var b = hsv.v; break;\n case 4: var r = t; var g = p; var b = hsv.v; break;\n case 5: var r = hsv.v; var g = p; var b = q; break;\n }\n\n }\n\n // store the RGB components\n rgb =\n {\n 'r' : r * 2.55,\n 'g' : g * 2.55,\n 'b' : b * 2.55\n };\n\n }", "function distance(a, b) {\n\treturn Math.sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));\n}", "function getDistance(a, b) {\n return Math.sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));\n }", "function distance(a,b){\r\n return Math.sqrt(Math.abs((a.x-b.x)*(a.x-b.x))+Math.abs((a.y-b.y)*(a.y-b.y)));\r\n}", "combineRGB(percent, rgbLow, rgbDiff) {\n\t\tlet color = 0x000000;\n\t\tcolor |= (percent * rgbDiff.r + rgbLow.r) << 16;\n\t\tcolor |= (percent * rgbDiff.g + rgbLow.g) << 8;\n\t\tcolor |= (percent * rgbDiff.b + rgbLow.b) << 0;\n\t\treturn color;\n\t}", "function getDisOf(b1, b2) {\n var delta_x = Math.abs(b1.x - b2.x),\n delta_y = Math.abs(b1.y - b2.y);\n\n return Math.sqrt(delta_x * delta_x + delta_y * delta_y);\n }", "function getDisOf(b1, b2) {\n var delta_x = Math.abs(b1.x - b2.x),\n delta_y = Math.abs(b1.y - b2.y);\n\n return Math.sqrt(delta_x * delta_x + delta_y * delta_y);\n}", "function getDisOf(b1, b2) {\n var delta_x = Math.abs(b1.x - b2.x),\n delta_y = Math.abs(b1.y - b2.y);\n\n return Math.sqrt(delta_x * delta_x + delta_y * delta_y);\n}", "function RGB_HSV(r,g,b){r/=255;g/=255;b/=255;var n=Math.min(Math.min(r,g),b);var v=Math.max(Math.max(r,g),b);var m=v-n;if(m===0){return[null,0,100*v];}var h=r===n?3+(b-g)/m:g===n?5+(r-b)/m:1+(g-r)/m;return[60*(h===6?0:h),100*(m/v),100*v];}// h: 0-360", "function calculateColor(star) {\n var distance = {}, m, color;\n\n distance.x = star.X - camera.position.x;\n distance.y = star.Y - camera.position.y;\n distance.z = star.Z - camera.position.z;\n distance.total = Math.sqrt(Math.pow(distance.x, 2) +\n Math.pow(distance.y, 2) +\n Math.pow(distance.z, 2));\n\n m = star.M - 5 * (1 - Math.log10(distance.total));\n\n //color = colorScale(m).gl();\n\n if (star.T < 4000) {\n color = colorScaleRed(m).gl();\n } else if (star.T > 10000) {\n color = colorScaleBlue(m).gl();\n } else {\n color = colorScaleWhite(m).gl();\n }\n\n return new THREE.Color(color[0], color[1], color[2]);\n}", "function distance(bottomLeft_R1, topRight_R1, bottomLeft_R2, topRight_R2){\n\t\t\treturn (Math.min(topRight_R1, topRight_R2) - Math.max(bottomLeft_R1, bottomLeft_R2))\n\t\t}", "function distanceNextFrame(a, b) {\r\n return Math.sqrt((a.x + a.dx - b.x - b.dx)**2 + (a.y + a.dy - b.y - b.dy)**2) - a.radius - b.radius;\r\n}", "static distance(a, b){\n const deltaX = a.x - b.x;\n const deltaY = a.y - b.y;\n\n //sqrt is static method for the Math class\n return Math.sqrt(deltaX ** 2 + deltaY ** 2);\n }", "function getstepcolor(step) {\n var diff\n var newcolor=new Array(3);\n for(var i=0;i<3;i++) {\n diff = (startcolor[i]-endcolor[i]);\n if(diff > 0) {\n newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);\n } else {\n newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);\n }\n }\n return (\"rgb(\" + newcolor[0] + \", \" + newcolor[1] + \", \" + newcolor[2] + \")\");\n}", "function dist(c1, c2){\r\n return ((c2.x - c1.x) ** 2 + (c2.y - c1.y) ** 2) ** 0.5;\r\n}", "function computeDNumber(x, y, arr) {\n var diffCount = 0;\n\n for(let i = 0; i <= DIFF_DISTANCE; i++) {\n if(x - i >= 0) diffCount += computeColorDifference(x, y, x-i, y, arr);\n if(x + i < arr.length) diffCount += computeColorDifference(x, y, x+i, y, arr);\n if(y - i >= 0) diffCount += computeColorDifference(x, y, x, y-i, arr);\n if(y + i < arr[x].length) diffCount += computeColorDifference(x, y, x, y+i, arr);\n }\n \n return diffCount;\n}", "function hue2rgb( p, q, h ) {\r\nh = ( h + 1 ) % 1;\r\nif ( h * 6 < 1 ) {\r\nreturn p + (q - p) * 6 * h;\r\n}\r\nif ( h * 2 < 1) {\r\nreturn q;\r\n}\r\nif ( h * 3 < 2 ) {\r\nreturn p + (q - p) * ((2/3) - h) * 6;\r\n}\r\nreturn p;\r\n}", "function imgDiff(a, b, walpha, bfactor) {\n\t\tbfactor = bfactor || 1;\n\t\tvar adata = a.data;\n\t\tvar bdata = b.data;\n\t\tvar i, wa, wb, d = 0;\n\t\tfor (i = 0; i < adata.length; i += 4) {\n\n\t\t\twa = wb = 1;\n\t\t\tif (walpha) {\n\t\t\t\twa = (adata[i + 3] / 255);\n\t\t\t\twb = (bdata[i + 3] / 255);\n\t\t\t}\n\t\t\td += (adata[i] + adata[i + 1] + adata[i + 2]) * wa / bfactor -\n\t\t\t\t(bdata[i] + bdata[i + 1] + bdata[i + 2]) * wb;\n\t\t}\n\t\treturn d;\n\t}", "function distance(a, b){\n return Math.sqrt(Math.pow((a.x - b.x), 2) + Math.pow((a.y - b.y), 2));\n}", "function distance(a, b) {\r\n return Math.sqrt((a.x - b.x)**2 + (a.y - b.y)**2);\r\n}", "function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;\n }", "function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;\n }", "function math(r, g, b) {\n let h, s = null;\n\n let min = Math.min(r, g, b);\n let max = Math.max(r, g, b);\n let minMaxDif = max - min;\n\n // Rounding values to tenths\n function round(num){\n return Math.round(num*10) / 10;\n }\n\n // Lightness\n let l = (max + min) / 5.1;\n\n // Saturation\n if (max !== min){\n s = (minMaxDif / 255) / (1 - Math.abs((max + min) / 255 - 1)) * 100;\n\n // Hue\n if (max === b){\n h = 60 * (r - g) / minMaxDif + 240;\n } else if (max === g){\n h = 60 * (b - r) / minMaxDif + 120;\n }else if (max === r && g >= b){\n h = 60 * (g - b) / minMaxDif;\n }else {\n h = 60 * (g - b) / minMaxDif + 360;\n }\n } else {\n s = 0;\n h = 0;\n }\n h = round(h);\n s = round(s);\n l = round(l);\n console.log('hsl('+h+', '+s+'%, '+l+'%)');\n return 'hsl('+h+', '+s+'%, '+l+'%)';\n }", "function hue2rgb(p, q, h) {\n h = (h + 1) % 1;\n if (h * 6 < 1) {\n return p + (q - p) * h * 6;\n }\n if (h * 2 < 1) {\n return q;\n }\n if (h * 3 < 2) {\n return p + (q - p) * (2 / 3 - h) * 6;\n }\n return p;\n }", "function rgb2hsl(r, g, b) {\n\t var min = arithmetic_1.min3(r, g, b), max = arithmetic_1.max3(r, g, b), delta = max - min, l = (min + max) / 510;\n\t var s = 0;\n\t if (l > 0 && l < 1)\n\t s = delta / (l < 0.5 ? (max + min) : (510 - max - min));\n\t var h = 0;\n\t if (delta > 0) {\n\t if (max === r) {\n\t h = (g - b) / delta;\n\t }\n\t else if (max === g) {\n\t h = (2 + (b - r) / delta);\n\t }\n\t else {\n\t h = (4 + (r - g) / delta);\n\t }\n\t h *= 60;\n\t if (h < 0)\n\t h += 360;\n\t }\n\t return { h: h, s: s, l: l };\n\t}", "function rgb2hsl(r, g, b) {\n\t var min = arithmetic_1.min3(r, g, b), max = arithmetic_1.max3(r, g, b), delta = max - min, l = (min + max) / 510;\n\t var s = 0;\n\t if (l > 0 && l < 1)\n\t s = delta / (l < 0.5 ? (max + min) : (510 - max - min));\n\t var h = 0;\n\t if (delta > 0) {\n\t if (max === r) {\n\t h = (g - b) / delta;\n\t }\n\t else if (max === g) {\n\t h = (2 + (b - r) / delta);\n\t }\n\t else {\n\t h = (4 + (r - g) / delta);\n\t }\n\t h *= 60;\n\t if (h < 0)\n\t h += 360;\n\t }\n\t return { h: h, s: s, l: l };\n\t}", "calcManhattanDist(img1, img2) {\n debugger;\n let manhattan = 0;\n\n for (let i = 0; i < img1.color_moments.length; i++) {\n for(let x = 0; x < img1.color_moments[i].length; x++){\n manhattan += Math.abs(img1.color_moments[i][x] - img2.color_moments[i][x]);\n }\n }\n manhattan /= img1.color_moments.length;\n return manhattan;\n }", "function luminanace (r, g, b) {\n var a = [r, g, b].map(function (v) {\n v /= 255;\n return v <= 0.03928\n ? v / 12.92\n : Math.pow((v + 0.055) / 1.055, 2.4)\n })\n return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;\n}", "function blueShift(imageData) {\n let tints = { blueVred: [], blueVgreen: [] }\n for (let i = 0; i < imageData.length; i += 3) {\n const red = imageData[i]\n const green = imageData[i + 1]\n const blue = imageData[i + 2]\n tints.blueVred.push(blue - red)\n tints.blueVgreen.push(blue - green)\n }\n console.log('tints', tints)\n if (tints.blueVred.length) {\n const sumRed = tints.blueVred.reduce((a, b) => a + b)\n tints.blueVred = (sumRed / tints.blueVred.length)\n const sumGreen = tints.blueVgreen.reduce((a, b) => a + b)\n tints.blueVgreen = (sumGreen / tints.blueVgreen.length)\n }\n else {\n tints.blueVred = 0\n tints.blueVgreen = 0\n }\n return tints\n}", "get rgb_1() {\n let c = new Color(this.r, this.g, this.b);\n return [c.r / 255, c.g / 255, c.b / 255];\n }", "function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;\n }", "function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;\n }", "function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;\n }", "function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;\n }", "function luminanace(r, g, b) {\n var a = [r, g, b].map(function (v) {\n v /= 255;\n return v <= 0.03928\n ? v / 12.92\n : Math.pow( (v + 0.055) / 1.055, 2.4 );\n });\n return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;\n}", "function colorFilter(rgb) {\r\n\tvar amt = rgb[3];\r\n\tloadPixels();\r\n\tfor (var y = 0; y < height; y++) {\r\n\t\tfor (var x = 0; x < width; x++) {\r\n\t\t\tvar i = (x + y * width) * 4;\r\n\t\t\tpixels[i] -= (pixels[i] - rgb[0]) * amt;\r\n\t\t\tpixels[i+1] -= (pixels[i + 1] - rgb[1]) * amt;\r\n\t\t\tpixels[i+2] -= (pixels[i + 2] - rgb[2]) * amt;\r\n\t\t}\r\n\t}\r\n\tupdatePixels();\r\n}", "function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;\n}", "function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;\n}", "function hsl2rgb(h, m1, m2) {\n return (h < 60 ? m1 + (m2 - m1) * h / 60\n : h < 180 ? m2\n : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60\n : m1) * 255;\n }" ]
[ "0.854238", "0.8022885", "0.7506141", "0.74120796", "0.7324789", "0.7211602", "0.71846014", "0.7160846", "0.7160846", "0.70001143", "0.69889766", "0.69381386", "0.68725896", "0.6802981", "0.6688095", "0.66868526", "0.6551371", "0.654201", "0.65148985", "0.6450123", "0.642014", "0.6397203", "0.6384513", "0.62618697", "0.6250628", "0.6248977", "0.62353987", "0.6235185", "0.6133956", "0.6128075", "0.6068858", "0.60411745", "0.6011878", "0.5985885", "0.59792197", "0.5950351", "0.5937088", "0.5927849", "0.5922743", "0.5880471", "0.5865005", "0.5862564", "0.5858855", "0.58578825", "0.58578825", "0.58502144", "0.58471197", "0.58471197", "0.58421946", "0.58143204", "0.5813931", "0.5813247", "0.5812848", "0.5812848", "0.5812848", "0.58000875", "0.5793223", "0.5773056", "0.5772636", "0.5768574", "0.5756787", "0.57463294", "0.57388306", "0.57323337", "0.57124406", "0.57078207", "0.5678601", "0.56780386", "0.56780386", "0.56767565", "0.5672171", "0.5671941", "0.56581396", "0.56446916", "0.56323403", "0.5631743", "0.56227714", "0.55986583", "0.5592399", "0.5584517", "0.55807436", "0.5578835", "0.5578835", "0.557859", "0.5553016", "0.5547887", "0.5547887", "0.55465144", "0.55391914", "0.5535545", "0.5532564", "0.55296373", "0.55296373", "0.55296373", "0.55296373", "0.5529066", "0.5526637", "0.55238014", "0.55238014", "0.5523659" ]
0.68192565
13
Calculates the increment values for R, G, and B using distance, fps, and duration. This calculation can be made in many different ways.
function calculateIncrement(distanceArray, fps, duration) { var fps = fps || 30; var duration = duration || 1; var increment = []; for (var i = 0; i < distanceArray.length; i++) { var incr = Math.abs(Math.floor(distanceArray[i] / (fps * duration))); if (incr == 0) { incr = 1; } increment.push(incr); } return increment; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculateIncrement(distanceArray, fps, duration) {\n var fps\t\t\t= fps || 30;\n var duration\t= duration || 1;\n var increment\t= [];\n for (var i = 0; i < distanceArray.length; i++) {\n var incr = Math.abs(Math.floor(distanceArray[i] / (fps * duration)));\n if (incr == 0) {\n incr = 1;\n }\n increment.push(incr);\n }\n return increment;\n }", "_calcDimentions() {\n this._props.time = this._props.duration + this._props.delay;\n this._props.repeatTime = this._props.time * (this._props.repeat + 1);\n }", "function distanceNextFrame(a, b) {\r\n return Math.sqrt((a.x + a.dx - b.x - b.dx)**2 + (a.y + a.dy - b.y - b.dy)**2) - a.radius - b.radius;\r\n}", "calculateFrame() {\n const nowTime = (new Date()).getTime();\n this.tick += 1;\n if (nowTime - this.beforeTime >= 1000) {\n console.log(`fps: ${this.tick}`);\n this.tick = 0;\n this.beforeTime = nowTime;\n }\n }", "_incrementFrame() {\n this._elapsedFrameCount += 1;\n }", "function compute_fps() {\n let counter_element = document.querySelector(\"#fps-counter\");\n if (counter_element != null) {\n counter_element.innerText = \"FPS: \" + g_frames_since_last_fps_count;\n }\n g_frames_since_last_fps_count = 0;\n}", "distance() {\n return this.speed * this.duration() / 3600000;\n }", "function update() {\n if (get() - lastFPS > 1000) {\n this.fps = fpsCounter;\n fpsCounter = 0; // Reset the FPS counter\n lastFPS += 1000; // Add one second\n }\n fpsCounter++;\n\n let time = get();\n let deltaTime = (time - lastFrame);\n lastFrame = time;\n if (!(deltaTime >= time)) {\n this.delta = deltaTime;\n }\n }", "function getFps(){\n\tfps++;\n\tif(Date.now() - lastTime >= 1000){\n\t\tfpsCounter.innerHTML = fps;\n\t\tfps = 0;\n\t\tlastTime = Date.now(); \n\t}\n}", "updateR() {\n if (this.lastRUpdate==0 || globalUpdateCount - this.lastRUpdate >= DAY_LENGTH) {\n let pts = this.fields.map(f => f.pts).reduce((acc, pts) => acc.concat(pts), [])\n pts.push(...this.sender.objs.map(o => o.point))\n \n let nInfectious = 0\n const val = pts\n .map(pt => {\n if (pt.isInfectious()) {\n nInfectious += 1\n const timeInfectious = globalUpdateCount - pt.lastStatusUpdate + (pt.status == Point.INFECTIOUS2) ? Point.infectious1Interval : 0\n if (timeInfectious>0) {\n const timeRemaining = Point.infectious2Interval + Point.infectious1Interval - timeInfectious\n return pt.nInfected/timeInfectious*timeRemaining // estimated infections over duration of illness\n } else return 0\n } else return 0\n })\n .reduce((sum, ei) => sum + ei)\n \n if (nInfectious>0) {\n this.rVal = val/nInfectious\n this.rMax = this.rMax < this.rVal ? this.rVal : this.rMax\n } else this.rVal = 0\n this.lastRUpdate = globalUpdateCount\n }\n }", "function animation_frame() {\n var datalen = animationState.order.length,\n styles = animationState.styleArrays,\n curTime = Date.now(), genTime, updateTime,\n position, i, idx, p;\n timeRecords.frames.push(curTime);\n animationState.raf = null;\n position = ((curTime - animationState.startTime) / animationState.duration) % 1;\n if (position < 0) {\n position += 1;\n }\n animationState.position = position;\n\n for (idx = 0; idx < datalen; idx += 1) {\n i = animationState.order[idx];\n p = idx / datalen + position;\n if (p > 1) {\n p -= 1;\n }\n styles.p[i] = p;\n }\n if (animationStyles.fill) {\n for (i = 0; i < datalen; i += 1) {\n styles.fill[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.fillColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.fillColor[i].r = 0;\n styles.fillColor[i].g = 0;\n styles.fillColor[i].b = 0;\n } else {\n styles.fillColor[i].r = p * 10;\n styles.fillColor[i].g = p * 8.39;\n styles.fillColor[i].b = p * 4.39;\n }\n }\n }\n if (animationStyles.fillOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.fillOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * 10; // 1 - 0\n }\n }\n if (animationStyles.radius) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.radius[i] = p >= 0.1 ? 0 : 2 + 100 * p; // 2 - 12\n }\n }\n if (animationStyles.stroke) {\n for (i = 0; i < datalen; i += 1) {\n styles.stroke[i] = styles.p[i] >= 0.1 ? false : true;\n }\n }\n if (animationStyles.strokeColor) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n if (p >= 0.1) {\n styles.strokeColor[i].r = 0;\n styles.strokeColor[i].g = 0;\n styles.strokeColor[i].b = 0;\n } else {\n styles.strokeColor[i].r = p * 8.51;\n styles.strokeColor[i].g = p * 6.04;\n styles.strokeColor[i].b = 0;\n }\n }\n }\n if (animationStyles.strokeOpacity) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeOpacity[i] = p >= 0.1 ? 0 : 1.0 - p * p * 100; // (1 - 0) ^ 2\n }\n }\n if (animationStyles.strokeWidth) {\n for (i = 0; i < datalen; i += 1) {\n p = styles.p[i];\n styles.strokeWidth[i] = p >= 0.1 ? 0 : 3 - 30 * p; // 3 - 0\n }\n }\n var updateStyles = {};\n $.each(animationStyles, function (key, use) {\n if (use) {\n updateStyles[key] = styles[key];\n }\n });\n genTime = Date.now();\n pointFeature.updateStyleFromArray(updateStyles, null, true);\n updateTime = Date.now();\n timeRecords.generate.push(genTime - curTime);\n timeRecords.update.push(updateTime - genTime);\n show_framerate();\n if (animationState.mode === 'play') {\n animationState.raf = window.requestAnimationFrame(animation_frame);\n }\n }", "constructor(p, data, startHrs, startMins, am, width, height, fogTimes) {\n this.p = p;\n this.baseTimeMinutes = timeInMins(startHrs, startMins);\n this.ampm = am;\n this.data = data;\n this.fogTimes = fogTimes;\n\n /**\n * ANIMATION TIME CONSTANTS\n */\n /* Canvas will refresh 60 times a second */\n this.fRate = 60;\n /* A 'minute' in the animation will last 100 frames. */\n this.framesPerMin = 100;\n /** The length of this animation, in minutes. \n * Based on latest departure time of any visitor in the data array.\n * Add 5 to allow time for the latest departure to exit the screen\n * before restarting the animation. */\n this.durationInMins = 5 + getLatestDeparture(data);\n console.log(this.durationInMins);\n\n /**\n * ANIMATION LIFECYCLE STATE\n * Reset at the start of every animation\n */\n this.frameCount = 0;\n\n /**\n * MINUTE-BY-MINUTE STATE\n * Updated every minute for visitors within that minute\n */\n /* Array of objects that have x;N, y;N, and data:VisitorData fields,\n where VisitorData is {type:{r|c|w}, dir{up|down}, arrival:Minute, [departure:Minute]} */\n this.activeVisitors = [];\n // Shallow copy of data that can be mutated\n this.waitingVisitors = this.data.slice();\n /* Number of frames that elapse between each visitor in the current minute */\n this.framesPerVisitor;\n /* Array of VisitorData objects, the visitors that will be added\n to the animation during the current minute */\n this.visitorsInMin = [];\n\n /**\n * DRAWING (size + color) CONSTANTS\n * Known / given constants,\n * and dynamically calculated constants.\n */\n this.myWidth = width; // should be windowWidth when constructed\n this.myHeight = height; // should be 400 when constructed\n this.visitorDotSize = 10; // size of visitor dots in animatino\n // Calculate + set width-dependent drawing constants.\n this.initSizeConstants();\n // Init the color constants.\n this.initColorConstants();\n }", "function countingDistance() {\n setTimeout(function () {\n let color1 = document.querySelector(\"#RGBvalue> span\").innerHTML.split(\" \");\n let color2 = document.querySelector(\"#RGBvalue2>span\").innerHTML.split(\" \");\n color1 = color1.map((elem) => (elem = parseInt(elem)));\n color2 = color2.map((elem) => (elem = parseInt(elem)));\n console.log(226, color1, color2);\n let distance = Math.sqrt(\n (color2[0] - color1[0]) ** 2 +\n (color2[1] - color1[1]) ** 2 +\n (color2[2] - color1[2]) ** 2\n ).toFixed(1);\n // console.log(232, \"distance:\", distance);\n let putDistance = document.querySelector(\"p.fetched>span\").innerHTML;\n // console.log(234, putDistance);\n putDistance = putDistance.concat(\" [\", distance, \"]\");\n console.log(236, putDistance);\n document.querySelector(\"p.fetched>span\").innerHTML = putDistance;\n }, 150);\n}", "function getFramesPerInterval() {\n\treturn getInterval()*fps/1000;\n}", "animate(){\n // request another frame\n window.requestAnimationFrame(this.animate.bind(this));\n\n // calc elapsed time since last loop\n this.now = Date.now();\n this.elapsed = this.now - this.then;\n // if enough time has elapsed, draw the next frame\n if (this.elapsed > this.fpsInterval){\n // Get ready for next frame by setting then=now, but also adjust for your\n // specified fpsInterval not being a multiple of RAF's interval (16.7ms)\n this.then = this.now - (this.elapsed % this.fpsInterval)\n\n // animation code\n this.animateOneFrame();\n }\n }", "step() {\n this.currentColor += (this.redComponentRatio * (this.redDiff / this.steps)) & RED;\n this.currentColor += (this.greenComponentRatio * (this.greenDiff / this.steps)) & GREEN;\n this.currentColor += (this.blueComponentRatio * (this.blueDiff / this.steps)) & BLUE;\n return Math.floor(this.currentColor);\n }", "function frames(num1,num2) {\r\n\treturn num1*num2*60\r\n}", "function deltaRgb() {\n var STEPS = 60;\n var delta = {}\n for (var key in Colour) {\n delta[key] = Math.abs(Math.floor((colour[key] - nextColour[key]) / STEPS));\n if(delta[key] === 0) {\n delta[key]++;\n }\n }\n return delta;\n }", "function colorStep(c1, c2, t) {\n if (t < 0) {\n t = 0;\n } else if (t > 1) {\n t = 1;\n }\n\n return {\n r: parseInt(c1['r'] + (c2['r'] - c1['r']) * t),\n g: parseInt(c1['g'] + (c2['g'] - c1['g']) * t),\n b: parseInt(c1['b'] + (c2['b'] - c1['b']) * t)\n };\n }", "calculateRelativeValue(motion, key) {\n let a = motion.start[key];\n let b = motion.end[key];\n let r = motion.ratio;\n let easing = r > 0 ? motion.start.easing : motion.end.easing;\n\n switch (easing) {\n case \"in\": r = Math.sin((r * Math.PI) / 2); break;\n case \"out\": r = Math.cos((r * Math.PI) / 2); break;\n }\n\n return ((b - a) * r) + a;\n }", "get speed () {\n if (this.pointers.length > 0)\n return (this.pointers.reduce((sum, pointer) => { return sum+pointer.speed}, 0) / this.pointers.length);\n else\n return 0;\n }", "function calculate_distance() {\n\n currgal_length_in_Mpc = convert_ltyr_to_Mpc(currgal_length_in_ltyr);\n currgal_distance = currgal_length_in_Mpc / view_height_rad;\n\n print_distance(\"calculating.\");\n setTimeout(function () {\n print_distance(\"calculating..\")\n }, 500);\n setTimeout(function () {\n print_distance(\"calculating...\")\n }, 1000);\n setTimeout(function () {\n print_distance(Math.round(currgal_distance).toLocaleString() + \" Mpc\")\n }, 1500);\n }", "rgbDistance (r, g, b) {\n const [r1, g1, b1] = this\n const rMean = Math.round((r1 + r) / 2)\n const [dr, dg, db] = [r1 - r, g1 - g, b1 - b]\n const [dr2, dg2, db2] = [dr * dr, dg * dg, db * db]\n const distanceSq =\n (((512 + rMean) * dr2) >> 8) + (4 * dg2) + (((767 - rMean) * db2) >> 8)\n return distanceSq // Math.sqrt(distanceSq)\n }", "update() {\n if (this.isComplete()) {\n if (this.eventDispatcher && this.event) {\n this.eventDispatcher.dispatchEvent(this.event);\n }\n return -1;\n }\n // this.startTime = this.now();\n // this.endTime = this.startTime + this.totalTime;\n if (!this.endTime) return 0;\n var currentTime = this.now();\n var percentDone = (currentTime - this.startTime) / (this.endTime - this.startTime);\n if (percentDone < 0) percentDone = 0;\n else if (percentDone > 1) percentDone = 1;\n // var newVal = this.startVal + (this.endVal - this.startVal) * this.transition.applyTransition(percentDone);\n var trans = this.transition.applyTransition(percentDone);\n var newVal = this.startVal + (this.endVal - this.startVal) * trans;\n this.setValue(newVal);\n return 1;\n }", "function calcSpeed(distance, time){\n return distance/time;\n}", "update() {\n if (this._futureTrackDeltaTimeCache !== -1) {\n return;\n }\n\n const currentTime = this.gameTimeSeconds;\n\n this._incrementFrame();\n this._calculateNextDeltaTime(currentTime);\n this._calculateFrameStep();\n }", "function speedUp() {\r\n if (ballSpeedX > 0 && ballSpeedX < 16) {\r\n ballSpeedX += ballSpeedChange;\r\n aiSpeed += aiSpeedChange;\r\n }\r\n if (ballSpeedX < 0 && ballSpeedX > -16) {\r\n ballSpeedX -= ballSpeedChange;\r\n aiSpeed += aiSpeedChange;\r\n }\r\n if (ballSpeedY > 0 && ballSpeedY < 16) {\r\n ballSpeedY += ballSpeedChange;\r\n aiSpeed += aiSpeedChange;\r\n }\r\n if (ballSpeedY < 0 && ballSpeedY > -16) {\r\n ballSpeedY -= ballSpeedChange;\r\n aiSpeed += aiSpeedChange;\r\n }\r\n //console.log(ballSpeedX, ballY, aiSpeed, 'aiY=' + aiY)\r\n}", "function calc_steps() {\n\t\t for (var key in rgb_values) {\n\t\t if (rgb_values.hasOwnProperty(key)) {\n\t\t for(var i = 0; i < 4; i++) {\n\t\t rgb_values[key][i] = gradients[currentIndex][key][i];\n\t\t rgb_steps[key][i] = calc_step_size(gradients[nextIndex][key][i],rgb_values[key][i]);\n\t\t }\n\t\t }\n\t\t }\n\t\t}", "function calcTime(dist){\n\t//Get duration of the video\n\tvar dur = Popcorn(\"#video\").duration();\n\t//Get width of timeline in pixels\n\tvar wdth = document.getElementById(\"visualPoints\").style.width;\n\t//Trim for calculations\n\twdth = wdth.substr(0,wdth.length - 2);\n\t//Calculate pixel/total ratio\n\tvar ratio = dist / wdth;\n\t//Return time value in seconds calculated using ratio\n\treturn (ratio * dur);\n}", "calculateFPS(elapsedTimeMS) {\n this.fpsTimeElapsed += elapsedTimeMS;\n if (this.fpsTimeElapsed >= 1000) {\n this.currentFPS = this.fpsCounter;\n this.fpsCounter = 0;\n this.fpsTimeElapsed = 0;\n } else {\n this.fpsCounter++;\n }\n }", "update( time ) {\r\n let animation = this.animationList[this.current];\r\n if( !animation ) return;\r\n this.progress += time * animation.fps;\r\n while( this.progress >= 1.0 ) {\r\n this.progress -= 1.0;\r\n this.frame++;\r\n if( this.frame >= animation.startFrame + animation.numFrames ) {\r\n this.frame = animation.startFrame;\r\n }\r\n }\r\n }", "function calculateNext(data) {\n var v = data.calculationSettings.v;\n var m = data.calculationSettings.m;\n var n = data.calculationSettings.n;\n var h = data.calculationSettings.h;\n var ik = data.calculationSettings.ik;\n var il = data.calculationSettings.il;\n var ina = data.calculationSettings.ina;\n var timestep = data.calculationSettings.timestep;\n var gna1 = data.calculationSettings.gna1;\n var gna2 = data.calculationSettings.gna2;\n var gk1 = data.calculationSettings.gk1;\n var gk2 = data.calculationSettings.gk2;\n var gkMod = data.calculationSettings.gkMod;\n var gan = data.calculationSettings.gan;\n var ean = data.calculationSettings.ean;\n var ns1 = data.calculationSettings.ns1;\n var s1 = data.calculationSettings.s1;\n var s2 = data.calculationSettings.s2;\n var cm = data.calculationSettings.cm;\n \n \n\t\t// track the current value of v before iterating.\n\t\tvar vOld = v;\n\n\n\t\t// calculate alphas and betas for updating gating variables\n\t \tvar am;\n\t if (Math.abs(-v - 48) < 0.001) {\n\t \tam=0.15;\n\t } else {\n\t \tam=0.1*(-v-48)/(Math.exp((-v-48)/15)-1);\n\t }\n \n\t\tvar bm;\n\t\tif (Math.abs(v + 8) < 0.001) {\n\t\t\tbm = 0.6;\n\t\t}\n\t\telse {\n\t\t\tbm=0.12*(v+8)/(Math.exp((v+8)/5)-1);\n\t\t}\n \n\t\tvar ah = 0.17 * Math.exp((-v - 90)/20);\n\t\tvar bh = 1 / (Math.exp((-v - 42)/10) + 1);\n \n\t\tvar an;\n\t\tif (Math.abs(-v - 50) < 0.001) {\n\t\t\tan = 0.001;\n\t\t} else {\n\t\t\tan = 0.0001 * (-v - 50) / (Math.exp((-v-50)/10)-1);\n\t\t}\n\t\tvar bn = 0.002 * Math.exp((-v-90)/80);\n\n\n\t\t// calculate derivatives of gating variables\n\t\tvar dm = am * (1-m) - bm * m;\n\t\tvar dh = ah * (1-h) - bh * h;\n\t\tvar dn = an * (1-n) - bn * n;\n \n\t\t// update gating variables using explicit method\n\t\tm += timestep * dm;\n\t\th += timestep * dh;\n\t\tn += timestep * dn;\n\n\t\t// calculate potassium current conductance values\n\t\tvar gk1 = gkMod * Math.exp((-v-90)/50) + 0.015 * Math.exp((v+90)/60);\n\t\tvar gk2 = gkMod * Math.pow(n, 4);\n\n\n\t\t// calculate currents\n\t\tvar ina1 = gna1 * m * m * m * h * (v - 40);\n\t\tvar ina2 = gna2 * (v - 40);\n\t\tvar ik1 = gk1 * (v + 100);\n\t\tvar ik2 = gk2 * (v + 100);\n\t\til = gan * (v - ean);\n\n\n\t\t// sum the two sodium and the two potassium currents\n\t\tina = ina1 + ina2;\n\t\tik = ik1 + ik2;\n\n\n\t\t// set stimulus current periodically to be nonzero\n\t\tvar istim = _s1s2Stimulus(count, data);\n\n\n\t\t// calculate derivative of voltage \n\t\tvar dv = (-ina - ik - il - istim) / cm;\n\n\n\t\t// update voltage using forward Euler\n\t\tv += timestep * dv;\n\n\n\t\t// check vOld against the threshold\n\t\tcheckThreshold(vOld, v, threshold);\n\n\n\t\t// iterate the count\n\t\tcount++;\n \n data.calculationSettings.v = v;\n data.calculationSettings.m = m;\n data.calculationSettings.n = n;\n data.calculationSettings.h = h;\n data.calculationSettings.ik = ik;\n data.calculationSettings.ina = ina;\n data.calculationSettings.il = il;\n \n // var obj = {\n // v: v,\n // h: h,\n // n: n,\n // m: m,\n // ik: ik,\n // ina: ina,\n // il: il\n // }\n // console.log(\"object\");\n // console.log(obj);\n return data;\n\t}", "update() {\r\n let currentX = vx * rnt;\r\n let currentY = vy * rnt + 0.5 * (-1 * g) * Math.pow(rnt, 2)\r\n\r\n if (rnt <= t) {\r\n this.x = currentX;\r\n this.y = canvas.height - currentY\r\n //monitor the change of the displacement and time\r\n xD.innerText = Number.parseFloat(currentX).toFixed(1);\r\n yD.innerText = Number.parseFloat(dy).toFixed(1);\r\n time.innerText = Number.parseFloat(rnt).toFixed(1)\r\n rnt += speed.value / 60;//devide the speed value by 60 fram per second \r\n //to control the speed of the animation \r\n }\r\n\r\n\r\n //to adjust the canvas if the displacemetn is greater than the canvas\r\n if (dx > canvas.width) canvas.width = dx + r;\r\n if (dy > canvas.height) canvas.height = dy + r;\r\n\r\n }", "calcSpeed(){\n\treturn this.distance/(this.time/60);//miles per hour\n }", "updateRadiusStep() {\n\n\t\tconst r = this.r / this.samples;\n\t\tthis.uniforms.get(\"radiusStep\").value.set(r, r).divide(this.resolution);\n\n\t}", "function computeValues() {\n\t\t\t\n\t\t\tvar scaler;\n\t\t\t// deal with loop\n\t\t\tif (repeat > 0) {\n\t\t\t\t// not first run, save last scale ratio\n\t\t\t\txFrom = xTo;\n\t\t\t\tyFrom = yTo;\n\t\t\t\tratioFrom = ratioTo;\n\t\t\t} else {\n\t\t\t\t// get the scaler using conf options\n\t\t\t\tscaler = $.pixelentity.Geom.getScaler(zoom == \"out\" ? \"fill\" : \"none\",align.w,align.h,w,h,tw,th);\n\t\t\t\txFrom = scaler.offset.w;\n\t\t\t\tyFrom = scaler.offset.h;\n\t\t\t\tratioFrom = scaler.ratio;\n\t\t\t}\n\t\t\t\n\t\t\tscaler = $.pixelentity.Geom.getScaler(zoom == \"in\" ? \"fill\" : \"none\",pan.w,pan.h,w,h,tw,th);\n\t\t\txTo = scaler.offset.w;\n\t\t\tyTo = scaler.offset.h;\n\t\t\tratioTo = scaler.ratio;\n\t\t\t\n\t\t\txPrev = 0;\n\t\t\tyPrev = 0;\n\t\t\t\n\t\t\tduration = parseFloat(normalized)*33;\n\t\t\t\n\t\t\t// reset counter\n\t\t\tcounter = 0;\n\t\t\t\n\t\t\t// update runs count\n\t\t\trepeat++;\n\t\t\t\n\t\t}", "function getAnimationFrameRate() {\n return _config ? _config.animationFrameRate : undefined;\n }", "static frameCounter() {\n const time = performance.now()\n\n if (FPS.start === null) {\n FPS.start = time\n FPS.prevFrameTime = time\n } else {\n FPS.frameCount++\n FPS.frames.push(time - FPS.prevFrameTime)\n }\n\n FPS.prevFrameTime = time\n\n if (FPS.running) {\n requestAnimationFrame(FPS.frameCounter)\n }\n }", "update() {\n this.tickCount += 1;\n if (this.tickCount > this.ticksPerFrame) {\n this.tickCount = 0;\n // If the current frame index is in range\n if (this.frameIndex < this.numberOfFrames - 1) {\n // Go to the next frame\n this.frameIndex += 1;\n } else {\n this.frameIndex = 0;\n }\n }\n }", "function requestAnimFrame() {\n if (!lastCalledTime) {\n lastCalledTime = Date.now();\n fps2 = 0;\n return fps;\n }\n delta = (Date.now() - lastCalledTime) / 1000;\n lastCalledTime = Date.now();\n fps2 = 1 / delta;\n // console.clear();\n console.log('\\n'.repeat('100'));\n return parseInt(fps2);\n}", "function relativeStep(startTime) {\n // 'startTime' is provided by requestAnimationName function, and we can consider it as current time\n // first of all we calculate how much time has passed from the last time when frame was update\n if (!relativeAnimationStopped) {\n if (!relativeTimeWhenLastUpdate) relativeTimeWhenLastUpdate = startTime;\n relativeTimeFromLastUpdate = startTime - relativeTimeWhenLastUpdate;\n\n // then we check if it is time to update the frame\n if (relativeTimeFromLastUpdate > timePerFrame) {\n // and update it accordingly\n console.log(relativeFrameNumber);\n $relativePopulation.attr(\n \"src\",\n imagePath + `/relative_population_${relativeFrameNumber}.svg`\n );\n $(\".relative-slider\").val(relativeFrameNumber);\n // reset the last update time\n relativeTimeWhenLastUpdate = startTime;\n\n // then increase the frame number or reset it if it is the last frame\n if (relativeFrameNumber >= totalFrames) {\n relativeFrameNumber = 1;\n } else {\n relativeFrameNumber = relativeFrameNumber + 1;\n }\n }\n\n requestAnimationFrame(relativeStep);\n }\n}", "function timeToWalk(steps, strideLength, speed){\n\n let speedInMetersPerSecond = Number(speed) / 3.6;\n let distance = Number(steps) * Number(strideLength);\n let stridesPerSecond = speedInMetersPerSecond / Number(strideLength);\n let timeInSeconds = distance / speedInMetersPerSecond;\n\n let restTime = Math.floor(distance / 500);\n timeInSeconds += restTime * 60;\n\n let hours = Math.floor(timeInSeconds / 3600);\n timeInSeconds %= 3600;\n let minutes = Math.floor(timeInSeconds / 60);\n timeInSeconds %= 60;\n timeInSeconds = Math.round(timeInSeconds);\n\n\n var hoursResult = hours < 10 ? \"0\" + hours : hours;\n var minutesResult = minutes < 10 ? \"0\"+ minutes : minutes;\n var secondsResult = timeInSeconds < 10 ? \"0\"+ timeInSeconds : timeInSeconds;\n\n var result = hoursResult \n + \":\" \n + minutesResult\n + \":\"\n + timeInSeconds;\n\n console.log(result);\n}", "function step(timestamp){\n\n //update css variable\n positionLeft1 += speedX1;\n positionTop1 += speedY1;\n\n positionLeft2 += speedX2;\n positionTop2 += speedY2;\n\n positionLeft3 += speedX3;\n positionTop3 += speedY3;\n\n //change speed and direction variable if the ball hits the edge of the screen\n if(positionLeft1 > width){\n speedX1 = speedX1 * -1;\n }\n\n if(positionLeft1 < 0){\n speedX1 = speedX1 * -1;\n }\n\n if(positionTop1 > height){\n speedY1 = speedY1 * -1;\n }\n\n if(positionTop1 < 0 ){\n speedY1 = speedY1 * -1;\n }\n\n\n\n\n\n if(positionLeft2 > width){\n speedX2 = speedX2 * -1;\n }\n\n if(positionLeft2 < 0){\n speedX2 = speedX2 * -1;\n }\n\n if(positionTop2 > height){\n speedY2 = speedY2 * -1;\n }\n\n if(positionTop2 < 0 ){\n speedY2 = speedY2 * -1;\n }\n\n\n\n\n\n if(positionLeft3 > width){\n speedX3 = speedX3 * -1;\n }\n\n if(positionLeft3 < 0){\n speedX3 = speedX3 * -1;\n }\n\n if(positionTop3 > height){\n speedY3 = speedY3 * -1;\n }\n\n if(positionTop3 < 0 ){\n speedY3 = speedY3 * -1;\n }\n\n $('#shape1').css(\"left\", positionLeft1)\n $('#shape1').css(\"top\", positionTop1)\n\n $('#shape2').css(\"left\", positionLeft2)\n $('#shape2').css(\"top\", positionTop2)\n\n $('#shape3').css(\"left\", positionLeft3)\n $('#shape3').css(\"top\", positionTop3)\n window.requestAnimationFrame(step);\n}", "updateData()\n {\n this.x += this.speedx;\n this.y += this.speedy;\n\n if(this.x+this.r > w || this.x-this.r < 0){this.speedx *= -1};\n if(this.y+this.r > h || this.y-this.r < 0){this.speedy *= -1};\n }", "function bezier_counter(timestamp, start_time, element, duration, start_number, end_number, animation_bezier) {\n var progress = timestamp - start_time;\n\n // var bezier_y = animation_bezier.get_y(timestamp/duration) * end_number;\n var bezier_y = animation_bezier.get_y(progress / duration) * (end_number - start_number) + start_number;\n element.innerHTML = Math.floor(bezier_y);\n\n // check to see if function finished execution\n if (progress < duration) {\n requestAnimationFrame(function(timestamp) {\n bezier_counter(timestamp, start_time, element, duration, start_number, end_number, animation_bezier);\n });\n } else {\n // change to the users end_number at the end in case something went wrong\n element.innerHTML = end_number;\n };\n}", "function calc_steps() {\r\n for (var key in rgb_values) {\r\n if (rgb_values.hasOwnProperty(key)) {\r\n for (var i = 0; i < 3; i++) {\r\n rgb_values[key][i] = gradients[currentIndex][key][i];\r\n rgb_steps[key][i] = calc_step_size(gradients[nextIndex][key][i], rgb_values[key][i]);\r\n }\r\n }\r\n }\r\n}", "update() {\n this.steps += 1;\n }", "function calc_steps() {\r\n for (var key in rgb_values) {\r\n if (rgb_values.hasOwnProperty(key)) {\r\n for(var i = 0; i < 3; i++) {\r\n rgb_values[key][i] = gradients[currentIndex][key][i];\r\n rgb_steps[key][i] = calc_step_size(gradients[nextIndex][key][i],rgb_values[key][i]);\r\n }\r\n }\r\n }\r\n}", "calculateSteps() { \n for (var key in this.rgb_values) {\n if (this.rgb_values.hasOwnProperty(key)) {\n for (var i = 0; i < 3; i++) {\n this.rgb_values[key][i] = this.settings.gradients[this.currentIndex][key][i];\n this.rgb_steps[key][i] = this.calculateStepSize(this.settings.gradients[this.nextIndex][key][i], this.rgb_values[key][i]);\n }\n }\n } \n }", "static getFrameRate(frames) {\nvar frameok;\n//------------\n// Use 25fps as the somewhat arbitrary default value.\nframeok = frames && frames.length !== 0;\nif (frameok) {\nreturn 1000 / frames[0].duration;\n} else {\nreturn 25;\n}\n}", "_calculateFrameStep() {\n // TODO: what do the magic numbers mean?\n this._frameStep = Math.round(extrapolate_range_clamp(1, this._simulationRate, 10, 30, 1));\n }", "function animate() {\n var timeNow = new Date().getTime();\n if (lastTime != 0) {\n var elapsed = timeNow - lastTime; \n rotAngle= (rotAngle+1.0) % 360;\n }\n var elapsed=timeNow-lastTime;\n lastTime = timeNow;\n \n //when framecount is less than 120, the effect is just rotation\n //when framecount is between 120 to 240, the effect is shaking from left to right\n //when framecount is between 240 to 360, the effect is enlarging from left to right\n //when framecount is between 360 to 480, the effect is shaking hands\n //when framecount is between 480 to 600, the effect is enlargeing from top to bottom\n //then repeat\n days=days+0.01;\n if(framecount>=120 && framecount <240){\n updateBuffers();\n \n } \n if(framecount>=240 && framecount <360) {\n updateBuffers1();\n updatecolor();\n\n }\n if(framecount>=360 && framecount <480){\n updateBuffers2();\n }\n if (framecount >=480 && framecount < 600) {\n \n updateBuffers3();\n updatecolor();\n \n }\n \n \n \n}", "updateBackgroundStats() {\n this.treeSpeed += 0.4;\n this.horizonSpeed *= 0.8;\n }", "function animate()\n{\n frameCount++;\n // movement update\n update();\n // render update\n render();\n // trigger next frame\n requestAnimationFrame(animate);\n}", "step() {\n const backBufferIndex = this.currentBufferIndex === 0 ? 1 : 0;\n const cB = this.buffer[this.currentBufferIndex]; // currentBuffer\n const bB = this.buffer[backBufferIndex]; // backBuffer\n const w = this.width, h = this.height;\n\n const countNeighbors = (x, y) => {\n let c = 0; // counter\n if (x > 0 && cB[y][x - 1]) c++;\n if (x < w - 1 && cB[y][x + 1]) c++;\n if (y > 0 && cB[y - 1][x]) c++;\n if (y < h - 1 && cB[y + 1][x]) c++;\n if (x > 0 && y < h - 1 && cB[y + 1][x - 1]) c++;\n if (y > 0 && x < w - 1 && cB[y - 1][x + 1]) c++;\n if (x > 0 && y > 0 && cB[y - 1][x - 1]) c++;\n if (x < w - 1 && y < h - 1 && cB[y + 1][x + 1]) c++;\n return c;\n }\n\n for (let y = 0; y < this.height; y++) {\n for (let x = 0; x < this.width; x++) {\n const counter = countNeighbors(x, y);\n const cell = cB[y][x];\n if (cell && counter === 2) bB[y][x] = 1;\n else if (cell && counter === 3) bB[y][x] = 1;\n else if (!cell && counter === 3) bB[y][x] = 1;\n else bB[y][x] = 0;\n }\n }\n\n this.currentBufferIndex = backBufferIndex;\n }", "getspeed() {\n\t\tif(this.vars.alive){\n\t\t\treturn distance(this.vars.x,this.vars.y,this.vars.px,this.vars.py);\n\t\t}else{\n\t\t\treturn 0;\n\t\t}\n\t}", "function increaseBallSpeed()\n{\n\tballSpeed = ballSpeed + (2 / numBlocks);\n}", "update() {\n this.counter += (this.incrementor);\n\n if(this.counter % 255 ==0){\n this.incrementor *= -1;\n }\n }", "function motion() {\r\n\t// update time\r\n\tlet d = new Date();\r\n\tlet timeElapsed = d.getTime() - n - instructionDisplayTime;\r\n\t\r\n\tif (timeElapsed > 0) {\r\n\t\r\n\t\t// check if need to display text (130000 means 13s, 10s for each \r\n\t\t// level, 3s for display text)\r\n\t\tif (timeElapsed > (levelTime - 50) + curretLevels*(levelTime + waitLevelTime)) {\r\n\t\t\t// console.log(\"movingballs called curretLevels: \" + curretLevels)\r\n\t\t\tlevelText.alpha = 100;\r\n\t\t};\r\n\t\t\r\n\t\tif (rewardCollided() && rewardPresent){\r\n\t\t\tapp.stage.removeChild(reward);\r\n\t\t\tscale = scale * 2;\r\n\t\t\trewardPresent = false;\r\n\t\t\t// TODO: add a double score message to the screen\r\n\t\t};\r\n\t\t\r\n\t\t// update text\r\n\t\tlet xCo = playerBall.x.toString();\r\n\t\tlet yCo = playerBall.y.toString();\r\n\t\tplayerInfoText.text = \"X: \" + xCo + \" Y: \" + yCo + \" V: \" + playerBallVelocity;\r\n\t\t\r\n\t\t//update score and time\r\n\t\tscoreText.text = \"Score: \" + (timeElapsed - curretLevels*waitLevelTime) * scale;\r\n\t\ttimeText.text = \"Time: \" + \r\n\t\t(1 + Math.floor((timeElapsed - curretLevels*waitLevelTime)/ 1000)) + \"s\";\r\n\t\tlevelInfoText.text = \"Level: \" + (curretLevels + 1);\r\n\t\t\r\n\t\t// update red balls' position\r\n\t\tfor (let j = 0; j < allGraphic.length; j++) {\r\n\t\t\tlet xPos = allGraphic[j].x + allGraphicVelocity[j][0];\r\n\t\t\tlet yPos = allGraphic[j].y + allGraphicVelocity[j][1];\r\n\t\t\tif (xPos > xSize || xPos < 0) {\r\n\t\t\t\tallGraphicVelocity[j][0] = -allGraphicVelocity[j][0];\r\n\t\t\t};\r\n\t\t\tif (yPos > ySize || yPos < 0) {\r\n\t\t\t\tallGraphicVelocity[j][1] = -allGraphicVelocity[j][1];\r\n\t\t\t};\r\n\t\t\tallGraphic[j].x += allGraphicVelocity[j][0];\r\n\t\t\tallGraphic[j].y += allGraphicVelocity[j][1];\r\n\t\t};\r\n\t\t\r\n\t\t// update reward's position\r\n\t\trewardXPos = reward.x;\r\n\t\trewardYPos = reward.y;\r\n\t\t//console.log(\"x: \", rewardXPos);\r\n\t\t//console.log(\"y: \", rewardYPos);\r\n\t\tif (rewardXPos > xSize + 100 || rewardXPos < 0 - 100) {\r\n\t\t\trewardXSpeed = -rewardXSpeed;\r\n\t\t}; \r\n\t\tif (rewardYPos > ySize + 100 || rewardYPos < 0 - 100) {\r\n\t\t\trewardYSpeed = -rewardYSpeed;\r\n\t\t};\r\n\t\treward.x += rewardXSpeed;\r\n\t\treward.y += rewardYSpeed;\r\n\t};\r\n}", "function timeUpdate() {\n timeEngaged += delta();\n}", "calculatePercentages() {\n this.runs.forEach(run => {\n const data = {};\n data.runTime = (run.runningTime / run.totalTime) * 100;\n data.walkTime = 100 - data.runTime;\n data.runDistance = (run.distance / 100) * data.runTime;\n data.walkDistance = run.distance - data.runDistance;\n this.percentages.push(data);\n });\n }", "update(deltaTime){\n \n this.timePassed += deltaTime ;\n this.percentage = this.timePassed/this.time;\n let parcialDist = this.percentage * this.totalDistance;\n\n if(parcialDist>=this.totalDistance){ \n this.animationDone = true;\n }\n\n if(! this.animationDone){\n\n for(let i = 0; i<this.vectors.length;i++){\n if(parcialDist >= this.vectors[i].startDist && parcialDist <= this.vectors[i].endDist){\n this.pointIndex = i;\n break; \n } \n \n }\n \n this.angle = this.getAngle(this.vectors[this.pointIndex].vec, [0,0,1]);\n\n let ratio = (parcialDist-this.vectors[this.pointIndex].startDist)/(this.vectors[this.pointIndex].endDist-this.vectors[this.pointIndex].startDist);\n this.extraVect = [this.vectors[this.pointIndex].vec[0]*ratio,this.vectors[this.pointIndex].vec[1]*ratio,this.vectors[this.pointIndex].vec[2]*ratio];\n this.translateVec = [this.vectors[this.pointIndex].previousPoint[0]+this.extraVect[0], this.vectors[this.pointIndex].previousPoint[1]+this.extraVect[1],this.vectors[this.pointIndex].previousPoint[2]+this.extraVect[2]];\n }\n}", "function calcDist(val){\n\t//Convert time (\"m:(s)s\") to seconds\n\tvar secs = timeToSec(val.time);\n\t//Grab duration of video\n\tvar dur = Popcorn(\"#video\").duration();\n\t//Calculate ratio of time/duration\n\tvar ratio = secs / dur;\n\t//Grab width of timeline in pixels\n\tvar wdth = document.getElementById(\"visualPoints\").style.width;\n\t//Trim for calculations\n\twdth = wdth.substr(0,wdth.length - 2);\n\t//alert(\"Secs: \" + secs + \" Dur: \" + dur + \" Ratio: \" + ratio + \" Width: \" + wdth);\n\t//Return offset value in pixels calculated using ratio\n\treturn (ratio * wdth);\n}", "function C_FrameCounter ()\n{\n this.FrameCounter = 0 ;\n\n // increment frame rate\n this.M_IncreaseFrameCounter = function ()\n {\n this.FrameCounter ++ ;\n return this.FrameCounter ;\n }\n}", "get horizontalSpeed () { \n if (this.pointers.length > 0) \n return this.pointers.reduce((sum, pointer) => {return sum+pointer.horizontalSpeed}, 0) / this.pointers.length;\n else\n return 0;\n }", "function animate() {\n var timeNow = new Date().getTime();\n if (lastTime != 0) {\n\t\tvar elapsed = timeNow - lastTime;\n\n\t\tif(m_animateOn){\n\t\t\tm_animateSquare += (75 * elapsed) / (m_flipfreq * 50) ;\n\t\t\tm_animateEven += (75 * elapsed) / (m_flipfreq * 40) ;\n\t\t\tm_animateOdd += (75 * elapsed) / (m_flipfreq * 20) ;\n\t\t}else{\n\t\t\tif(m_animateSquare > 0){\n\t\t\t\tm_animateSquare -= (75 * elapsed) / (m_flipfreq * 5) ;\n\t\t\t\tif(m_animateSquare < 0){\n\t\t\t\t\tm_animateSquare = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(m_animateEven > 0){\n\t\t\t\tm_animateEven -= (75 * elapsed) / (m_flipfreq * 4) ;\n\t\t\t\tif(m_animateEven < 0){\n\t\t\t\t\tm_animateEven = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(m_animateOdd > 0){\n\t\t\t\tm_animateOdd -= (75 * elapsed) / (m_flipfreq * 2) ;\n\t\t\t\tif(m_animateOdd < 0){\n\t\t\t\t\tm_animateOdd = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n if(m_brightness != settings.brightness){\n var step = ( settings.brightness - m_brightness ) / 4.0;\n m_brightness += step;\n if(m_brightness > maxBrightness){\n m_brightness = maxBrightness;\n }\n if(m_brightness < minBrightness){\n m_brightness = minBrightness;\n }\n }\n\n if(m_contrast != settings.contrast){\n var step = ( settings.contrast - m_contrast ) / 4.0;\n m_contrast += step;\n if(m_contrast > maxContrast){\n m_contrast = maxContrast;\n }\n if(m_contrast < minContrast){\n m_contrast = minContrast;\n }\n }\n\n if(m_gamma != settings.gamma){\n var step = ( settings.gamma - m_gamma ) / 4.0;\n m_gamma += step;\n if( m_gamma > maxGamma ){\n m_gamma = maxGamma;\n }\n if( m_gamma < minGamma ){\n m_gamma = minGamma;\n }\n }\n\n if(settings.zoom != zoomZ) {\n var step = ( settings.zoom - zoomZ ) / 16.0;\n zoomZ += step;\n\n if (zoomZ < m_minZ) {\n zoomZ = m_minZ;\n }\n if (zoomZ > m_maxZ) {\n zoomZ = m_maxZ;\n }\n }\n\t\t\n\t if(settings.transX != transX){\n var step = ( settings.transX - transX ) / 5.0;\n transX += step;\n }\n\n if(settings.transY != transY){\n var step = ( settings.transY - transY ) / 5.0;\n transY += step;\n }\n\n\t\tif(settings.flipH){\n\t\t\t// increase from 0 to pi\n\t\t\tm_rotx += ( 75 *elapsed ) / m_flipfreq;\n\t\t\tif(m_rotx > pi){\n\t\t\t\tm_rotx = pi;\n\t\t\t}\n\t\t}else{\n\t\t\t// decrease from pi to 0\n\t\t\tm_rotx -= ( 75 * elapsed ) / m_flipfreq;\n\t\t\tif(m_rotx < 0.0){\n\t\t\t\tm_rotx = 0.0 \n\t\t\t}\n\t\t}\n\t\tif(settings.flipV){\n\t\t\t// increase from 0 to pi\n\t\t\tm_roty += ( 75 * elapsed ) / m_flipfreq;\n\t\t\tif(m_roty > pi){\n\t\t\t\tm_roty = pi;\n\t\t\t}\n\t\t}else{\n\t\t\t// decrease from pi to 0\n\t\t\tm_roty -= ( 75 * elapsed ) / m_flipfreq;\n\t\t\tif(m_roty < 0.0){\n\t\t\t\tm_roty = 0.0;\n\t\t\t}\n\t\t}\n\n\t\tif(m_rotz < settings.rotation){\n\t\t\tm_rotz += ( 75 * elapsed ) / m_flipfreq;\n\t\t\tif(m_rotz > settings.rotation){\n\t\t\t\t// rotated too far\n\t\t\t\tm_rotz = settings.rotation;\n\t\t\t}\n\t\t}\n\t\tif(m_rotz > settings.rotation){\n\t\t\tm_rotz -= ( 75 * elapsed ) / m_flipfreq;\n\t\t\tif(m_rotz > settings.rotation){\n\t\t\t\t// rotated too far\n\t\t\t\tm_rotz = settings.rotation;\n\t\t\t}\n\t\t}\n }\n\tlastTime = timeNow;\n}", "function getTransitionTime (distance, speed) {\n return distance / speed * 1000;\n}", "renderFrame() {\n\t\t// Context\n\t\tlet ctx = this.ctx;\n\n\t\t// Define style\n\t\tctx.lineWidth = 1;\n\t\tctx.strokeStyle = '#000000';\n\t\tctx.lineCap = 'rounded';\n\n\t\t// Clear old frame\n\t\tctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n\t\t// Render all the values\n\t\t// for each row and col (all derivations)\n\t\tfor(let col = 0; col <= 1; col++) {\n\t\t\tfor(let row = 0; row <= 5; row++) {\n\t\t\t\t// The values of the current derivation\n\t\t\t\tconst data = this.values[col * 6 + row];\n\t\t\t\tconst startX = this.variables.col[col];\n\t\t\t\tconst startY = this.variables.row[row] + this.variables.derivation.hHalf;\n\n\t\t\t\tctx.beginPath();\n\t\t\t\tctx.moveTo(\n\t\t\t\t\tstartX,\n\t\t\t\t\tstartY + data[0]\n\t\t\t\t);\n\n\t\t\t\t// For each pixel\n\t\t\t\tfor(let x = 1; x < data.length; x++) {\n\t\t\t\t\tctx.lineTo(\n\t\t\t\t\t\tstartX + x,\n\t\t\t\t\t\tstartY + data[x]\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tctx.stroke();\n\t\t\t\tctx.closePath();\n\n\t\t\t}\n\t\t}\n\n\t\tfor(let i =0; i < this.values.length; i++) {\n\t\t\t// Set the new value\n\t\t\tthis.values[i][this.rulerPosition] = this.generator.getValue(i);\n\t\t}\n\n\t\t// Draw (clear) both rulers\n\t\tctx.clearRect( this.variables.col[0] + this.rulerPosition+1, 0, this.state().ecgDisplay.rulerWidth, this.canvas.height );\n\t\tctx.clearRect( this.variables.col[1] + this.rulerPosition+1, 0, this.state().ecgDisplay.rulerWidth, this.canvas.height );\n\n\t\tthis.rulerPosition++;\n\t\tthis.rulerPosition %= this.variables.derivation.width;\n\n\t\t// Tell generator that time has passed\n\t\tthis.generator.next();\n\n\t\t// If still running, request next frame\n\t\tif(this.state().isPlaying) {\n\t\t\twindow.requestAnimationFrame(()=>{\n\t\t\t\tthis.renderFrame();\n\t\t\t});\n\t\t}\n\n\t}", "update(_time, delta) {\n const deltaTheta = this[$targetSpherical].theta - this[$spherical].theta;\n const deltaPhi = this[$targetSpherical].phi - this[$spherical].phi;\n const deltaRadius = this[$targetSpherical].radius - this[$spherical].radius;\n const distance = magnitude(deltaTheta, deltaPhi, deltaRadius);\n const frames = delta / FRAME_MILLISECONDS;\n // Velocity represents a scale along [0, 1] that changes based on the\n // acceleration constraint. We only \"apply\" velocity when accelerating.\n // When decelerating, we apply dampening exclusively.\n const applyVelocity = distance > this[$options].decelerationMargin;\n const nextVelocity = Math.min(this[$velocity] + this[$options].acceleration * frames, 1.0);\n if (applyVelocity) {\n this[$velocity] = nextVelocity;\n }\n else if (this[$velocity] > 0) {\n this[$velocity] = Math.max(nextVelocity, 0.0);\n }\n const scale = this[$dampeningFactor] *\n (applyVelocity ? this[$velocity] * frames : frames);\n const scaledDeltaTheta = deltaTheta * scale;\n const scaledDeltaPhi = deltaPhi * scale;\n const scaledDeltaRadius = deltaRadius * scale;\n let incrementTheta = step(ORBIT_STEP_EDGE, Math.abs(scaledDeltaTheta)) * scaledDeltaTheta;\n let incrementPhi = step(ORBIT_STEP_EDGE, Math.abs(scaledDeltaPhi)) * scaledDeltaPhi;\n let incrementRadius = step(ORBIT_STEP_EDGE, Math.abs(scaledDeltaRadius)) * scaledDeltaRadius;\n // NOTE(cdata): If we evaluate enough frames at once, then there is the\n // possibility that the next incremental step will overshoot the target.\n // If that is the case, we just jump straight to the target:\n if (magnitude(incrementTheta, incrementPhi, incrementRadius) > distance) {\n incrementTheta = deltaTheta;\n incrementPhi = deltaPhi;\n incrementRadius = deltaRadius;\n }\n this[$spherical].theta += incrementTheta;\n this[$spherical].phi += incrementPhi;\n this[$spherical].radius += incrementRadius;\n // Derive the new camera position from the updated spherical:\n this[$spherical].makeSafe();\n this[$sphericalToPosition](this[$spherical], this.camera.position);\n this.camera.lookAt(this.target);\n // Dispatch change events only when the camera position changes due to\n // the spherical->position derivation:\n if (!this[$previousPosition].equals(this.camera.position)) {\n this[$previousPosition].copy(this.camera.position);\n this.dispatchEvent({ type: 'change' });\n }\n else {\n this[$targetSpherical].copy(this[$spherical]);\n }\n }", "function colourPointsTime() {\n let start = 511;\n if (frame === start) {\n arrayOf.colourPoints = createColourPoints();\n }\n if (frame >= start) {\n updateColourPoints();\n }\n}", "static render_multi_frame(ds_instance, new_angles_dexter_units, prev_js, js_inc_per_frame, total_frames, frame_number=0, rob){\n if(frame_number > total_frames) { //we're done\n ds_instance.queue_instance.done_with_instruction() //removes the cur instruction_array from queue and if there's more, starts the next instruction.\n }\n else{\n let new_angles = []\n let xyz\n let prev_js_useful_len = Math.min(5, prev_js.length) //we do not handle j6 & 7 here. That's done with render_j6_plus\n for(let joint = 0; joint < prev_js_useful_len; joint++){\n let prev_j = prev_js[joint]\n let j_inc_per_frame = js_inc_per_frame[joint] //might be undefined for j6 and 7\n let inc_to_prev_j = frame_number * j_inc_per_frame\n let j_angle = prev_j + (Number.isNaN(inc_to_prev_j) ? 0 : inc_to_prev_j) //j_angle is in arcseconds\n ds_instance.angles_dexter_units[joint] = j_angle\n //if(joint === 0) { out(\"J\" + joint + \": inc_to_prev_j: \" + Math.round(inc_to_prev_j) +\n // \" j_angle as: \" + Math.round(j_angle) +\n // \" j_angle deg: \" + (Math.round(j_angle) / 3600 ))\n //}\n let angle_degrees = Socket.dexter_units_to_degrees(j_angle, joint + 1)\n if(((joint === 1) || (joint === 2) || (joint === 3)) &&\n sim.hi_rez) {\n angle_degrees *= -1\n }\n new_angles.push(angle_degrees)\n\n /* let j_angle_degrees_rounded = Math.round(angle_degrees)\n let rads = degrees_to_radians(angle_degrees)\n\n switch(joint) {\n case 0:\n sim.J1.rotation.y = rads * -1\n sim_pane_j1_id.innerHTML = j_angle_degrees_rounded\n break;\n case 1:\n sim.J2.rotation.z = rads\n sim_pane_j2_id.innerHTML = j_angle_degrees_rounded * -1\n break;\n case 2:\n sim.J3.rotation.z = rads\n sim_pane_j3_id.innerHTML = j_angle_degrees_rounded * -1\n break;\n case 3:\n sim.J4.rotation.z = rads\n sim_pane_j4_id.innerHTML = j_angle_degrees_rounded * -1\n break;\n case 4:\n sim.J5.rotation.y = rads * -1\n xyz = Kin.J_angles_to_xyz(new_angles, rob.pose)[0] //needed in case 6 and below\n sim_pane_j5_id.innerHTML = j_angle_degrees_rounded\n break;\n case 5:\n if(sim.J6) {\n sim.J6.rotation.z = rads\n }\n sim_pane_j6_id.innerHTML = j_angle_degrees_rounded\n break;\n case 6:\n if(sim.J7) { //330 degrees = 0.05 meters\n let new_xpos = ((angle_degrees * 0.05424483315198377) / 296) * -1 //more precise version from James W aug 25.\n new_xpos *= 10\n //out(\"J7 angle_degrees: \" + angle_degrees + \" new xpos: \" + new_xpos)\n sim.J7.position.setX(new_xpos) //see https://threejs.org/docs/#api/en/math/Vector3\n //all below fail to change render\n //sim.J7.position.x = new_pos\n //sim.J7.updateMatrix() //no effect\n //sim.j7.updateWorldMatrix(true, true)\n // prev new_pos value;\n // ((angle_degrees * 0.05) / 330 ) * -1 //meters of new location\n // but has the below problems\n // x causes no movement, but at least inited correctly\n // y sends the finger to move to outer space upon init, but still visible, however moving j7 doesn't move it\n // z causes the finger to be somewhat dislocated upon dui init, however moving j7 doesn't move it\n //sim.J7.rotation.y = rads\n }\n sim_pane_j7_id.innerHTML = j_angle_degrees_rounded\n if(window.SimBuild) {\n SimBuild.handle_j7_change(angle_degrees, xyz, rob)\n }\n break;\n } */ //end switch\n } //end for loop\n /* let str_length\n let x = xyz[0]\n if(x < 0) { str_length = 6} //so we get the minus sign plus 3 digits after decimal point, ie MM\n else { str_length = 5}\n sim_pane_x_id.innerHTML = (\"\" + x).substring(0, str_length)\n\n let y = xyz[1]\n if(y < 0) { str_length = 6} //so we get the minus sign plus 3 digits after decimal point, ie MM\n else { str_length = 5}\n sim_pane_y_id.innerHTML = (\"\" + y).substring(0, str_length)\n\n let z = xyz[2]\n if(z < 0) { str_length = 6} //so we get the minus sign plus 3 digits after decimal point, ie MM\n else { str_length = 5}\n sim_pane_z_id.innerHTML = (\"\" + z).substring(0, str_length)\n\n //ds_instance.queue_instance.update_show_queue_if_shown() //I *could* do this here and update\n //the current instruction row based on ds_instance.measured_angles_dexter_units\n //but update_show_queue_if_shown just uses the instruction_array's commanded angles and\n //besides, you can see J angles updated every frame in the Sim pane's header.\n //Best to just leave the queue sim alone until actual whole instructions in queue change.\n sim.renderer.render(sim.scene, sim.camera) //tell the graphis to finally draw.\n */\n this.render_j1_thru_j5(ds_instance)\n setTimeout(function() {\n SimUtils.render_multi_frame(ds_instance, new_angles_dexter_units, prev_js, js_inc_per_frame, total_frames, frame_number + 1, rob, false)\n }, SimUtils.ms_per_frame)\n }\n }", "function updateAnimationFrames() {\n\tdragon1 = document.getElementById('dragon1');\n\tdragon2 = document.getElementById('dragon2');\n\tdragon1.innerHTML = \"<img src='img/d1\" + state1 + x + \".svg'/>\";\n\tdragon2.innerHTML = \"<img src='img/d2\" + state2 + x + \".svg'/>\";\n\tif (r == false && x < 9) {\n\t\tx++;\n\t}\n\tif (r == true && x >= 0) {\n\t\tx--;\n\t}\n\tif (x == 9 ) {\n\t\tr = true;\n\t}\n\tif (x == 0) {\n\t\tr = false;\n\t}\n}", "getTotalCycleTime() {\n return this.NS_Green + this.NS_Left + this.EW_Green + this.EW_Left;\n }", "function update() {\n _this.cycleCounter += 1;\n // Update the frame index when the cycle counter has triggered\n if (_this.cycleCounter > _this.CPS) {\n _this.cycleCounter = 0;\n // Update and reset the frame index at the end of the animation\n _this.frameIndex = (_this.frameIndex + 1) % _this.numFrames;\n }\n }", "setCoreParamsAndAnimate() {\n const diff = Math.abs(this.props.target - this.props.initial);\n let steps;\n let stepSize;\n let interval = 0;\n if (this.props.interval) {\n steps = this.props.duration / this.props.interval;\n stepSize = diff / steps;\n interval = this.props.interval;\n } else {\n steps = diff / this.props.stepSize;\n stepSize = this.props.stepSize;\n interval = this.props.duration\n ? this.props.duration / steps\n : DEFAULT_INTERVAL_MSECS;\n }\n // console.log(`To cover difference of ${diff}, with step size, ${stepSize}, need ${steps} steps`);\n this.setState({\n currentNumber: this.props.initial,\n targetNumber: this.props.target,\n interval,\n stepSize,\n isIncrement: this.props.target > this.props.initial,\n }, () => {\n // console.log(`Animating from current number ${this.state.currentNumber}, towards target number ${this.state.targetNumber}`)\n this.animate();\n });\n }", "recalculateValues() {\n this.remainingTime = this.startingTime;\n this.decreasePerInterval = this.startingProgressPercent / this.startingTime;\n }", "function Animator (args) {\n\t\targs = args || {};\n\n\t \tthis.easing = args.easing || function (t) { return t }; // default to linear easing\n\t \tthis.start_pos = args.start || 0;\n\t \tthis.end_pos = args.end || 1;\n\t \tthis.ratio = args.ratio || 0.25; // ratio to total animation --> normalize to 1\n\t \tthis.msec = args.msec || 1000; // default to 1000msec --> 1s\n\t \tthis.order = args.order || 0;\n\n\t \t// Called Flag\n\t \tthis.started = false;\n\n\t \t// Value to be returned\n\t \tthis.value = this.start_pos;\n\n\t \t// Global (local) reference to 'this'\n\t \tvar _this = this;\n\n\t\t// performance.now is guaranteed to increase and gives sub-millisecond resolution\n\t\t// Date.now is susceptible to system clock changes and gives some number of milliseconds resolution\n\t\t_this.start = window.performance.now(); \n\t\tvar delta = _this.end_pos - _this.start_pos; // displacement\n\n\t\tfunction frame() {\n\t\t\tvar now = window.performance.now();\n\t\t\tvar t = (now - _this.start) / _this.msec; // normalize to 0..1\n\n\t\t\tif (t >= 1) { // if animation complete or running over\n\t\t\t\t_this.value = _this.end_pos; // ensure the animation terminates in the specified state\n\t\t\t \treturn;\n\t\t\t}\n\n\t\t\tvar proportion = _this.easing(t); // Call upon the strange magic of your timing function\n\t\t\t\n\t\t\t// delta is our multiplier | this decides our current position relative to starting position\n\t\t\t// update your animation based on this value\n\t\t\t// trig functions are naturally really excited about this,\n\t\t\t// Can I make the whole thing less imperitive? --> Stateless?\n\n\t\t\t_this.value = _this.start_pos + proportion * delta; \t\n\t\t\trequestAnimationFrame(frame); // next frame!\n\t\t}\n\n\t\tthis.animate = function() {\n\t\t\t_this.started = true;\n\t\t\t_this.start = window.performance.now();\n\t\t\trequestAnimationFrame(frame); // you can use setInterval, but this will give a smoother animation --> Call it the first time and it loops forever until return\n\t\t}\n\t}", "updateMetrics() {\n // Update progress bar\n this.setState({\n readyImagesProgress: this.readyImagesCount /\n this.totalImagesCount * 100,\n numReadyImages: this.readyImagesCount,\n renderedImagesProgress: this.renderedImagesCount /\n this.totalImagesCount * 100,\n renderTimer: Date.now() - this.renderStartTime,\n totalTimer: Date.now() - this.fetchStartTime,\n numRenderedImages: this.renderedImagesCount,\n });\n }", "grow() {\n this.r = sin(frameCount * .01) * 100;\n }", "function calculateFPS(timestamp) {\n if (lastRun === 0) {\n lastRun = timestamp;\n return;\n }\n\n updateFPS++;\n\n if (updateFPS === updateFPSth) {\n delta = (timestamp - lastRun) / 1000;\n lastRun = timestamp;\n fps = Math.round(1/delta);\n\n if (fps > 60)\n fps = 60;\n\n updateFPS = 0;\n }\n else {\n lastRun = timestamp;\n }\n }", "function framesPerSecond() {\n floating.unshift(Math.round( 1000 / (new Date().getTime() - frame), 0));\n floating = floating.slice(0, 9);\n return Math.round(floating.average(), 0);\n}", "function move() {\n let id = setInterval(frame, 1);\n function frame() {\n if(m == 60){m = 0};\n h = m + (zl * 60);\n switch(true){ \n case h < 60:\n circle.style.stroke = (`#1d59ff`); // 1\n break;\n case h < 120:\n circle.style.stroke = (`#68c4fa`); // 2\n break;\n case h < 180:\n circle.style.stroke = (`#68faf0`); // 3\n break;\n case h < 240:\n circle.style.stroke = (`#68fab7`); // 4\n break\n case h < 300:\n circle.style.stroke = (`#4CAF50`); // 5\n break;\n case h < 360:\n circle.style.stroke = (`#a5fa68`); // 6\n break;\n case h < 420:\n circle.style.stroke = (`#900080`); // 7\n break;\n case h < 480:\n circle.style.stroke = (`#e9fa68`); // 8\n break\n case h < 540:\n circle.style.stroke = (`#faa668`); // 9 \n break;\n case h <= 599:\n circle.style.stroke = (`#ff6969`); // 10\n break;\n case h < 601:\n circle.style.stroke = (`#d10101`); // fin\n break;\n }\n }\n setProgress(h);\n console.log(h);\n}", "function counterCalculate (){\n playerCounter = 0;\n for(var i = 0; i < playerArr.length; i++){\n playerCounter += playerArr[i].value;\n }\n\n dealerCounter = 0;\n for(var y = 0; y < dealerArr.length; y++){\n dealerCounter += dealerArr[y].value;\n }\n}", "function animate(rads, current) {\n const context = rads.getContext('2d');\n //Starting coordinates\n const x = rads.width / 2; //middle of canvas\n const y = rads.height / 2; //middle of canvas\n const radius = 0.38 * rads.width; //Radius of circle in pixels\n const endNum = rads.getAttribute('data-num');\n const endPercent = +rads.getAttribute('data-num') + +1; //Ending % of circle\n const fullCircle = Math.PI * 2; //= 360 degrees in radians\n const quarterClock = Math.PI / 2; //This equals 25% of a circle used later to move start point from 3 o'clock to 12.\n\n context.lineWidth = 10; // Line width\n context.strokeStyle = rads.getAttribute('data-color'); //Line Color\n\n context.beginPath();\n //https://www.w3schools.com/tags/canvas_arc.asp\n context.arc(x, y, radius, -(quarterClock), ((fullCircle) * current) - quarterClock, false);\n context.stroke(); //Draw the line\n currentPercent++; // +1%\n\n //Canvas Text\n context.font = \"bold \" + (radius * 0.7) + \"px serif\";\n context.textBaseline = \"top\";\n context.textAlign = \"center\";\n context.fillText(endNum, x /*- (x * 0.25)*/ , y - (y * 0.3));\n\n if (currentPercent < endPercent) { //If the +1 didn't put it to the endPercent then do it again, starting at the current percentage\n requestAnimationFrame(() => animate(rads, (currentPercent / 100)));\n }\n context.closePath();\n}", "function speedIncrease() {\n if (score < 2500 && cnvsWidth < 600) {\n speed += 0.002;\n } else if (score < 2500 && cnvsWidth < 1200) {\n speed += 0.005;\n } else if (score < 2500) {\n speed += 0.007;\n } else if (score < 5000 && cnvsWidth < 600) {\n speed += 0.001;\n } else if (score < 5000 && cnvsWidth < 1200) {\n speed += 0.002;\n } else if (score < 5000) {\n speed += 0.002;\n } else if (score < 7500 && cnvsWidth < 600) {\n speed += 0.0005;\n } else if (score < 7500 && cnvsWidth < 1200) {\n speed += 0.0002;\n } else if (score < 7500) {\n speed += 0.001;\n }\n}", "function Animate() {\n\n //stop animating if requested\n if (stop_animating) return;\n \n // request another frame\n requestAnimationFrame(Animate);\n\n // calc elapsed time since last loop\n time.now = performance.now();\n time.elapsed = time.now - time.then;\n\n // if enough time has elapsed and all objects finished rendering, draw the next frame\n if ( (time.elapsed > fps_interval) && (UpdateFinished()) ) {\n\n //add this frame duration to the frame array\n fps_array.push( parseInt(1000/ (time.now - time.then) ) );\n\n // Get ready for next frame by setting then=now, but also adjust for your\n // specified fps_interval not being a multiple of user screen RAF's interval\n //(16.7ms for 60fps for example).\n time.then = time.now - (time.elapsed % fps_interval);\n\n //Draw the frame\n UpdateTimeDisplay();\n DrawFrame();\n }\n}", "function calcMoves() {\n moves++;\n movesSpan.innerText = moves;\n updateStars();\n }", "update(time, delta) {\n }", "function handleUpdate(){\n pCounter = audio.currentTime / audio.duration * 100;\n progress.style.width = pCounter + '%';\n\n durmins = Math.floor(audio.duration / 60);\n dursecs = Math.floor(audio.duration - durmins * 60);\n\n curmins = Math.floor(audio.currentTime / 60);\n cursecs = Math.floor(audio.currentTime - curmins * 60);\n\n // if durmins & curmins are less than 10\n // add an empty string\n if(durmins < 10){\n durmins = '' + durmins\n }else if(curmins < 10){\n curmins = '' + curmins\n }\n\n // add zero (0) if the dursecs & cursecs are less than 10\n if(dursecs < 10){\n dursecs = '0' + dursecs\n }else if(cursecs < 10){\n cursecs = '0' + cursecs\n }\n\n // Add the value of the mins and secs to our span elements\n dur__time.innerHTML = `${durmins}:${dursecs}`;\n cur__time.innerHTML = `${curmins}:${cursecs}`;\n }", "function calculateFps(now) {\n \tvar cur_fps = 1000 / (now - vp.fps.frame);\n \tvp.fps.frame = now;\n \tif (now - vp.fps.update > 1000)\n \t\tvp.fps.update = now; \n \treturn cur_fps; \n}", "function getSpeedMovement() {\n\tfor(var i=ABSCISSA.length;i--;) {\n\t\tspeedTranslation[i] = Math.abs(camera.position.getComponent(i)-positionFinal[i])*DEFAULT_MOVEMENT_CAMERA_SPEED;\n\t\tspeedRotation[i] = Math.abs(camera.rotation.toVector3().getComponent(i)-rotationFinal[i])*DEFAULT_ROTATION_CAMERA_SPEED;\n\t}\n}", "function update_stats() {\n\t\t\t// get time delta if not specified\n\t\t\tif (dtime === undefined) {\n\t\t\t\tvar old = medeactx.time;\n\t\t\t\tmedeactx.time = Date.now() * 0.001;\n\n\t\t\t\tdtime = medeactx.time - old;\n\t\t\t}\n\n\t\t\t// check if the canvas sized changed\n\t\t\tif(medeactx.cached_cw != medeactx.canvas.width) {\n\t\t\t\tmedeactx.cached_cw = medeactx.canvas.width;\n\t\t\t\tmedeactx.frame_flags |= medeactx.FRAME_CANVAS_SIZE_CHANGED;\n\t\t\t}\n\t\t\tif(medeactx.cached_ch != medeactx.canvas.height) {\n\t\t\t\tmedeactx.cached_ch = medeactx.canvas.height;\n\t\t\t\tmedeactx.frame_flags |= medeactx.FRAME_CANVAS_SIZE_CHANGED;\n\t\t\t}\n\n\t\t\tmedeactx._UpdateFrameStatistics(dtime);\n\t\t}", "function calculateFPSNormal() {\n\tvar t = performance.now();\n\tvar dt = t - startTime;\n\t// if elapsed time is greater than 1s\n\tif( dt > 1000 ) {\n\t\t// calculate the frames drawn over the period of time\n\t\tFPSNormal = frames * 1000 / dt;\n\t\t// and restart the values\n\t\tframes = 0;\n\t\tstartTime = t;\n\t}\n\tframes++;\n}", "updateProgress() {\n var state = this.state;\n\n state.runningTime += state.deltaT;\n\n if (this.duration) {\n state.progress = Math.max(0, Math.min(1, state.runningTime / this.duration));\n }\n }", "function timeCount(){\n time += 1;\n fill(0,0,0);\n textAlign(LEFT);\n text(`Time: ${time}`, 20, 20);\n if (time % 1000 == 0){\n poleSpeed += 1;\n if (rrate == 5){\n rrate = 5;\n }\n else{\n rrate -= 5;\n }\n }\n}", "get time ()\n\t{\n\t\tlet speed = parseInt (this.token.actor.data.data.attributes.movement.walk, 10);\n\t\t\n\t\tif (! speed)\n\t\t\tspeed = 30;\n\n\t\treturn speed / this.gridDistance;\n\t}", "function totalRace() {\n return player1Time + player2Time;\n }", "get blendDistance() {}", "getKeyframesRatio(start, end) {\n return (this.frame - start.frame) / (end.frame - start.frame);\n }", "function calcDuration(points) {\n var sum = 0;\n var prev = 0;\n //points.splice(0, 1);\n for (var i = 1; i < points.length; i++) //!!!!!!!!!!!!!!!! i=0 buvo\n {\n var d = durations[prev][points[i]];\n prev = points[i];\n sum += d;\n }\n //points.unshift(0);\n return sum;\n}" ]
[ "0.71802247", "0.56769407", "0.5670698", "0.56258494", "0.5583371", "0.5529605", "0.55150187", "0.55066925", "0.54881376", "0.5478588", "0.5415672", "0.5410037", "0.53956777", "0.539482", "0.5379198", "0.5377735", "0.53744066", "0.53606665", "0.5356631", "0.5353362", "0.5351561", "0.53445673", "0.5331744", "0.53296614", "0.5326162", "0.53205633", "0.52782226", "0.5260273", "0.52575094", "0.5253086", "0.5239607", "0.52384675", "0.5230401", "0.5229579", "0.52268255", "0.52244204", "0.52239317", "0.5220371", "0.5218764", "0.521469", "0.52027404", "0.51983553", "0.5185231", "0.51696754", "0.5168115", "0.5163712", "0.51556367", "0.515236", "0.5142843", "0.5131322", "0.51290315", "0.51200044", "0.5116186", "0.51135164", "0.51129687", "0.5111301", "0.5107755", "0.5106697", "0.5099107", "0.5098017", "0.50926137", "0.508825", "0.50855726", "0.50841135", "0.5076638", "0.50750905", "0.5072088", "0.50680804", "0.5066584", "0.50487655", "0.5042947", "0.50424826", "0.5035511", "0.5031787", "0.5030731", "0.5023675", "0.5015918", "0.5009903", "0.50070584", "0.5003371", "0.5002356", "0.4995404", "0.49875993", "0.49839342", "0.49810442", "0.4977461", "0.49723032", "0.49715814", "0.4970909", "0.4967664", "0.49657652", "0.496235", "0.49622768", "0.49567103", "0.4950406", "0.49493077", "0.4937595", "0.49352297", "0.49342096", "0.49327323" ]
0.71370786
1
Converts RGB array [32,64,128] to HEX string 204080 It's easier to apply HEX color than RGB color.
function rgb2hex(colorArray) { var color = []; for (var i = 0; i < colorArray.length; i++) { var hex = colorArray[i].toString(16); if (hex.length < 2) { hex = "0" + hex; } color.push(hex); } return "#" + color.join(""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "rgbToHex (array) {\n var hexChars = {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 'A', 11: 'B', 12: 'C', 13: 'D', 14: 'E', 15: 'F'};\n var result = '';\n for (var i = 0; i < array.length; i++) {\n var d1 = parseInt(array[i] / 16);\n result += hexChars[d1];\n var d2 = array[i] - (d1 * 16);\n result += hexChars[d2];\n }\n return result;\n }", "function rgb2hex(colorArray) {\n var color = [];\n for (var i = 0; i < colorArray.length; i++) {\n var hex = colorArray[i].toString(16);\n if (hex.length < 2) { hex = \"0\" + hex; }\n color.push(hex);\n }\n return \"#\" + color.join(\"\");\n }", "function convertArrayToHexColor(arrayColor){\n // array -> rgb -> hex\n var rgb = arrayToRGB(arrayColor);\n var hex = rgbToHex(rgb);\n return hex;\n }", "function rgb(...values) {\n let hex = [];\n for (let val of values) {\n if (val > 255) {\n hex.push('FF');\n } else if (val < 0) {\n hex.push('00');\n } else {\n hex.push(val.toString(16).toUpperCase());\n }\n }\n \n return hex.map(a => {\n return a.length < 2 ? a = 0 + a : a;\n }).join('')\n}", "function RGBtoHEX() {\n let Red = parseInt(document.querySelector(\"#rangeRed\").value).toString(16);\n let Green = parseInt(document.querySelector(\"#rangeGreen\").value).toString(\n 16\n );\n let Blue = parseInt(document.querySelector(\"#rangeBlue\").value).toString(16);\n Red = Red.padStart(2, 0);\n Green = Green.padStart(2, 0);\n Blue = Blue.padStart(2, 0);\n console.log(308, Red, Green, Blue);\n document.querySelector(\"#HEXvalue3\").innerHTML = `HEX Value: <span>#${\n Red + Green + Blue\n }</span>`;\n}", "function _convertToHex(rgbArr) {\n if (rgbArr.toString() !== '[object Array]' && rgbArr.length != 3) {\n console.error('rgbArr should be an array with length equals to 3.');\n throw new Error('Invalid parameter');\n }\n var hex = _(rgbArr).map(_hex).reduce(function(prev, curr) {\n return prev + curr;\n });\n return '#' + hex;\n}", "function array2color(a) {return \"rgb(\" + a.join(\",\") + \")\";}", "function convertRgbToHexa() {\n let output = [];\n let arglength = arguments.length;\n if (arglength > 0) {\n let input = arguments;\n for (let i = 0; i < arglength; i++) {\n output.push(arguments[i].toString(16));\n }\n }\n return output;\n}", "function rgbToHex(rgb) \n {\n var hexCode = \"\"; \n for(var i=0; i < rgb.length; i++)\n {\n var hex = parseInt(rgb[i]).toString(16);\n hex = hex.length == 1 ? \"0\" + hex : hex; \n hexCode += hex;\n }\n\n return \"#\" + hexCode;\n }", "function rgbToHex(R,G,B) { return toHex(R)+toHex(G)+toHex(B); }", "function rgb(...rgb){\n return rgb.map(val => val <= 0 ? \"00\" : (val > 255 ? 255 : val).toString(16).toUpperCase()).join(\"\");\n }", "getHexColorValue() {\n let hexRepresentation = _.map(_.slice(this.props.value, 0, 3), (val)=>{\n let hexVal = val.toString(16);\n return hexVal.length === 1 ? '0' + hexVal : hexVal;\n }).join('');\n return '#' + hexRepresentation;\n }", "toHexString() {\n const intR = (this.r * 255) || 0;\n const intG = (this.g * 255) || 0;\n const intB = (this.b * 255) || 0;\n const intA = (this.a * 255) || 0;\n return \"#\" + _1.Scalar.ToHex(intR) + _1.Scalar.ToHex(intG) + _1.Scalar.ToHex(intB) + _1.Scalar.ToHex(intA);\n }", "function GetHexColour($Rgb)\n{\n\tvar $Length = 6\n\treturn ('000000000' + $Rgb.toString(16) ).substr(-$Length);\n}", "function rgbToHex(str) {\n\tcolour = [];\n\tstr.replace(/[a-z())]+/g, '')\n\t\t.split(',')\n\t\t.map(val => {\n\t\t\tlet value = Number(val).toString(16);\n\t\t\tvalue = value < 2 ? `0${value}` : value;\n\t\t\tcolour.push(value);\n\t\t});\n\treturn '#' + colour.join('');\n}", "function rgbToHex(rgb){\n rgb = rgb.replace(\"rgb(\", \"\");\n rgb = rgb.replace(\")\", \"\");\n rgb = rgb.split(\",\");\n\n function deciToHex(rgb) {\n const BASE = 16;\n const ALPHABET = [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"A\", \"B\", \"C\", \"D\", \"E\", \"F\"];\n\n let rightHex = rgb % BASE;\n let leftHex = (rgb - rightHex) / BASE;\n return ALPHABET[leftHex] + ALPHABET[rightHex];\n }\n\n return '#' + deciToHex(rgb[0]) + deciToHex(rgb[1]) + deciToHex(rgb[2]);\n }", "function rgb2hex(r, g, b) {\r\n return [_rgbToPaddedHex(r), _rgbToPaddedHex(g), _rgbToPaddedHex(b)].join('');\r\n}", "function rgb2Hex(s) {\n //@ts-ignore\n return s.match(/[0-9]+/g).reduce(function (a, b) { return a + (b | 256).toString(16).slice(1); }, '#').toString(16);\n}", "function rgbHex(rgb) {\n let hex = '#';\n for (let i = 0; i < 3; i++) {\n hex += d2h(rgb[i]);\n }\n return hex;\n}", "function rgb2Hex(r, g, b) \n{\n var colourHex = \"\";\n var hexArray = new Array( \"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\", \"a\", \"b\", \"c\", \"d\", \"e\", \"f\" );\n var code1 = Math.floor(r*16);\n var code2 = Math.floor(r*256) - code1*16;\n colourHex += hexArray[code1];\n colourHex += hexArray[code2];\n var code1 = Math.floor(g*16);\n var code2 = Math.floor(g*256) - code1*16;\n colourHex += hexArray[code1];\n colourHex += hexArray[code2];\n var code1 = Math.floor(b*16);\n var code2 = Math.floor(b*256) - code1*16;\n colourHex += hexArray[code1];\n colourHex += hexArray[code2];\n return colourHex;\n}", "function rgb2hex(rgb) {\n\t\treturn (0x01000000 + rgb).toString(16).substr(-6).toUpperCase();\n\t}", "function rgb2hex(r, g, b) {\n return [_rgbToPaddedHex(r), _rgbToPaddedHex(g), _rgbToPaddedHex(b)].join('');\n}", "function colorHex(rgb){\n\tvar colorRgb = rgb;\n\tif(/^(rgb|RGB)/.test(colorRgb)){\n\t\tvar aColor = colorRgb.replace(/(?:\\(|\\)|rgb|RGB)*/g,\"\").split(\",\");\n\t\tvar strHex = \"#\";\n\t\tfor(var i=0; i<aColor.length; i++){\n\t\t\tvar hex = Number(aColor[i]).toString(16);\n\t\t\thex = hex<10 ? 0+''+hex :hex;\n\t\t\tif(hex === \"0\"){\n\t\t\t\thex += hex;\n\t\t\t}\n\t\t\tstrHex += hex;\n\t\t}\n\t\tif(strHex.length !== 7){\n\t\t\tstrHex = colorRgb;\n\t\t}\n\t\treturn strHex;\n\t}else if(COLOR_REG.test(colorRgb)){\n\t\tvar aNum = colorRgb.replace(/#/,\"\").split(\"\");\n\t\tif(aNum.length === 6){\n\t\t\treturn colorRgb;\n\t\t}else if(aNum.length === 3){\n\t\t\tvar numHex = \"#\";\n\t\t\tfor(var i = 0; i < aNum.length; i+=1){\n\t\t\t\tnumHex += (aNum[i] + aNum[i]);\n\t\t\t}\n\t\t\treturn numHex;\n\t\t}\n\t}else{\n\t\treturn colorRgb;\n\t}\n}", "function colorsToHexString(colors) {\n\treturn colors.map(c => c.toHex()).join(',')\n}", "function arrayOfHexaColors() {\n let output = [];\n let arglength = arguments.length;\n if (arglength > 0) {\n let input = arguments;\n for (let i = 0; i < arglength; i++) {\n output.push(arguments[i].toString(16));\n }\n }\n return output;\n}", "toHexColor() {\n const R = this.R.toHex().valueOf();\n const G = this.G.toHex().valueOf();\n const B = this.B.toHex().valueOf();\n return new HexColor(`#${R}${G}${B}`);\n }", "function rgb2hex(rgb) {\nvar hex = [\nrgb.r.toString(16),\nrgb.g.toString(16),\nrgb.b.toString(16)\n];\n$.each(hex, function(nr, val) {\nif (val.length === 1) hex[nr] = '0' + val;\n});\nreturn '#' + hex.join('');\n}", "function rgbToHex(colour) {\n var hex = \"#\";\n for (var i in colour) {\n var hexValue = colour[i].toString(16);\n (hexValue.length < 2) ?\n hex += \"0\" + hexValue : hex += hexValue;\n }\n return hex;\n }", "function rgbToHex(rgb){ \r\n\t\tvar hex = Number(rgb).toString(16);\r\n\t\tif (hex.length < 2) {\r\n\t\t hex = \"0\" + hex;\r\n\t\t}\r\n\t\treturn hex;\r\n\t\t}", "function fullColorString(clr, a) {\n return \"#\" + ((Math.ceil(a*255) + 256).toString(16).substr(1, 2) +\n clr.toString().substr(1, 6)).toUpperCase();\n}", "function rgbToHex(col) {\n if (col.charAt(0) == 'r') {\n col = col.replace('rgb(', '').replace(')', '').split(',');\n var r = parseInt(col[0], 10).toString(16);\n var g = parseInt(col[1], 10).toString(16);\n var b = parseInt(col[2], 10).toString(16);\n r = r.length == 1 ? '0' + r : r;\n g = g.length == 1 ? '0' + g : g;\n b = b.length == 1 ? '0' + b : b;\n var colHex = '#' + r + g + b;\n return colHex;\n }\n}", "function toHexString(arr) {\n return Array.prototype.map.call(arr, (x) => (\"00\" + x.toString(16)).slice(-2)).join(\"\");\n}", "function hexlify (arr) {\n return arr.map(function (byte) {\n return ('0' + (byte & 0xFF).toString(16)).slice(-2);\n }).join('');\n}", "function convertToHex(rgb) {\n return '#' + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\n}", "function rgb2hex(rgb) {\r\n return \"#\" + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\r\n }", "function rgbToHexConverter(rgb) {\n const regex = /[\\(|\\)|r|g|b| ]/g\n let rgbString = rgb.replace(regex, '')\n let rgbArr = new Array();\n rgbArr = rgbString.split(\",\");\n const hex = \"#\" + ((1 << 24) + ((+rgbArr[0]) << 16) + ((+rgbArr[1]) << 8) + (+rgbArr[2])).toString(16).slice(1);\n return hex\n}", "function _dec_to_rgb(value) {\r\n var hex_string = \"\";\r\n for (var hexpair = 0; hexpair < 3; hexpair++) {\r\n var myByte = value & 0xFF; // get low byte\r\n value >>= 8; // drop low byte\r\n var nybble2 = myByte & 0x0F; // get low nybble (4 bits)\r\n var nybble1 = (myByte >> 4) & 0x0F; // get high nybble\r\n hex_string += nybble1.toString(16); // convert nybble to hex\r\n hex_string += nybble2.toString(16); // convert nybble to hex\r\n }\r\n return hex_string.toUpperCase();\r\n}", "function _dec_to_rgb(value) {\r\n var hex_string = \"\";\r\n for (var hexpair = 0; hexpair < 3; hexpair++) {\r\n var myByte = value & 0xFF; // get low byte\r\n value >>= 8; // drop low byte\r\n var nybble2 = myByte & 0x0F; // get low nybble (4 bits)\r\n var nybble1 = (myByte >> 4) & 0x0F; // get high nybble\r\n hex_string += nybble1.toString(16); // convert nybble to hex\r\n hex_string += nybble2.toString(16); // convert nybble to hex\r\n }\r\n return hex_string.toUpperCase();\r\n}", "function encodePickingColor(i) {\n return [i + 1 & 255, i + 1 >> 8 & 255, i + 1 >> 16 & 255];\n}", "function rgb(r,g,b){\n return [r,g,b]\n .map(x => {\n if(x >= 255) return 'FF';\n if(x <= 0) return '00';\n\n const hex = x.toString(16);\n return hex.length === 1 ? `0${hex}` : hex;\n }).join('').toUpperCase();\n}", "toHexColor() {\n const R = this.R.toHex().valueOf();\n const G = this.G.toHex().valueOf();\n const B = this.B.toHex().valueOf();\n return new HexColor(`#${R}${G}${B}`);\n }", "function rgbToHex(r, g, b) {\n\t\t return \"#\" + componentToHex(r) + componentToHex(g) + componentToHex(b);\n\t\t}", "function RGBToHex(r, g, b) {\r\n return \"#\" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);\r\n }", "function rgb2Hex(r, g, b){\n return ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1, 7);\n}", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n }", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n }", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n }", "function convertToHex(rgb) {\n return hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\n }", "function rgbToHex(rNum, gNum, bNum) {\n var r = rNum.toString(16);\n var g = gNum.toString(16);\n var b = bNum.toString(16);\n r = r.length < 2 ? '0' + r : r;\n g = g.length < 2 ? '0' + g : g;\n b = b.length < 2 ? '0' + b : b;\n return '#' + r + g + b;\n}", "function colorRGB(){\n var coolor = \"(\"+generarNumero(255)+\",\" + generarNumero(255) + \",\" + generarNumero(255) +\")\";\n return \"rgb\" + coolor;\n }", "function rgbToHex(r, g, b, allow3Char) {\r\n\r\n var hex = [\r\n pad2(mathRound(r).toString(16)),\r\n pad2(mathRound(g).toString(16)),\r\n pad2(mathRound(b).toString(16))\r\n ];\r\n\r\n // Return a 3 character hex if possible\r\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\r\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\r\n }\r\n\r\n return hex.join(\"\");\r\n }", "function rgb2hex(rgb){\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n return \"#\" +\n (\"0\" + parseInt(rgb[1],10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[2],10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[3],10).toString(16)).slice(-2);\n}", "function rgb2Hex(color) {\n // Converts a single value to two-character hexadecimal\n function value2Hex(val) {\n val = Math.round(val).toString(16);\n // Must zero-pad for under-long things\n return color.base == 256 && val.length < 2 ? \"0\" + val : val;\n }\n return \"#\" + value2Hex(color.r) + value2Hex(color.g) + value2Hex(color.b)\n}", "function _rgbToPaddedHex(num) {\r\n num = clamp(num, MAX_COLOR_RGB);\r\n var hex = num.toString(16);\r\n return hex.length === 1 ? '0' + hex : hex;\r\n}", "function rgbToHex(rgb){\n var hex = Number(rgb).toString(16);\n if (hex.length < 2) {\n hex = \"0\" + hex;\n }\n return hex;\n\n function fullColorHex(r,g,b){\n var red = rgbToHex(r);\n var green = rgbToHex(g);\n var blue = rgbToHex(b);\n return red+green+blue;\n }\n}", "function rgbToStringColor( rgb ) {\n return `#${ rgb.r.toString( 16 ).padStart( 2, 0 ) }${ rgb.g.toString( 16 ).padStart( 2, 0 ) }${ rgb.b.toString( 16 ).padStart( 2, 0 ) }`\n}", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [pad2(mathRound(r).toString(16)), pad2(mathRound(g).toString(16)), pad2(mathRound(b).toString(16))];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n }", "function rgbToHex(r, g, b, allow3Char) {\n var hex = [\n Object(_util__WEBPACK_IMPORTED_MODULE_0__['pad2'])(\n Math.round(r).toString(16),\n ),\n Object(_util__WEBPACK_IMPORTED_MODULE_0__['pad2'])(\n Math.round(g).toString(16),\n ),\n Object(_util__WEBPACK_IMPORTED_MODULE_0__['pad2'])(\n Math.round(b).toString(16),\n ),\n ];\n // Return a 3 character hex if possible\n if (\n allow3Char &&\n hex[0].startsWith(hex[0].charAt(1)) &&\n hex[1].startsWith(hex[1].charAt(1)) &&\n hex[2].startsWith(hex[2].charAt(1))\n ) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n return hex.join('');\n }", "function toHexa(olColor) {\n var hex = '#';\n for (var i = 0; i < 3; i++) {\n var part = olColor[i].toString(16);\n if (part.length === 1) {\n hex += '0';\n }\n hex += part;\n }\n return hex;\n }", "function rgbToHex(r, g, b, allow3Char) {\n\n\t\t\tvar hex = [\n\t\t\t\t\tpad2(mathRound(r).toString(16)),\n\t\t\t\t\tpad2(mathRound(g).toString(16)),\n\t\t\t\t\tpad2(mathRound(b).toString(16))\n\t\t\t];\n\n\t\t\t// Return a 3 character hex if possible\n\t\t\tif (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n\t\t\t\t\treturn hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n\t\t\t}\n\n\t\t\treturn hex.join(\"\");\n\t}", "function rgbToHex(r, g, b, allow3Char) {\n\n\t\t\tvar hex = [\n\t\t\t\t\tpad2(mathRound(r).toString(16)),\n\t\t\t\t\tpad2(mathRound(g).toString(16)),\n\t\t\t\t\tpad2(mathRound(b).toString(16))\n\t\t\t];\n\n\t\t\t// Return a 3 character hex if possible\n\t\t\tif (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n\t\t\t\t\treturn hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n\t\t\t}\n\n\t\t\treturn hex.join(\"\");\n\t}", "function rgb_to_hex(colorval) {\n var parts = colorval.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n delete(parts[0]);\n for (var i = 1; i < 4; i++) {\n parts[i] = parseInt(parts[i]).toString(16);\n if (parts[i].length == 1) parts[i] = '0' + parts[i];\n }\n return '#' + parts.join('');\n}", "function rgb2hex(rgb){\n rgb = rgb.match(/^rgb\\((\\d+),\\s*(\\d+),\\s*(\\d+)\\)$/);\n return rgb ? \"#\" +\n (\"0\" + parseInt(rgb[1],10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[2],10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[3],10).toString(16)).slice(-2) : '#00000000';\n }", "function toHex(d) {\n let r = djb2('red' + d)\n let g = djb2('green' + d)\n let b = djb2('blue' + d)\n\n let red = Math.abs((r + 85) % 240) + 30\n let green = Math.abs((g + 170) % 240) + 30\n let blue = Math.abs(b % 240) + 30\n\n red = red < 255 ? red : 255\n green = green < 255 ? green : 255\n blue = blue < 255 ? blue : 255\n\n return (\n ('0' + Number(red).toString(16)).slice(-2) +\n ('0' + Number(green).toString(16)).slice(-2) +\n ('0' + Number(blue).toString(16)).slice(-2)\n )\n}", "function rgbToHex(r, g, b, force6Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (!force6Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n }", "function rgbToHex(r, g, b, allow3Char) {\n\t\n\t var hex = [\n\t pad2(mathRound(r).toString(16)),\n\t pad2(mathRound(g).toString(16)),\n\t pad2(mathRound(b).toString(16))\n\t ];\n\t\n\t // Return a 3 character hex if possible\n\t if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n\t return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n\t }\n\t\n\t return hex.join(\"\");\n\t}", "function rgbToHex(r, g, b, allow3Char) {\n\t\n\t var hex = [\n\t pad2(mathRound(r).toString(16)),\n\t pad2(mathRound(g).toString(16)),\n\t pad2(mathRound(b).toString(16))\n\t ];\n\t\n\t // Return a 3 character hex if possible\n\t if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n\t return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n\t }\n\t\n\t return hex.join(\"\");\n\t}", "function rgbToHex(r, g, b, allow3Char) {\n\t\n\t var hex = [\n\t pad2(mathRound(r).toString(16)),\n\t pad2(mathRound(g).toString(16)),\n\t pad2(mathRound(b).toString(16))\n\t ];\n\t\n\t // Return a 3 character hex if possible\n\t if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n\t return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n\t }\n\t\n\t return hex.join(\"\");\n\t}", "function rgbToHex(r, g, b, allow3Char) {\n var hex = [(0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .FZ)(Math.round(r).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .FZ)(Math.round(g).toString(16)), (0,_util__WEBPACK_IMPORTED_MODULE_0__/* .pad2 */ .FZ)(Math.round(b).toString(16))];\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n return hex.join('');\n}", "function _rgbToPaddedHex(num) {\n num = (0,_clamp__WEBPACK_IMPORTED_MODULE_0__.clamp)(num, _consts__WEBPACK_IMPORTED_MODULE_1__.MAX_COLOR_RGB);\n var hex = num.toString(16);\n return hex.length === 1 ? '0' + hex : hex;\n}", "function reddify(rgbArr){ //todo3 //needs to take in an array parameter\n rgbArr[RED] = 255 //use array with this\n }", "function rgbToHex(r, g, b, allow3Char) {\n var hex = [pad2(mathRound(r).toString(16)), pad2(mathRound(g).toString(16)), pad2(mathRound(b).toString(16))]; // Return a 3 character hex if possible\n\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n } // `rgbaToHex`", "function rgbToHex(r, g, b, allow3Char) {\n var hex = [pad2(mathRound(r).toString(16)), pad2(mathRound(g).toString(16)), pad2(mathRound(b).toString(16))]; // Return a 3 character hex if possible\n\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n } // `rgbaToHex`", "function _rgbToPaddedHex(num) {\n num = clamp(num, MAX_COLOR_RGB);\n const hex = num.toString(16);\n\n return hex.length === 1 ? \"0\" + hex : hex;\n}", "function rgbToHex(r, g, b, allow3Char) {\n\t var hex = [\n\t pad2(Math.round(r).toString(16)),\n\t pad2(Math.round(g).toString(16)),\n\t pad2(Math.round(b).toString(16)),\n\t ];\n\t // Return a 3 character hex if possible\n\t if (allow3Char &&\n\t hex[0].startsWith(hex[0].charAt(1)) &&\n\t hex[1].startsWith(hex[1].charAt(1)) &&\n\t hex[2].startsWith(hex[2].charAt(1))) {\n\t return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n\t }\n\t return hex.join('');\n\t}", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n }", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n }", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n }", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n }", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n }", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n }", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n }", "function rgb2hex(rgb) {\n return \"#\" + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\n }", "function hex(x) {\n for (var i = 0; i < x.length; i++)\n x[i] = makeHex(x[i]);\n return x.join('');\n}", "function rgbToHex(r, g, b, allow3Char) {\n var hex = [\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(r).toString(16)),\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(g).toString(16)),\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(b).toString(16)),\n ];\n // Return a 3 character hex if possible\n if (allow3Char &&\n hex[0].startsWith(hex[0].charAt(1)) &&\n hex[1].startsWith(hex[1].charAt(1)) &&\n hex[2].startsWith(hex[2].charAt(1))) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n return hex.join('');\n}", "function rgbToHex(r, g, b, allow3Char) {\n var hex = [\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(r).toString(16)),\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(g).toString(16)),\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(b).toString(16)),\n ];\n // Return a 3 character hex if possible\n if (allow3Char &&\n hex[0].startsWith(hex[0].charAt(1)) &&\n hex[1].startsWith(hex[1].charAt(1)) &&\n hex[2].startsWith(hex[2].charAt(1))) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n return hex.join('');\n}", "function rgbToHex(r, g, b, allow3Char) {\n var hex = [\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(r).toString(16)),\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(g).toString(16)),\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(b).toString(16)),\n ];\n // Return a 3 character hex if possible\n if (allow3Char &&\n hex[0].startsWith(hex[0].charAt(1)) &&\n hex[1].startsWith(hex[1].charAt(1)) &&\n hex[2].startsWith(hex[2].charAt(1))) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n return hex.join('');\n}", "function rgbToHex(r, g, b, allow3Char) {\n var hex = [\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(r).toString(16)),\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(g).toString(16)),\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(b).toString(16)),\n ];\n // Return a 3 character hex if possible\n if (allow3Char &&\n hex[0].startsWith(hex[0].charAt(1)) &&\n hex[1].startsWith(hex[1].charAt(1)) &&\n hex[2].startsWith(hex[2].charAt(1))) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n return hex.join('');\n}", "function rgbToHex(r, g, b, allow3Char) {\n var hex = [\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(r).toString(16)),\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(g).toString(16)),\n (0,_util__WEBPACK_IMPORTED_MODULE_0__.pad2)(Math.round(b).toString(16)),\n ];\n // Return a 3 character hex if possible\n if (allow3Char &&\n hex[0].startsWith(hex[0].charAt(1)) &&\n hex[1].startsWith(hex[1].charAt(1)) &&\n hex[2].startsWith(hex[2].charAt(1))) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n return hex.join('');\n}", "function colorRGBToHex(rgb){\n var color = rgb.toString().match(/\\d+/g);\n var hex = \"#\";\n for (var i = 0; i < 3; i++) {\n hex += (\"0\" + Number(color[i]).toString(16)).slice(-2);\n }\n return hex;\n}", "function thememount_rgbToHex( rgb ) {\n\trgb = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n\treturn (rgb && rgb.length === 4) ? \"#\" +\n\t(\"0\" + parseInt(rgb[1],10).toString(16)).slice(-2) +\n\t(\"0\" + parseInt(rgb[2],10).toString(16)).slice(-2) +\n\t(\"0\" + parseInt(rgb[3],10).toString(16)).slice(-2) : '';\n}", "function rgb2Hex(rgb) {\n return \"#\" + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\n}", "function rgbTohex(r, g, b) {\r\n return \"#\" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);\r\n}", "function rgb2hex(rgb){\n rgb = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\n return (rgb && rgb.length === 4) ? \"#\" +\n (\"0\" + parseInt(rgb[1],10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[2],10).toString(16)).slice(-2) +\n (\"0\" + parseInt(rgb[3],10).toString(16)).slice(-2) : '';\n}", "function convertToHex (rgb) {\n return hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);\n}", "function rgbString2hex(rgb){\r\n rgb = rgb.match(/^rgba?[\\s+]?\\([\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?,[\\s+]?(\\d+)[\\s+]?/i);\r\n return (rgb && rgb.length === 4) ? '#' +\r\n ('0' + parseInt(rgb[1],10).toString(16)).slice(-2) +\r\n ('0' + parseInt(rgb[2],10).toString(16)).slice(-2) +\r\n ('0' + parseInt(rgb[3],10).toString(16)).slice(-2) : '';\r\n }", "intToRGB(i){\n var c = (i & 0x00FFFFFF)\n .toString(16)\n .toUpperCase();\n\n return \"00000\".substring(0, 6 - c.length) + c;\n }", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n}", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n}", "function rgbToHex(r, g, b, allow3Char) {\n\n var hex = [\n pad2(mathRound(r).toString(16)),\n pad2(mathRound(g).toString(16)),\n pad2(mathRound(b).toString(16))\n ];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join(\"\");\n}" ]
[ "0.7556023", "0.73206246", "0.71314526", "0.71244615", "0.7061715", "0.7028961", "0.70205355", "0.6992772", "0.6978075", "0.6971078", "0.6907708", "0.68681127", "0.68507344", "0.6831597", "0.65897954", "0.6584251", "0.6574992", "0.65680873", "0.65485245", "0.65251356", "0.6515626", "0.65115917", "0.65105754", "0.6510008", "0.6499388", "0.6497772", "0.649696", "0.6481965", "0.6467519", "0.64664435", "0.64537656", "0.6452249", "0.64497", "0.6448811", "0.64413637", "0.64349085", "0.6433432", "0.64328283", "0.64271426", "0.64069957", "0.6397728", "0.63939524", "0.6386212", "0.63838375", "0.6381113", "0.6381113", "0.6381113", "0.63794005", "0.6377932", "0.63736135", "0.6355417", "0.63537484", "0.6351884", "0.63486165", "0.6347948", "0.6344366", "0.63428247", "0.63426274", "0.6334612", "0.6334557", "0.6334557", "0.63322204", "0.6329423", "0.63268334", "0.632063", "0.63138044", "0.63138044", "0.63138044", "0.6311197", "0.63066006", "0.6303892", "0.6301021", "0.6301021", "0.63008237", "0.6300414", "0.6294822", "0.6294822", "0.6294822", "0.6294822", "0.6294822", "0.6294822", "0.6294822", "0.6283165", "0.62823534", "0.62784404", "0.62784404", "0.62784404", "0.62784404", "0.62784404", "0.62723404", "0.62722874", "0.62710994", "0.62640685", "0.62636584", "0.6255929", "0.6255764", "0.62553024", "0.6254415", "0.6254415", "0.6254415" ]
0.7285543
2
==================== Transition Initiator ====================
function startTransition() { clearInterval(transHandler); targetColor = generateRGB(); distance = calculateDistance(currentColor, targetColor); increment = calculateIncrement(distance, fps, duration); transHandler = setInterval(function() { transition(); }, 1000/fps); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function start() {\n classes.isTransition = true;\n original.addEventListener('transitionend', end);\n }", "stateTransition(){return}", "function initTransition(transition) {\r\n const currTransition = JSON.parse(JSON.stringify(newTransition))\r\n\r\n for (let player in currTransition)\r\n currTransition[player].nextState = JSON.parse(JSON.stringify(transition[player].nextState))\r\n \r\n return currTransition\r\n }", "onTransitionStart() {\n this.seed = Math.random() * 45000;\n }", "function startTransition() {\n clearInterval(transHandler);\n \n targetColor\t= generateRGB();\n distance\t= calculateDistance(currentColor, targetColor);\n increment\t= calculateIncrement(distance, fps, duration);\n \n transHandler = setInterval(function() {\n transition();\n }, 1000/fps);\n }", "function Initial () {}", "function Initial () {}", "function Initial () {}", "function main() {\n this.prior = this.current\n this.current = this.current.apply(this, arguments) || this.current\n // Call user transition function, if defined\n if (this.transition) {\n this.transition.apply(this, arguments)\n }\n}", "transitionCompleted() {\n // implement if needed\n }", "function setStart(node, transition) { \n //Set initial start position\n switch(transition) {\n case 'bottom-slide-in':\n node.style.MsTransform = \"translate(\" + 0 + \"px,\" + (window.innerHeight + service.elementHeight/2) + \"px)\";\n node.style.WebkitTransform = \"translate(\" + 0 + \"px,\" + (window.innerHeight + service.elementHeight/2) + \"px)\";\n node.style.MozTransform = \"translate(\" + 0 + \"px,\" + (window.innerHeight + service.elementHeight/2) + \"px)\";\n node.style.transform = \"translate(\" + 0 + \"px,\" + (window.innerHeight + service.elementHeight/2) + \"px)\";\n break;\n case 'top-slide-in':\n node.style.MsTransform = \"translate(\" + 0 + \"px,\" + (-(window.innerHeight + service.elementHeight/2)) + \"px)\";\n node.style.WebkitTransform = \"translate(\" + 0 + \"px,\" + (-(window.innerHeight + service.elementHeight/2)) + \"px)\";\n node.style.MozTransform = \"translate(\" + 0 + \"px,\" + (-(window.innerHeight + service.elementHeight/2)) + \"px)\";\n node.style.transform = \"translate(\" + 0 + \"px,\" + (-(window.innerHeight + service.elementHeight/2)) + \"px)\";\n break;\n case 'right-slide-in':\n node.style.MsTransform = \"translate(\" + (document.body.clientWidth + service.elementWidth/2) + \"px,\" + 0 + \"px)\";\n node.style.WebkitTransform = \"translate(\" + (document.body.clientWidth + service.elementWidth/2) + \"px,\" + 0 + \"px)\";\n node.style.MozTransform = \"translate(\" + (document.body.clientWidth + service.elementWidth/2) + \"px,\" + 0 + \"px)\";\n node.style.transform = \"translate(\" + (document.body.clientWidth + service.elementWidth/2) + \"px,\" + 0 + \"px)\";\n break;\n case 'left-slide-in':\n node.style.MsTransform = \"translate(\" + (-(document.body.clientWidth + service.elementWidth/2)) + \"px,\" + 0 + \"px)\";\n node.style.WebkitTransform = \"translate(\" + (-(document.body.clientWidth + service.elementWidth/2)) + \"px,\" + 0 + \"px)\";\n node.style.MozTransform = \"translate(\" + (-(document.body.clientWidth + service.elementWidth/2)) + \"px,\" + 0 + \"px)\";\n node.style.transform = \"translate(\" + (-(document.body.clientWidth + service.elementWidth/2)) + \"px,\" + 0 + \"px)\";\n break;\n case 'normal-fade-in':\n node.style.opacity = 0;\n break;\n case 'twirl':\n node.style.msTransform = \"scale(0) rotate(720deg)\";\n node.style.WebkitTransform = \"scale(0) rotate(720deg)\";\n node.style.MozTransform = \"scale(0) rotate(720deg)\";\n node.style.transform = \"scale(0) rotate(720deg)\";\n break;\n case 'zoom-in':\n node.parentNode.style.msTransform = \"scale(0)\";\n node.parentNode.style.WebkitTransform = \"scale(0)\";\n node.parentNode.style.MozTransform = \"scale(0)\";\n node.parentNode.style.transform = \"scale(0)\";\n node.style.opacity = 0;\n node.style.msTransform = \"scale(0)\";\n node.style.WebkitTransform = \"scale(0)\";\n node.style.MozTransform = \"scale(0)\";\n node.style.transform = \"scale(0)\";\n break;\n case 'zoom-out':\n node.parentNode.style.msTransform = \"scale(3)\";\n node.parentNode.style.WebkitTransform = \"scale(3)\";\n node.parentNode.style.MozTransform = \"scale(3)\";\n node.parentNode.style.transform = \"scale(3)\";\n node.style.opacity = 0;\n node.style.msTransform = \"scale(3)\";\n node.style.WebkitTransform = \"scale(3)\";\n node.style.MozTransform = \"scale(3)\";\n node.style.transform = \"scale(3)\";\n break;\n case 'grow-in':\n node.parentNode.style.perspective = \"1300px\";\n node.parentNode.style.WebkitPerspective = \"1300px\";\n node.parentNode.style.MozPerspective = \"1300px\";\n node.parentNode.style.WebkitTransformStyle = \"preserve-3d\";\n node.parentNode.style.MozTransformStyle = \"preserve-3d\";\n node.parentNode.style.transformStyle = \"preserve-3d\";\n node.parentNode.style.transform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.WebkitTransform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.MozTransform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.MsTransform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.style.opacity = 0;\n node.style.WebkitTransformStyle = \"preserve-3d\";\n node.style.MozTransformStyle = \"preserve-3d\";\n node.style.transformStyle = \"preserve-3d\";\n node.style.transform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.style.WebkitTransform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.style.MozTransform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.style.MsTransform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n break;\n case 'top-fall-in':\n node.parentNode.style.perspective = \"1300px\";\n node.parentNode.style.WebkitPerspective = \"1300px\";\n node.parentNode.style.MozPerspective = \"1300px\";\n node.parentNode.style.WebkitTransformStyle = \"preserve-3d\";\n node.parentNode.style.MozTransformStyle = \"preserve-3d\";\n node.parentNode.style.transformStyle = \"preserve-3d\";\n node.parentNode.style.transform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.WebkitTransform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.MozTransform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.MsTransform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.style.opacity = 0;\n node.style.WebkitTransformStyle = \"preserve-3d\";\n node.style.MozTransformStyle = \"preserve-3d\";\n node.style.transformStyle = \"preserve-3d\";\n node.style.transform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.style.WebkitTransform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.style.MozTransform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.style.MsTransform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n break;\n case 'side-fall':\n node.parentNode.style.perspective = \"1300px\";\n node.parentNode.style.WebkitPerspective = \"1300px\";\n node.parentNode.style.MozPerspective = \"1300px\";\n node.parentNode.style.WebkitTransformStyle = \"preserve-3d\";\n node.parentNode.style.MozTransformStyle = \"preserve-3d\";\n node.parentNode.style.transformStyle = \"preserve-3d\";\n node.parentNode.style.transform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.WebkitTransform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.MozTransform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.MsTransform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.style.opacity = 0;\n node.style.WebkitTransformStyle = \"preserve-3d\";\n node.style.MozTransformStyle = \"preserve-3d\";\n node.style.transformStyle = \"preserve-3d\";\n node.style.transform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.style.WebkitTransform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.style.MozTransform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.style.MsTransform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n break;\n case '3d-rotate-left':\n node.parentNode.style.perspective = \"1300px\";\n node.parentNode.style.WebkitPerspective = \"1300px\";\n node.parentNode.style.MozPerspective = \"1300px\";\n node.style.opacity = 0;\n node.style.WebkitTransformStyle = \"preserve-3d\";\n node.style.MozTransformStyle = \"preserve-3d\";\n node.style.transformStyle = \"preserve-3d\";\n node.style.transform = \"translateZ(100px) translateX(-30%) rotateY(90deg)\";\n node.style.WebkitTransform = \"translateZ(100px) translateX(-30%) rotateY(90deg)\";\n node.style.MozTransform = \"translateZ(100px) translateX(-30%) rotateY(90deg)\";\n node.style.MsTransform = \"translateZ(100px) translateX(-30%) rotateY(90deg)\";\n node.style.WebkitTransformOrigin = \"0 100%\";\n node.style.MozTransformOrigin = \"0 100%\";\n node.style.transformOrigin = \"0 100%\";\n break;\n case '3d-rotate-right':\n node.parentNode.style.perspective = \"1300px\";\n node.parentNode.style.WebkitPerspective = \"1300px\";\n node.parentNode.style.MozPerspective = \"1300px\";\n node.style.opacity = 0;\n node.style.WebkitTransformStyle = \"preserve-3d\";\n node.style.MozTransformStyle = \"preserve-3d\";\n node.style.transformStyle = \"preserve-3d\";\n node.style.transform = \"translateZ(100px) translateX(30%) rotateY(-90deg)\";\n node.style.WebkitTransform = \"translateZ(100px) translateX(30%) rotateY(-90deg)\";\n node.style.MozTransform = \"translateZ(100px) translateX(30%) rotateY(-90deg)\";\n node.style.MsTransform = \"translateZ(100px) translateX(30%) rotateY(-90deg)\";\n node.style.WebkitTransformOrigin = \"0 -100%\";\n node.style.MozTransformOrigin = \"0 -100%\";\n node.style.transformOrigin = \"0 -100%\";\n break;\n case '3d-sign':\n node.parentNode.style.perspective = \"1300px\";\n node.parentNode.style.WebkitPerspective = \"1300px\";\n node.parentNode.style.MozPerspective = \"1300px\";\n node.style.opacity = 0;\n node.style.WebkitTransformStyle = \"preserve-3d\";\n node.style.MozTransformStyle = \"preserve-3d\";\n node.style.transformStyle = \"preserve-3d\";\n node.style.transform = \"rotateX(-60deg)\";\n node.style.WebkitTransform = \"rotateX(-60deg)\";\n node.style.MozTransform = \"rotateX(-60deg)\";\n node.style.MsTransform = \"rotateX(-60deg)\";\n node.style.WebkitTransformOrigin = \"50% 0\";\n node.style.MozTransformOrigin = \"50% 0\";\n node.style.transformOrigin = \"50% 0\";\n break;\n case 'horizontal-flip':\n node.style.opacity = 0;\n node.style.transform = \"rotateY(-400deg)\";\n node.style.WebkitTransform = \"rotateY(-400deg)\";\n node.style.MozTransform = \"rotateY(-400deg)\";\n node.style.MsTransform = \"rotateY(-400deg)\";\n break;\n case 'super-horizontal-flip':\n node.style.opacity = 0;\n node.style.transform = \"rotateY(-2000deg)\";\n node.style.WebkitTransform = \"rotateY(-2000deg)\";\n node.style.MozTransform = \"rotateY(-2000deg)\";\n node.style.MsTransform = \"rotateY(-2000deg)\";\n break;\n case 'vertical-flip':\n node.style.opacity = 0;\n node.style.transform = \"rotateX(-400deg)\";\n node.style.WebkitTransform = \"rotateX(-400deg)\";\n node.style.MozTransform = \"rotateX(-400deg)\";\n node.style.MsTransform = \"rotateX(-400deg)\";\n break;\n case 'super-vertical-flip':\n node.style.opacity = 0;\n node.style.transform = \"rotateX(-2000deg)\";\n node.style.WebkitTransform = \"rotateX(-2000deg)\";\n node.style.MozTransform = \"rotateX(-2000deg)\";\n node.style.MsTransform = \"rotateX(-2000deg)\";\n break;\n default:\n }\n \n node.style.display = \"block\";\n node.style.display = \"block\";\n node.parentNode.style.display = \"block\";\n node.parentNode.style.display = \"block\";\n \n //Set transition timings\n switch(transition) {\n case 'bottom-slide-in':\n case 'top-slide-in':\n case 'right-slide-in':\n case 'left-slide-in':\n node.style.WebkitTransition = \"all 2s\";\n node.style.transition = \"all 2s\";\n node.style.MozTransition = \"all 2s\";\n service.transitionTime = 2;\n break;\n case 'grow-in':\n node.parentNode.style.WebkitTransition = \"all 2s\";\n node.parentNode.style.transition = \"all 2s\";\n node.parentNode.style.MozTransition = \"all 2s\";\n node.style.WebkitTransition = \"all 2s\";\n node.style.transition = \"all 2s\";\n node.style.MozTransition = \"all 2s\";\n service.transitionTime = 2.2;\n break;\n case 'normal-fade-in':\n case 'twirl':\n node.style.WebkitTransition = \"all 1s\";\n node.style.transition = \"all 1s\";\n node.style.MozTransition = \"all 1s\";\n service.transitionTime = 1.2;\n break;\n case 'top-fall-in':\n case 'side-fall':\n case 'zoom-in':\n case 'zoom-out':\n node.style.WebkitTransition = \"all 1.6s ease-in\";\n node.style.transition = \"all 1.6s ease-in\";\n node.style.MozTransition = \"all 1.6s ease-in\";\n service.transitionTime = 1.8;\n break;\n case '3d-rotate-left':\n case '3d-rotate-right':\n case 'horizontal-flip':\n case 'super-horizontal-flip':\n case 'vertical-flip':\n case 'super-vertical-flip':\n node.style.WebkitTransition = \"all 1.6s\";\n node.style.transition = \"all 1.6s\";\n node.style.MozTransition = \"all 1.6s\";\n service.transitionTime = 1.8;\n case '3d-sign':\n node.style.WebkitTransition = \"all 1.2s\";\n node.style.transition = \"all 1.2s\";\n node.style.MozTransition = \"all 1.2s\";\n service.transitionTime = 1.4;\n default:\n }\n }", "constructor(transitionTime) {\n this.transitionTime = transitionTime;\n }", "async start() {\n const { config, emitter, states } = this;\n\n let curr;\n\n if(config.initial) {\n curr = config.initial;\n } else {\n curr = Object.keys(config.states)[0];\n }\n\n const details = {\n curr : states.get(curr),\n };\n\n await emitter.emit(`enter`, details);\n await emitter.emitSerial(`enter:${curr}`, details);\n\n this.state = curr;\n }", "function startup() {\n\tsceneTransition(\"start\");\n}", "function ArrowViewStateTransition() {}", "during_setup(e) {\n\t\tlet state = e.state;\n\t\tif (state === undefined) state = this.old_state;\n\t\tthis.enter(state);\n\t}", "constructor() {\n super()\n this.state = intialState\n }", "function StreamStateMachine() {\n var _this = this;\n var __arguments = new Array(arguments.length);\n for (var __argumentIndex = 0; __argumentIndex < __arguments.length; ++__argumentIndex) {\n __arguments[__argumentIndex] = arguments[__argumentIndex];\n }\n if (__arguments.length == 0) {\n _this = _super.call(this, fm.liveswitch.StreamState.New) || this;\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.New, fm.liveswitch.StreamState.Initializing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.New, fm.liveswitch.StreamState.Failing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.New, fm.liveswitch.StreamState.Closing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.Initializing, fm.liveswitch.StreamState.Connecting);\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.Initializing, fm.liveswitch.StreamState.Failing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.Initializing, fm.liveswitch.StreamState.Closing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.Connecting, fm.liveswitch.StreamState.Connected);\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.Connecting, fm.liveswitch.StreamState.Failing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.Connecting, fm.liveswitch.StreamState.Closing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.Connected, fm.liveswitch.StreamState.Failing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.Connected, fm.liveswitch.StreamState.Closing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.Closing, fm.liveswitch.StreamState.Failing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.Closing, fm.liveswitch.StreamState.Closed);\n _super.prototype.addTransition.call(_this, fm.liveswitch.StreamState.Failing, fm.liveswitch.StreamState.Failed);\n }\n else {\n throw new fm.liveswitch.Exception('Constructor overload does not exist with specified parameter count/type combination.');\n }\n return _this;\n }", "function setTransitionProperties() {\n TransitionProperties.toState = toState;\n TransitionProperties.toParams = toParams;\n TransitionProperties.fromState = fromState;\n TransitionProperties.fromParams = fromParams;\n TransitionProperties.options = options;\n }", "start() {\n this.stop();\n this.setup();\n this.doUpdate();\n this.interval = setInterval(this.doUpdate.bind(this), transitionDuration);\n }", "started () {}", "function setTransitionProperties() {\n TransitionProperties.next = next;\n TransitionProperties.current = current;\n }", "constructor(transitions, initialState, randomObj) {\n\t\tthis.transitions_ = transitions;\n\t\tthis.currentState_ = initialState;\n\t\tthis.randomObj_ = randomObj || Math;\n\t}", "constructor(target, transition) {\n this.target = target;\n if (transition) this.transition = transition;\n else this.transition = new TweenTransition();\n // this.totalTime = false;\n this.startTime = false;\n this.endTime = false;\n this.startVal = false;\n this.endVal = false;\n // this.lastVal = false;\n this.fieldToAnimate = false;\n this.eventDispatcher = false; // dispatch \"isComplete()\" events\n this.event = false; // \"isComplete\" events\n }", "initializer () {\n this._state = \"dead\"\n this._num2state = []\n this._state2num = {}\n this._groups = []\n this.transitions([\n { state: \"dead\", enter: null, leave: null },\n { state: \"booted\", enter: \"boot\", leave: \"shutdown\" },\n { state: \"latched\", enter: \"latch\", leave: \"unlatch\" },\n { state: \"configured\", enter: \"configure\", leave: \"reset\" },\n { state: \"prepared\", enter: \"prepare\", leave: \"release\" },\n { state: \"started\", enter: \"start\", leave: \"stop\" }\n ])\n this.groups([\n \"BOOT\", \"BASE\", \"RESOURCE\", \"SERVICE\", \"USECASE\"\n ])\n }", "function Transition() {\n /**\n * @type {*}\n */\n this.signals = {};\n this.signals.in = new signals.Signal();\n this.signals.out = new signals.Signal();\n\n /**\n * @type {Boolean}\n */\n this.push = false;\n\n /**\n * @type {Boolean}\n */\n this.replace = true;\n\n /**\n * @type {Boolean}\n */\n this.wait = true;\n\n /**\n * @type {Boolean}\n */\n this.requiresWebGL = false;\n\n PIXI.Container.call(this);\n}", "function revealInit(){\n\t\t$('.reveal-animate').each(function(){\n\t\t\t$(this).addClass('no-transition');\n\t\t\t$(this).data('top', $(this).offset().top + $(this).outerHeight());\n\t\t\t$(this).removeClass('no-transition');\n\t\t});\n\t}", "function revealInit(){\n\t\t$('.reveal-animate').each(function(){\n\t\t\t$(this).addClass('no-transition');\n\t\t\t$(this).data('top', $(this).offset().top + $(this).outerHeight());\n\t\t\t$(this).removeClass('no-transition');\n\t\t});\n\t}", "activate() {\n\n\t\tthis.arbitrate();\n\n\t}", "function connectTransitionGraph() {\n //normalize as with onEntry/onExit\n transitions.forEach(function (t) {\n if (typeof t.onTransition === 'function') {\n t.onTransition = [t.onTransition];\n }\n });\n\n transitions.forEach(function (t) {\n //normalize \"event\" attribute into \"events\" attribute\n if (t.event) {\n t.events = t.event.trim().split(/ +/);\n }\n });\n\n //hook up targets\n transitions.forEach(function (t) {\n if (t.targets || (typeof t.target === 'undefined')) return; //targets have already been set up\n\n if (typeof t.target === 'string') {\n //console.log('here1');\n var target = idToStateMap[t.target];\n if (!target) throw new Error('Unable to find target state with id ' + t.target);\n t.target = target;\n t.targets = [t.target];\n } else if (Array.isArray(t.target)) {\n //console.log('here2');\n t.targets = t.target.map(function (target) {\n if (typeof target === 'string') {\n target = idToStateMap[target];\n if (!target) throw new Error('Unable to find target state with id ' + t.target);\n return target;\n } else {\n return target;\n }\n });\n } else if (typeof t.target === 'object') {\n t.targets = [t.target];\n } else {\n throw new Error('Transition target has unknown type: ' + t.target);\n }\n });\n\n //hook up LCA - optimization\n transitions.forEach(function (t) {\n if (t.targets) t.lcca = getLCCA(t.source, t.targets[0]); //FIXME: we technically do not need to hang onto the lcca. only the scope is used by the algorithm\n\n t.scope = getScope(t);\n //console.log('scope',t.source.id,t.scope.id,t.targets);\n });\n }", "function ConnectionStateMachine() {\n var _this = this;\n var __arguments = new Array(arguments.length);\n for (var __argumentIndex = 0; __argumentIndex < __arguments.length; ++__argumentIndex) {\n __arguments[__argumentIndex] = arguments[__argumentIndex];\n }\n if (__arguments.length == 0) {\n _this = _super.call(this, fm.liveswitch.ConnectionState.New) || this;\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.New, fm.liveswitch.ConnectionState.Initializing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.New, fm.liveswitch.ConnectionState.Failing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.New, fm.liveswitch.ConnectionState.Closing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.Initializing, fm.liveswitch.ConnectionState.Connecting);\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.Initializing, fm.liveswitch.ConnectionState.Failing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.Initializing, fm.liveswitch.ConnectionState.Closing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.Connecting, fm.liveswitch.ConnectionState.Connected);\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.Connecting, fm.liveswitch.ConnectionState.Failing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.Connecting, fm.liveswitch.ConnectionState.Closing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.Connected, fm.liveswitch.ConnectionState.Failing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.Connected, fm.liveswitch.ConnectionState.Closing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.Closing, fm.liveswitch.ConnectionState.Failing);\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.Closing, fm.liveswitch.ConnectionState.Closed);\n _super.prototype.addTransition.call(_this, fm.liveswitch.ConnectionState.Failing, fm.liveswitch.ConnectionState.Failed);\n }\n else {\n throw new fm.liveswitch.Exception('Constructor overload does not exist with specified parameter count/type combination.');\n }\n return _this;\n }", "preStateChange(action){return;}", "dispatch() {\n machine.transition({ state: this.state });\n }", "onTransitionEnd () {\n this.setState((prevState) => {\n return prevState.movingTo ? this.silentState : {}\n })\n\n // set next index if transition buffer has something else\n if (this.transitionBuffer.length > 0) {\n this.gotoSlide(this.transitionBuffer.shift())\n } else {\n // re-start autoplay\n this.setAutoPlay()\n }\n }", "function delayTransitionInComplete() { \n\t\t//setTimeout(transitionInComplete, 0);\n\t\ttransitionInComplete();\n\t}", "performTransition (trans) {\n if (trans === Transition.NullTransition) {\n return\n }\n const id = this.currentState.GetOutputState(trans)\n if (id === StateId.NullStateId) {\n return\n }\n // Update currentState\n this.currentStateId = id\n const state = this.states.find((s) => s.Id === id)\n if (state !== undefined) {\n // Post processing of old state\n this.currentState.DoBeforeLeaving()\n this.currentState = state\n // Reset the state to its desired condition before it can reason or act\n this.currentState.DoBeforeEntering()\n }\n }", "function start(state) { \n service.goNext(state);\n }", "function launchTransition()\n\t\t{\n\t\t\t// delete active_class before change :\n\t\t\t_this.$refs.medias.removeClass(_this._getSetting('classes.active'));\n\n\t\t\t// delete active_class before change :\n\t\t\t_this.$refs.current.addClass(_this._getSetting('classes.active'));\n\n\t\t\t// check transition type :\n\t\t\tif (_this._getSetting('transition') && _this._isNativeTransition(_this._getSetting('transition.callback'))) _this._transition(_this._getSetting('transition.callback'));\n\t\t\telse if (_this._getSetting('transition') && _this._getSetting('transition.callback')) _this._getSetting('transition.callback')(_this);\n\t\t\t\n\t\t\t// callback :\n\t\t\tif (_this._getSetting('onChange')) _this._getSetting('onChange')(_this);\n\t\t\t$this.trigger('slidizle.change', [_this]);\n\n\t\t\t// check if the current if greater than the previous :\n\t\t\tif (_this.$refs.current.index() == 0 && _this.$refs.previous)\n\t\t\t{\n\t\t\t\tif (_this.$refs.previous.index() == _this.$refs.medias.length-1) {\n\t\t\t\t\tif (_this._getSetting('onNext')) _this._getSetting('onNext')(_this);\n\t\t\t\t\t$this.trigger('slidizle.next', [_this]);\n\t\t\t\t} else {\n\t\t\t\t\tif (_this._getSetting('onPrevious')) _this._getSetting('onPrevious')(_this);\n\t\t\t\t\t$this.trigger('slidizle.previous', [_this]);\n\t\t\t\t}\n\t\t\t} else if (_this.$refs.current.index() == _this.$refs.medias.length-1 && _this.$refs.previous)\n\t\t\t{\n\t\t\t\tif (_this.$refs.previous.index() == 0) {\n\t\t\t\t\tif (_this._getSetting('onPrevious')) _this._getSetting('onPrevious')(_this);\n\t\t\t\t\t$this.trigger('slidizle.previous', [_this]);\n\t\t\t\t} else {\n\t\t\t\t\tif (_this._getSetting('onNext')) _this._getSetting('onNext')(_this);\n\t\t\t\t\t$this.trigger('slidizle.next', [_this]);\n\t\t\t\t}\n\t\t\t} else if (_this.$refs.previous) {\n\t\t\t\tif (_this.$refs.current.index() > _this.$refs.previous.index()) {\n\t\t\t\t\tif (_this._getSetting('onNext')) _this._getSetting('onNext')(_this);\n\t\t\t\t\t$this.trigger('slidizle.next', [_this]);\n\t\t\t\t} else {\n\t\t\t\t\tif (_this._getSetting('onPrevious')) _this._getSetting('onPrevious')(_this);\n\t\t\t\t\t$this.trigger('slidizle.previous', [_this]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (_this._getSetting('onNext')) _this._getSetting('onNext')(_this);\n\t\t\t\t$this.trigger('slidizle.next', [_this]);\n\t\t\t}\n\n\t\t\t// init the timer :\n\t\t\tif (_this._getSetting('timeout') && _this.$refs.medias.length > 1 && _this.isPlaying && !_this.timer) {\n\t\t\t\tclearInterval(_this.timer);\n\t\t\t\t_this.timer = setInterval(function() {\n\t\t\t\t\t_this._tick();\n\t\t\t\t}, _this._getSetting('timerInterval'));\n\t\t\t}\n\t\t}", "function setupFsm() {\n // when jumped to drag mode, enter\n fsm.when(\"* -> drag\", function() {});\n fsm.when(\"drag -> *\", function(exit, enter, reason) {\n if (reason == \"drag-finish\") {}\n });\n }", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "started() {}", "function isFirstTransition() {\n return previousState == null;\n }", "function initMenu() {\n // Connect Animation\n window.onStepped.Connect(stepMenu);\n\n // Make buttons do things\n let startbutton = document.getElementById('start_button');\n \n //VarSet('S:Continue', 'yielding')\n buttonFadeOnMouse(startbutton);\n startbutton.onclick = startDemo\n\n\n // run tests for prepar3d integration\n runTests();\n}", "function reactionStart () {\n if (bu2.state != 1) t0 = new Date(); // Falls Animation angeschaltet, neuer Anfangszeitpunkt\n switchButton2(); // Zustand des Schaltknopfs ändern\n if (bu2.state == 1) startAnimation(); // Entweder Animation fortsetzen ...\n else stopAnimation(); // ... oder stoppen\n }", "activate() {}", "function Transition() {\n\n /**\n * The list of transitions associated to a state\n * @private\n */\n var _transitions = {};\n\n /**\n * Add a new transition\n * @private\n * @param {String} event the event that will trigger the transition\n * @param {Function} action the function that is executed\n * @param {Object} scope [optional] the scope in which to execute the action\n * @param {String} next [optional] the name of the state to transit to.\n * @returns {Boolean} true if success, false if the transition already exists\n */\n this.add = function add(event, action, scope, next) {\n\n var arr = [];\n\n if (_transitions[event]) {\n return false;\n }\n\n if (typeof event == \"string\" &&\n typeof action == \"function\") {\n\n arr[0] = action;\n\n if (typeof scope == \"object\") {\n arr[1] = scope;\n }\n\n if (typeof scope == \"string\") {\n arr[2] = scope;\n }\n\n if (typeof next == \"string\") {\n arr[2] = next;\n }\n\n _transitions[event] = arr;\n return true;\n }\n\n return false;\n };\n\n /**\n * Check if a transition can be triggered with given event\n * @private\n * @param {String} event the name of the event\n * @returns {Boolean} true if exists\n */\n this.has = function has(event) {\n return !!_transitions[event];\n };\n\n /**\n * Get a transition from it's event\n * @private\n * @param {String} event the name of the event\n * @return the transition\n */\n this.get = function get(event) {\n return _transitions[event] || false;\n };\n\n /**\n * Execute the action associated to the given event\n * @param {String} event the name of the event\n * @param {params} params to pass to the action\n * @private\n * @returns false if error, the next state or undefined if success (that sounds weird)\n */\n this.event = function event(newEvent) {\n var _transition = _transitions[newEvent];\n if (_transition) {\n _transition[0].apply(_transition[1], toArray(arguments).slice(1));\n return _transition[2];\n } else {\n return false;\n }\n };\n}", "_reflow() {\n this._init();\n }", "function initAction() {\n }", "immediate() {\n this.frame = 0;\n this._timeout = 0;\n const event = transitionEvent(this);\n event.isFastForward = true;\n\n this.events.emit('firstframe', event);\n this.events.emit('secondframe', event);\n this.events.emit('complete', event);\n }", "function MaidQuartersInitiationTransition(C) {\n\tCharacterSetCurrent(C);\n\tC.CurrentDialog = DialogFind(C, \"MaidInitiationTransition\");\n}", "LoadSourceState() {\n\n }", "start () {\n this.stateLoop();\n }", "function switchToParent(){\n\n //check if this is the first transition\n if(parent !== undefined){\n animReplaceParent();\n } else {\n //for the first transition\n animChildToParent();\n }\n\n //set parent events\n parent.allowableEvents = parentEvents.slice();\n}", "function Transition( name )\n {\n this.name = name;\n this.input = [];\n this.output = [];\n // call getTransitionInformation() which makes an asynch XQuery call\n // to obtain the transition record from the PN_Definition. This will establish\n // the value for xmldoc.\n //setTransitionInformation(name);\n //xpathQuery = \"//transitions/transition[@id='\" + this.name + \"']\";\n //Transition.prototype.setTransitionInputs( xpathQuery );\n }", "trigger(event) {\r\n var tr = this.config.states[this.activeState].transitions;\r\n if (tr[event] == undefined) {\r\n throw new Error(\"yryjinug\")\r\n }\r\n this.history1.push(this.activeState);\r\n this.activeState = this.config.states[this.activeState].transitions[event];\r\n this.history2 = [];\r\n\r\n\r\n }", "@action startTransition(node: NavNode): Promise<> {\n if (!node) {\n Log.error(`Attempting to transition to empty node`);\n return Promise.reject();\n }\n\n if (node === this.front) {\n Log.error(`Attempting to transition to the same node`);\n return Promise.reject();\n }\n\n if (this.multistepInProgress) {\n // We're in the middle of executing a multistep transactional transition\n return Promise.resolve();\n }\n\n this.transitionInProgress = true;\n\n const oldFront = this.front;\n if (this.front) {\n if (!!oldFront.element.wrappedRef) {\n this.propagateLifecycleEvent(oldFront.element.wrappedRef, 'componentWillHide');\n }\n }\n\n // We perform the componentWillShow as a mobx reaction because it isn't immediately available\n when('node ref available', () => !!node.element.wrappedRef,\n () => {\n this.propagateLifecycleEvent(node.element.wrappedRef, 'componentWillShow');\n });\n\n return new Promise((resolve) => {\n when('nav card mounted', () => node.element.mounted, () => {\n // Move nodes to the correct z-index as necessary\n if (this.motion === Motion.NONE) {\n this.front = node;\n this.back = null;\n } else if (this.motion === Motion.SLIDE_ON) {\n this.back = this.front;\n this.front = node;\n } else if (this.motion === Motion.SLIDE_OFF) {\n this.back = node;\n }\n\n // TODO custom callbacks\n if (this.motion === Motion.NONE) {\n this.endTransition(node, oldFront);\n resolve();\n return;\n }\n\n let start = 0;\n let end = 1;\n if (this.motion === Motion.SLIDE_OFF) {\n start = 1;\n end = 0;\n }\n this.transitionValue = new Animated.Value(start);\n Animated.timing(this.transitionValue, {\n toValue: end,\n duration: 200,\n useNativeDriver: true,\n }).start(() => {\n this.endTransition(node, oldFront);\n resolve();\n });\n });\n });\n }", "constructor(initialState) {\n /** The allowed transitions */\n this.transitions = [\n // Accepting flaw\n { name: 'approvedByProfessor', from: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.Started.toString(), to: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.WaitingForProfessor.toString(), requiredRoles: [thesis_dais_internship_manager_core_1.RoleType.Professor] },\n { name: 'approvedByCompany', from: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.WaitingForProfessor.toString(), to: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.WaitingForCompany.toString(), requiredRoles: [thesis_dais_internship_manager_core_1.RoleType.Professor] },\n { name: 'confirmed', from: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.WaitingForCompany.toString(), to: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.Confirmed.toString(), requiredRoles: [thesis_dais_internship_manager_core_1.RoleType.Company] },\n { name: 'started', from: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.Confirmed.toString(), to: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.Started.toString() },\n { name: 'ended', from: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.Started.toString(), to: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.Ended.toString() },\n // Professor reject\n { name: 'rejectedByProfessor', from: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.WaitingForProfessor.toString(), to: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.RejectedByProfessor.toString(), requiredRoles: [thesis_dais_internship_manager_core_1.RoleType.Professor] },\n // Company reject\n { name: 'rejectedByCompany', from: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.WaitingForCompany.toString(), to: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.RejectedByCompany.toString(), requiredRoles: [thesis_dais_internship_manager_core_1.RoleType.Company] },\n // Student cancel\n { name: 'canceled', from: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.WaitingForProfessor.toString(), to: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.Canceled.toString(), requiredRoles: [thesis_dais_internship_manager_core_1.RoleType.Student, thesis_dais_internship_manager_core_1.RoleType.Professor] },\n { name: 'canceled', from: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.WaitingForCompany.toString(), to: thesis_dais_internship_manager_core_1.InternshipProposalStatusType.Canceled.toString(), requiredRoles: [thesis_dais_internship_manager_core_1.RoleType.Student, thesis_dais_internship_manager_core_1.RoleType.Professor] },\n ];\n this.stateMachine = new StateMachine({\n init: initialState.toString(),\n transitions: this.transitions\n });\n }", "transitionTo(state) {\n logger.debug(`Transaction state transition ${currentState} --> ${state}`)\n\n if (!VALID_STATE_TRANSITIONS[currentState].includes(state)) {\n throw new KafkaJSNonRetriableError(\n `Transaction state exception: Invalid transition ${currentState} --> ${state}`\n )\n }\n\n stateMachine.emit('transition', { to: state, from: currentState })\n currentState = state\n }", "init() {\n this.initSubject.next(true);\n }", "init() {\n this.timerSlide();\n this.nextClick();\n this.previousClick();\n this.breakSlide();\n this.playSlide();\n this.keybord();\n }", "transitionToUrl(url) {\n this.transitionTo(url);\n }", "function Transition() {\n\n\t\t/**\n\t\t * The list of transitions associated to a state\n\t\t * @private\n\t\t */\n\t\tvar _transitions = {};\n\n\t\t/**\n\t\t * Add a new transition\n\t\t * @private\n\t\t * @param {String} event the event that will trigger the transition\n\t\t * @param {Function} action the function that is executed\n\t\t * @param {Object} scope [optional] the scope in which to execute the action\n\t\t * @param {String} next [optional] the name of the state to transit to.\n\t\t * @returns {Boolean} true if success, false if the transition already exists\n\t\t */\n\t\tthis.add = function add(event, action, scope, next) {\n\n\t\t\tvar arr = [];\n\n\t\t\tif (_transitions[event]) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (typeof event == \"string\"\n\t\t\t\t&& typeof action == \"function\") {\n\n\t\t\t\t\tarr[0] = action;\n\n\t\t\t\t\tif (typeof scope == \"object\") {\n\t\t\t\t\t\tarr[1] = scope;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (typeof scope == \"string\") {\n\t\t\t\t\t\tarr[2] = scope;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (typeof next == \"string\") {\n\t\t\t\t\t\tarr[2] = next;\n\t\t\t\t\t}\n\n\t\t\t\t\t_transitions[event] = arr;\n\t\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t};\n\n\t\t/**\n\t\t * Check if a transition can be triggered with given event\n\t\t * @private\n\t\t * @param {String} event the name of the event\n\t\t * @returns {Boolean} true if exists\n\t\t */\n\t\tthis.has = function has(event) {\n\t\t\treturn !!_transitions[event];\n\t\t};\n\n\t\t/**\n\t\t * Get a transition from it's event\n\t\t * @private\n\t\t * @param {String} event the name of the event\n\t\t * @return the transition\n\t\t */\n\t\tthis.get = function get(event) {\n\t\t\treturn _transitions[event] || false;\n\t\t};\n\n\t\t/**\n\t\t * Execute the action associated to the given event\n\t\t * @param {String} event the name of the event\n\t\t * @param {params} params to pass to the action\n\t\t * @private\n\t\t * @returns false if error, the next state or undefined if success (that sounds weird)\n\t\t */\n\t\tthis.event = function event(event) {\n\t\t\tvar _transition = _transitions[event];\n\t\t\tif (_transition) {\n\t\t\t\t_transition[0].apply(_transition[1], Tools.toArray(arguments).slice(1));\n\t\t\t\treturn _transition[2];\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t};\n\t}", "__previnit(){}", "function prologuetoBattleMapStateChangeStarter() {\n activeGameState.battleMap1ActiveState = battleMap1ActiveState;\n\n store.dispatch( {\n type: DIFFICULTY_CHANGE,\n payload: {\n activeGameState: activeGameState,\n towerTypes: towerTypes\n }\n });\n\n store.dispatch( {\n type: MENU_CHANGE,\n payload: {\n currentPage: 'BATTLE_MAP',\n previousPage: 'PROLOGUE'\n }\n });\n store.dispatch( {\n type: BATTLE_ON,\n payload: {\n battleState: 'BATTLE_ON',\n activeGameState: activeGameState\n }\n });\n }", "function pageTransitionInit() {\r\n\t\t\t\t\t\r\n\t\t\t\t\tif ($('body[data-ajax-transitions=\"true\"]').length > 0 && $('#ajax-loading-screen[data-method=\"standard\"]').length > 0) {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t$('html').addClass('page-trans-loaded');\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Fade loading animation\r\n\t\t\t\t\t\tif ($('#ajax-loading-screen[data-effect=\"standard\"]').length > 0) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ($('.nectar-particles').length == 0) {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t$loadingScreenEl.transition({\r\n\t\t\t\t\t\t\t\t\t'opacity': 0\r\n\t\t\t\t\t\t\t\t}, 500, function () {\r\n\t\t\t\t\t\t\t\t\t$(this).css({\r\n\t\t\t\t\t\t\t\t\t\t'display': 'none'\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\t$('#ajax-loading-screen .loading-icon').transition({\r\n\t\t\t\t\t\t\t\t\t'opacity': 0\r\n\t\t\t\t\t\t\t\t}, 500);\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// Bind waypoints after loading screen has left\r\n\t\t\t\t\t\t\tif ($('.nectar-box-roll').length == 0) {\r\n\t\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\t\twaypoints();\r\n\t\t\t\t\t\t\t\t}, 550);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t} \r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Swipe loading animation\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ($('#ajax-loading-screen[data-effect*=\"horizontal_swipe\"]').length > 0) {\r\n\t\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\t\t$loadingScreenEl.addClass('loaded');\r\n\t\t\t\t\t\t\t\t}, 60);\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\tif ($('#page-header-wrap #page-header-bg[data-animate-in-effect=\"zoom-out\"] .nectar-video-wrap').length == 0) {\r\n\t\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\t\t$('#ajax-loading-screen:not(.loaded)').addClass('loaded');\r\n\t\t\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\t\t\t$loadingScreenEl.addClass('hidden');\r\n\t\t\t\t\t\t\t\t\t}, 1000);\r\n\t\t\t\t\t\t\t\t}, 150);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\r\n\t\t\t\t\t\t\t// Bind waypoints after loading screen has left\r\n\t\t\t\t\t\t\tif ($('.nectar-box-roll').length == 0 && $('#ajax-loading-screen[data-effect*=\"horizontal_swipe\"]').length > 0) {\r\n\t\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\t\twaypoints();\r\n\t\t\t\t\t\t\t\t}, 750);\r\n\t\t\t\t\t\t\t} else if ($('.nectar-box-roll').length == 0) setTimeout(function () {\r\n\t\t\t\t\t\t\t\twaypoints();\r\n\t\t\t\t\t\t\t}, 350);\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\r\n\t\t\t\t\t\t// Safari back/prev fix\r\n\t\t\t\t\t\tif (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || \r\n\t\t\t\t\t\tnavigator.userAgent.match(/(iPod|iPhone|iPad)/)) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\twindow.onunload = function () {\r\n\t\t\t\t\t\t\t\t$loadingScreenEl.stop().transition({\r\n\t\t\t\t\t\t\t\t\t'opacity': 0\r\n\t\t\t\t\t\t\t\t}, 800, function () {\r\n\t\t\t\t\t\t\t\t\t$(this).css({\r\n\t\t\t\t\t\t\t\t\t\t'display': 'none'\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\t$('#ajax-loading-screen .loading-icon').transition({\r\n\t\t\t\t\t\t\t\t\t'opacity': 0\r\n\t\t\t\t\t\t\t\t}, 600);\r\n\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t\twindow.onpageshow = function (event) {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tif (event.persisted) {\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t$loadingScreenEl.stop().transition({\r\n\t\t\t\t\t\t\t\t\t\t'opacity': 0\r\n\t\t\t\t\t\t\t\t\t}, 800, function () {\r\n\t\t\t\t\t\t\t\t\t\t$(this).css({\r\n\t\t\t\t\t\t\t\t\t\t\t'display': 'none'\r\n\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t$('#ajax-loading-screen .loading-icon').transition({\r\n\t\t\t\t\t\t\t\t\t\t'opacity': 0\r\n\t\t\t\t\t\t\t\t\t}, 600);\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\t\r\n\t\t\t\t\t\t\t};\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t} \r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\telse if (navigator.userAgent.indexOf('Firefox') != -1) {\r\n\t\t\t\t\t\t\twindow.onunload = function () {};\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t// Remove excess loading images if using page transitions.\r\n\t\t\t\t\t\t$('.portfolio-loading, .nectar-slider-loading .loading-icon').remove();\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ($('#ajax-loading-screen[data-disable-fade-on-click=\"1\"]').length == 0) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif ($('body.using-mobile-browser #ajax-loading-screen[data-method=\"standard\"][data-disable-mobile=\"1\"]').length == 0) {\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\tvar ignore_onbeforeunload = false;\r\n\t\t\t\t\t\t\t\t$('a[href^=\"mailto\"], a[href^=\"tel\"]').on('click', function () {\r\n\t\t\t\t\t\t\t\t\tignore_onbeforeunload = true;\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\twindow.addEventListener('beforeunload', function () {\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\tif (!ignore_onbeforeunload) {\r\n\t\t\t\t\t\t\t\t\t\t$loadingScreenEl.addClass('set-to-fade');\r\n\t\t\t\t\t\t\t\t\t\ttransitionPage();\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t\tignore_onbeforeunload = false;\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t} \r\n\t\t\t\t\t\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\t// No page transitions\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ($('.nectar-box-roll').length == 0 && !nectarDOMInfo.usingFrontEndEditor) {\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t// Waypoints.\r\n\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\twaypoints();\r\n\t\t\t\t\t\t\t}, 100);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\r\n\t\t\t\t\tfunction transitionPage() {\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif ($('#ajax-loading-screen[data-effect*=\"horizontal_swipe\"]').length > 0) {\r\n\t\t\t\t\t\t\t$loadingScreenEl.removeClass('loaded');\r\n\t\t\t\t\t\t\t$loadingScreenEl.addClass('in-from-right');\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\t$loadingScreenEl.addClass('loaded');\r\n\t\t\t\t\t\t\t}, 30);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t} \r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tif ($('#ajax-loading-screen[data-effect=\"center_mask_reveal\"]').length > 0) {\r\n\t\t\t\t\t\t\t\t$loadingScreenEl.css('opacity', '0').css('display', 'block').transition({\r\n\t\t\t\t\t\t\t\t\t'opacity': '1'\r\n\t\t\t\t\t\t\t\t}, 450);\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\t$loadingScreenEl.show().transition({\r\n\t\t\t\t\t\t\t\t\t'opacity': '1'\r\n\t\t\t\t\t\t\t\t}, 450);\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}", "transitionInCustom() {\n // hello from the other side\n }", "function mainMenuStartButtonStateChangeStarter() {\n store.dispatch( {\n type: MENU_CHANGE,\n payload: {\n currentPage: 'LOAD_SAVED',\n previousPage: 'MAIN_MENU'\n }\n });\n }", "started() {\r\n\r\n\t}", "function setupBehaviors() {\n\t\tfor( evt in transitions ) {\n\t\t\t//console.log(evt);\n\t\t\tvar fromAndTo = [];\n\t\t\tfor( state in transitions[evt] ) {\n\t\t\t\t//console.log(\" \"+state+\" :\"+transitions[evt][state]);\n\n\t\t\t\tfromAndTo.push([state,transitions[evt][state]]);\n\n\t\t\t}\n\t\t\t//here we add listeners for the transitions - first, a log mechanism to help debug\n\t\t\t//window.addEventListener(evt, logListener.bind(this,fromAndTo,evt), false);\n\t\t\twindow.addEventListener(evt, handleListener.bind(this,fromAndTo,evt), false);\n\t\t}\n\t}", "checkOnTransition() {\n this.timeout = 0;\n if( ! this.transitionStarted) {\n console.warn('Transition failed to start for: ', this.cssName, this.target);\n this.cleanup();\n this.events.emit('complete', transitionEvent(this));\n }\n }", "function begin()\n\t\t{\n\t\t\tcurrentRandomTimer = null;\n\t\t\tgenerateRandomSwim();\n\t\t} // end begin()", "init() {\n this.previousSlide();\n this.createControls();\n this.initGestures();\n }", "function start() {\n action(1, 0, 0);\n}", "started() { }", "event(cntx) {\n// console.log('running from super class. Text: '+this._text);\n// this.call('init')('starting')\n try {\n if (!cntx.keystate)\n throw new fsmError(\"FSM error: missing current state\", e)\n let trans = this.eventListener(cntx)\n if (trans) {\n let nextstate = this.gotoNextstate(trans,cntx.logic)\n if (nextstate) {\n this.exitAction(cntx)\n this.effectAction(trans,cntx)\n cntx.keystate = nextstate.key\n this.entryAction(cntx)\n } else {\n throw new fsmError(\"FSM error: next state missing\", e);\n }\n } else {\n this.stayAction(cntx)\n }\n } catch(e) {\n console.log('Error: ' + e.name + \":\" + e.message + \"\\n\" + e.stack);\n } finally {\n let state = cntx.logic.states[cntx.keystate]\n if (state &&\n (!state.hasOwnProperty(\"transitions\") ||\n state.transitions.length == 0)) {\n cntx.complete = true\n }\n return cntx\n }\n }", "started () { this.state = Command.STATE.CREATE; }", "function Transition(path) {\n this.path = path;\n this.abortReason = null;\n this.isAborted = false;\n}", "willTransition() {\n this.refresh();\n console.log(\"WILL TANSITION\");\n }", "makeStart() {\n this.type = Node.START;\n this.state = null;\n }", "function mkdOnWindowLoad() {\n mkdSmoothTransition();\n }", "function StateMachine() {\n this.transitionMap = {};\n this.currentState = \"\";\n\n // Statics related to state change\n this._tList = {};\n this._eventStack = [];\n this._deepTransition = false;\n this._stateToTransition = \"\";\n }", "start() {\n this.isActive = true;\n return new Promise(resolve => {\n this.execute().then(() => {\n this.isActive = false;\n this.shouldSkip = false;\n const nextState = this.getNextState();\n if (this.permittedStates.indexOf(nextState) !== -1) {\n resolve(nextState);\n }\n else {\n AppLogger.log(`you can't switch to ${nextState} from ${this.id}`, AppLoggerMessageType.ERROR);\n }\n });\n });\n }", "detectTransitionType(){\n this.getTransitionType()\n this.toggleTransitionClasses()\n }", "function animateStartup(){\n var myElement = document.getElementById(\"pageTitle\");\n console.log(\"animation block started\")\n document.getElementById(\"pageTitle\").style.animation=\n \"startupAnimation 1s 1\";\n myElement.style.transition=\"top 1.0s linear 0s\";\n myElement.style.top=\"0px\";\n \n}", "function start() {\n status = -1;\n action(1, 0, 0);\n}", "function preMenuPlayButtonStateChangeStarter() {\n store.dispatch( {\n type: MENU_CHANGE,\n payload: {\n currentPage: 'MAIN_MENU',\n previousPage: 'PRE_MENU'\n }\n });\n store.dispatch( {\n type: MUSIC_ON,\n payload: {\n status: 'ON',\n src: mainMenuMusicSource\n }\n });\n store.dispatch( {\n type: SFX_ON,\n payload: {\n status: 'ON',\n }\n });\n }", "function activate() {\n\t\t}", "function transitions_startAnimation(key, value, target, transition) {\n if (transition === void 0) { transition = {}; }\n return value.start(function (onComplete) {\n var delayTimer;\n var controls;\n var animation = transitions_getAnimation(key, value, target, transition, onComplete);\n var delay = getDelayFromTransition(transition, key);\n var start = function () { return (controls = animation()); };\n if (delay) {\n delayTimer = setTimeout(start, secondsToMilliseconds(delay));\n }\n else {\n start();\n }\n return function () {\n clearTimeout(delayTimer);\n controls === null || controls === void 0 ? void 0 : controls.stop();\n };\n });\n}", "function start() {\n validtrans(depObj, allow, reject);\n }", "function start() {\r\n status = -1;\r\n action(1, 0, 0);\r\n}", "function Init() {\n /**\n * SETUP VARIABLE AT FIRST\n */\n an.rubyID = DB.GetRubyID($anim);\n myData = that.data = vData[an.rubyID];\n // Setup initialization timer of object\n if (myData.tsInit == UNDE)\n myData.tsInit = VA.tsCur;\n // Properties & options of object\n var prop = myData.prop, opts = myData.opts;\n an.propEnd = prop[prop.length - 1];\n an.optsEnd = opts[opts.length - 1];\n /**\n * SETUP AFTER START ANIMATION\n */\n SetupStyleBegin();\n Start();\n }", "function Transition(target, key, _) {\n}" ]
[ "0.67823213", "0.66147184", "0.65315574", "0.6438239", "0.6239101", "0.62327784", "0.62327784", "0.62327784", "0.6154615", "0.6144665", "0.6142564", "0.6139299", "0.6124338", "0.6103054", "0.60899705", "0.6081108", "0.6056934", "0.60539234", "0.60092807", "0.59602845", "0.59559405", "0.59471756", "0.5945129", "0.5888566", "0.5882896", "0.5872032", "0.58643675", "0.58643675", "0.58635676", "0.58630055", "0.58610433", "0.585743", "0.5850068", "0.58484983", "0.582918", "0.58212817", "0.5816151", "0.581608", "0.58056873", "0.5800986", "0.5800986", "0.5800986", "0.5800986", "0.5800986", "0.5800986", "0.5800986", "0.5800986", "0.5800986", "0.5800986", "0.5798896", "0.57971674", "0.57957", "0.57947844", "0.57770693", "0.57763106", "0.5774043", "0.57433695", "0.57155937", "0.5712585", "0.5711855", "0.5710069", "0.5708528", "0.57009226", "0.5698145", "0.56742406", "0.5653222", "0.5650928", "0.564806", "0.5624426", "0.5624122", "0.5619958", "0.5619882", "0.5616385", "0.56044906", "0.55686456", "0.5563252", "0.55615324", "0.55535764", "0.5526674", "0.55195826", "0.5519051", "0.5501003", "0.55004317", "0.54940295", "0.5493603", "0.54831374", "0.5476851", "0.5468525", "0.54659337", "0.5456888", "0.5456364", "0.54550743", "0.54547894", "0.54536784", "0.54486597", "0.544864", "0.5448389", "0.544835", "0.5445917", "0.5445633" ]
0.6356494
4
==================== Transition Calculator ====================
function transition() { // checking R if (currentColor[0] > targetColor[0]) { currentColor[0] -= increment[0]; if (currentColor[0] <= targetColor[0]) { increment[0] = 0; } } else { currentColor[0] += increment[0]; if (currentColor[0] >= targetColor[0]) { increment[0] = 0; } } // checking G if (currentColor[1] > targetColor[1]) { currentColor[1] -= increment[1]; if (currentColor[1] <= targetColor[1]) { increment[1] = 0; } } else { currentColor[1] += increment[1]; if (currentColor[1] >= targetColor[1]) { increment[1] = 0; } } // checking B if (currentColor[2] > targetColor[2]) { currentColor[2] -= increment[2]; if (currentColor[2] <= targetColor[2]) { increment[2] = 0; } } else { currentColor[2] += increment[2]; if (currentColor[2] >= targetColor[2]) { increment[2] = 0; } } // applying the new modified color transElement.style.backgroundColor = rgb2hex(currentColor); // transition ended. start a new one if (increment[0] == 0 && increment[1] == 0 && increment[2] == 0) { startTransition(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function transition() {\n generateNewColour();\n\n for (var key in Colour) {\n if(colour[key] > nextColour[key]) {\n colour[key] -= delta[key];\n if(colour[key] <= nextColour[key]) {\n delta[key] = 0;\n }\n }\n else {\n colour[key] += delta[key];\n if(colour[key] >= nextColour[key]) {\n delta[key] = 0;\n }\n }\n }\n }", "function CalculateTransition(parameter, destinyParameter, TransitionSpeed){\n\tif (parameter == destinyParameter) // If the parameter was in the same position of its destiny, return it\n\t\treturn parameter;\n\telse {\n\t\t\n\t\tif (parameter < destinyParameter) // If the parameter is minor than destiny, calculate the half of the track to the front\n\t\t\treturn parameter + Math.ceil((destinyParameter - parameter) / 5);\t\n\t\telse // And if the parameter is minor than destiny, calculate the half of the track to the back\n\t\t\treturn parameter - Math.ceil((parameter - destinyParameter) / 5);\t\n\t}\n\t\n}", "function transition() {\n // checking R\n if (currentColor[0] > targetColor[0]) {\n currentColor[0] -= increment[0];\n if (currentColor[0] <= targetColor[0]) {\n increment[0] = 0;\n }\n } else {\n currentColor[0] += increment[0];\n if (currentColor[0] >= targetColor[0]) {\n increment[0] = 0;\n }\n }\n \n // checking G\n if (currentColor[1] > targetColor[1]) {\n currentColor[1] -= increment[1];\n if (currentColor[1] <= targetColor[1]) {\n increment[1] = 0;\n }\n } else {\n currentColor[1] += increment[1];\n if (currentColor[1] >= targetColor[1]) {\n increment[1] = 0;\n }\n }\n \n // checking B\n if (currentColor[2] > targetColor[2]) {\n currentColor[2] -= increment[2];\n if (currentColor[2] <= targetColor[2]) {\n increment[2] = 0;\n }\n } else {\n currentColor[2] += increment[2];\n if (currentColor[2] >= targetColor[2]) {\n increment[2] = 0;\n }\n }\n \n // applying the new modified color\n transElement.style.backgroundColor = rgb2hex(currentColor);\n \n // transition ended. start a new one\n if (increment[0] == 0 && increment[1] == 0 && increment[2] == 0) {\n startTransition();\n }\n }", "function transition(updateCurrent){\n var next_state = {};\n \n for(var i in current_state){\n next_state[i] = 0;\n }\n \n for(var i in current_state){\n for(var j in transition_model[i]){\n next_state[i] += current_state[j]*transition_model[j][i]\n //console.log(i,j,'=',current_state[j],'*',transition_model[j][i]);\n }\n }\n\n if (updateCurrent){\n current_state = next_state;\n states_array.push(current_state);}\n else {return next_state;}\n }", "function transitionThreeUp(){\n\n}", "applyTransition(percentDone) {\n return percentDone;\n }", "stateTransition(){return}", "calculateTransition(transition) {\n // Start in true state so adding transition can make to uncraftable\n const depth = new Depth({value: 0, craftable: true});\n depth.addTransition(transition);\n transition.depth = depth;\n\n if (transition.newActor) {\n this.setObjectDepth(transition.newActor, depth);\n }\n if (transition.newTarget) {\n this.setObjectDepth(transition.newTarget, depth);\n }\n if (transition.newExtraTarget) {\n this.setObjectDepth(transition.newExtraTarget, depth);\n }\n }", "function Transition() {\n\n /**\n * The list of transitions associated to a state\n * @private\n */\n var _transitions = {};\n\n /**\n * Add a new transition\n * @private\n * @param {String} event the event that will trigger the transition\n * @param {Function} action the function that is executed\n * @param {Object} scope [optional] the scope in which to execute the action\n * @param {String} next [optional] the name of the state to transit to.\n * @returns {Boolean} true if success, false if the transition already exists\n */\n this.add = function add(event, action, scope, next) {\n\n var arr = [];\n\n if (_transitions[event]) {\n return false;\n }\n\n if (typeof event == \"string\" &&\n typeof action == \"function\") {\n\n arr[0] = action;\n\n if (typeof scope == \"object\") {\n arr[1] = scope;\n }\n\n if (typeof scope == \"string\") {\n arr[2] = scope;\n }\n\n if (typeof next == \"string\") {\n arr[2] = next;\n }\n\n _transitions[event] = arr;\n return true;\n }\n\n return false;\n };\n\n /**\n * Check if a transition can be triggered with given event\n * @private\n * @param {String} event the name of the event\n * @returns {Boolean} true if exists\n */\n this.has = function has(event) {\n return !!_transitions[event];\n };\n\n /**\n * Get a transition from it's event\n * @private\n * @param {String} event the name of the event\n * @return the transition\n */\n this.get = function get(event) {\n return _transitions[event] || false;\n };\n\n /**\n * Execute the action associated to the given event\n * @param {String} event the name of the event\n * @param {params} params to pass to the action\n * @private\n * @returns false if error, the next state or undefined if success (that sounds weird)\n */\n this.event = function event(newEvent) {\n var _transition = _transitions[newEvent];\n if (_transition) {\n _transition[0].apply(_transition[1], toArray(arguments).slice(1));\n return _transition[2];\n } else {\n return false;\n }\n };\n}", "currentMotion(){\n\n // an object to hold this function's result\n let result = {\n height:0,\n thighDisplacement:0,\n thighDisplacement2:0,\n kneeDisplacement:0,\n thighOrigin:0,\n thighOrigin2:0,\n kneeOrigin:0,\n }\n // if transition is active, ramp from this.last values to this.current values\n if(this.transition>0){\n result.height=lerp(this.current.height, this.last.height, this.transition);\n result.thighDisplacement=lerp(this.current.thighDisplacement, this.last.thighDisplacement, this.transition);\n result.kneeDisplacement=lerp(this.current.kneeDisplacement, this.last.kneeDisplacement, this.transition);\n result.thighOrigin=lerp(this.current.thighOrigin, this.last.thighOrigin, this.transition);\n result.kneeOrigin=lerp(this.current.kneeOrigin, this.last.kneeOrigin, this.transition);\n result.thighOrigin2=lerp(this.current.thighOrigin2, this.last.thighOrigin2, this.transition);\n result.thighDisplacement2=lerp(this.current.thighDisplacement2, this.last.thighDisplacement2, this.transition);\n this.backHeight = result.height;\n // increment transition by removing 1/length.\n // transition stops when it reaches 0.\n this.transition-=1/this.transitionLength;\n }\n else {\n // if transition isn't active, result becomes current motion values.\n result = this.current;\n this.backHeight = this.current.height;\n }\n // return result\n return result;\n }", "function updateTransitions() {\r\n\r\n if (motion.currentTransition !== nullTransition) {\r\n // is this a new transition?\r\n if (motion.currentTransition.progress === 0) {\r\n // do we have overlapping transitions?\r\n if (motion.currentTransition.lastTransition !== nullTransition) {\r\n // is the last animation for the nested transition the same as the new animation?\r\n if (motion.currentTransition.lastTransition.lastAnimation === avatar.currentAnimation) {\r\n // then sync the nested transition's frequency time wheel for a smooth animation blend\r\n motion.frequencyTimeWheelPos = motion.currentTransition.lastTransition.lastFrequencyTimeWheelPos;\r\n }\r\n }\r\n }\r\n if (motion.currentTransition.updateProgress() === TRANSITION_COMPLETE) {\r\n motion.currentTransition = nullTransition;\r\n }\r\n }\r\n}", "getTransitionMethod (transition) {\n\n switch (transition) {\n // ease linear\n case \"easeLinear\":\n return d3EaseLinear; \n break;\n // easeQuadIn as d3EaseQuadIn,\n case \"easeQuadIn\":\n return d3EaseQuadIn;\n break;\n // easeQuadOut as d3EaseQuadOut\n case \"easeQuadOut\":\n return d3EaseQuadOut;\n break;\n // easeQuadInOut as d3EaseQuadInOut\n case \"easeQuadInOut\":\n return d3EaseQuadInOut;\n break;\n // easeCubicIn as d3EaseCubicIn\n case \"easeCubicIn\":\n return d3EaseCubicIn;\n break;\n // easeCubicOut as d3EaseCubicOut,\n case \"easeCubicOut\":\n return d3EaseCubicOut;\n break;\n // easeCubicInOut as d3EaseCubicInOut,\n case \"easeCubicInOut\":\n return d3EaseCubicInOut;\n break;\n // easePolyIn as d3EasePolyIn,\n case \"easePolyIn\":\n return d3EasePolyIn;\n break;\n // easePolyOut as d3EasePolyOut,\n case \"easePolyOut\":\n return d3EasePolyOut;\n break;\n // easePolyInOut as d3EasePolyInOut,\n case \"easePolyInOut\":\n return d3EasePolyInOut;\n break;\n // easeSinIn as d3EaseSinIn,\n case \"easeSinIn\":\n return d3EaseSinIn;\n break;\n // easeSinOut as d3EaseSinOut,\n case \"easeSinOut\":\n return d3EaseSinOut;\n break;\n // easeSinInOut as d3EaseSinInOut,\n case \"easeSinInOut\":\n return d3EaseSinInOut;\n break;\n // easeExpIn as d3EaseExpIn,\n case \"easeExpIn\":\n return d3EaseExpIn;\n break;\n // easeExpOut as d3EaseExpOut,\n case \"easeExpOut\":\n return d3EaseExpOut;\n break;\n // easeExpInOut as d3EaseExpInOut,\n case \"easeExpInOut\":\n return d3EaseExpInOut;\n break;\n // easeCircleIn as d3EaseCircleIn,\n case \"easeCircleIn\":\n return d3EaseCircleIn;\n break;\n // easeCircleOut as d3EaseCircleOut,\n case \"easeCircleOut\":\n return d3EaseCircleOut;\n break;\n // easeCircleInOut as d3EaseCircleInOut,\n case \"easeCircleInOut\":\n return d3EaseCircleInOut;\n break;\n // easeBounceIn as d3EaseBounceIn,\n case \"easeBounceIn\":\n return d3EaseBounceIn;\n break;\n // easeBounceOut as d3EaseBounceOut,\n case \"easeBounceOut\":\n return d3EaseBounceOut;\n break;\n // easeBounceInOut as d3EaseBounceInOut,\n case \"easeBounceInOut\":\n return d3EaseBounceInOut;\n break;\n // easeBackIn as d3EaseBackIn,\n case \"easeBackIn\":\n return d3EaseBackIn;\n break;\n // easeBackOut as d3EaseBackOut,\n case \"easeBackOut\":\n return d3EaseBackOut;\n break;\n // easeBackInOut as d3EaseBackInOut,\n case \"easeBackInOut\":\n return d3EaseBackInOut;\n break;\n // easeElasticIn as d3EaseElasticIn,\n case \"easeElasticIn\":\n return d3EaseElasticIn;\n break;\n // easeElasticOut as d3EaseElasticOut,\n case \"easeElasticOut\":\n return d3EaseElasticOut;\n break;\n // easeElasticInOut as d3EaseElasticInOut,\n case \"easeElasticInOut\":\n return d3EaseElasticInOut;\n break;\n // easeElastic as d3EaseElastic,\n case \"easeElastic\":\n return d3EaseElastic;\n break;\n\n // ease elastic transition\n case \"easeElastic\":\n return d3EaseElastic; \n break;\n };\n\n }", "getTransition() {\n if ( this.props.finalTab ) {\n return WizardPage.transitions.submit;\n } else {\n return this.getPreferredTransition();\n }\n }", "function transition(source, input, target, output, direction) {\n return 'δ('+source+', '+input+') = ('+target+', '+output+', '+direction+')';\n }", "function ArrowViewStateTransition() {}", "function updateTransition() {\r\n\r\n if (motion.currentTransition !== nullTransition) {\r\n\r\n // new transition?\r\n if (motion.currentTransition.progress === 0) {\r\n\r\n // overlapping transitions?\r\n if (motion.currentTransition.lastTransition !== nullTransition) {\r\n\r\n // is the last animation for the nested transition the same as the new animation?\r\n if (motion.currentTransition.lastTransition.lastAnimation === motion.currentAnimation) {\r\n\r\n // sync the nested transitions's frequency time wheel for a smooth animation blend\r\n motion.frequencyTimeWheelPos = motion.currentTransition.lastTransition.lastFrequencyTimeWheelPos;\r\n }\r\n }\r\n\r\n if (motion.currentTransition.lastAnimation === motion.selectedWalk) {\r\n\r\n // decide at which angle we should stop the frequency time wheel\r\n var stopAngle = motion.selectedWalk.calibration.stopAngleForwards;\r\n var percentToMove = 0;\r\n var lastFrequencyTimeWheelPos = motion.currentTransition.lastFrequencyTimeWheelPos;\r\n var lastElapsedFTDegrees = motion.currentTransition.lastElapsedFTDegrees;\r\n\r\n // set the stop angle depending on which quadrant of the walk cycle we are currently in\r\n // and decide whether we need to take an extra step to complete the walk cycle or not\r\n // - currently work in progress\r\n if(lastFrequencyTimeWheelPos <= stopAngle && lastElapsedFTDegrees < 180) {\r\n\r\n // we have not taken a complete step yet, so we do need to do so before stopping\r\n percentToMove = 100;\r\n stopAngle += 180;\r\n\r\n } else if(lastFrequencyTimeWheelPos > stopAngle && lastFrequencyTimeWheelPos <= stopAngle + 90) {\r\n\r\n // take an extra step to complete the walk cycle and stop at the second stop angle\r\n percentToMove = 100;\r\n stopAngle += 180;\r\n\r\n } else if(lastFrequencyTimeWheelPos > stopAngle + 90 && lastFrequencyTimeWheelPos <= stopAngle + 180) {\r\n\r\n // stop on the other foot at the second stop angle for this walk cycle\r\n percentToMove = 0;\r\n if (motion.currentTransition.lastDirection === BACKWARDS) {\r\n\r\n percentToMove = 100;\r\n\r\n } else {\r\n\r\n stopAngle += 180;\r\n }\r\n\r\n } else if(lastFrequencyTimeWheelPos > stopAngle + 180 && lastFrequencyTimeWheelPos <= stopAngle + 270) {\r\n\r\n // take an extra step to complete the walk cycle and stop at the first stop angle\r\n percentToMove = 100;\r\n }\r\n\r\n // set it all in motion\r\n motion.currentTransition.stopAngle = stopAngle;\r\n motion.currentTransition.percentToMove = percentToMove;\r\n }\r\n\r\n } // end if new transition\r\n\r\n // update the Transition progress\r\n if (motion.currentTransition.updateProgress() >= 1) {\r\n\r\n // it's time to kill off this transition\r\n delete motion.currentTransition;\r\n motion.currentTransition = nullTransition;\r\n }\r\n }\r\n}", "detectTransitionType(){\n this.getTransitionType()\n this.toggleTransitionClasses()\n }", "function stateTransition(oldState, votes) {\n return oldState;\n}", "function change() {\n //Depending on which botton was checked is the respected\n //transition function called\n if (this.value == 2016) { \n transition2016();\n } else if (this.value == 2014) {\n transition2014();\n } else{\n transition2006(); \n }\n}", "calcStateChange(currentState, workersStates) {\n const nextState = STATE_HANDLERS[currentState](workersStates);\n return (nextState !== currentState)\n ? { type: CONTROL_ACTION_KEYS.SET_STATE, data: nextState } : null;\n }", "function CalculateScaleTransition(parameter, destinyParameter, TransitionSpeed){\n\t// Setting the transition speed\n\tif(TransitionSpeed == \"fast-background\")\n\t\tparameterChange = 0.05;\n\telse\n\t\tparameterChange = 0.01;\n\tif (parameter.toFixed(2) == destinyParameter.toFixed(2)) // If the parameter was in the same position of its destiny, return it\n\t\treturn parameter;\n\telse {\n\t\t\n\t\tif (parameter < destinyParameter) // If the parameter is minor than destiny, calculate the half of the track to the front\n\t\t\n\t\t\t//return parameter + roundValueToDigits((destinyParameter - parameter) / 5) + 0.01;\t\n\t\t\treturn roundValueToDigits(parameter + parameterChange);\t\n\t\telse // And if the parameter is minor than destiny, calculate the half of the track to the back\n\t\t\t//return parameter - roundValueToDigits((parameter - destinyParameter) / 5) - 0.01;\t\n\t\t\treturn roundValueToDigits(parameter - parameterChange);\t\n\t}\n}", "function getTransition(properties, duration, easing, type){\n\t\tvar ob = parse(properties);\n\t\tob[0].isTransition = type || 1;\n\t\tob[0].useAll = true;\n\t\treturn getCSS(ob, duration, easing);\n\t}", "function convertTransition(edge) {\n\t\tif(!visitedEdges.includes(edge)){\n\t\t\tvisitedEdges.push(edge);\n\t\t}else{\n\t\t\talert('This transitition has already been converted');\n\t\t\treturn;\n\t\t}\n\t\tvar transitions = toColonForm(edge.label()).split('<br>');\n\t\tfunction setTableValue (a, b, c) {\n\t\t\ttable.value(lastRow, 0, a);\n\t\t\ttable.value(lastRow, 1, b);\n\t\t\ttable.value(lastRow, 2, c);\n\t\t\ttable._arrays[lastRow].show();\n\t\t\tlastRow++;\n\t\t}\n\t\tfor(var i = 0; i < transitions.length; i++){\n\t\t\tvar transition = transitions[i];\n\t\t\tvar transitionSplit = transition.split(':');\n\t\t\tvar fromNode = edge.start();\n\t\t\tvar toNode = edge.end();\n\t\t\tvar qi = fromNode.value();\n\t\t\tvar qj = toNode.value();\n\t\t\tif(increaseOne.indexOf(transition) > -1) {\n\t\t\t\tvar states = g.nodes();\n\t\t\t\tfor (var k = 0; k < states.length; k++) {\n\t\t\t\t\tvar qk = states[k].value();\n\t\t\t\t\tfor (var l = 0; l < states.length; l++) {\n\t\t\t\t\t\tvar ql = states[l].value();\n\t\t\t\t\t\t// format ['', '', ['','','']]\n\t\t\t\t\t\tproductions.push(['(' + qi + transitionSplit[1] + qk + ')', arrow, [transitionSplit[0] , '(' + qj + transitionSplit[2][0] + ql + ')' , '(' + ql + transitionSplit[2][1] + qk + ')']]);\n\t\t\t\t\t\tsetTableValue('(' + qi + transitionSplit[1] + qk + ')', arrow, transitionSplit[0] + '(' + qj + transitionSplit[2][0] + ql + ')' + '(' + ql + transitionSplit[2][1] + qk + ')');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tproductions.push(['(' + qi + transitionSplit[1] + qj + ')', arrow, [transitionSplit[0]]]);\n\t\t\t\tsetTableValue('(' + qi + transitionSplit[1] + qj + ')', arrow, transitionSplit[0]);\n\t\t\t}\n\t\t\ttable.layout();\n\t\t}\n\t\tcount++;\n\t\tif(count >= g.edges().length){\n\t\t\tjsav.umsg('Finished');\n\t\t\talert('All transitions have been converted, export to grammar editor?');\n\t\t\tproductions = removeUseless(productions);\n\n\t\t\tvar reducedTable = jsav.ds.matrix(productions, {style: \"table\"});\n\t\t\treducedTable.layout();\n\t\t\t$(\".jsavmatrix\").css(\"margin-left\", \"auto\");\n\n\t\t\tproductions = transform(productions);\n\t\t\tlocalStorage['grammar'] = JSON.stringify(productions);\n\t\t\twindow.open(\"./grammarEditor.html\");\n\t\t}\n\t}", "function getTransitionTime (distance, speed) {\n return distance / speed * 1000;\n}", "function getTransition() {// Function to get transition for d3.v.6\n return d3.transition()\n .duration(750)\n //.ease(d3.easeLinear)\n}", "function transition_listener(p1, p2, time){\n\tp1.obj[p1.lstnr](p1.value);\n\treturn p1.value;\n}", "function transitionOpacities(fromOpacity, toOpacity, t) {\n var targetOpacity = (toOpacity - fromOpacity) * t + fromOpacity;\n // Based on the blending formula here. (http://en.wikipedia.org/wiki/Alpha_compositing#Alpha_blending)\n // This is a quadratic blending function that makes the top layer and bottom layer blend linearly.\n // However there is an asymptote at target=1 so that needs to be handled with an if else statement.\n if (targetOpacity == 1) {\n var newFromOpacity = 1;\n var newToOpacity = t;\n } else {\n var newFromOpacity = targetOpacity - t * t * targetOpacity;\n var newToOpacity = (targetOpacity - newFromOpacity) / (1 - newFromOpacity);\n }\n return [newFromOpacity, newToOpacity];\n }", "function parseStateFromTransition(transition) {\r\n const parsedState = {}\r\n\r\n for (let player in transition) parsedState[player] = transition[player].nextState\r\n return parsedState\r\n }", "function color_fsm() {\n if (color_stage == 0) {\n if (lorenz_red >= 255) {\n color_stage = 1;\n } else {\n lorenz_red++;\n }\n } else if (color_stage == 1) {\n if (lorenz_green >= 255) {\n color_stage = 2;\n } else {\n lorenz_green++;\n }\n } else if (color_stage == 2) {\n if (lorenz_blue >= 255) {\n color_stage = 3;\n } else {\n lorenz_blue++;\n }\n } else if (color_stage == 3) {\n if (lorenz_red <= 0) {\n color_stage = 4;\n } else {\n lorenz_red--;\n }\n } else if (color_stage == 4) {\n if (lorenz_green <= 0) {\n color_stage = 5;\n } else {\n lorenz_green--;\n }\n } else {\n if (lorenz_blue <= 0) {\n color_stage = 0;\n } else {\n lorenz_blue--;\n }\n }\n}", "function transicion () {\n\n ready_tapes = 0;\n var current_transition = \"\";\n current_transition += state + \",\";\n\n for ( var i = 0; i < n_tapes - 1; i++ ) {\n current_transition += tapes[ i ].get_current_symbol() + \",\";\n }\n current_transition += tapes[ n_tapes - 1 ].get_current_symbol();\n\n //If transition exists, apply transition.\n\n if ( transitions[ current_transition ] ) {\n var aux = transitions[ current_transition ].split( ',' );\n state = aux[ 0 ];\n $( '#state_text' ).text( \"State: \" + state );\n\n for ( var i = 0; i < n_tapes; i++ ) {\n tapes[ i ].set_middle_symbol( aux[ i + 1 ] );\n\n if ( aux[ i + n_tapes + 1 ] == 'r' ) {\n tapes[ i ].mover( -1, function () {\n transicion();\n } );\n }\n\n else if ( aux[ i + n_tapes + 1 ] == 'l' ) {\n tapes[ i ].mover( 1, function () {\n transicion();\n } );\n }\n\n else {\n tapes[ i ].mover( 0, function () {\n transicion();\n } );\n }\n }\n step_counter++;\n }\n\n //Otherwise verify if the input is accepted.\n\n else {\n ready_tapes = 2 * n_tapes;\n $( '#state_text' ).text( \"State: \" + state );\n if ( final_states.indexOf( state ) != -1 ) {\n $( '#accept_icon' ).removeClass( 'large red remove circle' )\n .addClass( 'large green check circle' ).show();\n }\n else {\n $( '#accept_icon' ).removeClass( 'large green check circle' )\n .addClass( 'large red remove circle' ).show();\n }\n\n layer.draw();\n $( '#load_input' ).removeClass( 'disabled' );\n $( '#input' ).removeClass( 'disabled' );\n disableMachineButtons();\n input_loaded = false;\n }\n $( '#counter_text' ).text( \"Steps: \" + step_counter );\n}", "function getTransitionPropOfAttrTransition( attr ) {\n\n return attr.startsWith( \"transition.\" ) ?\n attr.slice( 11, attr.indexOf(\".\", 11 ) ) : \"\";\n\n }", "function Transition( name )\n {\n this.name = name;\n this.input = [];\n this.output = [];\n // call getTransitionInformation() which makes an asynch XQuery call\n // to obtain the transition record from the PN_Definition. This will establish\n // the value for xmldoc.\n //setTransitionInformation(name);\n //xpathQuery = \"//transitions/transition[@id='\" + this.name + \"']\";\n //Transition.prototype.setTransitionInputs( xpathQuery );\n }", "function Transition() {\n\n\t\t/**\n\t\t * The list of transitions associated to a state\n\t\t * @private\n\t\t */\n\t\tvar _transitions = {};\n\n\t\t/**\n\t\t * Add a new transition\n\t\t * @private\n\t\t * @param {String} event the event that will trigger the transition\n\t\t * @param {Function} action the function that is executed\n\t\t * @param {Object} scope [optional] the scope in which to execute the action\n\t\t * @param {String} next [optional] the name of the state to transit to.\n\t\t * @returns {Boolean} true if success, false if the transition already exists\n\t\t */\n\t\tthis.add = function add(event, action, scope, next) {\n\n\t\t\tvar arr = [];\n\n\t\t\tif (_transitions[event]) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (typeof event == \"string\"\n\t\t\t\t&& typeof action == \"function\") {\n\n\t\t\t\t\tarr[0] = action;\n\n\t\t\t\t\tif (typeof scope == \"object\") {\n\t\t\t\t\t\tarr[1] = scope;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (typeof scope == \"string\") {\n\t\t\t\t\t\tarr[2] = scope;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (typeof next == \"string\") {\n\t\t\t\t\t\tarr[2] = next;\n\t\t\t\t\t}\n\n\t\t\t\t\t_transitions[event] = arr;\n\t\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t};\n\n\t\t/**\n\t\t * Check if a transition can be triggered with given event\n\t\t * @private\n\t\t * @param {String} event the name of the event\n\t\t * @returns {Boolean} true if exists\n\t\t */\n\t\tthis.has = function has(event) {\n\t\t\treturn !!_transitions[event];\n\t\t};\n\n\t\t/**\n\t\t * Get a transition from it's event\n\t\t * @private\n\t\t * @param {String} event the name of the event\n\t\t * @return the transition\n\t\t */\n\t\tthis.get = function get(event) {\n\t\t\treturn _transitions[event] || false;\n\t\t};\n\n\t\t/**\n\t\t * Execute the action associated to the given event\n\t\t * @param {String} event the name of the event\n\t\t * @param {params} params to pass to the action\n\t\t * @private\n\t\t * @returns false if error, the next state or undefined if success (that sounds weird)\n\t\t */\n\t\tthis.event = function event(event) {\n\t\t\tvar _transition = _transitions[event];\n\t\t\tif (_transition) {\n\t\t\t\t_transition[0].apply(_transition[1], Tools.toArray(arguments).slice(1));\n\t\t\t\treturn _transition[2];\n\t\t\t} else {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t};\n\t}", "function transition (state, event) {\n return machine.states[state]\n ?.on?.[event] || state;\n\n // switch (state) {\n // case 'active':\n // switch (event) {\n // case 'click':\n // return 'inactive'\n // default:\n // return state;\n // }\n // case 'inactive':\n // switch (event) {\n // case 'click':\n // return 'active'\n // default:\n // return state;\n // }\n // default:\n // return state;\n // }\n}", "function startTransition() {\n clearInterval(transHandler);\n \n targetColor\t= generateRGB();\n distance\t= calculateDistance(currentColor, targetColor);\n increment\t= calculateIncrement(distance, fps, duration);\n \n transHandler = setInterval(function() {\n transition();\n }, 1000/fps);\n }", "function transitioned(calculate) {\n return function(globalProperties, featureProperties) {\n var z = globalProperties.zoom;\n var zh = globalProperties.zoomHistory;\n var duration = globalProperties.duration;\n\n var fraction = z % 1;\n var t = Math.min((Date.now() - zh.lastIntegerZoomTime) / duration, 1);\n var fromScale = 1;\n var toScale = 1;\n var mix, from, to;\n\n if (z > zh.lastIntegerZoom) {\n mix = fraction + (1 - fraction) * t;\n fromScale *= 2;\n from = calculate({zoom: z - 1}, featureProperties);\n to = calculate({zoom: z}, featureProperties);\n } else {\n mix = 1 - (1 - t) * fraction;\n to = calculate({zoom: z}, featureProperties);\n from = calculate({zoom: z + 1}, featureProperties);\n fromScale /= 2;\n }\n\n if (from === undefined || to === undefined) {\n return undefined;\n } else {\n return {\n from: from,\n fromScale: fromScale,\n to: to,\n toScale: toScale,\n t: mix\n };\n }\n };\n}", "function getTransition(state, key) {\n\t\t\treturn state.lookup[key];\n\t\t}", "function transition($new, $old) {\n $slides.eq(currentEq).fadeOut();\n $slides.eq(nextEq).fadeIn();\n $positions.eq(currentEq).removeClass(settings.positionActiveClass);\n $positions.eq(nextEq).addClass(settings.positionActiveClass);\n }", "function changeTransitionDirection(verticalPosition) {\n //If newVertPos greater/equal to expected position percentage and verticalNum value\n //is timerPercent. Change verticalNum to breakPercent, remove/add css classes to\n //select elements, and set/return newVertPos equal to 100\n\t if((newVertPos >= (timerTime * timerPercent))&& verticalNum == timerPercent) {\n verticalNum = breakPercent;\n $breakSettings.removeClass('timerSettingDown');\n $timerDisplay.removeClass('timerDown');\n $breakSettings.addClass('timerSettingStart');\n $timerDisplay.addClass('timerStart');\n\n newVertPos = 100;\n return newVertPos;\n }\n //newVertPos less/equal to expected position percentage and verticalNum is breakPercent\n //. Change verticalNum to timerPercent, remove/add css classes to selected elements and\n // set/return newVertPos equal to 0.\n else if((newVertPos <= (100 + breakTime * breakPercent))&& verticalNum == breakPercent) {\n \tverticalNum = timerPercent;\n $breakSettings.removeClass('timerSettingStart');\n $timerDisplay.removeClass('timerStart');\n $breakSettings.addClass('timerSettingDown');\n $timerDisplay.addClass('timerDown');\n\n newVertPos = 0;\n return newVertPos;\n }\n else {\n \treturn verticalPosition;\n }\n}", "function setStart(node, transition) { \n //Set initial start position\n switch(transition) {\n case 'bottom-slide-in':\n node.style.MsTransform = \"translate(\" + 0 + \"px,\" + (window.innerHeight + service.elementHeight/2) + \"px)\";\n node.style.WebkitTransform = \"translate(\" + 0 + \"px,\" + (window.innerHeight + service.elementHeight/2) + \"px)\";\n node.style.MozTransform = \"translate(\" + 0 + \"px,\" + (window.innerHeight + service.elementHeight/2) + \"px)\";\n node.style.transform = \"translate(\" + 0 + \"px,\" + (window.innerHeight + service.elementHeight/2) + \"px)\";\n break;\n case 'top-slide-in':\n node.style.MsTransform = \"translate(\" + 0 + \"px,\" + (-(window.innerHeight + service.elementHeight/2)) + \"px)\";\n node.style.WebkitTransform = \"translate(\" + 0 + \"px,\" + (-(window.innerHeight + service.elementHeight/2)) + \"px)\";\n node.style.MozTransform = \"translate(\" + 0 + \"px,\" + (-(window.innerHeight + service.elementHeight/2)) + \"px)\";\n node.style.transform = \"translate(\" + 0 + \"px,\" + (-(window.innerHeight + service.elementHeight/2)) + \"px)\";\n break;\n case 'right-slide-in':\n node.style.MsTransform = \"translate(\" + (document.body.clientWidth + service.elementWidth/2) + \"px,\" + 0 + \"px)\";\n node.style.WebkitTransform = \"translate(\" + (document.body.clientWidth + service.elementWidth/2) + \"px,\" + 0 + \"px)\";\n node.style.MozTransform = \"translate(\" + (document.body.clientWidth + service.elementWidth/2) + \"px,\" + 0 + \"px)\";\n node.style.transform = \"translate(\" + (document.body.clientWidth + service.elementWidth/2) + \"px,\" + 0 + \"px)\";\n break;\n case 'left-slide-in':\n node.style.MsTransform = \"translate(\" + (-(document.body.clientWidth + service.elementWidth/2)) + \"px,\" + 0 + \"px)\";\n node.style.WebkitTransform = \"translate(\" + (-(document.body.clientWidth + service.elementWidth/2)) + \"px,\" + 0 + \"px)\";\n node.style.MozTransform = \"translate(\" + (-(document.body.clientWidth + service.elementWidth/2)) + \"px,\" + 0 + \"px)\";\n node.style.transform = \"translate(\" + (-(document.body.clientWidth + service.elementWidth/2)) + \"px,\" + 0 + \"px)\";\n break;\n case 'normal-fade-in':\n node.style.opacity = 0;\n break;\n case 'twirl':\n node.style.msTransform = \"scale(0) rotate(720deg)\";\n node.style.WebkitTransform = \"scale(0) rotate(720deg)\";\n node.style.MozTransform = \"scale(0) rotate(720deg)\";\n node.style.transform = \"scale(0) rotate(720deg)\";\n break;\n case 'zoom-in':\n node.parentNode.style.msTransform = \"scale(0)\";\n node.parentNode.style.WebkitTransform = \"scale(0)\";\n node.parentNode.style.MozTransform = \"scale(0)\";\n node.parentNode.style.transform = \"scale(0)\";\n node.style.opacity = 0;\n node.style.msTransform = \"scale(0)\";\n node.style.WebkitTransform = \"scale(0)\";\n node.style.MozTransform = \"scale(0)\";\n node.style.transform = \"scale(0)\";\n break;\n case 'zoom-out':\n node.parentNode.style.msTransform = \"scale(3)\";\n node.parentNode.style.WebkitTransform = \"scale(3)\";\n node.parentNode.style.MozTransform = \"scale(3)\";\n node.parentNode.style.transform = \"scale(3)\";\n node.style.opacity = 0;\n node.style.msTransform = \"scale(3)\";\n node.style.WebkitTransform = \"scale(3)\";\n node.style.MozTransform = \"scale(3)\";\n node.style.transform = \"scale(3)\";\n break;\n case 'grow-in':\n node.parentNode.style.perspective = \"1300px\";\n node.parentNode.style.WebkitPerspective = \"1300px\";\n node.parentNode.style.MozPerspective = \"1300px\";\n node.parentNode.style.WebkitTransformStyle = \"preserve-3d\";\n node.parentNode.style.MozTransformStyle = \"preserve-3d\";\n node.parentNode.style.transformStyle = \"preserve-3d\";\n node.parentNode.style.transform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.WebkitTransform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.MozTransform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.MsTransform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.style.opacity = 0;\n node.style.WebkitTransformStyle = \"preserve-3d\";\n node.style.MozTransformStyle = \"preserve-3d\";\n node.style.transformStyle = \"preserve-3d\";\n node.style.transform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.style.WebkitTransform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.style.MozTransform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n node.style.MsTransform = \"scale(0) translateZ(600px) rotateX(20deg)\";\n break;\n case 'top-fall-in':\n node.parentNode.style.perspective = \"1300px\";\n node.parentNode.style.WebkitPerspective = \"1300px\";\n node.parentNode.style.MozPerspective = \"1300px\";\n node.parentNode.style.WebkitTransformStyle = \"preserve-3d\";\n node.parentNode.style.MozTransformStyle = \"preserve-3d\";\n node.parentNode.style.transformStyle = \"preserve-3d\";\n node.parentNode.style.transform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.WebkitTransform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.MozTransform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.MsTransform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.style.opacity = 0;\n node.style.WebkitTransformStyle = \"preserve-3d\";\n node.style.MozTransformStyle = \"preserve-3d\";\n node.style.transformStyle = \"preserve-3d\";\n node.style.transform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.style.WebkitTransform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.style.MozTransform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n node.style.MsTransform = \"scale(1) translateZ(600px) rotateX(20deg)\";\n break;\n case 'side-fall':\n node.parentNode.style.perspective = \"1300px\";\n node.parentNode.style.WebkitPerspective = \"1300px\";\n node.parentNode.style.MozPerspective = \"1300px\";\n node.parentNode.style.WebkitTransformStyle = \"preserve-3d\";\n node.parentNode.style.MozTransformStyle = \"preserve-3d\";\n node.parentNode.style.transformStyle = \"preserve-3d\";\n node.parentNode.style.transform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.WebkitTransform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.MozTransform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.parentNode.style.MsTransform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.style.opacity = 0;\n node.style.WebkitTransformStyle = \"preserve-3d\";\n node.style.MozTransformStyle = \"preserve-3d\";\n node.style.transformStyle = \"preserve-3d\";\n node.style.transform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.style.WebkitTransform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.style.MozTransform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n node.style.MsTransform = \"scale(1) translate(30%) translateZ(600px) rotateX(20deg)\";\n break;\n case '3d-rotate-left':\n node.parentNode.style.perspective = \"1300px\";\n node.parentNode.style.WebkitPerspective = \"1300px\";\n node.parentNode.style.MozPerspective = \"1300px\";\n node.style.opacity = 0;\n node.style.WebkitTransformStyle = \"preserve-3d\";\n node.style.MozTransformStyle = \"preserve-3d\";\n node.style.transformStyle = \"preserve-3d\";\n node.style.transform = \"translateZ(100px) translateX(-30%) rotateY(90deg)\";\n node.style.WebkitTransform = \"translateZ(100px) translateX(-30%) rotateY(90deg)\";\n node.style.MozTransform = \"translateZ(100px) translateX(-30%) rotateY(90deg)\";\n node.style.MsTransform = \"translateZ(100px) translateX(-30%) rotateY(90deg)\";\n node.style.WebkitTransformOrigin = \"0 100%\";\n node.style.MozTransformOrigin = \"0 100%\";\n node.style.transformOrigin = \"0 100%\";\n break;\n case '3d-rotate-right':\n node.parentNode.style.perspective = \"1300px\";\n node.parentNode.style.WebkitPerspective = \"1300px\";\n node.parentNode.style.MozPerspective = \"1300px\";\n node.style.opacity = 0;\n node.style.WebkitTransformStyle = \"preserve-3d\";\n node.style.MozTransformStyle = \"preserve-3d\";\n node.style.transformStyle = \"preserve-3d\";\n node.style.transform = \"translateZ(100px) translateX(30%) rotateY(-90deg)\";\n node.style.WebkitTransform = \"translateZ(100px) translateX(30%) rotateY(-90deg)\";\n node.style.MozTransform = \"translateZ(100px) translateX(30%) rotateY(-90deg)\";\n node.style.MsTransform = \"translateZ(100px) translateX(30%) rotateY(-90deg)\";\n node.style.WebkitTransformOrigin = \"0 -100%\";\n node.style.MozTransformOrigin = \"0 -100%\";\n node.style.transformOrigin = \"0 -100%\";\n break;\n case '3d-sign':\n node.parentNode.style.perspective = \"1300px\";\n node.parentNode.style.WebkitPerspective = \"1300px\";\n node.parentNode.style.MozPerspective = \"1300px\";\n node.style.opacity = 0;\n node.style.WebkitTransformStyle = \"preserve-3d\";\n node.style.MozTransformStyle = \"preserve-3d\";\n node.style.transformStyle = \"preserve-3d\";\n node.style.transform = \"rotateX(-60deg)\";\n node.style.WebkitTransform = \"rotateX(-60deg)\";\n node.style.MozTransform = \"rotateX(-60deg)\";\n node.style.MsTransform = \"rotateX(-60deg)\";\n node.style.WebkitTransformOrigin = \"50% 0\";\n node.style.MozTransformOrigin = \"50% 0\";\n node.style.transformOrigin = \"50% 0\";\n break;\n case 'horizontal-flip':\n node.style.opacity = 0;\n node.style.transform = \"rotateY(-400deg)\";\n node.style.WebkitTransform = \"rotateY(-400deg)\";\n node.style.MozTransform = \"rotateY(-400deg)\";\n node.style.MsTransform = \"rotateY(-400deg)\";\n break;\n case 'super-horizontal-flip':\n node.style.opacity = 0;\n node.style.transform = \"rotateY(-2000deg)\";\n node.style.WebkitTransform = \"rotateY(-2000deg)\";\n node.style.MozTransform = \"rotateY(-2000deg)\";\n node.style.MsTransform = \"rotateY(-2000deg)\";\n break;\n case 'vertical-flip':\n node.style.opacity = 0;\n node.style.transform = \"rotateX(-400deg)\";\n node.style.WebkitTransform = \"rotateX(-400deg)\";\n node.style.MozTransform = \"rotateX(-400deg)\";\n node.style.MsTransform = \"rotateX(-400deg)\";\n break;\n case 'super-vertical-flip':\n node.style.opacity = 0;\n node.style.transform = \"rotateX(-2000deg)\";\n node.style.WebkitTransform = \"rotateX(-2000deg)\";\n node.style.MozTransform = \"rotateX(-2000deg)\";\n node.style.MsTransform = \"rotateX(-2000deg)\";\n break;\n default:\n }\n \n node.style.display = \"block\";\n node.style.display = \"block\";\n node.parentNode.style.display = \"block\";\n node.parentNode.style.display = \"block\";\n \n //Set transition timings\n switch(transition) {\n case 'bottom-slide-in':\n case 'top-slide-in':\n case 'right-slide-in':\n case 'left-slide-in':\n node.style.WebkitTransition = \"all 2s\";\n node.style.transition = \"all 2s\";\n node.style.MozTransition = \"all 2s\";\n service.transitionTime = 2;\n break;\n case 'grow-in':\n node.parentNode.style.WebkitTransition = \"all 2s\";\n node.parentNode.style.transition = \"all 2s\";\n node.parentNode.style.MozTransition = \"all 2s\";\n node.style.WebkitTransition = \"all 2s\";\n node.style.transition = \"all 2s\";\n node.style.MozTransition = \"all 2s\";\n service.transitionTime = 2.2;\n break;\n case 'normal-fade-in':\n case 'twirl':\n node.style.WebkitTransition = \"all 1s\";\n node.style.transition = \"all 1s\";\n node.style.MozTransition = \"all 1s\";\n service.transitionTime = 1.2;\n break;\n case 'top-fall-in':\n case 'side-fall':\n case 'zoom-in':\n case 'zoom-out':\n node.style.WebkitTransition = \"all 1.6s ease-in\";\n node.style.transition = \"all 1.6s ease-in\";\n node.style.MozTransition = \"all 1.6s ease-in\";\n service.transitionTime = 1.8;\n break;\n case '3d-rotate-left':\n case '3d-rotate-right':\n case 'horizontal-flip':\n case 'super-horizontal-flip':\n case 'vertical-flip':\n case 'super-vertical-flip':\n node.style.WebkitTransition = \"all 1.6s\";\n node.style.transition = \"all 1.6s\";\n node.style.MozTransition = \"all 1.6s\";\n service.transitionTime = 1.8;\n case '3d-sign':\n node.style.WebkitTransition = \"all 1.2s\";\n node.style.transition = \"all 1.2s\";\n node.style.MozTransition = \"all 1.2s\";\n service.transitionTime = 1.4;\n default:\n }\n }", "static makeTransition(change, cid, status){\n\n //values reference\n const valuesTbl = {\n currency: ['PENNY', 'NICKEL', 'DIME', 'QUARTER', 'ONE', 'FIVE', 'TEN', 'TWENTY', 'ONE HUNDRED'],\n values: [0.01, 0.05, 0.1, 0.25, 1, 5, 10, 20, 100]\n };\n\n // will be composed\n const returnObj = {\n oldCid: cid,\n newCid: [],\n change: []\n };\n\n \n if(status === 'INSUFFICIENT_FUNDS'){\n\n returnObj.newCid = cid;\n\n }else if(status === 'CLOSED'){\n\n returnObj.newCid = cid.map(([currency, number]) => [currency, 0]);\n returnObj.change = cid;\n\n\n }else {\n\n //the money will be taken from cid and placed on returnObj.change\n //transitionMoney will be used to store the amount of money taken from the cid\n let transitionMoney = 0;\n let transitionCid = cid;\n\n //loop through all cid itens(currecy and stored value of the currency)\n for(let countOne = transitionCid.length -1; countOne >= 0; countOne--){\n\n //cid item ex.: [\"PENNY\", 0.5]\n let currentCid = transitionCid[countOne];\n\n //index on valuesTbl.currency of the current currency\n //ex.: if the current currency is 'PENNY' the returned index will be 0 \n let currencyIndex = valuesTbl.currency.indexOf(currentCid[0]);\n\n //get the value of the currency ex.: PENNY = 0.01\n let currentCurrency = valuesTbl.currency[currencyIndex],\n currentValue = valuesTbl.values[currencyIndex];\n\n //get how many units of the currency are in the cid\n\n /* if the current cid is [\"PENNY\", 0.5], the 'times'\n variable will be equal to 50, because there are 50 pennies\n in the cid (0.5 * 0.01)\n */\n const times = Math.round(currentCid[1] / currentValue);\n\n //loop until fulfill returnObj.change with the change taken from transitionCid\n\n for(let countTwo = 1; countTwo <= times; countTwo++){\n\n //checks if transitionMoney isn't fulfilled and equal to change\n let checkLimit = parseFloat((transitionMoney + currentValue).toFixed(2));\n\n if(checkLimit <= change && currentCid[1] != 0){\n\n //takes money from the cid and puts on transitionMoney and returnObj.change\n currentCid[1] -= currentValue;\n transitionMoney += currentValue;\n\n\n //checks if the returnObj.change already have a currency item, ex.: penny\n //then adds the value\n let cidItem = false;\n\n for(const [index, value] of returnObj.change.entries()){\n if(value[0] === currentCurrency){\n cidItem = index;\n }\n }\n\n if(typeof cidItem == 'number'){\n returnObj.change[cidItem][1] += currentValue;\n } else {\n returnObj.change.push([currentCurrency, currentValue]);\n }\n }\n }\n }\n\n returnObj.newCid = transitionCid;\n }\n \n\n return returnObj;\n\n\n }", "function getAnimation(transition, uiTargets, isReversed) {\n var targets = transition.animation;\n var calculateValue = function(start, end, t) {\n var startKeyValue = start.value[ 1 ];\n var endKeyValue = end.value[ 1 ];\n var ease = start.value[ 2 ];\n\n // since this is a hold frame we'll just return it\n if(ease === 'hold') {\n return startValue;\n // this is a bezier ease\n } else if(Array.isArray(ease)) {\n ease = bezierEasing.apply(undefined, ease);\n\n if(Array.isArray(startKeyValue)) {\n return endKeyValue.map(function(endValue, i) {\n var startValue = startKeyValue[ i ];\n\n return (endValue - startValue) * ease(t) + startValue; \n });\n } else {\n return (endKeyValue - startKeyValue) * ease(t) + startKeyValue;\n }\n\n // this is just a lerp\n } else {\n if(Array.isArray(startKeyValue)) {\n return endKeyValue.map(function(endValue, i) {\n var startValue = startKeyValue[ i ];\n\n return (endValue - startValue) * t + startValue; \n });\n } else {\n return (endKeyValue - startKeyValue) * t + startKeyValue;\n }\n }\n };\n var animators = Object.keys(targets).reduce(function(keyframers, targetName) {\n var target = targets[ targetName ];\n var uiTarget = uiTargets[ targetName ]; // ui target contains the src and width and height\n\n var propKeyframers = Object.keys(target.animated).map(function(propName) {\n var frames = target.animated[ propName ];\n var animator = keyframes();\n var propWriter = getWriterForProp(propName);\n\n frames.forEach(function(frame) {\n animator.add({ time: frame[ 0 ], value: frame });\n });\n\n return function(time, ui) {\n propWriter(\n ui[ targetName ], \n uiTarget, \n animator.value(time, calculateValue)\n );\n }; \n });\n\n return keyframers.concat(propKeyframers);\n }, []);\n\n\n // this function will actually apply calculated states\n // based on the passed in animation data\n var animator = function(time, start) {\n var ui = merge(\n {},\n start\n );\n\n if(isReversed) {\n time = transition.duration - time;\n }\n\n animators.forEach(function(animator) {\n animator(time, ui);\n });\n\n return ui;\n };\n\n // f1 requires that the function have a duration defined on it\n // otherwise the duration will be the default duration of 0.5\n // instead we'll use the duration AE is passing\n animator.duration = transition.duration;\n\n return animator;\n }", "static get textTypeTransitions() {\n return [\n [1, 1, 0],\n [1, 0, 1],\n [1, 2, 2],\n [2, 2, 0],\n [2, 0, 2],\n [2, 1, 1],\n [0, 1, 1],\n [0, 0, 0],\n [0, 2, 2]\n ];\n }", "function transition(){\n\t\n\tgame.move(gameInfo.curtain);\n\t\n\t// If the curtain has just fully descended\n\tif(gameInfo.curtain.y == 0 && !gameInfo.curtain.descended) {\n\t\tgameInfo.curtain.descended = true;\n\t\tgameInfo.curtain.vy = 0;\n\t\tgameInfo.transitionInvisible.visible = false;\n\t\tgameInfo.transitionVisible.visible = true;\n\t\tif (gameInfo.currentLevelRunning) {\n\t\t\tgameInfo.currentLevelBackground.visible = true;\n\t\t}\n\t\tfor (var sprite in gameInfo.transitionVisible) {\n\t\t\tsprite.visible = true;\n\t\t}\n\t\t\n\t}\n\t\n\tif (gameInfo.curtain.descended) {\n\t\tgameInfo.ascendCounter -= 1;\n\t}\n\t\n\t// If the player has any new towers unlocked, they are unlocked while the curtain is down \n\tif (gameInfo.ascendCounter == 10) {\n\t\tgame.pause();\n\t\tgameInfo.currentUnlocks = [];\n\t\tfor (let tower in gameInfo.towers) {\n\t\t\tif(gameInfo.towers[tower].locked && gameInfo.towers[tower].unlockAfterScene == gameInfo.lastSceneCompleted) {\n\t\t\t\tgameInfo.towers[tower].locked = false;\n\t\t\t\tgameInfo.towers[tower].portrait.tint = 0xFFFFFF;\n\t\t\t\tgameInfo.towers[tower].portrait.priceLabel.text = gameInfo.towers[tower].price;\n\t\t\t\tgameInfo.levelInterfaceInteractive.push(gameInfo.towers[tower].portrait);\n\t\t\t\tgameInfo.currentUnlocks.push(tower);\n\t\t\t}\n\t\t}\n\t\tif (gameInfo.currentUnlocks.length > 0) {\n\t\t\t// The tower information sprites are created dynamically so they will appear above the curtain\n\t\t\tcreateInfoPane(gameInfo.currentUnlocks[0]);\n\t\t\tgameInfo.currentInfoPane.index = 0;\n\t\t\tgameInfo.currentInfoPane2.interact = true;\n\t\t\tgameInfo.currentInfoPane2.release = nextInfoPane;\n\t\t}\n\t\telse {\n\t\t\tgame.resume();\n\t\t}\n\t}\n\t\n\t\n\t// If it is time for the curtain to ascend\n\tif (gameInfo.ascendCounter == 0) {\n\t\tgameInfo.curtain.vy = -15;\n\t\tgame.move(gameInfo.curtain);\n\t}\n\t\n\t// If the curtain has fully ascended\n\tif (gameInfo.curtain.y == -915) {\n\t\tgame.remove(gameInfo.curtain);\n\t\tfor (let sprite of gameInfo.transitionActivate) {\n\t\t\tgame.makeInteractive(sprite);\n\t\t}\n\t\tgameInfo.transitionActivation();\n\t}\n}", "function initTransition(transition) {\r\n const currTransition = JSON.parse(JSON.stringify(newTransition))\r\n\r\n for (let player in currTransition)\r\n currTransition[player].nextState = JSON.parse(JSON.stringify(transition[player].nextState))\r\n \r\n return currTransition\r\n }", "function behAnimatedState(\r\n defer, initialState, compareStates, transitions ) {\r\n \r\n var deMonIn = behDemandMonitor( defer );\r\n var deMonOut = behDemandMonitor( defer );\r\n \r\n var currentVal = initialState;\r\n var updaterHistoryEndMillis = -1 / 0;\r\n var currentCooldownMillis = 0;\r\n function advanceUpdaterHistoryEndMillis( newMillis ) {\r\n newMillis = Math.max( newMillis, updaterHistoryEndMillis );\r\n currentCooldownMillis -=\r\n newMillis - updaterHistoryEndMillis;\r\n updaterHistoryEndMillis = newMillis;\r\n }\r\n \r\n // TODO: Whoops, this behavior doesn't preserve duration coupling.\r\n // See if there's another way to do this that does. Fortunately,\r\n // the duration coupling violation is completely internal to this\r\n // state resource.\r\n var updaterInternal = {};\r\n updaterInternal.inType = typeAtom( 0, null );\r\n updaterInternal.outType = typeAtom( 0, null );\r\n updaterInternal.install = function (\r\n context, inWires, outWires ) {\r\n \r\n var inWire = inWires.leafInfo;\r\n var outWire = outWires.leafInfo;\r\n \r\n // TODO: Reindent.\r\n context.onSigsReady( function () {\r\n inWire.sig.readEachEntry( function ( entry ) {\r\n \r\n if ( entEnd( entry ) < updaterHistoryEndMillis ) {\r\n outWire.sig.history.addEntry( {\r\n maybeData: { val: \"\" },\r\n startMillis: entry.startMillis,\r\n maybeEndMillis: entry.maybeEndMillis\r\n } );\r\n return;\r\n }\r\n \r\n if ( updaterHistoryEndMillis === 1 / 0 ) {\r\n outWire.sig.history.addEntry( {\r\n maybeData: null,\r\n startMillis: entry.startMillis,\r\n maybeEndMillis: null\r\n } );\r\n \r\n } else if (\r\n entry.startMillis < updaterHistoryEndMillis ) {\r\n \r\n outWire.sig.history.addEntry( {\r\n maybeData: { val: \"\" },\r\n startMillis: entry.startMillis,\r\n maybeEndMillis:\r\n { val: updaterHistoryEndMillis }\r\n } );\r\n \r\n } else if (\r\n updaterHistoryEndMillis < entry.startMillis ) {\r\n \r\n // NOTE: This case happens once, at the very\r\n // beginning of the app. (We do this sanity check to\r\n // make sure that's actually true.)\r\n if ( updaterHistoryEndMillis !== -1 / 0 )\r\n throw new Error();\r\n \r\n updaterHistoryEndMillis = entry.startMillis;\r\n outWire.sig.history.addEntry( {\r\n maybeData: { val: JSON.stringify( currentVal ) },\r\n startMillis: outWire.sig.history.getLastEntry().\r\n startMillis,\r\n maybeEndMillis: { val: updaterHistoryEndMillis }\r\n } );\r\n }\r\n \r\n var rules = entry.maybeData === null ? [] :\r\n _.arrMappend( entry.maybeData.val, function ( rule ) {\r\n if ( !(true\r\n && _.likeArray( rule )\r\n && rule.length === 2\r\n && _.isString( rule[ 0 ] )\r\n && _.hasOwn( transitions, \"\" + rule[ 0 ] )\r\n ) )\r\n return [];\r\n return transitions[ \"\" + rule[ 0 ] ].call( {},\r\n rule[ 1 ] );\r\n } );\r\n while ( updaterHistoryEndMillis < entEnd( entry ) ) {\r\n var currentRules =\r\n _.arrMappend( rules, function ( rule ) {\r\n var replacement = rule( currentVal );\r\n return replacement === null ? [] :\r\n [ replacement ];\r\n } );\r\n \r\n if ( currentRules.length === 0 ) {\r\n // TODO: See if this should reset the state\r\n // instead of prolonging the current state. After\r\n // all, if this state resource is to be a\r\n // discoverable resource, there oughta be some\r\n // justification as to why it started at its\r\n // initial value. On the other hand, if this is to\r\n // be a persistent resource, we'll actually want\r\n // it to start in a state other than its\r\n // designated initial state sometimes, since this\r\n // other state represents the previously persisted\r\n // value.\r\n outWire.sig.history.addEntry( {\r\n maybeData:\r\n entry.maybeEndMillis === null ? null :\r\n { val: JSON.stringify( currentVal ) },\r\n startMillis: entry.startMillis,\r\n maybeEndMillis: entry.maybeEndMillis\r\n } );\r\n \r\n // NOTE: We don't let inactivity satisfy the\r\n // cooldown. That helps keep this state resource\r\n // deterministic even if there are pauses in the\r\n // app activity signal.\r\n if ( entry.maybeData === null )\r\n updaterHistoryEndMillis = entEnd( entry );\r\n else\r\n advanceUpdaterHistoryEndMillis(\r\n entEnd( entry ) );\r\n return;\r\n }\r\n \r\n var favoriteRule = 0 < currentCooldownMillis ? {\r\n newVal: currentVal,\r\n cooldownMillis: currentCooldownMillis\r\n } : _.arrFoldl(\r\n currentRules[ 0 ],\r\n _.arrCut( currentRules, 1 ),\r\n function ( a, b ) {\r\n var comparedStates =\r\n compareStates( a.newVal, b.newVal );\r\n return comparedStates < 0 ? a :\r\n 0 < comparedStates ? b :\r\n a.cooldownMillis < b.cooldownMillis ? a :\r\n b;\r\n } );\r\n \r\n currentVal = favoriteRule.newVal;\r\n currentCooldownMillis = favoriteRule.cooldownMillis;\r\n \r\n // TODO: If we ever want to support fractional values\r\n // for cooldownMillis, fix this code. It adds a very\r\n // large number (updaterHistoryEndMillis) to what\r\n // could be a very small fraction, and then it\r\n // subtracts the difference from the cooldown (via\r\n // advanceUpdaterHistoryEndMillis), rather than just\r\n // setting the cooldown to zero.\r\n var nextUpdaterHistoryEndMillis =\r\n Math.min( entEnd( entry ),\r\n updaterHistoryEndMillis +\r\n currentCooldownMillis );\r\n outWire.sig.history.addEntry( {\r\n maybeData: { val: JSON.stringify( currentVal ) },\r\n startMillis: updaterHistoryEndMillis,\r\n maybeEndMillis:\r\n { val: nextUpdaterHistoryEndMillis }\r\n } );\r\n advanceUpdaterHistoryEndMillis(\r\n nextUpdaterHistoryEndMillis );\r\n }\r\n } );\r\n } );\r\n };\r\n \r\n var updater = behSeqs(\r\n behFmap( function ( val ) {\r\n return [];\r\n } ),\r\n deMonIn.monitor,\r\n updaterInternal,\r\n deMonOut.demander\r\n );\r\n \r\n var result = {};\r\n result.demander = behSeqs(\r\n behDupPar( updater, deMonIn.demander ),\r\n behSnd( typeOne(), typeOne() )\r\n );\r\n result.monitor = behSeqs(\r\n behDupPar( updater, behSeqs(\r\n deMonOut.monitor,\r\n behFmap( function ( responses ) {\r\n var filteredResponses =\r\n _.arrKeep( responses, function ( it ) {\r\n return it !== \"\";\r\n } );\r\n if ( filteredResponses.length !== 1 )\r\n throw new Error();\r\n return filteredResponses[ 0 ];\r\n } )\r\n ) ),\r\n behSnd( typeOne(), typeAtom( 0, null ) )\r\n );\r\n return result;\r\n}", "function transitioned(calculate) {\n\t return function(globalProperties, featureProperties) {\n\t var z = globalProperties.zoom;\n\t var zh = globalProperties.zoomHistory;\n\t var duration = globalProperties.duration;\n\t\n\t var fraction = z % 1;\n\t var t = Math.min((Date.now() - zh.lastIntegerZoomTime) / duration, 1);\n\t var fromScale = 1;\n\t var toScale = 1;\n\t var mix, from, to;\n\t\n\t if (z > zh.lastIntegerZoom) {\n\t mix = fraction + (1 - fraction) * t;\n\t fromScale *= 2;\n\t from = calculate({zoom: z - 1}, featureProperties);\n\t to = calculate({zoom: z}, featureProperties);\n\t } else {\n\t mix = 1 - (1 - t) * fraction;\n\t to = calculate({zoom: z}, featureProperties);\n\t from = calculate({zoom: z + 1}, featureProperties);\n\t fromScale /= 2;\n\t }\n\t\n\t if (from === undefined || to === undefined) {\n\t return undefined;\n\t } else {\n\t return {\n\t from: from,\n\t fromScale: fromScale,\n\t to: to,\n\t toScale: toScale,\n\t t: mix\n\t };\n\t }\n\t };\n\t}", "function observe(obs, updateCurrent){ \n var next_state = {};\n \n for(var i in current_state){\n next_state[i] = 0;\n }\n \n var total = 0;\n for(var i in transition(false)){\n next_state[i] += transition(false)[i]*observation_model[i][obs]\n total += transition(false)[i]*observation_model[i][obs];\n //console.log(i,current_state[i],observation_model[i][obs]);\n }\n //console.log(total);\n \n for(var i in next_state){\n next_state[i] = next_state[i]/total;\n }\n \n if (updateCurrent){\n current_state = next_state;\n states_array.push(current_state);\n }\n else {return next_state;} \n }", "function StyleTransition(reference, declaration, oldTransition, value) {\n\n\t this.declaration = declaration;\n\t this.startTime = this.endTime = (new Date()).getTime();\n\n\t if (reference.function === 'piecewise-constant' && reference.transition) {\n\t this.interp = interpZoomTransitioned;\n\t } else {\n\t this.interp = interpolate[reference.type];\n\t }\n\n\t this.oldTransition = oldTransition;\n\t this.duration = value.duration || 0;\n\t this.delay = value.delay || 0;\n\n\t if (!this.instant()) {\n\t this.endTime = this.startTime + this.duration + this.delay;\n\t this.ease = util.easeCubicInOut;\n\t }\n\n\t if (oldTransition && oldTransition.endTime <= this.startTime) {\n\t // Old transition is done running, so we can\n\t // delete its reference to its old transition.\n\n\t delete oldTransition.oldTransition;\n\t }\n\t}", "function StyleTransition(reference, declaration, oldTransition, value) {\n\t\n\t this.declaration = declaration;\n\t this.startTime = this.endTime = (new Date()).getTime();\n\t\n\t if (reference.function === 'piecewise-constant' && reference.transition) {\n\t this.interp = interpZoomTransitioned;\n\t } else {\n\t this.interp = interpolate[reference.type];\n\t }\n\t\n\t this.oldTransition = oldTransition;\n\t this.duration = value.duration || 0;\n\t this.delay = value.delay || 0;\n\t\n\t if (!this.instant()) {\n\t this.endTime = this.startTime + this.duration + this.delay;\n\t this.ease = util.easeCubicInOut;\n\t }\n\t\n\t if (oldTransition && oldTransition.endTime <= this.startTime) {\n\t // Old transition is done running, so we can\n\t // delete its reference to its old transition.\n\t\n\t delete oldTransition.oldTransition;\n\t }\n\t}", "function startTransition() {\n\tclearInterval(transHandler);\n\t\n\ttargetColor\t= generateRGB();\n\tdistance\t= calculateDistance(currentColor, targetColor);\n\tincrement\t= calculateIncrement(distance, fps, duration);\n\t\n\ttransHandler = setInterval(function() {\n\t\ttransition();\n\t}, 1000/fps);\n}", "performTransition (trans) {\n if (trans === Transition.NullTransition) {\n return\n }\n const id = this.currentState.GetOutputState(trans)\n if (id === StateId.NullStateId) {\n return\n }\n // Update currentState\n this.currentStateId = id\n const state = this.states.find((s) => s.Id === id)\n if (state !== undefined) {\n // Post processing of old state\n this.currentState.DoBeforeLeaving()\n this.currentState = state\n // Reset the state to its desired condition before it can reason or act\n this.currentState.DoBeforeEntering()\n }\n }", "function updateTransition(thisVar) {\n if (isMidTransition(thisVar)) {\n if (typeof(thisVar.trans.leaveSpd) !== 'undefined') {\n thisVar.fgGrp.x += thisVar.trans.leaveSpd;\n if (thisVar.fgGrp.x < -DIMS.game.outer.width+DIMS.game.pad.horz*2\n || thisVar.fgGrp.x > DIMS.game.outer.width) {\n var onLeave = thisVar.trans.onLeave;\n delete thisVar.trans;\n onLeave.f.apply(onLeave.thisVar);\n }\n } else if (typeof(thisVar.trans.enterSpd) !== 'undefined') {\n thisVar.fgGrp.x += thisVar.trans.enterSpd;\n if (thisVar.trans.enterSpd < 0\n && thisVar.fgGrp.x <= DIMS.game.pad.horz) {\n thisVar.fgGrp.x = DIMS.game.pad.horz;\n delete thisVar.trans;\n } else if (thisVar.trans.enterSpd > 0\n && thisVar.fgGrp.x >= DIMS.game.pad.horz) {\n thisVar.fgGrp.x = DIMS.game.pad.horz;\n delete thisVar.trans;\n }\n }\n }\n}", "function transitioned(calculate) {\n\t return function(globalProperties, featureProperties) {\n\t var z = globalProperties.zoom;\n\t var zh = globalProperties.zoomHistory;\n\t var duration = globalProperties.duration;\n\n\t var fraction = z % 1;\n\t var t = Math.min((Date.now() - zh.lastIntegerZoomTime) / duration, 1);\n\t var fromScale = 1;\n\t var toScale = 1;\n\t var mix, from, to;\n\n\t if (z > zh.lastIntegerZoom) {\n\t mix = fraction + (1 - fraction) * t;\n\t fromScale *= 2;\n\t from = calculate({zoom: z - 1}, featureProperties);\n\t to = calculate({zoom: z}, featureProperties);\n\t } else {\n\t mix = 1 - (1 - t) * fraction;\n\t to = calculate({zoom: z}, featureProperties);\n\t from = calculate({zoom: z + 1}, featureProperties);\n\t fromScale /= 2;\n\t }\n\n\t if (from === undefined || to === undefined) {\n\t return undefined;\n\t } else {\n\t return {\n\t from: from,\n\t fromScale: fromScale,\n\t to: to,\n\t toScale: toScale,\n\t t: mix\n\t };\n\t }\n\t };\n\t}", "function StyleTransition(reference, declaration, oldTransition, value) {\n\n this.declaration = declaration;\n this.startTime = this.endTime = (new Date()).getTime();\n\n if (reference.function === 'piecewise-constant' && reference.transition) {\n this.interp = interpZoomTransitioned;\n } else {\n this.interp = interpolate[reference.type];\n }\n\n this.oldTransition = oldTransition;\n this.duration = value.duration || 0;\n this.delay = value.delay || 0;\n\n if (!this.instant()) {\n this.endTime = this.startTime + this.duration + this.delay;\n this.ease = util.easeCubicInOut;\n }\n\n if (oldTransition && oldTransition.endTime <= this.startTime) {\n // Old transition is done running, so we can\n // delete its reference to its old transition.\n\n delete oldTransition.oldTransition;\n }\n}", "function update_transition(source, input, target, output, direction)\n {\n //Calling the function that formats the transition, before adding it to the HTML.\n $('#transition').val(transition(\"Q\"+source, input, \"Q\"+target, output, direction));\n }", "function lower() {\n d.getElementById('slide').style.webkitTransition = \"all 0.6s ease\";\n d.getElementById('slide').style.MozTransition = \"all 0.6s ease\";\n d.getElementById('slide').style.top = '-10px';\n}", "async function timeTravelToTransition() {\n\n\n let startTimeOfNextPhaseTransition = await stakingHbbft.startTimeOfNextPhaseTransition.call();\n\n await validatorSetHbbft.setCurrentTimestamp(startTimeOfNextPhaseTransition);\n const currentTS = await validatorSetHbbft.getCurrentTimestamp.call();\n currentTS.should.be.bignumber.equal(startTimeOfNextPhaseTransition);\n await callReward(false);\n }", "getTranslate() {\n // 8:00 is translateY(43px)\n let res = 43;\n // start gives in the format of \"00:00\"\n let hr = (parseInt(this.state.eventInfo.time_start.substring(0, 2)) - 8) * 2;\n let min = parseInt(this.state.eventInfo.time_start.substring(3, 5)) / 30;\n // half an hour is an additional of 21px\n res += ((hr + min) * 21)\n return res;\n }", "function SlideTransition(totalImages) {\n var callback = {};\n callback.leftAnimation = function ($next, $current) {\n TweenMax.set($next,{x:\"-100%\"});\n TweenMax.to($next, 0.5, {x: \"0%\", ease:Power0.easeNone });\n TweenMax.to($current, 0.5, {x: \"100%\", ease:Power0.easeNone });\n };\n\n callback.rightAnimation = function ($current, $next) {\n console.log(slideState);\n TweenMax.set($next,{x:\"100%\"});\n TweenMax.to($next, 0.5, {x: \"0%\", ease:Power0.easeNone });\n TweenMax.to($current, 0.5, {x: \"-100%\", ease:Power0.easeNone });\n };\n\n var transitionHandler = new TransitionBaseHandler(totalImages, callback);\n\n this.left = transitionHandler.left;\n this.right = transitionHandler.right;\n}", "setTransitions() {\n this.slowTransition = 'slowTransition';\n this.fastTransition = 'fastTransition';\n }", "changeCurrentMotion(motion, transition){\n\n // start transition\n this.transition = 1;\n // set its length\n this.transitionLength = transition;\n // update current and last motion\n this.last = this.current;\n this.current = motion;\n }", "function computeNextFloat (from, to, ease){\n return from + (to - from) * ease;\n}", "function transition() {\n\tvar transition1\t= d3.transition()\n\t\t.ease(d3.easeLinear)\n\t\t.delay(10)\n\t\t.duration(1000);\n\treturn (transition1)\n}", "function Transition() {\n /**\n * @type {*}\n */\n this.signals = {};\n this.signals.in = new signals.Signal();\n this.signals.out = new signals.Signal();\n\n /**\n * @type {Boolean}\n */\n this.push = false;\n\n /**\n * @type {Boolean}\n */\n this.replace = true;\n\n /**\n * @type {Boolean}\n */\n this.wait = true;\n\n /**\n * @type {Boolean}\n */\n this.requiresWebGL = false;\n\n PIXI.Container.call(this);\n}", "function transitionSelect() {\n var el = document.createElement(\"div\");\n if (el.style.WebkitTransition) return \"webkitTransitionEnd\";\n if (el.style.OTransition) return \"oTransitionEnd\";\n return 'transitionend';\n }", "function launchTransition()\n\t\t{\n\t\t\t// delete active_class before change :\n\t\t\t_this.$refs.medias.removeClass(_this._getSetting('classes.active'));\n\n\t\t\t// delete active_class before change :\n\t\t\t_this.$refs.current.addClass(_this._getSetting('classes.active'));\n\n\t\t\t// check transition type :\n\t\t\tif (_this._getSetting('transition') && _this._isNativeTransition(_this._getSetting('transition.callback'))) _this._transition(_this._getSetting('transition.callback'));\n\t\t\telse if (_this._getSetting('transition') && _this._getSetting('transition.callback')) _this._getSetting('transition.callback')(_this);\n\t\t\t\n\t\t\t// callback :\n\t\t\tif (_this._getSetting('onChange')) _this._getSetting('onChange')(_this);\n\t\t\t$this.trigger('slidizle.change', [_this]);\n\n\t\t\t// check if the current if greater than the previous :\n\t\t\tif (_this.$refs.current.index() == 0 && _this.$refs.previous)\n\t\t\t{\n\t\t\t\tif (_this.$refs.previous.index() == _this.$refs.medias.length-1) {\n\t\t\t\t\tif (_this._getSetting('onNext')) _this._getSetting('onNext')(_this);\n\t\t\t\t\t$this.trigger('slidizle.next', [_this]);\n\t\t\t\t} else {\n\t\t\t\t\tif (_this._getSetting('onPrevious')) _this._getSetting('onPrevious')(_this);\n\t\t\t\t\t$this.trigger('slidizle.previous', [_this]);\n\t\t\t\t}\n\t\t\t} else if (_this.$refs.current.index() == _this.$refs.medias.length-1 && _this.$refs.previous)\n\t\t\t{\n\t\t\t\tif (_this.$refs.previous.index() == 0) {\n\t\t\t\t\tif (_this._getSetting('onPrevious')) _this._getSetting('onPrevious')(_this);\n\t\t\t\t\t$this.trigger('slidizle.previous', [_this]);\n\t\t\t\t} else {\n\t\t\t\t\tif (_this._getSetting('onNext')) _this._getSetting('onNext')(_this);\n\t\t\t\t\t$this.trigger('slidizle.next', [_this]);\n\t\t\t\t}\n\t\t\t} else if (_this.$refs.previous) {\n\t\t\t\tif (_this.$refs.current.index() > _this.$refs.previous.index()) {\n\t\t\t\t\tif (_this._getSetting('onNext')) _this._getSetting('onNext')(_this);\n\t\t\t\t\t$this.trigger('slidizle.next', [_this]);\n\t\t\t\t} else {\n\t\t\t\t\tif (_this._getSetting('onPrevious')) _this._getSetting('onPrevious')(_this);\n\t\t\t\t\t$this.trigger('slidizle.previous', [_this]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (_this._getSetting('onNext')) _this._getSetting('onNext')(_this);\n\t\t\t\t$this.trigger('slidizle.next', [_this]);\n\t\t\t}\n\n\t\t\t// init the timer :\n\t\t\tif (_this._getSetting('timeout') && _this.$refs.medias.length > 1 && _this.isPlaying && !_this.timer) {\n\t\t\t\tclearInterval(_this.timer);\n\t\t\t\t_this.timer = setInterval(function() {\n\t\t\t\t\t_this._tick();\n\t\t\t\t}, _this._getSetting('timerInterval'));\n\t\t\t}\n\t\t}", "function step() {\n DateChange(x.invert(currentValue));\n granularitiy = (targetValue/1501)\n currentValue = currentValue + granularitiy; // Granularity\n if (currentValue >= targetValue + granularitiy) {\n moving = false;\n currentValue = 0;\n clearInterval(timer);\n playButton.text(\"Play\");\n }\n if(currentValue < 0)\n currentValue = 0;\n}", "function calculateRadius(numTransitions) {\n return 80 + 4 * numTransitions;\n }", "function expectedDurationOfState(state, prob){\n\t\treturn 1/(1-prob[state][state]);\n\t}", "getNextTransitionType() {\n if (this.newLayoutTime < this.newModuleTime) {\n return 'NextLayout';\n } else {\n return 'NextModule';\n }\n }", "function transitionTime() {\n if (questionCounter < 8) {\n questionCounter++;\n generateGame();\n counter = 15;\n timer();\n }\n else {\n endGame();\n }\n }", "function useTransition(inheritedTransition) {\n var valid = validTransition(inheritedTransition);\n\n if (inheritedTransition.ease && !valid.ease) {\n console.log(\"chart: creating transition. inherited transition expired on node:\", \n inheritedTransition.node());\n return valid.transition().duration(150); \n } \n\n return valid;\n }", "function GetRowTransitions(board, num_columns) {\n var transitions = 0;\n var last_bit = 1;\n\n for (var i = 0; i < board.length; ++i) {\n var row = board[i];\n\n for (var j = 0; j < num_columns; ++j) {\n var bit = (row >> j) & 1;\n \n if (bit != last_bit) {\n ++transitions;\n }\n\n last_bit = bit;\n }\n\n if (bit == 0) {\n ++transitions;\n }\n last_bit = 1;\n }\n return transitions;\n}", "transitionTo(state) {\n logger.debug(`Transaction state transition ${currentState} --> ${state}`)\n\n if (!VALID_STATE_TRANSITIONS[currentState].includes(state)) {\n throw new KafkaJSNonRetriableError(\n `Transaction state exception: Invalid transition ${currentState} --> ${state}`\n )\n }\n\n stateMachine.emit('transition', { to: state, from: currentState })\n currentState = state\n }", "function nextState(state) {\n if (--state == 0) state=3;\n return state;\n }", "function setTransitionProperties() {\n TransitionProperties.next = next;\n TransitionProperties.current = current;\n }", "previousstep(step) {}", "function connectTransitionGraph() {\n //normalize as with onEntry/onExit\n transitions.forEach(function (t) {\n if (typeof t.onTransition === 'function') {\n t.onTransition = [t.onTransition];\n }\n });\n\n transitions.forEach(function (t) {\n //normalize \"event\" attribute into \"events\" attribute\n if (t.event) {\n t.events = t.event.trim().split(/ +/);\n }\n });\n\n //hook up targets\n transitions.forEach(function (t) {\n if (t.targets || (typeof t.target === 'undefined')) return; //targets have already been set up\n\n if (typeof t.target === 'string') {\n //console.log('here1');\n var target = idToStateMap[t.target];\n if (!target) throw new Error('Unable to find target state with id ' + t.target);\n t.target = target;\n t.targets = [t.target];\n } else if (Array.isArray(t.target)) {\n //console.log('here2');\n t.targets = t.target.map(function (target) {\n if (typeof target === 'string') {\n target = idToStateMap[target];\n if (!target) throw new Error('Unable to find target state with id ' + t.target);\n return target;\n } else {\n return target;\n }\n });\n } else if (typeof t.target === 'object') {\n t.targets = [t.target];\n } else {\n throw new Error('Transition target has unknown type: ' + t.target);\n }\n });\n\n //hook up LCA - optimization\n transitions.forEach(function (t) {\n if (t.targets) t.lcca = getLCCA(t.source, t.targets[0]); //FIXME: we technically do not need to hang onto the lcca. only the scope is used by the algorithm\n\n t.scope = getScope(t);\n //console.log('scope',t.source.id,t.scope.id,t.targets);\n });\n }", "function whichTransitionEvent(){\n\t\t\tlet el = document.createElement('fakeelement'),\n\t\t\t\ttransitions = {\n\t\t\t\t\t'transition':'transitionend',\n\t\t\t\t\t'OTransition':'oTransitionEnd',\n\t\t\t\t\t'MozTransition':'transitionend',\n\t\t\t\t\t'WebkitTransition':'webkitTransitionEnd'\n\t\t\t\t};\n\n\t\t\tfor(let event in transitions){\n\t\t\t\tif( el.style[event] !== undefined ) return transitions[event];\n\t\t\t}\n\t\t}", "function easeInOutBack(t, b, c, d, s) {\n if (s === undefined) {\n s = 1.70158;\n }\n t /= d / 2;\n if (t < 1) {\n return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;\n }\n return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;\n }", "function easeInOutBack(t, b, c, d, s) {\n if (s === undefined) {\n s = 1.70158;\n }\n t /= d / 2;\n if (t < 1) {\n return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;\n }\n return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;\n }", "function easeInOutBack(t, b, c, d, s) {\n if (s === undefined) {\n s = 1.70158;\n }\n t /= d / 2;\n if (t < 1) {\n return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;\n }\n return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;\n }", "function easeInOutBack(t, b, c, d, s) {\n if (s === undefined) {\n s = 1.70158;\n }\n t /= d / 2;\n if (t < 1) {\n return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;\n }\n return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;\n }", "function easeInOutBack(t, b, c, d, s) {\n if (s === undefined) {\n s = 1.70158;\n }\n t /= d / 2;\n if (t < 1) {\n return c / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)) + b;\n }\n return c / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2) + b;\n }", "_getAnimationDuration(el) {\n let duration = window.getComputedStyle(el).transitionDuration\n\n return parseFloat(duration) * (duration.indexOf('ms') !== -1 ? 1 : 1000)\n }", "function GetColumnTransitions(board, num_columns) {\n var transitions = 0;\n var last_bit = 1;\n\n for (var i = 0; i < num_columns; ++i) {\n for (var j = 0; j < board.length; ++j) {\n var row = board[j];\n var bit = (row >> i) & 1;\n \n if (bit != last_bit) {\n ++transitions;\n }\n\n last_bit = bit;\n }\n\n last_bit = 1;\n }\n \n return transitions;\n}", "function ease(t, b, c, d){\n t /= d / 2;\n if (t < 1) return c / 2 * t * t + b;\n t--;\n return -c / 2 * (t * (t - 2) - 1) + b;\n }", "actionToState(action,rasp,source,initialRASP){\n var nextRASP={}, delta={}; // nextRASP will be the next state, delta is where all the changes to state are recorded. There may be other properties in the state, only change them deliberatly \n if(action.type===\"TOGGLE\") { // the user clicks on a subject which sends the toggle event, to either open or close the article\n if(rasp.open==='open') { // if the article was open close it, but \n this.toChild['open']({type: \"CLEAR_PATH\"}); // first clear the state of all the sub children, so when they are reopened they are back to their initial state.\n // this is good for 3 reasons: 1) reduces the number of items we need to save state for,\n // 2) reduces the state information we have to encode in to the URL path\n // 3) it fits many use cases that when something becomes visibile it consistently starts in the same state\n delta.open=null; // closed\n delta.minimize=null; // not minimized anymore\n this.qaction(()=>this.props.rasp.toParent({type: \"DESCENDANT_UNFOCUS\"}));\n } else { \n delta.open='open'; // was closed, now open\n delta.minimize=null; // not minimized\n this.qaction(()=>this.props.rasp.toParent({type: \"DESCENDANT_FOCUS\"}))\n }\n } else if(action.type===\"DESCENDANT_FOCUS\" && action.distance > 2 && !rasp.minimize ){\n // a 2+ distant sub child has chanaged to open, so minimize, but don't minimize if already minimized which will change the shape of the propogating message\n delta.minimize=true;\n } else if(action.type===\"DESCENDANT_UNFOCUS\" && action.distance >= 2 && rasp.minimize){\n // a 2+ distant sub child has changed from open, and we are minimized, so unminimize\n delta.minimize=false;\n } else\n return null; // if we don't understand the action, just pass it on\n // we did understand the action and so now calculate the computed state information\n Object.assign(nextRASP,rasp,delta); // calculate the new state based on the previous state and the delta. There may be other properties in the previous state (like depth). Don't clobber them.\n nextRASP.shape= nextRASP.open==='open' ? 'open' : initialRASP.shape; // shape is the piece of state information that all RASP components can understand\n // build the pathSegment out of parts for each state property\n var parts=[];\n if(nextRASP.open==='open') parts.push('o');\n if(nextRASP.minimize) parts.push('m');\n nextRASP.pathSegment= parts.join(','); // pathSegment is be incorporated into the URL path. It should be calculated and the minimal length necessary to do the job\n return nextRASP;\n }", "function toDictionary(cur, prev){\n var key = ee.String(\"class_\").cat(ee.String(ee.Dictionary(cur).get('transition_class_value'))); //get the transition class\n var value = ee.Dictionary(cur).get('sum'); //get the sum of the area \n return ee.Dictionary(prev).set(key, value); //return as a property\n}", "function easeOutBack (t, b, c, d, s)\n {\n if (!s) \n {\n s = 1.70158;\n }\n return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;\n }", "function TransitionFactory(type, totalImages) {\n\n if(type == TRANSITIONS.fade){\n return new FadeTransition(totalImages);\n }else if (type == TRANSITIONS.slide) {\n return new SlideTransition(totalImages);\n }else{\n console.error(\"This transition is not yet supported\");\n }\n}", "function destination(){\n prev=-1;\n flag1=0;\nv=1;\nflag2=1;\n}", "update() {\n if (this.isComplete()) {\n if (this.eventDispatcher && this.event) {\n this.eventDispatcher.dispatchEvent(this.event);\n }\n return -1;\n }\n // this.startTime = this.now();\n // this.endTime = this.startTime + this.totalTime;\n if (!this.endTime) return 0;\n var currentTime = this.now();\n var percentDone = (currentTime - this.startTime) / (this.endTime - this.startTime);\n if (percentDone < 0) percentDone = 0;\n else if (percentDone > 1) percentDone = 1;\n // var newVal = this.startVal + (this.endVal - this.startVal) * this.transition.applyTransition(percentDone);\n var trans = this.transition.applyTransition(percentDone);\n var newVal = this.startVal + (this.endVal - this.startVal) * trans;\n this.setValue(newVal);\n return 1;\n }", "function whichTransitionEvent(){\n var t;\n var el = document.createElement('fakeelement');\n var transitions = {\n 'transition':'transitionend',\n 'OTransition':'oTransitionEnd',\n 'MozTransition':'transitionend',\n 'WebkitTransition':'webkitTransitionEnd'\n }\n for(t in transitions){\n if( el.style[t] !== undefined ){\n return transitions[t];\n }\n }\n}", "function transitionRule(cellState, countOfLiveNeighbors) {\n if (cellState == 1 && (countOfLiveNeighbors == 2 || countOfLiveNeighbors == 3)) {\n // If a live cell has 2 or 3 live neighbors, it stays alive.\n return 1;\n } else if (cellState == 0 && countOfLiveNeighbors == 3) {\n // If a dead cell has 3 live neighbors, it becomes alive.\n return 1;\n } else {\n // Otherwise, the cell dies.\n return 0;\n }\n}", "function fade(t) { return t * t * t * (t * (t * 6 - 15) + 10); }", "function updateTransitions(transitions,arcs1,arcs2) {\r\n for (let i = 0; i < transitions.length; i++) {\r\n if (isFirable(transitions[i],arcs1,arcs2)) {\r\n transitions[i].attr('.root/fill', '#228b22');\r\n transitions[i].attr('.root/stroke', '#228b22');\r\n transitions[i].attr('.label/fill', '#228b22');\r\n } else {\r\n transitions[i].attr('.root/fill', '#dc143c');\r\n transitions[i].attr('.root/stroke', '#dc143c');\r\n transitions[i].attr('.label/fill', '#dc143c'); \r\n }\r\n };\r\n //console.info(\"who go first??\");\r\n //checkIfNoFirableTransitions(transitions,arcs1,arcs2);\r\n }", "function fireTransition(transition,arcs1,arcs2) {\r\n let inplaces = collectInplaces(transition,arcs1),\r\n outplaces = collectOutplaces(transition,arcs2);\r\n for (let i = 0; i < inplaces.length; i++) {\r\n inplaces[i].set('tokens',inplaces[i].get('tokens') - 1);\r\n }\r\n for (let i = 0; i < outplaces.length; i++) {\r\n outplaces[i].set('tokens',outplaces[i].get('tokens') + 1);\r\n }\r\n }", "function Transition(path) {\n this.path = path;\n this.abortReason = null;\n this.isAborted = false;\n}" ]
[ "0.6630601", "0.6541303", "0.6538054", "0.63178617", "0.63018835", "0.62306374", "0.6152068", "0.61283296", "0.60233706", "0.5993718", "0.5973599", "0.59581375", "0.59218556", "0.59086174", "0.5902313", "0.58689725", "0.5867377", "0.5865813", "0.58509195", "0.58506835", "0.584715", "0.582811", "0.57974577", "0.57906353", "0.5772368", "0.5736266", "0.57268405", "0.57258445", "0.5719667", "0.57063866", "0.5683337", "0.56793976", "0.5666213", "0.56627315", "0.5646569", "0.56452394", "0.56439686", "0.5634029", "0.56172305", "0.5587743", "0.5579019", "0.55789757", "0.5571433", "0.5565085", "0.55476093", "0.5545801", "0.5544787", "0.5538285", "0.55220443", "0.5510418", "0.5509661", "0.5509314", "0.5483666", "0.54740417", "0.5471969", "0.5466371", "0.54478264", "0.54431933", "0.5441441", "0.54309154", "0.54242736", "0.540952", "0.53604585", "0.5344965", "0.53441423", "0.5327744", "0.5313793", "0.52975184", "0.5290237", "0.5282374", "0.5279896", "0.5266528", "0.52567637", "0.51979345", "0.5188953", "0.5187781", "0.5175336", "0.5155223", "0.515131", "0.5148649", "0.5148514", "0.5148514", "0.5148514", "0.5148514", "0.5148514", "0.5144093", "0.51233166", "0.51109606", "0.51011837", "0.510085", "0.5099008", "0.5096465", "0.50940365", "0.5093514", "0.50931805", "0.50921184", "0.50872266", "0.5085061", "0.5081868", "0.50817007" ]
0.67392343
0
var y = 0 var a = 200 var b = 160 var c = 180 var g = 140
function setup() { createCanvas(800, 800); strokeWeight(0); //Triangulos negros en pareja punta arriba for (var x = 160; x < 320; x = x + 20) { for (var y = 160; y < 320; y = y + 20) { fill(0); triangle(x, y, x, y + 20, x + 20, y + 20); noFill(); } } //linea superior rectángulo blanco linea 1 y 5 + triangulo pareja //punta abajo for (var a = 200; a < 320; a = a + 80) { for (var b = 160; b < 320; b = b + 80) { fill(255) rect(a, b, 40, 20); noFill(); fill(0); triangle(a, b, a + 20, b, a + 20, b + 20); triangle(a + 20, b, a + 40, b, a + 40, b + 20); noFill(); } } //rectangulos línea 2 y 6 + triangulos punta abajo en pareja for (var c = 180; c < 320; c = c + 80) { for (var d = 180; d < 320; d = d + 80) { fill(255) rect(c, d, 40, 20); noFill(); fill(0); triangle(c, d, c + 20, d, c + 20, d + 20); triangle(c + 20, d, c + 40, d, c + 40, d + 20); noFill(); } } //rectangulos linea 3 y 7 + triangulos punta abajo en parejas for (var e = 160; e < 320; e = e + 80) { for (var f = 200; f < 320; f = f + 80) { fill(255) rect(e, f, 40, 20); noFill(); fill(0) triangle(e, f, e + 20, f, e + 20, f + 20); triangle(e + 20, f, e + 40, f, e + 40, f + 20); noFill(); } } // Rectángulos linea 4 y 8 + triangulos en pareja punta abajo for (var g = 140; g < 318; g = g + 80) { for (var h = 220; h < 318; h = h + 80) { fill(255) rect(g, h, 40, 20); noFill(); fill(0); triangle(g, h, g + 20, h, g + 20, h + 20); triangle(g + 20, h, g + 40, h, g + 40, h + 20); noFill(); fill(255) rect(140, 220, 20, 20) noFill(); fill(255) rect(140, 300, 20, 20); noFill(); fill(255) rect(320, 220, 20, 20); noFill(); fill(255) rect(320, 300, 20, 20); noFill(); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_point_y(c) {\n\treturn 94 + c * 75;\n}", "function Ay(t,e,n){var r=t.getResolution(n),i=my(t,e[0],e[1],r,!1),o=py(i,2),a=o[0],s=o[1],l=my(t,e[2],e[3],r,!0),u=py(l,2),c=u[0],d=u[1];return{minX:a,minY:s,maxX:c,maxY:d}}", "function n(e,t,a,l){return{x:e,y:t,width:a,height:l}}", "function fillConstants(){\n g.a = (27/64)*((g.R**2)*(g.Tc**2))/g.Pc\n g.b = (g.R*g.Tc)/(8*g.Pc);\n g.Vc = 0.359*(g.R*g.Tc)/g.Pc;\n}", "function getXY(red,green,blue){\n\n if (red > 0.04045){\n red = Math.pow((red + 0.055) / (1.0 + 0.055), 2.4);\n }\n else red = (red / 12.92);\n \n if (green > 0.04045){\n green = Math.pow((green + 0.055) / (1.0 + 0.055), 2.4);\n }\n else green = (green / 12.92);\n \n if (blue > 0.04045){\n blue = Math.pow((blue + 0.055) / (1.0 + 0.055), 2.4);\n }\n else blue = (blue / 12.92);\n \n var X = red * 0.664511 + green * 0.154324 + blue * 0.162028;\n var Y = red * 0.283881 + green * 0.668433 + blue * 0.047685;\n var Z = red * 0.000088 + green * 0.072310 + blue * 0.986039;\n var x = X / (X + Y + Z);\n var y = Y / (X + Y + Z);\n return new Array(x,y);\n}", "function A(t){g.translate(t.dx,t.dy)}", "constructor() {\n this.rColor = 0;\n this.gColor = 244;\n this.bColor = 158;\n this.x = 750;\n this.y = 10;\n this.width = 200;\n this.height = 200;\n }", "getLineParameters() {\n if (this.x1 !== this.x2) {\n this.a = ((this.y2 - this.y1)) / ((this.x1 - this.x2))\n this.b = 1.0\n this.c = this.a * this.x1 + this.b * this.y1\n }\n else {\n this.a = 1.0\n this.b = ((this.x1 - this.x2)) / ((this.y2 - this.y1))\n this.c = this.a * this.x1 + this.b * this.y1\n }\n }", "function get_line_y(c) {\n\treturn 94 + c * 75;\n}", "function Yg(a,b,c,d,e,h,k){var m=Zg;q&&(m=-m);this.dr=m*Math.PI/180;this.u=a;this.Xa=b;this.Mk=c;a.be.appendChild(this.eh(b,!(!h||!k)));$g(this,d,e);h&&k||(a=this.Xa.getBBox(),h=a.width+2*ah,k=a.height+2*ah);this.Ic(h,k);bh(this);ch(this);this.ai=!0;z||(v(this.nf,\"mousedown\",this,this.gr),this.mc&&v(this.mc,\"mousedown\",this,this.Fs))}", "function punto_y(){\n var y;\n y = height / 5;\n\n return(y);\n}", "function circleLessGreen(){\n g = g - 40;\n}", "function _f(x, y) {\n return (g.tx - x) * (g.tx - x) + (g.ty - y) * (g.ty - y);\n}", "y1(t) {\n return (\n Math.cos(t / 10) * -125 + Math.cos(t / 20) * 125 + Math.cos(t / 30) * 125\n );\n }", "function circleMoreGreen(){\n g = g + 40;\n}", "function r({w,r,x=10,y=20}){\n return w+r+x+y;\n }", "constructor(){\n this.x = (Math.random() * (745 - 51)) + 51;\n this.y = 25;\n this.v = 1 + Math.random() * 2;\n this.color = [16, 37, 66];\n }", "function $h(a){this.Y=null;this.Vd=new Pb(0,25);this.zb(a)}", "function x (x,y){\n let p = sz * 0.10;\n line((sz * x + sz) - p,\n (sz * y) + p,\n (sz * x) + p,\n (sz * y + sz) - p);\n line((sz * x) + p,\n (sz * y) + p,\n (sz * x + sz) - p,\n (sz * y + sz) - p);\n \n}", "function draw_A () {\n\t\n\tpomf=mouseX*0.1\n\t\n\t\n\tline (16-pomf,0-pomf, 60+pomf,-100+pomf);\n\tline (60-pomf,-100-pomf, 108+pomf, 0+pomf);\n\t\n\tline (6-pomf,0,26+pomf,0);\n\tline (98-pomf,0,118+pomf,0);\n\tline (52-pomf,-50,72+pomf,-50);\n\n\treturn 75;\n}", "constructor(name, x, y) {\n this.name = name;\n this.x = x;\n this.y = y;\n this.w = 50;\n this.h = 50;\n this.ax = x;\n this.ay = y;\n }", "function colorwheel(a,theta,x){return a*(1+cos(theta+x))}", "drawVariables(x, y , w, h) {\n this.x = x;\n this.y = y;\n this.w = w;\n this.h = h;\n }", "constructor(x, y, r) {\n this.x = x;\n this.y = y;\n this.r = r;\n this.a = random(255);\n this.brightness = random(100, 200);\n this.strokeR = 255;\n this.strokeG = 255;\n this.strokeB = 255;\n this.strokeA = random(255);\n this.strokeWeight = 0;\n // this.removal = removal;\n // this.xspeed = xspeed;\n // this.yspeed = yspeed;\n }", "function pt(r, a) {\n return [r * Math.cos(a) + cx, cy - r * Math.sin(a)];\n }", "constructor(x, y) {\n this.x = x;\n this.y = y;\n this.w = 100;\n this.h = 40;\n this.fillColor = color(255, 76, 39);\n this.id = 1;\n }", "function luminanace (r, g, b) {\n var a = [r, g, b].map(function (v) {\n v /= 255;\n return v <= 0.03928\n ? v / 12.92\n : Math.pow((v + 0.055) / 1.055, 2.4)\n })\n return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;\n}", "function draw() { \r\n background(234,31,58); // Set the background to black\r\n y = y - 1; \r\n if (y < 2) { \r\n y = height; \r\n } \r\n stroke(234,31,58);\r\n fill(234,31,184);\r\n rect(0, y, width, y); \r\n \r\n stroke(234,31,58);\r\n fill(234,226,128);\r\n rect(0, y, width, y/2); \r\n \r\n stroke(234,31,58);\r\n fill(250,159,114);\r\n rect(0, y, width, y/4); \r\n\r\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function xLng(x) {\n return (x - 0.5) * 360;\n}", "function n(e,t){var n=e.width,i=e.height,r=Math.round(t.x*n)%n,o=Math.round(t.y*i)%i;r<0&&(r+=n),o<0&&(o+=i);var a=o*n+r;return e.data[4*a+3]}", "constructor( x, y, r ){\n //This instance of x, y, and r are given assigned variables x, y, and r\n this.x = x;\n this.y = y;\n this.r = r;\n //Assigns value of 50 to this instance of variable abductionSize\n this.abductionSize = 50;\n //Assigns value of half of value of abductionSize to this instance of variable abductionR\n // this.abductionR = this.abductionSize / 2;\n\n //This instance of deltaX and deltaY are assigned values of 3\n this.deltaX = 3;\n this.deltaY = 3;\n\n //Assigns Boolean value of false\n this.flyOff = false;\n }", "function l(e,t,a){if(0===a)return e;a=(a-a%90)%360;var l=e.x,o=e.y;switch(a){case 90:l=t.height-e.y-e.height,o=e.x;break;case 180:l=t.width-e.x-e.width,o=t.height-e.y-e.height;break;case 270:l=e.y,o=t.width-e.x-e.width}return n(l,o,90===a||270===a?e.height:e.width,90===a||270===a?e.width:e.height)}", "constructor(alpha) {\n this.alpha = alpha\n this.y = 0\n this.z1 = 0\n }", "function luminanace(r, g, b) {\n var a = [r, g, b].map(function (v) {\n v /= 255;\n return v <= 0.03928\n ? v / 12.92\n : Math.pow( (v + 0.055) / 1.055, 2.4 );\n });\n return a[0] * 0.2126 + a[1] * 0.7152 + a[2] * 0.0722;\n}", "dibujar_p() {\n push();\n stroke('black');\n strokeWeight(3);\n translate(this.posx-((this._shape[0].length*this.longitud)/2),this.posy-((this._shape.length*this.longitud)/2));\n for (var i = 0; i < this._shape.length; i++) {\n for (var j = 0; j < this._shape[i].length; j++) {\n if (this._shape[i][j] != 0) {\n fill(this._shape[i][j]);\n rect(j * this.longitud, i * this.longitud, this.longitud, this.longitud);\n }\n } \n }\n pop();\n}", "constructor(x, y, r, g, b)\n {\n this.posX = x;\n this.posY = y;\n this.colour = [r, g, b]; //Array to set up color variable\n this.score = 0;\n //2D Array set up determin what number it is and what lines should be activated relative to that\n //Order is set up as: Top, Top Left, Top Right, Middle, Bottom Left, Bottom Right, Bottom.\n this.units = [[1, 1, 1, 0, 1, 1, 1],\n [0, 0, 1, 0, 0, 1, 0],\n [1, 0, 1, 1, 1, 0, 1],\n [1, 0, 1, 1, 0, 1, 1],\n [0, 1, 1, 1, 0, 1, 0],\n [1, 1, 0, 1, 0, 1, 1],\n [1, 1, 0, 1, 1, 1, 1],\n [1, 0, 1, 0, 0, 1, 0],\n [1, 1, 1, 1, 1, 1, 1],\n [1, 1, 1, 1, 0, 1, 1]];\n }", "function transform(p){\n\t\t\t\t\tvar x = (p[0] - data.bounds[0][0]) / (data.bounds[1][0] - data.bounds[0][0]);\n\t\t\t\t\tvar y = (p[1] - data.bounds[0][1]) / (data.bounds[1][0] - data.bounds[0][0]);\n\n\t\t\t\t\tx *= scale;\n\t\t\t\t\ty *= -scale * 1.75;\n\n\t\t\t\t\tx += -5;\n\t\t\t\t\ty += 5;\n\n\t\t\t\t\treturn [x, y];\n\t\t\t\t}", "function gtaCoordToMap(x, y)\r\n{\r\n\tvar mapx = x * 0.03;\r\n\tvar mapy = y * 0.03;\r\n\treturn {x: mapx, y: mapy};\r\n}", "function area_rectangulo(base,altura){\n return base*altura\n}", "function me(a){this.ra=a;this.hb=null;this.Rf=new ne(a,!0,!0);this.rg=new ne(a,!1,!0);this.Ef=v(\"rect\",{height:oe,width:oe,style:\"fill: #fff\"},null);pe(this.Ef,a.of)}", "function createX(){\n line(0, 0, -vScale/2, -vScale/2);\n line(0, 0, vScale/2, -vScale/2);\n line(0, 0, vScale/2, vScale/2);\n line(0, 0, -vScale/2, vScale/2);\n}", "function xb(a){this.radius=a}", "function ga(t,e,n){var i=t.getResolution(n),r=_a(t,e[0],e[1],i,!1),o=va(r,2),a=o[0],s=o[1],u=_a(t,e[2],e[3],i,!0),l=va(u,2),c=l[0],d=l[1];return{minX:a,minY:s,maxX:c,maxY:d}}", "function area(r) {\n \n return r*r\n}", "constructor(\n /**\n * Defines the red component (between 0 and 1, default is 0)\n */\n r = 0, \n /**\n * Defines the green component (between 0 and 1, default is 0)\n */\n g = 0, \n /**\n * Defines the blue component (between 0 and 1, default is 0)\n */\n b = 0, \n /**\n * Defines the alpha component (between 0 and 1, default is 1)\n */\n a = 1) {\n this.r = r;\n this.g = g;\n this.b = b;\n this.a = a;\n }", "function extraBpoints(mm){\n let shift;\n if (g.uniformGen == \"A\"){\n shift = 100;\n } else {\n shift = 75;\n }\n let value_temp = 550 - 5*mm + 150 - shift;\n push();\n strokeWeight(0); fill(255,0,0);\n circle(75, value_temp,12);\n circle(252, value_temp,12);\n strokeWeight(2); stroke(255,0,0);\n line(75,value_temp, 252+15, value_temp);\n pop();\n}", "init() {\n this.size = 20;\n this.sv = 1;\n this.a = 0;\n this.x = point.x;\n this.y = point.y;\n this.hue = hue;\n }", "calculateControlPoints(){\n \n\tthis.controlPoints = \n\t [ \n [\n [-this.base/2, 0, 0, 1],\n [-this.base/2, 0.7*this.base, 0, 1],\n [this.base/2, 0.7*this.base, 0 , 1],\n [this.base/2, 0, 0, 1]\n ],\n\n [\n [-this.top/2, 0, this.height, 1],\n [-this.top/2, 0.7*this.top, this.height, 1],\n [this.top/2, 0.7*this.top, this.height, 1],\n [this.top/2, 0, this.height, 1]\n ],\n ];\n\n \n }", "function newDrawing(data){\n noFill();\n\n for (var i = 0; i < 200; i += 20) {\n stroke (250);\n bezier(data.x-(i/2.0), data.y, 410, 20, 440, 300, 240-(i/16.0), 300+(i/8.0));\n } \n}", "function convert(x, y) {\n var new_x = (x + 50) * size_mult;\n var new_y = ((y * -1) + 50) * size_mult;\n return {'x': new_x, 'y': new_y};\n}", "function draw() {\n stroke(200 * mouseX / width ,200 * mouseY/ height , 10, 60)\n strokeWeight(12.0);\n strokeCap(ROUND);\n curve(width, height, mouseX, mouseY, mouseX, mouseY, mouseX, mouseY);\n curve(0, height, mouseX, mouseY, mouseX, mouseY, 100,99,60);\n curve(0, height, mouseX, mouseY, mouseX, mouseY, 100,mouseX,88);\n}", "function pt(r, a) {\n return [r * Math.cos(a) + cx, cy - r * Math.sin(a)];\n }", "function setup() {\n \n createCanvas(400,1200); \n \n background(255);\n colorMode(HSB,360,100,100);\n\n \n \tv = createVector(100,250);\n // v2 = createVector(v.x+150,v.y-75)\n tx = 107;\n ty=0;\n strokeWeight(2.0);\n v2 = createVector(v.x+170,v.y-75);\n \tanchorPoint = v2.copy();\n}", "function b(t){\n\t\t\t\tvar tsquared = t*t;\n\t\t\t\tvar tcubed = t*tsquared;\n\t\t\t\tomtsquared = (1-t)*(1-t);\n\t\t\t\tomtcubed = (1-t)*omtsquared\n\t\t\t\tvar bt = {\t\"x\": p0.x()*omtcubed + 3*p1.x()*t*omtsquared + 3*p2.x()*tsquared*(1-t) + p3.x()*tcubed,\n\t\t\t\t\t\t\t\"y\": p0.y()*omtcubed + 3*p1.y()*t*omtsquared + 3*p2.y()*tsquared*(1-t) + p3.y()*tcubed };\n\t\t\t\t\n\t\t\t\treturn bt;\n\t\t\t}", "constructor(x,y, angle){\n\t\tthis.x = x;\n\t\tthis.y = y;\n\t\tthis.angle = angle;\n this.map = map(mouseY, 0, height, 1, 254)\n this.c1 = fill(255);//white\n this.c2 = fill(0);//black\n this.co1 = fill(this.map,157,96); //light orange\n this.co2 = fill(255,107,15); //dark orange\n this.w = width;\n this.h = height;\n this.Y_AXIS = 1;\n this.X_AXIS = 2;\n this.num =10;\n this.move = 1\n \n\t}", "function Gl(a,b,c,d){this.h=null;this.Ga=Number(c);this.R=Number(b);this.Aa={height:this.Ga+10,width:this.R};this.Ka=d||\"\";this.la=u(\"g\",{},null);this.Of=u(\"image\",{height:this.Ga+\"px\",width:this.R+\"px\",y:-12},this.la);this.ja(a);Eb&&(this.ig=u(\"rect\",{height:this.Ga+\"px\",width:this.R+\"px\",y:-12,\"fill-opacity\":0},this.la))}", "constructor(x, y) {\n\t\tthis.chadX = 1000;\n\t\tthis.chadY = 10;\n\t\tthis.chadW = 10;\n\t\tthis.chadDy = 5;\n this.color = \"Red\";\n }", "function dda(imageData, x1, y1, x2, y2, r, g, b) {\r\n let dx = x2 - x1;\r\n let dy = y2 - y1;\r\n if (Math.abs(dx) > Math.abs(dy)) {\r\n // Penambahan pada sumbu x\r\n let y = y1;\r\n if (x2 > x1) {\r\n // Bergerak ke kanan\r\n for (let x = x1; x < x2; x++) {\r\n y = y + dy / Math.abs(dx);\r\n gambar_titik(imageData, Math.ceil(x), Math.ceil(y), r\r\n , g, b);\r\n }\r\n } else {\r\n // Bergerak ke kiri\r\n for (let x = x1; x > x2; x--) {\r\n y = y + dy / Math.abs(dx);\r\n gambar_titik(imageData, Math.ceil(x), Math.ceil(y), r\r\n , g, b);\r\n }\r\n }\r\n }\r\n else {\r\n // Penambahan pada sumbu y\r\n let x = x1;\r\n if (y2 > y1) {\r\n // Bergerak ke bawah\r\n for (let y = y1; y < y2; y++) {\r\n x = x + dx / Math.abs(dy);\r\n gambar_titik(imageData, Math.ceil(x), Math.ceil(y), r\r\n , g, b);\r\n }\r\n } else {\r\n // Bergerak ke atas\r\n for (let y = y1; y > y2; y--) {\r\n x = x + dx / Math.abs(dy);\r\n gambar_titik(imageData, Math.ceil(x), Math.ceil(y), r\r\n , g, b);\r\n }\r\n }\r\n }\r\n }", "function cong(x, y) {\n if (x === void 0) {\n x = 25;\n }\n if (y === void 0) {\n y = 75;\n }\n return x + y;\n}", "function posfor(x, y, axis) {\n if (axis == 0) return x * 9 + y;\n if (axis == 1) return y * 9 + x;\n return [0,3,6,27,30,33,54,57,60][x] + [0,1,2,9,10,11,18,19,20][y];\n}", "function posfor(x, y, axis) {\n if (axis == 0) return x * 9 + y;\n if (axis == 1) return y * 9 + x;\n return [0,3,6,27,30,33,54,57,60][x] + [0,1,2,9,10,11,18,19,20][y];\n}", "function fill_hyst(){\n var cor = 100;\n dens_chart = [];\n for (var i = 0; i < cor; i++) {\n dens_chart[i] = 0;\n }\n for(i = 0; i < y.length; i++){\n var addr = Math.floor( cor*(y[i]-min_y)/(max_y-min_y) );\n if (0 <= addr)\n dens_chart[addr]+=cor/ y.length/(max_y-min_y);\n }\n dist_chart[0] = 0;\n for (i = 0; i < cor; i++) {\n dist_chart[i+1] = dist_chart[i] + dens_chart[i]*(max_y-min_y)/cor;\n }\n}", "function normalLimbs(x,y,col=color(215,200,230)) {\n\tstroke(0);\n\tstrokeWeight(1);\n\t//antenna\n\tnoFill();\n\tstrokeWeight(10);\n\tarc((x+180),(y-110),160,160,radians(180),radians(270)); //bendy thing\n\tfill(135,215,255);\t\t//light blue\n\tstrokeWeight(1);\n\tellipse((x+180),(y-190),40,40); //ball\n\t//feet\n\tfill(col);\n\tellipse((x+100),(y+140),120,40);\n\t//arm\n\tarc((x+140),(y+30),100,100,radians(-135),radians(45),CHORD);\n}", "function dibujar_diente_sano_alr(canvas,px,py,num){\r\n\tif (canvas.getContext) {\r\n\t\t var ctx = canvas.getContext('2d');\r\n\t\t var k = (39*num);\r\n\tctx.beginPath();\r\n\tctx.arc((px+k),py,20,0,Math.PI*2,true);\r\n\tctx.fillStyle=\"rgba(255,255,0,0)\";\r\n\tctx.fill();\r\n\tctx.lineWidth = 3;\r\n\tctx.strokeStyle = \"white\";\r\n\tctx.stroke();\r\n\t}\r\n}", "function a$9(a){a.code.add(t$i`const float MAX_RGBA_FLOAT =\n255.0 / 256.0 +\n255.0 / 256.0 / 256.0 +\n255.0 / 256.0 / 256.0 / 256.0 +\n255.0 / 256.0 / 256.0 / 256.0 / 256.0;\nconst vec4 FIXED_POINT_FACTORS = vec4(1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0);\nvec4 float2rgba(const float value) {\nfloat valueInValidDomain = clamp(value, 0.0, MAX_RGBA_FLOAT);\nvec4 fixedPointU8 = floor(fract(valueInValidDomain * FIXED_POINT_FACTORS) * 256.0);\nconst float toU8AsFloat = 1.0 / 255.0;\nreturn fixedPointU8 * toU8AsFloat;\n}\nconst vec4 RGBA_2_FLOAT_FACTORS = vec4(\n255.0 / (256.0),\n255.0 / (256.0 * 256.0),\n255.0 / (256.0 * 256.0 * 256.0),\n255.0 / (256.0 * 256.0 * 256.0 * 256.0)\n);\nfloat rgba2float(vec4 rgba) {\nreturn dot(rgba, RGBA_2_FLOAT_FACTORS);\n}`);}", "function th(a){this.u=a;this.ma=null;this.Ce=new uh(a,!0,!0);this.af=new uh(a,!1,!0);this.pe=u(\"rect\",{height:kh,width:kh,style:\"fill: #fff\"},null);vh(this.pe,a.be)}", "function calc(data) {\n //calculating x and y values\n var fx = data[0][0] * Math.cos((Math.PI / 180) * data[0][1]) + data[1][0] * Math.cos((Math.PI / 180) * data[1][1]);\n var fy = data[0][0] * Math.sin((Math.PI / 180) * data[0][1]) + data[1][0] * Math.sin((Math.PI / 180) * data[1][1]);\n //calculating magnitude of resultant\n var r = Math.abs(Math.sqrt(((Math.pow(fx, 2)) + (Math.pow(fy, 2)))));\n //calculating angle of resultant\n //var an:number=180-(Math.atan(fy/fx)*180/Math.PI);\n var an = (Math.atan2(fy, fx)) * 180 / Math.PI;\n //calling printing function \n printfun(r, an);\n}", "function Dg(a){this.p=a;this.P=null;this.qd=new Eg(a,!0,!0);this.Nd=new Eg(a,!1,!0);this.ed=E(\"rect\",{height:T,width:T,style:\"fill: #fff\"},null);Fg(this.ed,a.Yc)}", "function micah() {\n stroke(0);\n fill(255);\n\n ellipse(420, -850, 30, 30);\n ellipse(420, -950, 30, 30);\n rect(380, -900, 20, 10);\n}", "function n(e,r,t){const{x:o,y:s}=r;if(t<2){return {x:e[0]+o*e[2]+s*e[4],y:e[1]+o*e[3]+s*e[5]}}if(2===t){const r=o*o,t=s*s,i=o*s;return {x:e[0]+o*e[2]+s*e[4]+r*e[6]+i*e[8]+t*e[10],y:e[1]+o*e[3]+s*e[5]+r*e[7]+i*e[9]+t*e[11]}}const i=o*o,n=s*s,p=o*s,a=i*o,f=i*s,c=o*n,l=s*n;return {x:e[0]+o*e[2]+s*e[4]+i*e[6]+p*e[8]+n*e[10]+a*e[12]+f*e[14]+c*e[16]+l*e[18],y:e[1]+o*e[3]+s*e[5]+i*e[7]+p*e[9]+n*e[11]+a*e[13]+f*e[15]+c*e[17]+l*e[19]}}", "set y(value) {}", "function drawPixel(x, y, r, g, b) {\n var index = (x + y * canvasWidth) * 4;\n\n canvasData.data[index + 0] = r;\n canvasData.data[index + 1] = g;\n canvasData.data[index + 2] = b;\n canvasData.data[index + 3] = 180;\n }", "static labToXYZ(l, a, b) {\n if (typeof l === \"object\") {\n ({ a } = l);\n ({ b } = l);\n ({ l } = l);\n }\n\n let y = (l + 16) / 116;\n let x = y + (a / 500);\n let z = y - (b / 200);\n\n if (x > 0.2068965517) {\n x = x * x * x;\n } else {\n x = 0.1284185493 * (x - 0.1379310345);\n }\n\n if (y > 0.2068965517) {\n y = y * y * y;\n } else {\n y = 0.1284185493 * (y - 0.1379310345);\n }\n\n if (z > 0.2068965517) {\n z = z * z * z;\n } else {\n z = 0.1284185493 * (z - 0.1379310345);\n }\n\n // D65 reference white point\n return {x: x * 95.047, y: y * 100.0, z: z * 108.883};\n }", "function y(x) {\n return (Math.sin(x / 2) + Math.cos(x / 4)) * 5;\n}", "function Pythagoras(x){\n noStroke();\n if(x<30){\n fill(255, 192, 203,map(x, 0, a, 150, 255));//color of square\n }else {\n fill(107, 142, 35,map(x, 0, a, 150, 255));//color of square\n }\n rect(0,0,x,x);//\n \n if (x <= 2) return 0;//suqare sides smaller than 2, stop\n\n //top right square\n push();\n rotate(PI / 2 - t);//rotate about 37 degree\n translate(0,-x/5 * 3 - x/5*4);\n Pythagoras(x/5*4);\n pop();\n\n //top left square\n push();\n rotate( - t);//rotate 53°\n translate(0,-x/5 * 3);\n Pythagoras(x/5*3);\n pop(); \n}", "function percentGrid() {\n fill(130)\n // y axis grid marks\n for (var i = 0; i < 11; i++) {\n var yLabelLength = 50\n noStroke()\n stroke(210)\n line(720, yLabelLength * i + 200 , 115, yLabelLength * i + 200)\n }\n //x axis grid marks\n for (var i = 0; i < 11; i++ ){\n var xLabelValues = [i] * 10\n xLabelValues.toString()\n fill(160)\n noStroke()\n textSize(10)\n text(xLabelValues, 90, -50 * i + 700)\n stroke(190)\n line( 60 * i + 120, 200, 60 * i + 120, 700)\n }\n}", "function Hc(a){this.radius=a}", "function circleY(x, r, a, sign) {\n\t return sign * Math.sqrt(Math.pow(r, 2) - Math.pow(x - a, 2));\n\t}", "function circleLessBlue(){\n b = b - 40;\n}", "function estilo1(){\n strokeWeight (10)\n //(ancho del borde)\n \n //stroke solo define color de relleno\n \n //1 es greyscale 0 negro 255 blanco\n //2 bn + alpha\n //3 rgb\n //4 rgb+alpha\n \n stroke (100)\n fill(0,50)\n \n}", "static scale(p, c) {\n return {x: (c * p.x), y: (c * p.y)};\n }", "function project(c, p, y) {\n return {\n x: c.x + (p.x-c.x) / (p.y-c.y) * (y-c.y),\n y: y\n };\n}", "function trC(coord){\n\treturn -95 + coord*10;\n}", "constructor(x,y,w,h,clr){\n this.x = x;\n this.y = y;\n this.w = w;\n this.h = h;\n this.clr = clr;\n}", "function g5(param) {\n var ref = _slicedToArray(param === void 0 ? [] : param, 2), tmp = ref[0], x = tmp === void 0 ? 0 : tmp, tmp1 = ref[1], y = tmp1 === void 0 ? 0 : tmp1;\n}", "Paraboloid(){\n\t\tlet parab = Math.pow(this.x,2) + Math.pow(this.y, 2); \n\t\treturn parab; \n\t}", "SmoothTangents() {}", "function Xb(a){this.radius=a}", "function Xa(a){this.radius=a}", "function t$8(t){t.vertex.code.add(t$i`const float PI = 3.141592653589793;`),t.fragment.code.add(t$i`const float PI = 3.141592653589793;\nconst float LIGHT_NORMALIZATION = 1.0 / PI;\nconst float INV_PI = 0.3183098861837907;\nconst float HALF_PI = 1.570796326794897;`);}", "y2(t) {\n return (\n Math.cos(t / 15) * 125 + Math.cos(t / 25) * 125 + Math.cos(t / 35) * 125\n );\n }", "function estilo1(){\n //ellipse(posX, posY, width, height) siempre en px\n //Se ejecuta después de stup 60 veces por segundo\n //Los parametros de color y borde se escriben antes de la figura\n \n //Tamaño de borde (puede ser reemplazado por variable LOCAL)\n strokeWeight(10);\n \n //color del borde\n stroke(210, 0, 100);\n \n //Color del relleno\n fill(0, 200, 0);\n}", "constructor(x, y) {\n this.x = x;\n this.y = y;\n this.size = 15;\n this.dx = random(3, 10);\n this.dy = random(0, 0);\n this.transparency = 255;\n this.color = color(150, this.transparency);\n }" ]
[ "0.6391052", "0.61730516", "0.61370814", "0.6108678", "0.6094876", "0.60914975", "0.6068002", "0.598916", "0.5968246", "0.5942434", "0.5940826", "0.591112", "0.58868766", "0.58752006", "0.5857745", "0.58426124", "0.5839398", "0.58363694", "0.58009154", "0.57877654", "0.57848215", "0.57774013", "0.5773812", "0.57605064", "0.574727", "0.57428557", "0.573365", "0.5728249", "0.57199126", "0.57199126", "0.57199126", "0.57199126", "0.57199126", "0.57199126", "0.57199126", "0.57199126", "0.57199126", "0.57189125", "0.5715773", "0.5713158", "0.5710811", "0.5708382", "0.5677955", "0.5677153", "0.5665065", "0.56498605", "0.56484574", "0.56433624", "0.5630119", "0.56236196", "0.56129783", "0.560925", "0.56001395", "0.55987185", "0.5593094", "0.55918115", "0.55896264", "0.5585904", "0.5582394", "0.5574764", "0.5572147", "0.55669504", "0.5563221", "0.5557973", "0.5547479", "0.553555", "0.5534842", "0.5524495", "0.5524495", "0.552067", "0.552048", "0.55120414", "0.55117357", "0.5507972", "0.5503637", "0.5501231", "0.5498158", "0.549665", "0.5496551", "0.5489462", "0.54860574", "0.54841787", "0.5476561", "0.54757667", "0.54748374", "0.54739416", "0.54725957", "0.5472289", "0.5471311", "0.54652125", "0.5464634", "0.5463186", "0.5462343", "0.545236", "0.5450655", "0.54481494", "0.5443864", "0.54436255", "0.5443405", "0.54413825", "0.5438987" ]
0.0
-1
END OF ISSUE RELATED VIEWS
function resetPreHeights(reverse) { // Set height of pre-columns to 100% of parent - bad CSS problem. var objectivePres = $('.explorer-resource-section-listing-item-pre, .explorer-resource-listing-labels-pre'); var i, objectivePre; for (i = 0; i < objectivePres.length; i++){ objectivePre = $(objectivePres[i]); if (reverse && reverse === true){ objectivePre.height(objectivePre.parent().find( '.explorer-resource-listing-body-content').height()); } else { objectivePre.height(objectivePre.parent().height()); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function View() {\n }", "function LView(){}", "function LView() { }", "function LView() { }", "function LView() {}", "function LView() {}", "function LView() {}", "function View(){}", "function TView() { }", "function TView() { }", "function directUserFromViewInfo() {\n if (nextStep == \"Departments\") {\n viewDepartments();\n }\n if (nextStep == \"Roles\") {\n viewRoles();\n }\n if (nextStep == \"Employees\") {\n viewEmployees();\n }\n if (nextStep == \"All Information\") {\n viewAll();\n } \n }", "function TView(){}", "function View() {}", "function View() {}", "function View() {}", "function View() {}", "function setupPersonFullView() {\r\n populatePersonFullData();\r\n}", "function ViewController(){}//Extends Controller (at bottom of page).", "function TView() {}", "function TView() {}", "function TView() {}", "function ViewData(){}", "function View() {\n // FIXME\n // Store base view elements\n\n // Store resuable view templates (result card, expanded profile cards, forms)\n\n // Render base view elements\n\n // Render\n}", "function viewNote() {\n // increment views\n Note.get({id: $stateParams.id}).$promise.then(function(response){\n $scope.resource = response.data.resource;\n $scope.relatedResources = response.data.related_resources;\n });\n }", "resaveView() {\n this.nature.current.resaveViews();\n this.animals.current.resaveViews();\n this.chill.current.resaveViews();\n this.places.current.resaveViews();\n this.other.current.resaveViews();\n }", "requestView(){\t\t\n\t\tthis.trigger('requestView');\n\t}", "get view() {\n return null;\n }", "function ViewData() {}", "function ViewData() {}", "function ViewData() {}", "get View() {}", "function ViewData() { }", "function ViewData() { }", "function PageView(options) {\n var that = this;\n View.apply(this, arguments);\n this.options = options;\n\n this.todo_id = that.options.args[0];\n this._subviews = [];\n this.loadModels();\n\n // create the layout\n this.layout = new HeaderFooterLayout({\n headerSize: App.Defaults.Header.size,\n footerSize: App.Defaults.Footer.size\n });\n\n this.createContent();\n this.createHeader();\n \n // Attach the main transform and the comboNode to the renderTree\n this.add(this.layout);\n\n\n this.model.populated().then(function(){\n\n // debugger;\n\n // Show user information\n that.contentLightbox.show(that.PageLayout);\n console.log(that.PageLayout.Views);\n\n // // Show Certify, Certified, or Nothing\n // // - determine is_me\n // if(that.model.get('is_me') == true && that.model.get('user_id') == App.Data.User.get('_id')){\n // console.error('is_me!');\n // that.profileRight.Layout.show(that.profileRight.EditProfile);\n // } else if (that.model.get('connected_user_id') == App.Data.User.get('_id')){\n // console.error('is_me!');\n // that.profileRight.Layout.show(that.profileRight.EditProfile);\n // } else {\n // that.is_me = false;\n // console.error('Not is_me!');\n\n // // Connected to this person?\n // // console.log(that.model.get('related_player_ids'));\n // // console.log(App.Data.Players.findMe().get('related_player_ids'));\n // // console.log(_.intersection(that.model.get('related_player_ids'),App.Data.Players.findMe().get('related_player_ids')));\n // // console.log(that.model.toJSON());\n // var my_friend_player_ids = _.pluck(App.Data.Players.toJSON(), '_id');\n // // console.log(my_friend_player_ids);\n // if(_.intersection(that.model.get('related_player_ids'),my_friend_player_ids).length > 0){\n // that.profileRight.Layout.show(that.profileRight.Connected);\n // } else {\n // that.profileRight.Layout.show(that.profileRight.Connect);\n // }\n // }\n\n // update going forward\n that.update_content();\n that.model.on('change', that.update_content.bind(that));\n\n });\n\n\n }", "view() {\n this.dialogCreateEditView.option(resource.ref.RefView);\n $(\"#btnDlHelp\").removeClass(\"button-disable\");\n $(\"#btnDlClose\").removeClass(\"button-disable\");\n $(\"#btnDlAdd\").removeClass(\"button-disable\");\n $(\"#btnDlUpdate\").removeClass(\"button-disable\");\n $(\"#btnDlPrev\").removeClass(\"button-disable\");\n $(\"#btnDlNext\").removeClass(\"button-disable\");\n $(\"#btnDlPrint\").removeClass(\"button-disable\");\n $(\"#btnDlDelete\").removeClass(\"button-disable\");\n $(\"#goFirst\").removeClass(\"button-disable\");\n $(\"#goLast\").removeClass(\"button-disable\");\n this.checkButtonViewDisable();\n this.checkSave = true;\n this.getRefByID(1);\n $(\"#dialogCreateEditView input:visible\").attr(\"disabled\", \"disabled\");\n $(\"#dialogCreateEditView input:visible\").parent().addClass(\"disable\");\n }", "function view(model) {\n return {\n //title: getTitle(),\n table: getTable(model),\n };\n}", "function fourthView(){\n populateAppropGridOnSubmit();\n populateAppropGridWhenPlotClicked();\n }", "function ViewManager() { }", "function viewsEvents()\n { $('#tree .b-delete-view').attr('title', T('DELETE_VIEW'));\n }", "function GetBudgetViews() {\n GetAddBudgetPartial();\n GetActiveBudgetsPartial();\n}", "get view(){return this._tempState.view;}", "synchronizeViewFromModel() {\n }", "function DesignView(apc,model) {\n this.apc = apc;\n this.model = model;\n this.style = apc.style;\n this.valid = true;\n // for the moment, default to natural mode\n this.style = apc.getval('style') || 'arc';\n this.view = apc.getval('view') || 'states';\n this.automark = true;\n this.autolike = false;\n this.footnote = false;\n this.footseq = null;\n this.footcount = 0;\n this.footmax = 100;\n this.footnotes = [];\n var myView = this;\n this.changed = function (model) {\n myView.valid = false;\n if (myView.model!=model) {\n if (myView.model) myView.model.noInterest(myView);\n }\n myView.model = model;\n if (model) {\n model.addInterest(myView,myView.changed.bind(myView));\n myView.valid = false;\n myView.recompute();\n myView.draw(apc.vp.ctx);\n apc.vp.valid = false;\n if (this.footnote && this.footseq && this.model.got==this.footseq)\n this.addFootnote();\n else if (this.bonusflag && this.footseq && this.model.got==this.footseq)\n this.addBonus();\n else if (this.autolike && this.likeseq && this.model.got==this.likeseq)\n this.addLike();\n }\n }\n if (model) model.addInterest(this,this.changed.bind(this));\n return this;\n}", "render(){if(this.renderer){this.renderer.call(this.owner,this.content,this.owner,this.model)}}", "function loadView() {\t\t\n\t\tvar srv1 = comc.requestLiteList('MENUPERF', $scope.cntx);\n\t\tvar srv2 = comc.requestLiteList('BOOL' , $scope.cntx);\n\t\t\n\t\t$q.all([srv.stResp(false, srv1)]).then(function(){\n\t\t\t$scope.cntx.form.get('perf').data = $scope.cntx.data.get('ltLMenuperf')[0].clav;\n\t\t\tvar srv3 = comc.request('ctmn/list', $scope.cntx);\n\t\t\t\n\t\t\t$q.all([srv.stResp(true, srv3)]).then(function(){\n\t\t\t\tview();\n\t\t\t});\n\t\t});\n\t}", "get currentView() { return this._currentView; }", "get currentView() { return this._currentView; }", "onViewChange() {\n \n }", "static view(v) {\n // Add history\n window.history.replaceState(State.preserve(), document.title);\n // Change views\n for (let view of Array.from(arguments)) {\n // Store view\n let element = UI.find(view);\n // Store parent\n let parent = element.parentNode;\n // Hide all\n for (let child of parent.children) {\n UI.hide(child);\n }\n // Show view\n UI.show(element);\n }\n // Add history\n window.history.pushState(State.preserve(), document.title);\n }", "function loadView() {\n\t\tvar srv1 = comc.requestLiteList('MENUPERF', $scope.cntx);\n\t\tvar srv2 = comc.requestLiteList('BOOL' , $scope.cntx);\n\t\t\n\t\t$q.all([srv.stResp(false, srv1)]).then(function(){\n\t\t\tview();\n\t\t});\n\t}", "function DebugView() { }", "showViewComp (type) {\n\t\t\tthis.$axios.get('api/do_m_scrpt_code/getThisScrpt/'+this.manu_script_id).then(res => {\n\t\t\t\tif (type == 'add') {\n\t\t\t\t\tthis.allManScrpt = res.data.data;\n\t\t\t\t\tthis.is_view_com = true;\n\t\t\t\t} else this.$emit('rowFunc','AuthorManuscriptView',res.data.data);\n\t\t\t});\n\t\t}", "showPost(model) {\n if (model && model.attributes.id) {\n this.postView = new PostEntry({ model });\n this.showChildView('entry', this.postView);\n Backbone.history.navigate(`portfolio/${model.attributes.id}`);\n } else {\n this.showErr();\n }\n }", "initViews() {\n this.views = this.generateViews();\n this.prepareViewsModelsFields();\n }", "function viewDataNew() {\n cleanScreenOfChampions();\n showChampions(dataChampions);\n}", "function View() {\n var self = this;\n this.currentDate = new Date();\n this.currentReport = {\n needToPickupList: [],\n absenceList: [],\n pickedUpList: []\n };\n }", "set View(value) {}", "function view(model){\n return {\n title: getTitle(),\n table: getTable(model)\n }\n}", "function view(model){\n return {\n title: getTitle(),\n table: getTable(model)\n }\n}", "function view(model){\n return {\n title: getTitle(),\n table: getTable(model)\n }\n}", "function view(model){\n return {\n title: getTitle(),\n table: getTable(model)\n }\n}", "function view(model){\n return {\n title: getTitle(),\n table: getTable(model)\n }\n}", "function view(model){\n return {\n title: getTitle(),\n table: getTable(model)\n }\n}", "function view(model){\n return {\n title: getTitle(),\n table: getTable(model)\n }\n}", "function view(model){\n return {\n title: getTitle(),\n table: getTable(model)\n }\n}", "get views() {\r\n return new Views(this);\r\n }", "function ProjectRoomInfoController(){}", "function loadView() {\n\t\tvar srv1 = comc.request('cuen/list', $scope.cntx);\n\t\t\n\t\t$q.all([srv.stResp(true, srv1)]).then(function() {\n\t\t\tview();\n\t\t});\n\t}", "function addNewItem() { switchToView('edit-form'); }", "function onView(row){\n var record = row.row.getRecord();\n var tableName = record.getValue('docs_assigned.vf_table_name');\n var docName = record.getValue('docs_assigned.doc');\n var fieldName = \"doc\";\n var keys = {};\n var ds = View.dataSources.get('abEhsTrackDocumentation_ds');\n \n switch (tableName) {\n\tcase 'ehs_training_results':\n\t\tvar dateKey = ds.formatValue('docs_assigned.date_doc', record.getValue('docs_assigned.date_key'), false);\n\t keys = {\n \t\t'training_id': record.getValue('docs_assigned.training_id'),\n \t\t'em_id': record.getValue('docs_assigned.em_id'),\n \t\t'date_actual': dateKey\n\t };\n\t break;\n\n\tcase 'ehs_em_ppe_types':\n\t\tvar dateKey = ds.formatValue('docs_assigned.date_doc', record.getValue('docs_assigned.date_key'), false);\n\t keys = {\n \t\t'ppe_type_id': record.getValue('docs_assigned.ppe_type_id'),\n \t\t'em_id': record.getValue('docs_assigned.em_id'),\n \t\t'date_use': dateKey\n\t };\n\t break;\n\n\tcase 'ehs_incidents':\n\t\tfieldName = \"cause_doc\";\n\t\tkeys = {'incident_id': record.getValue('docs_assigned.incident_id')};\n\t break;\n\n\tcase 'ehs_incident_witness':\n\t\tkeys = {'incident_witness_id': record.getValue('docs_assigned.incident_witness_id')};\n\t break;\n\n\tcase 'ehs_restrictions':\n\t\tkeys = {'restriction_id': record.getValue('docs_assigned.restriction_id')};\n\t break;\n\n\tcase 'docs_assigned':\n\tdefault:\n\t keys = {'doc_id': record.getValue('docs_assigned.doc_id')};\n\t break;\n\t}\n \n \n View.showDocument(keys, tableName, fieldName, docName);\n}", "renderView() {\n super.renderView();\n\n this.parent.className = 'detail';\n\n const tag = this.getTagFromLocation();\n\n this.db.fetchRestaurantByTag(tag).then(restaurant => {\n if (restaurant) {\n this.bc.reset();\n this.bc.addCrumb(restaurant.name, '');\n this.bc.render();\n\n // Add map marker\n this.map.addMarker(restaurant.name, restaurant.latlng, DBHelper.urlForRestaurant(restaurant));\n this.map.resetView();\n\n this.appendRestaurantDetails(restaurant);\n\n this.appendReviews(restaurant.id, restaurant.tag);\n }\n else {\n this.renderError();\n }\n });\n }", "get view() {\n\t\treturn this._v;\n\t}", "function clickedViewData()\n{\n var connObj = dw.databasePalette.getSelectedNode();\n if (connObj && \n ((connObj.objectType==\"Table\")||\n\t(connObj.objectType==\"View\")))\t\n {\n\tvar objname = connObj.name;\n\tvar connname = connObj.parent.parent.name;\n\tobjname = encodeSQLReference(objname, connname);\n\tobjname = dwscripts.unescServerQuotes(objname);\n\tvar sqlstatement = \"Select * from \" + objname;\n\tMMDB.showResultset(connname,sqlstatement,MM.MSG_ViewData);\n }\n}", "function mainCtrl($scope, $rootScope, $log, $location, $window, $timeout, toastr, UsersResourceService, AppService) {\n $scope.subView = 'patchNotes';\n // Subview shift Fn\n $scope.subViewShift = function (view) {\n switch (view) {\n case \"svrAnnouncements\" :\n $scope.subView = view;\n break;\n case \"patchNotes\" :\n $scope.subView = view;\n break;\n case \"patches\" :\n $scope.subView = view;\n break;\n }\n };\n }", "function createViewModule() {\n\n var LIST_VIEW = 'LIST_VIEW';\n var GRID_VIEW = 'GRID_VIEW';\n var RATING_CHANGE = 'RATING_CHANGE';\n\n\n /**\n * An object representing a DOM element that will render the given ImageModel object.\n */\n var ImageRenderer = function(imageModel) {\n var self = this;\n \n // Constants\n this.unavailablePath = 'unavailable.svg';\n this.unavailableName = '(image not available)';\n this.unavailableCaption = '(click to add caption)';\n \n // Save the incoming image model\n this.imageModel = imageModel;\n this.currentView = GRID_VIEW;\n \n // Register as a listener to the image model\n this.modelDidChangeListenerFunction = function(imageModel, eventTime) {\n self.setImageModel(imageModel);\n };\n \n // Clone the template\n var imageTemplate = document.getElementById('image-item-template').content;\n this.imageOuterDiv = document.createElement('div'); \n this.imageOuterDiv.appendChild(document.importNode(imageTemplate, true));\n \n this.imageDiv = this.imageOuterDiv.querySelector('.ft-item');\n \n this.imageContainer = this.imageDiv.querySelector('.ft-item-image-container');\n this.metadataContainer = this.imageDiv.querySelector('.ft-item-metadata-container');\n \n this.imageField = this.imageDiv.querySelector('.ft-item-image');\n this.captionField = this.imageDiv.querySelector('.ft-item-caption');\n this.nameField = this.imageDiv.querySelector('.ft-item-name');\n this.dateField = this.imageDiv.querySelector('.ft-item-date');\n \n // Add a RatingsView instance to it\n this.ratingsInstance = new RatingsView(this.imageModel);\n this.imageDiv.querySelector('.ft-item-metadata-container').appendChild(this.ratingsInstance.getElement());\n \n // Add an event listener to the image to catch load errors\n this.imageField.addEventListener('error', function(event) {\n event.stopPropagation();\n event.preventDefault();\n \n // base64-encoded version of unavailable.svg\n // Using this in case unavailable.svg goes missing, otherwise we get stuck in an infinite loop\n this.src = \"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNS4wLjIsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIyODBweCINCgkgaGVpZ2h0PSIyODBweCIgdmlld0JveD0iMCAwIDI4MCAyODAiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDI4MCAyODAiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGcgaWQ9IkxheWVyXzJfMl8iPg0KCTxyZWN0IGZpbGw9IiNGRkZGRkYiIHdpZHRoPSIyODAiIGhlaWdodD0iMjgwIi8+DQo8L2c+DQo8ZyBpZD0iTGF5ZXJfMSI+DQoJPGcgaWQ9IkxheWVyXzJfMV8iPg0KCQk8ZyBpZD0iTGF5ZXJfMiIgZGlzcGxheT0ibm9uZSI+DQoJCQkNCgkJCQk8Y2lyY2xlIGRpc3BsYXk9ImlubGluZSIgZmlsbD0iI0RERERERCIgc3Ryb2tlPSIjQkZCRkJGIiBzdHJva2Utd2lkdGg9IjE0IiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIGN4PSIxMTcuMzk4IiBjeT0iOTYuMDU5IiByPSI1My43OTciLz4NCgkJCQ0KCQkJCTxsaW5lIGRpc3BsYXk9ImlubGluZSIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjQkZCRkJGIiBzdHJva2Utd2lkdGg9IjE0IiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHgxPSIxNTUuODAxIiB5MT0iMTMzLjcyIiB4Mj0iMjI2LjQ2NiIgeTI9IjIwNC4zODciLz4NCgkJCTxnIGRpc3BsYXk9ImlubGluZSIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAgICAiPg0KCQkJCTxwYXRoIGZpbGw9IiM3RjdGN0YiIGQ9Ik0yMzEuOTkzLDIwNi43ODRjMC0yMy4zOTcsMzMuMTYxLTI1LjIzOSwzMy4xNjEtNDQuNzcxYzAtOS4yMTEtNy4xODQtMTcuMTM0LTIxLjU1NS0xNy4xMzQNCgkJCQkJYy0xNC4wMDIsMC0yMi42NjIsNS44OTYtMjkuNDc5LDE1LjEwOGwtOS4yMTItOS45NDljOC44NDQtMTEuNjA3LDIyLjQ3OC0xOC43OTIsMzkuOTc5LTE4Ljc5Mg0KCQkJCQljMjIuNDc3LDAsMzYuMTA5LDEyLjcxMiwzNi4xMDksMjguNTU4YzAsMjcuODE3LTM1LjU1OSwzMC4yMTMtMzUuNTU5LDQ4LjI3YzAsMi45NDcsMS42NTgsNi42MzMsNC43OTEsOC44NDRsLTExLjIzOCw0Ljk3NQ0KCQkJCQlDMjM0LjAyLDIxNy42NTQsMjMxLjk5MywyMTIuNDk1LDIzMS45OTMsMjA2Ljc4NHogTTIzMi43MywyNDcuNjg2YzAtNS41MjYsNC42MDQtMTAuMTM0LDEwLjEzMy0xMC4xMzQNCgkJCQkJYzUuNTI3LDAsMTAuMTMzLDQuNjA2LDEwLjEzMywxMC4xMzRjMCw1LjUyNi00LjYwNSwxMC4xMzMtMTAuMTMzLDEwLjEzM0MyMzcuMzM1LDI1Ny44MTgsMjMyLjczLDI1My4yMTIsMjMyLjczLDI0Ny42ODZ6Ii8+DQoJCQk8L2c+DQoJCTwvZz4NCgkJPGNpcmNsZSBmaWxsPSIjREREREREIiBzdHJva2U9IiNCRkJGQkYiIHN0cm9rZS13aWR0aD0iMTQiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgY3g9IjExNS41OTciIGN5PSI5Ni40NjciIHI9IjUwLjUyMiIvPg0KCQkNCgkJCTxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0JGQkZCRiIgc3Ryb2tlLXdpZHRoPSIxNCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiB4MT0iMTUwLjU2MSIgeTE9IjEzMS40MzMiIHgyPSIyMTYuODg3IiB5Mj0iMTk3Ljc1NyIvPg0KCTwvZz4NCgk8ZyBpZD0iTGF5ZXJfMyI+DQoJCTxnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgICAgIj4NCgkJCTxwYXRoIGZpbGw9IiNCRkJGQkYiIGQ9Ik0yMDYuMTkzLDkzLjE1M2MwLTE3LjY4NiwyNS4wNjUtMTkuMDc4LDI1LjA2NS0zMy44MzljMC02Ljk2My01LjQzMi0xMi45NTEtMTYuMjk0LTEyLjk1MQ0KCQkJCWMtMTAuNTg0LDAtMTcuMTI4LDQuNDU3LTIyLjI3OSwxMS40MTlsLTYuOTYzLTcuNTJjNi42ODUtOC43NzQsMTYuOTg4LTE0LjIwNCwzMC4yMTktMTQuMjA0DQoJCQkJYzE2Ljk4OCwwLDI3LjI5NSw5LjYwOSwyNy4yOTUsMjEuNTg1YzAsMjEuMDI4LTI2Ljg3OSwyMi44MzctMjYuODc5LDM2LjQ4NWMwLDIuMjI5LDEuMjU0LDUuMDE0LDMuNjIzLDYuNjg1bC04LjQ5NCwzLjc2DQoJCQkJQzIwNy43MjUsMTAxLjM2OCwyMDYuMTkzLDk3LjQ3LDIwNi4xOTMsOTMuMTUzeiBNMjA2Ljc1MSwxMjQuMDY3YzAtNC4xNzcsMy40NzktNy42NTgsNy42NTgtNy42NTgNCgkJCQljNC4xNzcsMCw3LjY1OSwzLjQ4MSw3LjY1OSw3LjY1OGMwLDQuMTc5LTMuNDgyLDcuNjYtNy42NTksNy42NkMyMTAuMjMsMTMxLjcyOCwyMDYuNzUxLDEyOC4yNDYsMjA2Ljc1MSwxMjQuMDY3eiIvPg0KCQk8L2c+DQoJPC9nPg0KCTxnPg0KCQk8Zz4NCgkJCTxwb2x5bGluZSBmaWxsPSJub25lIiBzdHJva2U9IiNEREREREQiIHN0cm9rZS13aWR0aD0iMTQiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgcG9pbnRzPSIyNzMsMjU1IDI3MywyNzMgMjU1LDI3MyAJCQkiLz4NCgkJCQ0KCQkJCTxsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0RERERERCIgc3Ryb2tlLXdpZHRoPSIxNCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBzdHJva2UtZGFzaGFycmF5PSI0MC41ODgyLDI3LjA1ODgiIHgxPSIyMjcuOTQxIiB5MT0iMjczIiB4Mj0iMzguNTI5IiB5Mj0iMjczIi8+DQoJCQk8cG9seWxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjREREREREIiBzdHJva2Utd2lkdGg9IjE0IiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHBvaW50cz0iMjUsMjczIDcsMjczIDcsMjU1IAkJCSIvPg0KCQkJDQoJCQkJPGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjREREREREIiBzdHJva2Utd2lkdGg9IjE0IiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS1kYXNoYXJyYXk9IjQwLjU4ODIsMjcuMDU4OCIgeDE9IjciIHkxPSIyMjcuOTQxIiB4Mj0iNyIgeTI9IjM4LjUyOSIvPg0KCQkJPHBvbHlsaW5lIGZpbGw9Im5vbmUiIHN0cm9rZT0iI0RERERERCIgc3Ryb2tlLXdpZHRoPSIxNCIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBwb2ludHM9IjcsMjUgNyw3IDI1LDcgCQkJIi8+DQoJCQkNCgkJCQk8bGluZSBmaWxsPSJub25lIiBzdHJva2U9IiNEREREREQiIHN0cm9rZS13aWR0aD0iMTQiIHN0cm9rZS1taXRlcmxpbWl0PSIxMCIgc3Ryb2tlLWRhc2hhcnJheT0iNDAuNTg4MiwyNy4wNTg4IiB4MT0iNTIuMDU5IiB5MT0iNyIgeDI9IjI0MS40NzEiIHkyPSI3Ii8+DQoJCQk8cG9seWxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjREREREREIiBzdHJva2Utd2lkdGg9IjE0IiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHBvaW50cz0iMjU1LDcgMjczLDcgMjczLDI1IAkJCSIvPg0KCQkJDQoJCQkJPGxpbmUgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjREREREREIiBzdHJva2Utd2lkdGg9IjE0IiBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiIHN0cm9rZS1kYXNoYXJyYXk9IjQwLjU4ODIsMjcuMDU4OCIgeDE9IjI3MyIgeTE9IjUyLjA1OSIgeDI9IjI3MyIgeTI9IjI0MS40NzEiLz4NCgkJPC9nPg0KCTwvZz4NCgk8dGV4dCB0cmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAxIDI3LjQ5MDIgMjQzKSIgZmlsbD0iIzdGN0Y3RiIgZm9udC1mYW1pbHk9IidQcm94aW1hTm92YS1SZWd1bGFyJyIgZm9udC1zaXplPSIzMiI+cGhvdG8gbm90IGZvdW5kPC90ZXh0Pg0KPC9nPg0KPC9zdmc+DQo=\";\n \n// try {\n// this.src = self.unavailablePath;\n// }\n// catch (err) {\n// this.src = \"\";\n// }\n });\n \n // Add an event listener to the image to allow users to click it to zoom in\n this.imageContainer.addEventListener('click', function(event) {\n var lightbox = new Lightbox();\n lightbox.showImage(self.imageField.src);\n });\n \n // Add event listeners to activate the edit caption fields\n this.editCaptionContainer = this.imageDiv.querySelector('.ft-item-caption-input-container');\n this.editCaptionInputField = this.imageDiv.querySelector('.ft-item-caption-input');\n this.editCaptionSaveButton = this.imageDiv.querySelector('.ft-item-caption-save-btn');\n this.editCaptionCancelButton = this.imageDiv.querySelector('.ft-item-caption-cancel-btn');\n \n this.captionField.addEventListener('click', function(event) {\n // Toggle the two fields\n self.captionField.classList.add('nodisplay');\n self.editCaptionContainer.classList.remove('nodisplay');\n \n // Fill in the text box with whatever was previously there\n if (self.captionField.innerText != self.unavailableCaption) {\n self.editCaptionInputField.value = self.captionField.innerText;\n }\n else {\n self.editCaptionInputField.value = \"\";\n }\n \n // Focus the text box\n self.editCaptionInputField.focus();\n \n // Allow users to save by pressing Enter and cancel by pressing Escape\n self.editCaptionInputField.addEventListener('keypress', function(event) {\n if (event.keyCode == 13) {\n self.editCaptionSaveButton.dispatchEvent(new Event('click'));\n }\n else if (event.keyCode == 27) {\n self.editCaptionCancelButton.dispatchEvent(new Event('click'));\n }\n });\n \n // Add event listeners to activate the Save and Cancel buttons\n self.editCaptionSaveButton.addEventListener('click', function(event) {\n self.imageModel.setCaption(self.editCaptionInputField.value.trim());\n \n self.captionField.classList.remove('nodisplay');\n self.editCaptionContainer.classList.add('nodisplay');\n });\n self.editCaptionCancelButton.addEventListener('click', function(event) {\n self.captionField.classList.remove('nodisplay');\n self.editCaptionContainer.classList.add('nodisplay');\n });\n });\n \n this.setImageModel(imageModel);\n };\n\n _.extend(ImageRenderer.prototype, {\n \t_formatDate: function(date) {\n var hours = date.getHours();\n var minutes = date.getMinutes();\n var AMPM = (hours < 12 ? \"AM\" : \"PM\");\n hours = hours % 12;\n hours = (hours === 0 ? 12 : hours);\n minutes = (minutes < 10 ? \"0\" : \"\") + minutes;\n \n return date.toDateString() + \", \" + hours + \":\" + minutes + \" \" + AMPM;\n },\n \n /**\n * Returns an element representing the ImageModel, which can be attached to the DOM\n * to display the ImageModel.\n */\n getElement: function() {\n return this.imageOuterDiv;\n },\n\n /**\n * Returns the ImageModel represented by this ImageRenderer.\n */\n getImageModel: function() {\n return this.imageModel;\n },\n\n /**\n * Sets the ImageModel represented by this ImageRenderer, changing the element and its\n * contents as necessary.\n */\n setImageModel: function(imageModel) {\n // Unregister from the old model \n this.imageModel.removeListener(this.modelDidChangeListenerFunction);\n \n // Save the new ImageModel and update our rendering\n this.imageModel = imageModel;\n \n var imagePath = imageModel.getPath() || this.unavailablePath;\n var captionText = imageModel.getCaption();\n captionText = (captionText.length === 0 ? this.unavailableCaption : captionText);\n \n this.imageField.src = imagePath;\n this.captionField.innerText = captionText;\n this.nameField.innerText = imagePath; // (imagePath.search(/^images\\//) === -1 ? (imagePath || unavailableName) : imagePath.split('/').slice(1).join('/'));\n this.dateField.innerText = this._formatDate(imageModel.getModificationDate());\n this.ratingsInstance.setModel(this.imageModel);\n// this.ratingsInstance.setRating(imageModel.getRating());\n \n // Reregister the new model\n this.imageModel.addListener(this.modelDidChangeListenerFunction);\n },\n\n /**\n * Changes the rendering of the ImageModel to either list or grid view.\n * @param viewType A string, either LIST_VIEW or GRID_VIEW\n */\n setToView: function(viewType) {\n this.currentView = viewType;\n \n if (viewType == LIST_VIEW) {\n this.imageDiv.classList.add('ft-item-list-view');\n this.imageContainer.classList.add('ft-item-image-container-list-view');\n this.metadataContainer.classList.add('ft-item-metadata-container-list-view')\n }\n else if (viewType = GRID_VIEW) {\n this.imageDiv.classList.remove('ft-item-list-view');\n this.imageContainer.classList.remove('ft-item-image-container-list-view');\n this.metadataContainer.classList.remove('ft-item-metadata-container-list-view')\n }\n },\n\n /**\n * Returns a string of either LIST_VIEW or GRID_VIEW indicating which view type it is\n * currently rendering.\n */\n getCurrentView: function() {\n \t return this.currentView;\n }\n });\n\n\n /**\n * A factory is an object that creates other objects. In this case, this object will create\n * objects that fulfill the ImageRenderer class's contract defined above.\n */\n var ImageRendererFactory = function() {\n };\n\n _.extend(ImageRendererFactory.prototype, {\n\n /**\n * Creates a new ImageRenderer object for the given ImageModel\n */\n createImageRenderer: function(imageModel) {\n return new ImageRenderer(imageModel);\n }\n });\n\n\n /**\n * An object representing a DOM element that will render an ImageCollectionModel.\n * Multiple such objects can be created and added to the DOM (i.e., you shouldn't\n * assume there is only one ImageCollectionView that will ever be created).\n */\n var ImageCollectionView = function() {\n var self = this;\n this.currentView = GRID_VIEW;\n \n // Clone the template\n var collectionTemplate = document.getElementById('image-collection-template').content;\n this.collectionOuterDiv = document.createElement('div');\n this.collectionOuterDiv.appendChild(document.importNode(collectionTemplate, true));\n \n this.collectionDiv = this.collectionOuterDiv.querySelector('.ft-container');\n \n this.emptyMessageDiv = this.collectionOuterDiv.querySelector('.ft-empty-container');\n \n // Keep a reference to the ImageCollectionModel\n this.imageCollectionModel = undefined;\n \n // Keep a reference to an ImageRendererFactory\n this.imageRendererFactory = new ImageRendererFactory();\n \n // Keep a collection of ImageRenderers\n this.imageRendererDivPairs = [];\n \n // Define the listener function for model changes\n this.modelDidChangeListenerFunction = function(eventType, imageModelCollection, imageModel, eventDate) {\n if (eventType == 'IMAGE_ADDED_TO_COLLECTION_EVENT') {\n self._renderModelToView(imageModel);\n }\n else if (eventType == 'IMAGE_REMOVED_FROM_COLLECTION_EVENT') {\n self._unrenderModelFromView(imageModel);\n }\n else if (eventType == 'IMAGE_META_DATA_CHANGED_EVENT') {\n //self._refreshUpdatedModel(imageModel);\n }\n };\n \n // Define the listener function for view changes\n this.viewDidChangeListenerFunction = function(toolbar, eventType, eventDate) {\n if (eventType == LIST_VIEW || eventType == GRID_VIEW) {\n self.setToView(eventType);\n }\n else if (eventType = RATING_CHANGE) {\n self._filterByRating(toolbar.getCurrentRatingFilter());\n }\n };\n };\n\n _.extend(ImageCollectionView.prototype, {\n _checkInit: function() {\n if (!(this.imageCollectionModel && this.imageRendererFactory)) {\n throw new Error(\"ImageCollectionView has not been initialized yet.\");\n }\n },\n \n /**\n * Renders a given ImageModel to the view and adds an ImageRenderer object\n * to the internal collection\n */\n _renderModelToView: function(imageModel) {\n this._checkInit();\n \n var self = this;\n \n // Create the container to hold the ImageRenderer\n var container = document.createElement('div');\n container.className = \"ft-icv-item-container ft-icv-item-container-new\";\n \n // Copy the delete overlay into the container\n var deleteTemplate = document.getElementById('image-item-delete-overlay-template').content;\n container.appendChild(document.importNode(deleteTemplate, true));\n \n // Add event listeners to activate the delete buttons\n var deleteMessage = container.querySelector('.ft-item-delete-overlay-content-message');\n var deleteHoverIcon = container.querySelector('.ft-item-delete-icon');\n var deleteOverlay = container.querySelector('.ft-item-delete-overlay');\n var deleteRemoveButton = deleteOverlay.querySelector('.btn-danger');\n var deleteCancelButton = deleteOverlay.querySelector('.btn-light');\n \n container.addEventListener('mouseover', function(event) {\n deleteHoverIcon.classList.remove('nodisplay');\n });\n container.addEventListener('mouseout', function(event) {\n deleteHoverIcon.classList.add('nodisplay');\n });\n \n deleteHoverIcon.addEventListener('mousemove', function(event) {\n deleteHoverIcon.classList.remove('nodisplay');\n });\n deleteHoverIcon.addEventListener('click', function(event) {\n deleteOverlay.classList.remove('nodisplay');\n });\n \n deleteRemoveButton.addEventListener('click', function(event) {\n deleteRemoveButton.disabled = true;\n deleteCancelButton.disabled = true;\n deleteMessage.innerHTML = 'Removing&hellip;';\n \n self.getImageCollectionModel().removeImageModel(imageModel);\n });\n \n deleteCancelButton.addEventListener('click', function(event) {\n deleteOverlay.classList.add('ft-item-delete-hidden');\n });\n \n deleteOverlay.addEventListener('webkitAnimationEnd', function(event) {\n if (deleteOverlay.classList.contains('ft-item-delete-hidden')) {\n deleteOverlay.classList.add('nodisplay');\n deleteOverlay.classList.remove('ft-item-delete-hidden');\n }\n });\n deleteOverlay.addEventListener('animationend', function(event) {\n if (deleteOverlay.classList.contains('ft-item-delete-hidden')) {\n deleteOverlay.classList.add('nodisplay');\n deleteOverlay.classList.remove('ft-item-delete-hidden');\n }\n });\n \n // Create an ImageRenderer for the ImageModel\n var renderer = this.imageRendererFactory.createImageRenderer(imageModel);\n \n // Append the ImageRenderer element to the container\n container.appendChild(renderer.getElement());\n \n // Add the container to the DOM\n this.emptyMessageDiv.classList.add('nodisplay');\n var divOnDom = this.collectionDiv.appendChild(container);\n \n renderer.setToView(this.currentView);\n divOnDom.classList.remove('nodisplay');\n setTimeout(function() {\n divOnDom.classList.remove('ft-icv-item-container-new');\n }, 750);\n// divOnDom.scrollIntoView(true);\n \n this.imageRendererDivPairs.push({imageRenderer: renderer, divOnDom: divOnDom});\n },\n \n /**\n * Removes a given ImageModel from the view and removes the corresponding\n * ImageRenderer object(s) from the internal collection\n */\n _unrenderModelFromView: function(imageModel) {\n this._checkInit();\n \n var self = this;\n \n var pair;\n var findImageModelPredicate = function(pair) {\n return pair.imageRenderer.getImageModel() == imageModel;\n };\n while (pair = _.find(this.imageRendererDivPairs, findImageModelPredicate)) {\n var divToRemove = pair.divOnDom;\n \n // Add the .ft-icv-item-container-deleted class to animate out\n // the deletion before removing it from the DOM\n divToRemove.classList.add('ft-icv-item-container-deleted');\n \n setTimeout(function() {\n self.collectionDiv.removeChild(divToRemove);\n }, 500);\n \n var index = this.imageRendererDivPairs.indexOf(pair);\n if (index !== -1) {\n this.imageRendererDivPairs.splice(index, 1);\n }\n }\n \n setTimeout(function() {\n if (self.imageRendererDivPairs.length === 0) {\n self.emptyMessageDiv.classList.remove('nodisplay');\n }\n }, 500);\n },\n \n /**\n * Convenience functions to re-render an ImageCollectionModel \n */\n _rerenderAll: function() {\n this._checkInit();\n this._unrenderAll();\n \n var self = this;\n \n _.each(this.imageCollectionModel.getImageModels(), function(imageModel) {\n self._renderModelToView(imageModel);\n });\n },\n \n _unrenderAll: function() {\n while (this.imageRendererDivPairs.length > 0) {\n this._unrenderModelFromView(this.imageRendererDivPairs[0].imageRenderer.getImageModel());\n }\n },\n \n /**\n * Shows / hides all the currently-rendered DIVs based on the rating\n */\n _filterByRating: function(rating) {\n _.each(this.imageRendererDivPairs, function(pair) {\n if (pair.imageRenderer.getImageModel().getRating() >= rating) {\n pair.divOnDom.classList.remove('nodisplay');\n }\n else {\n pair.divOnDom.classList.add('nodisplay');\n }\n })\n },\n \n /**\n * Attaches the view to a toolbar for view updating the view mode and filter\n */\n attachToToolbar: function(toolbar) {\n toolbar.addListener(this.viewDidChangeListenerFunction);\n \n this.setToView(toolbar.getCurrentView());\n },\n \n /**\n * Detaches the view from a toolbar\n */\n detachFromToolbar: function(toolbar) {\n toolbar.removeListener(this.viewDidChangeListenerFunction);\n },\n \n /**\n * Returns an element that can be attached to the DOM to display the ImageCollectionModel\n * this object represents.\n */\n getElement: function() {\n return this.collectionOuterDiv;\n },\n\n /**\n * Gets the current ImageRendererFactory being used to create new ImageRenderer objects.\n */\n getImageRendererFactory: function() {\n return this.imageRendererFactory;\n },\n \n /**\n * Sets the ImageRendererFactory to use to render ImageModels. When a *new* factory is provided,\n * the ImageCollectionView should redo its entire presentation, replacing all of the old\n * ImageRenderer objects with new ImageRenderer objects produced by the factory.\n */\n setImageRendererFactory: function(imageRendererFactory) {\n // Set the new image renderer factory\n this.imageRendererFactory = imageRendererFactory;\n \n // Remove and regenerate all the images if we have a model\n if (this.imageCollectionModel) {\n this._rerenderAll();\n }\n },\n\n /**\n * Returns the ImageCollectionModel represented by this view.\n */\n getImageCollectionModel: function() {\n return this.imageCollectionModel;\n },\n\n /**\n * Sets the ImageCollectionModel to be represented by this view. When setting the ImageCollectionModel,\n * you should properly register/unregister listeners with the model, so you will be notified of\n * any changes to the given model.\n */\n setImageCollectionModel: function(imageCollectionModel) {\n // Unregister with the old model\n if (this.imageCollectionModel) {\n this.imageCollectionModel.removeListener(this.modelDidChangeListenerFunction);\n }\n \n // Set the new ImageCollectionModel\n this.imageCollectionModel = imageCollectionModel;\n \n // Register as a listener to the new model\n this.imageCollectionModel.addListener(this.modelDidChangeListenerFunction);\n \n // Rerender all the images\n this._rerenderAll();\n },\n\n /**\n * Changes the presentation of the images to either grid view or list view.\n * @param viewType A string of either LIST_VIEW or GRID_VIEW.\n */\n setToView: function(viewType) {\n this._checkInit();\n \n if (viewType != LIST_VIEW && viewType != GRID_VIEW) {\n throw new Error(\"Invalid viewType to ImageCollectionView.setToView: \" + viewType);\n }\n \n this.currentView = viewType;\n \n // Change the container view\n if (viewType == LIST_VIEW) {\n this.collectionDiv.classList.add('ft-container-list-view');\n }\n else if (viewType == GRID_VIEW) {\n this.collectionDiv.classList.remove('ft-container-list-view');\n }\n \n // Notify all the ImageRenderers to update their views\n _.each(this.imageRendererDivPairs, function(pair) {\n pair.imageRenderer.setToView(viewType);\n });\n },\n\n /**\n * Returns a string of either LIST_VIEW or GRID_VIEW indicating which view type is currently\n * being rendered.\n */\n getCurrentView: function() {\n return this.curentView;\n }\n });\n\n\n /**\n * An object representing a DOM element that will render the toolbar to the screen.\n */\n var Toolbar = function() {\n var self = this;\n this.listeners = [];\n \n \t// Clone the template\n var toolbarTemplate = document.getElementById('toolbar-template').content;\n this.toolbarDiv = document.importNode(toolbarTemplate, true);\n \n // Attach an event listener to the ratings clear button\n var ratingsClearButton = this.toolbarDiv.querySelector('.ft-nav-options-filter-clear-btn');\n ratingsClearButton.addEventListener('click', function(event) {\n self.setRatingFilter(0);\n });\n \n // Add a live RatingsView to track the filter\n var models = createModelModule();\n this.ratingsModel = new models.RatingsModel();\n this.ratingsModel.addListener(function(ratingsModel, eventTime) {\n if (ratingsModel.getRating() === 0) {\n ratingsClearButton.classList.add('hidden');\n }\n else { \n ratingsClearButton.classList.remove('hidden');\n }\n \n self._notify(self, RATING_CHANGE);\n });\n this.ratingsInstance = new RatingsView(this.ratingsModel, true);\n // true to disable the caption ^~~~\n \n // Attach the RatingsView to the div\n this.toolbarDiv.querySelector('.ft-nav-options-items-rating').appendChild(this.ratingsInstance.getElement());\n \n // Manage the view\n this.gridViewSelectButton = this.toolbarDiv.querySelectorAll('.ft-nav-options-view')[0];\n this.gridViewSelectButton.addEventListener('click', function(event) {\n self.setToView(GRID_VIEW);\n });\n this.listViewSelectButton = this.toolbarDiv.querySelectorAll('.ft-nav-options-view')[1];\n this.listViewSelectButton.addEventListener('click', function(event) {\n self.setToView(LIST_VIEW);\n });\n \n this.currentView = GRID_VIEW;\n this.setToView(this.currentView);\n };\n\n _.extend(Toolbar.prototype, {\n _notify: function(toolbar, eventType, eventDate) {\n _.each(this.listeners, function(listener) {\n listener(toolbar, eventType, eventDate || Date.now());\n });\n },\n \n /**\n * Returns an element representing the toolbar, which can be attached to the DOM.\n */\n getElement: function() {\n return this.toolbarDiv;\n },\n\n /**\n * Registers the given listener to be notified when the toolbar changes from one\n * view type to another.\n * @param listener_fn A function with signature (toolbar, eventType, eventDate), where\n * toolbar is a reference to this object, eventType is a string of\n * either, LIST_VIEW, GRID_VIEW, or RATING_CHANGE representing how\n * the toolbar has changed (specifically, the user has switched to\n * a list view, grid view, or changed the star rating filter).\n * eventDate is a Date object representing when the event occurred.\n */\n addListener: function(listener_fn) {\n if (!_.isFunction(listener_fn)) {\n throw new Error(\"Invalid arguments to Toolbar.addListener: \" + JSON.stringify(arguments));\n }\n \n this.listeners.push(listener_fn);\n },\n\n /**\n * Removes the given listener from the toolbar.\n */\n removeListener: function(listener_fn) {\n if (!_.isFunction(listener_fn)) {\n throw new Error(\"Invalid arguments to Toolbar.removeListener: \" + JSON.stringify(arguments));\n }\n \n var index = this.listeners.indexOf(listener_fn);\n \n if (index !== -1) {\n this.listeners.splice(index, 1);\n }\n },\n\n /**\n * Sets the toolbar to either grid view or list view.\n * @param viewType A string of either LIST_VIEW or GRID_VIEW representing the desired view.\n */\n setToView: function(viewType) {\n if (viewType != LIST_VIEW && viewType != GRID_VIEW) {\n throw new Error(\"Invalid viewType to Toolbar.setToView: \" + viewType);\n }\n \n this.currentView = viewType;\n \n if (viewType == LIST_VIEW) {\n this.gridViewSelectButton.classList.remove('ft-nav-options-view-selected');\n this.listViewSelectButton.classList.add('ft-nav-options-view-selected');\n }\n else if (viewType == GRID_VIEW) {\n this.gridViewSelectButton.classList.add('ft-nav-options-view-selected');\n this.listViewSelectButton.classList.remove('ft-nav-options-view-selected');\n }\n \n this._notify(this, viewType);\n },\n\n /**\n * Returns the current view selected in the toolbar, a string that is\n * either LIST_VIEW or GRID_VIEW.\n */\n getCurrentView: function() {\n return this.currentView;\n },\n\n /**\n * Returns the current rating filter. A number in the range [0,5], where 0 indicates no\n * filtering should take place.\n */\n getCurrentRatingFilter: function() {\n \t return this.ratingsInstance.getRating();\n },\n\n /**\n * Sets the rating filter.\n * @param rating An integer in the range [0,5], where 0 indicates no filtering should take place.\n */\n setRatingFilter: function(rating) {\n this.ratingsInstance.setRating(rating);\n \n this._notify(this, RATING_CHANGE);\n }\n });\n\n\n /**\n * An object that will allow the user to choose images to display.\n * @constructor\n */\n var FileChooser = function() {\n this.listeners = [];\n this._init();\n };\n\n _.extend(FileChooser.prototype, {\n _notify: function(fileChooser, files, eventDate) {\n _.each(this.listeners, function(listener_fn) {\n listener_fn(fileChooser, files, eventDate);\n });\n },\n \n // This code partially derived from: http://www.html5rocks.com/en/tutorials/file/dndfiles/\n _init: function() {\n var self = this;\n \n // Clone the file chooser template\n this.fileChooserDiv = document.createElement('div');\n var fileChooserTemplate = document.getElementById('file-chooser');\n this.fileChooserDiv.appendChild(document.importNode(fileChooserTemplate.content, true));\n \n // Attach an event listener to update our listeners when users select files\n var fileChooserInput = this.fileChooserDiv.querySelector('.ft-file-input');\n fileChooserInput.addEventListener('change', function(evt) {\n var files = evt.target.files;\n var eventDate = Date.now();\n self._notify(self, files, eventDate);\n \n // Clear .value, otherwise onchange won't fire if users select the same file\n // multiple times in a row\n fileChooserInput.value = null;\n \n// _.each(\n// self.listeners,\n// function(listener_fn) {\n// listener_fn(self, files, eventDate);\n// }\n// );\n });\n \n // Attach event listeners for when users drag/drop files\n var fileChooserContainer = this.fileChooserDiv.querySelector('.ft-file-input-container');\n fileChooserContainer.addEventListener('dragover', function(event) {\n event.stopPropagation();\n event.preventDefault();\n event.dataTransfer.dropEffect = 'copy';\n \n this.classList.add('ft-file-input-container-dragging')\n });\n fileChooserContainer.addEventListener('dragleave', function(event) {\n this.classList.remove('ft-file-input-container-dragging');\n });\n fileChooserContainer.addEventListener('drop', function(event) {\n event.stopPropagation();\n event.preventDefault();\n \n this.classList.remove('ft-file-input-container-dragging');\n \n self._notify(self, event.dataTransfer.files, Date.now());\n });\n },\n\n /**\n * Returns an element that can be added to the DOM to display the file chooser.\n */\n getElement: function() {\n return this.fileChooserDiv;\n },\n\n /**\n * Adds a listener to be notified when a new set of files have been chosen.\n * @param listener_fn A function with signature (fileChooser, fileList, eventDate), where\n * fileChooser is a reference to this object, fileList is a list of files\n * as returned by the File API, and eventDate is when the files were chosen.\n */\n addListener: function(listener_fn) {\n if (!_.isFunction(listener_fn)) {\n throw new Error(\"Invalid arguments to FileChooser.addListener: \" + JSON.stringify(arguments));\n }\n\n this.listeners.push(listener_fn);\n },\n\n /**\n * Removes the given listener from this object.\n * @param listener_fn\n */\n removeListener: function(listener_fn) {\n if (!_.isFunction(listener_fn)) {\n throw new Error(\"Invalid arguments to FileChooser.removeListener: \" + JSON.stringify(arguments));\n }\n this.listeners = _.without(this.listeners, listener_fn);\n }\n });\n \n \n /**\n * An object which manages a ratings view.\n * @constructor\n */\n var RatingsView = function(imageModel, disableCaption) {\n this.model = imageModel;\n this.disableCaption = disableCaption;\n var self = this;\n \n this.userDidInitiateChange = false;\n \n // Add listener to the model to update the views\n this.modelDidUpdateListenerFunction = function(imageModel, eventTime) {\n self.updateStars(imageModel.getRating(), true);\n };\n this.model.addListener(this.modelDidUpdateListenerFunction);\n \n // Clone the template\n var ratingsTemplate = document.getElementById('ratings-template').content;\n this.ratingsDiv = document.importNode(ratingsTemplate, true);\n \n this.starsDiv = this.ratingsDiv.querySelectorAll('div')[0];\n this.captionDiv = this.ratingsDiv.querySelectorAll('div')[1];\n \n // Function to return the star index of a click event in the view\n this.starIndexOfClickEvent = function(event) {\n var starIndex = -1;\n for (var i = 4; i >= 0; i--) {\n if (event.clientX > this.starsDiv.children[i].getBoundingClientRect().left) {\n starIndex = i;\n break;\n }\n }\n \n return starIndex;\n };\n \n // Add an event listener to handle the mouseover\n this.lastUpdateTime = 0;\n this.starsDiv.addEventListener('mousemove', function(event) {\n // this = starsDiv\n var starIndex = self.starIndexOfClickEvent(event);\n self.updateStars(starIndex + 1);\n \n if (!self.disableCaption) {\n self.captionDiv.classList.remove('hidden');\n \n // .lastUpdateTime enforces that the \"rating updated\" message should stay on the\n // screen for at least 1 second as long as the user stays on the same star.\n // Also works around a bug in Chrome for Windows where mousemove fires on mouse clicks\n if (Date.now() - self.lastUpdateTime >= 100) {\n if (starIndex === -1) {\n self.captionDiv.innerText = \"Click to clear rating\";\n }\n else {\n self.captionDiv.innerText = \"Click to rate \"\n + (starIndex + 1)\n + ((starIndex + 1) === 1 ? \" star\" : \" stars\");\n }\n }\n }\n });\n \n // Add an event to clear the view when the user mouseouts\n this.starsDiv.addEventListener('mouseout', function(event) {\n self.lastUpdateTime = 0;\n self.updateStars(self.model.getRating());\n \n if (!self.disableCaption) {\n self.captionDiv.classList.add('hidden');\n }\n });\n \n // Add an event to change the rating on click\n this.starsDiv.addEventListener('click', function(event) {\n var starIndex = self.starIndexOfClickEvent(event);\n \n self.userDidInitiateChange = true;\n self.lastUpdateTime = Date.now();\n self.model.setRating(starIndex + 1);\n });\n \n // Update the stars view\n this.updateStars(self.model.getRating());\n };\n \n _.extend(RatingsView.prototype, {\n updateStars: function(starCount, showUpdatedMessage) {\n for (var i = 0; i < 5; i++) {\n this.starsDiv.children[i].src\n = (i < starCount\n ? \"star-filled.svg\"\n : \"star-empty.svg\");\n }\n \n if (!this.disableCaption) {\n if (showUpdatedMessage && this.userDidInitiateChange) {\n this.captionDiv.classList.remove('hidden');\n this.captionDiv.classList.add('caption-success');\n this.captionDiv.innerText = \"Rating updated\";\n }\n else if (Date.now() - this.lastUpdateTime >= 100) {\n this.captionDiv.classList.remove('caption-success');\n }\n this.userDidInitiateChange = false;\n }\n },\n \n setRating: function(starCount) {\n this.model.setRating(starCount);\n },\n \n getRating: function() {\n return this.model.getRating()\n },\n \n getElement: function() {\n return this.ratingsDiv;\n },\n \n getModel: function() {\n return this.model;\n },\n \n setModel: function(newImageModel) {\n this.model.removeListener(this.modelDidUpdateListenerFunction);\n \n this.model = newImageModel;\n this.model.addListener(this.modelDidUpdateListenerFunction);\n }\n });\n \n \n /**\n * A lightbox view for modally displaying an image.\n * @constructor \n */\n var Lightbox = function() {\n // Clone the template\n this.lightboxTemplate = document.getElementById('lightbox-template').content;\n };\n \n _.extend(Lightbox.prototype, {\n /**\n * Show a lightbox on attachToDiv (or document.body if undefined) with\n * the image at imagePath\n */\n showImage: function(imagePath, attachToDiv) {\n var lightboxDiv = document.createElement('div');\n lightboxDiv.appendChild(document.importNode(this.lightboxTemplate, true));\n \n var image = lightboxDiv.querySelector('.lightbox-content');\n image.src = imagePath;\n \n// var closeButton = lightboxDiv.querySelector('.lightbox-close-hint');\n// closeButton.addEventListener('click', function(event) {\n// document.body.removeChild(document.querySelector('.lightbox'));\n// });\n \n // Add an event listener to allow users to click anywhere to close the lightbox\n var lightboxOnDom = document.body.appendChild(lightboxDiv);\n \n lightboxOnDom.addEventListener('click', function(event) {\n this.classList.add('lightbox-hidden');\n \n this.addEventListener('webkitAnimationEnd', function(event) {\n document.body.removeChild(this);\n });\n this.addEventListener('animationend', function(event) {\n document.body.removeChild(this);\n });\n });\n }\n });\n \n\n // Return an object containing all of our classes and constants\n return {\n ImageRenderer: ImageRenderer,\n ImageRendererFactory: ImageRendererFactory,\n ImageCollectionView: ImageCollectionView,\n Toolbar: Toolbar,\n FileChooser: FileChooser,\n \n RatingsView: RatingsView,\n Lightbox: Lightbox,\n\n LIST_VIEW: LIST_VIEW,\n GRID_VIEW: GRID_VIEW,\n RATING_CHANGE: RATING_CHANGE\n };\n}", "function ContentView(model) {\n var self = this;\n attrs.set(this, {\n canvas: document.getElementById(\"content-display\"),\n displaySize: undefined,\n scale: undefined,\n selected_view: new SelectedActionView(),\n move_info: undefined,\n /**\n * This method calculates the maximum size the content display can\n * display at whilst maintaining a minimum of a 5% border.\n */\n calculateScale: function() {\n var content = document.getElementsByClassName(\"content\")[0];\n var size = model.getSize();\n this.scale = Math.min(\n (content.clientWidth * 0.95) / size.getWidth(),\n (content.clientHeight * 0.95) / size.getHeight()\n );\n this.displaySize = new Rect(0, 0, size.getWidth() * this.scale, size.getHeight() * this.scale);\n },\n /**\n * This method returns the group that was clicked on.\n *\n * @param event the event containing the location of the click.\n */\n getGroup: function(event) {\n var point = {\n x: self.unScale(event.offsetX),\n y: self.unScale(event.offsetY)\n };\n var groups = model.getGroups();\n for (let group of groups) {\n if (group.getBoundingBox().contains(point)) {\n for (let tile of group.getTiles()) {\n if (tile.contains(point)) return group;\n }\n }\n }\n return null;\n }\n });\n window.addEventListener(\"resize\", function() {\n self.notify(model);\n });\n // Add listeners for moving image around in group.\n attrs.get(this).canvas.addEventListener(\"mousedown\", function(event) {\n if (event.which == 1) {\n // 1: Left-Click, 2: Middle-Click, 3: Right-Click\n model.saveState(true);\n attrs.get(self).move_info = {\n x: event.offsetX,\n y: event.offsetY,\n group: attrs.get(self).getGroup(event)\n };\n }\n });\n attrs.get(this).canvas.addEventListener(\"mousemove\", function(event) {\n var move_info = attrs.get(self).move_info;\n if (event.which == 1 && move_info && move_info.group) {\n move_info.group\n .getImageData()\n .updatePosition(\n self.unScale(move_info.x - event.offsetX),\n self.unScale(move_info.y - event.offsetY)\n );\n attrs.get(self).move_info.x = event.offsetX;\n attrs.get(self).move_info.y = event.offsetY;\n self.notify(model);\n }\n });\n attrs.get(this).canvas.addEventListener(\"mouseup\", function(event) {\n if (event.which == 1 && attrs.get(self).move_info) {\n window.saveState();\n attrs.get(self).move_info = undefined;\n }\n });\n // Add listener for selecting group.\n attrs.get(this).canvas.addEventListener(\"contextmenu\", function(event) {\n event.preventDefault();\n var group = attrs.get(self).getGroup(event);\n if (!event.ctrlKey && !event.shiftKey) {\n attrs.get(self).selected_view.emptySelection();\n }\n if (attrs.get(self).selected_view.isSelected(group)) {\n attrs.get(self).selected_view.removeSelectedGroup(group);\n } else {\n attrs.get(self).selected_view.addSelectedGroup(group);\n }\n self.notify(model);\n });\n // Add listeners to empty the current selection.\n // Needed, so only clicks outside the canvas clear the selection.\n attrs.get(this).canvas.addEventListener(\"click\", function(event) {\n event.stopPropagation();\n });\n document.getElementsByClassName(\"content\")[0].addEventListener(\"click\", function() {\n if (attrs.get(self).selected_view.getGroups().length > 0) {\n attrs.get(self).selected_view.emptySelection();\n self.notify(model);\n }\n });\n this.notify(model);\n model.registerObserver(this);\n }", "function viewMain($state) {\n var vm = this;\n\n /* Los controladores tienden a crecer, por lo que es recomendable agrupar los métodos en objetos,\n de tal manera que luego sea más fácil comprender de un vistazo qué hace cada cual. En mi caso,\n suelo usar estos objetos:\n actions, para los métodos que se lanzan desde eventos del usuario en la template\n rest, para llamadas a los modelos\n render, métodos relacionados con la renderización de los elementos\n aux, métodos auxiliares.\n Hay un ejemplo más completo en view-game\n */\n\n vm.actions = {};\n\n /* En lugar de utilizar state.go, se pueden colocar directamente los enlaces en la template\n con la directiva ui-sref */\n vm.actions.goToPlayer = function() {\n $state.go('player');\n };\n\n }", "function view(model){\n return {\n title: Title(),\n table: Table(model)\n }\n}", "function storyView(event_name) {\n relatedStories(event_name);\n}", "function GrouponPageView() {\n BaseView.apply(this, arguments);\n }", "function errorView() {\n\t// The view for initial landing and error page\n\t$(\"#main\").css(\"grid-column\", \"1 / span 3\");\n\t$(\"#sidebar\").addClass(\"hidden\");\n\t$(\"#info\").removeClass(\"hidden\");\n}", "function viewThisClickFunct() {\n\t// if overview is clicked from an info step (where it can be a last step) then remove any later history\n\tif (currentStepInfo.type == \"info\" && currentStep < decisionHistory[currentDecision].length - 1) {\n\t\tdecisionHistory[currentDecision] = decisionHistory[currentDecision].splice(0,currentStep + 1);\n\t\tstoredResultTxt[currentDecision] = storedResultTxt[currentDecision].splice(0,currentStep + 1);\n\t\t$fwdBtn.attr(\"disabled\", \"disabled\");\n\t}\n\t\n\t$overviewHolder.find(\".decisionInfo\").parent().remove();\n\t$(\"#viewAllBtn\").remove();\n\tshowHideHolders($overviewHolder);\n\t\n\tshowDecision(currentDecision);\n\t\n\tif (decisionHistory.length > 1) {\n\t\t$overviewHolder.append('<a id=\"viewAllBtn\" href=\"#\">' + allParams.viewAllString + '</a>');\n\t}\n\t\n\t$dialog.dialog(\"close\");\n\tdocument.getElementById(\"mainHolder\").scrollIntoView();\n\t\n\t// _____ VIEW ALL DECISIONS BTN _____\n\t$(\"#viewAllBtn\")\n\t\t.click(function() {\n\t\t\t$overviewHolder.find(\".decisionInfo\").parent().remove();\n\t\t\t$(\"#viewAllBtn\").remove();\n\t\t\tshowHideHolders($overviewHolder);\n\t\t\t\n\t\t\tfor (var i=0; i<decisionHistory.length; i++) {\n\t\t\t\tshowDecision(i);\n\t\t\t}\n\t\t\t\n\t\t\tdocument.getElementById(\"mainHolder\").scrollIntoView();\n\t\t});\n}", "showContact(model) {\n const entry = new ContactEntry({ model });\n this.showChildView('layout', entry);\n\n Backbone.history.navigate(`contact/${model.id}`);\n }", "function saveNewView(type) {\n var view = {\"class\":type}\n var editUI = document.getElementById(\"edit\" + type)\n // Handle View\n switch (type) {\n\n case \"DepictionHeaderView\":\n // Title\n var title = \"Heading Title\"\n if (editUI.getElementsByClassName(\"titleField\")[0].value != \"\") {\n title = editUI.getElementsByClassName(\"titleField\")[0].value\n }\n view.title = title\n // Set other properties\n view.useMargins = editUI.getElementsByClassName(\"useMargins\")[0].checked\n view.useBoldText = editUI.getElementsByClassName(\"useBoldText\")[0].checked\n view.alignment = editUI.getElementsByClassName(\"alignment\")[0].value\n break;\n\n case \"DepictionSubheaderView\":\n // Title\n var title = \"Subheading Title\"\n if (editUI.getElementsByClassName(\"titleField\")[0].value != \"\") {\n title = editUI.getElementsByClassName(\"titleField\")[0].value\n }\n view.title = title\n // Set other properties\n view.useMargins = editUI.getElementsByClassName(\"useMargins\")[0].checked\n view.useBoldText = editUI.getElementsByClassName(\"useBoldText\")[0].checked\n break;\n \n case \"DepictionLabelView\":\n // Title\n var text = \"Label Text\"\n if (editUI.getElementsByClassName(\"textField\")[0].value != \"\") {\n text = editUI.getElementsByClassName(\"textField\")[0].value\n }\n view.text = text\n // Set other properties\n view.alignment = editUI.getElementsByClassName(\"alignment\")[0].value\n view.useMargins = editUI.getElementsByClassName(\"useMargins\")[0].checked\n view.usePadding = editUI.getElementsByClassName(\"usePadding\")[0].checked\n view.fontWeight = editUI.getElementsByClassName(\"fontWeight\")[0].value\n view.fontSize = editUI.getElementsByClassName(\"fontSize\")[0].value\n // Font color\n if (editUI.getElementsByClassName(\"fontColor\")[0].value != \"\") {\n view.textColor = editUI.getElementsByClassName(\"fontColor\")[0].value\n }\n break;\n \n case \"DepictionMarkdownView\":\n view.markdown = simplemde.value()\n break;\n\n case \"DepictionImageView\":\n // Set Image URL\n var imageURL = editUI.getElementsByClassName(\"urlField\")[0].value\n if (imageURL != \"\") {\n if (validateImageURL(imageURL)) {\n view.URL = imageURL\n } else {\n displayError(\"Invalid Image URL!\")\n }\n } else {\n displayError(\"Image URL cannot be blank!\")\n }\n // Set other properties\n view.width = editUI.getElementsByClassName(\"widthSlider\")[0].value\n view.height = editUI.getElementsByClassName(\"widthSlider\")[0].value\n view.cornerRadius = editUI.getElementsByClassName(\"cornerRadiusSlider\")[0].value\n view.alignment = editUI.getElementsByClassName(\"alignment\")[0].value\n break;\n \n case \"DepictionTableTextView\":\n // Set Title\n var title = \"Table Title\"\n if (editUI.getElementsByClassName(\"titleField\")[0].value != \"\") {\n title = editUI.getElementsByClassName(\"titleField\")[0].value\n }\n view.title = title\n // Set Text\n var text = \"Table Text\"\n if (editUI.getElementsByClassName(\"textField\")[0].value != \"\") {\n text = editUI.getElementsByClassName(\"textField\")[0].value\n }\n view.text = text\n break;\n\n case \"DepictionTableButtonView\":\n // Set Action URL\n var buttonURL = editUI.getElementsByClassName(\"textField\")[0].value\n if (buttonURL != \"\") {\n view.action = buttonURL\n } else {\n displayError(\"Action URL cannot be blank!\")\n }\n // Set Text\n var title = \"Button Text\"\n if (editUI.getElementsByClassName(\"textField\")[0].value != \"\") {\n title = editUI.getElementsByClassName(\"textField\")[0].value\n }\n view.title = title\n // Set other properties\n view.yPadding = editUI.getElementsByClassName(\"yPadding\")[0].value\n // Tint color\n if (editUI.getElementsByClassName(\"tableTintColorPicker\")[0].value != \"\") {\n view.tintColor = editUI.getElementsByClassName(\"tableTintColorPicker\")[0].value\n }\n break;\n\n case \"DepictionSeparatorView\":\n break;\n\n case \"DepictionSpacerView\":\n view.spacing = editUI.getElementsByClassName(\"spacing\")[0].value\n break;\n\n default:\n throw(\"View is not yet supported\")\n }\n\n // Insert new view\n config.tabs[currentViewingTab].views.splice(\n newViewIndex, // Insert at index (variable is global from when user clicked \"add new view\" button)\n 0, // Delete 0 items\n view // Object to be inserted\n )\n // Re-render Preview\n renderSileoDepiction(config)\n // Hide popup\n hideAlert()\n}", "onViewParsed() {\n\n }", "static rendered () {}", "static rendered () {}", "renderContents() {\n // columns shown, hidden or reordered\n this.init();\n }", "renderContents() {\n // columns shown, hidden or reordered\n this.init();\n }", "viewMeta() { FlowRouter.go('invoiceMeta', { invoiceId: this.props.invoice._id } ) }", "viewMeta() { FlowRouter.go('invoiceMeta', { invoiceId: this.props.invoice._id } ) }", "function GrouponDetailView() {\n BaseView.apply(this, arguments);\n }", "setupView() {\n if (this.view === null) { // If this is called, then user has not overwritten this function\n throw new Error(\"RealtimeMultiplayerGame.AbstractClientGame.setupView - Override this method, then call MyClientGame.superclass.setupView()\");\n }\n this.fieldController.setView(this.view);\n }", "function enterView(newView,hostTNode){var oldView=lView;if(newView){var tView=newView[TVIEW];firstTemplatePass=tView.firstTemplatePass;bindingRootIndex=tView.bindingStartIndex;}previousOrParentTNode=hostTNode;isParent=true;lView=contextLView=newView;return oldView;}", "get view() {\n return this._view;\n }", "get view() {\n return this._view;\n }", "_changed() {\n reload_articles_on_drawer_close();\n }", "get defaultView() {\r\n return new View(this, \"DefaultView\");\r\n }", "function setView_formTracking(){\n var f = formatValues();\n var formTrackingDict = openFormTrackingDict();\n var view = setFormView();\n var scrollView = setScrollView();\n var popupWin = setPopupWindow();\n\n currentTop = 20;\n elementTop = 13;\n \n //Update view/button\n var updateView = setUpdateView();\n lbl_update = setUpdateLabel();\n var btn_update = new setupDateButton('Update DB',elementTop,f.leftCol2_2,f.colWidth3,60);\n updateView.add(lbl_update);\n updateView.add(btn_update);\n view.add(updateView);\n currentTop += f.otherSpace + 5;\n elementTop += f.otherSpace + 5; \n \n var hdr_dataSub = setHeader ('Data Submission', currentTop, f.colIndent, f.colWidth1);\n scrollView.add (hdr_dataSub); \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n var lbl_datasubmission = setLabel ('Data Submission Type', currentTop, f.colIndent, f.colWidth2);\n var tf_datasubmission = setTextField ('', elementTop, f.leftCol2_2, f.colWidth2-f.buttonWidth);\n tf_datasubmission.editable = false;\n var btn_datasubmission = new setDropdownButton((elementTop),(f.leftCol2_2 + f.colWidth2 - f.buttonWidth));\n\n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n var lbl_dataNote = setLabel ('Describe blended submissions',elementTop, f.colIndent, f.colWidth2);\n var tf_dataNote = setTextField ('', currentTop, f.leftCol2_2, f.colWidth2);\n var datasubmissionData = ['APP','BLENDED'];\n var datasubmissionSelect = setSelectTableView(datasubmissionData);\n \n scrollView.add (lbl_datasubmission);\n scrollView.add (tf_datasubmission);\n scrollView.add (btn_datasubmission);\n scrollView.add (lbl_dataNote);\n scrollView.add (tf_dataNote);\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n var hdr_shipping = setHeader ('Shipping/Lab Information', currentTop, f.colIndent, f.colWidth1);\n scrollView.add (hdr_shipping); \n currentTop += f.otherSpace;\n elementTop += f.otherSpace; \n var lbl_shipInst = setLabel ('Fill out shipping info for each Lab samples will be sent to. Further down the page, you will assign each sample to the appropriate lab/shipment',currentTop, f.colIndent, f.colWidth1);\n scrollView.add (lbl_shipInst); \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n //create the list of labs used for shipping\n view.labArray = {};\n //labArray format is [Name,Date Sent,Airbill,Sender,Sender Phone,Shipping Method]\n view.labArray[1] = ['','','','','','',String(Math.floor(Math.random()*8999))];\n var labSelect = Titanium.UI.createTableView();\n var lbl_labNo = setLabel('Lab #',currentTop,f.colIndent + 50,f.colWidth4 - 50);\n lbl_labNo.textAlign = Ti.UI.TEXT_ALIGNMENT_CENTER;\n scrollView.add(lbl_labNo); \n currentTop += f.labelSpace;\n elementTop += f.labelSpace;\n var btn_leftLabNo = setLeftButton(currentTop,f.colIndent);\n var tf_labNo = setTextField('1',elementTop,f.colIndent + 50,f.colWidth4 - 50);\n var btn_rightLabNo = setRightButton(currentTop,f.leftCol4_2);\n scrollView.add(btn_leftLabNo,tf_labNo,btn_rightLabNo);\n \n btn_leftLabNo.addEventListener('click',function(e){\n if (tf_labNo.value > 1) {\n changeNum = Number(tf_labNo.value) - 1;\n changeLab(Number(tf_labNo.value),changeNum);\n tf_labNo.value = String(changeNum);\n }\n });\n btn_rightLabNo.addEventListener('click',function(e){\n changeNum = Number(tf_labNo.value) + 1;\n changeLab(Number(tf_labNo.value),changeNum);\n tf_labNo.value = String(changeNum);\n });\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n var pickerWin = setPopupWindow();\n var picker = Ti.UI.createPicker({\n useSpinner:true,\n type:Ti.UI.PICKER_TYPE_DATE,\n minDate:new Date(2015,03,01),\n maxDate:new Date(2015,10,31),\n value:new Date(2015,3,12),\n top:50 \n });\n \n var pickerButton = Ti.UI.createButton({\n style:Titanium.UI.iPhone.SystemButtonStyle.BORDERED,\n color:'black',\n height:50,\n width:150,\n title:'Add date',\n borderColor:'black',\n borderWidth:'1',\n borderRadius:5,\n backgroundColor:'white',\n font:{fontSize:18,fontWeight:'bold'},\n });\n \n pickerWin.add(picker);\n pickerWin.add(pickerButton); \n \n \n var lbl_labName = setLabelI ('Lab Name', currentTop, f.colIndent, f.colWidth4);\n var labNameMeta = setMetaView('Select name of national lab from dropdown or type in name of alternate lab.');\n lbl_labName.addEventListener('click', function() {\n view.add(labNameMeta);\n labNameMeta.show();\n });\n var tf_labName = setTextFieldHint ('', elementTop, f.leftCol4_2, f.colWidth4+20+f.colWidth4+20+f.colWidth4-f.buttonWidth, 'Select from list, or type in other lab name');\n tf_labName.addEventListener('change', function() {\n updateLab();\n });\n var btn_labName = new setDropdownButton((elementTop),(f.colWidth1+12-f.buttonWidth));\n var labNameData = ['WRS','GLEC','MED','MICROBAC'];\n var labNameSelect = setSelectTableView(labNameData);\n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_labName);\n scrollView.add (tf_labName);\n scrollView.add (btn_labName); \n \n var lbl_datesent = setLabel ('Date Sent',currentTop, f.colIndent, f.colWidth4);\n var tf_datesent = setTextFieldNumber('',elementTop,f.leftCol4_2, f.colWidth4-f.buttonWidth,'mmddyy');\n tf_datesent.addEventListener('change', function() {\n updateLab();\n });\n var lbl_airbill = setLabel ('Airbill No.',currentTop, f.leftCol4_3, f.colWidth4);\n var tf_airbill = setTextField ('', elementTop, f.leftCol4_4, f.colWidth4);\n tf_airbill.addEventListener('change', function() {\n updateLab();\n });\n btn_datesent = setDropdownButton(elementTop, f.leftCol4_2+(f.colWidth4-f.buttonWidth));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n var lbl_sender = setLabel ('Sender', currentTop, f.colIndent, f.colWidth4);\n var tf_sender = setTextField ('',elementTop, f.leftCol4_2, f.colWidth4);\n tf_sender.addEventListener('change', function() {\n updateLab();\n });\n var lbl_senderph = setLabel ('Sender Phone', elementTop-7, f.leftCol4_3, f.colWidth4);\n var tf_senderph = setTextFieldNumber('', elementTop, f.leftCol4_4, f.colWidth4,'enter numbers');\n tf_senderph.addEventListener('change', function() {\n updateLab();\n });\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n var lbl_shmethod = setLabel ('Shipping Method',elementTop-7, f.colIndent, f.colWidth4);\n var tf_shmethod = setTextField ('', elementTop, f.leftCol4_2, f.colWidth4-f.buttonWidth);\n tf_shmethod.addEventListener('change', function() {\n updateLab();\n });\n var btn_shmethod = new setDropdownButton((elementTop),(f.leftCol4_2 + f.colWidth4 - f.buttonWidth));\n var shmethodData = ['FEDEX','UPS','HAND_DELIVERY'];\n var shmethodSelect = setSelectTableView(shmethodData);\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n scrollView.add (lbl_datesent);\n scrollView.add (tf_datesent);\n scrollView.add(btn_datesent);\n scrollView.add (lbl_sender);\n scrollView.add (tf_sender);\n scrollView.add (lbl_senderph);\n scrollView.add (tf_senderph);\n scrollView.add (lbl_shmethod);\n scrollView.add (tf_shmethod);\n scrollView.add (btn_shmethod);\n scrollView.add (lbl_airbill);\n scrollView.add (tf_airbill); \n \n //button events*/\n \n if (Titanium.Platform.name == 'android') {\n eventListener = \"blur\";\n } else {\n eventListener = \"change\";\n }\n btn_datesent.addEventListener('click', function() {\n pickerWin.open();\n });\n picker.addEventListener('change',function(e){\n tf_datesent.value = (e.value.getMonth() + 1) + '/' + e.value.getDate() + '/' + e.value.getFullYear();\n });\n pickerButton.addEventListener('click',function(){\n pickerWin.close(); \n });\n tf_datesent.addEventListener(eventListener, function() {\n tf_datesent.value = entryMask(tf_datesent.value,'date');\n }); \n \n \n \n var hdr_sampTrack = setHeader ('Sample Tracking', currentTop, f.colIndent, f.colWidth1);\n scrollView.add (hdr_sampTrack); \n currentTop += f.otherSpace;\n elementTop += f.otherSpace; \n \n var lbl_sampleType = setVLabel ('Sample Type', currentTop, f.colIndent, f.colWidth4, f.colWidth5);\n var lbl_notCollected = setVLabel ('Not Collected', currentTop, f.leftCol5_2, f.colWidth5, f.colWidth5);\n var lbl_sampleID = setVLabel ('Sample ID', currentTop, f.leftCol5_3, f.colWidth5, f.colWidth5);\n var lbl_lab = setVLabel ('LAB-SHIP', currentTop, f.leftCol5_4, f.colWidth6, f.colWidth5);\n var lbl_comment = setVLabel ('Comments',currentTop, f.leftCol5_5, (f.colWidth5), f.colWidth5);\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n currentTop += f.otherSpace;\n elementTop += f.otherSpace; \n \n //CHEM SAMPLE\n var lbl_sampleCHEM = setLabel ('CHEM', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotCHEM = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDCHEM = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labCHEM = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labCHEM = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentCHEM = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleType);\n scrollView.add (lbl_notCollected);\n scrollView.add (lbl_sampleID);\n scrollView.add (lbl_lab);\n scrollView.add (lbl_comment);\n scrollView.add (lbl_sampleCHEM);\n scrollView.add (btn_radionotCHEM);\n scrollView.add (lbl_sampleIDCHEM);\n scrollView.add (tf_labCHEM);\n scrollView.add (btn_labCHEM);\n scrollView.add (tf_commentCHEM);\n \n //CHLA SAMPLE\n var lbl_sampleCHLA = setLabel ('CHLA', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotCHLA = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDCHLA = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labCHLA = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labCHLA = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentCHLA = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleCHLA);\n scrollView.add (btn_radionotCHLA);\n scrollView.add (lbl_sampleIDCHLA);\n scrollView.add (tf_labCHLA);\n scrollView.add (btn_labCHLA);\n scrollView.add (tf_commentCHLA);\n \n //NUTS SAMPLE\n var lbl_sampleNUTS = setLabel ('NUTS', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotNUTS = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDNUTS = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labNUTS = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labNUTS = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentNUTS = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleNUTS);\n scrollView.add (btn_radionotNUTS);\n scrollView.add (lbl_sampleIDNUTS);\n scrollView.add (tf_labNUTS);\n scrollView.add (btn_labNUTS);\n scrollView.add (tf_commentNUTS);\n \n //SEDG SAMPLE\n var lbl_sampleSEDG = setLabel ('SEDG', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotSEDG = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDSEDG = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labSEDG = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labSEDG = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentSEDG = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleSEDG);\n scrollView.add (btn_radionotSEDG);\n scrollView.add (lbl_sampleIDSEDG);\n scrollView.add (tf_labSEDG);\n scrollView.add (btn_labSEDG);\n scrollView.add (tf_commentSEDG);\n \n //SEDX SAMPLE\n var lbl_sampleSEDX = setLabel ('SEDX', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotSEDX = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDSEDX = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labSEDX = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labSEDX = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentSEDX = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleSEDX);\n scrollView.add (btn_radionotSEDX);\n scrollView.add (lbl_sampleIDSEDX);\n scrollView.add (tf_labSEDX);\n scrollView.add (btn_labSEDX);\n scrollView.add (tf_commentSEDX);\n \n \n //PHYT SAMPLE\n var lbl_samplePHYT = setLabel ('PHYT', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotPHYT = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDPHYT = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labPHYT = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labPHYT = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentPHYT = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_samplePHYT);\n scrollView.add (btn_radionotPHYT);\n scrollView.add (lbl_sampleIDPHYT);\n scrollView.add (tf_labPHYT);\n scrollView.add (btn_labPHYT);\n scrollView.add (tf_commentPHYT);\n \n //ALGX SAMPLE\n var lbl_sampleALGX = setLabel ('ALGX', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotALGX = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDALGX = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labALGX = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labALGX = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentALGX = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleALGX);\n scrollView.add (btn_radionotALGX);\n scrollView.add (lbl_sampleIDALGX);\n scrollView.add (tf_labALGX);\n scrollView.add (btn_labALGX);\n scrollView.add (tf_commentALGX);\n \n //ENTE SAMPLE\n var lbl_sampleENTE = setLabel ('ENTE', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotENTE = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDENTE = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labENTE = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labENTE = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentENTE = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleENTE);\n scrollView.add (btn_radionotENTE);\n scrollView.add (lbl_sampleIDENTE);\n scrollView.add (tf_labENTE);\n scrollView.add (btn_labENTE);\n scrollView.add (tf_commentENTE);\n \n //MICX SAMPLE\n var lbl_sampleMICX = setLabel ('MICX', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotMICX = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDMICX = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labMICX = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labMICX = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentMICX = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleMICX);\n scrollView.add (btn_radionotMICX);\n scrollView.add (lbl_sampleIDMICX);\n scrollView.add (tf_labMICX);\n scrollView.add (btn_labMICX);\n scrollView.add (tf_commentMICX);\n \n //FPLG SAMPLE\n var lbl_sampleFPLG = setLabel ('FPLG', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotFPLG = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDFPLG = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labFPLG = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labFPLG = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentFPLG = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleFPLG);\n scrollView.add (btn_radionotFPLG);\n scrollView.add (lbl_sampleIDFPLG);\n scrollView.add (tf_labFPLG);\n scrollView.add (btn_labFPLG);\n scrollView.add (tf_commentFPLG);\n \n //SEDC SAMPLE\n var lbl_sampleSEDC = setLabel ('SEDC', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotSEDC = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDSEDC = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labSEDC = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labSEDC = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentSEDC = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleSEDC);\n scrollView.add (btn_radionotSEDC);\n scrollView.add (lbl_sampleIDSEDC);\n scrollView.add (tf_labSEDC);\n scrollView.add (btn_labSEDC);\n scrollView.add (tf_commentSEDC);\n \n //SEDO SAMPLE\n var lbl_sampleSEDO = setLabel ('SEDO', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotSEDO = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDSEDO = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labSEDO = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labSEDO = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentSEDO = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleSEDO);\n scrollView.add (btn_radionotSEDO);\n scrollView.add (lbl_sampleIDSEDO);\n scrollView.add (tf_labSEDO);\n scrollView.add (btn_labSEDO);\n scrollView.add (tf_commentSEDO);\n \n //FTIS SAMPLE\n var lbl_sampleFTIS = setLabel ('FTIS', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotFTIS = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDFTIS = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labFTIS = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labFTIS = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentFTIS = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleFTIS);\n scrollView.add (btn_radionotFTIS);\n scrollView.add (lbl_sampleIDFTIS);\n scrollView.add (tf_labFTIS);\n scrollView.add (btn_labFTIS);\n scrollView.add (tf_commentFTIS);\n \n \n //BENT SAMPLE\n var lbl_sampleBENT = setLabel ('BENT', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotBENT = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDBENT = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labBENT = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labBENT = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentBENT = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleBENT);\n scrollView.add (btn_radionotBENT);\n scrollView.add (lbl_sampleIDBENT);\n scrollView.add (tf_labBENT);\n scrollView.add (btn_labBENT);\n scrollView.add (tf_commentBENT);\n \n \n //HTIS SAMPLE\n var lbl_sampleHTIS = setLabel ('HTIS', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotHTIS = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDHTIS = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labHTIS = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labHTIS = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentHTIS = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleHTIS);\n scrollView.add (btn_radionotHTIS);\n scrollView.add (lbl_sampleIDHTIS);\n scrollView.add (tf_labHTIS);\n scrollView.add (btn_labHTIS);\n scrollView.add (tf_commentHTIS);\n \n \n //UVID SAMPLE\n var lbl_sampleUVID = setLabel ('UVID', currentTop, f.colIndent, f.colWidth5);\n var btn_radionotUVID = setRadioButton((currentTop),(f.leftCol5_2),false);\n var lbl_sampleIDUVID = setLabel('',currentTop, f.leftCol5_3, f.colWidth5); \n var tf_labUVID = setTextFieldHint('',currentTop,f.leftCol5_4,f.colWidth5-f.buttonWidth,'Select Lab');\n var btn_labUVID = setDropdownButton(elementTop,(f.leftCol5_4 + f.colWidth5 - f.buttonWidth));\n var tf_commentUVID = setTextField ('',currentTop, f.leftCol5_5, (f.colWidth5));\n \n currentTop += f.otherSpace;\n elementTop += f.otherSpace;\n \n scrollView.add (lbl_sampleUVID);\n scrollView.add (btn_radionotUVID);\n scrollView.add (lbl_sampleIDUVID);\n scrollView.add (tf_labUVID);\n scrollView.add (btn_labUVID);\n scrollView.add (tf_commentUVID);\n \n //button events\n btn_datasubmission.addEventListener('click', function() {\n popupWin.add(datasubmissionSelect);\n popupWin.open();\n });\n datasubmissionSelect.addEventListener('click',function(e){\n tf_datasubmission.value = e.rowData.rowValue;\n popupWin.remove(datasubmissionSelect);\n popupWin.close();\n });\n btn_labName.addEventListener('click', function() {\n popupWin.add(labNameSelect);\n popupWin.open();\n });\n labNameSelect.addEventListener('click',function(e){\n tf_labName.value = e.rowData.rowValue;\n popupWin.remove(labNameSelect);\n popupWin.close();\n });\n btn_shmethod.addEventListener('click', function() {\n popupWin.add(shmethodSelect);\n popupWin.open();\n });\n shmethodSelect.addEventListener('click',function(e){\n tf_shmethod.value = e.rowData.rowValue;\n popupWin.remove(shmethodSelect);\n popupWin.close();\n });\n \n btn_labCHEM.addEventListener('click',function(){\n labCHEMSelect = labDrop(tf_labCHEM);\n popupWin.add(labCHEMSelect);\n popupWin.open();\n });\n btn_labCHLA.addEventListener('click',function(){\n labCHLASelect = labDrop(tf_labCHLA);\n popupWin.add(labCHLASelect);\n popupWin.open();\n });\n btn_labNUTS.addEventListener('click',function(){\n labNUTSSelect = labDrop(tf_labNUTS);\n popupWin.add(labNUTSSelect);\n popupWin.open();\n });\n btn_labSEDG.addEventListener('click',function(){\n labSEDGSelect = labDrop(tf_labSEDG);\n popupWin.add(labSEDGSelect);\n popupWin.open();\n }); \n btn_labSEDX.addEventListener('click',function(){\n labSEDXSelect = labDrop(tf_labSEDX);\n popupWin.add(labSEDXSelect);\n popupWin.open();\n }); \n btn_labPHYT.addEventListener('click',function(){\n labPHYTSelect = labDrop(tf_labPHYT);\n popupWin.add(labPHYTSelect);\n popupWin.open();\n });\n btn_labALGX.addEventListener('click',function(){\n labALGXSelect = labDrop(tf_labALGX);\n popupWin.add(labALGXSelect);\n popupWin.open();\n });\n btn_labENTE.addEventListener('click',function(){\n labENTESelect = labDrop(tf_labENTE);\n popupWin.add(labENTESelect);\n popupWin.open();\n });\n btn_labMICX.addEventListener('click',function(){\n labMICXSelect = labDrop(tf_labMICX);\n popupWin.add(labMICXSelect);\n popupWin.open();\n });\n btn_labFPLG.addEventListener('click',function(){\n labFPLGSelect = labDrop(tf_labFPLG);\n popupWin.add(labFPLGSelect);\n popupWin.open();\n }); \n btn_labSEDC.addEventListener('click',function(){\n labSEDCSelect = labDrop(tf_labSEDC);\n popupWin.add(labSEDCSelect);\n popupWin.open();\n });\n btn_labSEDO.addEventListener('click',function(){\n labSEDOSelect = labDrop(tf_labSEDO);\n popupWin.add(labSEDOSelect);\n popupWin.open();\n });\n btn_labBENT.addEventListener('click',function(){\n labBENTSelect = labDrop(tf_labBENT);\n popupWin.add(labBENTSelect);\n popupWin.open();\n });\n btn_labFTIS.addEventListener('click',function(){\n labFTISSelect = labDrop(tf_labFTIS);\n popupWin.add(labFTISSelect);\n popupWin.open();\n });\n btn_labHTIS.addEventListener('click',function(){\n labHTISSelect = labDrop(tf_labHTIS);\n popupWin.add(labHTISSelect);\n popupWin.open();\n }); \n btn_labUVID.addEventListener('click',function(){\n labUVIDSelect = labDrop(tf_labUVID);\n popupWin.add(labUVIDSelect);\n popupWin.open();\n });\n\n function labDrop(textField){\n labData = [];\n shipIdData = [];\n var size = 0, key;\n for (key in view.labArray) {\n if (view.labArray.hasOwnProperty(key)) size++;\n }\n for (var i = 1; i < size+1; i++) {\n labData[i-1] = view.labArray[i][0] + \"-\" + view.labArray[i][1];\n shipIdData[i-1] = view.labArray[i][6];\n }\n //update labSelect\n var select = setTableView(labData,shipIdData);\n \n select.addEventListener('click',function(e){\n textField.value = e.rowData.rowValue;\n textField.shipID = e.rowData.viewValue;\n popupWin.remove(select);\n popupWin.close();\n });\n return select;\n }\n \n if (Titanium.Platform.name == 'android') {\n eventListener = \"blur\";\n } else {\n eventListener = \"change\";\n }\n \n tf_datesent.addEventListener(eventListener, function() {\n tf_datesent.value = entryMask(tf_datesent.value,'date');\n });\n tf_senderph.addEventListener(eventListener, function() {\n tf_senderph.value = entryMask(tf_senderph.value,'phone');\n });\n \n \n function findLab(shipID) {\n var size = 0, key;\n for (key in view.labArray) {\n if (view.labArray.hasOwnProperty(key)) size++;\n }\n var index = 0;\n for (var i = 1; i < size+1; i++) {\n if (view.labArray[i][6] === shipID) {\n index = i;\n }\n }\n return index;\n }\n\n function changeLab(labNo,changeNum){\n var tempArray = view.labArray;\n if (!(changeNum in tempArray)){\n tempArray[changeNum] = ['','','','','','',String(Math.floor(Math.random()*8999))];\n }\n tempArray[labNo][0] = tf_labName.value;\n tempArray[labNo][1] = tf_datesent.value;\n tempArray[labNo][2] = tf_airbill.value;\n tempArray[labNo][3] = tf_sender.value;\n tempArray[labNo][4] = tf_senderph.value;\n tempArray[labNo][5] = tf_shmethod.value;\n \n tf_labName.value = tempArray[changeNum][0];\n tf_datesent.value = tempArray[changeNum][1];\n tf_airbill.value = tempArray[changeNum][2];\n tf_sender.value = tempArray[changeNum][3];\n tf_senderph.value = tempArray[changeNum][4];\n tf_shmethod.value = tempArray[changeNum][5];\n \n view.labArray = tempArray;\n }; \n function updateLab(){\n var tempArray = view.labArray;\n tempArray[tf_labNo.value][0] = tf_labName.value;\n tempArray[tf_labNo.value][1] = tf_datesent.value;\n tempArray[tf_labNo.value][2] = tf_airbill.value;\n tempArray[tf_labNo.value][3] = tf_sender.value;\n tempArray[tf_labNo.value][4] = tf_senderph.value;\n tempArray[tf_labNo.value][5] = tf_shmethod.value;\n \n view.labArray = tempArray;\n }; \n \n btn_update.addEventListener ('click', function(e) {\n //changeLab(Number(tf_labNo.value), Number(tf_labNo.value) + 1);\n \n formTrackingDict['DATA_SUBMISSION'] = tf_datasubmission.value;\n formTrackingDict['DATA_NOTE'] = tf_dataNote.value;\n if (btn_radionotCHEM.state !== true) {\n var i = findLab(tf_labCHEM.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'WRS'){\n formTrackingDict['CHEM_WRS'] = 'Y';\n formTrackingDict['CHEM_LAB'] = '';\n } else {\n formTrackingDict['CHEM_WRS'] = 'N';\n formTrackingDict['CHEM_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['CHEM_T1_1'] = tf_commentCHEM.value;\n formTrackingDict['CHEM_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['CHEM_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['CHEM_SENDER'] = view.labArray[i][3];\n formTrackingDict['CHEM_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['CHEM_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['CHEM_AIRBILL'] = view.labArray[i][2];\n }\n }\n if (btn_radionotCHLA.state !== true) {\n var i = findLab(tf_labCHLA.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'WRS'){\n formTrackingDict['CHLA_WRS'] = 'Y';\n formTrackingDict['CHLA_LAB'] = '';\n } else {\n formTrackingDict['CHLA_WRS'] = 'N';\n formTrackingDict['CHLA_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['CHLA_T1_2'] = tf_commentCHLA.value;\n formTrackingDict['CHLA_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['CHLA_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['CHLA_SENDER'] = view.labArray[i][3];\n formTrackingDict['CHLA_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['CHLA_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['CHLA_AIRBILL'] = view.labArray[i][2];\n }\n }\n if (btn_radionotNUTS.state !== true) {\n var i = findLab(tf_labNUTS.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'WRS'){\n formTrackingDict['NUTS_WRS'] = 'Y';\n formTrackingDict['NUTS_LAB'] = '';\n } else {\n formTrackingDict['NUTS_WRS'] = 'N';\n formTrackingDict['NUTS_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['NUTS_T1_3'] = tf_commentNUTS.value;\n formTrackingDict['NUTS_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['NUTS_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['NUTS_SENDER'] = view.labArray[i][3];\n formTrackingDict['NUTS_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['NUTS_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['NUTS_AIRBILL'] = view.labArray[i][2];\n }\n } \n if (btn_radionotSEDG.state !== true) {\n var i = findLab(tf_labSEDG.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'GLEC'){\n formTrackingDict['SEDG_GLEC'] = 'Y';\n formTrackingDict['SEDG_LAB'] = '';\n } else {\n formTrackingDict['SEDG_GLEC'] = 'N';\n formTrackingDict['SEDG_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['SEDG_T2_1'] = tf_commentSEDG.value;\n formTrackingDict['SEDG_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['SEDG_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['SEDG_SENDER'] = view.labArray[i][3];\n formTrackingDict['SEDG_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['SEDG_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['SEDG_AIRBILL'] = view.labArray[i][2];\n }\n }\n if (btn_radionotSEDX.state !== true) {\n var i = findLab(tf_labSEDX.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'GLEC'){\n formTrackingDict['SEDX_GLEC'] = 'Y';\n formTrackingDict['SEDX_LAB'] = '';\n } else {\n formTrackingDict['SEDX_GLEC'] = 'N';\n formTrackingDict['SEDX_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['SEDX_T2_2'] = tf_commentSEDX.value;\n formTrackingDict['SEDX_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['SEDX_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['SEDX_SENDER'] = view.labArray[i][3];\n formTrackingDict['SEDX_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['SEDX_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['SEDX_AIRBILL'] = view.labArray[i][2];\n }\n } \n \n if (btn_radionotPHYT.state !== true) {\n var i = findLab(tf_labPHYT.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'GLEC'){\n formTrackingDict['PHYT_GLEC'] = 'Y';\n formTrackingDict['PHYT_LAB'] = '';\n } else {\n formTrackingDict['PHYT_GLEC'] = 'N';\n formTrackingDict['PHYT_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['PHYT_T2_4'] = tf_commentPHYT.value;\n formTrackingDict['PHYT_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['PHYT_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['PHYT_SENDER'] = view.labArray[i][3];\n formTrackingDict['PHYT_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['PHYT_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['PHYT_AIRBILL'] = view.labArray[i][2];\n }\n } \n if (btn_radionotALGX.state !== true) {\n var i = findLab(tf_labALGX.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'GLEC'){\n formTrackingDict['ALGX_GLEC'] = 'Y';\n formTrackingDict['ALGX_LAB'] = '';\n } else {\n formTrackingDict['ALGX_GLED'] = 'N';\n formTrackingDict['ALGX_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['ALGX_T3_1'] = tf_commentALGX.value;\n formTrackingDict['ALGX_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['ALGX_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['ALGX_SENDER'] = view.labArray[i][3];\n formTrackingDict['ALGX_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['ALGX_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['ALGX_AIRBILL'] = view.labArray[i][2];\n }\n }\n if (btn_radionotENTE.state !== true) {\n var i = findLab(tf_labENTE.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'GLEC'){\n formTrackingDict['ENTE_GLEC'] = 'Y';\n formTrackingDict['ENTE_LAB'] = '';\n } else {\n formTrackingDict['ENTE_GLEC'] = 'N';\n formTrackingDict['ENTE_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['ENTE_T3_2'] = tf_commentENTE.value;\n formTrackingDict['ENTE_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['ENTE_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['ENTE_SENDER'] = view.labArray[i][3];\n formTrackingDict['ENTE_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['ENTE_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['ENTE_AIRBILL'] = view.labArray[i][2];\n }\n }\n if (btn_radionotMICX.state !== true) {\n var i = findLab(tf_labMICX.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'GLEC'){\n formTrackingDict['MICX_GLEC'] = 'Y';\n formTrackingDict['MICX_LAB'] = '';\n } else {\n formTrackingDict['MICX_GLEC'] = 'N';\n formTrackingDict['MICX_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['MICX_T3_3'] = tf_commentMICX.value;\n formTrackingDict['MICX_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['MICX_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['MICX_SENDER'] = view.labArray[i][3];\n formTrackingDict['MICX_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['MICX_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['MICX_AIRBILL'] = view.labArray[i][2];\n }\n } \n if (btn_radionotFPLG.state !== true) {\n var i = findLab(tf_labFPLG.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'GLEC'){\n formTrackingDict['FPLG_GLEC'] = 'Y';\n formTrackingDict['FPLG_LAB'] = '';\n } else {\n formTrackingDict['FPLG_GLEC'] = 'N';\n formTrackingDict['FPLG_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['FPLG_T3_4'] = tf_commentFPLG.value;\n formTrackingDict['FPLG_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['FPLG_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['FPLG_SENDER'] = view.labArray[i][3];\n formTrackingDict['FPLG_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['FPLG_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['FPLG_AIRBILL'] = view.labArray[i][2];\n }\n } \n if (btn_radionotSEDC.state !== true) {\n var i = findLab(tf_labSEDC.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'GLEC'){\n formTrackingDict['SEDC_GLEC'] = 'Y';\n formTrackingDict['SEDC_LAB'] = '';\n } else {\n formTrackingDict['SEDC_GLEC'] = 'N';\n formTrackingDict['SEDC_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['SEDC_T3_5'] = tf_commentSEDC.value;\n formTrackingDict['SEDC_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['SEDC_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['SEDC_SENDER'] = view.labArray[i][3];\n formTrackingDict['SEDC_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['SEDC_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['SEDC_AIRBILL'] = view.labArray[i][2];\n }\n }\n if (btn_radionotSEDO.state !== true) {\n var i = findLab(tf_labSEDO.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'GLEC'){\n formTrackingDict['SEDO_GLEC'] = 'Y';\n formTrackingDict['SEDO_LAB'] = '';\n } else {\n formTrackingDict['SEDO_GLEC'] = 'N';\n formTrackingDict['SEDO_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['SEDO_T3_6'] = tf_commentSEDO.value;\n formTrackingDict['SEDO_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['SEDO_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['SEDO_SENDER'] = view.labArray[i][3];\n formTrackingDict['SEDO_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['SEDO_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['SEDO_AIRBILL'] = view.labArray[i][2];\n }\n } \n if (btn_radionotBENT.state !== true) {\n var i = findLab(tf_labBENT.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'GLEC'){\n formTrackingDict['BENT_GLEC'] = 'Y';\n formTrackingDict['BENT_LAB'] = '';\n } else {\n formTrackingDict['BENT_GLEC'] = 'N';\n formTrackingDict['BENT_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['BENT_T4_1'] = tf_commentBENT.value;\n formTrackingDict['BENT_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['BENT_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['BENT_SENDER'] = view.labArray[i][3];\n formTrackingDict['BENT_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['BENT_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['BENT_AIRBILL'] = view.labArray[i][2];\n }\n }\n if (btn_radionotFTIS.state !== true) {\n var i = findLab(tf_labFTIS.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'GLEC'){\n formTrackingDict['FTIS_GLEC'] = 'Y';\n formTrackingDict['FTIS_LAB'] = '';\n } else {\n formTrackingDict['FTIS_GLEC'] = 'N';\n formTrackingDict['FTIS_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['FTIS_T5_1'] = tf_commentFTIS.value;\n formTrackingDict['FTIS_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['FTIS_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['FTIS_SENDER'] = view.labArray[i][3];\n formTrackingDict['FTIS_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['FTIS_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['FTIS_AIRBILL'] = view.labArray[i][2];\n }\n }\n if (btn_radionotHTIS.state !== true) {\n var i = findLab(tf_labFTIS.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'MICROBAC'){\n formTrackingDict['HTIS_MICROBAC'] = 'Y';\n formTrackingDict['HTIS_LAB'] = '';\n } else {\n formTrackingDict['HTIS_MICROBAC'] = 'N';\n formTrackingDict['HTIS_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['HTIS_T7_1'] = tf_commentHTIS.value;\n formTrackingDict['HTIS_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['HTIS_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['HTIS_SENDER'] = view.labArray[i][3];\n formTrackingDict['HTIS_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['HTIS_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['HTIS_AIRBILL'] = view.labArray[i][2];\n }\n }\n if (btn_radionotUVID.state !== true) {\n var i = findLab(tf_labUVID.shipID);\n if (!(i===0)) {\n if (view.labArray[i][0] === 'MED'){\n formTrackingDict['UVID_MED'] = 'Y';\n formTrackingDict['UVID_LAB'] = '';\n } else {\n formTrackingDict['UVID_MED'] = 'N';\n formTrackingDict['UVID_LAB'] = view.labArray[i][0];\n }\n formTrackingDict['UVID_T8_1'] = tf_commentUVID.value;\n formTrackingDict['UVID_SHIP_ID'] = view.labArray[i][6];\n formTrackingDict['UVID_DATE_SENT'] = view.labArray[i][1];\n formTrackingDict['UVID_SENDER'] = view.labArray[i][3];\n formTrackingDict['UVID_SENDER_PHONE'] = view.labArray[i][4];\n formTrackingDict['UVID_SHIPPING_METHOD'] = view.labArray[i][5];\n formTrackingDict['UVID_AIRBILL'] = view.labArray[i][2];\n }\n }\n\n saveJSON(formTrackingDict,view.uid + '_TRACKING.json');\n saveJSON(view.labArray,view.uid + '_TRACKING_labInfo.json');\n });\n \n view.addEventListener(\"updateFormTracking\",function(e){\n //reset dictionary\n formSampleDict = openFormSampleDict();\n formTrackingDict = openFormTrackingDict();\n formFishEcoDict = openFormFishEcoDict();\n formFishHumanDict = openFormFishHumanDict();\n view.uid = e.siteid + '_' + e.visitno; \n \n retrieveJSON(formSampleDict,view.uid + '_SAMPLECOLLECTION.json');\n retrieveJSON(formFishEcoDict, view.uid + '_FISHECO.json');\n retrieveJSON(formFishHumanDict, view.uid + '_FISHHUMAN.json');\n retrieveJSON(formTrackingDict,view.uid + '_TRACKING.json');\n \n var tempArray = {};\n tempArray[1] = ['','','','','','',String(Math.floor(Math.random()*8999))];\n view.labArray = tempArray;\n //lab data\n tf_labNo.value = '1';\n tf_labName.value = '';\n tf_datesent.value = '';\n tf_airbill.value = '';\n tf_sender.value = '';\n tf_senderph.value = '';\n tf_shmethod.value = '';\n var jsonFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,view.uid + '_TRACKING_labInfo.json');\n //var jsonFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'TRACKING_labInfo.json');\n if (jsonFile.exists()) {\n var jsonFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,view.uid + '_TRACKING_labInfo.json');\n //var jsonFile = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,'TRACKING_labInfo.json');\n var data = jsonFile.read().text;\n var tempArray2 = {};\n tempArray2 = JSON.parse(data);\n view.labArray = tempArray2;\n \n tf_labName.value = view.labArray[1][0];\n tf_datesent.value = view.labArray[1][1];\n tf_airbill.value = view.labArray[1][2];\n tf_sender.value = view.labArray[1][3];\n tf_senderph.value = view.labArray[1][4];\n tf_shmethod.value = view.labArray[1][5];\n }\n \n tf_datasubmission.value = formTrackingDict['DATA_SUBMISSION'];\n tf_dataNote.value = formTrackingDict['DATA_NOTE'];\n \n if (formSampleDict['CHEM_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotCHEM,true);\n lbl_sampleIDCHEM.text = formSampleDict['CHEM_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotCHEM,false);\n lbl_sampleIDCHEM.text = formSampleDict['CHEM_SAMPLE_ID'];\n if (formTrackingDict['CHEM_WRS'] === 'Y') {\n tf_labCHEM.value = 'WRS' + '-' + formTrackingDict['CHEM_DATE_SENT'];\n } else {\n tf_labCHEM.value = formTrackingDict['CHEM_LAB'] + '-' + formTrackingDict['CHEM_DATE_SENT'];\n }\n tf_commentCHEM.value = formTrackingDict['CHEM_T1_1'];\n tf_labCHEM.shipID = formTrackingDict['CHEM_SHIP_ID'];\n }\n if (formSampleDict['CHLA_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotCHLA,true);\n lbl_sampleIDCHLA.text = formSampleDict['CHLA_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotCHLA,false);\n lbl_sampleIDCHLA.text = formSampleDict['CHLA_SAMPLE_ID'];\n if (formTrackingDict['CHLA_WRS'] === 'Y') {\n tf_labCHLA.value = 'WRS' + '-' + formTrackingDict['CHLA_DATE_SENT'];\n } else {\n tf_labCHLA.value = formTrackingDict['CHLA_LAB'] + '-' + formTrackingDict['CHLA_DATE_SENT'];\n }\n tf_commentCHLA.value = formTrackingDict['CHLA_T1_2'];\n tf_labCHLA.shipID = formTrackingDict['CHLA_SHIP_ID'];\n }\n if (formSampleDict['NUTS_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotNUTS,true);\n lbl_sampleIDNUTS.text = formSampleDict['NUTS_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotNUTS,false);\n lbl_sampleIDNUTS.text = formSampleDict['NUTS_SAMPLE_ID'];\n if (formTrackingDict['NUTS_WRS'] === 'Y') {\n tf_labNUTS.value = 'WRS' + '-' + formTrackingDict['NUTS_DATE_SENT'];\n } else {\n tf_labNUTS.value = formTrackingDict['NUTS_LAB'] + '-' + formTrackingDict['NUTS_DATE_SENT'];\n }\n tf_commentNUTS.value = formTrackingDict['NUTS_T1_3'];\n tf_labNUTS.shipID = formTrackingDict['NUTS_SHIP_ID'];\n }\n if (formSampleDict['SEDG_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotSEDG,true);\n lbl_sampleIDSEDG.text = formSampleDict['SEDG_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotSEDG,false);\n lbl_sampleIDSEDG.text = formSampleDict['SEDG_SAMPLE_ID'];\n if (formTrackingDict['SEDG_GLEC'] === 'Y') {\n tf_labSEDG.value = 'GLEC' + '-' + formTrackingDict['SEDG_DATE_SENT'];\n } else {\n tf_labSEDG.value = formTrackingDict['SEDG_LAB'] + '-' + formTrackingDict['SEDG_DATE_SENT'];\n }\n tf_commentSEDG.value = formTrackingDict['SEDD_T2_1'];\n tf_labSEDG.shipID = formTrackingDict['SEDG_SHIP_ID'];\n }\n if (formSampleDict['SEDX_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotSEDX,true);\n lbl_sampleIDSEDX.text = formSampleDict['SEDX_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotSEDX,false);\n lbl_sampleIDSEDX.text = formSampleDict['SEDX_SAMPLE_ID'];\n if (formTrackingDict['SEDX_GLEC'] === 'Y') {\n tf_labSEDX.value = 'GLEC' + '-' + formTrackingDict['SEDX_DATE_SENT'];\n } else {\n tf_labSEDX.value = formTrackingDict['SEDX_LAB'] + '-' + formTrackingDict['SEDX_DATE_SENT'];\n }\n tf_commentSEDX.value = formTrackingDict['SEDX_T2_2'];\n tf_labSEDX.shipID = formTrackingDict['SEDX_SHIP_ID'];\n }\n \n if (formSampleDict['PHYT_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotPHYT,true);\n lbl_sampleIDPHYT.text = formSampleDict['PHYT_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotPHYT,false);\n lbl_sampleIDPHYT.text = formSampleDict['PHYT_SAMPLE_ID'];\n if (formTrackingDict['PHYT_GLEC'] === 'Y') {\n tf_labPHYT.value = 'GLEC' + '-' + formTrackingDict['PHYT_DATE_SENT'];\n } else {\n tf_labPHYT.value = formTrackingDict['PHYT_LAB'] + '-' + formTrackingDict['PHYT_DATE_SENT'];\n }\n tf_commentPHYT.value = formTrackingDict['PHYT_T2_4'];\n tf_labPHYT.shipID = formTrackingDict['PHYT_SHIP_ID'];\n } \n if (formSampleDict['ALGX_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotALGX,true);\n lbl_sampleIDALGX.text = formSampleDict['ALGX_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotALGX,false);\n lbl_sampleIDALGX.text = formSampleDict['ALGX_SAMPLE_ID'];\n if (formTrackingDict['ALGX_GLEC'] === 'Y') {\n tf_labALGX.value = 'GLEC' + '-' + formTrackingDict['ALGX_DATE_SENT'];\n } else {\n tf_labALGX.value = formTrackingDict['ALGX_LAB'] + '-' + formTrackingDict['ALGX_DATE_SENT'];\n }\n tf_commentALGX.value = formTrackingDict['ALGX_T3_1'];\n tf_labALGX.shipID = formTrackingDict['ALGX_SHIP_ID'];\n }\n if (formSampleDict['ENTE_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotENTE,true);\n lbl_sampleIDENTE.text = formSampleDict['ENTE_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotENTE,false);\n lbl_sampleIDENTE.text = formSampleDict['ENTE_SAMPLE_ID'];\n if (formTrackingDict['ENTE_GLEC'] === 'Y') {\n tf_labENTE.value = 'GLEC' + '-' + formTrackingDict['ENTE_DATE_SENT'];\n } else {\n tf_labENTE.value = formTrackingDict['ENTE_LAB'] + '-' + formTrackingDict['ENTE_DATE_SENT'];\n }\n tf_commentENTE.value = formTrackingDict['ENTE_T3_2'];\n tf_labENTE.shipID = formTrackingDict['ENTE_SHIP_ID'];\n }\n if (formSampleDict['MICX_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotMICX,true);\n lbl_sampleIDMICX.text = formSampleDict['MICX_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotMICX,false);\n lbl_sampleIDMICX.text = formSampleDict['MICX_SAMPLE_ID'];\n if (formTrackingDict['MICX_GLEC'] === 'Y') {\n tf_labMICX.value = 'GLEC' + '-' + formTrackingDict['MICX_DATE_SENT'];\n } else {\n tf_labMICX.value = formTrackingDict['MICX_LAB'] + '-' + formTrackingDict['MICX_DATE_SENT'];\n }\n tf_commentMICX.value = formTrackingDict['MICX_T3_3'];\n tf_labMICX.shipID = formTrackingDict['MICX_SHIP_ID'];\n }\n if (formFishEcoDict['FPLG_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotFPLG,true);\n lbl_sampleIDFPLG.text = formFishEcoDict['FPLG_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotFPLG,false);\n lbl_sampleIDFPLG.text = formFishEcoDict['FPLG_SAMPLE_ID'];\n if (formTrackingDict['FPLG_GLEC'] === 'Y') {\n tf_labFPLG.value = 'GLEC' + '-' + formTrackingDict['FPLG_DATE_SENT'];\n } else {\n tf_labFPLG.value = formTrackingDict['FPLG_LAB'] + '-' + formTrackingDict['FPLG_DATE_SENT'];\n }\n tf_commentFPLG.value = formTrackingDict['FPLG_T3_4'];\n tf_labFPLG.shipID = formTrackingDict['FPLG_SHIP_ID'];\n } \n if (formSampleDict['SEDC_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotSEDC,true);\n lbl_sampleIDSEDC.text = formSampleDict['SEDC_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotSEDC,false);\n lbl_sampleIDSEDC.text = formSampleDict['SEDC_SAMPLE_ID'];\n if (formTrackingDict['SEDC_GLEC'] === 'Y') {\n tf_labSEDC.value = 'GLEC' + '-' + formTrackingDict['SEDC_DATE_SENT'];\n } else {\n tf_labSEDC.value = formTrackingDict['SEDC_LAB'] + '-' + formTrackingDict['SEDC_DATE_SENT'];\n }\n tf_commentSEDC.value = formTrackingDict['SEDC_T3_5'];\n tf_labSEDC.shipID = formTrackingDict['SEDC_SHIP_ID'];\n }\n if (formSampleDict['SEDO_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotSEDO,true);\n lbl_sampleIDSEDO.text = formSampleDict['SEDO_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotSEDO,false);\n lbl_sampleIDSEDO.text = formSampleDict['SEDO_SAMPLE_ID'];\n if (formTrackingDict['SEDO_GLEC'] === 'Y') {\n tf_labSEDO.value = 'GLEC' + '-' + formTrackingDict['SEDO_DATE_SENT'];\n } else {\n tf_labSEDO.value = formTrackingDict['SEDO_LAB'] + '-' + formTrackingDict['SEDO_DATE_SENT'];\n }\n tf_commentSEDO.value = formTrackingDict['SEDO_T3_6'];\n tf_labSEDO.shipID = formTrackingDict['SEDO_SHIP_ID'];\n } \n if (formSampleDict['BENT_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotBENT,true);\n lbl_sampleIDBENT.text = formSampleDict['BENT_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotBENT,false);\n lbl_sampleIDBENT.text = formSampleDict['BENT_SAMPLE_ID'];\n if (formTrackingDict['BENT_GLEC'] === 'Y') {\n tf_labBENT.value = 'GLEC' + '-' + formTrackingDict['BENT_DATE_SENT'];\n } else {\n tf_labBENT.value = formTrackingDict['BENT_LAB'] + '-' + formTrackingDict['BENT_DATE_SENT'];\n }\n tf_commentBENT.value = formTrackingDict['BENT_T4_1'];\n tf_labBENT.shipID = formTrackingDict['BENT_SHIP_ID'];\n }\n if (formFishEcoDict['FTIS_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotFTIS,true);\n lbl_sampleIDFTIS.text = formFishEcoDict['FTIS_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotFTIS,false);\n lbl_sampleIDFTIS.text = formFishEcoDict['FTIS_SAMPLE_ID'];\n if (formTrackingDict['FTIS_GLEC'] === 'Y') {\n tf_labFTIS.value = 'GLEC' + '-' + formTrackingDict['FTIS_DATE_SENT'];\n } else {\n tf_labFTIS.value = formTrackingDict['FTIS_LAB'] + '-' + formTrackingDict['FTIS_DATE_SENT'];\n }\n tf_commentFTIS.value = formTrackingDict['FTIS_T5_1'];\n tf_labFTIS.shipID = formTrackingDict['FTIS_SHIP_ID'];\n }\n if (formFishHumanDict['HTIS_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotHTIS,true);\n lbl_sampleIDHTIS.text = formFishHumanDict['HTIS_SAMPLE_ID'];\n } else {\n changeStateRadioButton (btn_radionotHTIS,false);\n lbl_sampleIDHTIS.text = formFishHumanDict['HTIS_SAMPLE_ID'];\n if (formTrackingDict['HTIS_MICROBAC'] === 'Y') {\n tf_labHTIS.value = 'MICROBAC' + '-' + formTrackingDict['HTIS_DATE_SENT'];\n } else {\n tf_labHTIS.value = formTrackingDict['HTIS_LAB'] + '-' + formTrackingDict['HTIS_DATE_SENT'];\n }\n tf_commentHTIS.value = formTrackingDict['HTIS_T7_1'];\n tf_labHTIS.shipID = formTrackingDict['HTIS_SHIP_ID'];\n }\n if (formSampleDict['UVID_NOT_COLLECTED'] === 'Y') {\n changeStateRadioButton (btn_radionotUVID,true);\n lbl_sampleIDUVID.text = formSampleDict['UVID_FILENAME'];\n } else {\n changeStateRadioButton (btn_radionotUVID,false);\n lbl_sampleIDUVID.text = formSampleDict['UVID_FILENAME'];\n if (formTrackingDict['UVID_MED'] === 'Y') {\n tf_labUVID.value = 'MED' + '-' + formTrackingDict['UVID_DATE_SENT'];\n } else {\n tf_labUVID.value = formTrackingDict['UVID_LAB'] + '-' + formTrackingDict['UVID_DATE_SENT'];\n }\n tf_commentUVID.value = formTrackingDict['UVID_T8_1'];\n tf_labUVID.shipID = formTrackingDict['UVID_SHIP_ID'];\n }\n });\n view.add(scrollView);\n return view;\n}", "function sugarListView() {\n}", "function ViewController() {}" ]
[ "0.64383423", "0.6414478", "0.6263517", "0.6263517", "0.61634195", "0.61634195", "0.61634195", "0.6117753", "0.6082107", "0.6082107", "0.6082054", "0.6058179", "0.6007057", "0.6007057", "0.6007057", "0.6007057", "0.59570825", "0.5939924", "0.5938893", "0.5938893", "0.5938893", "0.5891839", "0.5874857", "0.58476496", "0.5824508", "0.580683", "0.57815146", "0.5749457", "0.5749457", "0.5749457", "0.5727427", "0.5671054", "0.5671054", "0.5657015", "0.5635741", "0.5633397", "0.561304", "0.56103873", "0.5589206", "0.55735976", "0.55701756", "0.5566639", "0.55657357", "0.5551006", "0.5548804", "0.55451804", "0.55451804", "0.55421585", "0.5534987", "0.5533923", "0.55312407", "0.55232406", "0.55097604", "0.5492811", "0.5476833", "0.5462328", "0.54569036", "0.5453025", "0.5453025", "0.5453025", "0.5453025", "0.5453025", "0.5453025", "0.5453025", "0.5453025", "0.5443688", "0.5442201", "0.54305923", "0.54018414", "0.5400038", "0.53835136", "0.538334", "0.5379724", "0.5374408", "0.53738093", "0.5373683", "0.5372305", "0.5368472", "0.5359212", "0.53513336", "0.5345844", "0.5343914", "0.5341348", "0.5337012", "0.5326642", "0.53127265", "0.53127265", "0.5296299", "0.5296299", "0.5292362", "0.5292362", "0.5290365", "0.5284899", "0.5276916", "0.52676666", "0.52676666", "0.5257278", "0.52498794", "0.5246674", "0.5237386", "0.52336746" ]
0.0
-1
=================================== GET FUNCTIONS ===================================
function getCustomer(res, mysql, context, complete, customerID){ mysql.pool.query("SELECT * FROM customers WHERE customer_id = ?", customerID, function(err, result){ if(err){ next(err); return; } context.customer = result[0]; complete(); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_data() {}", "get() {}", "_get () {\n throw new Error('_get not implemented')\n }", "function getInfo(){\t\t\n\treturn cachedInfo;\n}", "static get attributes() {}", "getData () {\n }", "private public function m246() {}", "get(name){\n var result=this.getPath(name);\n return result!=undefined?result[1]:undefined;\n }", "get() {\n\n }", "function getGlobDataAPI(){\n\n}", "private internal function m248() {}", "getData(){}", "get mains() {}", "static get properties() {}", "getRequestInfoUtils() {\n return {\n createResponse$: this.createResponse$.bind(this),\n findById: this.findById.bind(this),\n isCollectionIdNumeric: this.isCollectionIdNumeric.bind(this),\n getConfig: () => this.config,\n getDb: () => this.db,\n getJsonBody: this.getJsonBody.bind(this),\n getLocation: this.getLocation.bind(this),\n getPassThruBackend: this.getPassThruBackend.bind(this),\n parseRequestUrl: this.parseRequestUrl.bind(this),\n };\n }", "async get() {\n\t\treturn await this._run('GET');\n\t}", "get Automatic() {}", "getData() {\n \n}", "_get(key) { return undefined; }", "function __getter(value) {\n // console.log('GET', arguments)\n\n return value;\n }", "getAll() {\n return this._get(undefined);\n }", "function DWRUtil() { }", "static get properties(){return{}}", "static get properties(){return{}}", "function getDetails() {\n\n}", "_getPageMetadata() {\n return undefined;\n }", "obtain(){}", "static get_info() { \n\treturn {\n\t id : id , \n\t rules : [ \"get text chunk\"],\n\t vars : null \n\t}\n }", "get () {\n }", "function getOverload() {\n\n\t\t/**\n\t\t * Overload Cldr.prototype.get().\n\t\t */\n\t\tsuperGet = Cldr.prototype.get;\n\t\tCldr.prototype.get = function( path ) {\n\t\t\tvar value = superGet.apply( this, arguments );\n\t\t\tpath = pathNormalize( path, this.attributes ).join( \"/\" );\n\t\t\tglobalEe.trigger( \"get\", [ path, value ] );\n\t\t\tthis.ee.trigger( \"get\", [ path, value ] );\n\t\t\treturn value;\n\t\t};\n\t}", "function getOverload() {\n\n\t\t/**\n\t\t * Overload Cldr.prototype.get().\n\t\t */\n\t\tsuperGet = Cldr.prototype.get;\n\t\tCldr.prototype.get = function( path ) {\n\t\t\tvar value = superGet.apply( this, arguments );\n\t\t\tpath = pathNormalize( path, this.attributes ).join( \"/\" );\n\t\t\tglobalEe.trigger( \"get\", [ path, value ] );\n\t\t\tthis.ee.trigger( \"get\", [ path, value ] );\n\t\t\treturn value;\n\t\t};\n\t}", "function getOverload() {\n\n\t\t/**\n\t\t * Overload Cldr.prototype.get().\n\t\t */\n\t\tsuperGet = Cldr.prototype.get;\n\t\tCldr.prototype.get = function( path ) {\n\t\t\tvar value = superGet.apply( this, arguments );\n\t\t\tpath = pathNormalize( path, this.attributes ).join( \"/\" );\n\t\t\tglobalEe.trigger( \"get\", [ path, value ] );\n\t\t\tthis.ee.trigger( \"get\", [ path, value ] );\n\t\t\treturn value;\n\t\t};\n\t}", "function Utils() {}", "function Utils() {}", "static GetAtPath() {}", "GetData() {}", "transient protected internal function m189() {}", "GetModule() {\n\n }", "static getHelpers() {}", "transient private protected internal function m182() {}", "init () {\n\t\treturn null;\n\t}", "getList() { return this.api(); }", "get() {\n return this._internal[0].get();\n }", "function _____SHARED_functions_____(){}", "get() {\n const response = [];\n\n this.each(el => response\n .push(this[this.facade(el).getterMethod()](el)));\n\n return response.length > 1 ?\n response :\n response[0];\n }", "get Custom() {}", "get PSP2() {}", "async getter () {\n const seasonsNS = await getSeasons(env.apiLink,env.apiVersion,this.state.lang)\n const storiesNS = await getStories(env.apiLink,env.apiVersion,this.state.lang)\n const questsNS = await getQuests(env.apiLink,env.apiVersion,this.state.lang)\n const characters = await getCharacters(env.apiLink,env.apiVersion,this.state.lang,this.state.key)\n\n if (characters['text'] || characters['text'] === 'Invalid access token') {\n this.setState({\n apiKeyError : 'Invalid key',\n loading: false\n })\n } else {\n const seasons = seasonsNS.sort(function(a, b){return a['order']-b['order']})\n const stories = loadHash.orderBy(storiesNS, ['season', 'order'])\n const quests = loadHash.orderBy(questsNS, ['story', 'level']) // for the moment 'level' is the best way for short this thing\n\n let questsDone = {}\n let backstories = {}\n let characterId = {}\n for (let i = 0; i<characters.length; i++) {\n questsDone[characters[i]] = await getDoneQuests(env.apiLink,env.apiVersion,this.state.lang,this.state.key,characters[i])\n backstories[characters[i]] = await getBackstories(env.apiLink,env.apiVersion,this.state.key,characters[i])\n characterId[characters[i]] = await getInfoCharacter(env.apiLink,env.apiVersion,this.state.lang,this.state.key,characters[i])\n }\n\n return {seasons, stories, quests, characters, questsDone, backstories, characterId}\n }\n }", "static private protected internal function m118() {}", "protected internal function m252() {}", "function getImageInfo() {\n\n}", "getMethods (name, type){\r\n return \"\\t\" + type + \" get\" + name +\r\n \"() { \\n \\t \\t return \" + name + \";\\n\\t} \\n\";\r\n }", "GetComponents() {}", "GetComponents() {}", "GetComponents() {}", "GetComponents() {}", "get z() {}", "get(getFn) {\nvar getLen, putPr;\nputPr = this.getLoc.putPr;\nif (putPr != null) {\n// There is put we can match with and there should be a next in the chain\ngetLen = this.getLen;\nif (typeof qlgr.trace === \"function\") {\nqlgr.trace(`${this.qName}: Get ${getLen} matched`);\n}\nputPr.then(qlgr.debug != null ? ((val) => {\nqlgr.debug(`${this.qName}: Get ${getLen} resolved`);\nreturn getFn(val);\n}) : getFn);\n} else {\nif (typeof qlgr.trace === \"function\") {\nqlgr.trace(`${this.qName}: Get ${this.getLen} added`);\n}\nthis.getLoc.getFn = getFn;\nthis.getLoc.next = {};\n}\n// Always step on to next location for a get\nthis.getLoc = this.getLoc.next;\nreturn this.getLen++;\n}", "getInfo(){ // no need to use the keyword \"function\", it can be declared \n return {name: this.name, email: this.email}; // like this in a \"class\" and will work absolutely fine \n }", "get Diffuse() {}", "transient private internal function m185() {}", "static final private internal function m106() {}", "static get HEADERS() {\n return 1;\n }", "getAll() {\n return _data;\n }", "get() {\n // call the get method on the contract and return the value\n // this uses call() instead of send() because it is only reading from the chain\n return this.contractInterface.methods.get().call().then((response) => {\n return response;\n })\n }", "get value() {}", "get value() {}", "get object() {\n\n }", "get(endpoint) {\n\t\treturn this.fetchData(`${API_BASE_URL}/${endpoint}`, { \n\t\t\tmethod: 'GET', \n\t\t\theaders: this.getHeaders(),\n\t\t});\n\t}", "function Utils(){}", "get() {\n return null;\n }", "static private internal function m121() {}", "getResult() {}", "get resolution() {}", "_getHead(id) {\n\n }", "getNodeInformation() {\n return this.query('/', 'GET');\n }", "get EAC_R() {}", "function getInfo(md5) {\n return getCache()[md5];\n}", "static get STATUS() {\n return 0;\n }", "getAttributes() {}", "function accessesingData2() {\n\n}", "function accessesingData2() {\n\n}", "get bakeIK() {}", "function getOrigin_() {\n init_();\n retrieveOriginLi_();\n}", "get normal() {}", "get normal() {}", "getInfo() {\n return this.info;\n }", "static transient final protected internal function m47() {}", "async get() {\n return (await this.fetch(1)).list[0];\n }", "get userData() {}", "static transient final protected public internal function m46() {}", "static getUsers() {\n return API.fetcher(\"/user\");\n }", "getAll() {\n return this._get(1);\n }", "get() {\r\n //搜集依赖\r\n dep.depend()\r\n return val\r\n }", "transient final protected internal function m174() {}", "function _getlinks ()\n\t{\n\t\treturn links;\n\t}", "get() {\n const value = this.properties[name].get_value();\n return value;\n }", "function get(url){return axios__WEBPACK_IMPORTED_MODULE_0___default.a.get(url);}", "get() {\n return {\n meta: this.meta.get(),\n project: this.project.get()\n }\n }", "get() {\n return this._object\n }", "getObject(type)\n {\n let next = this.getObjects(type).next();\n return next.done ? undefined : next.value;\n }" ]
[ "0.65289366", "0.6266646", "0.617106", "0.6085017", "0.6076472", "0.60344386", "0.59548247", "0.5851485", "0.58506924", "0.58433396", "0.5839511", "0.58211654", "0.58146363", "0.5781314", "0.5762597", "0.5675487", "0.56609714", "0.5650497", "0.56503266", "0.56429654", "0.56322706", "0.5618441", "0.5581493", "0.5581493", "0.55810946", "0.55549526", "0.55481434", "0.5541285", "0.55396223", "0.5530788", "0.5530788", "0.5530788", "0.55122524", "0.55122524", "0.5501115", "0.54953206", "0.54930526", "0.54790294", "0.54649997", "0.5456037", "0.54411685", "0.5436991", "0.54333985", "0.5423356", "0.5411791", "0.54115725", "0.53990585", "0.5397493", "0.5393992", "0.5392325", "0.53811586", "0.5376872", "0.53748274", "0.53748274", "0.53748274", "0.53748274", "0.53604615", "0.535046", "0.5346336", "0.53463244", "0.5333065", "0.5322073", "0.53216016", "0.53145", "0.53111356", "0.5299802", "0.5299802", "0.52961445", "0.52950764", "0.5294988", "0.52948576", "0.5294509", "0.52826935", "0.5277469", "0.5271155", "0.5269099", "0.52687323", "0.5264312", "0.5263553", "0.52612466", "0.5255578", "0.5255578", "0.52537674", "0.52251834", "0.52226955", "0.52226955", "0.52144474", "0.5212014", "0.5210253", "0.5203278", "0.5202145", "0.5199505", "0.5198123", "0.5194174", "0.51884186", "0.51771796", "0.51725745", "0.5169495", "0.5167492", "0.5167385", "0.516622" ]
0.0
-1
get list on the basis on
function getplayersByTeamId(teamId) { var wkUrl = config.apiUrl + 'playersListByTeam/'; return $http({ url: wkUrl, params: { teamId: teamId }, method: 'GET', isArray: true }).then(success, fail) function success(resp) { return resp.data; } function fail(error) { var msg = "Error getting list: " + error; //log.logError(msg, error, null, true); throw error; // so caller can see it } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findLists() {}", "list(filterFn = this._list_filter) {\n const list = this.get('list') || [];\n return list.reduce((a, i) => {\n if (filterFn(i)) {\n a.push(i);\n }\n return a;\n }, []);\n }", "list() {\n const listings = this._listings.all();\n return Object.keys(listings).map(key => listings[key]);\n }", "get_all(name) {\n let ret = [];\n for(let item of this.data) {\n if(item.name === name) {\n ret.push(item);\n }\n }\n return ret;\n }", "function getTaskLists() {\n\n}", "generateTasksLists() {\n switch (this.props.selectedTaskType) {\n case 'ongoing':\n return this.props.ongoingTaskList;\n case 'overdue':\n return this.props.overdueTaskList;\n case 'completed':\n return this.props.completedTaskList;\n default:\n return null;\n }\n }", "_list() {\n const parameters = [\n 1,\n ['active', 'id', 'interval', 'language', 'last_run', 'name', 'run_on', 'tags'],\n {},\n 1000,\n 'name',\n ];\n return this.list.call(this, ...parameters);\n }", "list(req, res) {\n this.__readData(__data_source)\n .then(lists => {\n \n \n res.json({ type: \"success\", data: this.__formatter(lists) });\n })\n .catch(err => res.status(412).json({type:\"error\", data:[], message:\"No Data Found\"}));\n }", "function getContextsList2(type) {\n var list = [];\n\n $.ajax({\n type: 'GET',\n url: '/data/contexts/list',\n dataType: 'json',\n async: false,\n success: function(data) {\n if(data.success)\n $.each(data.rows, function(index, el) {\n if(type == 'all')\n list.push({id: el.id, text: el.name + ' (' + el.type + ')'});\n else if(itemId != el.id)\n list.push({id: el.id, text: el.name + ' (' + el.type + ')'});\n });\n }\n });\n\n return list;\n}", "getList(params) {\n return ApiService.get('/list', params.id);\n }", "get filterOptions() { // list state for filter\n let filterOptions = [\n 'All Orders',\n 'Waiting',\n 'Confirmed',\n 'Cancelled',\n ];\n if (!this.env.pos.tables) {\n return filterOptions\n } else {\n this.env.pos.tables.forEach(t => filterOptions.push(t.name))\n return filterOptions\n }\n }", "queryLists() {\n fetch(\"https://deco3801-oblong.uqcloud.net/wanderlist/get_bucketlist_belonging_to_user/\" + this.state.userData.id)\n .then(response => response.json())\n .then(obj => this.loadLists(obj));\n }", "async getAllExample() { \n return [{id:\"0001\"}, {id:\"0002\"}]\n }", "getListName() {}", "getList() {\r\n return this.list.slice()\r\n }", "getList() {\n return this.value ? [] : this.nestedList;\n }", "async getArray(type) {\n if (type == 'anime_top') {\n const resp = await fetch(this.resAni);\n const data = await resp.json();\n return data; \n } else if (type == 'kun_top') {\n const resp = await fetch(this.resChar);\n const data = await resp.json();\n const data1 = data.filter(el => el.gender === 'm')\n return data1; \n } else if (type == 'tyan_top') {\n const resp = await fetch(this.resChar);\n const data = await resp.json();\n const data2 = data.filter(el => el.gender === 'f')\n return data2;\n }\n}", "function printLexemesInList(list) {\n sessionService.getSession().then(function (session) {\n var config = session.projectSettings().config;\n var ws = config.entry.fields.lexeme.inputSystems[1];\n var arr = [];\n for (var i = 0; i < list.length; i++) {\n if (angular.isDefined(list[i].lexeme[ws])) {\n arr.push(list[i].lexeme[ws].value);\n }\n }\n\n console.log(arr);\n });\n }", "grabUserLists(data, mode = 'All') {\n let key = 'UserLists_' + mode;\n let cond = '1=1';\n if (mode == 'New')\n cond = \"list_check_ts is null\";\n else if (mode == 'Updated')\n cond = \"need_to_check_list = true\";\n return this.grabByIds({\n key: key,\n isByListOfIds: true,\n getTotalIdsCnt: () => data.totalIdsCnt,\n getListOfIds: () => data.listOfIds,\n /*getNextIds: (nextId, limit) => {\n return this.db.manyOrNone(\"\\\n select id, trim(login) as login, list_update_ts, list_check_ts, list_id \\\n from malrec_users \\\n where id >= $(nextId) and \"+ cond +\" \\\n order by id asc \\\n limit $(limit) \\\n \", {\n nextId: nextId,\n limit: limit,\n }).then((rows) => {\n let ids = [], data = {};\n if (rows)\n for (let row of rows) {\n ids.push(parseInt(row.id));\n data[row.id] = {\n login: row.login, \n listUpdatedTs: row.list_update_ts, \n listCheckedTs: row.list_check_ts, \n listId: row.list_id,\n };\n }\n return {ids: ids, data: data};\n });\n },*/\n getDataForIds: (ids) => {\n return this.db.manyOrNone(\"\\\n select id, trim(login) as login, list_update_ts, list_check_ts, list_id \\\n from malrec_users \\\n where id in (\" + ids.join(', ') + \") \\\n \").then((rows) => {\n let data = {};\n if (rows)\n for (let row of rows) {\n data[row.id] = {\n login: row.login, \n listUpdatedTs: row.list_update_ts, \n listCheckedTs: row.list_check_ts, \n listId: row.list_id,\n };\n }\n return data;\n });\n },\n fetch: (id, data) => {\n return this.provider.getUserList({login: data.login});\n },\n process: (id, newList, data) => {\n return this.processer.processUserList(id, data.login, data.listId, \n newList);\n },\n });\n }", "async getList() {\n const data = await this.getData();\n return data.map((medewerkers) => {\n return {\n voornaam: medewerkers.voornaam,\n basisrol: medewerkers.basisrol,\n geboortedatum: medewerkers.geboortedatum,\n };\n });\n }", "getListByClass(classId) {\n let classList = this.students.filter((student) => {\n return student.classId === classId;\n });\n let listByClass = classList.map((student) => {\n const name = student.name;\n const classId = student.classId;\n return {\n name,\n classId\n };\n });\n return listByClass;\n }", "function listingsByStatus() {\n\treturn db.any('SELECT * FROM listings ORDER BY status ASC');\n}", "function listingsByStatus() {\n\treturn db.any('SELECT * FROM listings ORDER BY status ASC');\n}", "function getList(options) {\n\n var deferred = $q.defer();\n\n // validating options\n var defObject = {\n listName: false,\n query: false,\n rowLimit: 10,\n columns: false,\n fields: false,\n useCustomCaml: false,\n columns: false,\n condition: false\n\n };\n\n var settings = $.extend({}, defObject, options);\n\n if ((!settings.listName) && (!settings.fields)) {\n deferred.reject();\n return deferred.promise;\n }\n\n\n\n var context = SP.ClientContext.get_current();\n\n var oList = context.get_web().get_lists().getByTitle(settings.listName);\n\n //var camlQuery = new SP.CamlQuery();\n\n /* check whether rowLimit is avalible or query details avalable\n retrive first 20 rows if both of parameters not avalable \n */\n\n //camlQuery = getCamlView(options.columns, options.condition, 20);\n\n var camlQuery = new SP.CamlQuery();\n if (settings.useCustomCaml) {\n camlQuery.set_viewXml(settings.customCamlXml);\n } else {\n\n if (settings.position !== undefined)\n camlQuery.set_listItemCollectionPosition(position);\n if (settings.folder !== undefined)\n camlQuery.set_folderServerRelativeUrl(_spPageContextInfo.webServerRelativeUrl + \"/Lists/\" + settings.listName + \"/\" + settings.folder);\n\n camlQuery.set_viewXml(getCamlView(settings.columns, settings.condition, 20));\n\n }\n\n\n var collListItem = oList.getItems(camlQuery);\n\n // including options if avalable\n //if (settings.columns) {\n // context.load(collListItem, 'Include(' + options.columns.join() + ')');\n //} else {\n context.load(collListItem);\n //}\n\n context.executeQueryAsync(getAllItems, fail);\n\n //return current Item Collection json\n function getAllItems() {\n // load query details to json object\n var tasksEntries = [];\n var itemsCount = collListItem.get_count();\n for (var i = 0; i < itemsCount; i++) {\n var item = collListItem.itemAt(i);\n var taskEntry = item.get_fieldValues();\n tasksEntries.push(helperService.parse(taskEntry, options.fields.mappingFromSP));\n }\n deferred.resolve(tasksEntries);\n\n }\n\n function fail(sender, args) {\n deferred.reject(args.get_message() + '\\n' + args.get_stackTrace());\n }\n\n return deferred.promise;\n\n\n }", "function getList(type){\n if( type === Type.REGION ) return clone(regions);\n else if( type === Type.PREF ) return clone(prefectures);\n return undefined;\n }", "function getUserList(data) {\n\tvar list = [];\n\tdata.forEach(element => {\n\t\tif (element.name) {\n\t\t\tlist.push({\n\t\t\t\tname: element.name,\n\t\t\t\tgift: element.gift\n\t\t\t});\n\t\t}\n\t\tif (element.spouse) {\n\t\t\tlist.push({\n\t\t\t\tname: element.spouse,\n\t\t\t\tgift: element.spouse_gift\n\t\t\t});\n\t\t}\n\t});\n\treturn list;\n}", "function getUserList(data) {\n\tvar list = [];\n\tdata.forEach(element => {\n\t\tif (element.name) {\n\t\t\tlist.push({\n\t\t\t\tname: element.name,\n\t\t\t\tgift: element.gift\n\t\t\t});\n\t\t}\n\t\tif (element.spouse) {\n\t\t\tlist.push({\n\t\t\t\tname: element.spouse,\n\t\t\t\tgift: element.spouse_gift\n\t\t\t});\n\t\t}\n\t});\n\treturn list;\n}", "itemsList(tableName){\n\t\ttableName = this.idCorrection(tableName);\n\t\tvar res = {isPresent: false, table: []};\n\t\tlet index = this.globalTables.search(tableName);\n\t\tif (index!=-1){\n\t\t\tres.isPresent = true;\t\t\t\n\t\t\tres.table = this.globalTables[index];\n\t\t}\n\t\treturn res;\n\t}", "function getTaskList(indice) \n{\n RMPApplication.debug(\"begin getTaskList\");\n c_debug(dbug.task, \"=> getTaskList\");\n id_index.setValue(indice);\n var query = \"parent.number=\" + var_order_list[indice].wo_number;\n\n var options = {};\n var pattern = {\"wm_task_query\": query};\n c_debug(dbug.task, \"=> getTaskList: pattern = \", pattern);\n id_get_work_order_tasks_list_api.trigger(pattern, options, task_ok, task_ko);\n RMPApplication.debug(\"end getTaskList\");\n}", "static getPlaylistAll (req, res) {\n\n Playlist.find().then(playLists => {\n\n const arrayToSend = []\n\n playLists.forEach(playList => { playList.users.forEach(u => { if (u.id === req.params.userId && playList.type === 'private') { arrayToSend.push(playList) } }) })\n playLists.forEach(playList => { if (playList.type === 'public') { arrayToSend.push(playList) } })\n playLists.forEach(p => {\n p.songs = _.sortBy(p.songs, ['grade'])\n\n })\n return res.json({ message: 'Your playLists', playLists: arrayToSend }) /* istanbul ignore next */\n }).catch(() => { return res.status(500).send({ message: 'Internal serveur error' }) })\n }", "function getByType(type) {\n let listnew = [];\n dataPost.forEach((item, index) => {\n if (item.type.toLowerCase() == type) {\n listnew.push(item);\n }\n });\n showPost(listnew);\n // console.log(listnew);\n }", "async function list(req, res) {\n const { date, currentDate, mobile_number } = req.query;\n if (date) {\n const data = await service.listByDate(date);\n res.json({ data });\n } else if (currentDate) {\n const data = await service.listByDate(currentDate);\n res.json({ data });\n } else if (mobile_number) {\n const data = await service.listByPhone(mobile_number);\n res.json({ data });\n } else {\n const data = await service.list();\n res.json({ data });\n }\n}", "function getData(){\n $http.get(rootUrl+\"?filter[period]=\"+$filter('date')($rootScope.selectedPeriod, \"yyyy-MM\")).then(function(response){\n self.list = response.data.data;\n });\n }", "function getAllItems() {\n // load query details to json object\n var oWebsite = context.get_web();\n context.load(oWebsite);\n var tasksEntries = [];\n\n context.executeQueryAsync(function () {\n\n var itemsCount = collListItem.get_count();\n for (var i = 0; i < itemsCount; i++) {\n var item = collListItem.itemAt(i);\n var taskEntry = item.get_fieldValues();\n\n taskEntry.SourceURL = context.get_web().get_serverRelativeUrl() + \"/Lists/\" + options.listName + \"/\" + taskEntry.DocumentName;\n tasksEntries.push(helperService.parse(taskEntry, options.fields.mappingFromSP));\n\n }\n\n deferred.resolve(tasksEntries);\n\n\n });\n\n\n\n }", "returnOrganizationsFromListOfIds (listOfOrganizationWeVoteIds) {\n const state = this.getState();\n const filteredOrganizations = [];\n if (listOfOrganizationWeVoteIds) {\n // organizationsFollowedRetrieve API returns more than one voter guide per organization some times.\n const uniqueOrganizationWeVoteIdArray = listOfOrganizationWeVoteIds.filter((value, index, self) => self.indexOf(value) === index);\n uniqueOrganizationWeVoteIdArray.forEach((organizationWeVoteId) => {\n if (state.allCachedOrganizationsDict[organizationWeVoteId]) {\n filteredOrganizations.push(state.allCachedOrganizationsDict[organizationWeVoteId]);\n }\n });\n }\n return filteredOrganizations;\n }", "function gotData(data) {\r\n let idx = 0;\r\n listings = [];\r\n data.forEach((element) => {\r\n let list = new Listing();\r\n list.loadFB(element.val(), idx);\r\n listings.push({'val': list, 'ref': element.ref, 'visible': true, 'simpleView': true,});\r\n idx++;\r\n });\r\n applyFilters();\r\n}", "function buildList() {\n if (settings.filterBy === \"expelled\") {\n const currentList = filterList(expelledStudentList);\n const sortedList = sortList(currentList);\n\n displayStudents(sortedList);\n updateInfoList(sortedList);\n } else {\n const currentList = filterList(studentList);\n const sortedList = sortList(currentList);\n\n displayStudents(sortedList);\n updateInfoList(sortedList);\n }\n}", "getRefferalAndAngentList(){\nreturn this.get(Config.API_URL + Constant.REFFERAL_GETREFFERALANDANGENTLIST);\n}", "async function list(req, res) {\n const { date, mobile_number } = req.query;\n if (date) {\n const data = await service.listByDate(date);\n res.json({ data });\n } else if (mobile_number) {\n const data = await service.listByPhone(mobile_number);\n res.json({ data });\n } else {\n const data = await service.list();\n res.json({ data });\n }\n}", "getUserList(room) {\n var users = this.users.filter((user) => user.room === room); // when returning true array keeps user row in array\n \n // covert array of objects to array of strings(the names)\n var namesArray = users.map((user) => user.name);\n return namesArray;\n }", "function getList(){\r\n // Re-add list items with any new information\r\n let dataSend = \"pullTasks=all\";\r\n let data = apiReq(dataSend, 2);\r\n}", "function getContextsList(type) {\n var list = [];\n\n $.ajax({\n type: 'GET',\n url: '/data/contexts/list',\n dataType: 'json',\n async: false,\n success: function(data) {\n if(data.success)\n $.each(data.rows, function(index, el) {\n if(type == 'all')\n list.push({id: el.name, text: el.name + ' (' + el.type + ')'});\n else if(itemId != el.id)\n list.push({id: el.name, text: el.name + ' (' + el.type + ')'});\n });\n }\n });\n\n return list;\n}", "function transformMatchedList(data) {\n var list = angular.fromJson(data);\n list = bookingAdminService.matchedDic(list);\n return list;\n }", "allProducts(productsListFromProps) {\n if (productsListFromProps.length > 0) {\n const l = productsListFromProps.length;\n let indexedProductsAll = [];\n for (let x = 0; x < l; x++) {\n indexedProductsAll.push({ seqNumb: x, details: productsListFromProps[x] })\n }\n return indexedProductsAll;\n } else {\n return [];\n }\n }", "getAll() {\n let inventoryList = [];\n for(let id in this.warehouse) {\n inventoryList.push(\n Object.assign({}, this.warehouse[id])\n );\n }\n return inventoryList;\n }", "function clients(list, name) {\n return list.filter(item => item.name === name).map(item => item.clientId);\n}", "getListByClass(classNumber) {\n let classList = studentsFullList.filter(student => student.classId == classNumber);\n return classList.map(student => {\n let name = student.name;\n let classId = student.classId;\n return {\n name,\n classId\n };\n });\n }", "function buildShowList(){\n\n\n let dataList = JSON.parse(localStorage.getItem(\"allData\")) ;\n let flag;\n\n\n for(let i = 0; i < dataList.length ; ++i){\n\n\n if(dataList[i].status == \"completed\")\n \t flag = true ;\n else \n flag = false ;\n\n addShowList(dataList[i] , flag); \t\n\n }\n\n }", "getUserList(room){\n var users = this.users.filter((user)=> user.room === room); /* FINDING USER WITH SAME ROOM NAME */\n var namesArray = users.map((user)=> user.name); /* SELECTING USER NAMES IN THAT ROOM */\n\n return namesArray;\n }", "function listByDates(date, list) {\n incomingDate=moment(date).format('YYYY-MM-DD')\n let datearray = [];\n return new Promise((resolve, reject) => {\n list.forEach(element => { //filter list according to date comparison\n // console.log(moment(element.createdDate, \"YYYY-MM-DD\"))\n let dbdate = moment(element.date, \"YYYY-MM-DD\");\n // console.log(moment(inputdate).isSame(dbdate,'date'))\n if (moment(incomingDate).isSame(dbdate, 'date')) {\n datearray.push(element);\n }\n })\n resolve(datearray)\n })\n}", "async getRecords() {\n const sitemap = new sitemapper({\n url: this.sitemapUrl,\n timeout: 120000\n })\n\n const res = await sitemap.fetch();\n\n const excludes = new Set(this.ignoreUrls);\n const fullList = new Set([\n ...res.sites,\n ...this.additionalUrls\n ]).filter(url => !excludes.has(url));\n\n return fullList; \n }", "function list (cb) {\n const q = ds.createQuery([kind])\n .order('order_id', { desending: true });\n\n ds.runQuery(q, (err, entities, nextQuery) => {\n if (err) {\n cb(err);\n return;\n }\n cb(null, entities.map(fromDatastore));\n });\n}", "lists() {\n const board = ReactiveCache.getBoard(this.selectedBoardId.get());\n const ret = board.lists();\n return ret;\n }", "function exactMatchToList(list, attribute){\n return exactMatch(list, attribute).map( (ele) => { return ele['name']})\n}", "getDependsId(recordList){\n return recordList ? recordList.map(entry=>entry.dependsOn) : [];\n }", "function getFilters(callback) {\n var filterList=[];\n fetch('/filters', {\n accept: \"application/json\"\n })\n .then(response => response.json())\n .then(response => {\n response.forEach((element) => {\n let curr = {\n label:element.filter,\n value:element.id,\n }\n\n filterList.push(curr);\n });\n return filterList\n })\n .then(callback)\n}", "function getPolicyListCurated(){\n var items = [];\n Policy.getPolicy({app_id: $stateParams.app_id},\n function onSuccess(response) {\n response.rules.forEach(function(rule){\n var opt = $filter('filter')(vm.operator, function (d) {return d.id === rule.operator;})[0] || 'NaN';\n var metric = $filter('filter')(vm.metrics, function (d) {return d.id === rule.metric;})[0] || 'NaN';\n\n items.push({\n metric: metric.name,\n operator: opt.name,\n value: rule.value,\n weight: rule.weight,\n id: rule.id,\n organs: rule.organs,\n selected: false\n });\n });\n\n }, function onError(err) {\n toastr.error(err.data, 'Error');\n });\n return items;\n }", "static async list(){\n let sql = 'Select * from theloai';\n let list =[];\n try {\n let results = await database.excute(sql);\n results.forEach(element => {\n let tl = new TheLoai();\n tl.build(element.id,element.tenTheLoai,element.moTa);\n list.push(tl);\n });\n return list;\n\n } catch (error) {\n throw error; \n } \n }", "list(id) {\n const params = new Array();\n if (id != null) {\n params.push(`id=${id}`);\n }\n return this.rest.get(`${this.baseUrl}/list`, ...params);\n }", "list(id) {\n const params = new Array();\n if (id != null) {\n params.push(`id=${id}`);\n }\n return this.rest.get(`${this.baseUrl}/list`, ...params);\n }", "function currentList() {\n return isFiltering ? filtered : rawGroups;\n }", "getPages() {\n let typesContain = [Hello, Clock];\n let types = [];\n for (let i = 0; i < this.props.url['screen-apps'].length; i++) {\n let str = this.props.url['screen-apps'][i]['type'];\n for (let j = 0; j < typesContain.length; j++) {\n if (str === typesContain[j].name) {\n types.push(typesContain[j]);\n break;\n }\n }\n }\n return types;\n }", "grabUserListsUpdated(data, mode = 'All') {\n let key = 'UserListsUpdated_' + mode;\n let cond = \"1=1\";\n if (mode == 'WithList')\n cond = \"list_update_ts is not null and is_deleted = false\";\n else if (mode == 'WithoutList')\n cond = \"list_update_ts is null and is_deleted = false\";\n else if (mode == 'Active')\n cond = \"list_update_ts > ('now'::timestamp - '1 year'::interval) and is_deleted = false\";\n else if (mode == 'NonActive')\n cond = \"list_update_ts < ('now'::timestamp - '1 year'::interval) and is_deleted = false\";\n return this.grabByIds({\n key: key,\n isByListOfIds: true,\n getTotalIdsCnt: () => data.totalIdsCnt,\n getListOfIds: () => data.listOfIds,\n /*getNextIds: (nextId, limit) => {\n return this.db.manyOrNone(\"\\\n select id, trim(login) as login, list_update_ts \\\n from malrec_users \\\n where id >= $(nextId) and need_to_check_list = false \\\n and \"+ cond +\" \\\n order by id asc \\\n limit $(limit) \\\n \", {\n nextId: nextId,\n limit: limit,\n }).then((rows) => {\n let ids = [], data = {};\n if (rows)\n for (let row of rows) {\n ids.push(parseInt(row.id));\n data[row.id] = {\n login: row.login, \n listUpdatedTs: row.list_update_ts, \n };\n }\n return {ids: ids, data: data};\n });\n },*/\n getDataForIds: (ids) => {\n return this.db.manyOrNone(\"\\\n select id, trim(login) as login, list_update_ts \\\n from malrec_users \\\n where id in (\" + ids.join(', ') + \") \\\n \").then((rows) => {\n let data = {};\n if (rows)\n for (let row of rows) {\n data[row.id] = {\n login: row.login, \n listUpdatedTs: row.list_update_ts, \n };\n }\n return data;\n });\n },\n fetch: (id, data) => {\n return this.provider.getLastUserListUpdates({login: data.login});\n },\n process: (id, updatedRes, data) => {\n return this.processer.processUserListUpdated(id, data.login, \n data.listUpdatedTs, updatedRes);\n },\n });\n }", "function findServicedAll() {\n findServiced(spec1);\n findServiced(spec2);\n findServiced(spec3);\n\n localStorage.setItem('list', JSON.stringify(list));\n getList();\n}", "function findServicedAll() {\n findServiced(spec1);\n findServiced(spec2);\n findServiced(spec3);\n\n localStorage.setItem('list', JSON.stringify(list));\n getList();\n}", "async getCustomers() {\n const customers = await this.request('/vehicles', 'GET');\n let customersList = [];\n if (customers.status === 'success' && customers.data !== undefined) {\n customersList = customers.data\n .map(customer => customer.ownerName)\n .filter((value, index, self) => self.indexOf(value) === index)\n .map(customer => ({\n label: customer,\n value: customer\n }));\n }\n return customersList;\n }", "getEntitieslist() {\n const d = this.items\n return Object.keys(d).map(function (field) {\n return d[field]\n })\n }", "patList(){\n let Pats = Patients.find({}).fetch();\n //console.dir(Pats)\n\n let list = [];\n for (let x in Pats){\n list.push({\n name: Pats[x].fname + ' ' + Pats[x].lname,\n patId: Pats[x].patId\n })\n }\n //console.log(list);\n return list\n }", "function getSubscribersListByGroups(){\n if(!$scope.mail.subscribers_groups_ids || !$scope.mail.subscribers_groups_ids.length){\n $scope.status.subscribers_list = {\n error: 'Subscribers groups not select'\n };\n return;\n }\n\n var received_groups = 0;\n $scope.mail.subscribers_groups_ids.forEach(function(subscriber_group_id){\n SubscribersGroups.get({id: subscriber_group_id, with_subscribers: true}).$promise.then(function(response){\n response.subscribers.forEach(function(subscriber){\n if($scope.subscribers_list.indexOf(subscriber.mail) == -1)\n $scope.subscribers_list.push(subscriber.mail);\n });\n\n received_groups++;\n if(received_groups == $scope.mail.subscribers_groups_ids.length)\n $scope.status.subscribers_list.loading = false;\n });\n });\n }", "function getTodoList() {\n return Object.values(DB).filter((item) => item.status === TODO)\n}", "function getTodoLists() {\n $http.get(settings.api + '/todo')\n .success(function (data) {\n for (var i = 0; i < data.length; i++) {\n if (data[i].Id == SecretService.listId) {\n data[i].active = true;\n }\n }\n $scope.todoLists = data;\n })\n .error(function(data) {\n console.log('Error: ' + data);\n });\n }", "function populateBasedOnFilter(response, arg){\n console.log(response)\n console.log(arg)\n\n // better way is to recieve hashmap with date key and object strings as value\n switch(arg) {\n case \"statements\":\n var i = 0;\n for(i = 0; i < response.length; i++){\n $('.activityList').append(\"<li class='statementItems'><div class='listChildren container-fluid'><div class='col-sm-1'><i class='fa fa-quote-right fa-3x' aria-hidden='true' style='color:#35a87c'></i></div><div class='col-sm-11'><p class='date'>\" + new Date(response[i]['date']).toDateString() + \"</p><p>\" + memberName + \" released a <a href=\" + response[i]['url'] + \" target='_blank'>statement</a> </p><p class='description'>\" + response[i]['title'] + \"</p></div></div></li>\") \n } \n break;\n case \"bills\":\n var i = 0;\n for(i = 0; i < response.length; i++){\n $('.activityList').append(\"<li class='billItems'><div class='listChildren container-fluid'><div class='col-sm-1'><i class='fa fa-file-text fa-3x' aria-hidden='true' style='color:#edbe40'></i></div><div class='col-sm-11'><p class='date'>\" + new Date(response[i]['latest_major_action_date']).toDateString() + \"</p><p><a href= \" + response[i]['congressdotgov_url'] + \" target='_blank'><strong>\" + response[i]['title'] + \"</strong></a></p><p class='description'>\" +response[i]['latest_major_action']+ \"</p></div></div></li>\") \n }\n break;\n case \"votes\":\n response = response[0]['votes']\n \n var i = 0;\n for(i = 0; i < response.length; i++){\n \n var motionResult = response[i]['result'].toLowerCase();\n var resText = \"Failed\"\n var iconColor = \"#db4818\"\n\n if(motionResult.includes('agreed')){\n resText = \"Passed\"\n }\n \n if(response[i]['position'].toLowerCase() == 'yes'){\n iconColor = \"#2add3f\"\n }\n \n $('.activityList').append(\"<li class='voteItems'><div class='listChildren container-fluid'><div class='col-sm-1'><i class='fa fa-check-circle fa-3x' aria-hidden='true' style='color:\" + iconColor + \"'></i></div><div class='col-sm-11'><p class='date'>\" + new Date(response[i]['date']).toDateString() + \"</p><p>\" + memberName + \" voted <span class=\" + response[i]['position'].toLowerCase() + \">\" + response[i]['position'].toLowerCase() + \"</span> on \" + response[i]['chamber'] + \" Vote \" + response[i]['roll_call'] + \"</p><p class='description'>\" + response[i]['description'] + \"</p><p>\" +response[i]['question']+ \": <span class= \" + resText.toLowerCase() + \">\" + resText + \"</span></p></div></div></li>\") \n }\n break;\n case \"twitter\":\n \n break;\n default:\n } \n }", "get lists() {\r\n return new Lists(this);\r\n }", "grabUserLoginsByList(data, mode = 'Lost') {\n let key = 'SpUserLogins_' + mode;\n return this.grabByIds({\n key: key,\n isByListOfIds: true,\n getTotalIdsCnt: () => data.totalIdsCnt,\n getListOfIds: () => data.listOfIds,\n getDataForIds: (ids) => null,\n fetch: (id) => this.provider.userIdToLogin({userId: id}),\n process: (id, obj) => this.processer.processUserIdToLogin(id, obj),\n });\n }", "getLists() {\n return db.query('SELECT * FROM lists ORDER BY id')\n }", "function getResultItems(res,type) {\r\n var data = {};\r\n switch(type) {\r\n case 'artist':\r\n data.items = res.artists.items;\r\n break;\r\n case 'playlist':\r\n data.items = res.playlists.items;\r\n break; \r\n }\r\n return data;\r\n }", "async function getAreasList() {\n const res = await axios.get(`${MD_BASE_URL}/list.php?a=list`);\n const areasList = res.data.meals.map(i => i.strArea);\n return areasList;\n }", "function buildRequestList () {\n\tlet order = [];\n\n\t// Check if the user is requesting to ascend any items.\n\tlet hasAscension = false;\n\tlet filteredAscensionItems = {};\n\tfor (let itemId in ascensionItems) {\n\t\tlet requestedAmount = ascensionItems[itemId];\n\t\tif (requestedAmount <= 0) {\n\t\t\tcontinue;\n\t\t} else {\n\t\t\thasAscension = true;\n\t\t\tfilteredAscensionItems[itemId] = requestedAmount;\n\t\t\tconsole.log(itemId, requestedAmount, filteredAscensionItems);\n\t\t}\n\t}\n\n\t// If so, then note that ascension is happening in the order.\n\tif (hasAscension) {\n\t\torder.push({\n\t\t\tid: 'ASCENSION',\n\t\t\tcheckoutItems: filteredAscensionItems\n\t\t});\n\t}\n\n\t// Check if the user has requested to buy any services.\n\tfor (let serviceId in checkoutItems) {\n\t\tlet requestedAmount = checkoutItems[serviceId];\n\t\tif (requestedAmount <= 0) {\n\t\t\tcontinue;\n\t\t} else {\n\t\t\torder.push({\n\t\t\t\tid: serviceId,\n\t\t\t\tamount: requestedAmount\n\t\t\t});\n\t\t}\n\t}\n\treturn order;\n}", "getGroupedBySession() {\n var map = {general:{items:[]}};\n for(var i = 0; i< this.list.length; i++) {\n if (this.list[i].sessionId) {\n if (!(this.list[i].sessionId in map)) {\n map[this.list[i].sessionId] = {items: []};\n }\n map[this.list[i].sessionId].items.push(this.list[i]);\n } else {\n map['general'].items.push(this.list[i]);\n }\n }\n return map;\n }", "function GetPkgByFacAndDate(factory, plnDate) {\n var list = [];\n if (!factory) return; //user must select the factory\n\n var config = ObjectConfigAjaxPost(\n \"/MesPkgIotMachineTimeDashboard/GetMesPkgByDate\",\n false,\n JSON.stringify({ factory: factory, date: plnDate })\n );\n\n AjaxPostCommon(config, function (lstPackage) {\n if (lstPackage && lstPackage.Result && lstPackage.Result.length > 0) {\n list = lstPackage.Result;\n //let plnStartDate = $(\"#beginDate\").val().replace(/\\//g, \"-\");\n //lstPackage.Result.map((item) => {\n // //after get list MES Package then get detail of MES Package\n // let el = getInfoDetailChart(item.MxPackage, plnStartDate);\n // if (el != null) {\n // list.push(el);\n // }\n //})\n }\n });\n\n return list;\n}", "getListItem(createdList, classInstance) {\n\n let results=classInstance.getListResults();\n\n let count=0;\n let timer=setInterval(function () {\n\n ++count;\n if (count === 2) {\n clearInterval(timer);\n }\n\n\n if (![undefined, 0].includes(results.length)) {\n\n\n for (let x = 0; x <= results.length; x++) {\n\n if (![undefined].includes(results[x])) {\n\n createdList.innerHTML = \" \";\n if (results[x].hasOwnProperty(0)) {\n results[x].forEach(function (results) {\n\n\n createdList.innerHTML+=\"<option class='listed'>\"+results.name+\"</option>\";\n\n\n })\n }\n\n\n }\n\n }\n\n\n }\n\n\n }, 1000);\n\n\n\n\n\n }", "function getData(search_param) {\n resourceRepo.getList(search_param).then(function success(response) {\n if (angular.isDefined(response.data.items)) {\n vm.itemsList = response.data.items;\n }\n }, function failure(response) {\n var t = response;\n })\n }", "function generatePartyList(par) {\n\t\tvar arr = [];\n\t\tfor (var i = 0; i < members.length; i++) {\n\t\t\tif (members[i].party === par) {\n\t\t\t\tarr.push(members[i]);\n\t\t\t}\n\t\t}\n\t\treturn arr;\n\t}", "function pick_list(lists) {\n return _.find(lists, function(list) {\n return _.includes(list['title'], 'webtask');\n });\n}", "static async getListings() {\n let res = await this.request(`listings`);\n return res.listings;\n }", "function getTasks() {\n console.log(\"Called: getTasks \");\n\n let result = [];\n let tempTasks = [];\n let value = this.state.compareRole.toLowerCase();\n\n result = this.state.roles.filter(function (data) {\n // return data.role.includes(value) !== -1;\n // return data._id.includes(\"60fdefe4d7bc2a0eb3c697dd\");\n return data.role.includes(value);\n });\n // console.log(\"Called: getTasks \", result);\n\n return result.map(function (currenttask) {\n // console.log(\"Tasks from getTasks\", currenttask.tasks);\n tempTasks = currenttask.tasks;\n\n return tempTasks.map((tasklist) => {\n // console.log(\"FROM getTasks: \", tasklist);\n return <li>{tasklist}</li>;\n });\n });\n }", "filterByStatus(status){\n let todosTemp = [];\n \n this.props.observer.filteredTodos.forEach(function (todo) {\n debugger;\n if(todo.props.isSelected){\n todosTemp.push(todo);\n }\n });\n \n return todosTemp; \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 }", "async function list(req, res) {\n const { date, mobile_number } = req.query;\n let data;\n if (date) {\n data = await service.listByDate(date);\n } else if (mobile_number) {\n data = await service.search(mobile_number);\n } else {\n data = await service.list();\n }\n res.json({ data });\n}", "static all () {\n return [{\n ids: ['CITY OF TAMPA'],\n name: 'City of Tampa',\n // address: '',\n phone: '8132748811',\n // fax: '',\n // email: '',\n website: 'https://www.tampagov.net/solid-waste/programs'\n },\n {\n ids: ['TEMPLE TERRACE'],\n name: 'City of Temple Terrace',\n // address: '',\n phone: '8135066570',\n // fax: '',\n email: '[email protected]',\n website: 'http://templeterrace.com/188/Sanitation/'\n },\n {\n ids: ['CITY OF PLANT CITY'],\n name: 'City of Plant City',\n address: '1802 Spooner Drive, Plant City, FL 33563',\n phone: '8137579208',\n fax: '8137579049',\n email: '[email protected]',\n website: 'https://www.plantcitygov.com/64/Solid-Waste'\n }]\n }", "filteredRequestList() {\n const fullname = (employee)=> employee.fname + \" \" + employee.lname;\n if(this.employeeFilter === 'all' && this.approvalFilter === 'all') {\n return this.expenses;\n }\n let filteredList = [];\n if(this.employeeFilter !== 'all' && this.approvalFilter === 'all') {\n //employeeId is unique and therefore the returned array should always be exactly one element\n const employee = this.employees\n .filter(emp=> emp.employeeId === this.employeeFilter)[0].fullname;\n filteredList = this.expenses.filter(expense=> fullname(expense.requestor) === employee);\n return filteredList;\n }\n if(this.employeeFilter === 'all' && this.approvalFilter !== 'all') {\n filteredList = this.expenses\n .filter(expense=> expense.approval == this.approvalFilter);\n return filteredList;\n }\n if(this.employeeFilter !== 'all' && this.approvalFilter !== 'all') {\n const employee = this.employees\n .filter(emp=> emp.employeeId === this.employeeFilter)[0].fullname;\n filteredList = this.expenses\n .filter(expense=> fullname(expense.requestor) === employee)\n .filter(expense=> expense.approval == this.approvalFilter);\n return filteredList;\n }\n }", "function getList(){\n\t\t// call ajax\n\t\tlet url = 'https://final-project-sekyunoh.herokuapp.com/get-user';\n\t\tfetch(url)\n\t\t.then(checkStatus)\n\t\t.then(function(responseText) {\n\t\t\tlet res = JSON.parse(responseText);\n\t\t\tlet people = res['people'];\n\t\t\tdisplayList(people);\n\t\t})\n\t\t.catch(function(error) {\n\t\t\t// show error\n\t\t\tdisplayError(error + ' while getting list');\n\t\t});\n\t}", "generateExerciseList() {\n this.generatedExerciseList = [];\n if (this.exerciseList) {\n for (let exercise in this.exerciseList) {\n if (this.exerciseList[exercise].subject === this.$scope.selectedSubject && this.exerciseList[exercise].subCategory === this.$scope.selectedSubCategory) {\n this.generatedExerciseList.push(this.exerciseList[exercise]);\n }\n }\n }\n }", "function loadDfctFields() {\n var request = $.ajax(\n 'https://hpalm.its.yale.edu/qcbin/rest/domains/' + jQuery.data(document.body, 'domain') + '/projects/' + jQuery.data(document.body, 'project') + '/customization/entities/defect/fields?required=true&alt=application/json', {\n dataType: \"json\"\n }\n ),\n chained = request.then(function (data) {\n listss = []\n ids = []\n $(jQuery.parseJSON(JSON.stringify(data))).each(function () {\n this.Field.forEach(function (item) {\n // Only get the non-system values\n if (item.System === false) {\n console.log(item.PhysicalName)\n console.log(item.Label)\n attrs = new Object;\n if (item.Type === \"LookupList\") {\n attrs.Name = item.Name\n ids.push(item[\"List-Id\"])\n attrs.id = item[\"List-Id\"]\n listss.push(attrs);\n }\n }\n });\n });\n\n return $.ajax(\"https://hpalm.its.yale.edu/qcbin/rest/domains/WATERFALL/projects/MAINT_CouncilOfMasters/customization/used-lists?alt=application/json\", {\n dataType: \"json\",\n data: {\n id: ids.join(\",\")\n }\n });\n });\n\n chained.done(function (data) {\n console.log(data);\n\n fields = []\n $(jQuery.parseJSON(JSON.stringify(data))).each(function () {\n this.lists.forEach(function (item) {\n vals = []\n item.Items.forEach(function (entry) {\n vals.push(entry.value);\n });\n\n // Push an object in for each list\n obj = {}\n // Need physical name\n obj.name = item.Name;\n\n //sconsole.log($.grep(listss, function(e){ return e.id === item.Id; })[0].physical_name);\n obj.phy_name = $.grep(listss, function (e) {\n return e.id === item.Id;\n })[0].Name;\n obj.is = vals;\n fields.push(obj);\n });\n //console.log(listss);\n //console.log(listss.filter(function (list) { return list.id == \"1320\" })[0].physical_name);\n });\n // Store the lists in local storage.\n localStorage.setItem(\"defectLists\", JSON.stringify(fields));\n });\n}", "getAllCurrentJobs() { \n return this.items.map(ele=>ele.element);\n }", "deliveries(){\n const deliveriesInNeighborhood = [];\n for(const delivery of store.deliveries){\n if(delivery.neighborhoodId === this.id){\n deliveriesInNeighborhood.push(delivery)\n }\n }\n return deliveriesInNeighborhood;\n }", "function loadAll() {\n return $scope.listData;\n\n var allStates = 'Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware,\\\n Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana,\\\n Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana,\\\n Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York, North Carolina,\\\n North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina,\\\n South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, Washington, West Virginia,\\\n Wisconsin, Wyoming';\n return allStates.split(/, +/g).map(function (state) {\n return {\n value: state.toLowerCase(),\n display: state\n };\n });\n\n\n // sh.each()\n\n\n }", "function fetchListings() {\n\treturn db.any('SELECT * FROM listings ORDER BY post_date DESC');\n}", "getCompiledList(jobClusterId) {\n let newList = [];\n\n return this._setList().then((clusterList) => {\n console.log(clusterList);\n if (typeof clusterList !== \"undefined\" && clusterList !== null && clusterList !== 403) {\n clusterList.forEach((cluster, i) => {\n const checkObj = {\n value: cluster.id,\n label: cluster.name,\n selected: false\n };\n if (jobClusterId !== null && jobClusterId == cluster.id) {\n checkObj.selected = true;\n }\n newList.push(checkObj);\n });\n\n return newList;\n } else {\n return Promise.resolve(clusterList);\n }\n\n });\n }", "function createBeerListFetches(){\n return [fetch('https://api.punkapi.com/v2/beers'), fetch('https://api.punkapi.com/v2/beers')] \n}", "generateGetAll() {\n\n }" ]
[ "0.6232334", "0.61338603", "0.61326045", "0.60422355", "0.5983285", "0.5833092", "0.58275867", "0.5807358", "0.57620746", "0.5690261", "0.5684759", "0.5680404", "0.56588656", "0.5641119", "0.563561", "0.56234515", "0.56033593", "0.55922544", "0.5586068", "0.55778646", "0.55279356", "0.55092055", "0.55092055", "0.5501233", "0.54858863", "0.54726845", "0.54726845", "0.5464716", "0.54615307", "0.5452872", "0.5447096", "0.54465234", "0.5442054", "0.5440973", "0.54341924", "0.54316056", "0.54301745", "0.5426391", "0.5416377", "0.541588", "0.5404231", "0.540192", "0.5401748", "0.53986996", "0.53948987", "0.53763366", "0.5375865", "0.5373522", "0.5366926", "0.5364369", "0.53634125", "0.53531206", "0.5349386", "0.53491414", "0.53488874", "0.5347324", "0.53436714", "0.53428406", "0.533814", "0.533814", "0.5335028", "0.5328877", "0.5324067", "0.53227705", "0.53227705", "0.53208077", "0.5315218", "0.5315016", "0.53095585", "0.5304203", "0.5298496", "0.5297687", "0.52965206", "0.52915376", "0.52888024", "0.52883226", "0.5285909", "0.5285354", "0.5281036", "0.5280848", "0.5280714", "0.5280448", "0.52705145", "0.52680725", "0.52674645", "0.52628005", "0.52610815", "0.5256619", "0.525421", "0.52528113", "0.52512056", "0.5249025", "0.5240555", "0.52379066", "0.52334887", "0.5232904", "0.5227191", "0.52263355", "0.5225041", "0.52192", "0.5217482" ]
0.0
-1
get list on the basis on
function getPlayersListByMatchId(homeTeamId, awayTeamId) { var wkUrl = config.apiUrl + 'teamsListByMatchId/'; return $http({ url: wkUrl, params: { homeTeamId: homeTeamId, awayTeamId: awayTeamId }, method: 'GET', isArray: true }).then(success, fail) function success(resp) { return resp.data; } function fail(error) { var msg = "Error getting list: " + error; //log.logError(msg, error, null, true); throw error; // so caller can see it } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findLists() {}", "list(filterFn = this._list_filter) {\n const list = this.get('list') || [];\n return list.reduce((a, i) => {\n if (filterFn(i)) {\n a.push(i);\n }\n return a;\n }, []);\n }", "list() {\n const listings = this._listings.all();\n return Object.keys(listings).map(key => listings[key]);\n }", "get_all(name) {\n let ret = [];\n for(let item of this.data) {\n if(item.name === name) {\n ret.push(item);\n }\n }\n return ret;\n }", "function getTaskLists() {\n\n}", "generateTasksLists() {\n switch (this.props.selectedTaskType) {\n case 'ongoing':\n return this.props.ongoingTaskList;\n case 'overdue':\n return this.props.overdueTaskList;\n case 'completed':\n return this.props.completedTaskList;\n default:\n return null;\n }\n }", "_list() {\n const parameters = [\n 1,\n ['active', 'id', 'interval', 'language', 'last_run', 'name', 'run_on', 'tags'],\n {},\n 1000,\n 'name',\n ];\n return this.list.call(this, ...parameters);\n }", "list(req, res) {\n this.__readData(__data_source)\n .then(lists => {\n \n \n res.json({ type: \"success\", data: this.__formatter(lists) });\n })\n .catch(err => res.status(412).json({type:\"error\", data:[], message:\"No Data Found\"}));\n }", "function getContextsList2(type) {\n var list = [];\n\n $.ajax({\n type: 'GET',\n url: '/data/contexts/list',\n dataType: 'json',\n async: false,\n success: function(data) {\n if(data.success)\n $.each(data.rows, function(index, el) {\n if(type == 'all')\n list.push({id: el.id, text: el.name + ' (' + el.type + ')'});\n else if(itemId != el.id)\n list.push({id: el.id, text: el.name + ' (' + el.type + ')'});\n });\n }\n });\n\n return list;\n}", "getList(params) {\n return ApiService.get('/list', params.id);\n }", "get filterOptions() { // list state for filter\n let filterOptions = [\n 'All Orders',\n 'Waiting',\n 'Confirmed',\n 'Cancelled',\n ];\n if (!this.env.pos.tables) {\n return filterOptions\n } else {\n this.env.pos.tables.forEach(t => filterOptions.push(t.name))\n return filterOptions\n }\n }", "queryLists() {\n fetch(\"https://deco3801-oblong.uqcloud.net/wanderlist/get_bucketlist_belonging_to_user/\" + this.state.userData.id)\n .then(response => response.json())\n .then(obj => this.loadLists(obj));\n }", "async getAllExample() { \n return [{id:\"0001\"}, {id:\"0002\"}]\n }", "getListName() {}", "getList() {\r\n return this.list.slice()\r\n }", "getList() {\n return this.value ? [] : this.nestedList;\n }", "async getArray(type) {\n if (type == 'anime_top') {\n const resp = await fetch(this.resAni);\n const data = await resp.json();\n return data; \n } else if (type == 'kun_top') {\n const resp = await fetch(this.resChar);\n const data = await resp.json();\n const data1 = data.filter(el => el.gender === 'm')\n return data1; \n } else if (type == 'tyan_top') {\n const resp = await fetch(this.resChar);\n const data = await resp.json();\n const data2 = data.filter(el => el.gender === 'f')\n return data2;\n }\n}", "function printLexemesInList(list) {\n sessionService.getSession().then(function (session) {\n var config = session.projectSettings().config;\n var ws = config.entry.fields.lexeme.inputSystems[1];\n var arr = [];\n for (var i = 0; i < list.length; i++) {\n if (angular.isDefined(list[i].lexeme[ws])) {\n arr.push(list[i].lexeme[ws].value);\n }\n }\n\n console.log(arr);\n });\n }", "grabUserLists(data, mode = 'All') {\n let key = 'UserLists_' + mode;\n let cond = '1=1';\n if (mode == 'New')\n cond = \"list_check_ts is null\";\n else if (mode == 'Updated')\n cond = \"need_to_check_list = true\";\n return this.grabByIds({\n key: key,\n isByListOfIds: true,\n getTotalIdsCnt: () => data.totalIdsCnt,\n getListOfIds: () => data.listOfIds,\n /*getNextIds: (nextId, limit) => {\n return this.db.manyOrNone(\"\\\n select id, trim(login) as login, list_update_ts, list_check_ts, list_id \\\n from malrec_users \\\n where id >= $(nextId) and \"+ cond +\" \\\n order by id asc \\\n limit $(limit) \\\n \", {\n nextId: nextId,\n limit: limit,\n }).then((rows) => {\n let ids = [], data = {};\n if (rows)\n for (let row of rows) {\n ids.push(parseInt(row.id));\n data[row.id] = {\n login: row.login, \n listUpdatedTs: row.list_update_ts, \n listCheckedTs: row.list_check_ts, \n listId: row.list_id,\n };\n }\n return {ids: ids, data: data};\n });\n },*/\n getDataForIds: (ids) => {\n return this.db.manyOrNone(\"\\\n select id, trim(login) as login, list_update_ts, list_check_ts, list_id \\\n from malrec_users \\\n where id in (\" + ids.join(', ') + \") \\\n \").then((rows) => {\n let data = {};\n if (rows)\n for (let row of rows) {\n data[row.id] = {\n login: row.login, \n listUpdatedTs: row.list_update_ts, \n listCheckedTs: row.list_check_ts, \n listId: row.list_id,\n };\n }\n return data;\n });\n },\n fetch: (id, data) => {\n return this.provider.getUserList({login: data.login});\n },\n process: (id, newList, data) => {\n return this.processer.processUserList(id, data.login, data.listId, \n newList);\n },\n });\n }", "async getList() {\n const data = await this.getData();\n return data.map((medewerkers) => {\n return {\n voornaam: medewerkers.voornaam,\n basisrol: medewerkers.basisrol,\n geboortedatum: medewerkers.geboortedatum,\n };\n });\n }", "getListByClass(classId) {\n let classList = this.students.filter((student) => {\n return student.classId === classId;\n });\n let listByClass = classList.map((student) => {\n const name = student.name;\n const classId = student.classId;\n return {\n name,\n classId\n };\n });\n return listByClass;\n }", "function listingsByStatus() {\n\treturn db.any('SELECT * FROM listings ORDER BY status ASC');\n}", "function listingsByStatus() {\n\treturn db.any('SELECT * FROM listings ORDER BY status ASC');\n}", "function getList(options) {\n\n var deferred = $q.defer();\n\n // validating options\n var defObject = {\n listName: false,\n query: false,\n rowLimit: 10,\n columns: false,\n fields: false,\n useCustomCaml: false,\n columns: false,\n condition: false\n\n };\n\n var settings = $.extend({}, defObject, options);\n\n if ((!settings.listName) && (!settings.fields)) {\n deferred.reject();\n return deferred.promise;\n }\n\n\n\n var context = SP.ClientContext.get_current();\n\n var oList = context.get_web().get_lists().getByTitle(settings.listName);\n\n //var camlQuery = new SP.CamlQuery();\n\n /* check whether rowLimit is avalible or query details avalable\n retrive first 20 rows if both of parameters not avalable \n */\n\n //camlQuery = getCamlView(options.columns, options.condition, 20);\n\n var camlQuery = new SP.CamlQuery();\n if (settings.useCustomCaml) {\n camlQuery.set_viewXml(settings.customCamlXml);\n } else {\n\n if (settings.position !== undefined)\n camlQuery.set_listItemCollectionPosition(position);\n if (settings.folder !== undefined)\n camlQuery.set_folderServerRelativeUrl(_spPageContextInfo.webServerRelativeUrl + \"/Lists/\" + settings.listName + \"/\" + settings.folder);\n\n camlQuery.set_viewXml(getCamlView(settings.columns, settings.condition, 20));\n\n }\n\n\n var collListItem = oList.getItems(camlQuery);\n\n // including options if avalable\n //if (settings.columns) {\n // context.load(collListItem, 'Include(' + options.columns.join() + ')');\n //} else {\n context.load(collListItem);\n //}\n\n context.executeQueryAsync(getAllItems, fail);\n\n //return current Item Collection json\n function getAllItems() {\n // load query details to json object\n var tasksEntries = [];\n var itemsCount = collListItem.get_count();\n for (var i = 0; i < itemsCount; i++) {\n var item = collListItem.itemAt(i);\n var taskEntry = item.get_fieldValues();\n tasksEntries.push(helperService.parse(taskEntry, options.fields.mappingFromSP));\n }\n deferred.resolve(tasksEntries);\n\n }\n\n function fail(sender, args) {\n deferred.reject(args.get_message() + '\\n' + args.get_stackTrace());\n }\n\n return deferred.promise;\n\n\n }", "function getList(type){\n if( type === Type.REGION ) return clone(regions);\n else if( type === Type.PREF ) return clone(prefectures);\n return undefined;\n }", "function getUserList(data) {\n\tvar list = [];\n\tdata.forEach(element => {\n\t\tif (element.name) {\n\t\t\tlist.push({\n\t\t\t\tname: element.name,\n\t\t\t\tgift: element.gift\n\t\t\t});\n\t\t}\n\t\tif (element.spouse) {\n\t\t\tlist.push({\n\t\t\t\tname: element.spouse,\n\t\t\t\tgift: element.spouse_gift\n\t\t\t});\n\t\t}\n\t});\n\treturn list;\n}", "function getUserList(data) {\n\tvar list = [];\n\tdata.forEach(element => {\n\t\tif (element.name) {\n\t\t\tlist.push({\n\t\t\t\tname: element.name,\n\t\t\t\tgift: element.gift\n\t\t\t});\n\t\t}\n\t\tif (element.spouse) {\n\t\t\tlist.push({\n\t\t\t\tname: element.spouse,\n\t\t\t\tgift: element.spouse_gift\n\t\t\t});\n\t\t}\n\t});\n\treturn list;\n}", "itemsList(tableName){\n\t\ttableName = this.idCorrection(tableName);\n\t\tvar res = {isPresent: false, table: []};\n\t\tlet index = this.globalTables.search(tableName);\n\t\tif (index!=-1){\n\t\t\tres.isPresent = true;\t\t\t\n\t\t\tres.table = this.globalTables[index];\n\t\t}\n\t\treturn res;\n\t}", "function getTaskList(indice) \n{\n RMPApplication.debug(\"begin getTaskList\");\n c_debug(dbug.task, \"=> getTaskList\");\n id_index.setValue(indice);\n var query = \"parent.number=\" + var_order_list[indice].wo_number;\n\n var options = {};\n var pattern = {\"wm_task_query\": query};\n c_debug(dbug.task, \"=> getTaskList: pattern = \", pattern);\n id_get_work_order_tasks_list_api.trigger(pattern, options, task_ok, task_ko);\n RMPApplication.debug(\"end getTaskList\");\n}", "static getPlaylistAll (req, res) {\n\n Playlist.find().then(playLists => {\n\n const arrayToSend = []\n\n playLists.forEach(playList => { playList.users.forEach(u => { if (u.id === req.params.userId && playList.type === 'private') { arrayToSend.push(playList) } }) })\n playLists.forEach(playList => { if (playList.type === 'public') { arrayToSend.push(playList) } })\n playLists.forEach(p => {\n p.songs = _.sortBy(p.songs, ['grade'])\n\n })\n return res.json({ message: 'Your playLists', playLists: arrayToSend }) /* istanbul ignore next */\n }).catch(() => { return res.status(500).send({ message: 'Internal serveur error' }) })\n }", "function getByType(type) {\n let listnew = [];\n dataPost.forEach((item, index) => {\n if (item.type.toLowerCase() == type) {\n listnew.push(item);\n }\n });\n showPost(listnew);\n // console.log(listnew);\n }", "async function list(req, res) {\n const { date, currentDate, mobile_number } = req.query;\n if (date) {\n const data = await service.listByDate(date);\n res.json({ data });\n } else if (currentDate) {\n const data = await service.listByDate(currentDate);\n res.json({ data });\n } else if (mobile_number) {\n const data = await service.listByPhone(mobile_number);\n res.json({ data });\n } else {\n const data = await service.list();\n res.json({ data });\n }\n}", "function getData(){\n $http.get(rootUrl+\"?filter[period]=\"+$filter('date')($rootScope.selectedPeriod, \"yyyy-MM\")).then(function(response){\n self.list = response.data.data;\n });\n }", "function getAllItems() {\n // load query details to json object\n var oWebsite = context.get_web();\n context.load(oWebsite);\n var tasksEntries = [];\n\n context.executeQueryAsync(function () {\n\n var itemsCount = collListItem.get_count();\n for (var i = 0; i < itemsCount; i++) {\n var item = collListItem.itemAt(i);\n var taskEntry = item.get_fieldValues();\n\n taskEntry.SourceURL = context.get_web().get_serverRelativeUrl() + \"/Lists/\" + options.listName + \"/\" + taskEntry.DocumentName;\n tasksEntries.push(helperService.parse(taskEntry, options.fields.mappingFromSP));\n\n }\n\n deferred.resolve(tasksEntries);\n\n\n });\n\n\n\n }", "returnOrganizationsFromListOfIds (listOfOrganizationWeVoteIds) {\n const state = this.getState();\n const filteredOrganizations = [];\n if (listOfOrganizationWeVoteIds) {\n // organizationsFollowedRetrieve API returns more than one voter guide per organization some times.\n const uniqueOrganizationWeVoteIdArray = listOfOrganizationWeVoteIds.filter((value, index, self) => self.indexOf(value) === index);\n uniqueOrganizationWeVoteIdArray.forEach((organizationWeVoteId) => {\n if (state.allCachedOrganizationsDict[organizationWeVoteId]) {\n filteredOrganizations.push(state.allCachedOrganizationsDict[organizationWeVoteId]);\n }\n });\n }\n return filteredOrganizations;\n }", "function gotData(data) {\r\n let idx = 0;\r\n listings = [];\r\n data.forEach((element) => {\r\n let list = new Listing();\r\n list.loadFB(element.val(), idx);\r\n listings.push({'val': list, 'ref': element.ref, 'visible': true, 'simpleView': true,});\r\n idx++;\r\n });\r\n applyFilters();\r\n}", "function buildList() {\n if (settings.filterBy === \"expelled\") {\n const currentList = filterList(expelledStudentList);\n const sortedList = sortList(currentList);\n\n displayStudents(sortedList);\n updateInfoList(sortedList);\n } else {\n const currentList = filterList(studentList);\n const sortedList = sortList(currentList);\n\n displayStudents(sortedList);\n updateInfoList(sortedList);\n }\n}", "getRefferalAndAngentList(){\nreturn this.get(Config.API_URL + Constant.REFFERAL_GETREFFERALANDANGENTLIST);\n}", "async function list(req, res) {\n const { date, mobile_number } = req.query;\n if (date) {\n const data = await service.listByDate(date);\n res.json({ data });\n } else if (mobile_number) {\n const data = await service.listByPhone(mobile_number);\n res.json({ data });\n } else {\n const data = await service.list();\n res.json({ data });\n }\n}", "getUserList(room) {\n var users = this.users.filter((user) => user.room === room); // when returning true array keeps user row in array\n \n // covert array of objects to array of strings(the names)\n var namesArray = users.map((user) => user.name);\n return namesArray;\n }", "function getList(){\r\n // Re-add list items with any new information\r\n let dataSend = \"pullTasks=all\";\r\n let data = apiReq(dataSend, 2);\r\n}", "function getContextsList(type) {\n var list = [];\n\n $.ajax({\n type: 'GET',\n url: '/data/contexts/list',\n dataType: 'json',\n async: false,\n success: function(data) {\n if(data.success)\n $.each(data.rows, function(index, el) {\n if(type == 'all')\n list.push({id: el.name, text: el.name + ' (' + el.type + ')'});\n else if(itemId != el.id)\n list.push({id: el.name, text: el.name + ' (' + el.type + ')'});\n });\n }\n });\n\n return list;\n}", "function transformMatchedList(data) {\n var list = angular.fromJson(data);\n list = bookingAdminService.matchedDic(list);\n return list;\n }", "allProducts(productsListFromProps) {\n if (productsListFromProps.length > 0) {\n const l = productsListFromProps.length;\n let indexedProductsAll = [];\n for (let x = 0; x < l; x++) {\n indexedProductsAll.push({ seqNumb: x, details: productsListFromProps[x] })\n }\n return indexedProductsAll;\n } else {\n return [];\n }\n }", "getAll() {\n let inventoryList = [];\n for(let id in this.warehouse) {\n inventoryList.push(\n Object.assign({}, this.warehouse[id])\n );\n }\n return inventoryList;\n }", "function clients(list, name) {\n return list.filter(item => item.name === name).map(item => item.clientId);\n}", "getListByClass(classNumber) {\n let classList = studentsFullList.filter(student => student.classId == classNumber);\n return classList.map(student => {\n let name = student.name;\n let classId = student.classId;\n return {\n name,\n classId\n };\n });\n }", "function buildShowList(){\n\n\n let dataList = JSON.parse(localStorage.getItem(\"allData\")) ;\n let flag;\n\n\n for(let i = 0; i < dataList.length ; ++i){\n\n\n if(dataList[i].status == \"completed\")\n \t flag = true ;\n else \n flag = false ;\n\n addShowList(dataList[i] , flag); \t\n\n }\n\n }", "getUserList(room){\n var users = this.users.filter((user)=> user.room === room); /* FINDING USER WITH SAME ROOM NAME */\n var namesArray = users.map((user)=> user.name); /* SELECTING USER NAMES IN THAT ROOM */\n\n return namesArray;\n }", "function listByDates(date, list) {\n incomingDate=moment(date).format('YYYY-MM-DD')\n let datearray = [];\n return new Promise((resolve, reject) => {\n list.forEach(element => { //filter list according to date comparison\n // console.log(moment(element.createdDate, \"YYYY-MM-DD\"))\n let dbdate = moment(element.date, \"YYYY-MM-DD\");\n // console.log(moment(inputdate).isSame(dbdate,'date'))\n if (moment(incomingDate).isSame(dbdate, 'date')) {\n datearray.push(element);\n }\n })\n resolve(datearray)\n })\n}", "async getRecords() {\n const sitemap = new sitemapper({\n url: this.sitemapUrl,\n timeout: 120000\n })\n\n const res = await sitemap.fetch();\n\n const excludes = new Set(this.ignoreUrls);\n const fullList = new Set([\n ...res.sites,\n ...this.additionalUrls\n ]).filter(url => !excludes.has(url));\n\n return fullList; \n }", "function list (cb) {\n const q = ds.createQuery([kind])\n .order('order_id', { desending: true });\n\n ds.runQuery(q, (err, entities, nextQuery) => {\n if (err) {\n cb(err);\n return;\n }\n cb(null, entities.map(fromDatastore));\n });\n}", "lists() {\n const board = ReactiveCache.getBoard(this.selectedBoardId.get());\n const ret = board.lists();\n return ret;\n }", "function exactMatchToList(list, attribute){\n return exactMatch(list, attribute).map( (ele) => { return ele['name']})\n}", "getDependsId(recordList){\n return recordList ? recordList.map(entry=>entry.dependsOn) : [];\n }", "function getFilters(callback) {\n var filterList=[];\n fetch('/filters', {\n accept: \"application/json\"\n })\n .then(response => response.json())\n .then(response => {\n response.forEach((element) => {\n let curr = {\n label:element.filter,\n value:element.id,\n }\n\n filterList.push(curr);\n });\n return filterList\n })\n .then(callback)\n}", "function getPolicyListCurated(){\n var items = [];\n Policy.getPolicy({app_id: $stateParams.app_id},\n function onSuccess(response) {\n response.rules.forEach(function(rule){\n var opt = $filter('filter')(vm.operator, function (d) {return d.id === rule.operator;})[0] || 'NaN';\n var metric = $filter('filter')(vm.metrics, function (d) {return d.id === rule.metric;})[0] || 'NaN';\n\n items.push({\n metric: metric.name,\n operator: opt.name,\n value: rule.value,\n weight: rule.weight,\n id: rule.id,\n organs: rule.organs,\n selected: false\n });\n });\n\n }, function onError(err) {\n toastr.error(err.data, 'Error');\n });\n return items;\n }", "static async list(){\n let sql = 'Select * from theloai';\n let list =[];\n try {\n let results = await database.excute(sql);\n results.forEach(element => {\n let tl = new TheLoai();\n tl.build(element.id,element.tenTheLoai,element.moTa);\n list.push(tl);\n });\n return list;\n\n } catch (error) {\n throw error; \n } \n }", "list(id) {\n const params = new Array();\n if (id != null) {\n params.push(`id=${id}`);\n }\n return this.rest.get(`${this.baseUrl}/list`, ...params);\n }", "list(id) {\n const params = new Array();\n if (id != null) {\n params.push(`id=${id}`);\n }\n return this.rest.get(`${this.baseUrl}/list`, ...params);\n }", "function currentList() {\n return isFiltering ? filtered : rawGroups;\n }", "getPages() {\n let typesContain = [Hello, Clock];\n let types = [];\n for (let i = 0; i < this.props.url['screen-apps'].length; i++) {\n let str = this.props.url['screen-apps'][i]['type'];\n for (let j = 0; j < typesContain.length; j++) {\n if (str === typesContain[j].name) {\n types.push(typesContain[j]);\n break;\n }\n }\n }\n return types;\n }", "grabUserListsUpdated(data, mode = 'All') {\n let key = 'UserListsUpdated_' + mode;\n let cond = \"1=1\";\n if (mode == 'WithList')\n cond = \"list_update_ts is not null and is_deleted = false\";\n else if (mode == 'WithoutList')\n cond = \"list_update_ts is null and is_deleted = false\";\n else if (mode == 'Active')\n cond = \"list_update_ts > ('now'::timestamp - '1 year'::interval) and is_deleted = false\";\n else if (mode == 'NonActive')\n cond = \"list_update_ts < ('now'::timestamp - '1 year'::interval) and is_deleted = false\";\n return this.grabByIds({\n key: key,\n isByListOfIds: true,\n getTotalIdsCnt: () => data.totalIdsCnt,\n getListOfIds: () => data.listOfIds,\n /*getNextIds: (nextId, limit) => {\n return this.db.manyOrNone(\"\\\n select id, trim(login) as login, list_update_ts \\\n from malrec_users \\\n where id >= $(nextId) and need_to_check_list = false \\\n and \"+ cond +\" \\\n order by id asc \\\n limit $(limit) \\\n \", {\n nextId: nextId,\n limit: limit,\n }).then((rows) => {\n let ids = [], data = {};\n if (rows)\n for (let row of rows) {\n ids.push(parseInt(row.id));\n data[row.id] = {\n login: row.login, \n listUpdatedTs: row.list_update_ts, \n };\n }\n return {ids: ids, data: data};\n });\n },*/\n getDataForIds: (ids) => {\n return this.db.manyOrNone(\"\\\n select id, trim(login) as login, list_update_ts \\\n from malrec_users \\\n where id in (\" + ids.join(', ') + \") \\\n \").then((rows) => {\n let data = {};\n if (rows)\n for (let row of rows) {\n data[row.id] = {\n login: row.login, \n listUpdatedTs: row.list_update_ts, \n };\n }\n return data;\n });\n },\n fetch: (id, data) => {\n return this.provider.getLastUserListUpdates({login: data.login});\n },\n process: (id, updatedRes, data) => {\n return this.processer.processUserListUpdated(id, data.login, \n data.listUpdatedTs, updatedRes);\n },\n });\n }", "function findServicedAll() {\n findServiced(spec1);\n findServiced(spec2);\n findServiced(spec3);\n\n localStorage.setItem('list', JSON.stringify(list));\n getList();\n}", "function findServicedAll() {\n findServiced(spec1);\n findServiced(spec2);\n findServiced(spec3);\n\n localStorage.setItem('list', JSON.stringify(list));\n getList();\n}", "async getCustomers() {\n const customers = await this.request('/vehicles', 'GET');\n let customersList = [];\n if (customers.status === 'success' && customers.data !== undefined) {\n customersList = customers.data\n .map(customer => customer.ownerName)\n .filter((value, index, self) => self.indexOf(value) === index)\n .map(customer => ({\n label: customer,\n value: customer\n }));\n }\n return customersList;\n }", "getEntitieslist() {\n const d = this.items\n return Object.keys(d).map(function (field) {\n return d[field]\n })\n }", "patList(){\n let Pats = Patients.find({}).fetch();\n //console.dir(Pats)\n\n let list = [];\n for (let x in Pats){\n list.push({\n name: Pats[x].fname + ' ' + Pats[x].lname,\n patId: Pats[x].patId\n })\n }\n //console.log(list);\n return list\n }", "function getSubscribersListByGroups(){\n if(!$scope.mail.subscribers_groups_ids || !$scope.mail.subscribers_groups_ids.length){\n $scope.status.subscribers_list = {\n error: 'Subscribers groups not select'\n };\n return;\n }\n\n var received_groups = 0;\n $scope.mail.subscribers_groups_ids.forEach(function(subscriber_group_id){\n SubscribersGroups.get({id: subscriber_group_id, with_subscribers: true}).$promise.then(function(response){\n response.subscribers.forEach(function(subscriber){\n if($scope.subscribers_list.indexOf(subscriber.mail) == -1)\n $scope.subscribers_list.push(subscriber.mail);\n });\n\n received_groups++;\n if(received_groups == $scope.mail.subscribers_groups_ids.length)\n $scope.status.subscribers_list.loading = false;\n });\n });\n }", "function getTodoList() {\n return Object.values(DB).filter((item) => item.status === TODO)\n}", "function getTodoLists() {\n $http.get(settings.api + '/todo')\n .success(function (data) {\n for (var i = 0; i < data.length; i++) {\n if (data[i].Id == SecretService.listId) {\n data[i].active = true;\n }\n }\n $scope.todoLists = data;\n })\n .error(function(data) {\n console.log('Error: ' + data);\n });\n }", "function populateBasedOnFilter(response, arg){\n console.log(response)\n console.log(arg)\n\n // better way is to recieve hashmap with date key and object strings as value\n switch(arg) {\n case \"statements\":\n var i = 0;\n for(i = 0; i < response.length; i++){\n $('.activityList').append(\"<li class='statementItems'><div class='listChildren container-fluid'><div class='col-sm-1'><i class='fa fa-quote-right fa-3x' aria-hidden='true' style='color:#35a87c'></i></div><div class='col-sm-11'><p class='date'>\" + new Date(response[i]['date']).toDateString() + \"</p><p>\" + memberName + \" released a <a href=\" + response[i]['url'] + \" target='_blank'>statement</a> </p><p class='description'>\" + response[i]['title'] + \"</p></div></div></li>\") \n } \n break;\n case \"bills\":\n var i = 0;\n for(i = 0; i < response.length; i++){\n $('.activityList').append(\"<li class='billItems'><div class='listChildren container-fluid'><div class='col-sm-1'><i class='fa fa-file-text fa-3x' aria-hidden='true' style='color:#edbe40'></i></div><div class='col-sm-11'><p class='date'>\" + new Date(response[i]['latest_major_action_date']).toDateString() + \"</p><p><a href= \" + response[i]['congressdotgov_url'] + \" target='_blank'><strong>\" + response[i]['title'] + \"</strong></a></p><p class='description'>\" +response[i]['latest_major_action']+ \"</p></div></div></li>\") \n }\n break;\n case \"votes\":\n response = response[0]['votes']\n \n var i = 0;\n for(i = 0; i < response.length; i++){\n \n var motionResult = response[i]['result'].toLowerCase();\n var resText = \"Failed\"\n var iconColor = \"#db4818\"\n\n if(motionResult.includes('agreed')){\n resText = \"Passed\"\n }\n \n if(response[i]['position'].toLowerCase() == 'yes'){\n iconColor = \"#2add3f\"\n }\n \n $('.activityList').append(\"<li class='voteItems'><div class='listChildren container-fluid'><div class='col-sm-1'><i class='fa fa-check-circle fa-3x' aria-hidden='true' style='color:\" + iconColor + \"'></i></div><div class='col-sm-11'><p class='date'>\" + new Date(response[i]['date']).toDateString() + \"</p><p>\" + memberName + \" voted <span class=\" + response[i]['position'].toLowerCase() + \">\" + response[i]['position'].toLowerCase() + \"</span> on \" + response[i]['chamber'] + \" Vote \" + response[i]['roll_call'] + \"</p><p class='description'>\" + response[i]['description'] + \"</p><p>\" +response[i]['question']+ \": <span class= \" + resText.toLowerCase() + \">\" + resText + \"</span></p></div></div></li>\") \n }\n break;\n case \"twitter\":\n \n break;\n default:\n } \n }", "get lists() {\r\n return new Lists(this);\r\n }", "grabUserLoginsByList(data, mode = 'Lost') {\n let key = 'SpUserLogins_' + mode;\n return this.grabByIds({\n key: key,\n isByListOfIds: true,\n getTotalIdsCnt: () => data.totalIdsCnt,\n getListOfIds: () => data.listOfIds,\n getDataForIds: (ids) => null,\n fetch: (id) => this.provider.userIdToLogin({userId: id}),\n process: (id, obj) => this.processer.processUserIdToLogin(id, obj),\n });\n }", "getLists() {\n return db.query('SELECT * FROM lists ORDER BY id')\n }", "function getResultItems(res,type) {\r\n var data = {};\r\n switch(type) {\r\n case 'artist':\r\n data.items = res.artists.items;\r\n break;\r\n case 'playlist':\r\n data.items = res.playlists.items;\r\n break; \r\n }\r\n return data;\r\n }", "async function getAreasList() {\n const res = await axios.get(`${MD_BASE_URL}/list.php?a=list`);\n const areasList = res.data.meals.map(i => i.strArea);\n return areasList;\n }", "function buildRequestList () {\n\tlet order = [];\n\n\t// Check if the user is requesting to ascend any items.\n\tlet hasAscension = false;\n\tlet filteredAscensionItems = {};\n\tfor (let itemId in ascensionItems) {\n\t\tlet requestedAmount = ascensionItems[itemId];\n\t\tif (requestedAmount <= 0) {\n\t\t\tcontinue;\n\t\t} else {\n\t\t\thasAscension = true;\n\t\t\tfilteredAscensionItems[itemId] = requestedAmount;\n\t\t\tconsole.log(itemId, requestedAmount, filteredAscensionItems);\n\t\t}\n\t}\n\n\t// If so, then note that ascension is happening in the order.\n\tif (hasAscension) {\n\t\torder.push({\n\t\t\tid: 'ASCENSION',\n\t\t\tcheckoutItems: filteredAscensionItems\n\t\t});\n\t}\n\n\t// Check if the user has requested to buy any services.\n\tfor (let serviceId in checkoutItems) {\n\t\tlet requestedAmount = checkoutItems[serviceId];\n\t\tif (requestedAmount <= 0) {\n\t\t\tcontinue;\n\t\t} else {\n\t\t\torder.push({\n\t\t\t\tid: serviceId,\n\t\t\t\tamount: requestedAmount\n\t\t\t});\n\t\t}\n\t}\n\treturn order;\n}", "getGroupedBySession() {\n var map = {general:{items:[]}};\n for(var i = 0; i< this.list.length; i++) {\n if (this.list[i].sessionId) {\n if (!(this.list[i].sessionId in map)) {\n map[this.list[i].sessionId] = {items: []};\n }\n map[this.list[i].sessionId].items.push(this.list[i]);\n } else {\n map['general'].items.push(this.list[i]);\n }\n }\n return map;\n }", "function GetPkgByFacAndDate(factory, plnDate) {\n var list = [];\n if (!factory) return; //user must select the factory\n\n var config = ObjectConfigAjaxPost(\n \"/MesPkgIotMachineTimeDashboard/GetMesPkgByDate\",\n false,\n JSON.stringify({ factory: factory, date: plnDate })\n );\n\n AjaxPostCommon(config, function (lstPackage) {\n if (lstPackage && lstPackage.Result && lstPackage.Result.length > 0) {\n list = lstPackage.Result;\n //let plnStartDate = $(\"#beginDate\").val().replace(/\\//g, \"-\");\n //lstPackage.Result.map((item) => {\n // //after get list MES Package then get detail of MES Package\n // let el = getInfoDetailChart(item.MxPackage, plnStartDate);\n // if (el != null) {\n // list.push(el);\n // }\n //})\n }\n });\n\n return list;\n}", "getListItem(createdList, classInstance) {\n\n let results=classInstance.getListResults();\n\n let count=0;\n let timer=setInterval(function () {\n\n ++count;\n if (count === 2) {\n clearInterval(timer);\n }\n\n\n if (![undefined, 0].includes(results.length)) {\n\n\n for (let x = 0; x <= results.length; x++) {\n\n if (![undefined].includes(results[x])) {\n\n createdList.innerHTML = \" \";\n if (results[x].hasOwnProperty(0)) {\n results[x].forEach(function (results) {\n\n\n createdList.innerHTML+=\"<option class='listed'>\"+results.name+\"</option>\";\n\n\n })\n }\n\n\n }\n\n }\n\n\n }\n\n\n }, 1000);\n\n\n\n\n\n }", "function getData(search_param) {\n resourceRepo.getList(search_param).then(function success(response) {\n if (angular.isDefined(response.data.items)) {\n vm.itemsList = response.data.items;\n }\n }, function failure(response) {\n var t = response;\n })\n }", "function generatePartyList(par) {\n\t\tvar arr = [];\n\t\tfor (var i = 0; i < members.length; i++) {\n\t\t\tif (members[i].party === par) {\n\t\t\t\tarr.push(members[i]);\n\t\t\t}\n\t\t}\n\t\treturn arr;\n\t}", "function pick_list(lists) {\n return _.find(lists, function(list) {\n return _.includes(list['title'], 'webtask');\n });\n}", "static async getListings() {\n let res = await this.request(`listings`);\n return res.listings;\n }", "function getTasks() {\n console.log(\"Called: getTasks \");\n\n let result = [];\n let tempTasks = [];\n let value = this.state.compareRole.toLowerCase();\n\n result = this.state.roles.filter(function (data) {\n // return data.role.includes(value) !== -1;\n // return data._id.includes(\"60fdefe4d7bc2a0eb3c697dd\");\n return data.role.includes(value);\n });\n // console.log(\"Called: getTasks \", result);\n\n return result.map(function (currenttask) {\n // console.log(\"Tasks from getTasks\", currenttask.tasks);\n tempTasks = currenttask.tasks;\n\n return tempTasks.map((tasklist) => {\n // console.log(\"FROM getTasks: \", tasklist);\n return <li>{tasklist}</li>;\n });\n });\n }", "filterByStatus(status){\n let todosTemp = [];\n \n this.props.observer.filteredTodos.forEach(function (todo) {\n debugger;\n if(todo.props.isSelected){\n todosTemp.push(todo);\n }\n });\n \n return todosTemp; \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 }", "async function list(req, res) {\n const { date, mobile_number } = req.query;\n let data;\n if (date) {\n data = await service.listByDate(date);\n } else if (mobile_number) {\n data = await service.search(mobile_number);\n } else {\n data = await service.list();\n }\n res.json({ data });\n}", "static all () {\n return [{\n ids: ['CITY OF TAMPA'],\n name: 'City of Tampa',\n // address: '',\n phone: '8132748811',\n // fax: '',\n // email: '',\n website: 'https://www.tampagov.net/solid-waste/programs'\n },\n {\n ids: ['TEMPLE TERRACE'],\n name: 'City of Temple Terrace',\n // address: '',\n phone: '8135066570',\n // fax: '',\n email: '[email protected]',\n website: 'http://templeterrace.com/188/Sanitation/'\n },\n {\n ids: ['CITY OF PLANT CITY'],\n name: 'City of Plant City',\n address: '1802 Spooner Drive, Plant City, FL 33563',\n phone: '8137579208',\n fax: '8137579049',\n email: '[email protected]',\n website: 'https://www.plantcitygov.com/64/Solid-Waste'\n }]\n }", "filteredRequestList() {\n const fullname = (employee)=> employee.fname + \" \" + employee.lname;\n if(this.employeeFilter === 'all' && this.approvalFilter === 'all') {\n return this.expenses;\n }\n let filteredList = [];\n if(this.employeeFilter !== 'all' && this.approvalFilter === 'all') {\n //employeeId is unique and therefore the returned array should always be exactly one element\n const employee = this.employees\n .filter(emp=> emp.employeeId === this.employeeFilter)[0].fullname;\n filteredList = this.expenses.filter(expense=> fullname(expense.requestor) === employee);\n return filteredList;\n }\n if(this.employeeFilter === 'all' && this.approvalFilter !== 'all') {\n filteredList = this.expenses\n .filter(expense=> expense.approval == this.approvalFilter);\n return filteredList;\n }\n if(this.employeeFilter !== 'all' && this.approvalFilter !== 'all') {\n const employee = this.employees\n .filter(emp=> emp.employeeId === this.employeeFilter)[0].fullname;\n filteredList = this.expenses\n .filter(expense=> fullname(expense.requestor) === employee)\n .filter(expense=> expense.approval == this.approvalFilter);\n return filteredList;\n }\n }", "function getList(){\n\t\t// call ajax\n\t\tlet url = 'https://final-project-sekyunoh.herokuapp.com/get-user';\n\t\tfetch(url)\n\t\t.then(checkStatus)\n\t\t.then(function(responseText) {\n\t\t\tlet res = JSON.parse(responseText);\n\t\t\tlet people = res['people'];\n\t\t\tdisplayList(people);\n\t\t})\n\t\t.catch(function(error) {\n\t\t\t// show error\n\t\t\tdisplayError(error + ' while getting list');\n\t\t});\n\t}", "generateExerciseList() {\n this.generatedExerciseList = [];\n if (this.exerciseList) {\n for (let exercise in this.exerciseList) {\n if (this.exerciseList[exercise].subject === this.$scope.selectedSubject && this.exerciseList[exercise].subCategory === this.$scope.selectedSubCategory) {\n this.generatedExerciseList.push(this.exerciseList[exercise]);\n }\n }\n }\n }", "function loadDfctFields() {\n var request = $.ajax(\n 'https://hpalm.its.yale.edu/qcbin/rest/domains/' + jQuery.data(document.body, 'domain') + '/projects/' + jQuery.data(document.body, 'project') + '/customization/entities/defect/fields?required=true&alt=application/json', {\n dataType: \"json\"\n }\n ),\n chained = request.then(function (data) {\n listss = []\n ids = []\n $(jQuery.parseJSON(JSON.stringify(data))).each(function () {\n this.Field.forEach(function (item) {\n // Only get the non-system values\n if (item.System === false) {\n console.log(item.PhysicalName)\n console.log(item.Label)\n attrs = new Object;\n if (item.Type === \"LookupList\") {\n attrs.Name = item.Name\n ids.push(item[\"List-Id\"])\n attrs.id = item[\"List-Id\"]\n listss.push(attrs);\n }\n }\n });\n });\n\n return $.ajax(\"https://hpalm.its.yale.edu/qcbin/rest/domains/WATERFALL/projects/MAINT_CouncilOfMasters/customization/used-lists?alt=application/json\", {\n dataType: \"json\",\n data: {\n id: ids.join(\",\")\n }\n });\n });\n\n chained.done(function (data) {\n console.log(data);\n\n fields = []\n $(jQuery.parseJSON(JSON.stringify(data))).each(function () {\n this.lists.forEach(function (item) {\n vals = []\n item.Items.forEach(function (entry) {\n vals.push(entry.value);\n });\n\n // Push an object in for each list\n obj = {}\n // Need physical name\n obj.name = item.Name;\n\n //sconsole.log($.grep(listss, function(e){ return e.id === item.Id; })[0].physical_name);\n obj.phy_name = $.grep(listss, function (e) {\n return e.id === item.Id;\n })[0].Name;\n obj.is = vals;\n fields.push(obj);\n });\n //console.log(listss);\n //console.log(listss.filter(function (list) { return list.id == \"1320\" })[0].physical_name);\n });\n // Store the lists in local storage.\n localStorage.setItem(\"defectLists\", JSON.stringify(fields));\n });\n}", "getAllCurrentJobs() { \n return this.items.map(ele=>ele.element);\n }", "deliveries(){\n const deliveriesInNeighborhood = [];\n for(const delivery of store.deliveries){\n if(delivery.neighborhoodId === this.id){\n deliveriesInNeighborhood.push(delivery)\n }\n }\n return deliveriesInNeighborhood;\n }", "function loadAll() {\n return $scope.listData;\n\n var allStates = 'Alabama, Alaska, Arizona, Arkansas, California, Colorado, Connecticut, Delaware,\\\n Florida, Georgia, Hawaii, Idaho, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana,\\\n Maine, Maryland, Massachusetts, Michigan, Minnesota, Mississippi, Missouri, Montana,\\\n Nebraska, Nevada, New Hampshire, New Jersey, New Mexico, New York, North Carolina,\\\n North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina,\\\n South Dakota, Tennessee, Texas, Utah, Vermont, Virginia, Washington, West Virginia,\\\n Wisconsin, Wyoming';\n return allStates.split(/, +/g).map(function (state) {\n return {\n value: state.toLowerCase(),\n display: state\n };\n });\n\n\n // sh.each()\n\n\n }", "function fetchListings() {\n\treturn db.any('SELECT * FROM listings ORDER BY post_date DESC');\n}", "getCompiledList(jobClusterId) {\n let newList = [];\n\n return this._setList().then((clusterList) => {\n console.log(clusterList);\n if (typeof clusterList !== \"undefined\" && clusterList !== null && clusterList !== 403) {\n clusterList.forEach((cluster, i) => {\n const checkObj = {\n value: cluster.id,\n label: cluster.name,\n selected: false\n };\n if (jobClusterId !== null && jobClusterId == cluster.id) {\n checkObj.selected = true;\n }\n newList.push(checkObj);\n });\n\n return newList;\n } else {\n return Promise.resolve(clusterList);\n }\n\n });\n }", "function createBeerListFetches(){\n return [fetch('https://api.punkapi.com/v2/beers'), fetch('https://api.punkapi.com/v2/beers')] \n}", "generateGetAll() {\n\n }" ]
[ "0.6232334", "0.61338603", "0.61326045", "0.60422355", "0.5983285", "0.5833092", "0.58275867", "0.5807358", "0.57620746", "0.5690261", "0.5684759", "0.5680404", "0.56588656", "0.5641119", "0.563561", "0.56234515", "0.56033593", "0.55922544", "0.5586068", "0.55778646", "0.55279356", "0.55092055", "0.55092055", "0.5501233", "0.54858863", "0.54726845", "0.54726845", "0.5464716", "0.54615307", "0.5452872", "0.5447096", "0.54465234", "0.5442054", "0.5440973", "0.54341924", "0.54316056", "0.54301745", "0.5426391", "0.5416377", "0.541588", "0.5404231", "0.540192", "0.5401748", "0.53986996", "0.53948987", "0.53763366", "0.5375865", "0.5373522", "0.5366926", "0.5364369", "0.53634125", "0.53531206", "0.5349386", "0.53491414", "0.53488874", "0.5347324", "0.53436714", "0.53428406", "0.533814", "0.533814", "0.5335028", "0.5328877", "0.5324067", "0.53227705", "0.53227705", "0.53208077", "0.5315218", "0.5315016", "0.53095585", "0.5304203", "0.5298496", "0.5297687", "0.52965206", "0.52915376", "0.52888024", "0.52883226", "0.5285909", "0.5285354", "0.5281036", "0.5280848", "0.5280714", "0.5280448", "0.52705145", "0.52680725", "0.52674645", "0.52628005", "0.52610815", "0.5256619", "0.525421", "0.52528113", "0.52512056", "0.5249025", "0.5240555", "0.52379066", "0.52334887", "0.5232904", "0.5227191", "0.52263355", "0.5225041", "0.52192", "0.5217482" ]
0.0
-1
Computes all the neccessary variables for drawing a connection. Singleton.
function ConstraintSolver(){}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addConnection(){\n\n\n\t\t//draw horizontal part of connection spouses\n\t\tarrayConnections.push(new Connection2(arrayRelationship[0].begining_x_middle_horizontal, arrayRelationship[0].begining_y_middle_horizo1l, arrayRelationship[0].begining_x_middle_horizontal + SEPARATION, (arrayRelationship[0].begining_y_middle_horizo1l)));\n\t\tarrayConnections.push(new Connection2(arrayRelationship[3].begining_x_middle_horizontal, arrayRelationship[3].begining_y_middle_horizo1l, arrayRelationship[3].begining_x_middle_horizontal + SEPARATION, (arrayRelationship[3].begining_y_middle_horizo1l)));\n\t\tarrayConnections.push(new Connection2(arrayRelationship[5].begining_x_middle_horizontal, arrayRelationship[5].begining_y_middle_horizo1l, arrayRelationship[5].begining_x_middle_horizontal + SEPARATION, (arrayRelationship[5].begining_y_middle_horizo1l)));\n\t\tarrayConnections.push(new Connection2(arrayRelationship[9].begining_x_middle_horizontal, arrayRelationship[9].begining_y_middle_horizo1l, arrayRelationship[9].begining_x_middle_horizontal + SEPARATION, (arrayRelationship[9].begining_y_middle_horizo1l)));\n\t\tarrayConnections.push(new Connection2(arrayRelationship[10].begining_x_middle_horizontal, arrayRelationship[10].begining_y_middle_horizo1l, arrayRelationship[10].begining_x_middle_horizontal + SEPARATION, (arrayRelationship[10].begining_y_middle_horizo1l)));\n\t\tarrayConnections.push(new Connection2(arrayRelationship[18].begining_x_middle_horizontal, arrayRelationship[18].begining_y_middle_horizo1l, arrayRelationship[18].begining_x_middle_horizontal + SEPARATION, (arrayRelationship[18].begining_y_middle_horizo1l)));\t\n\t\tarrayConnections.push(new Connection2(arrayRelationship[13].begining_x_middle_horizontal, arrayRelationship[13].begining_y_middle_horizo1l, arrayRelationship[13].begining_x_middle_horizontal + SEPARATION, (arrayRelationship[13].begining_y_middle_horizo1l)));\n\t\tarrayConnections.push(new Connection2(arrayRelationship[14].begining_x_middle_horizontal, arrayRelationship[14].begining_y_middle_horizo1l, arrayRelationship[14].begining_x_middle_horizontal + SEPARATION, (arrayRelationship[14].begining_y_middle_horizo1l)));\n\t\tarrayConnections.push(new Connection2(arrayRelationship[15].begining_x_middle_horizontal, arrayRelationship[15].begining_y_middle_horizo1l, arrayRelationship[15].begining_x_middle_horizontal + SEPARATION, (arrayRelationship[15].begining_y_middle_horizo1l)));\n\t\tarrayConnections.push(new Connection2(arrayRelationship[17].begining_x_middle_horizontal, arrayRelationship[17].begining_y_middle_horizo1l, arrayRelationship[17].begining_x_middle_horizontal + SEPARATION, (arrayRelationship[17].begining_y_middle_horizo1l)));\n\t\tarrayConnections.push(new Connection2(arrayRelationship[3].begining_x_middle_horizontal, arrayRelationship[3].begining_y_middle_horizo1l, arrayRelationship[3].begining_x_middle_horizontal + SEPARATION, (arrayRelationship[3].begining_y_middle_horizo1l)));\n\t\tarrayConnections.push(new Connection2(arrayRelationship[5].begining_x_middle_horizontal, arrayRelationship[5].begining_y_middle_horizo1l, arrayRelationship[5].begining_x_middle_horizontal + SEPARATION, (arrayRelationship[5].begining_y_middle_horizo1l)));\n\t\n\n\t\t \n\t\t //draw vertical part of connection for siblings\n\t\t arrayConnections.push(new Connection2(arrayRelationship[5].begining_x_middle_vertical, arrayRelationship[5].drawY, arrayRelationship[5].begining_x_middle_vertical, (arrayRelationship[5].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[4].begining_x_middle_vertical, arrayRelationship[4].drawY, arrayRelationship[4].begining_x_middle_vertical, (arrayRelationship[4].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[6].begining_x_middle_vertical, arrayRelationship[6].drawY, arrayRelationship[6].begining_x_middle_vertical, (arrayRelationship[6].drawY -30)));\n\t\t //arrayConnections.push(new Connection2(arrayRelationship[8].begining_x_middle_vertical, arrayRelationship[8].drawY, arrayRelationship[8].begining_x_middle_vertical, (arrayRelationship[8].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[7].begining_x_middle_vertical, arrayRelationship[7].drawY, arrayRelationship[7].begining_x_middle_vertical, (arrayRelationship[7].drawY -30)));\n\n\t\t arrayConnections.push(new Connection2(arrayRelationship[11].begining_x_middle_vertical, arrayRelationship[11].drawY, arrayRelationship[11].begining_x_middle_vertical, (arrayRelationship[11].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[12].begining_x_middle_vertical, arrayRelationship[12].drawY, arrayRelationship[12].begining_x_middle_vertical, (arrayRelationship[12].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[13].begining_x_middle_vertical, arrayRelationship[13].drawY, arrayRelationship[13].begining_x_middle_vertical, (arrayRelationship[13].drawY -30)));\n\t\t //arrayConnections.push(new Connection2(arrayRelationship[8].begining_x_middle_vertical, arrayRelationship[8].drawY, arrayRelationship[8].begining_x_middle_vertical, (arrayRelationship[8].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[14].begining_x_middle_vertical, arrayRelationship[14].drawY, arrayRelationship[14].begining_x_middle_vertical, (arrayRelationship[14].drawY -30)));\t\t \n\n\t\t arrayConnections.push(new Connection2(arrayRelationship[15].begining_x_middle_vertical, arrayRelationship[15].drawY, arrayRelationship[15].begining_x_middle_vertical, (arrayRelationship[15].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[16].begining_x_middle_vertical, arrayRelationship[16].drawY, arrayRelationship[16].begining_x_middle_vertical, (arrayRelationship[16].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[17].begining_x_middle_vertical, arrayRelationship[17].drawY, arrayRelationship[17].begining_x_middle_vertical, (arrayRelationship[17].drawY -30)));\n\t\t //arrayConnections.push(new Connection2(arrayRelationship[8].begining_x_middle_vertical, arrayRelationship[8].drawY, arrayRelationship[8].begining_x_middle_vertical, (arrayRelationship[8].drawY -30)));\n\t\t //arrayConnections.push(new Connection2(arrayRelationship[23].begining_x_middle_vertical, arrayRelationship[23].drawY, arrayRelationship[23].begining_x_middle_vertical, (arrayRelationship[23].drawY -30)));\n\n\t\t //arrayConnections.push(new Connection2(arrayRelationship[24].begining_x_middle_vertical, arrayRelationship[24].drawY, arrayRelationship[24].begining_x_middle_vertical, (arrayRelationship[24].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[25].begining_x_middle_vertical, arrayRelationship[25].drawY, arrayRelationship[25].begining_x_middle_vertical, (arrayRelationship[25].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[26].begining_x_middle_vertical, arrayRelationship[26].drawY, arrayRelationship[26].begining_x_middle_vertical, (arrayRelationship[26].drawY -30)));\n\t\t //arrayConnections.push(new Connection2(arrayRelationship[8].begining_x_middle_vertical, arrayRelationship[8].drawY, arrayRelationship[8].begining_x_middle_vertical, (arrayRelationship[8].drawY -30)));\n\t\t// arrayConnections.push(new Connection2(arrayRelationship[27].begining_x_middle_vertical, arrayRelationship[27].drawY, arrayRelationship[27].begining_x_middle_vertical, (arrayRelationship[27].drawY -30)));\t\t \n\n\n\n\t\t arrayConnections.push(new Connection2(arrayRelationship[28].begining_x_middle_vertical, arrayRelationship[28].drawY, arrayRelationship[28].begining_x_middle_vertical, (arrayRelationship[28].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[29].begining_x_middle_vertical, arrayRelationship[29].drawY, arrayRelationship[29].begining_x_middle_vertical, (arrayRelationship[29].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[30].begining_x_middle_vertical, arrayRelationship[30].drawY, arrayRelationship[30].begining_x_middle_vertical, (arrayRelationship[30].drawY -30)));\n\n\n\t\t//draw horizontal connections for siblings\n\t\t arrayConnections.push(new Connection2(arrayRelationship[4].begining_x_middle_vertical, arrayRelationship[7].drawY -30, arrayRelationship[7].begining_x_middle_vertical, (arrayRelationship[7].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[11].begining_x_middle_vertical, arrayRelationship[12].drawY -30, arrayRelationship[12].begining_x_middle_vertical, (arrayRelationship[12].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[13].begining_x_middle_vertical, arrayRelationship[15].drawY -30, arrayRelationship[15].begining_x_middle_vertical, (arrayRelationship[15].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[16].begining_x_middle_vertical, arrayRelationship[17].drawY -30, arrayRelationship[17].begining_x_middle_vertical, (arrayRelationship[17].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[25].begining_x_middle_vertical, arrayRelationship[26].drawY -30, arrayRelationship[26].begining_x_middle_vertical, (arrayRelationship[26].drawY -30)));\n\t\t arrayConnections.push(new Connection2(arrayRelationship[28].begining_x_middle_vertical, arrayRelationship[30].drawY -30, arrayRelationship[30].begining_x_middle_vertical, (arrayRelationship[30].drawY -30)));\n\n\t\t//draw vertical part of connection FOR SPOUSES\n\t\tarrayConnections.push(new Connection2((arrayRelationship[0].begining_x_middle_horizontal+(SEPARATION)/2), arrayRelationship[0].begining_y_middle_horizo1l, (arrayRelationship[0].begining_x_middle_horizontal+(SEPARATION)/2), (arrayRelationship[2].drawY)));\n\t\tarrayConnections.push(new Connection2((arrayRelationship[3].begining_x_middle_horizontal+(SEPARATION)/2), arrayRelationship[3].begining_y_middle_horizo1l, (arrayRelationship[3].begining_x_middle_horizontal+(SEPARATION)/2), (arrayRelationship[5].drawY -30)));\n\t\t//THIS IS THE EXEPTION\n\t\tarrayConnections.push(new Connection2((arrayRelationship[5].begining_x_middle_horizontal+(SEPARATION)/2), arrayRelationship[5].begining_y_middle_horizo1l, (arrayRelationship[5].begining_x_middle_horizontal+(SEPARATION)/2), (arrayRelationship[11].drawY -90)));\n\t\t\t\tarrayConnections.push(new Connection2((arrayRelationship[5].begining_x_middle_horizontal+(SEPARATION)/2), (arrayRelationship[11].drawY -90),arrayRelationship[11].begining_x_middle_vertical+80, arrayRelationship[12].drawY -30));\n\t\t\n\t\tarrayConnections.push(new Connection2((arrayRelationship[9].begining_x_middle_horizontal+(SEPARATION)/2), arrayRelationship[9].begining_y_middle_horizo1l, (arrayRelationship[9].begining_x_middle_horizontal+(SEPARATION)/2), (arrayRelationship[13].drawY -30)));\n\t\t\n\t\t//THIS IS AN EXEPTION\n\t\tarrayConnections.push(new Connection2((arrayRelationship[10].begining_x_middle_horizontal+(SEPARATION)/2), arrayRelationship[10].begining_y_middle_horizo1l, (arrayRelationship[10].begining_x_middle_horizontal+(SEPARATION)/2), (arrayRelationship[16].drawY -90)));\n\t\t\t\tarrayConnections.push(new Connection2((arrayRelationship[10].begining_x_middle_horizontal+(SEPARATION)/2), (arrayRelationship[16].drawY -90),arrayRelationship[16].begining_x_middle_vertical+80, arrayRelationship[17].drawY -30));\n\t\t\t\t\n\t\t\n\t\tarrayConnections.push(new Connection2((arrayRelationship[17].begining_x_middle_horizontal+(SEPARATION)/2), arrayRelationship[17].begining_y_middle_horizo1l, (arrayRelationship[17].begining_x_middle_horizontal+(SEPARATION)/2), (arrayRelationship[28].drawY -30)));\n\t\tarrayConnections.push(new Connection2((arrayRelationship[15].begining_x_middle_horizontal+(SEPARATION)/2), arrayRelationship[15].begining_y_middle_horizo1l, (arrayRelationship[15].begining_x_middle_horizontal+(SEPARATION)/2), (arrayRelationship[27].drawY)));\n\t\tarrayConnections.push(new Connection2((arrayRelationship[18].begining_x_middle_horizontal+(SEPARATION)/2), arrayRelationship[18].begining_y_middle_horizo1l, (arrayRelationship[18].begining_x_middle_horizontal+(SEPARATION)/2), (arrayRelationship[23].drawY)));\n\t\tarrayConnections.push(new Connection2((arrayRelationship[13].begining_x_middle_horizontal+(SEPARATION)/2), arrayRelationship[13].begining_y_middle_horizo1l, (arrayRelationship[13].begining_x_middle_horizontal+(SEPARATION)/2), (arrayRelationship[24].drawY)));\n\t\tarrayConnections.push(new Connection2((arrayRelationship[14].begining_x_middle_horizontal+(SEPARATION)/2), arrayRelationship[14].begining_y_middle_horizo1l, (arrayRelationship[14].begining_x_middle_horizontal+(SEPARATION)/2), (arrayRelationship[25].drawY-30)));\n\t\n\t\t\t\t\t\n}", "drawConnections (ctx) {\n let now = LiteGraph.getTime();\n\n //draw connections\n ctx.lineWidth = this.d_connections_width;\n\n ctx.fillStyle = \"#AAA\";\n ctx.strokeStyle = \"#AAA\";\n ctx.globalAlpha = this.d_editor_alpha;\n //for every node\n for (let n = 0, l = this.d_graph.d_nodes.length; n < l; ++n) {\n let node = this.d_graph.d_nodes[n];\n //for every input (we render just inputs because it is easier as every slot can only have one input)\n if (node.inputs && node.inputs.length)\n for (let i = 0; i < node.inputs.length; ++i) {\n let input = node.inputs[i];\n if (!input || input.link == null)\n continue;\n let link_id = input.link;\n let link = this.d_graph.d_links[link_id];\n if (!link)\n continue;\n\n let start_node = this.d_graph.getNodeById(link.origin_id);\n if (start_node == null) continue;\n let start_node_slot = link.origin_slot;\n let start_node_slotpos = null;\n\n if (start_node_slot == -1)\n start_node_slotpos = [start_node.pos[0] + 10, start_node.pos[1] + 10];\n else\n start_node_slotpos = start_node.getConnectionPos(false, start_node_slot);\n\n let color = LGraphCanvas.link_type_colors[node.inputs[i].type] || this.d_efault_link_color;\n\n this.d_renderLink(ctx, start_node_slotpos, node.getConnectionPos(true, i), color);\n\n if (link && link._last_time && now - link._last_time < 1000) {\n let f = 2.0 - (now - link._last_time) * 0.002;\n let color = \"rgba(255,255,255, \" + f.toFixed(2) + \")\";\n this.d_renderLink(ctx, start_node_slotpos, node.getConnectionPos(true, i), color, true, f);\n }\n }\n }\n ctx.globalAlpha = 1;\n }", "function allocateConnection() {\n\t\tif (document.getElementById(this.id) != null) {\n\t\t\tdocument.getElementById(MAP).removeChild(document.getElementById(this.id));\n\t\t}\n\t\tthis.points = this.originX + \",\" + this.originY + \" \";\n\t\tif (this.middlePoint == LEFT_CORNER) {\n\t\t\tvar x = Math.min(this.originX, this.destinationX);\n\t\t\tvar y = x == this.originX ? this.destinationY : this.originY;\n\t\t\tthis.points += x + \",\" + y + \" \";\n\t\t} else if (this.middlePoint == RIGHT_CORNER) {\n\t\t\tvar x = Math.max(this.originX, this.destinationX);\n\t\t\tvar y = x == this.originX ? this.destinationY : this.originY;\n\t\t\tthis.points += x + \",\" + y + \" \";\n\t\t}\n\t\tthis.points += this.destinationX + \",\" + this.destinationY;\n\t\tthis.write();\n\t}", "function Connection(port1, port2) {\n\t\tif (port1.ne.id > port2.ne.id) {\n\t\t\tthis.originPort = port2;\n\t\t\tthis.destinationPort = port1;\n\t\t} else {\n\t\t\tthis.originPort = port1;\n\t\t\tthis.destinationPort = port2;\n\t\t}\n\t\tthis.originPort.setConnection(this);\n\t\tthis.destinationPort.setConnection(this);\n\t\tthis.originX = null;\n\t\tthis.originY = null;\n\t\tthis.destinationX = null;\n\t\tthis.destinationY = null;\n\t\tthis.color = \"#003366\";\n\t\tthis.weight = 1;\n\t\tthis.points = null;\n\t\tthis.middlePoint = null;\n\t\tthis.onClickAction = null;\n\t\tthis.popupListItems = new List();\n\t\tthis.id = CONNECTION + connectionsCounter++;\n\t\tthis.allocateOrigin = allocateOrigin;\n\t\tthis.allocateDestination = allocateDestination;\n\t\tthis.allocate = allocateConnection;\n\t\tthis.setMiddlePoint = setConnectionMiddlePoint;\n\t\tthis.write = writeConnection;\n\t\tthis.setColor = setConnectionColor;\n\t\tthis.setWeight = setConnectionWeight;\n\t\tthis.setClickAction = setConnectionClickAction;\n\t\tthis.addPopupListItem = addConnectionPopupListItem;\n\t\tthis.showPopupMenuAt = showConnectionPopupMenu;\n\t\tthis.updatePopupMenu = updateConnectionPopupMenu;\n\t\tthis.executeAction = executeActionOnRightClickedConnection;\n\t\tthis.remove = removeConnection;\n\t\tthis.addPopupListItem(null, \"Angle to the left\", LEFT_CORNER);\n\t\tthis.addPopupListItem(null, \"Angle to the right\", RIGHT_CORNER);\n\t}", "draw(){\n var canvas = document.getElementById(\"myCanvas\");\n var ctx = canvas.getContext(\"2d\");\n\n\n var cur = this.lines[0];\n var next = this.lines[1];\n var wire = this.find_second_wire_connect(cur, next);\n\n ctx.beginPath();\n ctx.moveTo(wire.startx, wire.starty);\n ctx.lineTo(wire.endx, wire.endy);\n ctx.stroke();\n\n for(var i = 1; i < this.lines.length-1; i++){\n // ctx.beginPath();\n // ctx.rect(this.lines[i].posx*cell_size[0], this.lines[i].posy*cell_size[1], cell_size[0], cell_size[1]);\n // ctx.stroke();\n\n var prev = this.lines[i-1];\n var cur = this.lines[i];\n var next = this.lines[i+1];\n var wire = this.find_first_wire_connect(prev, cur);\n\n ctx.beginPath();\n ctx.moveTo(wire.startx, wire.starty);\n ctx.lineTo(wire.endx, wire.endy);\n ctx.stroke();\n\n wire = this.find_second_wire_connect(cur, next);\n\n ctx.beginPath();\n ctx.moveTo(wire.startx, wire.starty);\n ctx.lineTo(wire.endx, wire.endy);\n ctx.stroke();\n\n if(cur.elem == \"vertical_resistor\"){\n\n var startx = cur.posx*cell_size[0]+cell_size[0]/4;\n var starty = cur.posy*cell_size[1]+cell_size[1]/8;\n var sizex = cell_size[0]*2/4;\n var sizey = cell_size[1]*6/8;\n\n ctx.strokeStyle = \"#000000\";\n ctx.fillStyle = \"#FFFFFF\";\n ctx.fillRect(startx, starty, sizex, sizey);\n ctx.strokeRect(startx, starty, sizex, sizey);\n // ctx.stroke();\n }\n if(cur.elem == \"horizonzal_resistor\"){\n\n var startx = cur.posx*cell_size[0]+cell_size[0]/8;\n var starty = cur.posy*cell_size[1]+cell_size[1]/4;\n var sizex = cell_size[0]*6/8;\n var sizey = cell_size[1]*2/4;\n\n ctx.strokeStyle = \"#000000\";\n ctx.fillStyle = \"#FFFFFF\";\n ctx.fillRect(startx, starty, sizex, sizey);\n ctx.strokeRect(startx, starty, sizex, sizey);\n // ctx.stroke();\n }\n if(cur.elem == \"vertical_capacitor\"){\n\n var startx = cur.posx*cell_size[0]+cell_size[0]/8;\n var starty = cur.posy*cell_size[1]+cell_size[1]/4;\n var sizex = cell_size[0]*6/8;\n var sizey = cell_size[1]*2/4;\n\n ctx.strokeStyle = \"#000000\";\n ctx.fillStyle = \"#FFFFFF\";\n ctx.strokeRect(startx, starty, sizex, sizey);\n ctx.fillRect(startx-1, starty, sizex+2, sizey);\n // ctx.stroke();\n }\n if(cur.elem == \"horizontal_capacitor\"){\n\n var startx = cur.posx*cell_size[0]+cell_size[0]/4;\n var starty = cur.posy*cell_size[1]+cell_size[1]/8;\n var sizex = cell_size[0]*2/4;\n var sizey = cell_size[1]*6/8;\n\n ctx.strokeStyle = \"#000000\";\n ctx.fillStyle = \"#FFFFFF\";\n ctx.strokeRect(startx, starty, sizex, sizey);\n ctx.fillRect(startx, starty-1, sizex, sizey+2);\n // ctx.stroke();\n }\n if(cur.elem == \"right_diode\"){\n\n var startx = cur.posx*cell_size[0]+cell_size[0]*1/8;\n var starty = cur.posy*cell_size[1]+cell_size[1]*1/8;\n var sizex = cell_size[0]*5/8;\n var sizey = cell_size[1]*5/8;\n\n ctx.strokeStyle = \"#000000\";\n ctx.fillStyle = \"#FFFFFF\";\n ctx.fillRect(startx, starty, sizex, sizey);\n\n ctx.beginPath();\n ctx.moveTo(cur.posx*cell_size[0]+cell_size[0]/8, cur.posy*cell_size[1]+cell_size[1]/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]/8, cur.posy*cell_size[1]+cell_size[1]*7/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]*6/8, cur.posy*cell_size[1]+cell_size[1]*4/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]/8, cur.posy*cell_size[1]+cell_size[1]/8);\n ctx.moveTo(cur.posx*cell_size[0]+cell_size[0]*6/8, cur.posy*cell_size[1]+cell_size[1]*1/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]*6/8, cur.posy*cell_size[1]+cell_size[1]*7/8);\n ctx.stroke();\n }\n if(cur.elem == \"left_diode\"){\n var startx = cur.posx*cell_size[0]+cell_size[0]*2/8;\n var starty = cur.posy*cell_size[1]+cell_size[1]*2/8;\n var sizex = cell_size[0]*5/8;\n var sizey = cell_size[1]*5/8;\n\n ctx.strokeStyle = \"#000000\";\n ctx.fillStyle = \"#FFFFFF\";\n ctx.fillRect(startx, starty, sizex, sizey);\n\n ctx.beginPath();\n ctx.moveTo(cur.posx*cell_size[0]+cell_size[0]*7/8, cur.posy*cell_size[1]+cell_size[1]/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]*7/8, cur.posy*cell_size[1]+cell_size[1]*7/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]*2/8, cur.posy*cell_size[1]+cell_size[1]*4/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]*7/8, cur.posy*cell_size[1]+cell_size[1]/8);\n ctx.moveTo(cur.posx*cell_size[0]+cell_size[0]*2/8, cur.posy*cell_size[1]+cell_size[1]*1/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]*2/8, cur.posy*cell_size[1]+cell_size[1]*7/8);\n ctx.stroke();\n }\n if(cur.elem == \"down_diode\" ){\n var startx = cur.posx*cell_size[0]+cell_size[0]/8;\n var starty = cur.posy*cell_size[1]+cell_size[1]/8;\n var sizex = cell_size[0]*5/8;\n var sizey = cell_size[1]*5/8;\n\n ctx.strokeStyle = \"#000000\";\n ctx.fillStyle = \"#FFFFFF\";\n ctx.fillRect(startx, starty, sizex, sizey);\n\n ctx.beginPath();\n ctx.moveTo(cur.posx*cell_size[0]+cell_size[0]/8, cur.posy*cell_size[1]+cell_size[1]/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]*7/8, cur.posy*cell_size[1]+cell_size[1]/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]*4/8, cur.posy*cell_size[1]+cell_size[1]*6/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]/8, cur.posy*cell_size[1]+cell_size[1]/8);\n ctx.moveTo(cur.posx*cell_size[0]+cell_size[0]*1/8, cur.posy*cell_size[1]+cell_size[1]*6/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]*7/8, cur.posy*cell_size[1]+cell_size[1]*6/8);\n ctx.stroke();\n }\n if(cur.elem == \"up_diode\"){\n var startx = cur.posx*cell_size[0]+cell_size[0]*2/8;\n var starty = cur.posy*cell_size[1]+cell_size[1]*2/8;\n var sizex = cell_size[0]*5/8;\n var sizey = cell_size[1]*5/8;\n\n ctx.strokeStyle = \"#000000\";\n ctx.fillStyle = \"#FFFFFF\";\n ctx.fillRect(startx, starty, sizex, sizey);\n\n ctx.beginPath();\n ctx.moveTo(cur.posx*cell_size[0]+cell_size[0]/8, cur.posy*cell_size[1]+cell_size[1]*7/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]*7/8, cur.posy*cell_size[1]+cell_size[1]*7/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]*4/8, cur.posy*cell_size[1]+cell_size[1]*2/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]/8, cur.posy*cell_size[1]+cell_size[1]*7/8);\n ctx.moveTo(cur.posx*cell_size[0]+cell_size[0]*1/8, cur.posy*cell_size[1]+cell_size[1]*2/8);\n ctx.lineTo(cur.posx*cell_size[0]+cell_size[0]*7/8, cur.posy*cell_size[1]+cell_size[1]*2/8);\n ctx.stroke();\n }\n\n }\n\n var prev = this.lines[this.lines.length-2];\n var cur = this.lines[this.lines.length-1];\n var wire = this.find_first_wire_connect(prev, cur);\n\n ctx.beginPath();\n ctx.moveTo(wire.startx, wire.starty);\n ctx.lineTo(wire.endx, wire.endy);\n ctx.stroke();\n }", "function drawConnections(connections, paper){\n for(x in connections){\n line = connections[x];\n paper.line(line.startX, line.startY, line.endX, line.endY,4, line.gPassId);\n }\n}", "function Connection(object1, x1, y1, object2, x2, y2) {\n this.obj1 = object1;\n this.obj1x = x1;\n this.obj1y = y1;\n this.obj2 = object2;\n this.obj2x = x2;\n this.obj2y = y2\n}", "render() { \n const connectionHorizontalPad = 2\n const connectionVerticalPad = 2\n const maxRows = Math.ceil(Math.sqrt(this.props.maxConns)), \n maxCols = maxRows;\n const centreX = this.props.x + Endpoint.epWidth / 2\n\n const connections = this.state.connections.map((connection,idx) => {\n\n const firstX = (maxRows % 2) === 0 ?\n centreX - ((maxRows/2) * (ConnDimensions() + connectionHorizontalPad)) :\n centreX - ((Math.floor(maxRows / 2) * ConnDimensions()) + (ConnDimensions() * 0.5) + ((maxRows -1) * connectionHorizontalPad));\n\n const x = firstX + ((idx % maxCols) * (ConnDimensions() + connectionHorizontalPad))\n const rowIdx = Math.floor(idx/maxRows) % maxRows\n const y = this.props.y + 183 + (rowIdx * ConnDimensions()) + (rowIdx * connectionVerticalPad)\n const isOn = (idx+1) <= this.props.numConns ? true : false\n return <Connection x={x} y={y} on={isOn} key={idx}/>\n }); \n\n const textYOffset = this.props.y + Endpoint.epHeight - 33\n const textXOffset = centreX - 32 \n\n return (\n <g id={\"Connections-\" + this.props.epid}>\n <text x={textXOffset} y={textYOffset} textAnchor=\"start\" fontSize=\"0.7em\">Connections</text>\n {connections}\n </g>\n );\n }", "display(){\n //Sets the fill color to this.color\n ctx.fillStyle = this.color;\n //Starts drawing the border with a line width of 5\n ctx.beginPath();\n ctx.lineWidth = 5;\n //Draws a blue line from the first corner to the last\n ctx.moveTo(this.borders[0],this.borders[1]);\n\n for (var i = 2; i < (this.borders.length); i += 2){\n ctx.lineTo(this.borders[i],this.borders[i+1]);\n }\n //Closes the room by drawing from the last corner to the first\n ctx.lineTo(this.borders[0],this.borders[1]);\n //Sets the line color to blue\n ctx.strokeStyle = \"blue\";\n ctx.stroke();\n //fills in the borders with this.color\n ctx.fill();\n\n }", "function Drawing(){\n\n\tthis.header={\n\t\t$INSBASE:{x:0,y:0,z:0},\n\t\t$EXTMIN:{x:0,y:0,z:0},\n\t\t$EXTMAX:{x:10,y:10,z:0}\n\t};\n\tthis.tables={\n\t\tlinetype:{\n\t\t\tContinuous:{\n name: \"Continuous\",\n description: \"Solid line\",\n patternLength: 0\n },\n HIDDEN2: {\n name: \"HIDDEN2\",\n description: \"Hidden (.5x) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\",\n pattern:[0.125, -0.0625],\n patternLength: 0.1875\n }\n\t\t},\n\t\tlayer:{\n\t\t\thandle: \"2\",\n\t\t\townerHandle: \"0\",\n\t\t\tlayers: {\n\t\t\t\t\"0\":{Name:\"0\", Visible:true, color:16711680},\n\t\t\t\t\"A-WALL\":{Name:\"0\", Visible:true, color:16711680}\n\t\t\t}\t\t\n\t\t}\n\t};\n\tthis.blocks={};\n\tthis.entities=[\n\t\tline.create(this)\n\t\t//new line.Line(this)\n\t];\t\n}", "function updateGraphics() {\n ui.cellColorAlive = $(\"input[name=colorAliveCellHexagon]\").val();\n ui.cellColorDead = $(\"input[name=colorDeadCellHexagon]\").val();\n ui.cellColorStroke = $(\"input[name=colorOutlineHexagon\").val(); \n ui.draw();\n }", "function handleSocketConnect()\n{\n setPanelStatus(\"Panel Ready\");\n \n var panelBackground = svgDocument.getElementById(\"panelBackground\");\n if(panelBackground != null)\n {\n setStyleSubAttribute(panelBackground, \"fill\", connectedBackgroundColor);\n }\n \n // Now that we are connected, try to update all objects from the server\n updateAllObjectsFromServer();\n}", "init() {\n let pixelRatio = SmartCanvas.pixelRatio;\n\n this.element.width = this.width * pixelRatio;\n this.element.height = this.height * pixelRatio;\n\n this.element.style.width = this.width + 'px';\n this.element.style.height = this.height + 'px';\n\n /**\n * Canvas caching element\n *\n * @type {HTMLCanvasElement|Node}\n */\n this.elementClone = this.element.cloneNode(true);\n\n //noinspection JSUnresolvedVariable\n /**\n * Target drawings canvas element 2D context\n *\n * @type {CanvasRenderingContext2D}\n */\n this.context = this.element.getContext('2d');\n\n /**\n * Canvas caching element 2D context\n *\n * @type {CanvasRenderingContext2D}\n */\n this.contextClone = this.elementClone.getContext('2d');\n\n /**\n * Actual drawings width\n *\n * @type {number}\n */\n this.drawWidth = this.element.width;\n\n /**\n * Actual drawings height\n *\n * @type {number}\n */\n this.drawHeight = this.element.height;\n\n /**\n * X-coordinate of drawings zero point\n *\n * @type {number}\n */\n this.drawX = this.drawWidth / 2;\n\n /**\n * Y-coordinate of drawings zero point\n *\n * @type {number}\n */\n this.drawY = this.drawHeight / 2;\n\n /**\n * Minimal side length in pixels of the drawing\n *\n * @type {number}\n */\n this.minSide = this.drawX < this.drawY ? this.drawX : this.drawY;\n\n this.elementClone.initialized = false;\n\n this.contextClone.translate(this.drawX, this.drawY);\n this.contextClone.save();\n\n this.context.translate(this.drawX, this.drawY);\n this.context.save();\n\n this.context.max = this.contextClone.max = this.minSide;\n this.context.maxRadius = this.contextClone.maxRadius = null;\n }", "function setup() {\n createCanvas(800, 600);\n\n // this happens later:\n socket.on('donut', function(data) {\n console.log(data);\n fill(data.red, data.green, data.blue)\n background(255-data.red, 255-data.green, 255-data.blue);\n });\n\n\n }", "drawConnections({ x, y, value, ctx }) {\n // if gate that is feeding into this one\n // is 1 (true), color it red\n if (value) {\n ctx.strokeStyle = \"red\";\n } else {\n ctx.strokeStyle = \"#000\";\n }\n let halfway = (this.inputLocation.x + x) / 2;\n ctx.beginPath();\n ctx.moveTo(this.inputLocation.x, this.inputLocation.y);\n ctx.lineTo(halfway, this.inputLocation.y);\n ctx.lineTo(halfway, y);\n ctx.lineTo(x, y);\n ctx.stroke();\n }", "draw() {\n var p = window.p;\n\n let col= this.col ? this.p.color(this.col.r, this.col.g , this.col.b) : this.p.color(255,255,255);\n\n //we draw line\n this.p.stroke(col); //it's for campability with old clients\n this.p.strokeWeight(this.sw);\n this.p.line(this.a.x, this.a.y, this.b.x, this.b.y);\n\n }", "constructor() {\n this.__redrawBinded = this.redraw.bind(this);\n this.__cursorUpdatedHandler = () => { this.redraw() };\n this.__renderBinded = this.render.bind(this);\n }", "draw(){\n noStroke();\n if(this.getHover() || this.getSelected()){\n fill(BLUE_5); //needs a constant\n }\n else{\n fill(this.col);\n }\n \n push();\n beginShape(); //CCW\n vertex(this.getX() - (this.w)/2.0, this.getY() + (this.h)/2.0); //top left\n vertex(this.getX() - (this.w)/2.0, this.getY() - (this.h)/2.0);\n vertex(this.getX() + (this.w)/2.0, this.getY() - (this.h)/2.0);\n vertex(this.getX() + (this.w)/2.0, this.getY() + (this.h)/2.0);\n\n endShape(CLOSE);\n pop();\n }", "function setup() {\r\n\tcreateCanvases();\r\n\r\n\t//handle messages\r\n\t/*\r\n\t*\treceive Objects from Server\r\n\t*/\r\n\tsocket.on('receiveObj', function (obj, username, filename) {\r\n\t\tdrawObject(obj);\r\n\t\tcurrentFile.drawObjects.push(obj);\r\n\t\t//displays username on mousex and mousey from obj and fadeOut after 3000\r\n\t\tif (filename == fileName) {\r\n\t\t\t$(\"#foreground\").html(username);\r\n\t\t\t$(\"#foreground\").css({ 'top': obj.y, 'left': obj.x, 'background-color': 'moccasin', 'padding': '5px' }).fadeIn('fast');\r\n\t\t\t$(\"#foreground\").delay(3000).fadeOut();\r\n\t\t}\r\n\t}\r\n\t);\r\n\r\n\t/*\r\n\t*\treceive clear command from server\r\n\t*/\r\n\tsocket.on('clear',\r\n\t\tfunction (fileName) {\r\n\t\t\tclearCanvas();\r\n\t\t\t$(\"#foreground\").html(\"\");\r\n\t\t\t$(\"#foreground\").css({ 'display': 'none' });\r\n\t\t\twindow.location.href = \"/drawPadLoad\";\r\n\t\t}\r\n\t);\r\n\r\n\tupdateUserList();\r\n\tdrawObjects(data); // replaces parseAndDrawString();\r\n\r\n\t/*\r\n\t* appendUser to #containerInfoRight\r\n\t*/\r\n\tsocket.on('appUpdateUsers', function (users, username, fileName) {\r\n\t\tusersConnected = users;\r\n\t\t$(\"#containerInfoRight\").html(\"Online sind: \");\r\n\r\n\t\tfor (var i = 0; i < usersConnected.length; i++) {\r\n\t\t\tif (usersConnected[i].mindMapValue002 == fileName) {\r\n\t\t\t\t$(\"#containerInfoRight\").append(\"<font style='color:\" + usersConnected[i].usercolor + \";'>\" + usersConnected[i].username + \"</font> \");\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (usersConnected.length <= 1) {\r\n\t\t\tsaveFile(fileName);\r\n\t\t}\r\n\t});\r\n}", "portControl(helper) {\n stroke(83, 124, 123);\n strokeWeight(5);\n noFill();\n rect(this.x + this.width / 2 - 100, this.y + 280, 200, 200, 20);\n //headline\n textFont(myFontBold);\n textSize(60);\n fill(247, 240, 226);\n textAlign(CENTER);\n noStroke();\n text(\"Hafenkontrollen\", this.x + this.width / 2, this.y + 110);\n //describtion\n textSize(30);\n fill(83, 124, 123);\n text(\"Schütze deinen Hafen vor\", this.x + this.width / 2, this.y + 220);\n text(\"illegaler Fischerei\", this.x + this.width / 2, this.y + 250);\n //main image\n image(\n assets.visual.default.portControl,\n this.x + this.width / 2 - 75,\n this.y + 310,\n 150,\n 150\n );\n //clickable image array\n let x = this.x;\n let y = this.y;\n for (let i = 0; i < 10; i++) {\n image(assets.interactive.portControl, this.x + 130, this.y + 530, 40, 40);\n this.x += 45;\n if (i === 4) {\n this.y += 50;\n this.x = x;\n }\n }\n this.x = x;\n this.y = y;\n this.visualize.colorCheck();\n for (let i = 0; i < 10; i++) {\n image(\n assets.visual.default.portControl,\n this.x + 130,\n this.y + 530,\n 40,\n 40\n );\n if (\n mouseX > this.x + 130 &&\n mouseX < this.x + 170 &&\n mouseY > this.y + 530 &&\n mouseY < this.y + 570\n ) {\n this.chosenIndex = i + 1;\n }\n this.x += 45;\n if (i === 4) {\n this.y += 50;\n this.x = x;\n }\n }\n this.x = x;\n this.y = y;\n this.visualize.checkKey();\n this.visualize.doForKey(helper);\n this.portControlClicked();\n this.chosenIndex = 0;\n }", "function init() {\n clearCanvas()\n drawBackgroundColor()\n drawOrigin()\n }", "drawLineFunction(){\n //Using the pre set variables (this.) from the constructor, this.fillcolour will equal to the random values of this.Green/Red/Blue/Alpha\n this.fillcolour = color(this.Red, this.Green, this.Blue, this.Alpha);\n fill(this.fillcolour);//This then fills a line with the a random colour \n stroke(this.fillcolour);//This then fills a lines stroke with the a random colour \n \n //This creates a new operator (this.x2) and maps it to the value of x1 with a range of 0 to width to width to 0.\n this.x2 = map(this.x1, 0, width, width, 0);\n //This creates a new operator (this.y2) and maps it to the value of y1 with a range of 0 to height to height to 0.\n this.y2 = map(this.y1, 0, height, height, 0);\n \n //this is creating the lines and their partners to refelect\n line(this.x1, this.y1, this.size, this.size);\n line(this.x2, this.y2, this.size, this.size);\n line(this.x2, this.y1, this.size, this.size);\n line(this.x1, this.y2, this.size, this.size);\n \n }", "function ConnectedPosition() { }", "function init(){\n\n $pasos = $('.pasos');\n $percentage = null;\n /* ---------------------------------------------- */\n /* Configura las posiciones a la izquierda de acada elemento por porcentaje y conecta con el siguiente div hermano*/\n $.each($pasos,function(key,value)\n {\n $percentage = Math.floor((Math.random() * 80) + 1);\n \n $(value).css('left', + $percentage+'%');\n \n if(key > 0)\n {\n\n $(value).connections(\n {\n to: $($pasos[key-1]),\n //agrega algunos estilos para el borde de las conexiones\n css: {\n border: 'solid 10px #44B4D5',\n 'border-radius': '30px'\n }\n\n });\n\n }\n \n });\n\n\n /* ------------------------------------------------------*/\n /*Cambia las posiciones de los divs cuando la pantalla cambia de tamaño y actualiza las conecciones*/\n \n $(window).resize(function()\n {\n \n\n $.each($pasos,function(key,value){\n $percentage = Math.floor((Math.random() * 80) + 1);\n $(value).css('left', + $percentage+'%');\n \n \n });\n\n $pasos.connections('update');\n });\n /* ---------------------------------------------- */\n\n\n}", "onConnect() {\n if (this.startCoord)\n this.handler.coord.copy(this.startCoord);\n else {\n let ssCoord = Handler.ScreenSizeCoord;\n let width = (this.sizer.width) ? this.sizer.width : Math.round(ssCoord.width / 3);\n let height = (this.sizer.height) ? this.sizer.height : Math.round(ssCoord.height / 3);\n let x = Math.round((ssCoord.width - width) / 2);\n let y = Math.round((ssCoord.height - height) / 2);\n this.coord.assign(x, y, width, height, 0, 0, ssCoord.width, ssCoord.height);\n }\n }", "function reinit() {\n\t// Check for canvas width and set appropriate attributes\n\tcanvasWidth();\n\t// Draw the graph\n\tdrawGraph();\n\t// Reset the PointsX and PointsY arrays\n\tpointsX = [];\n\tpointsY = [];\n\t// Find all the points in pixels for the X and Y axes\n\tfindPointX();\n\tfindPointY();\n\t// Draw equations to the graph\n\tdrawEquations();\n\tif(type === \"linear\") {\n\t\t// Draw two circles for linear\n\t\tdrawCircle(circle_m);\n\t\tdrawCircle(circle_c);\n\t} else {\n\t\t// Draw two circles for quadratic\n\t\tdrawCircle(circle_x1);\n\t\tdrawCircle(circle_x2);\n\t}\n}", "drawVariables(x, y , w, h) {\n this.x = x;\n this.y = y;\n this.w = w;\n this.h = h;\n }", "init() {\n // setup the canvas\n this.canvasHolder.append(this.can)\n this.canvasHolder.append(this.paneOb.ta)\n this.canvasHolder.append(this.infoHolder)\n this.paneDiv.append(this.canvasHolder)\n this.can.height = this.size\n this.can.width = this.size\n this.invisican.height = this.size\n this.invisican.width = this.size\n //create interpolators for drawing\n //map xmin - xmax to 0 to 5000 or whatever width is do the same for y\n // create the regnametoValueMap\n /** This is the html canvas element context used for drawing lines and filling shapes on the canvas */\n this.ctx = this.can.getContext(\"2d\")\n /** This is the drawing context for the invisible canvas */\n this.invisictx = this.invisican.getContext(\"2d\")\n // calculate the regionSize min and max for all the slices, and allow us to scale the canvas content depending on that in the future\n this.calcRegionSizeGlobal()\n // take care of binding various functions to the events that get emitted\n // events to track valcolchange,radiobuttonchanged,sliderchange, filterChange\n // valcolchange we need to wait until something happens with the sliders?\n\n this.can.addEventListener(\"click\", this.getPos.bind(this))\n //radiobutton and slider change have implications for the slice we are looking at\n this.can.addEventListener(\"radiobuttonchanged\", () => {\n // must also trigger a slider update because otherwise slices get counted wrong\n this.setupCanvas()\n this.drawCanvas()\n })\n this.can.addEventListener(\"sliderchange\", () => {\n this.setupCanvas()\n this.drawCanvas()\n })\n\n //activity filter change, and valcolchange mean we must update our version of the ctrlInstance coldat, requires updating the regNameToValMap also\n this.can.addEventListener(\"filterChange\", () => {\n this.setupCanvas()\n this.drawCanvas()\n })\n\n }", "function init() {\n\tinitalizeGrid();\n\tupdateCanvasGrid();\n\tdrawPalette();\n\tdrawCurrentColor();\n\tdecodeOnFirstLoad();\n}", "draw(){\n canCon.beginPath();\n canCon.rect(this.x, this.y, this.width, this.height);\n canCon.fillStyle = 'blue';\n canCon.fill();\n}", "draw() {\n\n this.drawInteractionArea();\n\n //somewhat depreciated - we only really draw the curve interaction but this isnt hurting anyone\n if(lineInteraction)\n this.drawLine();\n else\n this.drawCurve();\n\n this.drawWatch(); \n\n }", "init() {\n const { canvasCenterX, canvasCenterY } = GLOBALS.drawer.init(); // resizes\n // update properties\n Object.assign(GLOBALS, {\n canvasCenterX,\n canvasCenterY\n });\n // create new ambient circles\n // TODO: adjust position of ORBITING circles\n Object.assign(GLOBALS.circles, {\n [CircleBehavior.AMBIENT]: this._createCircles(CIRCLE_AMOUNT)\n });\n // Focus onto the text field\n GLOBALS.inputField.focus();\n }", "constructor() {\n this.standardProgram = null; // Draw static point in the middle\n this.globalDrawingProgram = null; // Draw point defined by global parameters\n this.vertexColorProgram = null; // Draw static point in the middle\n }", "function initializeVariables(){\n MAX_POINTS = 500;\n drawCount = 0;\n colors = [0x8f00ff,0x4b0082,0x0000ff,0x00ff00,0xffff00,0xff7f00,0xff0000];\n cords = [2.02,2.11,2.18,2.25,2.32,2.40,2.47];\n cords2 = [1.55,1.74,1.94,2.18,2.34,2.52,2.70];\n \n randAllgeometries = new Array(4);\n randAllMaterials = new Array(4);\n randAllLines = new Array(4);\n randAllPositions = new Array(4);\n\n allgeometries = new Array(7);\n allMaterials = new Array(7);\n allLines = new Array(7);\n allPositions = new Array(7);\n\n allgeometries2 = new Array(7);\n allMaterials2 = new Array(7);\n allLines2 = new Array(7);\n allPositions2 = new Array(7);\n\n allgeometries3 = new Array(7);\n allMaterials3 = new Array(7);\n allLines3 = new Array(7);\n allPositions3 = new Array(7);\n}", "function connect() {\n\tif ((game != null && (game.readyState == 1 || state == 1)) || !window.location.hash) {\n\t\treturn;\n\t}\n\tstate = 1;\n\t\n\t// Extract server from url\n\tvar url = \"ws://\" + window.location.host + \n\t\twindow.location.pathname.slice(0, \n\t\twindow.location.pathname.length - \"client.html\".length) + \"socket\";\n\t\n var hash = window.location.hash.substring(1)\n\tgame = new WebSocket(url, hash);\n\tgame.onmessage = function (event) {\n\t\tvar msg = undefined;\n\t\ttry {\n\t\t\tmsg = JSON.parse(event.data);\n\t\t} catch(err) {\n\t\t\tconsole.log(\"Unable to parse server message\");\n\t\t\tconsole.log(err)\n\t\t\treturn;\n\t\t}\n\t\n\t\tvar action = msg['action'];\n\t\tif (action == \"render\") {\n\t\t\tvar width = msg['width'];\n\t\t\tvar height = msg['height'];\n\t\t\tvar elements = msg['elements'];\n\t\t\n\t\t\t// Update the canvas size\n\t\t\tif (c.width != window.innerWidth - 15 || c.height != window.innerHeight - 15) {\n\t\t\t\tc.width = window.innerWidth - 15;\n\t\t\t\tc.height = window.innerHeight - 15;\n\t\t\t}\n\t\t\tvar scalex = c.width / width;\n\t\t\tvar scaley = c.height / height;\n\t\t\n\t\t\t// Compute the 'dirty' area\n\t\t\t/*\n\t\t\tfor (var i = 0; i < elements.length; i++) {\n\t\t\t\tvar element = elements[i];\n\t\t\t\tvar type = element['type'];\n\t\t\t\t\n\t\t\t\tif (target == 0) {\n\t\t\t\t\telementSize(element);\n\t\t\t\t}\n\t\t\t}\n\t\t\t*/\n\t\t\t\n\t\t\t// Draw the base color\n\t\t\tvar ctx = c.getContext(\"2d\");\n\t\t\tdraw(width, height);\n\t\t\t\n\t\t\t// Draw the elements\n\t\t\tfor (var i = 0; i < elements.length; i++) {\n\t\t\t\tvar element = elements[i];\n\t\t\t\tvar type = element['type'];\n\t\t\t\t\n\t\t\t\t// Check for render target changes\n\t\t\t\tif (type == 'base') {\n\t\t\t\t\tvar enabled = element['enabled'];\n\t\t\t\t\tif (enabled) {\n\t\t\t\t\t\tbase = [];\n\t\t\t\t\t\ttarget = 1;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttarget = 0;\n\t\t\t\t\t}\n\t\t\t\t} else if (target == 1) {\n\t\t\t\t\tbase.push(element);\n\t\t\t\t} else {\n\t\t\t\t\tdrawElement(element, scalex, scaley);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\tgame.onopen = function() {\n\t\tconsole.log(\"open\");\n\t\tstate = 2;\n\t}\n\tgame.onclose = function() { \n\t\tconsole.log(\"closed\");\n\t\tstate = 0;\n\t};\n}", "function LayoutConnectionHandler(layouter, canvas) {\n this._layouter = layouter;\n this._canvas = canvas;\n}", "function LayoutConnectionHandler(layouter, canvas) {\n this._layouter = layouter;\n this._canvas = canvas;\n}", "function initialisationOfVariables() {\n CENTER_X = 350; /** Horizontal center point of canvas */\n CENTER_Y = 350; /** Vertical enter point of canvas */\n INITIAL_ROT_TOP = -8;\n INITIAL_ROT_BOTTOM = 172;\n PX_UNIT = 4; /** Here 0.5 degree is considered as 2px */\n DEGREE_UNIT = 0.5; /** 0.5 considered as basic degree unit for line spectram */\n current_angle = 90;\n current_fine_angle = 0;\n current_vernier_angle = 0;\n min_max_limit = false;\n hit_flag=false;/** Hit telescope */\n \n}", "function OverlayConnectionPosition() { }", "function draw() {\n // Only proceed if the peer connection is started\n if (!spw.isConnectionStarted()) {\n console.log('returning');\n return;\n }\n\n // Get and send my mouse position over peer connection\n myMousePosition = { x: mouseX, y: mouseY };\n spw.send(myMousePosition);\n\n // Draw a white background with alpha of 50\n background(255, 50);\n\n // Don't draw the stroke\n noStroke();\n\n // Use color x for my mouse position\n fill(colors.x);\n\n // Draw an ellipse at my mouse position\n ellipse(myMousePosition.x, myMousePosition.y, size);\n\n // Make sure there is a partner mouse position before drawing\n if (typeof partnerMousePosition !== 'undefined') {\n // Use color y for my parter's mouse position\n fill(colors.y);\n\n // Draw an ellipse at my partner's mouse position\n ellipse(partnerMousePosition.x, partnerMousePosition.y, size);\n }\n}", "function instanciateNode() {\n\n firstNodeMid = {\n xCord: nodeSize * 2,\n yCord: canvas.height / 2,\n connected: [\n [firstNodeTop.xCord, firstNodeTop.yCord],\n [firstNodeBot.xCord, firstNodeBot.yCord],\n [secondNodeMid.xCord, secondNodeMid.yCord]\n ],\n value: \"∞\",\n colour: unFinalizedCol\n\n };\n\n secondNodeMid = {\n xCord: canvas.width / 2 + nodeSize,\n yCord: canvas.height / 2,\n connected: [\n [firstNodeMid.xCord, firstNodeMid.yCord],\n [firstNodeTop.xCord, firstNodeTop.yCord],\n [firstNodeBot.xCord, firstNodeBot.yCord],\n [thirdNodeMid.xCord, thirdNodeMid.yCord],\n [secondNodeTop.xCord, secondNodeTop.yCord],\n [secondNodeBot.xCord, secondNodeBot.yCord]\n ],\n value: \"∞\",\n colour: unFinalizedCol\n\n };\n\n thirdNodeMid = {\n xCord: canvas.width - nodeSize * 2,\n yCord: canvas.height / 2,\n connected: [\n [secondNodeBot.xCord, secondNodeBot.yCord],\n [secondNodeTop.xCord, secondNodeTop.yCord],\n [secondNodeMid.xCord, secondNodeMid.yCord]\n ],\n value: \"∞\",\n colour: unFinalizedCol\n\n };\n\n firstNodeTop = {\n xCord: nodeSize * 11,\n yCord: canvas.height / 4.5,\n connected: [\n [secondNodeMid.xCord, secondNodeMid.yCord],\n [firstNodeMid.xCord, firstNodeMid.yCord],\n [secondNodeTop.xCord, secondNodeTop.yCord]\n ],\n value: \"∞\",\n colour: unFinalizedCol\n\n };\n\n secondNodeTop = {\n xCord: canvas.width - nodeSize * 9,\n yCord: canvas.height / 4.5,\n connected: [\n [secondNodeMid.xCord, secondNodeMid.yCord],\n [thirdNodeMid.xCord, thirdNodeMid.yCord],\n [firstNodeTop.xCord, firstNodeTop.yCord]\n ],\n value: \"∞\",\n colour: unFinalizedCol\n\n };\n\n firstNodeBot = {\n xCord: nodeSize * 11,\n yCord: canvas.height / 1.25,\n connected: [\n [secondNodeMid.xCord, secondNodeMid.yCord],\n [firstNodeMid.xCord, firstNodeMid.yCord],\n [secondNodeBot.xCord, secondNodeBot.yCord]\n ],\n value: \"∞\",\n colour: unFinalizedCol\n\n };\n\n secondNodeBot = {\n xCord: canvas.width - nodeSize * 9,\n yCord: canvas.height / 1.25,\n connected: [\n [secondNodeMid.xCord, secondNodeMid.yCord],\n [thirdNodeMid.xCord, thirdNodeMid.yCord],\n [secondNodeBot.xCord, secondNodeBot.yCord]\n ],\n value: \"∞\",\n colour: unFinalizedCol\n\n };\n\n}", "static draw(nn, context, inputs){\n context.clearRect(0, 0, context.canvas.width, context.canvas.height)\n\n inputs.forEach( (elem, index) => { // Voir si on peut draw les inputs dans la boucle du dessous où s'il faut vraiment séparer\n context.lineWidth = 1 // A set ailleurs ?\n context.strokeStyle = 'rgb(0, 0, 0)'\n context.strokeText(elem.toFixed(3), nn.drawX - 50, nn.drawY + index*nn.gapPerceptron) // A set en option ?\n\n let intensity = elem * 255\n context.fillStyle = 'rgb(0, ' + intensity + ', 0)'\n context.beginPath()\n context.arc(nn.drawX, nn.drawY + index*nn.gapPerceptron, nn.radiusPerceptron, 0, 2*Math.PI)\n context.fill()\n })\n\n let outputs = Matrix.toMatrix(inputs)\n nn.layers.forEach( (layer, index, layers) => {\n context.lineWidth = nn.thicknessWeights// A set ailleurs ?\n\n let result = Matrix.multiply(layer, outputs)\n result.applyActivationFunction(nn.activationFunction.func)\n outputs = Matrix.toArray(result)\n outputs.forEach( (elem, indexOutputs) => {\n let intensity = elem * 255\n context.fillStyle = 'rgb(0, ' + intensity + ', 0)'\n context.beginPath()\n context.arc(nn.drawX + (index+1)*nn.gapLayer, nn.drawY + indexOutputs*nn.gapPerceptron, nn.radiusPerceptron, 0, 2*Math.PI)\n context.fill()\n })\n outputs = Matrix.toMatrix(outputs)\n\n layer.data.forEach( (ligne, indexLigne) => {\n ligne.forEach( (value, indexColonne) => {\n context.beginPath()\n let colorIntensity = Math.abs(value) * 255 * inputs[indexColonne]\n if(value > 0){\n context.strokeStyle = 'rgb(0, ' + colorIntensity + ', 0)'\n }\n else{\n context.strokeStyle = 'rgb(' + colorIntensity + ', 0, 0)'\n }\n context.moveTo(nn.drawX + index*nn.gapLayer, nn.drawY + indexColonne*nn.gapPerceptron)\n context.lineTo(nn.drawX + (index+1)*nn.gapLayer, nn.drawY + indexLigne*nn.gapPerceptron)\n context.stroke()\n })\n })\n })\n }", "function LayoutConnectionHandler(layouter, canvas) {\n this._layouter = layouter;\n this._canvas = canvas;\n }", "function LayoutConnectionHandler(layouter, canvas) {\n this._layouter = layouter;\n this._canvas = canvas;\n}", "function init() {\n this.grid = setupGrid(this.rows, this.lines, this.pattern);\n draw(this.canvas, this.grid);\n}", "function draw() {\n //THis is used to make the intro screen\n if (state === 1) {\n background(intro);\n startButton();\n }\n\n //This askes the user for a background color\n else if (state === 2) {\n backgroundColorInput = prompt(\"Select a color for the background.\");\n background(backgroundColorInput);\n state = 3;\n mouseIsPressed = false;\n }\n\n //This is the main part of the program as the actual drawing part is located here\n else if (state === 3) {\n sidePanel();\n toolSelection();\n\n //This allowed me to put the 'setupSlider' function in the draw loop instead of inside the function\n if (stateChecker) {\n setupSlider();\n stateChecker = false;\n }\n\n //This assigns the variables rValue, gValue and bValue to their slider value\n //THis also draws a square to dispay the color of the pen\n //THis also cahnges the color of the pen to the color that is shown in the square\n rValue = rSlider.value();\n gValue = gSlider.value();\n bValue = bSlider.value();\n fill(rValue, gValue, bValue);\n rect(width - 335, 150, 250, 250);\n stroke(rValue, gValue, bValue);\n\n //This assigns the sizeValue variable to its slider value and changes the pen size to the sizeValue variable\n sizeValue = sizeSlider.value();\n penSize = sizeValue;\n }\n\n //This bit of code is in charge of the actual drawings made on thre canvas\n if (mouseIsPressed && mouseX <= width - 400) {\n strokeWeight(penSize);\n line(mouseX, mouseY, pmouseX, pmouseY);\n }\n}", "function draw(){\n\t\t// Needed to comply with Tool Delegate design pattern\n\t}", "function run (){\n console.log( 'Starting Connect4!' );\n\n this.cellStates = [];\n\n this.BORDER = 5, //the border on all four sides of the canvas.\n this.ROWS = 6, //the number of rows on our board\n this.COLUMNS = 7, //the number of columns on our board\n this.CIRCLERADIUS = 23,\n this.LINEWIDTH = 4,\n\n this.activePlayer = 1;\n this.gameEnded = false;\n //\n // Function: init\n //\n this.init = function (){\n\n var x = 0;\n var y = 0;\n\n for (x = 0; x < this.COLUMNS;x++){\n var tmpState = [];\n\n for (y = 0; y < this.ROWS;y++){\n tmpState.push(0);\n }\n\n this.cellStates.push(tmpState);\n }\n },\n\n //\n // Function: drawBoard\n //\n this.drawBoard = function (){\n\n var x = 0;\n var y = 0;\n\n for(x = 0; x < this.cellStates.length;x++){\n for(y = 0; y < this.cellStates[x].length;y++){\n\n this.drawCell($('#gameArea')[0],x,y,this.cellStates[x][y]);\n }\n }\n },\n\n this.drawCell = function(canvas, x, y, state) {\n var xZero = this.BORDER;\n var yZero = this.BORDER;\n\n var realWidth = canvas.width - 2 * this.BORDER;\n var realHeight = canvas.height - 2 * this.BORDER;\n\n \tvar cellWidth = (realWidth / this.COLUMNS);\n \tvar cellHeight = (realHeight / this.ROWS) ;\n\n var cellStartPosX = xZero + x*cellWidth;\n var cellStartPosY = yZero + y*cellHeight;\n\n \tvar ctx = canvas.getContext('2d');\n\n \tctx.lineWidth = this.LINEWIDTH;\n \tctx.strokeStyle = \"#086788\";\n \tctx.strokeRect (cellStartPosX,\tcellStartPosY,\n \t\t\t\t\tcellWidth, cellHeight);\n\n \tif (state == 1 || state == 2) {\n \t\tif (state == 1) {\n \t\t\tctx.fillStyle = \"#DD1C1A\"; //red\n \t \t}\n \t \telse {\n \t\t\tctx.fillStyle = \"#f6f600\"; //yellow\n \t \t}\n \t\tvar path = new Path2D();\n\n // var xPosition = cellStartPosX + (x+1)*this.LINEWIDTH + ((cellWidth - this.CIRCLERADIUS ) / 2);\n // var yPosition = cellStartPosY + (y+1)*this.LINEWIDTH + ((cellHeight - this.CIRCLERADIUS ) / 2);\n\n var xPosition = xZero + (x+1)*cellWidth - (cellWidth / 2);\n var yPosition = yZero + (y+1)*cellHeight - (cellHeight / 2);\n\n \t\tpath.arc(xPosition ,yPosition, this.CIRCLERADIUS,0,2*Math.PI);\n\n \t\tctx.fill(path);\n \t}\n },\n\n this.playerClicked = function(e){\n\n if(!this.gameEnded){\n\n var width = $(\"#gameArea\").width();\n var height = $(\"#gameArea\").height();\n\n var wStep = width / this.COLUMNS;\n var hStep = height / this.ROWS;\n\n var x = Math.floor((e.pageX-$(\"#gameArea\").offset().left));\n var y = Math.floor((e.pageY-$(\"#gameArea\").offset().top));\n\n var detCol = -1;\n var detRow = -1;\n\n for(var i = 0;i < this.COLUMNS;i++){\n if(x >= (i*wStep) && x <= ((i+1)*wStep)){\n detCol = i;\n break;\n }\n }\n\n /*for(var i = 0;i < this.ROWS;i++){\n if(y >= (i*hStep) && y <= ((i+1)*hStep)){\n detRow = i;\n break;\n }\n }*/\n //Looking for free rows\n for(var i = this.ROWS - 1;i >= 0;i--){\n if(this.cellStates[detCol][i] == 0){\n detRow = i;\n break;\n }\n }\n\n if(detRow != -1 && this.cellStates[detCol][detRow] == 0){\n this.cellStates[detCol][detRow] = this.activePlayer;\n this.drawBoard();\n\n if (this.hasGameEnded()){\n this.gameEnded = true;\n\n if(this.activePlayer == 1){\n alert(\"Spiel-Ende\\n\" + $(\"#nameOfPlayerOneElement\").text() + \" hat gewonnen!\\nFür eine neue Runde laden Sie bitte die Seite neu!\");\n }else if (this.acivePlayer == 2){\n alert(\"Spiel-Ende\\n\" + $(\"#nameOfPlayerTwoElement\").text() + \" hat gewonnen!\\nFür eine neue Runde laden Sie bitte die Seite neu!\");\n }\n\n console.log('Winner: ' + this.activePlayer);\n }else{\n //Calcualte next player\n if(this.activePlayer == 1){\n this.activePlayer = 2;\n $(\"#nameOfPlayer1\").css(\"color\",\"white\");\n $(\"#nameOfPlayer2\").css(\"color\",\"green\");\n }else if (this.activePlayer == 2){\n this.activePlayer = 1;\n $(\"#nameOfPlayer1\").css(\"color\",\"green\");\n $(\"#nameOfPlayer2\").css(\"color\",\"white\");\n }\n }\n }else if (detRow == -1){\n alert('Diese Spalte ist bereits voll. Bitte versuchen Sie eine andere!');\n }\n }\n }.bind(this),\n\n\n this.hasGameEnded = function() {\n var in1;\n\t\t\tvar in2;\n\t\t\tvar x,y,i,j;\n\n\t\t\tfor (x=0;x < this.COLUMNS;x++) {\n\n\t\t\t\tin1 = 0;\n\t\t\t\tin2 = 0;\n\n\t\t\t\tfor (y=0;y < this.ROWS;y++) {\n\t\t\t\t\tif (this.cellStates[x][y] == 1) {\n\t\t\t\t\t\tif (++in1 == 4)\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\tin2 = 0;\n\t\t\t\t\t}\n\t\t\t\t\telse if (this.cellStates[x][y] == 2) {\n\t\t\t\t\t\tif (++in2 == 4)\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\tin1 = 0;\n\t\t\t\t\t}else{\n in1 = 0;\n in2 = 0;\n }\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tfor (y=0;y < this.ROWS;y++) {\n\n\t\t\t\tin1 = 0;\n\t\t\t\tin2 = 0;\n\n\t\t\t\tfor (x=0;x < this.COLUMNS;x++) {\n\t\t\t\t\tif (this.cellStates[x][y] == 1) {\n\t\t\t\t\t\tif (++in1 == 4)\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\tin2 = 0;\n\t\t\t\t\t}\n\t\t\t\t\telse if (this.cellStates[x][y] == 2) {\n\t\t\t\t\t\tif (++in2 == 4)\n\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\tin1 = 0;\n\t\t\t\t\t}else{\n in1 = 0;\n in2 = 0;\n }\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (i=-this.COLUMNS;i < this.COLUMNS-3;i++) {\n\n\t\t\t\tin1 = 0;\n\t\t\t\tin2 = 0;\n\n\t\t\t\tfor (j=0;j < this.ROWS;j++) {\n\t\t\t\t\tx = i + j;\n\t\t\t\t\ty = j;\n\t\t\t\t\tif (x >= 0 && y >= 0 && x < this.COLUMNS && y < this.ROWS) {\n\t\t\t\t\t\tif (this.cellStates[x][y] == 1) {\n\t\t\t\t\t\t\tif (++in1 == 4)\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\tin2 = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (this.cellStates[x][y] == 2) {\n\t\t\t\t\t\t\tif (++in2 == 4)\n\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\tin1 = 0;\n\t\t\t\t\t\t}else{\n in1 = 0;\n in2 = 0;\n }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (i=-this.COLUMNS;i < this.COLUMNS-3;i++) {\n\n\t\t\t\tin1 = 0;\n\t\t\t\tin2 = 0;\n\n\t\t\t\tfor (j=0;j < this.ROWS;j++) {\n\t\t\t\t\tx = i - j;\n\t\t\t\t\ty = j;\n\t\t\t\t\tif (x >= 0 && y >= 0 && x < this.COLUMNS && y < this.ROWS) {\n\t\t\t\t\t\tif (this.cellStates[x][y] == 1) {\n\t\t\t\t\t\t\tif (++in1 == 4)\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\tin2 = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (this.cellStates[x][y] == 2) {\n\t\t\t\t\t\t\tif (++in2 == 4)\n\t\t\t\t\t\t\t\treturn true;\n\n\t\t\t\t\t\t\tin1 = 0;\n\t\t\t\t\t\t}else{\n in1 = 0;\n in2 = 0;\n }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n },\n this.init();\n\n this.drawBoard();\n\n $( \"#playerOnePopup\" ).popup();\n $( \"#playerTwoPopup\" ).popup();\n\n $(\"#PlayerOneSubmitButton\").click( function() {\n $(\"#nameOfPlayerOneElement\").text($(\"#PopupPlayerOneName\").val());\n $( \"#playerOnePopup\" ).popup(\"close\");\n\n setTimeout(function(){\n $(\"#playerTwoPopup\").popup(\"open\");\n }, 500);\n });\n\n $(\"#PlayerTwoSubmitButton\").click( function() {\n $(\"#nameOfPlayerTwoElement\").text($(\"#PopupPlayerTwoName\").val());\n $( \"#playerTwoPopup\" ).popup(\"close\");\n });\n\n $( \"#playerOnePopup\" ).popup(\"open\");\n $( \"#playerTwoPopup\" ).popup(\"open\");\n\n //Setup Listeners\n $(\"#gameArea\").click(this.playerClicked);\n\n $(\"#nameOfPlayer1\").css(\"color\",\"green\");\n}", "draw () {\n\n // loop over the x coordinates\n for (let x = 0; x < this.config.get(colsKey); ++x) {\n\n // loop over the y coordinates\n for (let y = 0; y < this.config.get(rowsKey); ++y) {\n\n // get the current index\n let index = (x + y * this.config.get(colsKey));\n\n // get the current state\n let state = this.grid.get(index);\n\n // do we have a living being?\n if (state === 1) {\n\n // fill black\n fill(0);\n\n // get the resolution\n let resolution = this.config.get('resolution');\n\n // prepare the x coordinate\n let xPos = (x * resolution);\n \n // prepare the y coordinate\n let yPos = (y * resolution);\n\n // draw a rect\n rect(xPos, yPos, resolution, resolution);\n }\n }\n }\n }", "function InstaRaspberry()\n{\n var colour = new Col();\n var size = {topNumCells : 20, numRings : Canvas.pctX(10)};\n\n Object.defineProperties(this, \n {\n //accessors\n \"hue\" : \n {\n configurable : false,\n writeable : false,\n enumerable : false,\n get : function() \n {\n return colour.h;\n },\n set : function(newValue) \n {\n //clamp the newValue to 0-2PI\n while (newValue > (Math.PI * 2)) \n {\n newValue -= Math.PI * 2;\n }\n \n while (newValue < 0)\n {\n newValue += Math.PI * 2;\n }\n \n //set the new value\n colour.h = newValue;\n colour.UpdateRGB();\n }\n },\n \n \"saturation\" : \n {\n configurable : false,\n writeable : false,\n enumerable : false,\n get : function() \n {\n return colour.s;\n },\n set : function(newValue) \n {\n //set the new value\n colour.s = newValue;\n colour.UpdateRGB();\n }\n }, \n \n \"value\" : \n {\n configurable : false,\n writeable : false,\n enumerable : false,\n get : function() \n {\n return colour.v;\n },\n set : function(newValue) \n {\n //set the new value\n colour.v = newValue;\n colour.UpdateRGB();\n }\n }, \n \n \"size\" :\n {\n configurable : false,\n writeable : false,\n enumerable : false,\n get : function() \n {\n return colour.v;\n },\n set : function(newValue) \n {\n //set the new value\n colour.v = newValue;\n colour.UpdateRGB();\n }\n },\n \n //methods\n \"Draw\" : \n {\n value : function(x, y, context)\n {\n context.beginPath();\n context.fillStyle = \"rgba(\"+colour.r+\",\"+colour.g+\",\"+colour.b+\", 1)\";\n context.arc(Canvas.pctX(50 + x), Canvas.pctY(50 + y), Canvas.pctY(10), 0, Math.PI * 2);\n context.fill();\n }, \n configurable : false,\n writeable : false,\n enumerable : false \n } \n });\n \n}", "function setup()\n{\n createCanvas(window.innerWidth , window.innerHeight);\n //input = createInput(200);\n document.addEventListener(\"pointerdown\", mouseClick);\n document.addEventListener(\"pointerup\", mouseRelease);\n //socket = socket.io.connect('http://localhost:4040');\n socket = io();\n socket.on('mouse', newDrawing);\n //createCanvas(window.innerWidth, window.innerHeight);\n \n if (window.DeviceOrientationEvent)\n {\n window.addEventListener(\"deviceorientation\", getOrientation, true); \n }\n\n frameRate(30);\n\n buildGrid();\n}", "drawCanvas() {\n //TODO find better version of how to structure so that the margin can be programmatically set\n this.ctx.clearRect(0, 0, this.can.width, this.can.height)\n this.invisictx.clearRect(0, 0, this.can.width, this.can.height)\n // remove previous tooltips\n while (this.infoHolder.firstChild) {\n this.infoHolder.removeChild(this.infoHolder.firstChild)\n }\n let red = {\n r: 227, g: 74, b: 51\n }\n let gray = {\n r: 254, g: 232, b: 200\n }\n let blue = {\n r: 67, g: 162, b: 202\n }\n // iterate over the boundary data\n for (let region of this.paneOb.sliceData.features) {\n // this is the object that has features, and properties\n for (let coords of region.geometry.coordinates) {\n this.ctx.lineWidth = 2\n this.ctx.beginPath()\n this.invisictx.beginPath()\n // create simplified variable with points and region name\n let linedata = { points: coords, region: region.properties.regionName }\n\n // begin actual drawing to the canvas\n let first = linedata.points[0]\n let x = this.xinterp.calc(first[0])\n let y = this.yinterp.calc(first[1])\n this.ctx.moveTo(x, y)\n this.invisictx.moveTo(x, y)\n for (let i = 1; i < linedata.points.length; i++) {\n let pt = linedata.points[i]\n let x = this.xinterp.calc(pt[0])\n let y = this.yinterp.calc(pt[1])\n this.ctx.lineTo(x, y)\n this.invisictx.lineTo(x, y)\n }\n this.ctx.closePath()\n this.invisictx.closePath()\n // check if its a roilisted\n if (this.paneOb.rois[linedata.region]) {\n if (this.paneOb.rois[linedata.region]) {\n this.ctx.strokeStyle = \"black\"\n this.ctx.lineWidth = 5\n this.ctx.stroke()\n }\n // add tooltips that are visible\n let regId = linedata.region.replace(/[-_]/g, \"\")\n // if we don't find the element must make the tooltip, make search specific to pane\n if (!this.paneOb.paneDiv.querySelector(`#tooltip${regId}`)) {\n this.tooltipMaker(linedata.region, this.paneOb.rois[linedata.region])\n }\n }\n\n // default stroke gray, update if nec\n this.ctx.strokeStyle = \"gray\"\n this.ctx.stroke()\n // these aren't defined yet\n if (this.regNameToValueMap != undefined) {\n if (this.regNameToValueMap[linedata.region]) {\n let scanData = this.regNameToValueMap[linedata.region].value\n let lerpc\n if (scanData < 0) {\n // use the blue to gray instead of gray to red\n let t = this.colInterpolator.calc(scanData)\n lerpc = LerpCol( t)\n } else {\n let t = this.colInterpolator.calc(scanData)\n lerpc = LerpCol( t)\n }\n this.ctx.fillStyle = lerpc\n this.ctx.fill()\n // query the region to color map\n }\n }\n this.invisictx.fillStyle = `rgb(${this.regToColMap[linedata.region][0]},${this.regToColMap[linedata.region][1]},${this.regToColMap[linedata.region][2]})`\n this.invisictx.fill()\n }\n }\n if (this.scanDatamin != undefined && this.scanDatamax != undefined) {\n // setup a legend in the corner\n let gradient = this.ctx.createLinearGradient(0, 0, 0, this.can.height / 4)\n // color stop for rgb\n if (this.scanDatamin < 0 && this.scanDatamax > 0) {\n gradient.addColorStop(1, `rgb(${blue.r},${blue.g},${blue.b})`)\n gradient.addColorStop(.5, `rgb(${gray.r},${gray.g},${gray.b})`)\n gradient.addColorStop(0, `rgb(${red.r},${red.g},${red.b})`)\n } else if (this.scanDatamax > 0) {\n gradient.addColorStop(1.0, `rgb(255,255,178)`)\n gradient.addColorStop(0.75, `rgb(254,204,92)`)\n gradient.addColorStop(0.5, `rgb(253,141,60)`)\n gradient.addColorStop(0.25, `rgb(240,59,32)`)\n gradient.addColorStop(.0, `rgb(189,0,38)`)\n } else {\n // this is the case of blue only\n console.log(this.scanDatamax, \"max\", this.scanDatamin, \"min\")\n gradient.addColorStop(0, `rgb(${gray.r},${gray.g},${gray.b})`)\n gradient.addColorStop(1, `rgb(${blue.r},${blue.g},${blue.b})`)\n }\n let gradientWidth = 10\n this.ctx.fillStyle = gradient\n let startx = this.can.width - this.margin - gradientWidth\n let endx = this.can.width - this.margin * 2\n this.ctx.fillRect(startx, 0, endx, this.can.height / 4)\n // add numeric values to the gradient\n // measure the text so it sits right next to the gradient\n this.ctx.font = \"15px Arial\"\n let minmeasure = this.ctx.measureText(this.scanDatamin).width\n let maxmeasure = this.ctx.measureText(this.scanDatamax).width\n this.ctx.fillStyle = \"black\"\n // the -5 is a spacer for the text next to the gradient bar\n this.ctx.fillText(this.scanDatamin, startx - minmeasure - 5, this.can.height / 4)\n this.ctx.fillText(this.scanDatamax, startx - maxmeasure - 5, 15)\n }\n }", "function paintJoints() {\r\n joinCellsX.forEach((element) => {\r\n ctx.fillRect(element.x, element.y, unit, space - unit);\r\n });\r\n joinCellsY.forEach((element) => {\r\n ctx.fillRect(element.x, element.y, space - unit, unit);\r\n });\r\n}", "function NodeConnection(options){\n this.start = null; // NodeConnector of the start\n this.end = null; // NodeConnector of the end\n\n for (var prop in options)\n if (this.hasOwnProperty(prop))\n this[prop] = options[prop];\n\n this.path = document.createElementNS(svg.ns, 'path');\n this.path.setAttributeNS(null, 'stroke', '#8e8e8e');\n this.path.setAttributeNS(null, 'stroke-width', '3');\n this.path.setAttributeNS(null, 'fill', 'none');\n this.path.setAttributeNS('hover', 'stroke-width', '6');\n this.path.onmouseover = function(e){\n this.setAttributeNS(null, 'stroke', '#FFFFFF');\n this.setAttributeNS(null, 'stroke-width', '4');\n }\n this.path.onmouseout = function(e){\n this.setAttributeNS(null, 'stroke', '#8e8e8e');\n this.setAttributeNS(null, 'stroke-width', '3');\n }\n this.path.onclick = function(){\n this.remove();\n }\n svg.appendChild(this.path);\n }", "function writeConnection() {\n\t\tif (this.points != null) {\n\t\t\tvar line = document.createElement(\"v:polyline\");\n\t\t\tline.setAttribute(\"id\", this.id);\n\t\t\tline.setAttribute(\"points\", this.points);\n\t\t\tvar elem = document.getElementById(MAP).appendChild(line);\n\t\t\telem.style.pixelTop = 0;\n\t\t\telem.style.pixelLeft = 0;\n\t\t\telem.style.position = \"absolute\";\n\t\t\telem.style.zIndex = 3;\n\t\t\telem.filled = \"false\";\n\t\t\telem.strokeColor = this.color;\n\t\t\telem.strokeWeight = this.weight;\n\t\t\tif (this.onClickAction != null) {\n\t\t\t\telem.attachEvent(\"onclick\", this.onClickAction);\n\t\t\t\telem.style.cursor = \"hand\";\n\t\t\t}\n\t\t\telem.connection = this;\n\t\t}\n\t}", "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.draw();\n }", "configureStartingData() {\n // We don't use a singleton because defaults could change between calls.\n new DrawingDefaultsConfig(this, this._last_tool).render(true);\n }", "function setup() {\n createCanvas(windowWidth, windowHeight);\n\n // Listen for message from users\n socket.on('message', function (message) {\n let id = message.id;\n let data = message.data;\n //How does this syntax work???\n users[id] = {x: width * data.x, y: width * data.y};\n });\n\n // Remove disconnected users\n socket.on('disconnected', function (id) {\n delete users[id];\n });\n}", "function drawGrid() {\n\n if (typeof(socket)===\"undefined\") return;\n ctx.clearRect(0, 0, 100 * multiplier, 100 * multiplier);\n for (var j = 1; j < gridSize; j++) {\n for (var k = 1; k < gridSize; k++) { \n if (theGrid[j][k][0] == 1) {\n ctx.fillStyle = theGrid[j][k][1];\n ctx.fillRect(j*multiplier, k*multiplier, multiplier, multiplier);\n }\n }\n }\n\n var theShape = (shapes[user.getSymbol()]);\n for (var row=0; row<theShape.length;row++) {\n for (var column=0; column<theShape[row].length;column++) {\n if (theShape[row][column]==1) {\n ctx.fillStyle = user.getColor();\n ctx.fillRect((hoverj+column)*multiplier,(hoverk+row)*multiplier,multiplier,multiplier);\n }\n }\n }\n\n for (var j = multiplier; j < gridSize * multiplier; j=j+multiplier) {\n ctx.beginPath();\n ctx.strokeStyle = gridColor;\n ctx.moveTo(j,0);\n ctx.lineTo(j,gridSize * multiplier);\n ctx.stroke();\n }\n\n for (var k = multiplier; k < gridSize * multiplier; k=k+multiplier) {\n ctx.beginPath();\n ctx.strokeStyle = gridColor;\n ctx.moveTo(0,k);\n ctx.lineTo(gridSize * multiplier,k);\n ctx.stroke();\n }\n\n }", "function dotWindow_connect(ctx,dotwindow) {\n ctx.save();\n ctx.strokeStyle = \"black\";\n ctx.lineWidth = 1;\n if (dotwindow.points.length) {\n ctx.beginPath();\n dotwindow.points.forEach(function(pt,i) {\n var x = pt.x || pt[0];\n var y = pt.y || pt[1];\n if (i) { ctx.lineTo(x,y); }\n else { ctx.moveTo(x,y); }\n });\n ctx.stroke();\n }\n}", "draw() {\n this.setSize();\n this.setSizeBounds();\n this.move();\n this.coordinates = getPlaneCoordinates(this);\n this.gridCoordinates = getGridCoordinates(this);\n }", "renderDrawingboard() {\n return (\n <Drawingboard \n playerName = {this.state.myName}\n onRef = {ref => (this.drawingboard = ref)}\n emitPath = {this.emitPath}\n clientColor = {this.state.myColor}\n clientId = {this.state.socketId}\n isGameActive = {this.state.sessionState.currentSessionStatus === GAMEACTIVE}\n isMyTurn = {this.state.gameState.isMyTurn}\n paths = {this.state.paths}\n resetHandler = {this.emitVoteToReset}\n setColor = {this.setColor}\n wantsReset = {this.state.gameState.hasVotedToReset}\n displayHelp = {this.displayHelp}\n />\n )\n }", "_render() {\n\t\tif (this.ctx) {\n\t\t\tthis.ctx.fillStyle = this._settings.append_to.css('color');\n\t\t\tthis.ctx.beginPath();\n\t\t\tthis.ctx.arc(this.coordinates.x, this.coordinates.y, this.size, 0, 2 * Math.PI);\n\t\t\tthis.ctx.closePath();\n\t\t\tthis.ctx.fill()\n\t\t} else if (this.$element) {\n\t\t\t// TODO: look into rendering to a canvas\n\t\t\tthis.$element.css({\n\t\t\t\t'top': 0,\n\t\t\t\t'left': 0,\n\t\t\t\t'transform': 'translate(' + (this.coordinates.x - (this.height / 2)) + 'px, ' + (this.coordinates.y - (this.width / 2)) + 'px)',\n\t\t\t\t'width': this.width + 'px',\n\t\t\t\t'height': this.height + 'px'\n\t\t\t});\n\t\t\t\n\t\t}\n\t}", "function onConnection(socket) {\n\t// update counter\n\tclient_count++;\n\tio.sockets.emit('counter', {'number': client_count});\n\n\t// send current state\n\tsocket.emit('data', {'action': 'new_lines', 'data': current_image});\n\n\t// handle canvas updates\n\tsocket.on('data', function(command) {\n\t\tvar action = command[\"action\"];\n\n\t\tif(action == \"new_lines\") {\n\t\t\t// save to own data structure\n\t\t\tfor(var p in command['data']) {\n\t\t\t\t// command['data'] == list of lines\n\t\t\t\tvar line = command['data'][p];\n\n\t\t\t\tvar entry = {};\n\t\t\t\tentry['line'] = line;\n\t\t\t\tentry['properties'] = command['properties'];\n\t\t\t\tcurrent_image.push(entry);\n\t\t\t}\n\n\t\t\t// broadcast changes\n\t\t\ttell_clients(socket, command);\n\t\t} else if(action == \"clear_lines\") {\n\t\t\tconsole.log(\"Clearing image...\");\n\n\t\t\tcurrent_image = [];\n\t\t\tsocket.broadcast.emit('data', {'action': 'clear_lines'});\t\n\t\t}\n\t});\n\n\t// smoother drawing (onthefly)\n\tsocket.on('onthefly', function(command) {\n\t\ttell_clients(socket, command);\n\t});\n\n\t// handle disconnects\n\tsocket.on('disconnect', function() {\n console.log('Client disconnected');\n client_count--;\n socket.broadcast.emit('counter', {'number': client_count});\n });\n}", "constructor(centerX,\n centerY,\n length,\n tolerance,\n draw_test,\n color_bg_supplier,\n color_fg_supplier,\n base_height,\n thickness){\n super();\n this.centerX = centerX;\n this.centerY = centerY;\n this.length = length;\n this.color_bg_supplier = color_bg_supplier;\n this.color_fg_supplier = color_fg_supplier;\n this.base_height = base_height;\n // angle from the center to the top corners of the rectangle\n this.delta_top = Math.atan(thickness/(2*length));\n // angle from the center to the bottom corners of the rectangle\n this.delta_base = Math.atan(thickness/(2*base_height));\n // the radius that the bottom corners of the rectangle move through\n this.vertex_radius_base = Math.sqrt( (thickness*thickness/4) + base_height * base_height);\n // the radius that the top corners of the rectangle move through\n this.vertex_radius_top = Math.sqrt( (thickness*thickness/4) + length * length);\n // last records the last plotted values (so we don't have to keep recalculating\n this.last_x1 = centerX;\n this.last_y1 = centerY;\n this.last_x2 = centerX;\n this.last_y2 = centerY;\n this.last_x3 = centerX;\n this.last_y3 = centerY;\n this.last_x4 = centerX;\n this.last_y4 = centerY;\n // The change in angle from the last plotted angle before we actually redraw\n this.tolerance = tolerance;\n // predicate test that is called if the hand is not going to redraw to see\n // if there is an externally defined reason for redrawing (like another hand)\n this.draw_test = draw_test;\n this.angle = -1;\n this.last_draw_time = null;\n }", "function Model() {\n\n/* Tuple: 5-tuple object that identifies a flow. \n * Overloaded constructor:\n * Tuple(SrcIP, SrcPort, DestIP, DestPort)\n * Tuple(jso)\n */\n\nthis.Tuple = {\n getID: function (){\n // Turn each value into string then concatenate\n plainStr = this.SrcIP.toString()+this.SrcPort.toString()+this.DestIP.toString()+this.DestPort.toString();\n\n return plainStr;\n }\n};\n\nthis.Flow = {\n latLng: function(){\n return new Location(this.rem_lat, this.rem_long);\n },\n loc_LatLng: function(){\n return new Location(this.loc_lat, this.loc_long);\n },\n getID: function (){\n // Call tuple's getID function\n return this.tuple.getID();\n },\n drawn: false // Drawn is set to true once UI element is created for the flow.\n};\n\n\n/* Data Processing Routines */\nthis.last = 0;\nthis.ups = 1; // Updates Per Second : (0.5 -> once every 2 seconds) \nthis.update = function (now){\n var dt = now-this.last; // Find delta between update calls\n if( dt >= 1000/this.ups ){ // Update if delta is large enough\n this.last = now; // Restart counter\n\n // Request new data from client\n if( UIHandle.websocket.readyState == UIHandle.websocket.OPEN ){\n var msg = new Object();\n var commandCnt = 1;\n\n // default command: list all connections with given mask\n msg['1'] = [{\"command\": \"list\"}];\n\n //check for filters to be applied - overwrite default if any filters are applied.\n if( $('#filter-exclude').prop('checked') === true ){\n msg[commandCnt.toString()] = [{\"command\": \"exclude\", \"options\": $('#exclude-list').val()}];\n commandCnt++;\n }\n if( $('#filter-include').prop('checked') === true ){\n msg[commandCnt.toString()] = [{\"command\": \"include\", \"options\": $('#include-list').val()}];\n commandCnt++;\n }\n if( $('#filter-filterip').prop('checked') === true ){\n msg[commandCnt.toString()] = [{\"command\": \"filterip\", \"options\": $('#filterip-list').val()}];\n //console.log(msg[commandCnt.toString()]);\n commandCnt++;\n }\n\n if( $('#filter-filterapp').prop('checked') === true ){\n msg[commandCnt.toString()] = [{\"command\": \"appinclude\", \"options\": $('#filterapp-list').val()}];\n commandCnt++;\n }\n msg[commandCnt.toString()] = [{\"mask\": mask.toString()}];\n this.sendMessage(MsgType.DATA, JSON.stringify(msg));\n }\n\n // Update selectedFlow if exists\n if(ctrl.view.selectedFlow != null){\n // Needed to update selectedFlow data due to data creation/destruction process\n ctrl.view.selectedFlow = DataContainer.getByCid(ctrl.view.selectedFlow.cid);\n }\n\n // Update Connection Details panel\n ctrl.view.writeFlowDetails();\n\n // Update Contact Info panel\n ctrl.view.refreshContactInfo();\n\n // Update Graph\n if(ctrl.view.selectedFlow != null){\n this.updateGraph( ctrl.view.selectedFlow, flowDeltas(ctrl.view.selectedFlow) );\n }\n\n //Debug function\n if(debug == true){\n dbFunc();\n }\n }\n requestAnimFrame(this.update);\n}.bind(this);\n\n/*\n * Replaces old data set (DataContainer.list) with newFlows.\n */\nthis.processNewData = function (newFlows){\n\n //Update prevTable before removing data\n populatePrevTable();\n\n // Remove old UI elements and store some metrics\n for(var i=0; i<DataContainer.list.length; i++){\n ctrl.view.removeUIElem(DataContainer.list[i]);\n }\n\n // Remove old Data elements\n DataContainer.destroy();\n \n // Create new Data elements\n for(var i=0; i<newFlows.length; i++){\n DataContainer.add(newFlows[i]);\n }\n\n // Create new UI elements\n for(var i=0; i<DataContainer.list.length; i++){\n ctrl.view.createUIElem(DataContainer.list[i], ctrl.view.countDestIP(DataContainer.list[i].tuple.DestIP));\n }\n\n};\n\nthis.updateGraph = function(flow, deltas){\n if(flow){\n tsg_addDatapoint( new Array(deltas[0], deltas[1], flow.SmoothedRTT, flow.CurCwnd) );\n tsg_draw();\n }\n};\n\nthis.jsonToFlows = function (inJSON){\n var jso = inJSON.DATA;\n var flows = new Array();\n\n for(var i=0; i<jso.length; i++){\n flows[i] = $.extend(true, flows[i], jso[i], this.Flow);\n flows[i].tuple = $.extend(true, flows[i].tuple, this.Tuple);\n }\n\n return flows;\n}.bind(this);\n\nthis.getRequest = function (url){\n var http = new XMLHttpRequest();\n http.open(\"GET\", url, false);\n try{\n http.send();\n }catch(e){\n return null;\n }\n \n return http.responseText;\n}.bind(this);\n\n// Function that handles messages via websocket from Client\nthis.getMessage = function (dataStr){\n lastBlob = dataStr; // DEBUG\n\n if(dataStr != null){\n var json = JSON.parse(dataStr);\n var msgType = null;\n if(json.DATA !== undefined){\n msgType = MsgType.DATA;\n }else if(json.function == \"report\"){\n msgType = MsgType.REPORT;\n }\n\n switch(msgType){\n case MsgType.DATA:\n // Convert data to a JSON object then apply data.\n this.processNewData(this.jsonToFlows(json));\n //this.updateGraph( ctrl.view.selectedFlow, flowDeltas(ctrl.view.selectedFlow) );\n break;\n case MsgType.REPORT:\n if(json.result == \"success\"){ // success - show report\n ctrl.view.showReport();\n }else if(json.result == \"failure\"){ // failed - show error\n ctrl.view.reportFail();\n }\n break;\n }\n }\n}.bind(this);\n\nthis.sendMessage = function (type, arg){ \n switch(type){\n case MsgType.DATA: // Request Data\n UIHandle.websocket.send(arg);\n break;\n case MsgType.REPORT: // Send Report\n UIHandle.websocket.send(arg);\n break;\n }\n}.bind(this);\n\nflowDeltas = function(flow){\n var resultArray = new Array();\n \n resultArray.push( flow.DataOctetsOut - DataContainer.getTableVal(flow.cid,'DataOctetsOut') );\n resultArray.push( flow.DataOctetsIn - DataContainer.getTableVal(flow.cid,'DataOctetsIn') );\n return resultArray;\n};\n\n}// end of Model", "function Connection2(startX, startY, stopX, stopY) {\n\n this.startX = startX;\n this.startY = startY;\n\tthis.stopX = stopX;\n\tthis.stopY = stopY;\n}", "joinParticles(connection) {\n connection.forEach(connect => {\n // if (dist(this.x, this.y, particles[connect].x, particles[connect].y) > 200) {\n // stroke('rgba(0,255,0,1)');\n // line(this.x, this.y, particles[connect].x, particles[connect].y);\n // }\n stroke('rgba(255,255,255,0.05)');\n line(this.x, this.y, particles[connect].x, particles[connect].y);\n\n })\n }", "renderConnections() {\n const { x, y } = this.getPosition();\n const { pin: pinModel } = this.props;\n if (pinModel.direction === Direction.in) {\n return null;\n }\n return (\n pinModel.connections.map((pin) => {\n const other = pin.getPosition();\n const offset = (Size.Pin.width / 2);\n return (<line\n className={`${this.pinType}-line`}\n x1={x + offset}\n y1={y + offset}\n x2={other.x + offset}\n y2={other.y + offset}\n strokeWidth=\"4\"\n stroke={pin.getType().color}\n />);\n })\n );\n }", "loadDrawing(){\n submitCanvas(this.sendToNeuralNet);\n }", "display() {\n stroke([204, 0, 255, 100]);\n strokeWeight(1);\n fill([255,0,0,70]);\n beginShape();\n for (let i=0; i<this.vertices.length; i++) {\n vertex(this.vertices[i].x/DIVIDER, this.vertices[i].y/DIVIDER);\n circle(this.vertices[i].x/DIVIDER, this.vertices[i].y/DIVIDER, 3);\n }\n vertex(this.vertices[0].x/DIVIDER, this.vertices[0].y/DIVIDER);\n endShape();\n }", "function drawCanvas() {\r\n // Clear everything\r\n context1.clearRect(0, 0, canvas1.width, canvas1.height); // Clear canvas\r\n\r\n // Background grids\r\n drawGrid(context1,canvas1.width, canvas1.height); // Draw background grid\r\n\r\n // Curve through points and vertices\r\n drawCurve(context1, styleUniformParametrization, computeUniformInterpolation(numberOfPoints, points)); // Draw uniform parametrization\r\n drawCurve(context1, styleNonUniformParametrization, computeNonUniformInterpolation(numberOfPoints, points)); // Draw non-uniform parametrization\r\n\r\n drawVertices(context1, style, points); // Draw vertices as circles\r\n\r\n }", "constructor(x,y,w,h,clr){\n this.x = x;\n this.y = y;\n this.w = w;\n this.h = h;\n this.clr = clr;\n}", "function newConnection(socket) {\n var thisID;\n console.log('new connection: ' + socket.id);\n //store all user IDs here paired with their socket ID\n allSocketID[IDindex] = socket.id;\n\n socket.on(\"newDrawing\", sendNewDrawings);\n socket.on(\"newMouseClick\", sendNewMouseClick);\n socket.on(\"newUser\", sendNewUserID);\n socket.on(\"requestCanvases\", sendCanvases);\n socket.on(\"requestImageOfCanvas\", sendCanvasImage);\n socket.on(\"newPath\", sendNewPath);\n socket.on(\"newCircle\", sendNewCircle);\n socket.on(\"reset\", Reset);\n\n function sendNewDrawings(data) {\n //console.log(\"Got Here\");\n //console.log(data.drawing);\n canvasImages[data.id] = data.image;\n socket.broadcast.emit(\"newDrawingData\", data);\n }\n\n function sendNewMouseClick(data) {\n socket.broadcast.emit(\"newMouseClickData\", data);\n }\n\n function sendNewUserID() {\n //console.log(allSocketID[IDindex]);\n socket.emit(\"newUserID\", IDindex);\n IDindex += 1;\n }\n\n function sendCanvases() {\n data = {\n canvases: canvases\n }\n socket.emit(\"receivedCanvases\", data);\n }\n\n //send image of specific canvas\n function sendCanvasImage(id) {\n requestedCanvas = {\n image: canvasImages[id],\n id: id\n }\n socket.emit(\"receiveCanvasImage\", requestedCanvas);\n }\n\n function sendNewPath(data) {\n socket.broadcast.emit(\"receiveNewPath\", data);\n }\n\n function sendNewCircle(data) {\n socket.broadcast.emit(\"receiveNewCircle\", data);\n }\n\n function Reset() {\n canvasImages = {};\n socket.broadcast.emit(\"receiveReset\");\n }\n}", "function init(){\n var el = document.getElementById('palette');\n buildLine(col1, el);\n buildLine(col3, el);\n buildLine(col4, el);\n\n }", "function drawInformation() {\n drawBottleInformation();\n drawCoinInformation();\n drawEnergyInformation();\n}", "draw() {\n // drawing curbs first\n const shades = ['#9ca297', '#b1bab0'];\n for (let i = 0; i < 2; i++) {\n ctx.fillStyle = shades[i];\n // curbs just big rects mildly translated so some shading\n if (i) {\n ctx.translate(0, 3.3);\n }\n ctx.fillRect(0, this.y - (this.linH / 3) * 1.5, init.w, inProptn(1, 7) + (this.linH / 3) * (3 - i * 1.5));\n }\n ctx.translate(0, -3.3);\n\n // road itself\n ctx.fillStyle = 'black';\n ctx.fillRect(0, this.y, init.w, inProptn(1, 7));\n\n this.markings();\n }", "setup() {\n this.frameCounter = 0\n this.gameOver = false\n this.dinoOffScreen = false\n this.blocksArray = []\n this.cratesArray = []\n this._drawBackground()\n this._drawGround()\n this._drawDino()\n this.newScore = new this.scoreClass()\n this._drawScore()\n }", "function drawCanvas() {\n\t\tdrawer.drawWallGrid(context, solver.gridWall, solver.xLength, solver.yLength, selectedSpacesGrid); \n\t\tdrawInsideSpaces(context, drawer, colourSet, solver, purificator, selectedSpacesGrid);\n\t\tdrawer.drawSudokuFrames(context, solver, mouseCoorsItem); \n\t\tsolver.callStateForItem(spanState);\n\t}", "draw() {\n EndeGelaende.crc2.beginPath();\n EndeGelaende.crc2.arc(this.x + 53, this.y + 45, 4 * this.size, 0, 2 * Math.PI);\n EndeGelaende.crc2.fillStyle = \"#AC0603\";\n EndeGelaende.crc2.fill();\n EndeGelaende.crc2.beginPath();\n EndeGelaende.crc2.moveTo(30, 20);\n //Auge\n EndeGelaende.crc2.beginPath();\n EndeGelaende.crc2.arc(this.x + 25, this.y + 38, 1 * this.size, 0, 2 * Math.PI);\n EndeGelaende.crc2.fillStyle = \"#ffffff\";\n EndeGelaende.crc2.fill();\n EndeGelaende.crc2.beginPath();\n EndeGelaende.crc2.arc(this.x + 23, this.y + 40, 0.7 * this.size, 0, 2 * Math.PI);\n EndeGelaende.crc2.fillStyle = \"#000000\";\n EndeGelaende.crc2.fill();\n EndeGelaende.crc2.beginPath();\n EndeGelaende.crc2.moveTo(this.x + 60 + this.size * 5, this.y + 70); //unten\n EndeGelaende.crc2.lineTo(this.x + 45 + this.size * 4, this.y + 45); // links\n EndeGelaende.crc2.lineTo(this.x + 60 + this.size * 5, this.y + 10); //oben \n EndeGelaende.crc2.fillStyle = \"#AC0603\";\n EndeGelaende.crc2.fill();\n // Text\n EndeGelaende.crc2.font = \"20px Arial\";\n EndeGelaende.crc2.fillStyle = \"white\";\n EndeGelaende.crc2.fillText(\"Du\", this.x + 50, this.y + 50);\n }", "function buildUI (thisObj ) {\n var H = 25; // the height\n var W = 30; // the width\n var G = 5; // the gutter\n var x = G;\n var y = G;\n var rownum = 1;\n var columnnum = 3;\n var gutternum = 2;\n var win = (thisObj instanceof Panel) ? thisObj : new Window('palette', 'Connect With Path',[0,0,gutternum*G + W*columnnum,gutternum*G + H*rownum],{resizeable: true});\n if (win !== null) {\n\n // win.check_box = win.add('checkbox',[x,y,x+W*2,y + H],'check');\n // win.check_box.value = metaObject.setting1;\n win.do_it_button = win.add('button', [x ,y,x+W*3,y + H], 'connect them');\n // win.up_button = win.add('button', [x + W*5+ G,y,x + W*6,y + H], 'Up');\n\n // win.check_box.onClick = function (){\n // alert(\"check\");\n // };\n win.do_it_button.onClick = function () {\n connect_all_layers();\n };\n\n }\n return win;\n}", "draw() {\n\t\tlet width = 30;\n\n\t\tinfo.context.beginPath();\n\t\tinfo.context.moveTo(this.position.x - width/2, this.position.y + width/2);\n\t\tinfo.context.lineTo(this.position.x + width/2, this.position.y + width/2);\n\t\tinfo.context.lineTo(this.position.x, this.position.y - width/2);\n\t\tinfo.context.closePath();\n\t\tinfo.context.fillStyle = this.color;\n\t\tinfo.context.fill();\n\t}", "function init() \n\t{\n\t\tcanvas = document.getElementById(\"canvas\");\n\t\tcontext = canvas.getContext('2d');\n\t\tcontext.lineWidth = 4;\n\t\tcontext.lineCap = 'round';\n\t\n\t\tcircleCount=0;\t\n\t\tdraggingDraw = false;\n\t\tbgColor = \"#000000\";\n\t\tcircles = [];\n\t\t\n\t\t//event listeners to draw circles\n\t\tcanvas.addEventListener('mousedown', dragStart, false);\n\t\tcanvas.addEventListener('mousemove', drag, false);\n\t\tcanvas.addEventListener('mouseup', dragStop, false);\n\t\t\n\t\t//event listener to delete circle\n\t\tcanvas.addEventListener('dblclick', deleteCircle,false);\n\t}", "drawInteractionArea() { \n //draw outer arc\n ctx.beginPath();\n ctx.fillStyle = outerArcColour;\n ctx.arc(this.x, this.y, this.r, (-interactionStyles[currStyle].stopAngle) * Math.PI/180 , (-interactionStyles[currStyle].startAngle) * Math.PI/180, true);\n ctx.fill();\n ctx.closePath();\n \n //draw the middle arc\n ctx.beginPath();\n ctx.fillStyle = middleArcColour;\n ctx.arc(this.x, this.y, interactionStyles[currStyle].r2, (-interactionStyles[currStyle].stopAngle- 6) * Math.PI/180 , (-interactionStyles[currStyle].startAngle+7) * Math.PI/180, true);\n ctx.fill();\n ctx.closePath();\n \n //draw inner arc\n ctx.beginPath();\n ctx.fillStyle = innerArcColour;\n ctx.arc(this.x, this.y, interactionStyles[currStyle].r1, (-interactionStyles[currStyle].stopAngle-19) * Math.PI/180, (-interactionStyles[currStyle].startAngle + 22) * Math.PI/180, true);\n ctx.fill();\n ctx.closePath();\n\n\n ctx.beginPath();\n ctx.lineWidth = 4;\n ctx.strokeStyle = \"white\";\n ctx.moveTo(this.u0, this.v0);\n ctx.quadraticCurveTo(this.cpX, this.cpY, this.u1, this.v1);\n ctx.stroke();\n }", "draw() { }", "draw() { }", "draw() { }", "function setup(){\n //- - - - - overall\n\t// var screenSize = windowHeight - 100;\n\t// createCanvas(int(screenSize * .666), screenSize);\n\tcreateCanvas(windowWidth, windowHeight);\n\tbackground(0, 150, 50);\n\n\n // Listen for confirmation of connection\n socket.on('connect', function() {\n console.log(\"Connected\");\n });\n\n\t// - - - - - heartbeat\n\tsocket.on('heartbeat',\n\t\tfunction(dteam2ata){\n\t\t}\n\t);\n\n\tsocket.on('team1',\n\t\tfunction(bubbles){\n\t\t\tconsole.log('got 1')\n\t\t\tteam1 = bubbles;\n\t\t});\n\n\tsocket.on('team2',\n\t\tfunction(bubbles){\n\t\t\tconsole.log('got 2')\n\t\t\tteam2 = bubbles;\n\t\t});\n}", "show(){\r\n let x = this.col * this.size / this.cols\r\n let y = this.row * this.size / this.rows\r\n\r\n ctx.strokeStyle = \"black\"\r\n ctx.fillStyle = \"white\"\r\n ctx.lineWidth = 2\r\n\r\n if(this.walls.top) this.drawTopWall(x,y)\r\n if(this.walls.bottom) this.drawBtmWall(x,y)\r\n if(this.walls.right) this.drawRightWall(x,y)\r\n if(this.walls.left) this.drawLeftWall(x,y)\r\n\r\n if(this.has_visited){\r\n ctx.fillRect(x+1,y+1,this.size/this.cols - 2, this.size/this.rows - 2)\r\n }\r\n }", "function setup() {\n createCanvas(windowWidth, windowHeight);\n updateCanvasScale();\n frameRate(IDEAL_FRAME_RATE);\n networkArray = new CleanableSpriteArray();\n hiddentext = new HiddenText(networkArray);\n cursorShapeColor = new ShapeColor(null, color(255));\n backgroundColor = color(0);\n}", "function update() {\n\tDraggable.create(\".box\", {\n\t\tbounds:$container,\n\t\tedgeResistance:0.65,\n\t\ttype:\"x,y\",\n\t\tthrowProps:true,\n\t\tautoScroll:true,\n\t\tliveSnap:false,\n\t\tsnap:{\n\t\t\tx: function(endValue) {\n\t\t\t\treturn Math.round(endValue / gridWidth) * gridWidth;\n\t\t\t},\n\t\t\ty: function(endValue) {\n\t\t\t\treturn Math.round(endValue / gridHeight) * gridHeight;\n\t\t\t}\n\t\t},\n\t\tonClick: function() {\n\n\t\t\tif(currentAction === \"connect\"){\n\n\t\t\t\tvar temp = this.target.id;\n\t\t\t\tvar number=temp.replace('box','');\n\t\t\t\tvar element = document.getElementById(temp);\n\t\t\t\tvar str=window.getComputedStyle(element).transform;\n\t\t\t\tvar res = str.split(\"(\");\n\t\t\t\tres = res[1].split(\")\");\n\t\t\t\tres = res[0].split(\",\");\n\t\t\t\tvar X = parseInt(res[4]); var Y = parseInt(res[5]);\n\n\t\t\t\tif(draw==false){\n\n\t\t\t\t\tif(connectTO[number-1]!=(-1) ) {\n\t\t\t\t\t\tconnectFROM[connectTO[number-1]-1]=-1; connectTO[number-1]=-1; countLines--; \n\t\t\t\t\t}\n\t\t\t\t\tdraw=true;\n\t\t\t\t\tpair[0]=number;\n\t\t\t\t}\n\t\t\t\telse if(pair[1]==\"\") {\n\t\t\t\t\tif(pair[0]!=number){\n\t\t\t\t\t\tvar old = connectFROM[number-1];\n\t\t\t\t\t\tconnectTO[pair[0]-1]=number;\n\t\t\t\t\t\tif(old!=-1) {connectTO[old-1]=(-1); countLines--; }\n\t\t\t\t\t\tif(number==connectFROM[connectTO[number-1]-1]) { connectTO[number-1]=-1; }\n\t\t\t\t\t\tcountLines=0;\n\t\t\t\t\t\tfor(i=0; i<connectTO.length; i++){\n\t\t\t\t\t\t\tif(connectFROM[i]!=(-2)) connectFROM[i]=-1; \n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor(i=0; i<connectTO.length; i++){\n\n\t\t\t\t\t\t\tif(connectTO[i]<0) continue;\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcountLines++;\n\t\t\t\t\t\t\t\tconnectFROM[connectTO[i]-1]=i+1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t\tpair= [\"\", \"\"];\n\t\t\t\t\tdraw=false;\n\n\t\t\t\t\t\tmyFunction(); //after click not move\n\n\t\t\t\t\t}\n\n\t\t\t}else if(currentAction === \"configure\"){\n\t\t\t\tvar temp = this.target;\n\t\t\t\tconfigureBox(temp);\n\t\t\t\t\n\t\t\t\t\n\n\t\t\t}else{ //delete\n\t\t\t\tvar temp = this.target;\n\t\t\t\tvar number=temp.id.replace('box','');\n\t\t\t\tdeleteBox($(temp).attr('id'));\n\t\t\t\tconsole.log($(temp).attr('id'));\n\t\t\t\ttemp.remove();\n\t\t\t\tthis.kill();\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tdeletedBox++;\n\t\t\t\tboxdel.push(number);\n\t\t\t\tconnectTO[connectFROM[number-1]-1]=(-1);\n\t\t\t\tconnectFROM[connectTO[number-1]-1]=(-1);\n\t\t\t\tconnectFROM[number-1]=-2;\n\t\t\t\tconnectTO[number-1]=-2;\n\t\t\t\t\n\t\t\t\t/*for(i=0; i<connectFROM.length; i++)\n\t\t\t\t{\n\t\t\t\t\tconnectFROM[i]=-1;\n\t\t\t\t\tconnectTO[i]=-1;\n\t\t\t\t}\n\t\t\t\tfor(i=0; i<boxdel.length; i++)\n\t\t\t\t{\n\t\t\t\t\tconnectFROM[boxdel[i]-1]=-2;\n\t\t\t\t\tconnectTO[boxdel[i]-1]=-2;\n\t\t\t\t}*/\n\t\t\t\t\n\t\t\t\tconnectTO[number-1]=(-2);\n\t\t\t\tconnectFROM[number-1]=(-2);\n\t\t\t\tconsole.log[number];\n\t\t\t\tconsole.log(modules);\n\t\t\t}\n\n\t\t}\n\n\t\t});\n}", "function initialize() {\n var x = document.getElementById(\"canvas\");\n var cr = x.getContext(\"2d\");\n cr.beginPath();\n cr.rect(150,180,50,50);\n cr.strokeStyle = 'black';\n cr.stroke();\n cr.closePath();\n\n var circle = x.getContext(\"2d\");\n circle.beginPath();\n circle.arc(500,200,40,0,2*Math.PI);\n circle.strokeStyle = 'black';\n circle.stroke();\n circle.closePath();\n\n var client1 = x.getContext(\"2d\");\n client1.beginPath();\n client1.rect(300,400,80,80);\n client1.strokeStyle = 'black';\n client1.stroke();\n client1.closePath();\n\n var client2 = x.getContext(\"2d\");\n client2.beginPath();\n client2.rect(460,400,80,80);\n client2.strokeStyle = 'black';\n client2.stroke();\n client2.closePath();\n\n var client3 = x.getContext(\"2d\");\n client3.beginPath();\n client3.rect(620,400,80,80);\n client3.strokeStyle = 'black';\n client3.stroke();\n client3.closePath();\n\n var line1 = x.getContext(\"2d\");\n line1.beginPath();\n line1.moveTo(465,220);\n line1.lineTo(350,400);\n line1.strokeStyle = 'black';\n line1.stroke();\n line1.closePath();\n \n var line2 = x.getContext(\"2d\");\n line2.beginPath();\n line2.moveTo(500,240);\n line2.lineTo(500,400);\n line2.strokeStyle = 'black';\n line2.stroke();\n line2.closePath();\n\n var line3 = x.getContext(\"2d\");\n line3.beginPath();\n line3.moveTo(535,220);\n line3.lineTo(655,400);\n line3.strokeStyle = 'black';\n line3.stroke();\n line3.closePath();\n\n var inputLine = x.getContext(\"2d\");\n inputLine.beginPath();\n inputLine.moveTo(200, 203);\n inputLine.lineTo(460, 203);\n inputLine.strokeStyle = 'black';\n inputLine.stroke();\n inputLine.closePath();\n}", "display() {\n fill('#323230');\n noStroke();\n if(this.shape === 'rect') {\n rectMode(CENTER);\n rect(this.x, this.y, this.size, this.size);\n } else if(this.shape === 'circle') {\n circle(this.x, this.y, this.size);\n } else {\n triangle(this.x - this.size / 2, this.y + this.size / 2, this.x + this.size / 2, this.y + this.size / 2, this.x, this.y - this.size / 2);\n }\n }", "constructor() {\n this.rColor = 0;\n this.gColor = 244;\n this.bColor = 158;\n this.x = 750;\n this.y = 10;\n this.width = 200;\n this.height = 200;\n }", "function setupCanvas(){\n\tctx.clearRect(0, 0, canvas.width, canvas.height);\n\tctx.strokeStyle = \"#222\";\n\tvar spacing = 20;\n\t// draws gridlines\n\tfor( var i=spacing; i< 800; i+=spacing ){\n\t\tctx.beginPath();\n\t\tctx.moveTo(0, i);\n\t\tctx.lineTo(800,i);\n\t\tctx.closePath();\n\t\tctx.stroke();\n\t\t\n\t\tctx.beginPath();\n\t\tctx.moveTo(i,0);\n\t\tctx.lineTo(i,800);\n\t\tctx.closePath();\n\t\tctx.stroke();\n\t}\n\t\n\t// center dot\n\tctx.fillStyle = \"#555\";\n\tctx.beginPath();\n\tctx.arc(400, 400, 3, 0, 2*Math.PI, true);\n\tctx.closePath();\n\tctx.fill();\n\t\n\t// circles at 1 AU, 2 AU\n\tctx.strokeStyle = \"#555\";\n\tfor( var i=1; i<3; i++ ){ \n\t\tctx.beginPath();\n\t\tctx.arc(400, 400, i*metersPerAU/metersPerPixel, 0, 2*Math.PI, true);\n\t\tctx.closePath();\n\t\tctx.stroke();\n\t}\n}", "function draw() {\n Gravity();\n Animation();\n FrameBorder(); \n FrameBorderCleaner();\n Controls();\n Interaction();\n}", "showSelf() {\n stroke(this.r, this.g, this.b);\n fill(this.r, this.g, this.b);\n circle(this.x, this.y, circleRadius);\n }", "constructor(x, y) {\n\t\tthis.chadX = 1000;\n\t\tthis.chadY = 10;\n\t\tthis.chadW = 10;\n\t\tthis.chadDy = 5;\n this.color = \"Red\";\n }", "function drawNet() {\n for (let i = 0; i < canvas.height; i += 40) {\n colorRect(canvas.width / 2 - 1, i, 2, 20, \"white\");\n }\n}", "function init() {\n\tcanvas = document.getElementById('canvas');\n\tctx = canvas.getContext('2d');\n\tw = canvas.width;\n\th = canvas.height;\n\n\tcanvas.addEventListener('mousemove', function (e) {\n\t\tfindxy('move', e)\n\t}, false);\n\n\tcanvas.addEventListener('mousedown', function (e) {\n\t\tfindxy('down', e)\n\t}, false);\n\n\tcanvas.addEventListener('mouseup', function (e) {\n\t\tfindxy('up', e)\n\t}, false);\n\n\tcanvas.addEventListener('mouseout', function (e) {\n\t\tfindxy('out', e)\n\t}, false);\n\n\t// Remove transparent background.\n\tclear();\n}" ]
[ "0.6440213", "0.64037186", "0.60672873", "0.59336716", "0.5864556", "0.58592737", "0.5836391", "0.57788295", "0.57110137", "0.5693107", "0.5689007", "0.5672295", "0.56445223", "0.56256276", "0.5607018", "0.5601943", "0.558718", "0.5569125", "0.55452734", "0.5527118", "0.5508233", "0.55000114", "0.54955447", "0.54753983", "0.5449938", "0.5441521", "0.5434573", "0.542815", "0.54239583", "0.5422558", "0.5418477", "0.54157656", "0.5414657", "0.5413963", "0.5408016", "0.53982556", "0.53982556", "0.53866917", "0.5380332", "0.53628314", "0.5361665", "0.5361528", "0.534654", "0.5334784", "0.5327616", "0.5321534", "0.531089", "0.5306203", "0.52968305", "0.5296276", "0.52936655", "0.5281529", "0.52680296", "0.5245147", "0.5239968", "0.52364856", "0.5236214", "0.5235581", "0.5235411", "0.522839", "0.52202827", "0.52190065", "0.5218574", "0.5215961", "0.5215131", "0.5213845", "0.52112496", "0.5202392", "0.52016294", "0.5198928", "0.5196537", "0.51947933", "0.518706", "0.51847744", "0.51837003", "0.51830584", "0.5169698", "0.5167777", "0.51640403", "0.5161477", "0.51576835", "0.5157562", "0.51574886", "0.5153174", "0.51524436", "0.5151847", "0.5151847", "0.5151847", "0.51469076", "0.5146436", "0.5144205", "0.51405394", "0.5140449", "0.51377827", "0.5132289", "0.5130933", "0.5127301", "0.51229113", "0.51149255", "0.51125455", "0.5112184" ]
0.0
-1
The popup dialog uses this function to insert the Selected Entry, Selected Page, or Reciprocal Association.
function insertSelectedObject(obj_title, obj_id, obj_class, obj_permalink, field, blog_id) { // Check if this is a reciprocal association, or just a standard Selected // Entry/Page. if ( jQuery('input#'+field+'.reciprocal-object').length ) { // If a reciprocal association already exists, we need to delete it // before creating a new association. if ( jQuery('input#'+field+'.reciprocal-object').val() ) { deleteReciprocalAssociation( field, jQuery('input#'+field+'.reciprocal-object').val() ); createReciprocalAssociation( obj_title, obj_id, obj_class, obj_permalink, field, blog_id ); } // No existing association exists, so just create the new reciprocal // entry association. else { createReciprocalAssociation( obj_title, obj_id, obj_class, obj_permalink, field, blog_id ); } } // This is just a standard Selected Entries or Selected Pages insert. else { // Create a list item populated with title, edit, view, and remove links. var $li = createObjectListing( obj_title, obj_id, obj_class, obj_permalink, blog_id ); // Insert the list item with the button, preview, etc into the field area. jQuery('ul#custom-field-selected-objects_'+field) .append($li) var objects = new Array(); objects[0] = jQuery('input#'+field).val(); objects.push(obj_id); jQuery('input#'+field).val( objects.join(',') ); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function InsertAnchor() {\r\n anchorSelectedText = getSelectedText();\r\n anchorSelectedText = anchorSelectedText.toString();\r\n var options = SP.UI.$create_DialogOptions();\r\n options.args = getSelectedText();\r\n options.title = \"Please enter the anchor name\";\r\n options.width = 400;\r\n options.height = 200;\r\n options.y = getTop(200);\r\n options.url = \"/_layouts/BeenJammin.SharePoint.CustomRibbonActions/AnchorDialog.aspx\";\r\n options.dialogReturnValueCallback = Function.createDelegate(null, AnchorCloseCallback);\r\n SP.UI.ModalDialog.showModalDialog(options);\r\n\r\n}", "function InsertAnchorLink() {\r\n var selectedField = RTE.Canvas.currentEditableRegion();\r\n var anchorTags = selectedField.getElementsByTagName(\"ins\");\r\n var anchorList = \"\";\r\n //This loop creates an Array that we pass into the dialog window\r\n for (i = 0; i < anchorTags.length; i++) {\r\n if (anchorTags[i].id && (anchorTags[i].id.length > 0))\r\n anchorList = anchorList + anchorTags[i].id + \",\";\r\n }\r\n anchorList = anchorList.substring(0, anchorList.length - 1);\r\n var options = SP.UI.$create_DialogOptions();\r\n var selectedText = getSelectedText();\r\n\r\n options.title = \"Please select an anchor\";\r\n options.width = 400;\r\n options.height = 200;\r\n options.y = getTop(200);\r\n\r\n options.args =\r\n {\r\n selectedText: selectedText,\r\n anchorList: anchorList\r\n };\r\n options.url = \"/_layouts/BeenJammin.SharePoint.CustomRibbonActions/AnchorLinkDialog.aspx\";\r\n options.dialogReturnValueCallback = Function.createDelegate(null, AnchorLinkCloseCallback);\r\n SP.UI.ModalDialog.showModalDialog(options);\r\n\r\n}", "function InsertEmailLink() {\r\n var options = SP.UI.$create_DialogOptions();\r\n options.args = getSelectedText();\r\n options.title = \"Please enter the email information\";\r\n options.width = 400;\r\n options.height = 200;\r\n options.y = getTop(200);\r\n options.url = \"/_layouts/BeenJammin.SharePoint.CustomRibbonActions/EmailLinkDialog.aspx\";\r\n options.dialogReturnValueCallback = Function.createDelegate(null, EmailLinkCloseCallback);\r\n SP.UI.ModalDialog.showModalDialog(options);\r\n\r\n}", "function choose_297e201048183a730148183ad85c0001() {\n if (typeof(windowapi) == 'undefined') {\n $.dialog({content: 'url:departController.do?departSelect', zIndex: 2100, title: '<t:mutiLang langKey=\"common.department.list\"/>', lock: true, width: 400, height: 350, left: '85%', top: '65%', opacity: 0.4, button: [\n {name: '<t:mutiLang langKey=\"common.confirm\"/>', callback: clickcallback_297e201048183a730148183ad85c0001, focus: true},\n {name: '<t:mutiLang langKey=\"common.cancel\"/>', callback: function () {\n }}\n ]});\n } else {\n $.dialog({content: 'url:departController.do?departSelect', zIndex: 2100, title: '<t:mutiLang langKey=\"common.department.list\"/>', lock: true, parent: windowapi, width: 400, height: 350, left: '85%', top: '65%', opacity: 0.4, button: [\n {name: '<t:mutiLang langKey=\"common.confirm\"/>', callback: clickcallback_297e201048183a730148183ad85c0001, focus: true},\n {name: '<t:mutiLang langKey=\"common.cancel\"/>', callback: function () {\n }}\n ]});\n }\n}", "function showDialogAdd() {\n var title = 'Add Parts to Locations'; \n var templateName = 'addUi'; \n var width = 600; \n \n // custom function to insert part data into the dialog box. For code modularity and simplicity\n createDialogWithPartData(title,templateName,width);\n}", "function create_related_entry_dialog(data) {\n let dialog = elementFactory({ type: \"div\" });\n let lst_wrap = elementFactory({ type: \"div\", css: { margin: \"5px 0 5px 0\" } });\n let src_lst = elementFactory({ type: \"div\", attr: { id: \"related-entry-src-list\" }, class: \"dialog-list\" });\n let dst_lst = elementFactory({ type: \"div\", attr: { id: \"related-entry-dst-list\" }, class: \"dialog-list\" });\n let arrow_wrap = elementFactory({ type: \"div\", attr: { id: \"arrow-container\" } });\n let arrow_r = elementFactory({ type: \"div\", attr: { id: \"arrow-wrap-r\" }, class: \"select-disable\" });\n let arrow_l = elementFactory({ type: \"div\", attr: { id: \"arrow-wrap-l\" }, class: \"select-disable\" });\n let btn_wrap = elementFactory({ type: \"div\", css: { margin: \"5px 0 5px 0\" } });\n\n // query result show\n $(dialog).append(elementFactory({\n type: \"div\",\n css: { margin: \"5px 0 5px 0\" },\n html: \"找到 \" + Object.keys(data).length + \" 個相關條目\"\n }));\n\n // append wrapper for two list and arrow\n $(lst_wrap).append(src_lst);\n $(lst_wrap).append(arrow_wrap);\n $(lst_wrap).append(dst_lst);\n $(dialog).append(lst_wrap);\n // add query result to src list\n for (let key in data) {\n if(!data.hasOwnProperty(key))\n continue;\n $(src_lst).append(elementFactory({\n type: \"div\",\n attr: { url: data[key], title: decodeURIComponent(key) },\n class: \"related-entry-item select-disable\",\n html: decodeURIComponent(key),\n on: { click: click_related_entry_item }\n }));\n }\n // arrow right\n $(arrow_r).append(elementFactory({ type: \"div\", attr: { id: \"arrow-tail-r\" } }));\n $(arrow_r).append(elementFactory({ type: \"div\", attr: { id: \"arrow-body-r\" }, html: \"加入\" }));\n $(arrow_r).append(elementFactory({ type: \"div\", attr: { id: \"arrow-head-r\" } }));\n $(arrow_wrap).append(arrow_r);\n // arrow left\n $(arrow_l).append(elementFactory({ type: \"div\", attr: { id: \"arrow-head-l\" } }));\n $(arrow_l).append(elementFactory({ type: \"div\", attr: { id: \"arrow-body-l\" }, html: \"刪去\" }));\n $(arrow_l).append(elementFactory({ type: \"div\", attr: { id: \"arrow-tail-l\" } }));\n $(arrow_wrap).append(arrow_l);\n\n // query result add and cancel button\n $(btn_wrap).append(elementFactory({\n type: \"button\",\n attr: { id: \"related-entry-dialog-cancel\" },\n class: \"btn btn-default btn-xs\",\n css: { margin: \"0 20px 0 0\" },\n html: \"取消\",\n on: { click: $.unblockUI }\n }));\n $(btn_wrap).append(elementFactory({\n type: \"button\",\n attr: { id: \"related-entry-dialog-add\" },\n class: \"btn btn-default btn-xs\",\n css: { margin: \"0 0 0 20px\" },\n html: \"加入\",\n on: { click: add_related_entry }\n }));\n $(dialog).append(btn_wrap);\n\n $.blockUI({\n message: $(dialog),\n css: { width: \"450px\", height: \"330px\", top: 'calc(50% - 165px)', left: 'calc(50% - 225px)', cursor: 'auto' }\n });\n}", "function addMiscellaneousPopup(that) {\n var tmp = '<form id=\"saveMarker\" class=\"tabledisplay\">' +\n '<p><label> <strong>Name: </strong></label>' +\n '<input type=\"text\" id=\"name\" name=\"name\" required=\"true\"/>' +\n '</p><br><p><label><strong>Type: </strong></label>' +\n '<select type=\"text\" id=\"type\" name=\"type\" required=\"true\"/>' +\n '<option value=\"Misc\">Miscellaneous</option></select>' +\n '<input class=\"hidden\" min=\"0\" id=\"cap\" name=\"capacity\" value=\"-9999\"/>' +\n '<input class=\"hidden\" min=\"0\" id=\"price\" name=\"price\" value =\"-9999\"/>' +\n '</p><br><p><label><strong>Picture: </strong></label>' +\n '<input type=\"text\" id=\"picture\" name=\"picture\"/>' +\n '</p><br><p><label><strong>Description: </strong></label>' +\n '<textarea class=\"form-control\" rows=\"1\" id=\"info\" name=\"description\"></textarea>' +\n '<p><br><div style=\"text-align:center;\"><button type=\"submit\" value=\"Save\" class=\"btn btn-primary trigger-submit\">Save</button></div>' + '</div>' +\n '</form>';\n createObjectCreationPopup(tmp);\n}", "function mealReferenceAddEditMealDialog(selection,e) {\n console.log(e)\n // Add or Edit\n const entryType = e.target.dataset.type;\n console.log(entryType);\n // Grab 'meals-reference' div\n container = document.querySelector('.meals-reference');\n // Meal Object\n let originalMealObject;\n let newMealObject;\n\n // If Editing an existing meal\n if(entryType == 'edit-meal'){\n mealsReferenceData.forEach(meal => {\n meal.name == selection ? originalMealObject = meal : '';\n });\n }else{\n originalMealObject = {\n name: '',\n type: '',\n link: '',\n season: ''\n }\n }\n\n // *** Popup Creation\n // Overlay\n const editMealOverlay = document.createElement('div');\n editMealOverlay.classList.add('overlay');\n // Modal\n const editMealModal = document.createElement('div');\n editMealModal.classList.add('modal');\n\n // ** Heading\n const editMealModalHeading = document.createElement('h2');\n const editMealModalHeadingText = entryType == 'edit-meal' ? document.createTextNode(`Editing Meal: ${originalMealObject.name}`) : document.createTextNode(`Adding New Meal`);\n editMealModalHeading.appendChild(editMealModalHeadingText);\n editMealModal.appendChild(editMealModalHeading);\n\n // ** Labels & Inputs\n // * Meal Name - Text\n const editMealModalNameContainer = document.createElement('div');\n // Label\n const editMealModalNameLabel = document.createElement('label');\n const editMealModalNameLabelText = document.createTextNode('Meal Name: ');\n editMealModalNameLabel.appendChild(editMealModalNameLabelText);\n editMealModalNameContainer.appendChild(editMealModalNameLabel);\n // Text Input\n const editMealModalNameInput = document.createElement('input');\n editMealModalNameInput.setAttribute('type', 'text');\n editMealModalNameInput.value = originalMealObject.name;\n editMealModalNameContainer.appendChild(editMealModalNameInput);\n // Append name container to main container\n editMealModal.appendChild(editMealModalNameContainer);\n\n // * Meal Type - Select\n const editMealModalTypeContainer = document.createElement('div');\n // Label\n const editMealModalTypeLabel = document.createElement('label');\n const editMealModalTypeLabelText = document.createTextNode('Meal Type: ');\n editMealModalTypeLabel.appendChild(editMealModalTypeLabelText);\n editMealModalTypeContainer.appendChild(editMealModalTypeLabel);\n const editMealModalTypeSelect = document.createElement('select');\n // Select Input\n settingsData.mealTypes.forEach(type => {\n const option = document.createElement('option');\n option.value = type;\n const optionText = document.createTextNode(type);\n option.appendChild(optionText);\n editMealModalTypeSelect.appendChild(option)\n })\n // Set select input to original meal's type\n for (let i = 0; i < editMealModalTypeSelect.options.length; i++){\n editMealModalTypeSelect.options[i].value == originalMealObject.type ? editMealModalTypeSelect.selectedIndex = i : '';\n }\n editMealModalTypeContainer.appendChild(editMealModalTypeSelect);\n editMealModal.appendChild(editMealModalTypeContainer);\n\n // * Meal Link - URL\n const editMealModalLinkContainer = document.createElement('div');\n // Label\n const editMealModalLinkLabel = document.createElement('label');\n const editMealModalLinkLabelText = document.createTextNode('Meal Link: ');\n editMealModalLinkLabel.appendChild(editMealModalLinkLabelText);\n editMealModalLinkContainer.appendChild(editMealModalLinkLabel);\n // Text Input\n const editMealModalLinkInput = document.createElement('input');\n editMealModalLinkInput.setAttribute('type', 'url');\n editMealModalLinkInput.value = originalMealObject.link;\n editMealModalLinkContainer.appendChild(editMealModalLinkInput);\n // Append name container to main container\n editMealModal.appendChild(editMealModalLinkContainer);\n\n // * Meal Season - Select\n const editMealModalSeasonContainer = document.createElement('div');\n // Label\n const editMealModalSeasonLabel = document.createElement('label');\n const editMealModalSeasonLabelText = document.createTextNode('Meal Season: ');\n editMealModalSeasonLabel.appendChild(editMealModalSeasonLabelText);\n editMealModalSeasonContainer.appendChild(editMealModalSeasonLabel);\n const editMealModalSeasonSelect = document.createElement('select');\n // Select Input\n settingsData.mealSeasons.forEach(season => {\n const option = document.createElement('option');\n option.value = season;\n const optionText = document.createTextNode(season);\n option.appendChild(optionText);\n editMealModalSeasonSelect.appendChild(option)\n })\n // Set select input to original meal's type\n for (let i = 0; i < editMealModalSeasonSelect.options.length; i++) {\n editMealModalSeasonSelect.options[i].value == originalMealObject.season ? editMealModalSeasonSelect.selectedIndex = i : '';\n }\n editMealModalSeasonContainer.appendChild(editMealModalSeasonSelect);\n editMealModal.appendChild(editMealModalSeasonContainer);\n\n // Finish & Cancel Buttons\n const editMealModalButtonContainer = document.createElement('div');\n const editMealModalFinishButton = document.createElement('button');\n editMealModalFinishButton.textContent = 'Finish';\n editMealModalFinishButton.addEventListener('click', () => {\n // Grag input field entries\n const mealName = editMealModalNameInput.value;\n const mealType = editMealModalTypeSelect.value;\n const mealLink = editMealModalLinkInput.value;\n const mealSeason = editMealModalSeasonSelect.value\n \n // Create new meal object\n newMealObject = {\n name: mealName,\n type: mealType,\n link: mealLink,\n season: mealSeason\n }\n \n // If Editing Exisiting Meal\n if (entryType == 'edit-meal') {\n mealsReferenceData.forEach(meal => {\n if(originalMealObject.name == meal.name){\n meal.name = mealName;\n meal.type = mealType;\n meal.link = mealLink;\n meal.season = mealSeason;\n };\n })\n }\n\n // If adding a new meal\n if(entryType == 'add-meal'){\n mealsReferenceData.push(newMealObject);\n }\n\n // Set local storage to updated dataset\n localStorage.setItem('mealsReferenceData', JSON.stringify(mealsReferenceData));\n \n // Close Overlay/Modal\n document.querySelector('.overlay').remove();\n\n // Reload Meals Reference Section\n loadMealsReference(e)\n })\n editMealModalButtonContainer.appendChild(editMealModalFinishButton);\n const editMealModalCancelButton = document .createElement('button');\n editMealModalCancelButton.textContent = 'Cancel';\n editMealModalCancelButton.addEventListener('click', () => {\n document.querySelector('.overlay').remove();\n });\n // \n editMealModalButtonContainer.appendChild(editMealModalCancelButton);\n editMealModal.appendChild(editMealModalButtonContainer);\n\n // Append Modal to Overlay\n editMealOverlay.appendChild(editMealModal);\n editMealOverlay.classList.add('show')\n // Append Overlay to Container\n document.body.appendChild(editMealOverlay);\n\n }", "function LaserficheEntryDetails(){\n if(window.parent !== window && window.parent.webAccessApi !== undefined) {\n var id = window.parent.webAccessApi.getSelectedEntries()[0].id;\n var entryName = window.parent.webAccessApi.getSelectedEntries()[0].name;\n var entryType = window.parent.webAccessApi.getSelectedEntries()[0].entryType;\n var templateName = window.parent.webAccessApi.getSelectedEntries()[0].templateName;\n $('.entry-id input').val(id);\n $('.entryName input').val(entryName);\n $('.entryType input').val(entryType);\n $('.templateName input').val(templateName);\n\n }\n}", "function _createNewPageEntry(isTemplate){\n\t\t\t_checkState(CONST_STATE_ADD_SELECT_TYPE);\n\t\t\t_removeAddEntrySelectTypeIfRequired();\n\t\t\tvar newId = _generateNewId();\n\t\t\tvar options = {\n\t\t\t\tkey: newId,\n\t\t\t\tisTemplate: isTemplate,\n\t\t\t\ttitle: \"\"\n\t\t\t};\n\t\t\t\n\t\t\tvar itemToInsertPage = _findItemToInsertPage(isTemplate);\n\t\t\tvar renderedInsertTitle = $.tmpl($(\"#render-add-page-insert-title-template\"), options);\n\t\t\tif(itemToInsertPage == null || itemToInsertPage.domElement == null){\n\t\t\t\tvar innerUL = _domElement.find(\"> ul\");\n\t\t\t\tinnerUL.append(renderedInsertTitle);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(itemToInsertPage.after)\n\t\t\t\t\titemToInsertPage.domElement.after(renderedInsertTitle);\n\t\t\t\telse\n\t\t\t\t\titemToInsertPage.domElement.before(renderedInsertTitle);\n\t\t\t}\n\t\t\t\n\t\t\t$(\"#new-item-title-\"+newId).focus();\n\t\t\t\n\t\t\t_state = isTemplate ? CONST_STATE_ADD_PAGE_TEMPLATE_SET_TITLE : CONST_STATE_ADD_PAGE_SET_TITLE;\n\t\t\t\n\t\t\tvar jsonCreator = {\n\t\t\t\t\tcreate: function(newId, title, isTemplate, id){\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tisTemplate: isTemplate,\n\t\t\t\t\t\t\tkey: newId,\n\t\t\t\t\t\t\ttitle: title,\n\t\t\t\t\t\t\ttype: \"page\",\n\t\t\t\t\t\t\tparentId: id\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t};\n\t\t\t\n\t\t\t// add the handles to create the new channel\n\t\t\t$(\"#new-item-title-\"+newId).keypress(function (e){\n\t\t\t\tswitch(e.which){\n\t\t\t\tcase CONST_VK_CONFIRM: //enter\n\t\t\t\t\t_confirmObjectCreation(newId, jsonCreator, \"#render-page-template\", itemToInsertPage, isTemplate);\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t$(\".insert-title > span.title-entry\").click(function(e){\n\t\t\t\te.stopPropagation();\n\t\t\t\treturn false;\n\t\t\t});\n\t\t\t\n\t\t\t$(\".insert-title > span.actions > span.ok\").click(function(e){\n\t\t\t\t_confirmObjectCreation(newId, jsonCreator, \"#render-page-template\", itemToInsertPage, isTemplate);\n\t\t\t\te.stopPropagation();\n\t\t\t\treturn false;\n\t\t\t});\n\t\t}", "function showCreationPopup(selected)\n {\n selected.addClass('selected');\n\n var date = new Date(date_arrival*1000);\n var arrival_date = date.format(date_format);\n\n $('.contract-datepicker-input[data-role=\"arrival\"]').val(arrival_date);\n\n var date = new Date(date_departure*1000);\n var departure_date = date.format(date_format);\n\n $('.contract-datepicker-input[data-role=\"departure\"]').val(departure_date);\n\n $('.contract-date-arrival-timestamp').val(date_arrival);\n $('.contract-date-departure-timestamp').val(date_departure);\n\n date_arrival_timestamp_global = date_arrival;\n date_departure_timestamp_global = date_departure;\n\n $('#blocking-create-modal').modal('show');\n }", "function existingChoicesClick(field_name) {\r\n var data = $('#ec_'+field_name).html(); \r\n var data = data.replace(/<br>/gi, \"\\n\"); // Replace <br> with \\n \r\n $('#existing_choices_popup').dialog('destroy').remove(); // wipes out the dialog box so we lose the data that was there \r\n $('#element_enum').val(data).trigger('blur').effect('highlight',{},2500);\r\n}", "function otherEntry(submitter_name)\n{\n\tswitch (submitter_name.value) {\n\t\tcase 'Other':\n\t\t\t$(\"#adminAddPopUp\").dialog(\"open\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t}\n}", "function popupGenCall(pgInfo){\n\n $(\"#gMain\").html(pgInfo);\n\n $(\"#popupDiv\").dialog({\n modal: true,\n width: 600,\n height: 400,\n dialogClass: 'ui-widget-shadow'\n });\n}", "function addParkingStandsPopup(that){\n // Input form for Objects\n var tmp = '<form id=\"saveMarker\" class=\"tabledisplay\">' +\n '<p><label> <strong>Name: </strong></label>' +\n '<input type=\"text\" id=\"name\" name=\"name\" required=\"true\"/>' +\n '</p><br><p><label><strong>Type: </strong></label>' +\n '<select type=\"text\" id=\"type\" name=\"type\" required=\"true\">' +\n '<option value=\"Parking\">Parking</option><option value=\"Stands\">Stands</option></select>' +\n '</p><br><p><label><strong>Capacity: </strong></label>' +\n '<input type=\"number\" min=\"0\" id=\"cap\" name=\"capacity\" required=\"true\">' +\n '</p><br><p><label><strong>Price: </strong></label>' +\n '<input type=\"number\" min=\"0\" id=\"price\" name=\"price\" required\"true\">' +\n '</p><br><p><label><strong>Description: </strong></label>' +\n '<textarea class=\"form-control\" rows=\"1\" id=\"info\" name=\"description\"></textarea>' +\n '<input class=\"hidden\" value=\"-9999\" type=\"text\" id=\"picture\" name=\"picture\"/>' +\n '<div style=\"text-align:center;\"><button type=\"submit\" value=\"Save\" class=\"btn btn-primary trigger-submit\">Save</button></div>' + '</div>' +\n '</form>';\n createObjectCreationPopup(tmp);\n}", "function showCreateMenuItemDialog()\n{\n\t$('#createMenuItemDialog').dialog('open');\n\t$(\"#createMenuItemDialog\").html('<div id=\"modalWindowLoader\"></div>');\n\t$(\"#createMenuItemDialog\").load('/admin/structure/add/' + selectedItemID, function()\n\t{\n\t\t$('#createMenuItemDialog input[name=folderId]').val(currentFolderID);\n\t});\n\treturn false;\n}", "function InsertSpecialCharacter() {\r\n var options = SP.UI.$create_DialogOptions();\r\n options.title = \"Please select the special character\";\r\n options.width = 500;\r\n options.height = 300;\r\n options.y = getTop(300);\r\n options.url = \"/_layouts/BeenJammin.SharePoint.CustomRibbonActions/SpecialCharacters.aspx\";\r\n options.dialogReturnValueCallback = Function.createDelegate(null, SpecialCharacterCloseCallback);\r\n SP.UI.ModalDialog.showModalDialog(options);\r\n\r\n}", "function openAssignWorkflowSitesAndFoldersDialog()\n {\n // The variable selectedWorkflow is in the closure scope\n $.perc_assign_workflow_sites_folder_dialog.createDialog(selectedWorkflow, updateSitesFolderAssignedSection);\n }", "function showDesignations(objTextBox, objLabel)\r\n{\r\n objDesignationInvokerTextBox = objTextBox;\r\n objDesignationInvokerLabel = objLabel;\r\n openModalDialog('../popup/cm_designation_search_listing.htm',screen.width-50,'400');\r\n return;\r\n}", "function setupPage() {\n\tvar itemDetails = createDialog(\".itemDetails\" , {width: 700, height: 800, title: \"Gene List Details\"});\n\n\t//---> set default sort column\n\t$(\"table[id='geneLists']\").find(\"tr.col_title\").find(\"th\").slice(1,2).addClass(\"headerSortUp\");\n\n\tvar tableRows = getRows();\n\tstripeAndHoverTable( tableRows );\n\tclickRadioButton();\n\n\t// setup click for Gene List row item\n\ttableRows.each(function(){\n \t//---> click functionality\n \t$(this).find(\"td\").slice(0,4).click( function() {\n \t\tvar listItemId = $(this).parent(\"tr\").attr(\"id\");\n \t\t$(\"input[name='geneListID2']\").val(listItemId);\n \t\t$(\"input[name='action']\").val(\"Select Gene List\");\n \t\tdocument.tableList.submit();\n \t});\n\n \t$(this).find(\"td.details\").click( function() {\n \t\tvar geneListID = $(this).parent(\"tr\").attr(\"id\");\n \t\t$.get(contextPath + \"/web/common/formatParameters.jsp\", \n\t\t\t\t{geneListID: geneListID, \n\t\t\t\tparameterType:\"geneList\"},\n \t\tfunction(data){\n \t\t\titemDetails.dialog(\"open\").html(data);\n\t\t\t\t\tcloseDialog(itemDetails);\n \t\t});\n \t});\n\n \t//---> center text \n \t$(this).find(\"td\").slice(1,5).css({\"text-align\" : \"center\"});\n\t});\n}", "function openLibInfoPopup(action_text) {\r\n\t$.post(app_path_webroot+'SharedLibrary/info.php?pid='+pid, { action_text: action_text }, function(data){\r\n\t\t// Add dialog content\r\n\t\tif (!$('#sharedLibInfo').length) $('body').append('<div id=\"sharedLibInfo\"></div>');\r\n\t\t$('#sharedLibInfo').html(data);\r\n\t\t$('#sharedLibInfo').dialog({ bgiframe: true, modal: true, width: 650, open: function(){fitDialog(this)}, \r\n\t\t\tbuttons: { Close: function() { $(this).dialog('close'); } }, title: 'The REDCap Shared Library'\r\n\t\t});\r\n\t});\t\t\t\r\n}", "function setUpAdditionalEmails() {\r\n\t// First, load a dialog via ajax\r\n\t$.post(app_path_webroot+'Profile/set_up_emails.php',{ action: 'view' },function(data){\r\n\t\tvar json_data = jQuery.parseJSON(data);\r\n\t\tinitDialog('setUpAdditionalEmails');\r\n\t\t$('#setUpAdditionalEmails').addClass('simpleDialog').html(json_data.popupContent);\r\n\t\t$('#setUpAdditionalEmails').dialog({ bgiframe: true, modal: true, width: 600, title: json_data.popupTitle, buttons: [\r\n\t\t\t{ text: 'Cancel',click: function(){\r\n\t\t\t\t$(this).dialog('destroy');\r\n\t\t\t}},\r\n\t\t\t{ text: json_data.saveBtnTxt, click: function(){\r\n\t\t\t\tsaveAdditionalEmails();\r\n\t\t\t}}\r\n\t\t] });\r\n\t});\r\n}", "function prefListAdd(event, ui){\n $.post( \"/people/addpreference/\"+ $($('.highlight').find(\"td:nth-child(1)\")).attr('data-id'),{pub: $(ui.item).attr('data-id')});\n}", "function operationSelect(selection){\n $(modalPopupContent).html($(operations + ' .operation[data-operation='+selection+']').html());\n showPopup();\n}", "function dropDownInsert(txt , selections) {\r\n\tif(window.isIE)\r\n\t{\r\n\t\ttxtBoxInsert(txt);\r\n\t\treturn false;\r\n\t}\r\n\tvar UIX = parseInt( getUniqueID() );\r\n\tvar newID = 'qry'+UIX\r\n\tvar options = selections.split(';');\r\n\t\r\n\tvar nProps = new Object();\r\n\tnProps.id = newID;\r\n\tnProps[\"class\"] = \"qryPart\";\r\n\tnProps.className='qryPart';\r\n\taddElement( 'components_builder' , 'div' , txt , nProps );\r\n\t\r\n\tvar iProps = new Object();\r\n\tiProps.id = 'selector_'+newID;\r\n\tiProps.type = 'text';\r\n\tvar selector = addElement( newID , 'select' , null , iProps );\r\n\t\r\n\tvar props = new Object();\r\n\tprops.id = '';\r\n\tprops. value = '';\t\t\r\n\tfor(var i=0;i<options.length;i++) {\r\n\t\tprops.id = 'option_'+i+'_'+newID;\r\n\t\tprops. value = options[i];\r\n\t\taddElement( 'selector_'+newID , 'option' , options[i] , props );\r\n\t}\r\n\t\r\n\tvar aProps = new Object();\r\n\taProps.id = newID+'_closer';\r\n\taProps.href = 'javascript:;';\r\n\taProps[\"class\"] = \"closer\";\r\n\taProps.className='closer';\r\n\tvar a = addElement( newID , 'span' , 'x' , aProps );\r\n\ta.onclick = function(){ deleteItem( 'components_builder' , newID ); };\r\n}", "function pointPopup(point) { \n \tvar pSelection = null;\n \tvar popUpDiv = $('<div id=\"popUpBox\"><div>');\n \tpopUpDiv.html('<p>Please choose the type for the point: </p>');\n \tpopUpDiv.dialog({\n \t\tposition: {\n \t\t\tmy: \"top\",\n \t\t\tat: \"bottom\",\n \t\t\tof: $(\"#diagram\")\n \t\t},\n height: 200,\n modal: true,\n resizable: false,\n buttons: {\n \"Q Point\": function() {\n \tpSelection = 1;\n \tmakeSelection(point, pSelection);\n $( this ).dialog( \"close\" );\n },\n \"T Point\": function() {\n \tpSelection = 0;\n \tmakeSelection(point, pSelection);\n $( this ).dialog( \"close\" );\n }\n }\n }).css({\n \tfontSize: 'small'\n });\n \t$('.ui-button').css({\n \t\tfontSize: 'small'\n \t});\n \treturn pSelection;\n }", "function operationSelect(selection) {\n $(modalPopupContent).addClass(\"operation-data\");\n $(modalPopupContent).html($(\" .operation[data-operation-code=\" + selection + \"]\").html());\n $(modalPopupContent).data(\"operation-code\", selection);\n showPopup();\n}", "function setupSaveDisplayedGenes() {\n\tvar nameGeneList;\n\t$(\"div#btnSaveGenes\").click(function(){\n \t$.get(\"nameGeneList.jsp?geneListSource=QTL\", function(data){\n \t\tif ( nameGeneList == undefined ) {\n \t\tnameGeneList = createDialog(\"div.saveDisplayedGenes\", \n\t\t\t\t\t{ width: 720, height: 350, title: \"Save Displayed Genes\"});\n\t\t\t}\n \t\tnameGeneList.dialog(\"open\").html(data);\n \t});\n \t});\n}", "function addButton() {\r\n\ttrace(\"addButton()\");\r\n\tvar href=\"\";\r\n\tvar links=new Array();\r\n\t\r\n\tswitch(GM_getValue(\"popup_mode\", 1)) {\r\n\t\tcase 0: // popup closed\r\n\t\tcase 1: // in normal mode\r\n\t\t\tlinks=getSelectLink(eLinks);\r\n\t\t\tbreak;\r\n\t\tcase 2: // in edit mode\r\n\t\t\tvar txt = document.getElementById(\"editbox\");\r\n\t\t\tlinks=txt.value.split('\\n');\r\n\t\t\tbreak;\r\n\t\tdefault:\r\n\t\t\ttrace(\"ERROR: popup_mode=\" + GM_getValue(\"popup_mode\", 1));\r\n\t\t\talert(\"Error !!! popup_mode unknown.\");\r\n\t\t\treturn;\r\n\t}\r\n\r\n\thref = getAddLink(links);\r\n\ttrace(\"href=\"+href);\r\n\t\r\n\tif(ed2kDlMethod=='local') {\r\n\t\tfor (var i=0; i<links.length; i++) {\r\n\t\t\twindow.location.replace(links[i]);\r\n\t\t}\r\n\t}\r\n\telse {\r\n\t\tvar e_win = window.open(href, 'emule');\r\n\t\te_win.blur();\r\n\t}\r\n\t\r\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 }", "function main(args){\r\n\r\n var selectedItem = args.DOC_REF.selection[0];\r\n var selectionName;\r\n \r\n if (selectedItem.name) {\r\n // Use name\r\n selectionName = selectedItem.name;\r\n }\r\n else {\r\n // Use type because name property is empty\r\n selectionName = selectedItem.typename; \r\n }\r\n \r\n\r\n\r\n var myDialog = sfDialogFactory(mainDialog(selectionName));\r\n \r\n myDialog.show();\r\n}", "function PromptSelectActivities(SelectRole, editor, graph, child, childSpContentTypeID) {\n\tvar dialog;\n\tvar pDialog = $('#Activities');\n\t\n\tpDialog.find('option').remove().end();\n\t\n\t$(\"#dialogOffPage\").css('display', 'inherit')\n\tdialog = $(\"#dialogOffPage\").dialog({\n\t\t\tautoOpen : false,\n\t\t\theight : 200,\n\t\t\twidth : 500,\n\t\t\tmodal : true,\n\t\t\tbuttons : {\n\t\t\t\t\"OK\" : function () {\n\t\t\t\t\tvar actorSelected = pDialog.val();\n\n\t\t\t\t\tif (actorSelected)\n\t\t\t\t\t{\t\t\t\t\t\t\n\t\t\t\t\t\tvar Name = $( \"#Activities option:selected\" ).text();\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Clear attributes except for label and spContentTypeID\n\t\t\t\t\t\tvar attributes = child.value.attributes,\n\t\t\t\t\t\tattributesCount = attributes.length,\n\t\t\t\t\t\ti2 = 0;\n\t\t\t\t\t\tfor (; i2 < attributesCount; i2 += 1) {\n\t\t\t\t\t\t\tvar attributeName = attributes[i2].nodeName;\n\n\t\t\t\t\t\t\tif (attributeName === \"href\") {\n\t\t\t\t\t\t\t\tchild.setAttribute(attributes[i2].nodeName, actorSelected);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse if (attributeName === 'label') {\n\t\t\t\t\t\t\t\tchild.setAttribute(attributes[i2].nodeName, Name);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t//updates Graph\n\t\t\t\t\t\tgraph.refresh();\n\t\t\t\t\t\t\n\t\t\t\t\t\t//save changes to graph XML\n\t\t\t\t\t\tvar updateProperties = {\n\t\t\t\t\t\t\t__metadata : {\n\t\t\t\t\t\t\t\t\"type\" : spDataType\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"GraphXML\" : editor.writeGraphModel()\n\t\t\t\t\t\t};\n\t\t\t\t\t\tUpdateListItem(webAbsoluteUrl, listName, currentItemId, updateProperties);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tdialog.dialog(\"close\");\n\t\t\t\t},\n\t\t\t\tCancel : function () {\n\t\t\t\t\t// mxGraphActivityEditor(mxGraphEditor);\n\t\t\t\t\t\n\t\t\t\t\tgraph.getModel().beginUpdate();\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\t//this.fireEvent(new mxEventObject(mxEvent.AFTER_ADD_VERTEX,\"vertex\",b)))\n\t\t\t\t\t\t// Gets the subtree from cell downwards\n\t\t\t\t\t\tvar cells = [];\n\t\t\t\t\t\tgraph.traverse(child, true, function(vertex)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcells.push(vertex);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tgraph.removeCells(cells);\n\t\t\t\t\t\t//child.remove();\n\t\t\t\t\t}\n\t\t\t\t\tfinally {\n\t\t\t\t\t\tgraph.getModel().endUpdate();\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tclosedWithoutCreate = true;\n\t\t\t\t\tdialog.dialog(\"close\");\n\t\t\t\t}\n\t\t\t},\n\t\t\tclose : function () {\n\t\t\t\tgraph.refresh();\n\t\t\t\t\t\t\n\t\t\t\tdialog.dialog(\"close\");\n\t\t\t\tclosedWithoutCreate = true;\n\t\t\t}\n\t\t});\n\n\n\tvar option = $('<option/>')\n\t\t.attr('value', 'Create')\n\t\t.text('Select a Activity')\n\t\t.appendTo(pDialog);\n\tgetAllItems\n\t(\n\t\t_spPageContextInfo.webAbsoluteUrl,\n\t\tlistName,\n\t\t\"ID,Title,ContentType\",\n\t\t\"startswith(ContentTypeId,'0x0100B780648F0DD4474886F4D0C3F275B33802')\", //filter for activity CT\n\t\t200, //rowlimit\n\t\t\"Title\",\n\t\tfunction (data) {\n\t\t$.each(data.results, function (i) {\n\t\t\t\n\t\t\t//var Tooltip = GetNavigationMenuForTooltip(_spPageContextInfo.webAbsoluteUrl, listName, data.results[i].ID);\n\t\t\t\n\t\t\tvar option = $('<option/>')\n\t\t\t\t.attr('value', data.results[i].ID)\n\t\t\t\t//.attr('title', Tooltip)\n\t\t\t\t.text(data.results[i].Title)\n\t\t\t\t.appendTo(pDialog);\n\t\t});\n\t},\n\t\tfunction (error) {\n\t\talert(error);\n\t});\n\t\n\tdialog.dialog(\"open\");\n}", "function ConfirmDialog() {\n\n //MessageLog.trace(\"\\n===================ConfirmDialog\\n\")\n\n if (Find_Unexposed_Substitutions()) {\n\n var d = new Dialog\n\n d.title = \"Delete_unexposed_substitutions\";\n\n rapport = \"The following subsitutions will be deleted : \"\n\n\n for (var c = 0; c < substituions_tab.columns.length; c++) {\n\n var currentColumn = substituions_tab.columns[c];\n\n var drawing = substituions_tab.drawings[c];\n\n for (var u = 0; u < substituions_tab.substitions[c].length; u++) {\n\n var sub_to_delete = substituions_tab.substitions[c][u];\n\n rapport += \"\\n\" + drawing + \" : \" + sub_to_delete;\n }\n\n }\n\n MessageLog.trace(rapport);\n\n if (rapport.length > 500) {\n rapport = \"Sorry too much informations to display please see the MessageLog\"\n\n }\n\n MessageBox.information(rapport)\n\n\n var rc = d.exec();\n\n if (rc) {\n\n Delete_Substitutions();\n\n }\n\n\n } else {\n\n \tMessageLog.trace(rapport);\n\n if (rapport.length > 500) {\n rapport = \"Sorry too much informations to display please see the MessageLog\"\n\n }\n\n MessageBox.information(rapport);\n\n }\n\n }", "function addEditAirOperation() {\n // set up the dialog elements\n $(\"#airopzone\").text(selectedZone);\n if (editingOpIdx > -1) { //editing an existing op\n selectZone(searchGrid.zoneToTopLeftCoords(airOps[editingOpIdx].Zone));\n $(\"#airopmission\").html(getMissionOptionHtml(airOps[editingOpIdx].Mission));\n } else { //new op\n if (!getMissionOptions()) return;\n if (!getNewOp()) return;\n }\n showAirOpSources();\n \n $(\"#dlgairops\").css(\"display\", \"block\")\n .draggable({\n handle: \".floathead\",\n containment: \"#pagediv\",\n scroll: false\n });\n \n // show it\n $(\"#dlgoverlay\").css(\"display\", \"block\").focus();\n}", "function openValidityDialog(index)\r\n{\r\n\tgArrayIndex = index;\r\n\t$( \"#dlgValidity\" ).dialog( \"open\" );\r\n\t$(\"#hValidity\").text(\"Add validity details for \" + arrEntp[gArrayIndex].getEName());\t\r\n}", "function add_found(ip) {\n $(\"#site-select\").one(\"popupafterclose\", function(){\n show_addnew(ip);\n }).popup(\"close\");\n}", "function initPopup () {\n popup = AJS.ConfluenceDialog({\n width : 865,\n height: 530,\n id: \"update-page-restrictions-dialog\",\n onCancel: cancel\n });\n\n popup.addHeader(AJS.I18n.getText(\"page.perms.dialog.heading\"));\n popup.addPanel(\"Page Permissions Editor\", AJS.renderTemplate(\"page-permissions-div\"));\n popup.addButton(AJS.I18n.getText(\"update.name\"), saveClicked, \"permissions-update-button\");\n popup.addCancel(AJS.I18n.getText(\"close.name\"), cancel);\n popup.popup.element.find(\".dialog-title\").append(AJS.template.load(\"page-restrictions-help-link\"));\n\n controls = AJS.PagePermissions.Controls(permissionManager);\n var $table = $(\"#page-permissions-table\").bind(\"changed\", updateButtonsUnsavedChanges);\n table = AJS.PagePermissions.Table($table);\n permissionManager.table = table;\n }", "function appendIteneraryListPreviewConfirmation(){\n\n\t//dialog\n\tvar htm=`<h3>Travel</h3><p>Are you sure you want to add this to your itinerary?</p>\n\t\t<button class=\"btn btn-danger\" id=\"iteneraryConfirmationButton\">Yes</button> <button class=\"btn btn-default\" id=\"iteneraryConfirmationButtonCancel\">No</button>\n`\n\n\t$('#itenerary-dialog-content').hide();\n\t$('#itenerary-confirmation').html(htm)\n\n\t//scroll confirmation to top\n\tscrollDialogTop()\n\t\n\n\t//add event handler in confirmation button\n\t$('#iteneraryConfirmationButton').click(function(){\n\t\t\n\t\t$(this).html('saving . . .')\n\t\tvar that=this\n\n\n\t\t//input value\n\t\tvar origin=$('#officialTravelOrigin').val();\n\t\tvar destination=$('#officialTravelDestination').val();\n\t\tvar departure_date=$('#officialTravelDepartureDate').val();\n\t\tvar departure_time=$('#officialTravelDepartureTime').val();\n\t\tvar date=new Date();\n\t\tvar date_created=date.getFullYear()+'-'+date.getMonth()+'-'+date.getDate();\n\t\tvar driver=$('#officialTravelDriver').val();\n\n\t\tvar tr_id=form_id\n\n\t\t\n\n\t\tif(typeof $(selectedElement).attr('id')!='undefined') tr_id=$(selectedElement).attr('id');\n\t\t//json data\n\t\tvar data={\"id\":null,\"tr_id\":tr_id,\"res_id\":null,\"location\":origin,\"destination\":destination,\"departure_time\":departure_time,\"actual_departure_time\":\"00:00:00\",\"returned_time\":\"00:00:00\",\"departure_date\":departure_date,\"returned_date\":\"0000-00-00\",\"status\":\"scheduled\",\"plate_no\":null,\"driver_id\":\"0\",\"linked\":\"no\",\"date_created\":date_created,driver_id:driver,_token:$('input[name=_token]').val()}\n\n\n\n\n\n\t\t$.post('api/travel/official/itenerary',data,function(res){\n\n\t\t\ttry{\n\t\t\t\tvar id=JSON.parse(res).id;\n\t\t\t\tdata.id=id;\n\n\n\t\t\t\t//add to preview\n\t\t\t\tappendIteneraryToListPreview(data,function(data){\n\t\t\t\t\t//saved button\n\t\t\t\t\t$(that).html('saved')\n\n\t\t\t\t\t//clear form\n\t\t\t\t\t$('#officialTravelOrigin').val('');\n\t\t\t\t\t$('#officialTravelDestination').val('');\n\t\t\t\t\t$('#officialTravelDepartureDate').val('');\n\t\t\t\t\t$('#officialTravelDepartureTime').val('');\n\n\t\t\t\t\t//enabling contextmenu\n\t\t\t\t\tunbindContext();\n\t\t\t\t\tcontext();\n\n\t\t\t\t\tappendIteneraryToListPreviewCallback(data);\n\n\t\t\t\t})\n\n\n\t\t\t}catch(e){\n\t\t\t\t//alert('Something went wrong.Please try again later!');\n\t\t\t}\n\n\n\t\t}).fail(function(){\n\t\t\talert('Something went wrong.Please try again later!');\n\t\t})\n\n\t\t\t\n\n\t\t//show form\n\t\tsetTimeout(function(){\n\n\t\t\t$('#itenerary-modal').modal('hide');\n\t\t\t//clear form\n\n\t\t\t//display default view\n\t\t\t$('#itenerary-dialog-content').show();\n\t\t\t$('#itenerary-confirmation').html('')\n\t\t},900)\n\t})\n\n\n\n\t//cancel\n\t$('#iteneraryConfirmationButtonCancel').click(function(){\n\t\t//show form\n\t\tsetTimeout(function(){\n\t\t\t//display default view\n\t\t\t$('#itenerary-dialog-content').show();\n\t\t\t$('#itenerary-confirmation').html('')\n\t\t},900)\n\t});\n\n\n}", "function createServiceChoiceDialog(chosenMarker) {\n\n\tconsole.log(chosenMarker);\n\tvar chosenMarkerUserID = chosenMarker;\n\tvar chosenMarkerUser = readUser(chosenMarkerUserID);\n\tvar chosenMarkerName = chosenMarkerUser.FirstName + \" \" + chosenMarkerUser.LastName;\n\n\t//set name on dialog\n\t$('#servicesChoiceDialogName').text(chosenMarkerName);\n\n\t$.mobile.changePage(\"#page-dialog\", {\n\t\trole : \"dialog\",\n\t\tallowSamePageTransition : true\n\t});\n\n\tvar currentUser = getCurrentUser();\n\n\tvar filteredServices = [];\n\n\t$('#servicesListView').empty();\n\tif (services != null && services.length > 0) {\n\t\tfor (var i = 0; i < services.length; i++) {\n\n\t\t\tif (chosenMarkerUserID == services[i].UserID) {\n\t\t\t\tfilteredServices.push(services[i]);\n\t\t\t\t//$('#servicesListView').append('<li><a onclick=\"createServicePageWindow('+services[i]+', '+ currentUser +')\">' +services[i].Description+ '</a></li>');\n\t\t\t\t$('#servicesListView').append('<li><a onclick=\"createServicePageWindow(' + services[i].ServiceID + ', ' + currentUser.UserID + ', &quot;' + chosenMarkerName + '&quot;)\">' + services[i].Description + '</a></li>');\n\n\t\t\t}\n\t\t}\n\t}\n\t$('#servicesListView').listview('refresh');\n\n\t//$('#servicesListView').empty().append('<li><a data-rel=\"dialog\" href=\"#page-subdialog\">Test</a></li><li><a data-rel=\"dialog\" href=\"#page-subdialog\">Test2</a></li>').listview('refresh');\n\n}", "function openAddNewEntryUI() {\n var html = HtmlService.createTemplateFromFile('newEntry').evaluate()\n .setWidth(400)\n .setHeight(300);\n SpreadsheetApp.getUi()\n .showModalDialog(html, 'Add a new entry');\n}", "getSelectionData() {\n let sel = this.selection.commonAncestorContainer,\n parent = sel.tagName === \"A\" ? sel : sel.parentNode;\n if (parent.tagName === \"A\") {\n this.value.link = parent.getAttribute(\"href\");\n this.target = parent;\n } else {\n this.target = document.createElement(\"a\");\n this.target.appendChild(this.selection.extractContents());\n this.selection.insertNode(this.target);\n }\n if (!this.target.getAttribute(\"id\"))\n this.target.setAttribute(\"id\", \"prompt\" + Date.now());\n this.__style = this.style;\n this.target.style.backgroundColor = getComputedStyle(this).getPropertyValue(\n \"--rich-text-editor-selection-bg\"\n );\n this.value.text = this.target.innerHTML;\n }", "function addOption(name){\n if(name){\n var newObj = {\n name: name,\n content: \"\"\n }\n if(dialogContent.length == 0)\n newObj.content = editor.value;\n dialogContent.push(newObj); \n }\n console.log(\"ON ADD =>\");\n console.log(dialogContent);\n}", "function handleAdeLinkEvent(thisObj) {\n var i, n, a, r, c, ret, exclude, url, html, editId, deleteId;\n var args, dataElement, value;\n var h = thisObj.getHtmlIds();\n var m = thisObj.getMeta();\n\tvar v = thisObj.values;\n \n // If all of the values have been selected, then inform the user that there are no more values\n // to select instead of showing the ADE popup. Only do this if the data element does not have \n // an other value, since the user can select as many others as desired.\n if (!m.otherCui && v && v.length == m.broadVsLeafCount) {\n alert(\"There are no more values to select for this data element.\");\n return;\n }\n \n\t// Create a parameter list for the URL for the ADE popup. Add the system name of the\n\t// data element and the form definition id.\n\tvar p = $H();\n\tp.dataElementSystemName = thisObj.systemName;\n p.formDefinitionId = GSBIO.kc.data.FormInstances.getFormInstance(_formId).formDefinitionId;\n\n\t// Append the list of CUIs of values to exclude. Never include the other CUI as an excluded\n\t// CUI since the user can enter as many others as desired.\n if (m.isDatatypeCv && v) {\n\t exclude = [];\n for (i = 0, n = v.length; i < n; i++) {\n if (v[i].value != m.otherCui) {\n exclude.push(v[i].value);\n }\n }\n if (exclude.length > 0) {\n p.excludedValues = exclude;\n }\n }\n\n // Build the argument for the popup, which is our ARTS object, which the popup will use to \n // merge its ARTS concepts into.\n args = [GSBIO.ARTS];\n\n\t// Build the URL and use it to show the modal popup. If the user does not cancel the popup\n\t// a GSBIO.kc.data.DataElement will be returned with a new value for this data element and \n\t// values that were entered for all of the value's ADE elements.\n\turl = m.adePopup + '?' + p.toQueryString();\n\tret = window.showModalDialog(url, args, \"dialogWidth:700px;dialogHeight:700px;\");\n\tif (ret) {\n\t _changed = true;\n\t dataElement = ret.evalJSON();\n value = dataElement.values[0];\n a = $(h.adeTable);\n\n // If there is only a single row in the ADE table then it is the heading row, and\n // therefore this is the first data element value to be added. In this case, clear\n // any existing values of this object. One situation in which this object might \n // contain a value is when the saved value is one of the system standard values.\n if (a.rows.length == 1) {\n\t thisObj.values = null;\n }\n \n // If either the user selected the NOVAL, or the user selected a value other than the \n \t // NOVAL and the current value of this data element is the NOVAL, first delete all \n // existing values from this object and delete all rows from the ADE summary table. We \n // do this since the NOVAL is mutually exclusive with all other values. The first case \n\t // (user selected the NOVAL) is fairly obvious, and in the second case if the current value\n\t // of this data element is the NOVAL it must be the first (and only) value, so in either\n\t // case we can delete all values. Note also that the first row of the ADE table is the \n\t // heading row, so don't delete that row.\n\t if (m.noCui && ((m.noCui == value.value) || (thisObj.getValue(0) && m.noCui == thisObj.getValue(0).value))) {\n\t thisObj.values = null;\n\t h.adeEdit = null;\n\t h.adeDelete = null;\n \t for (i = a.rows.length - 1; i > 0; i--) {\n\t a.deleteRow(i);\n\t }\n }\n\n // Add the value that the user entered to this data element.\n\t v = GSBIO.kc.data.DataElementValue(value);\n\t thisObj.addValue(v);\n\t \n\t // Add a new row to the ADE summary table, and add the value of the data element in the\n\t // first cell.\n\t r = a.insertRow(a.rows.length);\n\t r.insertCell().innerHTML = thisObj.getDisplayForAdeSummaryTable(thisObj.values.length-1);\n\n // Add the value of each ADE element to subsequent cells.\n\t if (v.ade && v.ade.elements) {\n\t\tfor (i = 0, n = v.ade.elements.length; i < n; i++) {\n\t\t r.insertCell().innerHTML = v.ade.elements[i].getDisplayForAdeSummaryTable();\n\t\t}\n\t }\n\n // Add the Edit and Delete button in the last cell. We'll generate their ids here and\n // add them to this object for proper event handling when they are clicked.\n editId = GSBIO.UniqueIdGenerator.getUniqueId();\n deleteId = GSBIO.UniqueIdGenerator.getUniqueId();\n thisObj.addAdeEditId(editId);\n thisObj.addAdeDeleteId(deleteId);\n\t c = r.insertCell();\n\t c.className = 'kcElementAdeButtons';\n\t html = '<input id=\"';\n\t html += editId;\n\t html += '\" type=\"button\" class=\"kcButton\" value=\"Edit\"/>&nbsp;';\n\t html += '<input id=\"';\n\t html += deleteId;\n\t html += '\" type=\"button\" class=\"kcButton\" value=\"Delete\"/>';\n\t c.innerHTML = html;\n\n // Make sure the standard values are all cleared.\n thisObj.clearStandardValues();\n\t\t\n\t // Make sure the ADE summary table is showing.\n\t thisObj.showAde();\n\t} \n }", "function displayDuplicateContacts(selectForm, params){\n console.log('displaying duplicate contacts . . .');\n gmail.tools.add_modal_window('Duplicate Contacts found', selectForm, function(){\n params['ot_target_contact_id'] = $('input[name=\"contact_id\"]:checked').val();\n // display Activity Confirmation screen\n activityConfirmationScreen(params);\n // remove model window on Click OK\n gmail.tools.remove_modal_window();\n });\n}", "function popupDdt_add() {\n\t\n\n\tvar postData = {\n\t\t\"ddtId\": popupDdt_data.ddt.ddt_id,\n\t\t\"ddt_code\": jQuery('#popupDdt_editDdtCode').val(),\n\t\t\"ddt_date\": jQuery('#popupDdt_editDdtDate').val(),\n\t\t\"cargo\":\tjQuery('#popupDdt_editCargo').val(),\n\t\t\"notes\":\tjQuery('#popupDdt_editNotes').val()\n\t};\n\t\n\tjQuery.post(\n\t 'index.php?controller=ddt&task=jsonAdd&type=json',\n\t postData,\n\t function (data) {\n\t \t\n\t \tvar result = DMResponse.validateJson(data);\n\t \t\n\t \tif ((result != false) && (result.result >= 0)) {\n\t\t\t\tpopoupDdt_data = result.ddt;\n\t\t\t\trowData = result.ddt;\n\t\t\t\tpopupDdt_data.uniqueId = result.ddt.uniqueId;\n\t\t\t\tpopupDdt_data.ddtCode = result.ddt.ddt_code;\n\t\t\t\tpopupDdt_data.ddtCodeStr = result.ddt.ddt_code_str;\n\t\t\t\tpopupDdt_data.ddtDateStr = result.ddt.ddt_date_str;\n\t\t\t\tpopupDdt_data.cargo = result.ddt.cargo;\n\t\t\t\tpopupDdt_data.notes = result.ddt.notes;\n\t\t\t\tDMPopup.successPopup('popupDdt',rowData);\n\t\t\t\tjQuery('#popupDdt').modal(\"hide\");\n\t \t} else {\n\t \t\talert(\"Si è verificato un errore (\" + result.result + \"): \" + result.description);\n\t \t}\n\t \t\n\t }\n\t);\n\t\n}", "function ShowUpdateActionInfoDialog() {\n //get selected rows\n var checkId = $(\"#test\").datagrid('getSelections');\n if (checkId.length == 1) {\n $(\"#UpdateActionInfoDialog\").dialog('open').dialog('setTitle', 'Update Info');\n //show input\n // can decide if item is editabale/peditable/not\n // need to get current rowflag\n var selectionitem = $(\"#test\").datagrid('getSelections')[0];\n // alert(selectionitem.From_ECI);\n // get row flag\n DisplaySelectInfo(GetRowFlag(activeeci, selectionitem.From_ECI, selectionitem.To_ECI));\n } else {\n $.messager.alert(\"Alert\", \"You Have Selected <font color='red' size='6'>\" + checkId.length + \"</font> Row(s)\");\n }\n}", "function saveNewOp() {\n let newEntry = {\n date: new Date().toJSON(),\n cat: pageDialog.category.value,\n amount: pageDialog.amount.value,\n desc: pageDialog.desc.value\n };\n entriesDb.insert(newEntry);\n displayEntries();\n }", "function SP_InsertOption()\n{\n\tif(arguments.length == 4)\n\t{\n\t\tvar oCMB = arguments[2];\n\t\tvar elOptNew = document.createElement('option');\n\t\tvar pstn = arguments[3];\n\t\telOptNew.text = arguments[0];\n\t\telOptNew.value = arguments[1];\n\t\t\n\t\tif(oCMB.selectedIndex == 0)\n\t\t{\n\t\t\tvar isOptDefault = oCMB.options[0].defaultSelected;\n\t\t\tif(!isOptDefault)\n\t\t\t{\n\t\t\t\telOptNew.selected = true;\n\t\t\t}\n\t\t}\n\t\t\n\t\toCMB.options.add(elOptNew,pstn);\n\t\t\n\t}\n}", "function PromptSelectRoleOrCreate(SelectRole, editor, graph, child, childSpContentTypeID) {\n\tvar dialog;\n\tvar pDialog = $('#actors');\n\t\n\t$('#actors')\n\t\t.find('option')\n\t\t.remove()\n\t\t.end();\n\t\n\t$(\"#dialog\").css('display', 'inherit')\n\tdialog = $(\"#dialog\").dialog({\n\t\t\tautoOpen : false,\n\t\t\theight : 200,\n\t\t\twidth : 500,\n\t\t\tmodal : true,\n\t\t\tbuttons : {\n\t\t\t\t\"OK\" : function () {\n\t\t\t\t\tvar actorSelected = $('#actors').val();\n\n\t\t\t\t\tif (actorSelected === \"Create\")\n\t\t\t\t\t{\n\t\t\t\t\t\t//--------------------------------\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Clear attributes except for label and spContentTypeID\n\t\t\t\t\t\tvar attributes = child.value.attributes,\n\t\t\t\t\t\tattributesCount = attributes.length,\n\t\t\t\t\t\ti2 = 0;\n\t\t\t\t\t\tfor (; i2 < attributesCount; i2 += 1) {\n\t\t\t\t\t\t\tvar attributeName = attributes[i2].nodeName;\n\n\t\t\t\t\t\t\tif (attributeName === 'label') {\n\t\t\t\t\t\t\t\tchild.setAttribute(attributes[i2].nodeName, child.value.nodeName + '_' + Math.floor(Math.random() * (1000 - 0)) + 0);\n\t\t\t\t\t\t\t\tgraph.refresh();\n\t\t\t\t\t\t\t} else if (attributeName !== 'spContentTypeID') {\n\t\t\t\t\t\t\t\tchild.setAttribute(attributes[i2].nodeName, '');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgraph.refresh();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If child has an spContentTypeID create an associated Sharepoint list item\n\t\t\t\t\t\tif (childSpContentTypeID) {\n\t\t\t\t\t\t\tproperties = {\n\t\t\t\t\t\t\t\t\"Title\" : child.getAttribute('label'),\n\t\t\t\t\t\t\t\t\"ContentTypeId\" : childSpContentTypeID,\n\t\t\t\t\t\t\t\t\"__metadata\" : {\n\t\t\t\t\t\t\t\t\t\"type\" : spDataType\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t};\n\n\t\t\t\t\t\t\t// If an item A is dropped inside of activity B, use activity\n\t\t\t\t\t\t\t// B's spID as item A's spParentIDs value. Otherwise use the\n\t\t\t\t\t\t\t// main parent id (i.e. the activity the current page represents)\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tchild.setAttribute('spParentIDs', currentItemId);\n\t\t\t\t\t\t\tproperties['ParentIDs'] = currentItemId.toString();\n\n\t\t\t\t\t\t\t/*******************************************************************\n\t\t\t\t\t\t\tCreate a Sharepoint list item\n\t\t\t\t\t\t\t ********************************************************************/\n\t\t\t\t\t\t\tcreateListItem(webAbsoluteUrl, listName, properties,\n\t\t\t\t\t\t\t\t//Success callback\n\t\t\t\t\t\t\t\tfunction (listItem) {\n\t\t\t\t\t\t\t\tchild.setAttribute('spID', listItem.Id);\n\t\t\t\t\t\t\t\t//child.setAttribute('href', webAbsoluteUrl + '/Lists/' + listName.replace(\" \", \"%20\") + '/DispForm.aspx?ID=' + listItem.Id);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tfunction (error) {\n\t\t\t\t\t\t\t\tconsole.log(error);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tconsole.log(properties);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar updateProperties = {\n\t\t\t\t\t\t\t\t__metadata : {\n\t\t\t\t\t\t\t\t\t\"type\" : spDataType\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"GraphXML\" : editor.writeGraphModel()\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tUpdateListItem(webAbsoluteUrl, listName, currentItemId, updateProperties);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//--------------------------------\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tvar actorSelected = $('#actors').val();\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar Name = $( \"#actors option:selected\" ).text();\n\t\t\t\t\t\t\n\t\t\t\t\t\t// Clear attributes except for label and spContentTypeID\n\t\t\t\t\t\tvar attributes = child.value.attributes,\n\t\t\t\t\t\tattributesCount = attributes.length,\n\t\t\t\t\t\ti2 = 0;\n\t\t\t\t\t\tfor (; i2 < attributesCount; i2 += 1) {\n\t\t\t\t\t\t\tvar attributeName = attributes[i2].nodeName;\n\n\t\t\t\t\t\t\tif (attributeName === 'label') {\n\t\t\t\t\t\t\t\tchild.setAttribute(attributes[i2].nodeName, Name);\n\t\t\t\t\t\t\t\tgraph.refresh();\n\t\t\t\t\t\t\t} else if (attributeName !== 'spContentTypeID') {\n\t\t\t\t\t\t\t\tchild.setAttribute(attributes[i2].nodeName, '');\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgraph.refresh();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// If child has an spContentTypeID create an associated Sharepoint list item\n\t\t\t\t\t\tif (childSpContentTypeID) {\n\t\t\t\t\t\t\t// If an item A is dropped inside of activity B, use activity\n\t\t\t\t\t\t\t// B's spID as item A's spParentIDs value. Otherwise use the\n\t\t\t\t\t\t\t// main parent id (i.e. the activity the current page represents)\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tchild.setAttribute('spParentIDs', currentItemId);\n\t\t\t\t\t\t\tchild.setAttribute('spID', actorSelected);\n\t\t\t\t\t\t\t//child.setAttribute('href', webAbsoluteUrl + '/Lists/' + listName.replace(\" \", \"%20\") + '/DispForm.aspx?ID=' + actorSelected);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tconsole.log(properties);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tvar updateProperties = {\n\t\t\t\t\t\t\t\t__metadata : {\n\t\t\t\t\t\t\t\t\t\"type\" : spDataType\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\"GraphXML\" : editor.writeGraphModel()\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tUpdateListItem(webAbsoluteUrl, listName, currentItemId, updateProperties);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//--------------------------------\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tdialog.dialog(\"close\");\n\t\t\t\t},\n\t\t\t\tCancel : function () {\n\t\t\t\t\t// mxGraphActivityEditor(mxGraphEditor);\n\t\t\t\t\t\n\t\t\t\t\tgraph.getModel().beginUpdate();\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\t//this.fireEvent(new mxEventObject(mxEvent.AFTER_ADD_VERTEX,\"vertex\",b)))\n\t\t\t\t\t\t// Gets the subtree from cell downwards\n\t\t\t\t\t\tvar cells = [];\n\t\t\t\t\t\tgraph.traverse(child, true, function(vertex)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcells.push(vertex);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t});\n\t\t\t\t\t\tgraph.removeCells(cells);\n\t\t\t\t\t\t//child.remove();\n\t\t\t\t\t}\n\t\t\t\t\tfinally {\n\t\t\t\t\t\tgraph.getModel().endUpdate();\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tclosedWithoutCreate = true;\n\t\t\t\t\tdialog.dialog(\"close\");\n\t\t\t\t}\n\t\t\t},\n\t\t\tclose : function () {\n\t\t\t\tgraph.refresh();\n\t\t\t\t\t\t\n\t\t\t\tdialog.dialog(\"close\");\n\t\t\t\tclosedWithoutCreate = true;\n\t\t\t}\n\t\t});\n\n\n\tvar option = $('<option/>')\n\t\t.attr('value', 'Create')\n\t\t.text('Create a new role')\n\t\t.appendTo(pDialog);\n\tgetAllItems\n\t(\n\t\t_spPageContextInfo.webAbsoluteUrl,\n\t\tlistName,\n\t\t\"ID,Title,ContentType\",\n\t\t\"startswith(ContentTypeId,'0x0100B780648F0DD4474886F4D0C3F275B33805')\", //filter for Swimlane/role based on actor CT\n\t\t200, //rowlimit\n\t\t\"Title\",\n\t\tfunction (data) {\n\t\t$.each(data.results, function (i) {\n\t\t\tvar option = $('<option/>')\n\t\t\t\t.attr('value', data.results[i].ID)\n\t\t\t\t.text(data.results[i].Title)\n\t\t\t\t.appendTo(pDialog);\n\t\t});\n\t},\n\t\tfunction (error) {\n\t\talert(error);\n\t});\n\t\n\tdialog.dialog(\"open\");\n}", "function addFormPopUp(container, e) {\n\t\t\t\te.preventDefault()\n\t\t\t\tXenForo.ajax(\n\t\t\t\t\tadd_entry_html,\n\t\t\t\t\t{},\n\t\t\t\t\tfunction (ajaxData, textStatus) {\n\t\t\t\t\t\tif (ajaxData.templateHtml) {\n\t\t\t\t\t\t\tnew XenForo.ExtLoader(e, function() {\n\t\t\t\t\t\t\t\tXenForo.createOverlay('',ajaxData.templateHtml, '').load();\n\t\t\t\t\t\t\t\tconsole.log($(container));\n\t\t\t\t\t\t\t\t$('div.overlayHeading').text(\"Add Frag Entry\");\n\t\t\t\t\t\t\t\t$('[name=dbtc_thread_id]').val($(container).find('div#dbtc_thread_id').attr('value'));\n\t\t\t\t\t\t\t\t// id of donor is in the dbtc_username value field\n\t\t\t\t\t\t\t\t$('[name=dbtc_donor_id]').val($(container).find('div#dbtc_receiver_id').attr('value'));\n\t\t\t\t\t\t\t\t$('[name=dbtc_date]').val($(container).find('div#dbtc_date').text());\n\t\t\t\t\t\t\t\t$('[name=dbtc_parent_transaction_id]').val($(container).attr('data-id'));\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}", "function insertGeoFormOk(event) {\r\n\r\n var geoForm = $('insertGeoForm');\r\n\r\n var location = $('insertGeoLocation').value;\r\n\r\n jsonQuery(location);\r\n\r\n enableDialog(false);\r\n\r\n}", "function newLookupDialog() {\n\n // build the list of possible traits to add with a listener on selection.\n newTraitsList = CQ.Util.build({\n allowBlank : true,\n fieldLabel : CQ.I18n.getMessage('Traits to add'),\n fieldSubLabel : CQ.I18n.getMessage('select to add'),\n xtype : 'selection',\n type : 'checkbox',\n listeners : {\n selectionchanged : function(list, value, checked) {\n debug(\"Adding Trait \" + value + \" \" + checked);\n if ( checked && value && newOptionsMap[value] ) {\n // add the new trait to the availableTraits\n availableTraits[value] = newOptionsMap[value];\n newOptionsMap[value] = false;\n // remove from the newTraitsList\n updateListComponent(newTraitsList, newOptionsMap);\n // add to the current traits\n updateListComponent(selectedTraitsList, availableTraits);\n }\n }\n }\n });\n // hide it till it has some contents.\n newTraitsList.hide();\n\n // build a list of selected traits, and bind a to the checkbox click to allow removal.\n selectedTraitsList = CQ.Util.build({\n allowBlank : true,\n fieldLabel : CQ.I18n.getMessage('Current traits'),\n fieldSubLabel : CQ.I18n.getMessage('select to remove'),\n xtype : 'selection',\n type : 'checkbox',\n listeners : {\n selectionchanged : function(list, value, checked) {\n debug(\"Removeing Trait \" + value + \" \" + checked);\n if ( checked && value && availableTraits[value] ) {\n // add the new trait to the availableTraits\n newOptionsMap[value] = availableTraits[value];\n availableTraits[value] = false;\n // remove from the newTraitsList\n updateListComponent(newTraitsList, newOptionsMap);\n // add to the current traits\n updateListComponent(selectedTraitsList, availableTraits);\n }\n }\n }\n\n });\n\n // populate the list with the currently available traits (ie the original traits).\n updateListComponent(selectedTraitsList, availableTraits);\n\n var trait = null;\n var traitValue = null;\n\n // build a search box and bind blur and enter to performing the search.\n // we cant use a suggests box because the search is too slow to be usable, taking between 1s and 30s to respond.\n trait = CQ.Util.build({\n allowBlank : true,\n fieldLabel : CQ.I18n.getMessage('Trait'),\n fieldSubLabel : CQ.I18n.getMessage('enter search'),\n url : traitLookupUrl,\n name : 'q',\n xtype : 'textfield',\n listeners : {\n change : function(field, newV, oldV) {\n searchForTraits(field, newV, oldV, newTraitsList);\n traitValue = newV;\n },\n specialkey : function(field, e) {\n debug(\"Special key \");\n // e.HOME, e.END, e.PAGE_UP, e.PAGE_DOWN,\n // e.TAB, e.ESC, arrow keys: e.LEFT, e.RIGHT, e.UP, e.DOWN\n if (e.getKey() == e.ENTER) {\n var newV = trait.getValue();\n searchForTraits(trait, newV, traitValue, newTraitsList);\n traitValue = newV;\n }\n }\n }\n });\n\n var panels = CQ.Util.build({\n \"xtype\" : 'panel',\n \"layout\" : 'column',\n \"items\" : [\n {\n \"xtype\" : 'panel',\n bodyBorder : false,\n border : false,\n title : CQ.I18n.getMessage(\"Search Traits\"),\n columnWidth: 0.5,\n items : [{\n \"xtype\" : 'panel',\n layout : 'form',\n bodyBorder : false,\n border : false,\n items : [trait, newTraitsList]\n }]\n },\n {\n \"xtype\" : 'panel',\n bodyBorder : false,\n border : false,\n title : CQ.I18n.getMessage(\"Selected Traits\"),\n columnWidth: 0.5,\n items : [{\n \"xtype\" : 'panel',\n layout : 'form',\n bodyBorder : false,\n border : false,\n items : [selectedTraitsList]\n }]\n }\n ]\n });\n\n // wrap the components up in a dialog\n if ( container ) {\n // invoked by the client context, so insert ourselves into that panel\n // as there are no other hooks.\n container.removeAll();\n container.add(panels);\n // add hooks in\n container.mon(container,{\n 'beforesubmit' : function() {\n // save the state including full trait objects to the\n // traitsmanager.\n traitsManager.setAvailableTraits(availableTraits);\n // stop the container performing a reload, since we have already\n // saved and there is no need to reconfigure the control.\n // normally this would result in reloading all the js files and\n // the data from the server. This component doesnt need that.\n container.hide();\n return false;\n }\n });\n container.mon(container,{\n 'loadcontent' : function() {\n // can't use the information from the dialog since that will\n // not contain all the information needed, so have to use\n // the data from the traitsManager.\n traitsManager.getAvailableTraits(setTraitsWithRefresh);\n }\n });\n\n return {\n // empty\n };\n } else {\n var searchDialog = new CQ.Dialog({\n \"height\" : 200,\n \"width\" : 600,\n \"title\" : CQ.I18n.getMessage(\"Manage Traits\"),\n \"buttons\" : [ {\n \"text\" : CQ.I18n.getMessage(\"OK\"),\n \"handler\" : function() {\n debug(\"Saving \"+JSON.stringify(availableTraits));\n callback(availableTraits);\n }\n }, {\n \"text\" : CQ.I18n.getMessage(\"Cancel\"),\n \"handler\" : function() {\n debug(\"Cancel \"+JSON.stringify(originalTraits));\n callback(originalTraits);\n }\n } ],\n items : [panels]\n });\n // expose only the functions we want to.\n return {\n /**\n * Show the dialog.\n * @param currentAvailableTraits the available traits.\n * @param oncompleteCallback a callback function to save the selected traits.\n * called with a map of traits keyed by id callback(availableTraits)\n * @returns nothing.\n */\n show : function(currentAvailableTraits, oncompleteCallback) {\n setTraits(currentAvailableTraits);\n setCallback(oncompleteCallback);\n searchDialog.show();\n },\n /**\n * hide the dialog, but dont dispose.\n * @returns\n */\n hide : function() {\n searchDialog.hide();\n }\n };\n }\n\n\n\n } // end of constructor function.", "function OpenNewAdd(Tag) {\n try\n {\n AddpriestFlag = 0;\n RemoveStyle();\n ClearFields();\n ButtonReset();\n $('#priestPreview').attr('src', \"../img/gallery/priest.png\");\n $('#hdfPriestID').val('');\n Dynamicbutton(\"btnMain\", \"Save\", \"MainbuttonClick\");\n Dynamicbutton(\"btnReset\", \"Reset\", \"Reset\");\n document.getElementById('HeadDetails').innerText = \"Add Priest\";\n $('#PriestShowDetails').hide();\n $('#PriestEd').show();\n $('#txtPriestName').focus();\n AutoComplete();\n }\n catch(e)\n {\n noty({ type: 'error', text: e.message });\n }\n \n \n }", "click(){\n\t\t\t\tcreateAddWindow();\n\t\t\t}", "function clickedDuplicate()\n{\n\tvar selectedObj = dw.databasePalette.getSelectedNode();\n\tif (selectedObj && selectedObj.objectType==\"Connection\")\n\t{\n\t\tvar connRec = MMDB.getConnection(selectedObj.name);\n\t\tif (connRec)\n\t\t{\n\t\t\tMMDB.popupConnection(connRec,true);\n\t\t\tdw.databasePalette.refresh();\n\t\t}\n\t}\n}", "function displayPopup(){\n var add = $(\"body\").append(\"<div id='popup'></div>\");\n $(\"#popup\")\n .css(\"background-color\",\"gray\")\n .css(\"opacity\",\"1\")\n .css(\"width\",\"300px\")\n .css(\"height\",\"100px\")\n .css(\"position\",\"fixed\")\n .css(\"z-index\", \"9999999\")\n .css(\"top\",\"1em\")\n .css(\"right\",\"1em\")\n .css(\"border-radius\",\"3px\")\n .attr(\"id\",\"box\");\n\n // The \"Add Some\" button allows the user to manually add\n // the highlighted elements one by one by hovering over a\n // highlighted element.\n $(\"<center>\" + \n \"<p id='selectText'>Add all to selected table?</p>\" +\n \"<button class='popupButton' id='okButton'>Add All</button>\" +\n \"<button class='popupButton' id='addOneButton'>Add Some</button>\" + \n \"<button class='popupButton' id='cancelButton'>Deselect All</button>\" +\n \"</center>\").appendTo(\"#box\");\n}", "function initAddPDUPopup(){\n\tvar retStr = \"\";\n\tvar accSelOpt = ['Telnet','SSH','SNMP'];\n\tvar manuSelOpt = ['Raritan','TrippLite'];\n\tvar modelSelOpt = ['RPX(DPXR20-30L)','TPX2-5464'];\n\tretStr += createSelectTr('Accessibility:','selAccAddPDU',accSelOpt,'onchangeAccess()');\n\tretStr += createInputTr('ManagementIp:','inputMgmtAddPDU',1);\n\tretStr += createSelectTr('Manufacturer:','selManAddPDU',manuSelOpt);\n\tretStr += createSelectTr('Model:','selModelAddPDU',modelSelOpt);\n\tretStr += createInputTr('Username:','inputUserAddPDU',1);\n\tretStr += createInputTr('Password:','inputPassAddPDU',1);\n\tretStr += createInputTr('Read Community:','inputReadAddPDU',0);\n\tretStr += createInputTr('Write Community:','inputWriteAddPDU',0);\n\tretStr += createSelectTr('Resource Domain:','selResDomAddPDU',['Default']);\n\treturn retStr;\n\t\n}", "function popup(tab) {\n\tbrowser.pageAction.setPopup({\n\t\tpopup:\"/pages/add.html\",\n\t\ttabId:tab.id,\n\t});\n\tbrowser.pageAction.openPopup()\n}", "function _addResult( pData ) {\n var lSelectionValues;\n gWizardSelection$.append( pData.entries );\n gWizardSelection$.iconList( \"refresh\" );\n gWizardSelection$.iconList( \"setSelection\", gWizardSelection$.children().first() );\n lSelectionValues = gWizardSelection$.iconList( \"getSelectionValues\" );\n gWizardSelectionHidden$\n .val( lSelectionValues[ 0 ] )\n .trigger( \"change\" );\n } // _addResult", "function createPageEditDialog() {\n $editDialog = $('<div class=\"thr-book-page edit-page\"></div>').dialog({\n width: 'auto',\n resizable: false,\n modal: true,\n draggable: false,\n autoOpen: false,\n open: function(event, ui) {\n $(this).find('.thr-caption').inlineEdit({\n buttons: '',\n saveOnBlur: true,\n control: 'textarea',\n placeholder: $('.wlClickToEdit').html(),\n save: saveEditCaption\n });\n\n }\n });\n $editDialog.on('click', 'a.thr-back-link', function() {\n editIndex -= 1;\n //console.log('prev', editIndex);\n setupEditContent();\n return false;\n });\n $editDialog.on('click', 'a.thr-next-link', function() {\n editIndex += 1;\n //console.log('next', editIndex);\n setupEditContent();\n return false;\n });\n $editDialog.on('click', 'img.deleteIcon', deletePage);\n $editDialog.on('click', 'img.copyIcon', copyPage);\n // limit max caption length\n $editDialog.on('keyup input paste', 'textarea', function(){\n var warnLength = maxCaptionLength - 10,\n $this = $(this),\n text = $this.val() || '',\n length = text.length;\n\n $this.toggleClass('text-too-long-warn', length >= warnLength);\n $this.toggleClass('text-too-long', length >= maxCaptionLength);\n\n });\n }", "function PPT() {\r\n\r\n // The RTE.Canvas functions are javascript functions that come with SharePoint.\r\n // These functions can be found in C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\14\\TEMPLATE\\LAYOUTS\\SP.UI.RTE.Publishing.debug.js & SP.UI.RTE.debug\r\n //var storageFieldId = RTE.Canvas.currentEditableRegion();\r\n // var rteFieldText = RTE.Canvas.getEditableRegionHtml(storageFieldId, true);\r\n var options = SP.UI.$create_DialogOptions();\r\n options.title = \"Paste Plain Text\";\r\n options.width = 700;\r\n options.height = 550;\r\n options.y = getTop(550);\r\n //options.args = rteFieldText;\r\n options.url = \"/_layouts/BeenJammin.SharePoint.CustomRibbonActions/PPT.aspx\";\r\n options.dialogReturnValueCallback = Function.createDelegate(null, PPTCloseCallback);\r\n SP.UI.ModalDialog.showModalDialog(options);\r\n}", "function openNewImageDialog(title, onInsert, isMultiple){\r\n\t\t\r\n\t\topenNewMediaDialog(title, onInsert, isMultiple, \"image\");\r\n\t\t\r\n\t}", "function InsertAudio() {\r\n\r\n var options = SP.UI.$create_DialogOptions();\r\n options.title = \"Please input a text and address\";\r\n options.width = 400;\r\n options.height = 200;\r\n options.y = getTop(200);\r\n options.args = getSelectedText();\r\n options.url = \"/_layouts/BeenJammin.SharePoint.CustomRibbonActions/EmbededAudio.aspx\";\r\n options.dialogReturnValueCallback = Function.createDelegate(null, LinkCloseCallback);\r\n SP.UI.ModalDialog.showModalDialog(options);\r\n\r\n}", "function openDialog(val){\r\n var check = document.getElementById('rem_perm');\r\n var remObject = document.getElementById('remObject');\r\n check.checked = \"\";\r\n remObject.innerHTML = \"\";\r\n remObject.appendChild(document.createTextNode(val));\r\n remObject.setAttribute(\"title\",val);\r\n $('#choiseGroup').dialog('open');\r\n}", "function dismissAddAnotherPopup(win, newId, newRepr) {\n // Original.\n newId = html_unescape(newId);\n newRepr = html_unescape(newRepr);\n var name = windowname_to_id(win.name);\n var elem = document.getElementById(name);\n if (elem) {\n if (elem.nodeName == 'SELECT') {\n var o = new Option(newRepr, newId);\n elem.options[elem.options.length] = o;\n o.selected = true;\n } else if (elem.nodeName == 'INPUT') {\n if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 \n && elem.value) {\n elem.value += ',' + newId;\n } else {\n elem.value = newId;\n }\n }\n } else {\n var toId = name + \"_to\";\n elem = document.getElementById(toId);\n var o = new Option(newRepr, newId);\n SelectBox.add_to_cache(toId, o);\n SelectBox.redisplay(toId);\n }\n win.close();\n // Added change event trigger.\n $(elem).trigger('change');\n}", "function InsertSpecialOffer()\n{\n /**\n Open the panel NewSpecialOffer\n */\n CreateSpecialOfferPanel('', '', COMMAND_INSERT);\n}", "function showCommissionTypes(objTextBox, objDescription)\r\n{\r\n objCommissionTypeInvokerTextBox = objTextBox;\r\n objCommissionTypeInvokerLabel = objDescription;\r\n openModalDialog('../popup/cm_commission_type_search_listing.htm',screen.width-50,'400');\r\n \r\n return;\r\n}", "function createRelocationPrompt() {\n let relocationDiv = $('<div id=\"relocation-selection-div\"></div>');\n $(relocationDiv).addClass('list-item-reloaction-div');\n let categories = $('#todo-list-categories').attr('value');\n let categorieNames = categories.split(';');\n\n let activeTabName = getActiveTabName();\n\n categorieNames.forEach(function (name) {\n\n if (name != activeTabName) {\n let buttonDiv = $('<div></div>');\n let button = $('<button val=\"' + name + '\" type=\"button\">' + name + '</button>');\n $(button).addClass(\"btn\");\n $(button).addClass(\"btn-default\");\n $(button).addClass(\"btn-block\");\n\n $(buttonDiv).append(button);\n $(relocationDiv).append(buttonDiv);\n\n $(button).click(function () {\n moveListItemTo(relocationDiv, name, activeTabName)\n });\n }\n });\n\n let cancelButtonDiv = $('<div></div>');\n let cancelButton = $('<button val=\"Cancel\" type=\"button\">Cancel</button>');\n $(cancelButton).addClass(\"btn\");\n $(cancelButton).addClass(\"btn-default\");\n $(cancelButton).addClass(\"btn-block\");\n $(cancelButtonDiv).append(cancelButton);\n $(relocationDiv).append(cancelButtonDiv);\n\n $(cancelButton).click(function () {\n $(relocationDiv).hide();\n });\n\n $(document.body).append(relocationDiv);\n }", "function optionsDialog(){ \n \n this.getPages = function(){\n var iDialogTemplate1 = Dialogs.createNewDialogTemplate(600, 280, \"Select objects and attributes\") \n \n iDialogTemplate1.CheckBox(20, 30, 300, 15, \"Include objects in assigned models\", \"CHECKBOX_1\"); \n \n iDialogTemplate1.Text(110, 85, 100, 16, \"Attributes\");\n iDialogTemplate1.ListBox(20, 100, 230, 80, [], \"attributes\"); \n \n iDialogTemplate1.Text(410, 85, 100, 16, \"Selected Attribute\"); \n iDialogTemplate1.ListBox(350, 100, 230, 80, [], \"selected_attributes\"); \n \n iDialogTemplate1.PushButton(260, 135, 80, 15, \"Add -->\", \"ADD_BUTTON_ATTR\"); \n iDialogTemplate1.PushButton(260, 160, 80, 15, \"X Remove\", \"REMOVE_BUTTON_ATTR\"); \n \n iDialogTemplate1.Text(110, 185, 100, 16, \"Objects\");\n iDialogTemplate1.ListBox(20, 200, 230, 80, [], \"objects\"); \n \n iDialogTemplate1.Text(410, 185, 100, 16, \"Selected Objects\"); \n iDialogTemplate1.ListBox(350, 200, 230, 80, [], \"selected_objects\"); \n \n iDialogTemplate1.PushButton(260, 235, 80, 15, \"Add -->\", \"ADD_BUTTON\"); \n iDialogTemplate1.PushButton(260, 260, 80, 15, \"X Remove\", \"REMOVE_BUTTON\"); \n \n return [iDialogTemplate1];\n } \n \n this.init = function(aPages){ \n \n //** Attributes\n this.as_Attributes = []; // all attributes from the adidas filter\n this.as_SelectedAttr = []; \n this.an_AttributesToExport = []; \n \n var an_allAtrsOfGroup = g_oAdidasFilter.AttrTypesOfAttrGroup(AT_ADIDAS_ATTRIBUTES_GENERAL, true); \n \n for(var i=0; i<an_allAtrsOfGroup.length; i++){\n var s_AttrNameAndTypeNum = g_oAdidasFilter.AttrTypeName(an_allAtrsOfGroup[i]) + \" ( \" + an_allAtrsOfGroup[i] + \" ) \"; \n this.as_Attributes.push(s_AttrNameAndTypeNum); \n }\n \n //** Objects\n this.ao_SelectedObjects = [];\n this.ao_ObjectsToExport = []; \n \n // Get objects \n this.updateOjects(); \n \n this.dialog.getPage(0).getDialogElement(\"attributes\").setItems(this.as_Attributes.sort()); \n }\n \n // returns true if the page is in a valid state. In this case \"Ok\", \"Finish\", or \"Next\" is enabled.\n // called each time a dialog value is changed by the user (button pressed, list selection, text field value, table entry, radio button,...)\n // pageNumber: the current page number, 0-based \n this.isInValidState = function(pageNumber){\n this.updateValidity(); \n return this.b_Valid; \n }\n \n \n this.b_Valid = false; // OK button grayed out at first \n \n \n this.updateValidity = function() \n { \n if(this.an_AttributesToExport.length > 0 && this.ao_ObjectsToExport.length > 0 ){\n this.b_Valid = true; \n }else{\n this.b_Valid = false; \n } \n }\n \n // called when the page is displayed\n // pageNumber: the current page number, 0-based\n // optional \n this.onActivatePage = function(pageNumber)\n {\n }\n \n // returns true if the \"Finish\" or \"Ok\" button should be visible on this page.\n // pageNumber: the current page number, 0-based\n // optional. if not present: always true\n this.canFinish = function(pageNumber)\n { \n // OK button is grayed out at first \n // if objects and attributes have been chosen it is aktiv again \n this.updateValidity(); \n return this.b_Valid; \n }\n \n // returns true if the user can switch to another page.\n // pageNumber: the current page number, 0-based\n // optional. if not present: always true\n this.canChangePage = function(pageNumber)\n {\n return true;\n }\n \n // returns true if the user can switch to next page.\n // called when the \"Next\" button is pressed and thus not suitable for activation/deactivation of this button\n // can prevent the display of the next page\n // pageNumber: the current page number, 0-based\n // optional. if not present: always true\n this.canGotoNextPage = function(pageNumber)\n {\n return true;\n }\n \n // returns true if the user can switch to previous page.\n // called when the \"Back\" button is pressed and thus not suitable for activation/deactivation of this button\n // can prevent the display of the previous page\n // pageNumber: the current page number, 0-based\n // optional. if not present: always true\n this.canGotoPreviousPage = function(pageNumber)\n {\n return true;\n }\n \n // called after \"Ok\"/\"Finish\" has been pressed and the current state data has been applied\n // can be used to update your data\n // pageNumber: the current page number\n // bOK: true=Ok/finish, false=cancel pressed\n // optional\n this.onClose = function(pageNumber, bOk)\n { \n if(!bOk){\n g_bCanceled = true; \n } \n }\n \n \n // the result of this function is returned as result of Dialogs.showDialog(). Can be any object.\n // optional\n this.getResult = function()\n { \n var s_attrGUID = \"\"; \n var s_attrAPIName = \"\"; \n var n_attrNum = Number(getAttrNum(this.as_SelectedAttr)); \n \n try{\n s_attrGUID = g_oAdidasFilter.UserDefinedAttributeTypeGUID(n_attrNum); \n s_attrAPIName = g_oAdidasFilter.getOriginalAttrTypeName(n_attrNum); \n }catch(e){} \n \n return {objects: this.ao_ObjectsToExport, attr: this.as_SelectedAttr, attrGUID: s_attrGUID, attrAPIName: s_attrAPIName }; \n }\n \n \n this.CHECKBOX_1_selChanged = function (newSelection)\n {\n this.updateOjects();\n }\n \n \n this.updateOjects = function() { \n var b_includeAssignments = this.dialog.getPage(0).getDialogElement(\"CHECKBOX_1\").isChecked(); \n if(b_includeAssignments){\n this.ao_Objects = getObjsInAssignedModels(g_oModel); \n }else{\n this.ao_Objects = g_oModel.ObjDefList(); \n } \n this.dialog.getPage(0).getDialogElement(\"objects\").setItems(showObjNameAndType(this.ao_Objects)); \n }\n \n \n this.ADD_BUTTON_ATTR_pressed = function()\n { \n var a_nValueIndex = this.dialog.getPage(0).getDialogElement(\"attributes\").getSelection();\n \n if(a_nValueIndex != null && a_nValueIndex.length > 0){ \n var attribute = this.as_Attributes[a_nValueIndex];\n if (!itemExists(this.as_SelectedAttr, attribute) && this.as_SelectedAttr.length == 0 ){ \n this.as_SelectedAttr.push(attribute);\n this.an_AttributesToExport.push(attribute); \n this.dialog.getPage(0).getDialogElement(\"selected_attributes\").setItems(this.as_SelectedAttr); \n }\n }\n this.updateValidity(); \n }\n \n \n this.REMOVE_BUTTON_ATTR_pressed = function()\n { \n var a_nValueIndex = this.dialog.getPage(0).getDialogElement(\"selected_attributes\").getSelection(); \n if(a_nValueIndex != null && a_nValueIndex.length > 0){ \n this.as_SelectedAttr.splice(a_nValueIndex[0], 1); \n this.an_AttributesToExport.splice(a_nValueIndex[0], 1); \n this.dialog.getPage(0).getDialogElement(\"selected_attributes\").setItems(this.as_SelectedAttr); \n }\n this.updateValidity(); \n } \n \n \n this.ADD_BUTTON_pressed = function()\n { \n var a_nValueIndex = this.dialog.getPage(0).getDialogElement(\"objects\").getSelection();\n \n if(a_nValueIndex != null && a_nValueIndex.length > 0){ \n var objectObjDef = this.ao_Objects[a_nValueIndex];\n if (!itemExists(this.ao_SelectedObjects, objectObjDef)){ \n this.ao_SelectedObjects.push(objectObjDef);\n this.ao_ObjectsToExport.push(objectObjDef);\n this.dialog.getPage(0).getDialogElement(\"selected_objects\").setItems(showObjNameAndType(this.ao_SelectedObjects));\n }\n }\n this.updateValidity(); \n }\n\n\n this.REMOVE_BUTTON_pressed = function()\n { \n var a_nValueIndex = this.dialog.getPage(0).getDialogElement(\"selected_objects\").getSelection(); \n if(a_nValueIndex != null && a_nValueIndex.length > 0){ \n this.ao_SelectedObjects.splice(a_nValueIndex[0], 1); \n this.ao_ObjectsToExport.splice(a_nValueIndex[0], 1); \n \n this.dialog.getPage(0).getDialogElement(\"selected_objects\").setItems(showObjNameAndType(this.ao_ObjectsToExport)); \n }\n this.updateValidity(); \n } \n \n // other methods (all optional):\n // - [ControlID]_pressed(),\n // - [ControlID]_focusChanged(boolean lost=false, gained=true)\n // - [ControlID]_changed() for TextBox and DropListBox\n // - [ControlID]_selChanged(int newSelection)\n // - [ControlID]_cellEdited(row, column) for editable tables, row and column are 0-based\n // SEARCH_BUTTON\n}", "function copyInfoToModal(emp) {\n $('#TextBoxTitle').val(emp.Title);\n $('#TextBoxFirstname').val(emp.Firstname);\n $('#TextBoxLastname').val(emp.Lastname);\n $('#TextBoxPhone').val(emp.Phoneno);\n $('#TextBoxEmail').val(emp.Email);\n $('#CheckBoxIsTech').val(emp.IsTech);\n loadDepartmentDDL(emp.DepartmentId);\n $('#HiddenId').val(emp.Id);\n $('#HiddenEntity').val(emp.Entity64);\n $('#HiddenPic').val(emp.StaffPicture64);\n}", "function _fnOnRowSuratKeluar(event) {\n var id = fnGetCellID($('tr.' + properties.sSelectedRowClass + ' td', oTable)[0]);\n\t\t\topWidth = 1050;\n\t\t\topHeight = 550;\n\t\t\topUrl = 'pop_entry_surat_keluar_insert.php?reqJsonId='+id;\n\t\t\tvar left = (screen.width/2)-(opWidth/2);\n\t\t\tvar top = (screen.height/2)-(opHeight/2);\n\t\t\tnewWindow = window.open(opUrl, \"\", \"width = \" + opWidth + \"px, height = \" + opHeight + \"px, resizable = 1, scrollbars, top=\"+top+\", left=\"+left);\n\t\t\tnewWindow.focus();\t\t\t\n }", "function popupAccept(){\n\n ErrorModule.hideErrors();\n PopupModule.show(popupElements.acceptBlock, \"Accept\");\n selectedCar = this.dataset.car;\n }", "function onSelectAut1(event, ui){\n\t// Memorizes author id from the completer list in the hidden form field author1id\n\t$(\"#author1id\").val(ui.item ? ui.item.id : \"\");\n}", "@action\n insert() {\n this.error = undefined;\n const { participants, absentees } = this.collectParticipantsAndAbsentees();\n const info = {\n chairman: this.chairman,\n secretary: this.secretary,\n participants,\n absentees,\n };\n if (absentees.includes(this.chairman)) {\n this.error = this.intl.t(\n 'participation-list-modal.chairman-absent-error',\n );\n return;\n }\n this.args.onSave(info);\n this.args.onCloseModal();\n }", "function initPopup () {\n if (popup) return;\n\n popup = AJS.ConfluenceDialog({\n width : 865,\n height: 530,\n id: \"update-page-restrictions-dialog\",\n onCancel: cancel\n });\n\n popup.addHeader(AJS.I18n.getText(\"page.perms.dialog.heading\"));\n popup.addPanel(\"Page Permissions Editor\", AJS.renderTemplate(\"page-permissions-div\"));\n popup.addButton(AJS.params.statusDialogUpdateButtonLabel || AJS.I18n.getText(\"update.name\"), saveClicked, \"permissions-update-button\");\n popup.addButton(AJS.params.statusDialogCancelButtonLabel || AJS.I18n.getText(\"cancel.name\"), cancel, \"permissions-cancel-button\");\n popup.popup.element.find(\".button-panel\").append(AJS.renderTemplate(\"page-restrictions-help-link\"));\n // $(\"#update-page-restrictions-dialog .button-panel\").append($(\"#permissions-inherited-warning\"));\n\n controls = AJS.PagePermissions.Controls(permissionManager);\n table = AJS.PagePermissions.Table($(\"#page-permissions-table\"));\n permissionManager.table = table;\n }", "function initAddSubjectDialog() {\n //there's only one add subject button\n $(\".add_subj_dialog\").dialog({\n closeOnEscape: true,\n title: \"Add Subject\", \n draggable: true, \n resizable: false, \n modal: true, \n autoOpen: false,\n });\n}", "function contextMenuFormula(action, el, pos) {\r\n\r\n switch (action) {\r\n case \"addFormulafact\":\r\n {\r\n\r\n var foldersubId=el.attr(\"id\");\r\n // alert('in alert '+foldersubId)\r\n document.getElementById(\"roleFormulaDialog\").innerHTML = \"<iframe width=500 height=500 frameborder=0 src=busRoleAddFormula.jsp?foldertabId=\"+foldersubId+\"></iframe>\";\r\n $('#roleFormulaDialog').dialog('open');\r\n\r\n break;\r\n }\r\n\r\n }\r\n }", "function OpenDialog_Upd_CategoryLevel1(IDCategoryLevel1) {\n var title = \"\";\n var width = 1200;\n var height = 900;\n if ($(\"#PositionShowDialog\").length <= 0) {\n $(\"body\").append('<div id=\"PositionShowDialog\" style=\"display:none; overflow-x:hidden; overflow-y:scroll;\" title=\"' + title + '\"></div>');\n }\n\n Fill_CategoryLevel1_Dialog_Upd(IDCategoryLevel1);\n\n $(\"#PositionShowDialog\").dialog({\n modal: true,\n width: width,\n //open: setTimeout('Change_TextareaToTinyMCE_OnPopup(\"#txt_InfoAlbumLang1\")', 2000), // Cần phải có settimeout,\n \n height: height,\n resizable: false,\n show: {\n effect: \"clip\",\n duration: 1000\n },\n hide: {\n effect: \"explode\",\n duration: 1000\n },\n\n buttons: {\n 'Đóng': function () {\n $(this).dialog('close');\n },\n 'Sửa': function () {\n //Save_Multi_TinyMCE(\"txt_Info_Lang\", sys_NumLang);\n Upd_CategoryLevel1(IDCategoryLevel1);\n \n $(this).dialog('close');\n }\n },\n close: function () {\n\n }\n });\n}", "function openPagePropertiesDialog(){\r\n\t\t\r\n\t\tvar selectedItem = g_objItems.getSelectedItem();\r\n\t\tvar pageTitle = selectedItem.data(\"title\");\r\n\t\tvar layoutID = selectedItem.data(\"id\");\r\n\t\tvar dialogID = \"uc_dialog_addon_properties\";\r\n\t\t\t\t\r\n\t\tvar options = {\r\n\t\t\t\tminWidth: 900,\r\n\t\t\t\ttitle:\"Edit Page: \"+pageTitle\r\n\t\t};\r\n\t\t\r\n\t\tvar objDialog = jQuery(\"#\" + dialogID);\r\n\t\tg_ucAdmin.validateDomElement(objDialog, \"dialog properties\");\r\n\t\t\r\n\t\tvar objLoader = objDialog.find(\".uc-settings-loader\");\r\n\t\tg_ucAdmin.validateDomElement(objLoader, \"loader\");\r\n\t\t\r\n\t\t\r\n\t\tvar objContent = objDialog.find(\".uc-settings-content\");\r\n\t\tg_ucAdmin.validateDomElement(objContent, \"content\");\r\n\t\t\r\n\t\tobjContent.html(\"\").hide();\r\n\t\tobjLoader.show();\r\n\t\t\r\n\t\t\t\t\r\n\t\tg_ucAdmin.openCommonDialog(\"#uc_dialog_addon_properties\", function(){\r\n\t\t\t\r\n\t\t\tvar data = {\"id\":layoutID};\r\n\t \r\n\t\t\tdata = addCommonAjaxData(data);\t\r\n\t\t\t\r\n\t\t\tg_ucAdmin.ajaxRequest(\"get_layouts_params_settings_html\", data, function(response){\r\n\t\t\t\t\r\n\t\t\t\tobjLoader.hide();\r\n\t\t\t\tobjContent.show().html(response.html);\r\n\t\t\t\t\r\n\t\t\t\t//init settings\r\n\t\t\t\tvar objSettingsWrapper = objContent.find(\".unite_settings_wrapper\");\r\n\t\t\t\tg_ucAdmin.validateDomElement(objSettingsWrapper, \"page properties settings wrapper\");\r\n\t\t\t\t\r\n\t\t\t\tg_settingsPageProps = new UniteSettingsUC();\r\n\t\t\t\tg_settingsPageProps.init(objSettingsWrapper);\r\n\t\t\t\t\r\n\t\t\t});\r\n\t\t\t\t\t\t\r\n\t\t} ,options);\r\n\t\t\r\n\t}", "function showDuplicateMsg() {\n $(\"#worning-duplicate\").dialog(\"open\");\n }", "function addEmail(url = gContextMenu.linkURL) {\n var addresses = getEmail(url);\n window.openDialog(\n \"chrome://messenger/content/addressbook/abNewCardDialog.xhtml\",\n \"\",\n \"chrome,resizable=no,titlebar,modal,centerscreen\",\n { primaryEmail: addresses }\n );\n}", "function settingDialog(exportInfo) {\r\n\r\n dlgMain = new Window(\"dialog\", strTitle);\r\n\r\n\tdlgMain.orientation = 'column';\r\n\tdlgMain.alignChildren = 'left';\r\n\t\r\n\t// -- top of the dialog, first line\r\n dlgMain.add(\"statictext\", undefined, strLabelDestination);\r\n\r\n\t// -- two groups, one for left and one for right ok, cancel\r\n\tdlgMain.grpTop = dlgMain.add(\"group\");\r\n\tdlgMain.grpTop.orientation = 'row';\r\n\tdlgMain.grpTop.alignChildren = 'top';\r\n\tdlgMain.grpTop.alignment = 'fill';\r\n\r\n\t// -- group contains four lines\r\n\tdlgMain.grpTopLeft = dlgMain.grpTop.add(\"group\");\r\n\tdlgMain.grpTopLeft.orientation = 'column';\r\n\tdlgMain.grpTopLeft.alignChildren = 'left';\r\n\tdlgMain.grpTopLeft.alignment = 'fill';\r\n\t\r\n\t// -- the second line in the dialog\r\n\tdlgMain.grpSecondLine = dlgMain.grpTopLeft.add(\"group\");\r\n\tdlgMain.grpSecondLine.orientation = 'row';\r\n\tdlgMain.grpSecondLine.alignChildren = 'center';\r\n\r\n dlgMain.etDestination = dlgMain.grpSecondLine.add(\"edittext\", undefined, exportInfo.destination.toString());\r\n dlgMain.etDestination.preferredSize.width = StrToIntWithDefault( stretDestination, 160 );\r\n\r\n dlgMain.btnBrowse= dlgMain.grpSecondLine.add(\"button\", undefined, strButtonBrowse);\r\n dlgMain.btnBrowse.onClick = btnBrowseOnClick;\r\n\r\n // -- the third line in the dialog\r\n dlgMain.grpThirdLine = dlgMain.grpTopLeft.add(\"statictext\", undefined, strLabelStyle);\r\n\r\n // -- the fourth line in the dialog\r\n dlgMain.etStyle = dlgMain.grpTopLeft.add(\"edittext\", undefined, exportInfo.style.toString());\r\n dlgMain.etStyle.alignment = 'fill';\r\n dlgMain.etStyle.preferredSize.width = StrToIntWithDefault( stretDestination, 160 );\r\n\r\n\t// -- the fifth line in the dialog\r\n dlgMain.cbSelection = dlgMain.grpTopLeft.add(\"checkbox\", undefined, strCheckboxSelectionOnly);\r\n dlgMain.cbSelection.value = exportInfo.selectionOnly;\r\n\r\n\t// the right side of the dialog, the ok and cancel buttons\r\n\tdlgMain.grpTopRight = dlgMain.grpTop.add(\"group\");\r\n\tdlgMain.grpTopRight.orientation = 'column';\r\n\tdlgMain.grpTopRight.alignChildren = 'fill';\r\n\t\r\n\tdlgMain.btnRun = dlgMain.grpTopRight.add(\"button\", undefined, strButtonRun );\r\n dlgMain.btnRun.onClick = btnRunOnClick;\r\n\r\n\tdlgMain.btnCancel = dlgMain.grpTopRight.add(\"button\", undefined, strButtonCancel );\r\n dlgMain.btnCancel.onClick = function() { \r\n\t\tvar d = this;\r\n\t\twhile (d.type != 'dialog') {\r\n\t\t\td = d.parent;\r\n\t\t}\r\n\t\td.close(cancelButtonID); \r\n\t}\r\n\r\n\tdlgMain.defaultElement = dlgMain.btnRun;\r\n\tdlgMain.cancelElement = dlgMain.btnCancel;\r\n\r\n\tdlgMain.grpBottom = dlgMain.add(\"group\");\r\n\tdlgMain.grpBottom.orientation = 'column';\r\n\tdlgMain.grpBottom.alignChildren = 'left';\r\n\tdlgMain.grpBottom.alignment = 'fill';\r\n \r\n dlgMain.pnlHelp = dlgMain.grpBottom.add(\"panel\");\r\n dlgMain.pnlHelp.alignment = 'fill';\r\n\r\n dlgMain.etHelp = dlgMain.pnlHelp.add(\"statictext\", undefined, strHelpText, {multiline:true});\r\n dlgMain.etHelp.alignment = 'fill';\r\n\r\n // in case we double clicked the file\r\n app.bringToFront();\r\n\r\n dlgMain.center();\r\n \r\n var result = dlgMain.show();\r\n \r\n if (cancelButtonID == result) {\r\n return result;\r\n }\r\n \r\n // get setting from dialog\r\n exportInfo.destination = dlgMain.etDestination.text;\r\n exportInfo.style = dlgMain.etStyle.text;\r\n exportInfo.selectionOnly = dlgMain.cbSelection.value;\r\n\r\n return result;\r\n}", "function clickEntry() {\n //alert($(\".LaneAssign\").data(\"id\"));\n //alert($(this).data(\"id\"));\n ////$(\"#themodal\").modal(\"show\");\n\n //$(this).effect('explode', 500, function() {\n //\t$(this).remove();\n //});\n return false;\n }", "function showpopupimageselection(){\n\t\t$('#imageselectionpopupmenu').popup('open');\n\t}", "function copyInfoToModal(emp) {\n $(\"#TextBoxTitle\").val(emp.Title);\n $(\"#TextBoxFirstname\").val(emp.Firstname);\n $(\"#TextBoxLastname\").val(emp.Lastname);\n $(\"#TextBoxPhone\").val(emp.Phoneno);\n $(\"#TextBoxEmail\").val(emp.Email);\n $(\"#HiddenId\").val(emp.EmployeeId);\n $(\"#HiddenEntity\").val(emp.Entity64);\n loadDepartmentDDL(emp.DepartmentId);\n}", "function insertDialogNode(ret,callback)\r\n{\r\n if (requestStack[ret][1].readyState == 4)\r\n {\r\n // If dialog retrieved successfuly\r\n if(requestStack[ret][1].status == 200)\r\n {\r\n httpResponseText = requestStack[ret][1].responseText;\r\n dialogInnerHTML=document.getElementById('dialogSpace').innerHTML;\r\n document.getElementById('dialogSpace').innerHTML=httpResponseText;\r\n document.getElementById('dialogTr').childNodes[1].setAttribute('id',dialogName);\r\n if (callback!=null)callback();\r\n /*if (dialogCache[dialogName]==''){\r\n alert('caching dialog');\r\n dialogCache[dialogName].HTML=httpResponseText;\r\n dialogCache[dialogName].callback=callback;\r\n }\r\n else {\r\n alert('dialog in cache'+dialogCache[dialogName].HTML+' '+dialogCache[dialogName].callback);\r\n } */\r\n removeRequestStack(ret);\r\n }\r\n else\r\n {\r\n displayError(eval(ErrorList[\"dialogRetrieve\"]));\r\n }\r\n }\r\n}", "function clickedOK()\n{\n var anAjaxDataTable = new ajaxDataTable(\"\",\"\",_LIST_SPRY_ODD_CLASSES.get(),_LIST_SPRY_EVEN_CLASSES.get(),_LIST_SPRY_HOVER_CLASSES.get(),_LIST_SPRY_SELECT_CLASSES.get());\n \n var colList = _TREELIST_AJAX_COLS.getRowValue('all');\n \n if (colList.length)\n {\n //set the current row behavior\n anAjaxDataTable.setColumnList(colList);\n anAjaxDataTable.setCurrentRowBehavior(_SET_CUR_BEHAVIOR_CHECKBOX.getCheckedState());\n \n INSERT_OPTIONS_OBJ.setOptions({ajaxDataTable: anAjaxDataTable});\n \n // save the data set url, root element and all columns names to detect \n // at insertion time if the actual data set is the same as the \n // one used when the user customized this insert option\n INSERT_OPTIONS_OBJ.setDatasetURL(DS_DESIGN_TIME_OBJ.getDataSetURL());\n INSERT_OPTIONS_OBJ.setRootElement(DS_DESIGN_TIME_OBJ.getRootElement());\n INSERT_OPTIONS_OBJ.setDatasetColumnsNames(DS_DESIGN_TIME_OBJ.getColumnNames());\n \n dwscripts.setCommandReturnValue(INSERT_OPTIONS_OBJ);\n }\n \n window.close();\n}", "function areYouSure(){\n\t\t$(\"#stage\").append('<div id=\"dialog-removeContent\" title=\"Remove this item from the page.\"><p class=\"validateTips\">Are you sure that you want to remove this item from your page? Selecting \"Remove\" will also remove all button links to this branch.<br/><br/>This cannot be undone!</div>');\n\n\t $(\"#dialog-removeContent\").dialog({\n modal: true,\n width: 550,\n close: function (event, ui) {\n $(\"#dialog-removeContent\").remove();\n },\n buttons: {\n Cancel: function () {\n $(this).dialog(\"close\");\n },\n Remove: function(){\n\t removeOption();\n\t $(this).dialog(\"close\");\n }\n }\n });\n\t}", "function initializeNewProblemDialog() {\r\n\t/** tab initialisation * */\r\n\tjQuery(\".tabContent\").hide();\r\n\tjQuery(\"ul.tabNavigation li:first\").addClass(\"selected\").show();\r\n\tjQuery(\".tabContent:first\").show();\r\n\tjQuery('ul.tabNavigation li').click(function() {\r\n\t\tjQuery(\"ul.tabNavigation li\").removeClass(\"selected\");\r\n\t\tjQuery(this).addClass(\"selected\");\r\n\t\tjQuery(\".tabContent\").hide();\r\n\t\tvar activeTab = jQuery(this).find(\"a\").attr(\"href\");\r\n\t\t$(activeTab).slideDown();\r\n\t\treturn false;\r\n\t}).filter(':first').click();\r\n\t\r\n\t/** Error initialisation* */\r\n\tif(jQuery(\"#departureDate\").val().length == 0) jQuery(\"#departureDate\").addClass(\"error\");\r\n\tif(jQuery(\"#departureDate1\").val().length == 0) jQuery(\"#departureDate1\").addClass(\"error\");\r\n\r\n\t/** dialog box initialisation * */\r\n\tjQuery(\"#newProblem\").dialog( {\r\n\t\tautoOpen : false,\r\n\t\theight : 400,\r\n\t\twidth : 450,\r\n\t\tresizable : false,\r\n\t\tmodal : true,\r\n\t\tbuttons : {\r\n\t\t\t'OK' : function() {\r\n\t\t\t\tvar b; // {Boolean}\r\n\t\t\t\tb = addProblem();\r\n\t\t\t\tif (b) jQuery(this).dialog('close');\r\n\t\t\t},\r\n\t\t\t'Annuler' : function() {\r\n\t\t\t\tjQuery(this).dialog('close');\r\n\t\t\t}\r\n\t\t},\r\n\t\tclose : function() {\r\n\t\t}\r\n\t});\r\n}", "function popDialog(name, callback)\r\n{\r\n dialogName=\"dialog\"+name;\r\n\r\n var url = \"./dialogs/dialog\"+name+\".jsp\"+urlQuery;\r\n displayCache();\r\n var ret=addRequestStack(url);\r\n urlQuery=\"\";\r\n XMLHTTPRequest(ret,function() {insertDialogNode(ret,callback);}, true);\r\n return false;\r\n}", "function Move_value_to_modal(){\n $(\"#Titre_Tach\").val($(\"#Titre-de-la-tache\").val());\n $('#Ajout_tache').attr(\"onclick\",\"Form_elements()\");\n }", "function ShowNewUserUI() {\n \n //Popup object/dialog.\n var oPopup = (mbIE) ? $f(\"NewEmployeePopup\") : $f(\"NewEmployeePopup\").contentWindow;\n \n goCloak.Show(\"ContentBox\", GetMaxZindex(), \"ContentBox\");\n \n //Set the action to perform if user clicks \"Run\" in the popup.\n //oPopup.SetProperty(\"GoCallback\", \"window.parent.Report_Run();\"); \n \n var oSrc = $(\"HdrUserAction\"); \n \n //Calc the position of the popup.\n var iLeft = oSrc.parentNode.offsetLeft + 50;\n if (iLeft < 0) iLeft = 20;\n var iTop = oSrc.parentNode.offsetTop + oSrc.parentNode.offsetHeight + 30;\n if (iTop < 0) iTop = 20;\n \n var sEmployeeType = \"admin-new-user\"; \n var sEmployeeID = 0;\n var sCompanyID = 0;\n var sCompanyName = null;\n\n //Position and display dialog.\n oPopup.ShowUI(iTop, iLeft, goCloak, sEmployeeType, sEmployeeID, sCompanyID, sCompanyName, this, true);\n\n}", "function processInsert(param) {\n\n var args = {\n targetid: \"frmData_상세\"\n };\n gw_com_module.formInsert(args);\n\n}", "function createPopUp() {\n\n}", "function ViewMarkup() {\n\n $('#ViewMarkupPopup').load(baseURL + \"Invoice/Create/\" + \"?CallSlipId=\" + $('#CallSlipId').val());\n $('#ViewMarkupPopup').dialog({\n title: 'Mark up Details',\n resizable: true,\n width: 650,\n modal: true,\n buttons: [\n {\n text: \"Close\",\n id: \"Close Purchase Order\",\n click: function () {\n $(this).dialog('close');\n }\n }],\n close: function (event, ui) {\n $(this).dialog('destroy');\n $('#ViewMarkupPopup').html(\"\");\n }\n });\n}", "function makeDialog( selected, event )\n {\n var boxOptions = $.chili.selection.box;\n var boxTag = $.browser.msie\n ? ('<textarea style=\"' + boxOptions.style + '\">')\n : ('<pre style=\"' + boxOptions.style + '\">');\n \n var boxElement = $(boxTag)\n .appendTo( 'body' )\n .text( selected )\n .attr( 'id', 'chili_selection' )\n .click( function() { $(this).remove(); } )\n ;\n var top = boxOptions.top(event.pageX, event.pageY, \n boxElement.width(), boxElement.height());\n var left = boxOptions.left(event.pageX, event.pageY, \n boxElement.width(), boxElement.height());\n boxElement.css( { top: top, left: left } );\n \n return boxElement;\n }", "function existingChoices() {\r\n\t$.get(app_path_webroot+\"Design/existing_choices.php?pid=\"+pid, { },function(data){\r\n\t\tvar json_data = jQuery.parseJSON(data);\r\n\t\tif (json_data.length < 1) {\r\n\t\t\talert(woops);\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\tsimpleDialog(json_data.content,json_data.title,'existing_choices_popup');\r\n\t\tfitDialog($('#existing_choices_popup'));\r\n\t});\r\n}", "function editarPopup(idReservacion,idHorariosReservados,nombre,fechaReservada, motivo){\t\t\t\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t//alert(idReservacion+\",\"+nombre+\",\"+fechaReservada+\",\"+motivo);\n\t\t\t\t\t//alert(idHorariosReservados);\n\t\t\t\t\t$('#fondoTransparente').css('opacity', '0.5');\n\t\t\t\t\t$('#popupDetallePersonas').fadeIn('slow');\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\tdocument.getElementById(\"fondoTransparente\").disabled =true;\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t//CODIGO PARA AGREGAR FILAS A LA TABLA;\n\t\t \n\t\t\t\t\t/*var n = $('tr:last td', $(\"#tabla\")).length;\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\tvar tds = '<tr id=\"filaAux\">';\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t \n\t\t\t\t\t tds += '<td id=\"idReservacion\" style=\"display: none;\"\">'+idReservacion+'</td>';\n\t\t\t\t\t tds += '<td id=\"idHorariosReservados\" style=\"display: none;\"\">'+idHorariosReservados+'</td>';\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\ttds += '</tr>';\n\t\t\t\t\t\n\t\t\t\t\t$(\"#tabla\").append(tds);\t*/\n\t\t\t\t\t\n\t\t\t\t\t//CODIGO PARA GUARDAR DATOS EN DIVS\n\t\t\t\t\t$(\"#idReservaciones\").data(\"Reservaciones\",idReservacion);\n\t\t\t\t\t$(\"#idHorariosReservados\").data(\"HorariosReservados\",idHorariosReservados);\n\t\t\t\t}", "function prntAssoc(error, displayText, GUID, itemMirror){\n if (error) {\n throw error;\n }\n \n itemMirror.isAssociatedItemGrouping(GUID, function(error, isGroupingItem){\n if (isGroupingItem) {\n var $thisAssoc;\n $thisAssoc = $('<li>', {'text': \" \" + displayText});\n $thisAssoc.prepend($('<span>', {class:'glyphicon glyphicon-folder-close'}));\n $thisAssoc.bind(\"click\",{guid:GUID, itemmirror:itemMirror},createItemMirrorFromGroupingItem);\n $('#modalDialog div.modal-body ul').append($thisAssoc);\n }\n });\n \n }", "function onClickAddStep() {\n if (currentStep instanceof ErrorStep) {\n var errorPopup = $(\"#ErrorPopup\");\n var errorPopupText = $(\"#ErrorPopupText\");\n errorPopupText.empty();\n errorPopupText.html(\"<p>\"+currentStep.error+\"</p>\");\n errorPopup.popup(\"open\");\n }\n else {\n cleaningSteps.push(currentStep);\n $(\"#PageAddNewCleaningStep\").dialog(\"close\");\n }\n}" ]
[ "0.6523596", "0.6398907", "0.6202359", "0.6027628", "0.5991657", "0.5936035", "0.58974165", "0.5896731", "0.57702357", "0.57117313", "0.5699788", "0.5677821", "0.56710464", "0.56627035", "0.56620127", "0.5650618", "0.562125", "0.55912447", "0.55584615", "0.55424947", "0.55280477", "0.5524193", "0.5519487", "0.55027074", "0.54877144", "0.54851234", "0.5481466", "0.54812634", "0.5473836", "0.5469017", "0.54669917", "0.54659665", "0.5465272", "0.54615194", "0.5457997", "0.5452453", "0.5451018", "0.54287046", "0.54235375", "0.5421701", "0.54128295", "0.5394486", "0.53921306", "0.538422", "0.5382759", "0.5365628", "0.53496265", "0.5335929", "0.5335181", "0.5329604", "0.53109604", "0.5310958", "0.5307613", "0.5307339", "0.53052586", "0.5304247", "0.52987957", "0.5296769", "0.5296649", "0.52897483", "0.5287324", "0.5279156", "0.5277984", "0.52756876", "0.5268699", "0.5267756", "0.52574277", "0.5252438", "0.52494216", "0.5247646", "0.52464277", "0.5243718", "0.52373755", "0.5236282", "0.5234686", "0.522595", "0.5225557", "0.5221427", "0.5220143", "0.52181107", "0.52178437", "0.5209516", "0.51985484", "0.5196621", "0.5195625", "0.5186178", "0.5182507", "0.5181368", "0.51809996", "0.5176542", "0.51759094", "0.5168636", "0.51679355", "0.51664054", "0.51636803", "0.5162521", "0.5154654", "0.51532614", "0.51516485", "0.5149402" ]
0.6296618
2
Create an object listing for an entry or page. This is used for Selected Entry, Selected Page, and Reciprocal Objects.
function createObjectListing(obj_title, obj_id, obj_class, obj_permalink, blog_id) { var $preview = jQuery('<span/>') .addClass('obj-title') .text(obj_title); // Edit link. var $edit = jQuery('<a/>') .attr('href', CMSScriptURI+'?__mode=view&_type='+obj_class+'&id='+obj_id+'&blog_id='+blog_id) .addClass('edit') .attr('target', '_blank') .attr('title', 'Edit in a new window') .html('<img src="'+StaticURI+'images/status_icons/draft.gif" width="9" height="9" alt="Edit" />'); // View link. var $view; if (obj_permalink) { $view = jQuery('<a/>') .attr('href', obj_permalink) .addClass('view') .attr('target', '_blank') .attr('title', 'View in a new window') .html('<img src="'+StaticURI+'images/status_icons/view.gif" width="13" height="9" alt="View" />'); } // Delete button. var $remove = jQuery('<img/>') .addClass('remove') .attr('title', 'Remove selected entry') .attr('alt', 'Remove selected entry') .attr('src', StaticURI+'images/status_icons/close.gif') .attr('width', 9) .attr('height', 9); // Insert all of the above into a list item. var $li = jQuery('<li/>') .attr('id', 'obj-'+obj_id) .append($preview) .append($edit) .append($view) .append($remove); return $li; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newListEntry(entry) {\n var listEntry = newElement('li');\n var listText = newElement('span');\n var actionContainer = newElement('div');\n var runButton = createIconButton('power-off', true, null, entry, _run);\n var editButton = createIconButton('edit', true, null, entry, _edit);\n var deleteButton = createIconButton('trash', true, null, entry, _delete);\n listText.innerHTML = entry.name;\n actionContainer.appendChild(runButton);\n actionContainer.appendChild(editButton);\n actionContainer.appendChild(deleteButton);\n listEntry.appendChild(listText);\n listEntry.appendChild(actionContainer);\n return listEntry;\n}", "static displayEntries() {\n let posts = Store.getEntries();\n\n posts.forEach((entry) => UI.addEntryToList(entry));\n\n }", "function renderEntry(entry) {\n\n var $entrieslists = document.createElement('li');\n\n var $row = document.createElement('div');\n $row.className = 'row';\n $entrieslists.appendChild($row);\n var $columnHalf = document.createElement('div');\n $columnHalf.className = 'column-half';\n $row.appendChild($columnHalf);\n\n var $img = document.createElement('img');\n $img.setAttribute('src', entry.photoUrl);\n $img.className = 'entries-img';\n $columnHalf.appendChild($img);\n\n var $entriesText = document.createElement('div');\n $entriesText.className = 'column-half entries-text';\n $row.appendChild($entriesText);\n\n var $title = document.createElement('h2');\n $title.textContent = entry.title;\n $entriesText.appendChild($title);\n\n var $notes = document.createElement('p');\n $notes.textContent = entry.notes;\n $entriesText.appendChild($notes);\n\n return $entrieslists;\n\n}", "function addEntry(entries) {\n\n var newUnorderedList = document.createElement('ul');\n var dataViewEntry = document.querySelector('div[data-view=\"entries\"]');\n dataViewEntry.appendChild(newUnorderedList);\n\n var divRow = document.createElement('div');\n divRow.setAttribute('class', 'row');\n newUnorderedList.appendChild(divRow);\n\n var divColumnHalf1 = document.createElement('div');\n divColumnHalf1.setAttribute('class', 'column-half');\n divRow.appendChild(divColumnHalf1);\n\n var liImage = document.createElement('li');\n divColumnHalf1.appendChild(liImage);\n\n var image = document.createElement('img');\n image.setAttribute('src', entries.url);\n image.setAttribute('class', 'dom-tree-image');\n liImage.appendChild(image);\n\n var divColumnHalf2 = document.createElement('div');\n divColumnHalf2.setAttribute('class', 'column-half');\n divRow.appendChild(divColumnHalf2);\n\n var liText = document.createElement('li');\n divColumnHalf2.appendChild(liText);\n\n var heading = document.createElement('h2');\n heading.textContent = entries.title;\n liText.appendChild(heading);\n\n var bodyText = document.createElement('p');\n bodyText.textContent = entries.notes;\n liText.appendChild(bodyText);\n\n return newUnorderedList;\n}", "function ListEntry(id, name) {\n this.id = id;\n this.name = name;\n}", "function createObjectImagePage(web, object, object_num) {\n\tvar objectListResult = \"\";\n\tvar objectListHead = \"<p><input type='image' src='images/object/\";\n\n\tfor (var i = 0; i < object_num; i++) {\n\t\tvar objectName = object + (i+1).toString();\n\t\tvar objectListMiddle = \"value='\" + objectName+ \"' onclick='addObjectImage(\\\"\" + objectName + \"\\\", \\\"\" + web + \"\\\")' \";\n\t\tobjectListResult += objectListHead + objectName + \".jpg' \" + objectListMiddle + \"/></p>\";\n\t}\n\tvar footer = \"<div data-role=footer data-id=fool data-position=fixed><div data-role=navbar><ul><li><a href=#home>Home</a></li><li><a href=#friends>Accounts</a></li><li><a href=#confirm>Setting</a></li>\";\n\tvar newPage = $(\"<div data-role='page' data-title='\"+web+object+\"' id=\"+web+object+\"><div data-role='header' data-position=fixed><a href=#\" + web+\"Page data-icon='back'>Back</a><h1>\"+object+\"</h1></div><div data-role='content' class=images>\"+objectListResult+\"</div>\"+footer+\"</div>\");\n\treturn newPage;\n\t//newPage.appendTo( $.mobile.pageContainer );\n\t//$.mobile.changePage(newPage);\n}", "function createListNode(obj, path) {\n if (\"maneuvers\" in obj) {\n return null;\n }\n \n var $ul = $(\"<ul>\");\n\n for (var x in obj) {\n var child = obj[x];\n if (child === null || typeof child !== 'object') continue;\n \n var name = x;\n if (\"description\" in child) {\n name = child.description;\n }\n\n var childpath = (path == \"\"? x : path + \"_\" + x);\n var $a = $(\"<a>\").attr(\"href\", \"cube.html?case=\" + childpath).text(name);\n\n var $cul = createListNode(child, childpath);\n var count = getManeuverCount(child);\n\n var $li = $(\"<li>\");\n $li.append($a);\n if (count > 0) {\n $li.append($(\"<span>\").addClass(\"note\").text(\"(\" + count + \")\"));\n }\n if ($cul) {\n $li.append($cul);\n }\n $ul.append($li);\n }\n \n return $ul;\n}", "function createTaskList(object) {\n\n\tfor( let i=0; i<object.length; i++ ) {\n\t\tlet navListItem =\n\t\t\t'<li>' +\n\t\t\t'<a href=\"single.html?task=' + object[i].id + '\">' +\n\t\t\t'<h2 class=\"task-title\">' + object[i].title.rendered + '</h2>' +\n\t\t\t'<div class=\"task-date\">' +\n\t\t\tgetDate(object[i]) +\n\t\t\t'</div>' +\n\t\t\t'<div class=\"task-status\">' + getStatus(object[i].task_status) + '</div>' +\n\t\t\t'</a>' +\n\t\t\t'</li>';\n\n\t\t$('.task-list ul').append(navListItem);\n\t}\n\t$('.main-area').append('<button class=\"more\">Load more tasks</button>');\n\tmorePostsTrigger();\n\n}", "function createListing(payload, cb) {\n // TODO: handle validation here or at the controller level? Let's try controller level\n\n base('listings').create(payload, function(err, record) {\n if (err) {\n console.error(err);\n return cb(err);\n }\n\n clearCache();\n // cb(null, record.getId());\n // Q: how should we return this for the permalink?\n // The unique ID is really the most important part...\n var permalink = record.get('unique_id') + '-' + record.get('permalink');\n cb(null, permalink);\n });\n\n // fetch the record that was just created to get the unique ID (for the permalink...)\n\n // bust the cache so the new listing will show up on the home page\n}", "function displayList (listofObjs){\n // create an ul element\n // create a li element\n // -append a particular object(ex. sailor)\n // -set as innerHTML\n // append li to ul\n // append our ul to pirate class element\nvar unOrdered = document.createElement('ul');\nvar objectContent = \" \";\n\nfor(var i = 0; i < listofObjs.length; i++){\n// loop through objects to add list item content\n for (key in listofObjs[i]){\n var listItems = document.createElement('li');\n\n objectContent += (\"<br>\" + key + \": \" + listofObjs[i][key]);\n listItems.innerHTML = objectContent;\n }\n\n unOrdered.appendChild(listItems);\n}\n\ndocument.body.appendChild(unOrdered);\n\n}", "function MakeObjectToAddInList(success) {\n return {\n \"itemId\": success.data.data.id,\n \"itemName\": success.data.data.itemName,\n \"itemPrice\": null,\n \"collection\": null,\n \"images\": [],\n \"quantity\": null,\n \"dateOfPurchase\": success.data.data.dateOfPurchase,\n \"category\": null,\n \"rooms\": null,\n \"currentValue\": null,\n \"brand\": success.data.data.brand,\n \"model\": success.data.data.model,\n \"description\": success.data.data.description,\n \"roomId\": null,\n \"collectionId\": null,\n \"price\": success.data.data.quotedPrice,\n \"categoryId\": success.data.data.category.id,\n \"categoryName\": GetCategoryOrSubCategoryOnId(true, success.data.data.category.id),\n \"subCategoryId\": success.data.data.subCategory.id,\n \"subCategoryName\": GetCategoryOrSubCategoryOnId(false, success.data.data.subCategory.id),\n \"templateType\": null,\n \"itemWorth\": 0,\n \"policyNumber\": null,\n \"appraisalValue\": null,\n \"productSerialNo\": null,\n \"imageId\": null,\n \"jwelleryTypeId\": null,\n \"jwelleryType\": null,\n \"claimed\": false,\n \"claimId\": success.data.data.claimId,\n \"vendorId\": null,\n \"age\": success.data.data.age,\n \"status\": null,\n \"statusId\": success.data.data.statusId,\n \"itemCategory\": null,\n \"contact\": null,\n \"notes\": null,\n \"additionalInfo\": null,\n \"approved\": false,\n \"scheduled\": success.data.data.isScheduledItem\n }\n }", "function Listing(status, postID, manage, title, postedDate, from, subject){\n this.status = status || '';\n this.postID = postID || '';\n this.manage = manage || '';\n this.title = title || '';\n this.postedDate = postedDate || '';\n this.from = from || '';\n this.subject = subject || '';\n\n}", "function _createEntries() {\n\t\tvar lvStatus;\n\t\t//Get the Request Body\n\t\tvar oBody = JSON.parse($.request.body.asString());\n\n\t\t//Check if it is Bulk Scenario Asynchronous\n\t\tif (oBody.JOURNAL.constructor === Array) {\n\t\t\tfor (var i = 0; i < oBody.JOURNAL.length; i++) {\n\t\t\t\t//Create the Batch Entry\n\t\t\t\tlvStatus = _createBatch(oBody, oBody.JOURNAL[i]);\n\n\t\t\t\t//Create the Header\n\t\t\t\tif (lvStatus === \"SUCCESS\") {\n\t\t\t\t\tlvStatus = _createHeader(oBody.JOURNAL[i]);\n\t\t\t\t}\n\n\t\t\t\t//If Successful create the Item\n\t\t\t\tif (lvStatus === \"SUCCESS\") {\n\t\t\t\t\t_createItems(oBody.JOURNAL[i], oBody.JOURNAL[i].JOURNAL_ENTRY);\n\t\t\t\t}\n\t\t\t\tlvStatus = \"\";\n\t\t\t}\n\t\t} else {\n\t\t\t//Create Header Entry\n\t\t\tif (oBody.JOURNAL) {\n\t\t\t\t//Create the Batch Entry\n\t\t\t\tlvStatus = _createBatch(oBody, oBody.JOURNAL);\n\n\t\t\t\t//Create the Header\n\t\t\t\tif (lvStatus === \"SUCCESS\") {\n\t\t\t\t\tlvStatus = _createHeader(oBody.JOURNAL);\n\t\t\t\t}\n\n\t\t\t\t//Create the Items\n\t\t\t\tif (lvStatus === \"SUCCESS\") {\n\t\t\t\t\t_createItems(oBody.JOURNAL, oBody.JOURNAL.JOURNAL_ENTRY);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "function createPage () {\n\t$(\"ul li\").each(function(index) {\n\t\tobj = $(this)\n\t\tdivCount += 1\n\t\t\tif (divCount < 10) {\n\t\t\t\tobj.show()\n\t\t\t} else {\n\t\t\t\tobj.hide()\n\t\t\t}\n\t\t\tif (index % 10 === 0) {\n\t\t\t\tnewTag += \"<li id=\\\"page\\\"><a href=\\\"#\\\">\" + countCreate + \"</a></li>\"\n\t\t\t\tcountCreate++;\n\t\t\t}\n\t});\n\tif (newTag !== null) {\n\t\t$(\"ul\").append(\"<nav aria-label=\\\"Page navigation\\\"><ul class=\\\"pagination\\\">\" + newTag + \"</ul></nav>\");\n\t}\n\n}", "function insertSelectedObject(obj_title, obj_id, obj_class, obj_permalink, field, blog_id) {\n // Check if this is a reciprocal association, or just a standard Selected\n // Entry/Page.\n if ( jQuery('input#'+field+'.reciprocal-object').length ) {\n // If a reciprocal association already exists, we need to delete it\n // before creating a new association.\n if ( jQuery('input#'+field+'.reciprocal-object').val() ) {\n deleteReciprocalAssociation(\n field,\n jQuery('input#'+field+'.reciprocal-object').val()\n );\n createReciprocalAssociation(\n obj_title,\n obj_id,\n obj_class,\n obj_permalink,\n field,\n blog_id\n );\n }\n // No existing association exists, so just create the new reciprocal\n // entry association.\n else {\n createReciprocalAssociation(\n obj_title,\n obj_id,\n obj_class,\n obj_permalink,\n field,\n blog_id\n );\n }\n }\n // This is just a standard Selected Entries or Selected Pages insert.\n else {\n // Create a list item populated with title, edit, view, and remove links.\n var $li = createObjectListing(\n obj_title,\n obj_id,\n obj_class,\n obj_permalink,\n blog_id\n );\n\n // Insert the list item with the button, preview, etc into the field area.\n jQuery('ul#custom-field-selected-objects_'+field)\n .append($li)\n\n var objects = new Array();\n objects[0] = jQuery('input#'+field).val();\n objects.push(obj_id);\n jQuery('input#'+field).val( objects.join(',') );\n }\n}", "function Entry (entryObject) {\n this.title = entryObject.title;\n this.date = entryObject.date;\n this.category = entryObject.category;\n this.mood = entryObject.mood;\n this.text = entryObject.text;\n this.author = entryObject.author || 'Stephanie Lingwood';\n}", "static addEntryToList(entry) {\n const list = document.querySelector('#journal-list');\n\n const row = document.createElement('tr');\n\n row.innerHTML = `\n <td>${entry.date}</td>\n <td>${entry.title}</td>\n <td>${entry.post}</td>\n `;\n\n list.appendChild(row);\n }", "function displayListings(data) {\n // Target the housing container already present in index.html\n var $housing = $('.js-housing');\n $housing.empty();\n var $container, i;\n // Loop through each listing\n for (i=0; i<data.length; i++) {\n var listing = data[i].properties;\n var coordinates = data[i].geometry.coordinates;\n // Creates a basic listing\n if (listing.sublease) {\n $container = displaySublease(listing, i, coordinates);\n //console.log(\"listing in displaysublease: \", listing);\n //console.log('sublease listing');\n } else {\n $container = displayPromo(listing, i, coordinates);\n //console.log('promo listing');\n }\n // Add the listing to the DOM\n $housing.append($container);\n }\n}", "function newObject() {\r\n dojo.byId(\"newButton\").blur();\r\n id = dojo.byId('objectId');\r\n if (id) {\r\n id.value = \"\";\r\n unselectAllRows(\"objectGrid\");\r\n loadContent(\"objectDetail.php\", \"detailDiv\", dojo.byId('listForm'));\r\n } else {\r\n showError(i18n(\"errorObjectId\"));\r\n }\r\n}", "function ListView(props) {\n const entryViews = [];\n for (let entry of props.entries) {\n entryViews.push(React.createElement(ListEntry, { entry: entry, key: entry.name, performAction: props.performAction }));\n }\n let pagination;\n if (props.numPages > 1) {\n pagination = (React.createElement(\"div\", { className: \"jp-extensionmanager-pagination\" },\n React.createElement(react_paginate_1.default, { previousLabel: '<', nextLabel: '>', breakLabel: React.createElement(\"a\", { href: \"\" }, \"...\"), breakClassName: 'break-me', pageCount: props.numPages, marginPagesDisplayed: 2, pageRangeDisplayed: 5, onPageChange: (data) => props.onPage(data.selected), containerClassName: 'pagination', activeClassName: 'active' })));\n }\n const listview = (React.createElement(\"ul\", { className: \"jp-extensionmanager-listview\" }, entryViews));\n return (React.createElement(\"div\", { className: \"jp-extensionmanager-listview-wrapper\" },\n entryViews.length > 0 ? (listview) : (React.createElement(\"div\", { key: \"message\", className: \"jp-extensionmanager-listview-message\" }, \"No entries\")),\n pagination));\n}", "function create_object ()\n\t{\n\t\tvar list = {}, \n\t\t\tareas = [], \n\t\t\tknown = {}, \n\t\t\tactions = app.menuActions.everyItem().getElements();\n\t\t\t\n\t\tfor(var i = 0; i < actions.length; i++)\n\t\t{\n\t\t\tif (!ignore (actions[i]))\n\t\t\t{\n\t\t\t\tlist[actions[i].name] = {area: actions[i].area, id: actions[i].id};\n\t\t\t\tif (!known[actions[i].area])\n\t\t\t\t{\n\t\t\t\t\tareas.push (actions[i].area);\n\t\t\t\t\tknown[actions[i].area] = true;\n\t\t\t\t}\n\t\t\t} // ignore\n\t\t}\n\t\t// Initially sort by area\n\t\tlist = sort_object (list, \"area\");\n\t\tareas.sort();\n\t\tareas.unshift('[All]'); // add [All] at the beginning of the array\n\t\treturn {list: list, areas: areas}\n\t}", "listing_of(owner) {\n return this._get(`listing?owner=${owner}`);\n }", "function listingEntryCreate (listingEntry) {\n console.log(className+\".listingEntryCreate(\"+listingEntry+\")\");\n\n debugObject(listingEntry);\n\n var listingEntryHash = commit(\"listingEntry\", listingEntry);\n\n console.log(\"listingEntryHash = \"+listingEntryHash);\n\n // On the DHT, put a link from my hash to the hash of the new post\n var me = App.Agent.Hash;\n\n commit(\"listing_links\",{ Links: [ { Base: listingEntryHash,Link: me, Tag: \"listing_source\" } ] });\n\n return listingEntryHash;\n}", "function Objects() {\n this.id = 0\n this.list = []\n this.objectTypes = {\n ship: ObjectShip,\n point: ObjectPoint,\n meteor: ObjectMeteor\n }\n\n this.create = (options) => {\n var objectType = this.objectTypes[options.type]\n var object = new objectType(options)\n\n this.list.push({\n id: this.id++,\n type: options.type,\n object: object\n })\n }\n\n this.step = () => {\n for (var o of this.list) {\n o.object.step()\n }\n }\n\n this.find = (objectType) => {\n var listObject = this.list.find(o => o.type == objectType)\n if (listObject) return listObject.object\n }\n\n this.all = (objectType) => {\n var objects = this.list.reduce((sum, num) => {\n num.type == objectType && sum.push(num.object)\n return sum\n }, [])\n\n return objects\n }\n}", "function Entry(get, list, edit, _delete) {\n let obj,\n ref,\n ref1,\n ref2,\n ref3;\n this.get = get;\n this.list = list;\n this.edit = edit;\n this.delete = _delete;\n if (this.get instanceof Object) {\n obj = this.get;\n this.get = (ref = obj.get) != null ? ref : false;\n this.list = (ref1 = obj.list) != null ? ref1 : false;\n this.edit = (ref2 = obj.edit) != null ? ref2 : false;\n this.delete = (ref3 = obj.delete) != null ? ref3 : false;\n }\n }", "renderNewList() {}", "function createList() {\n //clear all items from list\n while (dataList.firstChild) dataList.removeChild(dataList.firstChild);\n\n //add all list items from entries array\n for (let i in entries) {\n li = document.createElement('li');\n // Add text node with input values\n li.appendChild(document.createTextNode(`${entries[i].pace} on ${entries[i].date.toDateString()}`));\n dataList.appendChild(li);\n }\n}", "function showEntry(list, type, title, amount, id){\n // this is the entire html of our new entry variable\n const entry = `<li id = \"${id}\" class = \"${type}\"> \n <div class = \"entry\">- ${title}: $${amount} </div>\n <div id = \"edit\"></div>\n <div id = \"delete\"></div>\n </li>`;\n // make the newest entries appear at the top of list\n const position = \"afterbegin\";\n list.insertAdjacentHTML(position,entry);\n}", "function createList(objects) {\n\t var list = blank(),\n\t head = list,\n\t listItems = [],\n\t listTriples,\n\t triples = [];\n\t objects.forEach(function (o) {\n\t listItems.push(o.entity);\n\t appendAllTo(triples, o.triples);\n\t });\n\n\t // Build an RDF list out of the items\n\t for (var i = 0, j = 0, l = listItems.length, listTriples = Array(l * 2); i < l;) {\n\t listTriples[j++] = triple(head, RDF_FIRST, listItems[i]), listTriples[j++] = triple(head, RDF_REST, head = ++i < l ? blank() : RDF_NIL);\n\t } // Return the list's identifier, its triples, and the triples associated with its items\n\t return { entity: list, triples: appendAllTo(listTriples, triples) };\n\t }", "function makePage(){\n\n codeFellows.makeList();\n disneyLand.makeList();\n}", "function makeListing() {\n\tconsole.log(\"Make Listing Button Pressed.\");\n\n\t//numberOfWhateverUnits variables initialized in 'make-a-listing-page.js'\n\tpost = {\n\t\tnumFashion: numberOfFashionUnits,\n\t\tnumElectronics: numberOfElectronicsUnits,\n\t\tnumCollectables: numberOfCollectablesUnits,\n\t\tquantity: 1, //default for now. Possibly based on user input down the road. \n\t\titemName: selectedItemType,\n\t\tprice: price\n\t}\n\n\t$.ajax({\n method: \"POST\",\n url: \"/api/new-listing\",\n data: post\n })\n .done(function(data) {\n \tif (data.success)\n \t\twindow.location = data.redirectTo;\n });\n}", "_createPages() {\n let self = this,\n size = Math.floor(self.get('queryCount') / self.get('pageSize')) + 1,\n range = Array(size),\n pagesArray = self.get('pagesArray');\n\n pagesArray.clear();\n let i = 1;\n for (i = 1; i <= range.length; i++) {\n var obj = Ember.Object.create({text: i, className: self.get('pageNumber') === i ? \"active\": \"\"});\n pagesArray.pushObject(obj);\n }\n }", "function _createNewPageEntry(isTemplate){\n\t\t\t_checkState(CONST_STATE_ADD_SELECT_TYPE);\n\t\t\t_removeAddEntrySelectTypeIfRequired();\n\t\t\tvar newId = _generateNewId();\n\t\t\tvar options = {\n\t\t\t\tkey: newId,\n\t\t\t\tisTemplate: isTemplate,\n\t\t\t\ttitle: \"\"\n\t\t\t};\n\t\t\t\n\t\t\tvar itemToInsertPage = _findItemToInsertPage(isTemplate);\n\t\t\tvar renderedInsertTitle = $.tmpl($(\"#render-add-page-insert-title-template\"), options);\n\t\t\tif(itemToInsertPage == null || itemToInsertPage.domElement == null){\n\t\t\t\tvar innerUL = _domElement.find(\"> ul\");\n\t\t\t\tinnerUL.append(renderedInsertTitle);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(itemToInsertPage.after)\n\t\t\t\t\titemToInsertPage.domElement.after(renderedInsertTitle);\n\t\t\t\telse\n\t\t\t\t\titemToInsertPage.domElement.before(renderedInsertTitle);\n\t\t\t}\n\t\t\t\n\t\t\t$(\"#new-item-title-\"+newId).focus();\n\t\t\t\n\t\t\t_state = isTemplate ? CONST_STATE_ADD_PAGE_TEMPLATE_SET_TITLE : CONST_STATE_ADD_PAGE_SET_TITLE;\n\t\t\t\n\t\t\tvar jsonCreator = {\n\t\t\t\t\tcreate: function(newId, title, isTemplate, id){\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tisTemplate: isTemplate,\n\t\t\t\t\t\t\tkey: newId,\n\t\t\t\t\t\t\ttitle: title,\n\t\t\t\t\t\t\ttype: \"page\",\n\t\t\t\t\t\t\tparentId: id\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t};\n\t\t\t\n\t\t\t// add the handles to create the new channel\n\t\t\t$(\"#new-item-title-\"+newId).keypress(function (e){\n\t\t\t\tswitch(e.which){\n\t\t\t\tcase CONST_VK_CONFIRM: //enter\n\t\t\t\t\t_confirmObjectCreation(newId, jsonCreator, \"#render-page-template\", itemToInsertPage, isTemplate);\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t$(\".insert-title > span.title-entry\").click(function(e){\n\t\t\t\te.stopPropagation();\n\t\t\t\treturn false;\n\t\t\t});\n\t\t\t\n\t\t\t$(\".insert-title > span.actions > span.ok\").click(function(e){\n\t\t\t\t_confirmObjectCreation(newId, jsonCreator, \"#render-page-template\", itemToInsertPage, isTemplate);\n\t\t\t\te.stopPropagation();\n\t\t\t\treturn false;\n\t\t\t});\n\t\t}", "function createPostsCard(object){\n let newLi = createElement({tagName: 'li', className: 'border border-1 hover rounded-3 p-3 bg-light mb-2 js-post', node: elPost});\n let postTitle = createElement({tagName: 'div', className: \"h6\", text: object.title, node: newLi});\n let postBody = createElement({tagName: 'div', text: object.body, node: newLi});\n\n newLi.addEventListener('click', function(){\n $$_(\".js-post\", elPost).forEach(function(item){\n item.classList.remove(\"active\");\n });\n elPostsSection.classList.remove(\"bg-white\");\n elCommentsSection.classList.add(\"bg-white\");\n \n newLi.classList.add('active');\n elComments.innerHTML = '';\n main(createComment, \"posts/\"+ object.id +\"/comments\");\n });\n}", "function List(data) {\n if (!(data instanceof Object)) {\n throw new TypeError('Invalid data type for argument `data`.');\n }\n List.__super__.constructor.call(this);\n this.page = data.page;\n this.prevPage = data.prevPage;\n this.nextPage = data.nextPage;\n this.pageCount = data.pageCount;\n this.count = data.count;\n this.limit = data.limit;\n this.order = data.order;\n this.asc = data.asc;\n }", "function lists() {\n\t$.post(\"listobject.hrd\", function(data) {\n\t\t$(\"#tblist\").html(listobjectdetails(data));\n\t});\n\n}", "function getPageObject () {\n return {\n title: $('#title').val(),\n tags: ($('#tags').val() || []).join(),\n text: $('#text').val(),\n alias: $('#alias').val(),\n stamp: $('#stamp').val()\n }\n }", "function createList(objects) {\n var list = blank(), head = list, listItems = [], listTriples, triples = [];\n objects.forEach(function (o) { listItems.push(o.entity); appendAllTo(triples, o.triples); });\n\n // Build an RDF list out of the items\n for (var i = 0, j = 0, l = listItems.length, listTriples = Array(l * 2); i < l;)\n listTriples[j++] = triple(head, RDF_FIRST, listItems[i]),\n listTriples[j++] = triple(head, RDF_REST, head = ++i < l ? blank() : RDF_NIL);\n\n // Return the list's identifier, its triples, and the triples associated with its items\n return { entity: list, triples: appendAllTo(listTriples, triples) };\n }", "function showPages() {\n\tvar pages = getPages();\n\tvar formHTML = \"<ul>\";\n\tfor (var i = 0; i < pages.length; i++)\n\t{\n\t\tformHTML = formHTML + '<li id=\"li_' + i +'\">' + pages[i].title + ' <button id=\"bt_' + i + '\" onclick=\"selectPage(' + i + ')\">Edit</button></li>';\n\t}\n\tformHTML = formHTML + \"</ul>\";\n\t$( \"div#pagesList\" ).html(formHTML);\n}", "function createList(name, type, listEntries = []){\r\n\r\n val = {listName: name, type: type, entries: listEntries}\r\n \r\n window.localStorage.setItem(name,JSON.stringify(val)) \r\n populate()\r\n}", "function objectTree(obj) {\n var res;\n switch(obj.termType) {\n case 'symbol':\n var anchor = myDocument.createElement('a')\n anchor.setAttribute('href', obj.uri)\n anchor.addEventListener('click', tabulator.panes.utils.openHrefInOutlineMode, true);\n anchor.appendChild(myDocument.createTextNode(tabulator.Util.label(obj)));\n return anchor;\n \n case 'literal':\n\n if (!obj.datatype || !obj.datatype.uri) {\n res = myDocument.createElement('div');\n res.setAttribute('style', 'white-space: pre-wrap;');\n res.textContent = obj.value;\n return res\n } else if (obj.datatype.uri == 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral') {\n res = myDocument.createElement('div');\n res.setAttribute('class', 'embeddedXHTML');\n res.innerHTML = obj.value; // Try that @@@ beware embedded dangerous code\n return res;\n };\n return myDocument.createTextNode(obj.value); // placeholder - could be smarter, \n \n case 'bnode':\n if (obj.toNT() in doneBnodes) { // Break infinite recursion\n referencedBnodes[(obj.toNT())] = true;\n var anchor = myDocument.createElement('a')\n anchor.setAttribute('href', '#'+obj.toNT().slice(2))\n anchor.setAttribute('class','bnodeRef')\n anchor.textContent = '*'+obj.toNT().slice(3);\n return anchor; \n }\n doneBnodes[obj.toNT()] = true; // Flag to prevent infinite recusruion in propertyTree\n var newTable = propertyTree(obj);\n doneBnodes[obj.toNT()] = newTable; // Track where we mentioned it first\n if (tabulator.Util.ancestor(newTable, 'TABLE') && tabulator.Util.ancestor(newTable, 'TABLE').style.backgroundColor=='white') {\n newTable.style.backgroundColor='#eee'\n } else {\n newTable.style.backgroundColor='white'\n }\n return newTable;\n \n case 'collection':\n var res = myDocument.createElement('table')\n res.setAttribute('class', 'collectionAsTables')\n for (var i=0; i<obj.elements.length; i++) {\n var tr = myDocument.createElement('tr');\n res.appendChild(tr);\n tr.appendChild(objectTree(obj.elements[i]));\n }\n return res;\n case 'formula':\n var res = tabulator.panes.dataContentPane.statementsAsTables(obj.statements, myDocument);\n res.setAttribute('class', 'nestedFormula')\n return res;\n case 'variable':\n var res = myDocument.createTextNode('?' + obj.uri);\n return res;\n \n }\n throw \"Unhandled node type: \"+obj.termType\n }", "function createList(objects) {\n var list = blank(), head = list, listItems = [], listTriples, triples = [];\n objects.forEach(function (o) { listItems.push(o.entity); appendAllTo(triples, o.triples); });\n\n // Build an RDF list out of the items\n for (var i = 0, j = 0, l = listItems.length, listTriples = Array(l * 2); i < l;)\n listTriples[j++] = triple(head, Parser.factory.namedNode(RDF_FIRST), listItems[i]),\n listTriples[j++] = triple(head, Parser.factory.namedNode(RDF_REST), head = ++i < l ? blank() : Parser.factory.namedNode(RDF_NIL));\n\n // Return the list's identifier, its triples, and the triples associated with its items\n return { entity: list, triples: appendAllTo(listTriples, triples) };\n }", "function createList(object){\n \n var select = document.getElementById(\"standardlinks\"); \n\tvar length=select.length;\n\t\n\tfor(i=0;i<=length;i++){\n\t\tselect.remove(1);\n\t\t\n\t}\n\t\n\n\tfor(i=0;i<object.length;i++){\n\t\t//var select = document.getElementById(\"standardlinks\"); \n\t\tvar option = document.createElement(\"option\");\n\t\toption.text = object[i].name;\n\t\toption.value=object[i].link;\n\t\tselect.add(option);\n\t}\n}", "function createPages() {\r\n newDiv = document.createElement('div');\r\n newDiv.innerHTML = myLibrary[i].pages; \r\n library.appendChild(newDiv);\r\n }", "list() {\n\t\tconst query = objectToQuery({ prefix: this.objectPath, delimiter: '/' });\n\t\treturn this.fetch(`${baseApiURL}b/${this.bucket}/o${query}`);\n\t}", "function createPage() {\n // Clear the preview div.\n $('#previewDiv').empty();\n \n // Add a new page.\n addPage(new Page());\n}", "static loadJournal() {\n fetch(`${baseURL}/entries`)\n .then(resp => resp.json())\n .then(entries => {\n entries.forEach(entry => {\n let newEntry = new Entry(entry, entry.word, entry.user) \n Entry.all.push(newEntry)\n newEntry.display()\n })\n })\n }", "function ListView_CreateHTMLObject(theObject)\n{\n\t//create the div\n\tvar theHTML = document.createElement(\"div\");\n\t//simple add\n\ttheHTML = Basic_SetParent(theHTML, theObject);\n\t//set its Basic Properties\n\tBasic_SetBasicProperties(theHTML, theObject);\n\t//Listviews always have scrollbars implemented within themselves\n\ttheHTML.style.overflow = \"hidden\";\n\ttheHTML.style.overflowX = \"hidden\";\n\ttheHTML.style.overflowY = \"hidden\";\n\t//Update it completely\n\tListView_Update(theObject);\n\t//set methods\n\ttheHTML.GetData = ListView_GetData;\n\ttheHTML.GetHTMLTarget = ListView_GetHTMLTarget;\n\ttheHTML.UpdateProperties = ListView_UpdateProperties;\n\ttheHTML.ProcessOnKeyDown = ListView_ProcessOnKeyDown;\n\t//block all of our events (they will be handled internaly)\n\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_MOUSEDOWN, Browser_CancelBubbleAndMenu);\n\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_CLICK, Browser_CancelBubbleOnly);\n\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_MOUSERIGHT, Browser_CancelBubbleOnly);\n\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_DOUBLECLICK, Browser_CancelBubbleOnly);\n\t//return the newly created object, now added to the parent\n\treturn theHTML;\n}", "function searchResults(results) {\n var list = document.createElement('ul');\n for (var elem in results) {\n console.log(elem);\n creature = results[elem];\n console.log(creature);\n var list_node = document.createElement('li');\n //var link_text = document.createTextNode();\n var link = document.createElement('a');\n link.innerHTML = creature.name + ' (' + creature.size + \" \" + creature.category + ')';\n link.href = codex_url + '/bestiary/' + creature.name + '.html';\n console.log(link);\n list_node.appendChild(link);\n list.appendChild(list_node);\n }\n return list;\n}", "async function viewObjects(){\n\t//get obj properties to search\n\tconst p = new Parameters();\n\tlet search_params = {};\n\tsearch_params.classification = document.getElementById(\"classification\").value;\n\tsearch_params.culture = document.getElementById(\"culture\").value;\n\tsearch_params.accessionyear = document.getElementById(\"year\").value;\n\tsearch_params.division = document.getElementById(\"division\").value;\n\tsearch_params.period = document.getElementById(\"period\").value;\n\tsearch_params.person = document.getElementById(\"person\").value;\n\tsearch_params.exhibition = document.getElementById(\"exhibition\").value;\n\tsearch_params.medium = document.getElementById(\"medium\").value;\n\t//build search parameters\n\tfor (let prop in search_params){\n\t\tif (!search_params.hasOwnProperty(prop)){ continue; }\n\t\tlet val = search_params[prop];\n\t\tif (!val) { continue; }\n\t\tp.addParams(\"q\", `${prop}:${val}`);\n\t}\n\t//retrieve and display objects\n\tconst data = await getSearchData(OBJECT, p.getParams());\n\thtml = \"<table><tr><th colspan='2'>Objects</th></tr>\";\n\thtml += getObjectTable(data) + \"</table>\";\n\tdocument.getElementById(\"results\").innerHTML = html;\n}", "function addTodosToPage() {\n var ul = document.getElementById(\"todoList\");\n var listFragment = document.createDocumentFragment();\n for (var i = 0; i< todos.length; i++) {\n var todoItem = todos[i];\n var li = createNewTodo(todoItem);\n listFragment.appendChild(li);\n }\n ul.appendChild(listFragment);\n }", "enterObjectList(ctx) {\n\t}", "async listings(root, args) {\n if (args.ids) {\n // ListingIds provided in the query. Not a search by terms.\n const ids = args.ids.slice(\n args.page.offset,\n args.page.offset + args.page.numberOfItems\n )\n const listings = await search.Listing.getByIds(ids)\n return {\n nodes: listings,\n offset: args.page.offset,\n numberOfItems: listings.length,\n totalNumberOfItems: args.ids.length\n }\n } else {\n // Search query. Get listings from the search index.\n const { listings, stats } = await search.Listing.search(\n args.searchQuery,\n args.sort,\n args.order,\n args.filters,\n args.page.numberOfItems,\n args.page.offset\n )\n logger.info(\n `Query: \"${args.searchQuery}\" returned ${listings.length} results.`\n )\n return {\n nodes: listings,\n offset: args.page.offset,\n numberOfItems: listings.length,\n totalNumberOfItems: stats.totalNumberOfListings,\n stats: {\n maxPrice: stats.maxPrice,\n minPrice: stats.minPrice\n }\n }\n }\n }", "function createNavElements(objOfSection){\n\t\tvar $id = '#' + objOfSection.id\n\t\treturn $('<li>').append($('<a>', {\n\t\t\thref: $id,\n\t\t\ttext: objOfSection.name\n\t\t}))\n\t}", "function createObject() {\n var className= $.trim($className.val());\n var dbName = $.trim($dbName.val());\n if (className == null || className.length == 0 || dbName == null || dbName.length == 0) {\n alert(\"ERROR:\\nPlease list a Class Name and a Database Name\");\n return;\n }\n\n var num = getInt($container.attr(\"data-num\"));\n num++;\n $container.attr(\"data-num\", num);\n var $newObject = $container.find(\".object:last-child\").clone(true, true);\n\n $newObject.find(\".object-table\").attr(\"data-rows\", \"1\");\n $newObject.find(\".sel-ai-class\").attr(\"data-id\", num);\n $newObject.find(\".sel-pk-class\").attr(\"data-id\", num);\n \n $newObject.attr({\"data-num\": num, \"data-static\": \"0\"});\n \n \n $container.prepend($newObject);\n }", "function PrefObjectList()\n{\n this.objects = new Array();\n \n return this;\n}", "function composeObject_forCollectionTabsPage(iPageNumber)\r\n{ \r\n /*\r\n The following objectes were already created and initialized on the first call\r\n fullObject = getObjectInfo(xmlResponse, \"return/service_response/object_info\");\r\n urn = fullObject[0];\r\n COLLECTION_EXTERNAL_NAME = fullObject[1];\r\n objectData = fullObject[4];\r\n objectSchema = getSchema(DATASET, COLLECTION);\r\n formatedObject = mergeData2Schema(objectData,objectSchema);\r\n \r\n joinObjects = new Array();\r\n */\r\n\r\n var joinFieldsCount\r\n \r\n if(NSGlobal.bIE)\r\n {\r\n joinFieldsCount = objectData.selectNodes(\"//sw:count\");\r\n }\r\n else\r\n {\r\n joinFieldsCount = objectData.getElementsByTagName(NSGlobal.ajustarPrefNS(\"sw:count\"));\r\n }\r\n \r\n iTotalPages_collectionTabs = Math.ceil(joinFieldsCount.length / ipageSize_collectionTabs);\r\n iTotalPages_collectionTabs = ( iTotalPages_collectionTabs==0 )? 1 : iTotalPages_collectionTabs;\r\n \r\n /*Global Vars\r\n ipageSize_collectionTabs;\r\n iCurrentPage_collectionTabs;\r\n iTotalPages_collectionTabs\r\n */\r\n var iFirst = ipageSize_collectionTabs * iPageNumber;\r\n var iLast = (iFirst + ipageSize_collectionTabs < joinFieldsCount.length)? iFirst + ipageSize_collectionTabs : joinFieldsCount.length;\r\n if(joinObjects.length < iLast) // checking if information wasn't previously loaded\r\n {\r\n\t if(joinFieldsCount.length > 0)\r\n\t { \r\n\t\t //iteration through joinFieldsCount\r\n\t for (var i = iFirst ; i < iLast ; i++)\r\n\t {\r\n\t var joinFieldInternalName = joinFieldsCount[i].parentNode.tagName.split(\":\")[1];\r\n\t var joinCollection = joinFieldInternalName;\r\n\t var joinFieldElements =joinFieldsCount[i].childNodes[0].nodeValue;\r\n\t var joinFieldExternalName;\r\n\t \r\n\t var schemaIterator;\r\n\t if(NSGlobal.bIE){schemaIterator = objectSchema;}else{schemaIterator = objectSchema[0].childNodes;}\r\n\t \r\n\t for (var j = 0 ; j < schemaIterator.length ; j++) \r\n\t { \r\n\t if(schemaIterator[j].nodeType == 1 && schemaIterator[j].getAttribute(\"name\") == joinFieldInternalName)\r\n\t joinFieldExternalName = schemaIterator[j].getAttribute(\"sw:name\");\r\n\t }\r\n\t \r\n\t var childSchema = getSchema(DATASET, joinCollection);\r\n\t if(childSchema == null)\r\n\t childSchema = getSchema(DATASET, joinCollection.substring(0,joinCollection.length - 1)); //MAJOR PROBLEM\r\n\t \r\n\t var joinData = getJoinData(joinFieldInternalName, joinFieldExternalName,joinCollection, childSchema); \r\n\t joinObjects.push(new Array(joinFieldInternalName, joinFieldExternalName,joinFieldElements,childSchema, joinData)); \r\n\t }\r\n\t } \t \r\n }\r\n \r\n \r\n}", "function makePageForEpisodes(ListOfEpisodes) {\n // For each episode in getAllEpisodes() create a div and append it in the rootElement Container and have the class card\n ListOfEpisodes.forEach((oneEpisode) => {\n let createContainer = document.createElement(\"div\");\n rootElem.appendChild(createContainer);\n createContainer.className = \"card\";\n\n // let create the heading for each episode\n let headingDiv = document.createElement(\"div\");\n headingDiv.setAttribute(\"id\", \"headingContainer\");\n let headingElement = document.createElement(\"h2\");\n headingElement.innerText = oneEpisode.name;\n headingDiv.appendChild(headingElement);\n createContainer.appendChild(headingDiv);\n\n // let create the second heading indicating the episode code\n let episodeCodeHeading = document.createElement(\"h3\");\n episodeCodeHeading.innerHTML = `-- S0${oneEpisode.season}E0${oneEpisode.number}`;\n headingDiv.appendChild(episodeCodeHeading);\n\n //create an image element for each episode\n let imagesContainer = document.createElement(\"div\");\n imagesContainer.setAttribute(\"class\", \"imageContainer\");\n let createImageElement = document.createElement(\"img\");\n createImageElement.src = oneEpisode.image.medium;\n imagesContainer.appendChild(createImageElement);\n createContainer.appendChild(imagesContainer);\n\n //create a paragraph element containing the summary found in the getAllEpisode object\n let createParagraph = document.createElement(\"p\");\n createParagraph.innerHTML = oneEpisode.summary;\n imagesContainer.appendChild(createParagraph);\n });\n return ListOfEpisodes;\n}", "function createEntry(pokeTerm) {\r\n return (\r\n <Entry\r\n key={pokeTerm.id}\r\n img={pokeTerm.image}\r\n name={pokeTerm.name}\r\n description={pokeTerm.description}\r\n Evolutions={pokeTerm.Evolutions}\r\n />\r\n );\r\n}", "function createListItem(viewModelObject) {\n if(typeof viewModelObject.expanded == \"undefined\"){\n viewModelObject.expanded = false;\n }\n\n var listItem = jQuery(\"<li></li>\");\n viewModelObject.element = listItem;\n listItem.addClass(\"jqcTreeListItemCollapsed\");\n\n var listItemExpandHandle = jQuery(\"<div class='jqcTreeListItemExpandHandle'>+</div>\");\n var listItemCollapseHandle = jQuery(\"<div class='jqcTreeListItemCollapseHandle'>&ndash;</div>\");\n var listItemEmptyHandle = jQuery(\"<div class='jqcTreeListItemEmptyHandle'> </div>\");\n\n viewModelObject.expandHandle = listItemExpandHandle;\n viewModelObject.collapseHandle = listItemCollapseHandle;\n viewModelObject.emptyHandle = listItemEmptyHandle;\n\n\n listItemExpandHandle.click(function() {\n viewModelObject.expanded = true;\n listItemExpandHandle.hide();\n listItemCollapseHandle.show();\n listItem.find(\">ul\").show();\n });\n\n listItemCollapseHandle.click(function() {\n viewModelObject.expanded = false;\n listItemExpandHandle.show();\n listItemCollapseHandle.hide();\n listItem.find(\">ul\").hide();\n });\n\n\n listItem.append(listItemExpandHandle);\n listItem.append(listItemCollapseHandle);\n listItem.append(listItemEmptyHandle);\n\n var listItemText = jQuery(\"<span></span>\");\n listItemText.text(viewModelObject.dataObject[labelField]);\n listItem.append(listItemText);\n listItemText.click(function() {\n if(typeof viewModelObject.selected === 'undefined' || viewModelObject.selected === false) {\n if(!event.ctrlKey){\n treeList.unselectAllItems();\n }\n treeList.selectItem(viewModelObject);\n } else {\n treeList.unselectItem(viewModelObject);\n }\n\n eventManager.fireEvent(\"click-item\", function(listener) {\n listener.listenerFunction(event, listItem, viewModelObject);\n })\n });\n\n var childList = jQuery(\"<ul></ul>\");\n listItem.append(childList);\n childList.hide();\n\n if(treeList.viewModel.parentIdField() != null) {\n var parentId = viewModelObject.dataObject[treeList.viewModel.parentIdField()];\n if(parentId != null) {\n\n // 1. find parent view model object\n var parentViewModelObject = treeList.viewModel.getViewModelObjectById(parentId);\n\n // 2. find parent element, and then its <ul> element.\n var parentChildList = parentViewModelObject.element.find(\">ul\");\n\n //3. add this list item to the parent element ul list.\n parentChildList.append(listItem);\n } else {\n treeList.jqc.element.append(listItem);\n }\n\n }\n }", "function openNewPage() {\n let listingData = JSON.parse(localStorage.getItem(listing?.Id));\n\n if (listingData === null) {\n listingData = [];\n }\n\n // If property listing isn't in local storare, then store it\n if (localStorage.getItem(listing?.Id) === null) {\n listingData.push(listing);\n localStorage.setItem(listing?.Id, JSON.stringify(listingData));\n }\n\n window.open(`/listing/${listing?.Id}`);\n // localStorage.clear();\n }", "function displayListings(listings) {\n if (listings.data.children.length === 0) {\n displayError(\"Nothing found to display for this search term.\")\n return;\n } else {\n for (var i = 0; i < listings.data.children.length; i++) {\n listings.data.children[i].data.created = moment(listings.data.children[i].data.created_utc, 'X').format(\"dddd, MMMM Do YYYY, h:mm:ss a\");\n createRedditPost(listings.data.children[i].data);\n\n }\n }\n}", "function newEntity(type) {\n// if (uploadInProgress || downloadInProgress)\n// return;\n // Ensure a page is selected.\n if (!currentPage) {\n alert(\"You must select a page before you can add an entity.)\");\n return;\n }\n \n // create a new entitiy:\n var entity = new Entity();\n entity.entityType = type;\n // add the entity to the lecture and update accordingly\n addEntity(entity);\n // add it to the list\n entities.push(entity);\n console.log(entity);\n console.log(entities);\n}", "function createReciprocalAssociation(obj_title, recip_obj_id, obj_class, obj_permalink, field, blog_id) {\n jQuery('input#'+field+'.reciprocal-object').val( recip_obj_id );\n\n // Create a list item populated with title, edit, view, and remove links.\n var $li = createObjectListing(\n obj_title,\n recip_obj_id,\n obj_class,\n obj_permalink,\n blog_id\n );\n\n jQuery('ul#custom-field-reciprocal-'+field)\n .append($li);\n}", "function buildListItem(obj){\n let listItem = document.createElement('li')\n listItem.classList.add('app__list-item')\n\n let title = document.createElement('h3')\n title.innerText = \"WebSite: \"+obj.title\n listItem.appendChild(title)\n\n let username = document.createElement('p')\n username.innerText = \"Username: \"+obj.username\n listItem.appendChild(username)\n\n let password = document.createElement('p')\n password.innerText = \"Password: \"+obj.password\n password.setAttribute('data-pass', obj.password)\n listItem.appendChild(password)\n\n let cross = document.createElement('div')\n cross.classList.add(\"app__list-item__cross\")\n cross.innerText = \"X\"\n listItem.appendChild(cross)\n\n return listItem\n}", "function createHTMLListFromObject(jsObject) {\n var list = document.createElement('ul');\n // Change the padding (top: 0, right:0, bottom:0 and left:1.5)\n list.style.padding = '0 0 0 1.5rem';\n // For each property of the object\n Object.keys(jsObject).forEach(function _(property) {\n // create item\n var item = document.createElement('li');\n // append property name\n item.appendChild(document.createTextNode(property));\n\n if (jsObject[property] === null) {\n jsObject[property] = 'null';\n }\n\n if (typeof jsObject[property] === 'object') {\n // if property value is an object, then recurse to\n // create a list from it\n item.appendChild(\n createHTMLListFromObject(jsObject[property]));\n } else {\n // else append the value of the property to the item\n item.appendChild(document.createTextNode(': '));\n item.appendChild(\n document.createTextNode(jsObject[property]));\n }\n list.appendChild(item);\n });\n return list;\n}", "function createEntry(itemText) {\n\tconsole.log(\"Creating item '\" + itemText + \"'...\");\n\tvar entry = handle + checkYes;\n\tentry += '<div class=\"item-display unchecked\">' + itemText + '</div>';\n\tentry += editBox + edit + delButton;\n\t$('<li class=\"item-box\"></div>').appendTo('.item-list').html(entry);\n}", "function createOwnerList(obj) {\n\tvar uc = UtanCache(\"allOwner\") || UtanGlobalCache(\"allOwner\");\n\tif (!uc) return obj;\n\t\n\tvar ownerObj = uc.get();\n\tobj.add(new Option(\"\",\"\"));\n\tif (ownerObj) {\n\t\tfor (var owner in ownerObj) {\n\t\t\tobj.add(new Option(ownerObj[owner].OWNER_DESC,owner));\n\t\t}\n\t}\n}", "function generateList() {\n const ul = document.querySelector(\".list\");\n abrigoList.forEach((abrigo) => {\n const li = document.createElement(\"li\");\n const div = document.createElement(\"div\");\n const a = document.createElement(\"a\");\n const p = document.createElement(\"p\");\n a.addEventListener(\"click\", () => {\n irParaAbrigo(abrigo);\n });\n div.classList.add(\"abrigo-item\");\n a.innerText = abrigo.properties.name;\n a.href = \"#\";\n p.innerText = abrigo.properties.address;\n\n div.appendChild(a);\n div.appendChild(p);\n li.appendChild(div);\n ul.appendChild(li);\n });\n}", "function createContentFrom(obj){\n\n let frag = new DocumentFragment();\n\n let resultItem = document.createElement('li');\n resultItem.className = \"index-search-results--item\";\n\n let img = new Image();\n img.className = \"index-search-results--img\";\n img.src = `https://s3.amazonaws.com/aws-website-alecaaroncom-kjonn/img/${obj.img}`;\n\n // glue all the elements together to form a results-item component\n resultItem.appendChild(img);\n\n let h2 = document.createElement('h2');\n h2.textContent = obj.name;\n h2.className = \"index-search-results--title\";\n resultItem.appendChild(h2);\n\n let bio = document.createElement('p');\n bio.className = \"index-search-results--bio\";\n bio.textContent = obj.desc;\n\n let h3 = document.createElement('h3');\n h3.textContent = `${obj.name} has ${obj.countries} countries and animals such as:`;\n bio.appendChild(h3);\n console.log(h3);\n\n let animalList = document.createElement('ul');\n obj.animals.forEach( x => {\n let animalItem = document.createElement('li');\n animalItem.textContent = x.type;\n animalList.appendChild(animalItem);\n });\n bio.appendChild(animalList);\n\n //add the final peice tot he resultItem component and glue\n //it to the DOM\n resultItem.appendChild(bio);\n frag.appendChild(resultItem);\n\n //add the component to the DOM\n document.getElementsByClassName('index-search-results')[0].appendChild(frag);\n}", "function createPage(){\nvar header = document.createElement('h3');\nheader.innerText = \"Shopping List\";\ndocument.body.appendChild(header);\ncreateForm();\npopulateList();\n}", "function ListObjectsCommand(input) {\n var _this = \n // Start section: command_constructor\n _super.call(this) || this;\n _this.input = input;\n return _this;\n // End section: command_constructor\n }", "function CreatePageLinks(list, pageNumber) {\n let link = document.createElement(\"a\");\n const listItems = document.createElement(\"li\");\n link.textContent = pageNumber;\n listItems.appendChild(link);\n if (pageNumber == 1) {\n link.className = \"active\";\n }\n link.addEventListener(\"click\", (link) => {\n let aLinks = document.querySelectorAll(\"a\");\n for (let j = 0; j < aLinks.length; j++) {\n aLinks[j].className = \"\";\n }\n link.target.className = \"active\";\n ShowPage(list, pageNumber)\n });\n return listItems;\n}", "function displayEntries() {\n var contactsDiv = document.getElementById(\"contacts\"); \n // i) clear the list by settin innerHTML on the list empty\n contactsDiv.innerHTML = \"\"; \n // ii) (re-)add all entries\n for (var i = 0; i < contacts.length; i++) {\n var entryDiv = document.createElement(\"div\");\n entryDiv.innerHTML = \"<div id=\\\"contact_\" + i + \"\\\" class=\\\"contact\\\">\" \n + contacts[i].display(i) + \"</div>\";\n contactsDiv.appendChild(entryDiv);\n }\n}", "function createPage(name, div, button, links, butRef) {\r\n\t// Create page object\r\n\tconst obj = {};\r\n\t// Assign the variables to the page object\r\n\tobj.name = name;\r\n\tobj.div = div;\r\n\tobj.button = button;\r\n\tobj.videoLinks = [];\r\n\tobj.id = \"#\"+name;\r\n\tobj.vidLinks = links;\r\n\tobj.buttonName = butRef;\r\n\t// Return the page object\r\n\treturn obj;\r\n}", "function getObjects(e){\n\t\n\tvar data=[];\n\tapi.Object.GetAll('PeppaTest',function(r){\n\t\tif(r.success){\n\t\t\tvar count = r.PeppaTest.length;\n\t\t\tfor(var i=0; i<count; i++){\n\t\t\t\tdata.push(Ti.UI.createTableViewRow({title: r.PeppaTest[i].name, className:'pepparow', oid: r.PeppaTest[i].oid, hasCheck:(r.PeppaTest[i].status=='updated')}));\n\t\t\t}\n\t\t\t$.objectList.setData(data);\n\t\t}\n\t});\t\n\t\n}", "function displayNames( data )\n{\n // get the placeholder element from the page\n var listBox = document.getElementById( \"Names\" );\n listBox.innerHTML = \"\"; // clear the names on the page \n\n // iterate over retrieved entries and display them on the page\n for ( var i = 0; i < data.length; ++i )\n {\n // dynamically create a div element for each entry\n // and a fieldset element to place it in\n var entry = document.createElement( \"div\" );\n var field = document.createElement( \"fieldset\" );\n entry.onclick = function() { getAddress( this, this.innerHTML ); };\n entry.id = i; // set the id\n entry.innerHTML = data[ i ].First + \" \" + data[ i ].Last;\n field.appendChild( entry ); // insert entry into the field\n listBox.appendChild( field ); // display the field\n } // end for\n} // end function displayAll ", "function createNewPage(index, wrapper) {\n const page = $('#template .page').clone()[0];\n page.id = \"page\" + index;\n $(wrapper).append(page);\n // populate menu\n $('.menu ul').append(\"<li>\"+ index + \"</li>\");\n}", "function renderListingPage (productQuery) {\n return client.entries({ content_type: ContentTypes.Category }).then(function (categories) {\n var menuItems = categories.map(function (category) {\n return Templates.CategoryMenuItem(category);\n }).join('');\n\n return client.entries(productQuery).then(createProductTiles).then(function (productTiles) {\n return Templates.CategoryPage({\n categoryMenuItems: menuItems,\n productTiles: productTiles,\n searchTerms: productQuery.query\n });\n });\n });\n }", "function prepareList() {\n\t\t// find td of first entry, make it to a template\n\t\tlistNode = document.querySelector('.object-list tbody tr');\n\t\tif (listNode && listNode.parentElement) {\n\t\t\tlistStart = listNode.parentElement;\n\t\t\tlistNode.parentElement.removeChild(listNode);\n\t\t} else {\n\t\t\tconsole.error('No listitem found, could not load objects list.');\n\t\t\treturn;\n\t\t}\n\t}", "function ContentList(options) {\n var instance = (options.instance !== null && options.instance !== undefined) ? options.instance : this;\n var extender = new InstanceExtender();\n \n if (options.instance === null || options.instance === undefined) {\n instance = extender.extendNewInstance({ 'instance': instance, 'options': options});\n }\n \n //extend from object view\n var extOptions = Object.create(options);\n extOptions.instance = instance;\n extOptions.events = false;\n instance = ObjectView(extOptions);\n \n /// <summary>Gets type of view.</summary>\n instance.getType = function () {\n return 'ContentList';\n };\n \n /// <summary>Clears (resets) observer records list and view.</summary>\n instance.clearRecords = function () {\n\n if (instance.getObserverInterface() !== null && instance.getObserverInterface() !== undefined) {\n \n if (instance.getObserverInterface().getType() === 'ListObserver' \n || instance.getObserverInterface().getType() === 'ListKNObserver') {\n \n instance.getObserverInterface().clearList();\n instance.getObserverInterface().displayProcessing(false);\n \n }\n }\n };\n\n /// <summary>\n /// Find records based on provided keyword (via observer keyword property) and page number.\n /// if observer is not available then finds records based on options.keyword, options.size, options.page and options.fill.\n /// </summary>\n instance.find = function (options) {\n \n if (instance.getObserverInterface() !== null && instance.getObserverInterface() !== undefined) {\n \n instance.getObserverInterface().displayProcessingActivity();\n instance.getCRUDProcessor().find({\n 'uri': instance.URI,\n 'contentType': options.contentType,\n 'keyword': (options.keyword !== null && options.keyword !== undefined) ? options.keyword : instance.getObserverInterface().getKeyword(),\n 'size': (options.size !== null && options.size !== undefined) ? options.size : (instance.getObserverInterface().getListSize() !== null && instance.getObserverInterface().getListSize() !== undefined) ? instance.getObserverInterface().getListSize() : 10,\n 'page': options.page,\n 'fill': options.fill\n });\n \n } else {\n \n instance.getCRUDProcessor().find({\n 'uri': instance.URI,\n 'contentType': options.contentType,\n 'keyword': options.keyword,\n 'size': options.size,\n 'page': options.page,\n 'fill': options.fill\n });\n }\n };\n \n /// <summary>Get component from record.</summary>\n instance.getRecordComponent = function (record) {\n \n var component;\n var recordOptions = Object.create(instance.newOptions());\n recordOptions.objectkey = record.getKey();\n\n if (instance.newOptions().subjectf !== null\n && instance.newOptions().subjectf !== undefined) {\n\n recordOptions.subject = Util().extractFieldValue(record[instance.newOptions().subjectf], \"\");\n }\n\n if (instance.newOptions().descriptionf !== null\n && instance.newOptions().descriptionf !== undefined) {\n\n recordOptions.description = Util().extractFieldValue(record[instance.newOptions().descriptionf], \"\");\n }\n\n if (instance.newOptions().urlf !== null\n && instance.newOptions().urlf !== undefined) {\n\n recordOptions.url = Util().extractFieldValue(record[instance.newOptions().urlf], \"\");\n }\n\n if (instance.newOptions().urltitlef !== null\n && instance.newOptions().urltitlef !== undefined) {\n\n recordOptions.urltitle = Util().extractFieldValue(record[instance.newOptions().urltitlef], \"\");\n }\n\n if (instance.newOptions().textviewhtmlf !== null\n && instance.newOptions().textviewhtmlf !== undefined) {\n\n recordOptions.html = Util().extractFieldValue(record[instance.newOptions().textviewhtmlf], \"\");\n }\n\n if (instance.newOptions().textviewcssf !== null\n && instance.newOptions().textviewcssf !== undefined) {\n\n recordOptions.css = Util().extractFieldValue(record[instance.newOptions().textviewcssf], \"\");\n }\n\n if (instance.newOptions().imagenamef !== null\n && instance.newOptions().imagenamef !== undefined) {\n\n recordOptions.imagename = Util().extractFieldValue(record[instance.newOptions().imagenamef], \"\");\n }\n\n if (instance.newOptions().imagepathf !== null\n && instance.newOptions().imagepathf !== undefined) {\n\n recordOptions.imagepath = Util().extractFieldValue(record[instance.newOptions().imagepathf], \"\");\n }\n\n if (instance.newOptions().imagetitlef !== null\n && instance.newOptions().imagetitlef !== undefined) {\n\n recordOptions.imagetitle = Util().extractFieldValue(record[instance.newOptions().imagetitlef], \"\");\n }\n \n if (instance.newOptions().imagewidthf !== null\n && instance.newOptions().imagewidthf !== undefined) {\n\n recordOptions.imagewidth = Util().extractFieldValue(record[instance.newOptions().imagewidthf], \"\");\n }\n\n if (instance.newOptions().imageheightf !== null\n && instance.newOptions().imageheightf !== undefined) {\n\n recordOptions.imageheight = Util().extractFieldValue(record[instance.newOptions().imageheightf], \"\");\n }\n\n if (instance.newOptions().imageviewhtmlf !== null\n && instance.newOptions().imageviewhtmlf !== undefined) {\n\n recordOptions.html = Util().extractFieldValue(record[instance.newOptions().imageviewhtmlf], \"\");\n }\n\n if (instance.newOptions().imageviewcssf !== null\n && instance.newOptions().imageviewcssf !== undefined) {\n\n recordOptions.css = Util().extractFieldValue(record[instance.newOptions().imageviewcssf], \"\");\n }\n\n if (instance.newOptions().videosrcf !== null\n && instance.newOptions().videosrcf !== undefined) {\n\n recordOptions.videosrc = Util().extractFieldValue(record[instance.newOptions().videosrcf], \"\");\n }\n\n if (instance.newOptions().crossoriginf !== null\n && instance.newOptions().crossoriginf !== undefined) {\n\n recordOptions.crossorigin = Util().extractFieldValue(record[instance.newOptions().crossoriginf], \"\");\n }\n\n if (instance.newOptions().posterf !== null\n && instance.newOptions().posterf !== undefined) {\n\n recordOptions.poster = Util().extractFieldValue(record[instance.newOptions().posterf], \"\");\n }\n\n if (instance.newOptions().preloadf !== null\n && instance.newOptions().preloadf !== undefined) {\n\n recordOptions.preload = Util().extractFieldValue(record[instance.newOptions().preloadf], \"\");\n }\n\n if (instance.newOptions().autoplayf !== null\n && instance.newOptions().autoplayf !== undefined) {\n\n recordOptions.autoplay = Util().extractFieldValue(record[instance.newOptions().autoplayf], \"\");\n }\n\n if (instance.newOptions().mediagroupf !== null\n && instance.newOptions().mediagroupf !== undefined) {\n\n recordOptions.mediagroup = Util().extractFieldValue(record[instance.newOptions().mediagroupf], \"\");\n }\n\n if (instance.newOptions().loopf !== null\n && instance.newOptions().loopf !== undefined) {\n\n recordOptions.loop = Util().extractFieldValue(record[instance.newOptions().loopf], \"\");\n }\n\n if (instance.newOptions().mutedf !== null\n && instance.newOptions().mutedf !== undefined) {\n\n recordOptions.muted = Util().extractFieldValue(record[instance.newOptions().mutedf], \"\");\n }\n\n if (instance.newOptions().controlsf !== null\n && instance.newOptions().controlsf !== undefined) {\n\n recordOptions.controls = Util().extractFieldValue(record[instance.newOptions().controlsf], instance.newOptions().controls);\n } else {\n\n if (instance.newOptions().controls !== null\n && instance.newOptions().controls !== undefined) {\n\n recordOptions.controls = instance.newOptions().controls;\n }\n }\n\n if (instance.newOptions().videowidthf !== null\n && instance.newOptions().videowidthf !== undefined) {\n\n recordOptions.videowidth = Util().extractFieldValue(record[instance.newOptions().videowidthf], \"\");\n }\n\n if (instance.newOptions().videoheightf !== null\n && instance.newOptions().videoheightf !== undefined) {\n\n recordOptions.videoheight = Util().extractFieldValue(record[instance.newOptions().videoheightf], \"\");\n }\n\n if (instance.newOptions().avviewhtmlf !== null\n && instance.newOptions().avviewhtmlf !== undefined) {\n\n recordOptions.html = Util().extractFieldValue(record[instance.newOptions().avviewhtmlf], \"\");\n }\n\n if (instance.newOptions().avviewcssf !== null\n && instance.newOptions().avviewcssf !== undefined) {\n\n recordOptions.css = Util().extractFieldValue(record[instance.newOptions().avviewcssf], \"\");\n }\n\n if (recordOptions.subject.length > 0) {\n //viewType = \"TextView\";\n component = new TextView(recordOptions);\n }\n\n if (recordOptions.imagepath.length > 0) {\n //viewType = \"ImageView\";\n recordOptions.imagepath = (instance.newOptions().contextpath !== null && instance.newOptions().contextpath !== undefined) ? instance.newOptions().contextpath + recordOptions.imagepath : recordOptions.imagepath;\n component = new ImageView(recordOptions);\n }\n\n if (recordOptions.videosrc.length > 0) {\n //viewType = \"AVView\";\n recordOptions.videosrc = (instance.newOptions().contextpath !== null && instance.newOptions().contextpath !== undefined) ? instance.newOptions().contextpath + recordOptions.videosrc : recordOptions.videosrc;\n component = new AVView(recordOptions);\n }\n \n return component;\n };\n \n /// <summary>Present view with input values and html format.</summary>\n instance.presentView = function (options) {\n var htmlOutput = \"\";\n var records = [];\n\n if (options !== null && options !== undefined) {\n\n if (options.records !== null && options.records !== undefined) {\n\n records = options.records;\n\n } else {\n\n records = instance.getCRUDProcessor().getRecords();\n }\n } else {\n\n records = instance.getCRUDProcessor().getRecords();\n }\n\n for (var i = 0; i < records.length; i++) {\n \n htmlOutput += instance.getRecordComponent(records[i]).presentView();\n }\n \n return htmlOutput;\n };\n \n if (instance.getObserverInterface() !== null &&\n instance.getObserverInterface() !== undefined) {\n \n /** \n * Observer clearRecords function definition.\n * \n * @returns {undefined}\n */\n instance.getObserverInterface().clearRecords = function () {\n instance.clearRecords();\n };\n \n /** \n * Observer find function definition.\n * \n * @param {type} options\n * @returns {undefined}\n */\n instance.getObserverInterface().find = function (options) {\n instance.find(options);\n };\n \n /** \n * Observer find function definition.\n * \n * @param {type} options\n * @returns {undefined}\n */\n instance.getObserverInterface().presentView = function (options) {\n instance.presentView(options);\n };\n }\n \n if (instance.getObserverObject() !== null &&\n instance.getObserverObject() !== undefined) {\n \n /** \n * Observer clearRecords function definition.\n * \n * @returns {undefined}\n */\n instance.getObserverObject().clearRecords = function () {\n instance.clearRecords();\n };\n \n /**\n * Observer find function definition.\n * \n * @param {type} options\n * @returns {undefined}\n */\n instance.getObserverObject().find = function (options) {\n instance.find(options);\n };\n \n /** \n * Observer find function definition.\n * \n * @param {type} options\n * @returns {undefined}\n */\n instance.getObserverObject().presentView = function (options) {\n instance.presentView(options);\n };\n }\n \n /// <summary>Error processing and presenting event subscription.</summary>\n instance.presentErrors = function (event, eventData) {\n\n if (eventData.data.callback !== null &&\n eventData.data.callback !== undefined) {\n\n eventData.data.callback(eventData.result);\n } else {\n\n var htmlErrorOutput = \"An error has occured.\";\n if (instance.getMessageRepository() !== null && instance.getMessageRepository() !== undefined) {\n htmlErrorOutput = instance.getMessageRepository().get(\"standard.err.text\");\n }\n\n if ((instance.ErrorNode !== null && instance.ErrorNode !== undefined)\n || (instance.contenNode !== null && instance.contenNode !== undefined)) {\n\n htmlErrorOutput = \"\";\n for (var i = 0; i < instance.getErrors().length; i++) {\n\n htmlErrorOutput += (instance.getErrors()[i] + \". \");\n\n }\n }\n\n if (instance.ErrorNode !== null && instance.ErrorNode !== undefined) {\n\n instance.ErrorNode.innerHTML = htmlErrorOutput;\n\n } else if (instance.ContentNode !== null && instance.ContentNode !== undefined) {\n\n instance.ContentNode.innerHtml = htmlErrorOutput;\n\n } else {\n\n if (instance.getObserverInterface() !== null\n && instance.getObserverInterface() !== undefined) {\n\n instance.getObserverInterface().displayClearActivity();\n instance.getObserverInterface().setErrors(instance.getErrors());\n }\n }\n }\n };\n\n /// <summary>Multiple records processing and presenting event subscription.</summary>\n instance.presentRecords = function (event, eventData) {\n\n if (eventData.data.callback !== null &&\n eventData.data.callback !== undefined) {\n\n eventData.data.callback(eventData.result);\n } else {\n\n if (instance.ContentNode !== null && instance.ContentNode !== undefined) {\n\n instance.ContentNode.innerHTML = instance.presentView();\n\n } else {\n\n if (instance.getObserverInterface() !== null\n && instance.getObserverInterface() !== undefined) {\n\n var records;\n\n if (instance.getObserverInterface().getType() === \"ListObserver\" ||\n instance.getObserverInterface().getType() === \"ListKNObserver\") {\n\n if (instance.getObserverInterface().getListObject().getContentTypeObjectPrototype() !== null\n && instance.getObserverInterface().getListObject().getContentTypeObjectPrototype() !== undefined) {\n\n records = instance.getContentTypeObjects({'simpleObjects': eventData.result, 'contentPrototype': instance.getObserverInterface().getListObject().getContentTypeObjectPrototype()});\n }\n\n } else {\n\n records = (instance.getObserverInterface().getContentTypeObject() !== null && instance.getObserverInterface().getContentTypeObject() !== undefined) ? instance.getContentTypeObjects({'simpleObjects': eventData.result}) : eventData.result;\n }\n\n instance.getObserverInterface().clearList();\n\n for (var i = 0; i < records.length; i++) {\n //var viewType = \"TextView\";\n instance.getObserverInterface().newItem({'object': instance.getRecordComponent(records[i]) });\n }\n \n instance.getObserverInterface().displaySuccessActivity();\n }\n }\n }\n\n $(window).trigger('view-direction-change');\n };\n \n /// <summary>Presents request failure.</summary>\n instance.presentFailRequest = function (event, eventData) {\n \n if (eventData.data.callback !== null &&\n eventData.data.callback !== undefined) {\n\n eventData.data.callback(eventData.result);\n } else {\n \n var htmlErrorOutput = \"An error has occured.\";\n if (instance.getMessageRepository() !== null && instance.getMessageRepository() !== undefined) {\n htmlErrorOutput = instance.getMessageRepository().get(\"standard.err.text\");\n }\n \n if (instance.ErrorNode !== null && instance.ErrorNode !== undefined) {\n \n instance.ErrorNode.innerHTML = htmlErrorOutput;\n \n } else if (instance.ContentNode !== null && instance.ContentNode !== undefined) {\n\n instance.ContentNode.innerHtml = htmlErrorOutput;\n \n } else {\n \n if (instance.getObserverInterface() !== null\n && instance.getObserverInterface() !== undefined) {\n \n instance.getObserverInterface().displayFailureActivity();\n }\n }\n }\n };\n\n /// <summary>Subscribe CRUDProcessor events.</summary>\n instance.subscribeEvents = function (eventsInstance) {\n eventsInstance = (eventsInstance !== null && eventsInstance !== undefined) ? eventsInstance : instance;\n \n $(instance.getCRUDProcessor()).on('errors.processor.CRUD.WindnTrees', eventsInstance.presentErrors);\n $(instance.getCRUDProcessor()).on('records.processor.CRUD.WindnTrees', eventsInstance.presentRecords);\n $(instance.getCRUDProcessor()).on('fail.processor.CRUD.WindnTrees', eventsInstance.presentFailRequest);\n };\n \n /// <summary>Subscribe CRUDProcessor events.</summary>\n instance.unSubscribeEvents = function (eventsInstance) {\n \n eventsInstance = (eventsInstance !== null && eventsInstance !== undefined) ? eventsInstance : instance;\n \n $(instance.getCRUDProcessor()).off('errors.processor.CRUD.WindnTrees', eventsInstance.presentErrors);\n $(instance.getCRUDProcessor()).off('records.processor.CRUD.WindnTrees', eventsInstance.presentRecords);\n $(instance.getCRUDProcessor()).off('fail.processor.CRUD.WindnTrees', eventsInstance.presentFailRequest);\n };\n \n if (options.events !== null && options.events !== undefined) {\n if (options.events) {\n instance.subscribeEvents();\n }\n } else {\n instance.subscribeEvents();\n }\n \n if (options.contextpath !== null && options.contextpath !== undefined) {\n if (options.contextpath === 'load') {\n instance.loadContextPath();\n }\n }\n \n if (options.instance !== null && options.instance !== undefined) {\n return Object.create(instance);\n }\n \n return instance;\n}", "function createEntry(title, travelDate, coverPhoto) {\n // create variable that holds what a new entry object should include\n const newEntry = {\n title,\n travelDate,\n coverPhoto\n };\n // create ajax POST call that uses entries in url value\n $.ajax({\n type: \"POST\",\n url: \"/api/entries\",\n dataType: \"json\",\n contentType: \"application/json\",\n data: JSON.stringify(newEntry),\n\n headers: {\n Authorization: `Bearer ${jwt}`\n }\n })\n .done(function() {\n getUserDashboard();\n })\n .fail(function(jqXHR, error, errorThrown) {\n console.error(jqXHR);\n console.error(error);\n console.error(errorThrown);\n });\n}", "function createObject() {\n if (idNum === 0) {\n document.getElementById(\"prompt\").innerHTML = \"Drag object to start building!\";\n setTimeout(deletePrompt, 5000);\n }\n\n // create same object as clicked on and pop-up in middle of page\n let newObj = this.cloneNode(true);\n newObj.id = \"obj\" + idNum;\n newObj.style.position = \"absolute\";\n newObj.style.left = \"50%\";\n newObj.style.top = \"50%\";\n newObj.style.transform = \"translate(-50%, -50%)\";\n newObj.style.backgroundColor =\n window.getComputedStyle(this, null).getPropertyValue(\"background-color\");\n newObj.onmousedown = dragging;\n\n document.getElementById(\"environment\").append(newObj);\n idNum++;\n\n postObject(newObj);\n }", "function ListBox_CreateHTMLObject(theObject)\n{\n\t//create the div\n\tvar theHTML = document.createElement(\"div\");\n\t//simple add\n\ttheHTML = Basic_SetParent(theHTML, theObject);\n\t//set its Basic Properties\n\tBasic_SetBasicProperties(theHTML, theObject);\n\t//correct js properties\n\tListBox_CorrectStyleProperties(theObject);\n\t//Update Content (will trigger caption update)\n\tListBox_UpdateContent(theHTML, theObject);\n\t//set our interpreter methods\n\ttheHTML.GetData = ListBox_GetData;\n\ttheHTML.GetHTMLTarget = ListBox_GetHTMLTarget;\n\ttheHTML.GetUserInputChanges = ListBox_GetUserInputChanges;\n\ttheHTML.UpdateProperties = ListBox_UpdateProperties;\n\ttheHTML.ProcessOnKeyDown = ListBox_ProcessOnKeyDown;\n\t//block all of our events (they will be handled internaly)\n\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_MOUSEDOWN, Browser_CancelBubbleAndMenu);\n\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_CLICK, Browser_CancelBubbleOnly);\n\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_MOUSERIGHT, Browser_CancelBubbleOnly);\n\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_DOUBLECLICK, Browser_CancelBubbleOnly);\n\t//we need to listen to scroll events\n\tBrowser_AddEvent(theHTML, __BROWSER_EVENT_SCROLL, ListBox_OnScroll);\n\t//return the newly created object\n\treturn theHTML;\n}", "function renderFeedEntries(index) {\n //reset the collection \n App.FeedContent.reset();\n var entrySet = App.FeedEntries.at(index).get(\"content\");\n for (var i = 0; i < App.NumEntriesPerPage; i++) {\n var feedEntryJson = entrySet[i];\n var feedEntryModel = new FeedEntry(feedEntryJson);\n var mediaContents = feedEntryJson.mediaGroups[0].contents[0];\n feedEntryModel.set({\n \"thumbnailUrl\": mediaContents.thumbnails[0].url\n });\n feedEntryModel.set({\n \"videoUrl\": mediaContents.url\n });\n feedEntryModel.set({\n \"category\": feedEntryJson.categories[0]\n });\n feedEntryModel.set({\n \"index\": i\n });\n App.FeedContent.add(feedEntryModel);\n }\n togglePagination();\n}", "function displayRestaurant(obj) {\n const li = document.createElement('li');\n li.classList.value = 'ul-item result';\n\n const div = document.createElement('div');\n div.classList.value = 'li-item result-div';\n div.id = obj.id;\n div.innerText = obj.name + ' ' + obj.review_count;\n \n const reviewsBtn = document.createElement('button');\n reviewsBtn.classList.value = 'btn get-reviews';\n reviewsBtn.innerText = 'See reviews';\n reviewsBtn.addEventListener('click', getReviews, { once: true });\n\n const goingBtn = document.createElement('button');\n goingBtn.classList.value = 'btn going';\n goingBtn.addEventListener('click', updateDb);\n\n div.appendChild(reviewsBtn);\n div.appendChild(goingBtn);\n li.appendChild(div);\n document.getElementById('results').appendChild(li);\n }", "function newObject(object) {\n switch (object) {\n case 'sketch':\n create(\"canvas\");\n break;\n case 'photo':\n create('img');\n break;\n case 'title':\n create('p');\n break;\n case 'grid':\n grid.openGridSettings();\n break;\n }\n}", "listing_post(query) {\n return this._post('listing', query);\n }", "function addSearchResultToPage(todoItem) {\n var ul = document.getElementById(\"searchResultsList\");\n var li = document.createElement(\"li\");\n li.innerHTML =\n todoItem.who + \" needs to \" + todoItem.task + \" by \" + todoItem.dueDate;\n ul.appendChild(li);\n}", "function listMaker(data) {\n var $list = $('<div>');\n for (var datum in data) {\n if (data.hasOwnProperty(datum)) {\n var $item = $('<div>');\n $item.append($('<span>', {\n text: datum + ': '\n }));\n // Deal with objects.\n if (typeof(data[datum]) === 'object') {\n // jQuery objects are large and will stall the browse\n // if we try to print them. Just state that this is\n // a jQuery object.\n if (data[datum].jquery) {\n $item.append($('<b>', {\n text: '[jQuery] jQuery object'\n }));\n }\n // Otherwise recurse the function.\n else {\n $item.append(listMaker(data[datum]));\n }\n }\n else {\n $item.append($('<b>', {\n text: '[' + typeof(data[datum]) + '] ' + data[datum]\n }));\n }\n $item.appendTo($list);\n }\n }\n return ($list.children().length > 0) ? $list : $('<span>', {\n text: 'null'\n });\n }", "static initialize(obj, events, pageInfo) { \n obj['events'] = events;\n obj['page_info'] = pageInfo;\n }", "init() {\n this._super(...arguments);\n this._createPages();\n }", "function composeObject(xmlResponse, oInfoWindow)\r\n{ \r\n\r\n\tfullObject = getObjectInfo(xmlResponse, \"return/service_response/object_info\");\r\n\turn = fullObject[0];\r\n\tCOLLECTION_EXTERNAL_NAME = fullObject[1];\r\n\tobjectData = fullObject[4];\r\n\tobjectSchema = getSchema(DATASET, COLLECTION);\r\n\tformatedObject = mergeData2Schema(objectData,objectSchema);\r\n\t\r\n\tjoinObjects = new Array();\r\n\r\n\t/*Global Vars\r\n ipageSize_collectionTabs;\r\n iTotalPages_collectionTabs;\r\n iTotalPages_collectionTabs\r\n\t */\r\n\tiCurrentPage_collectionTabs = 0;\r\n\t\r\n\tcomposeObject_forCollectionTabsPage(iCurrentPage_collectionTabs);\r\n\r\n}", "function createEntry(listTitle, entryName, urlStr, entryID, backGroundColor){\r\n let entry = mySubWindow.document.createElement(\"div\");\r\n let userList = mySubWindow.document.getElementById(\"userList\");\r\n entry.id = \"container\";\r\n let entryImage = mySubWindow.document.createElement(\"img\");\r\n if (urlStr == null || urlStr == \"null\") {\r\n entryImage.src = \"https://i.imgur.com/wiUoT13.png\"\r\n }else{\r\n entryImage.src = basePosterURL + \"w92\" + urlStr;\r\n }\r\n entryImage.className = \"center-img\";\r\n entry.appendChild(entryImage);\r\n \r\n let dText = mySubWindow.document.createElement(\"div\");\r\n let title = mySubWindow.document.createElement(\"h2\");\r\n entry.style.backgroundColor=backGroundColor\r\n let removeBtn = mySubWindow.document.createElement(\"button\");\r\n removeBtn.className = \"btn btn-outline-danger\"\r\n removeBtn.innerHTML = \"remove\"\r\n removeBtn.onclick = function() {\r\n removeEntry(listTitle, entryName, entryID)\r\n }\r\n\r\n let upArrCon = mySubWindow.document.createElement(\"p\");\r\n \r\n let downArrCon = mySubWindow.document.createElement(\"p\")\r\n let upArr = mySubWindow.document.createElement(\"i\")\r\n let downArr = mySubWindow.document.createElement(\"i\")\r\n let upBtn = mySubWindow.document.createElement(\"button\");\r\n let downBtn = mySubWindow.document.createElement(\"button\");\r\n\r\n \r\n upArrCon.id = \"arrOffset\";\r\n downArrCon.id = \"arrOffset\";\r\n upBtn.id = \"upArrow\"\r\n downBtn.id =\"downArrow\"\r\n\r\n upArr.className = \"arrow up\";\r\n \r\n upBtn.onclick = function() {\r\n changeOrder(listTitle, entryName, entryID,\"up\")\r\n }\r\n downBtn.onclick = function() {\r\n changeOrder(listTitle, entryName, entryID,\"down\")\r\n }\r\n\r\n downArr.className = \"arrow down\";\r\n upBtn.appendChild(upArr);\r\n downBtn.appendChild(downArr);\r\n upArrCon.appendChild(upBtn);\r\n downArrCon.appendChild(downBtn);\r\n\r\n dText.className = \"center-txt\";\r\n title.textContent = entryName;\r\n dText.appendChild(title);\r\n dText.append(removeBtn);\r\n dText.appendChild(upArrCon);\r\n dText.appendChild(downArrCon);\r\n \r\n entry.appendChild(dText);\r\n\r\n let tableRow = mySubWindow.document.createElement(\"tr\");\r\n let tableOrder = mySubWindow.document.createElement(\"td\");\r\n let orderText = mySubWindow.document.createElement(\"h1\");\r\n orderText.style.textAlign = \"center\";\r\n orderText.innerHTML = totalEntryCount + 1;\r\n orderText.className=\"tableElement\"\r\n tableOrder.appendChild(orderText);\r\n let tableTitle = mySubWindow.document.createElement(\"td\");\r\n tableTitle.appendChild(entry)\r\n tableTitle.style.width=\"100%\"\r\n tableRow.appendChild(tableOrder);\r\n tableRow.appendChild(tableTitle);\r\n userList.appendChild(tableRow);\r\n}", "function buildList(data) {\n var json = JSON.parse(data);\n if (json.length == 0) {\n var none = document.createElement(\"p\");\n none.innerText = \"There seems to be nothing here :(\"\n return none;\n }\n var list = document.createElement(\"ul\");\n for (var i = 0, n = json.length; i < n; i++) {\n var anchor = document.createElement(\"a\");\n anchor.innerHTML = json[i].title;\n var code = document.createElement(\"pre\");\n var edit = document.createElement(\"a\");\n if (json[i].code == \"\" || json[i].code == undefined) { //For posts w/o code\n code.innerText = json[i].source;\n edit.setAttribute(\"href\", \"https://www.thiscodeworks.com/\" + json[i]._id+\"/editlink\");\n } else {\n code.innerText = json[i].code;\n edit.setAttribute(\"href\", \"https://www.thiscodeworks.com/\" + json[i]._id+\"/edit\");\n }\n code.setAttribute(\"class\", \"hide\");\n var item = document.createElement('li');\n item.appendChild(anchor);\n item.appendChild(code);\n list.appendChild(item);\n var icons = document.createElement(\"span\"); //Holds icons\n icons.setAttribute(\"class\", \"icons\");\n var expand = document.createElement(\"a\"); //Adds `open in new tab` btn\n expand.setAttribute(\"href\", \"https://www.thiscodeworks.com/\" + json[i]._id);\n anchor.setAttribute(\"href\", \"javascript:;\");\n expand.setAttribute(\"target\", \"_blank\");\n expand.setAttribute(\"class\", \"expand\");\n expand.setAttribute(\"title\", \"Open & edit in new tab\");\n var copy = document.createElement(\"a\"); //Adds `copy to clipboard` btn\n copy.setAttribute(\"class\", \"copy\");\n copy.setAttribute(\"title\", \"Copy to clipboard\");\n edit.setAttribute(\"target\", \"_blank\");\n edit.setAttribute(\"class\", \"edit\");\n edit.setAttribute(\"title\", \"Edit post\");\n icons.classList.toggle(\"hide\");\n icons.appendChild(edit);\n icons.appendChild(expand);\n icons.appendChild(copy);\n anchor.insertAdjacentElement(\"beforebegin\", icons);\n }\n return list;\n}", "function renderEachEntry(entry) {\n console.dir(entry);\n return `\n\t\t<div class=\"nav-bar\">\n\t\t<div class=\"nav-1\">\n\t\t\t<div class=\"nav-link\"><a href=\"\" class=\"my-journal-button\">My Profile</a></div>\n\t\t\t<div class=\"nav-link\"><a href=\"\" class=\"js-logout-button\">Log out</a></div>\n\t\t</div>\n\t\t</div>\n\t\t<main role=\"main\" class=\"journal-entry\">\n\t\t<div class=\"dashboard-header\">\n <h2>Where To Place's</h2>\n <hr class=\"style-two\">\n\t\t</div>\n\t\t<div class=\"edit-delete\">\n\t\t\t<button class=\"edit\" id=\"js-edit-button\" data-entryid=\"${\n entry.id\n }\">Edit</button>\n\t\t\t<button class=\"delete\" id=\"js-delete-button\" data-entryid=\"${\n entry.id\n }\">Delete</button>\n\t\t</div>\n\t\t<section class=\"each-entry\">\n <h5 class=\"entry-title\">\n <a data-entryid=\"${entry.id}\">${entry.title}</a>\n </h5>\n\t\t\t<p class=\"entry-date\">${entry.travelDate}</p>\n\t\t\t <div class=\"entry-list\"><img class=\"main-entry-photo\" src=\"${\n entry.coverPhoto\n }\">\n </div>\n\t\t</section>\t\n </main>\n <footer class=\"footer\">\n <p>\n Created by: Brian Thomas\n <a href=\"https://github.com/Bjthomas11\" target=\"_blank\"><i class=\"fab fa-github\"></i></a>\n </p>\n </footer>\n\t`;\n}", "function controlContentList(type){\n\n if(type == \"People\"){\n if(people.results.length) constructProfileList(people);\n }\n else{\n switch(type){\n case \"TV Shows\": if(tv.results.length) constructContentList(tv, \"tv\"); break;\n case \"Movies\": if(movies.results.length) constructContentList(movies, \"movie\"); break;\n case \"Collections\": if(collections.results.length) constructContentList(collections); break;\n }\n }\n\n if(currentList.total_pages > 1) updatePageNumbers();\n}", "function renderHeapObject(obj, addToEnd) {\n var objectID = getObjectID(obj);\n\n if (alreadyRenderedObjectIDs[objectID] === undefined) {\n var heapObjID = 'heap_object_' + objectID;\n var newDiv = '<div class=\"heapObject\" id=\"' + heapObjID + '\"></div>';\n\n if (addToEnd) {\n $(vizDiv + ' #heap').append(newDiv);\n }\n else {\n $(vizDiv + ' #heap').prepend(newDiv);\n }\n renderData(obj, $(vizDiv + ' #heap #' + heapObjID), false);\n\n alreadyRenderedObjectIDs[objectID] = 1;\n }\n }", "function createItems(controls) {\n let html = '';\n\t\t\n\t\tconsole.log(controls)\n\t\t\n for (key in controls) {\n if (key === 'self') {\n continue;\n }\n\n const control = controls[key];\n\t\t\t\n\t\t\tvar title = getTitle(control);\n\t\t\t\n\t\t\t\n const href = apiUrl + control._links[\"self\"].href;\n //const href = getCurrentHash() + '/';\n const method = control.method || 'GET';\n\n if (key === 'collection') {\n html += `<li>${createLink(href, `Collection: ${href} (${method})`)}</li>`;\n continue;\n }\n\n // Skip PATCH resources (not implemented)\n if (method === 'PATCH') {\n continue;\n }\n\n // \"Dynamic\" URLs, skip other than GETs (not implemented)\n if (control.isHrefTemplate && (method && method !== 'GET')) {\n continue;\n }\n\n const schemaUrl = apiUrl + control[\"_links\"][\"self\"].href || '';\n\n\t\t\t\t\n\t\t\thtml += `<tr> \n\t\t\t\t\t\t<td>${createLink(\n href,\n `${title} (${method})`,\n method,\n schemaUrl\n )}</td> \n\t\t\t\t\t\t<td>\n\t\t\t\t\t\t${createLink(\n href,\n `Edit`,\n `PUT`,\n schemaUrl\n )}\n\t\t\t\t\t\t</td> \n\t\t\t\t\t\t<td> \n\t\t\t\t\t\t${createLink(\n href,\n `DELETE`,\n `DELETE`,\n schemaUrl\n )}\n\t\t\t\t\t\t</td> \n\t\t\t\t\t</tr>`\n }\n\n return html;\n }", "function ListItem() {}" ]
[ "0.5590515", "0.557202", "0.55439574", "0.553152", "0.54849875", "0.53939384", "0.5362691", "0.53309596", "0.5288687", "0.52574104", "0.5232727", "0.5219121", "0.52162504", "0.52097124", "0.5176707", "0.51550287", "0.5143397", "0.5116031", "0.5105161", "0.5089701", "0.5076542", "0.5064938", "0.50615615", "0.5047265", "0.50263566", "0.50074625", "0.50028116", "0.49863073", "0.49845192", "0.49813595", "0.4966665", "0.49638647", "0.49520856", "0.4948287", "0.4946302", "0.49412858", "0.49380812", "0.4933121", "0.49296743", "0.49235395", "0.49211484", "0.49140292", "0.49040633", "0.48960677", "0.48850864", "0.48831692", "0.48828292", "0.48677045", "0.48665148", "0.48505723", "0.48459283", "0.48379174", "0.483671", "0.48325035", "0.48290187", "0.48204893", "0.48175693", "0.48163652", "0.48156506", "0.48134807", "0.47965544", "0.4787312", "0.4784687", "0.47812265", "0.47605917", "0.47580004", "0.47507635", "0.4745014", "0.4735272", "0.47325933", "0.47236225", "0.4723402", "0.4712113", "0.47103545", "0.47074127", "0.47056103", "0.4704222", "0.469642", "0.46959415", "0.46855658", "0.46791473", "0.46757025", "0.46699876", "0.46633005", "0.46565688", "0.46526152", "0.46525696", "0.46462244", "0.46389753", "0.4634156", "0.46311787", "0.46280295", "0.4624992", "0.46219847", "0.46126837", "0.46082926", "0.46074817", "0.4602896", "0.4602555", "0.46011877" ]
0.6963715
0
Create the reciprocal entry association. This happens after selecting an entry from the popup.
function createReciprocalAssociation(obj_title, recip_obj_id, obj_class, obj_permalink, field, blog_id) { jQuery('input#'+field+'.reciprocal-object').val( recip_obj_id ); // Create a list item populated with title, edit, view, and remove links. var $li = createObjectListing( obj_title, recip_obj_id, obj_class, obj_permalink, blog_id ); jQuery('ul#custom-field-reciprocal-'+field) .append($li); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addRelationship() {\n this.mapTypeForm.reset();\n this.submitted = false;\n this.displayModal = true;\n this.isedit = false;\n }", "function create_related_entry_dialog(data) {\n let dialog = elementFactory({ type: \"div\" });\n let lst_wrap = elementFactory({ type: \"div\", css: { margin: \"5px 0 5px 0\" } });\n let src_lst = elementFactory({ type: \"div\", attr: { id: \"related-entry-src-list\" }, class: \"dialog-list\" });\n let dst_lst = elementFactory({ type: \"div\", attr: { id: \"related-entry-dst-list\" }, class: \"dialog-list\" });\n let arrow_wrap = elementFactory({ type: \"div\", attr: { id: \"arrow-container\" } });\n let arrow_r = elementFactory({ type: \"div\", attr: { id: \"arrow-wrap-r\" }, class: \"select-disable\" });\n let arrow_l = elementFactory({ type: \"div\", attr: { id: \"arrow-wrap-l\" }, class: \"select-disable\" });\n let btn_wrap = elementFactory({ type: \"div\", css: { margin: \"5px 0 5px 0\" } });\n\n // query result show\n $(dialog).append(elementFactory({\n type: \"div\",\n css: { margin: \"5px 0 5px 0\" },\n html: \"找到 \" + Object.keys(data).length + \" 個相關條目\"\n }));\n\n // append wrapper for two list and arrow\n $(lst_wrap).append(src_lst);\n $(lst_wrap).append(arrow_wrap);\n $(lst_wrap).append(dst_lst);\n $(dialog).append(lst_wrap);\n // add query result to src list\n for (let key in data) {\n if(!data.hasOwnProperty(key))\n continue;\n $(src_lst).append(elementFactory({\n type: \"div\",\n attr: { url: data[key], title: decodeURIComponent(key) },\n class: \"related-entry-item select-disable\",\n html: decodeURIComponent(key),\n on: { click: click_related_entry_item }\n }));\n }\n // arrow right\n $(arrow_r).append(elementFactory({ type: \"div\", attr: { id: \"arrow-tail-r\" } }));\n $(arrow_r).append(elementFactory({ type: \"div\", attr: { id: \"arrow-body-r\" }, html: \"加入\" }));\n $(arrow_r).append(elementFactory({ type: \"div\", attr: { id: \"arrow-head-r\" } }));\n $(arrow_wrap).append(arrow_r);\n // arrow left\n $(arrow_l).append(elementFactory({ type: \"div\", attr: { id: \"arrow-head-l\" } }));\n $(arrow_l).append(elementFactory({ type: \"div\", attr: { id: \"arrow-body-l\" }, html: \"刪去\" }));\n $(arrow_l).append(elementFactory({ type: \"div\", attr: { id: \"arrow-tail-l\" } }));\n $(arrow_wrap).append(arrow_l);\n\n // query result add and cancel button\n $(btn_wrap).append(elementFactory({\n type: \"button\",\n attr: { id: \"related-entry-dialog-cancel\" },\n class: \"btn btn-default btn-xs\",\n css: { margin: \"0 20px 0 0\" },\n html: \"取消\",\n on: { click: $.unblockUI }\n }));\n $(btn_wrap).append(elementFactory({\n type: \"button\",\n attr: { id: \"related-entry-dialog-add\" },\n class: \"btn btn-default btn-xs\",\n css: { margin: \"0 0 0 20px\" },\n html: \"加入\",\n on: { click: add_related_entry }\n }));\n $(dialog).append(btn_wrap);\n\n $.blockUI({\n message: $(dialog),\n css: { width: \"450px\", height: \"330px\", top: 'calc(50% - 165px)', left: 'calc(50% - 225px)', cursor: 'auto' }\n });\n}", "function click_related_entry_item(e) {\n let self = e.data.target;\n let key = $(self).attr(\"title\");\n let url = $(self).attr(\"url\");\n let parent;\n if ($(self).parent().attr(\"id\") === \"related-entry-src-list\")\n parent = $(\"#related-entry-dst-list\");\n else\n parent = $(\"#related-entry-src-list\");\n $(self).remove();\n $(parent).append(elementFactory({\n type: \"div\",\n attr: { url: url, title: key },\n class: \"related-entry-item select-disable\",\n html: key,\n on: { click: click_related_entry_item }\n }));\n}", "function refreshDropsWithNewAssociation(){\n console.log(\"called refreshDropsWithNewAssociation\")\n //get the parent associated drop for add existing\n let currentInAddExistingAssociatedType = O('associated_add_existing_entity_select_box_type').value\n console.log(\"type \"+currentInAddExistingAssociatedType)\n fillExistingNameAssociations(currentInAddExistingAssociatedType)\n\n\n let currentInPendingEntityType = O('pending_entity_select_box_type').value\n console.log(\"type \"+currentInPendingEntityType)\n fillPendingNameAssociations(currentInPendingEntityType)\n}", "static associate() {\n // define association here\n }", "static associate() {\n // define association here\n }", "static associate() {\n // define association here\n }", "static associate() {\n // define association here\n }", "function insertSelectedObject(obj_title, obj_id, obj_class, obj_permalink, field, blog_id) {\n // Check if this is a reciprocal association, or just a standard Selected\n // Entry/Page.\n if ( jQuery('input#'+field+'.reciprocal-object').length ) {\n // If a reciprocal association already exists, we need to delete it\n // before creating a new association.\n if ( jQuery('input#'+field+'.reciprocal-object').val() ) {\n deleteReciprocalAssociation(\n field,\n jQuery('input#'+field+'.reciprocal-object').val()\n );\n createReciprocalAssociation(\n obj_title,\n obj_id,\n obj_class,\n obj_permalink,\n field,\n blog_id\n );\n }\n // No existing association exists, so just create the new reciprocal\n // entry association.\n else {\n createReciprocalAssociation(\n obj_title,\n obj_id,\n obj_class,\n obj_permalink,\n field,\n blog_id\n );\n }\n }\n // This is just a standard Selected Entries or Selected Pages insert.\n else {\n // Create a list item populated with title, edit, view, and remove links.\n var $li = createObjectListing(\n obj_title,\n obj_id,\n obj_class,\n obj_permalink,\n blog_id\n );\n\n // Insert the list item with the button, preview, etc into the field area.\n jQuery('ul#custom-field-selected-objects_'+field)\n .append($li)\n\n var objects = new Array();\n objects[0] = jQuery('input#'+field).val();\n objects.push(obj_id);\n jQuery('input#'+field).val( objects.join(',') );\n }\n}", "function addSelfToReverseMap() {\n console.log(\"Adding participant ID: \", getParticipantID(), \"to reverse map\");\n var reverseMap = getNameToIDMap();\n var participant = gapi.hangout.getParticipantById(getParticipantID());\n reverseMap[participant.person.name] = getParticipantID();\n var reverseMapStringified = JSON.stringify(reverseMap);\n gapi.hangout.data.submitDelta( { nameToIDMapKey : reverseMapStringified\n\t\t\t\t\t });\t\n}", "addRelationship() {\n this.relationTypeForm.reset();\n this.submitted = false;\n this.displayModal = true;\n this.isedit = false;\n }", "getEntry(face) { // Used in form view\n if (node.entries == null) {\n node.entries = {};\n }\n\n let entry = node.entries[face];\n if (entry === undefined) {\n entry = createFormEntry({onEntryStateChanged});\n node.entries[face] = entry;\n }\n\n return entry;\n }", "function addRelation()\n{\n var\ttable\t\t= document.getElementById('formTable');\n var tbody\t\t= table.tBodies[0];\n var newrownum\t= tbody.rows.length;\n var\tform\t\t= this.form;\n var formElts\t= form.elements;\n \n var\ttemplate\t= document.getElementById('newRowTemplate');\n var\tparms\t\t= {\"rownum\"\t: newrownum,\n\t\t\t\t\t \"idcp\"\t: newrownum + 1,\n\t\t\t\t\t \"relation\"\t: \"\"};\t\n var newrow\t\t= createFromTemplate(template,\n\t\t\t\t\t\t\t parms,\n\t\t\t\t\t\t\t null);\n tbody.appendChild(newrow);\n}", "static associate(models) {\n models.Identification_association.hasOne(models.AssociationPage);\n models.Identification_association.belongsTo(models.Representant_legale,{\n foreignKey: 'RepresentantLegaleId'\n });\n }", "handleNewEntry() {\n\t\tlet newEntry = {\n\t\t\tQualification: '',\n\t\t\tOrganization: '',\n\t\t\tFrom: '',\n\t\t\tEnd: ''\n\t\t}\n\t\tlet newEntryArray = this.state.entries.concat(newEntry)\n\t\tthis.setState({ entries: newEntryArray })\n\t}", "function add_related_entry() {\n $('#related-entry-dst-list div').each(function() {\n let key = $(this).html();\n let url = $(this).attr(\"url\");\n if (!window.table_wiki_list.includes(url)) {\n window.table_wiki_list.push(url);\n $(\"#wiki-table-body\").append(create_wiki_table_row({ name: key, url: url }, 1));\n }\n });\n $.unblockUI();\n}", "function populateEntryForm(entry) {\n console.log('POPULATE ENTRY with '+ entry.date + ' and ' + entry.entryId);\n //Call db with user_id and email JSON and get-entry-details action\n var userEmail = localStorage.getItem('user-email');\n var action = 'get-entry-details';\n\n\tvar jsonString = {\n user: jsonEscape(userEmail),\n action: action,\n entryId: entry.entryId\n };\n\n\tvar stringified = JSON.stringify(jsonString);\n\n //call database to grab\n getEntryDetails(stringified, 'http://howtoterminal.com/scripture-journal/db/web_service.php');\n}", "function LaserficheEntryDetails(){\n if(window.parent !== window && window.parent.webAccessApi !== undefined) {\n var id = window.parent.webAccessApi.getSelectedEntries()[0].id;\n var entryName = window.parent.webAccessApi.getSelectedEntries()[0].name;\n var entryType = window.parent.webAccessApi.getSelectedEntries()[0].entryType;\n var templateName = window.parent.webAccessApi.getSelectedEntries()[0].templateName;\n $('.entry-id input').val(id);\n $('.entryName input').val(entryName);\n $('.entryType input').val(entryType);\n $('.templateName input').val(templateName);\n\n }\n}", "function modifyRelationship() {\n\t\t\tconsole.log(\"modifyRelationship() -> AlleleFearUpdateAPI()\");\n\n\t\t\t// check if record selected\n\t\t\tif(vm.selectedIndex < 0) {\n\t\t\t\talert(\"Cannot Modify if a record is not selected.\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n // skip duplicates; relationship type, marker\n var rKey = 0;\n var mKey = 0;\n var isMIduplicate = false;\n var isMInoreference = false;\n\t\t\tfor(var i=0;i<vm.apiDomain.mutationInvolves.length; i++) {\n rKey = vm.apiDomain.mutationInvolves[i].relationshipTermKey;\n mKey = vm.apiDomain.mutationInvolves[i].markerKey;\n\n if (rKey == \"\" || mKey == \"\") {\n continue\n }\n\n if (vm.apiDomain.mutationInvolves[i].refsKey == \"\") {\n isMInoreference = true;\n }\n\n\t\t\t for(var j=i+1;j<vm.apiDomain.mutationInvolves.length; j++) {\n if (\n vm.apiDomain.mutationInvolves[j].relationshipTermKey == rKey\n && vm.apiDomain.mutationInvolves[j].markerKey == mKey\n ) { \n vm.apiDomain.mutationInvolves[j].processStatus = \"x\";\n isMIduplicate = true;\n }\n }\n }\n //if (isMIduplicate) {\n //alert(\"Mutation Involves: duplicate found; the duplicate will be skipped.\");\n //}\n if (isMInoreference) {\n alert(\"MI: Reference is required.\");\n return;\n }\n \n // skip duplicates; organism, marker\n var oKey = 0;\n var mKey = 0;\n var isECduplicate = false;\n var isECnoreference = false;\n\t\t\tfor(var i=0;i<vm.apiDomain.expressesComponents.length; i++) {\n oKey = vm.apiDomain.expressesComponents[i].organismKey;\n mKey = vm.apiDomain.expressesComponents[i].markerKey;\n\n if (oKey == \"\" || mKey == \"\") {\n continue\n }\n\n if (vm.apiDomain.expressesComponents[i].refsKey == \"\") {\n isECnoreference = true;\n }\n\n\t\t\t for(var j=i+1;j<vm.apiDomain.expressesComponents.length; j++) {\n if (\n vm.apiDomain.expressesComponents[j].organismKey == oKey\n && vm.apiDomain.expressesComponents[j].markerKey == mKey\n ) { \n vm.apiDomain.expressesComponents[j].processStatus = \"x\";\n isECduplicate = true;\n }\n }\n }\n //if (isECduplicate) {\n //alert(\"Expresses Components: duplicate found; the duplicate will be skipped.\");\n //}\n if (isECnoreference) {\n alert(\"EC: Reference is required.\");\n return;\n }\n\n // skip duplicates; organism, marker\n var oKey = 0;\n var mKey = 0;\n var isDCduplicate = false;\n var isDCnoreference = false;\n\t\t\tfor(var i=0;i<vm.apiDomain.driverComponents.length; i++) {\n oKey = vm.apiDomain.driverComponents[i].organismKey;\n mKey = vm.apiDomain.driverComponents[i].markerKey;\n\n if (oKey == \"\" || mKey == \"\") {\n continue\n }\n\n if (vm.apiDomain.driverComponents[i].refsKey == \"\") {\n isDCnoreference = true;\n }\n\n\t\t\t for(var j=i+1;j<vm.apiDomain.driverComponents.length; j++) {\n if (\n vm.apiDomain.driverComponents[j].organismKey == rKey\n && vm.apiDomain.driverComponents[j].markerKey == mKey\n ) { \n vm.apiDomain.driverComponents[j].processStatus = \"x\";\n isDCduplicate = true;\n }\n }\n }\n //if (isDCduplicate) {\n //alert(\"Driver Components: duplicate found; the duplicate will be skipped.\");\n //}\n if (isDCnoreference) {\n alert(\"DC: Reference is required.\");\n return;\n }\n\n\t\t\tpageScope.loadingStart();\n\n\t\t\tAlleleFearUpdateAPI.update(vm.apiDomain, function(data) {\n\t\t\t\tif (data.error != null) {\n\t\t\t\t\talert(\"ERROR: \" + data.error + \" - \" + data.message);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tloadObject();\n\t\t\t\t}\n\t\t\t\tpageScope.loadingEnd();\n\t\t\t}, function(err) {\n\t\t\t\tpageScope.handleError(vm, \"API ERROR: AlleleFearUpdateAPI.update\");\n\t\t\t\tpageScope.loadingEnd();\n\t\t\t});\n\t\t}", "function createEntry() {\n var js = checkCommon();\n if (!js) {\n return;\n }\n\n\n js['type'] = 'entry';\n\n var introduction = document.getElementsByClassName(\"introduction-p\")[0].innerHTML;\n introduction = introduction.trimLeft().trimRight();\n if (introduction.length === 0 || introduction === \"填写简介 Fill Introduction Here\") {\n alert(\"Please fill in the introduction.\");\n return;\n }\n js['introduction'] = introduction;\n\n var subsecs = document.getElementsByClassName(\"a-group\");\n var subsections = [];\n for (var i = 0; i < subsecs.length; i++) {\n var subsec = packSubSection(subsecs[i]);\n if (!subsec) {\n return;\n }\n subsections.push(subsec);\n }\n if (subsections.length === 0) {\n alert(\"Please fill in at least one subsection.\");\n return;\n }\n js['content'] = subsections;\n\n var refs = document.getElementsByClassName(\"entry-ref-list\")[0].childNodes;\n var refrences = [];\n var count = 0;\n for (var i = 0; i < refs.length; i++) {\n if (refs[i].tagName === \"LI\") {\n var value = refs[i].innerHTML;\n value = value.trimRight().trimLeft();\n if (value.length === 0 || value === \"来源 Recourse\") {\n continue;\n }\n count++;\n refrences.push(value);\n }\n }\n if (count === 0) {\n alert(\"Please have at least one reference.\");\n return;\n }\n js[\"reference\"] = refrences;\n\n var arr_str_ss = [];\n for (var i = 0; i < js['content'].length; i++) {\n arr_str_ss.push(JSON.stringify(js['content'][i]['content']));\n }\n\n $.ajax({\n url: '../../backend/entry-create-php.php',\n data: {'js': JSON.stringify(js), 'str_contents': arr_str_ss},\n type: 'POST',\n success: function (response) {\n if (response.substr(0,3) === \"set\") {\n var id = Number(response.substr(4));\n var form = document.createElement('form');\n form.setAttribute(\"action\",\"../view/entry-view.php\");\n form.setAttribute(\"method\", \"POST\");\n var input = document.createElement('input');\n input.setAttribute(\"type\", \"text\");\n input.setAttribute(\"name\", \"id\");\n input.setAttribute(\"value\", id + \"\");\n var sub = document.createElement('input');\n sub.setAttribute(\"type\", \"submit\");\n form.append(input);\n form.append(sub);\n document.body.append(form);\n form.submit();\n } else {\n alert(response);\n }\n }\n });\n\n}", "function buildNewEntryButton(journalSelf, entrySelf){\n\tvar button = document.createElement(\"button\");\n\tvar buttonLabel = document.createTextNode(\"Add Entry\");\n\tbutton.appendChild(buttonLabel);\n\n\tbutton.addEventListener('click', function(event){\t\n\t\tvar entriesData = new EntriesData ();\n\t\tvar entriesRelation = currentJournal.data.relation(\"userEntries\");\n\t\tparseInt(currentNumEntries, 10);\n\t\tcurrentNumEntries++;\n\t\tvar newEntryTitle = \"Entry\" + currentNumEntries;\n\t\tnewEntryTitle.toString();\n\t\t\n\t\tentriesData.save({\n\t\t\tentryTitle: newEntryTitle,\n\t\t\tentryText: \"\"\n\t\t}, \n\t\t{\n\t\t\tsuccess: function(results){\n\t\t\t\tconsole.log(\"Created new entry\");\n\t\t\t\tentriesRelation.add(entriesData);\n\t\t\t\tcurrentEntry = entrySelf;\n\t\t\t\tcurrentEntryIndex = 0;\n\t\t\t\tcurrentJournal.data.save(null, {\n\t\t\t\t\tsuccess: function (results){\n\t\t\t\t\t\trefreshEntriesSection(journalSelf, entrySelf);\n\t\t\t\t\t},\n\t\t\t\t\terror:function(error){\n\t\t\t\t\t\talert(\"Something went wrong: error is \" + error.message);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t\terror: function(error){\n\t\t\t\tconsole.log(\"Error creating new entry. Error: \" + error);\n\t\t\t}\n\t\t});\n\n\t});\n\tnewEntryButton.appendChild(button);\n}", "function createItemMirrorFromGroupingItem(event) {\n var itemMirror = event.data.itemmirror;\n var GUID = event.data.guid;\n console.log(\"Now creating a grouping item for \" + GUID);\n itemMirror.createItemMirrorForAssociatedGroupingItem(\n GUID, function (error, newItemMirror) {\n if (error) { throw error; }\n \n newItemMirror.getGroupingItemURI(function (error, groupingItemURI) {\n listAssociations(newItemMirror, groupingItemURI);\n $('div#modalDialog button').click(function (e) {\n console.log(groupingItemURI);\n window.location.assign(DESTURL + DELIMITER + groupingItemURI);\n //window.location.reload(); RELOAD NOT REQUIRED WHEN REDIRECT FROM DIFFERENT PAGE\n });\n });\n });\n }", "function setEntries(entrList) {\r\n\t//get data table\r\n\tvar entryTable = dojo.widget.byId('entryTable');\r\n\tfor (i = 0; i < entrList.length; i++) {\r\n\t\tvar entry = {};\r\n \t\tentry.toRemove = \"<input type='checkbox' id='toRemove' name='toRemove' value='\" + entrList[i].entryId + \"'>\"\r\n \t\tentry.viewText = entrList[i].viewText;\r\n \t\tentry.refValue = entrList[i].refValue;\r\n \t\tentry.entryDescn = entrList[i].entryDescn;\r\n \t\t//the method editEntry(obj) id editEntry.js\r\n \t\tentry.entryEdit = \"<a href='#'><img id='\" + entrList[i].entryId + \"' src='../images/icons/edit_3.gif' title='\" +\r\n \t\t\t\t\t\t\t\t\t\t\t imgTitle + \"' onclick='editEntry(this)'/></a>\";\r\n \t\tentries.add(entry);\r\n\t}\r\n\tentryTable.store.setData(entries.toArray());\r\n\tentries.clear();\r\n}", "function clickedDuplicate()\n{\n\tvar selectedObj = dw.databasePalette.getSelectedNode();\n\tif (selectedObj && selectedObj.objectType==\"Connection\")\n\t{\n\t\tvar connRec = MMDB.getConnection(selectedObj.name);\n\t\tif (connRec)\n\t\t{\n\t\t\tMMDB.popupConnection(connRec,true);\n\t\t\tdw.databasePalette.refresh();\n\t\t}\n\t}\n}", "function refreshNewEntrySection(entryTitle, entriesData){\n\tcurrentEntry.buildEditEntry(entryTitle, entriesData);\n}", "function prntAssoc(error, displayText, GUID, itemMirror){\n if (error) {\n throw error;\n }\n \n itemMirror.isAssociatedItemGrouping(GUID, function(error, isGroupingItem){\n if (isGroupingItem) {\n var $thisAssoc;\n $thisAssoc = $('<li>', {'text': \" \" + displayText});\n $thisAssoc.prepend($('<span>', {class:'glyphicon glyphicon-folder-close'}));\n $thisAssoc.bind(\"click\",{guid:GUID, itemmirror:itemMirror},createItemMirrorFromGroupingItem);\n $('#modalDialog div.modal-body ul').append($thisAssoc);\n }\n });\n \n }", "function clickEntry() {\n //alert($(\".LaneAssign\").data(\"id\"));\n //alert($(this).data(\"id\"));\n ////$(\"#themodal\").modal(\"show\");\n\n //$(this).effect('explode', 500, function() {\n //\t$(this).remove();\n //});\n return false;\n }", "function prepairNewEntries(container, opt) {\n\n container.find('>.mega-entry-added').each(function (i) {\n var ent = $(this);\n if (!ent.hasClass('tp-layout')) {\n\n ent.removeClass('tp-layout-first-item').removeClass('tp-layout-last-item').removeClass('very-last-item');\n ent.addClass(\"tp-notordered\")\n ent.wrapInner('<div class=\"mega-entry-innerwrap\"></div>');\n //ent.find('.mega-socialbar').appendTo(ent)\n var iw = ent.find('.mega-entry-innerwrap')\n /*if (opt.ie) {\n iw.append('<img class=\"ieimg\" src='+ent.data(\"src\")+'>');\n } else {*/\n iw.css({\n 'background': 'url(' + ent.data(\"src\") + ')',\n 'backgroundPosition': '50% 49%',\n 'backgroundSize': 'cover',\n 'background-repeat': 'no-repeat'\n });\n //}\n\n // LET ACT ON THE CLICK ON ITEM SOMEWAY\n ent.find('.mega-show-more').each(function () {\n var msm = $(this);\n\n // SAVE THE ID OF THE mega-entry WHICH IS CORRESPONDING ON THE BUTTON\n msm.data('entid', ent.attr('id'));\n\n // HANDLING OF THE CLICK\n msm.click(function () {\n var msm = $(this);\n var ent = container.find('#' + msm.data('entid'));\n ent.addClass(\"mega-in-detailview\");\n opt.detailview = \"on\";\n\n });\n\n });\n }\n });\n\n\n }", "function OnPrimaryGirders_Change( e )\r\n{\r\n Alloy.Globals.ShedModeInfrastructure[\"PRIMARY_GIRDERS\"] = e.id ;\r\n}", "function addExistingRelationshipToForm(relationship) {\n var renderControlAlias;\n var json;\n\n if (relationship) {\n\n renderControlAlias = spFormBuilderService.getRelationshipRenderControlAlias(relationship);\n\n if (renderControlAlias) {\n /////\n // Construct a JSON structure.\n /////\n json = {\n typeId: renderControlAlias,\n 'console:relationshipToRender': relationship.getEntity(),\n 'console:renderingOrdinal': jsonInt(),\n 'console:renderingWidth': jsonInt(),\n 'console:renderingHeight': jsonInt(),\n 'console:renderingBackgroundColor': 'white',\n 'console:renderingHorizontalResizeMode': jsonLookup('console:resizeAutomatic'),\n 'console:renderingVerticalResizeMode': jsonLookup('console:resizeAutomatic'),\n };\n\n if (relationship.isReverse) {\n json['console:isReversed'] = !!relationship.isReverse();\n }\n\n if (renderControlAlias === 'console:tabRelationshipRenderControl') {\n json['console:renderingHorizontalResizeMode'] = jsonLookup('console:resizeSpring');\n json['console:renderingVerticalResizeMode'] = jsonLookup('console:resizeSpring');\n }\n\n handleDataPath(json);\n\n return spEntity.fromJSON(json);\n }\n }\n\n return undefined;\n }", "function mealReferenceAddEditMealDialog(selection,e) {\n console.log(e)\n // Add or Edit\n const entryType = e.target.dataset.type;\n console.log(entryType);\n // Grab 'meals-reference' div\n container = document.querySelector('.meals-reference');\n // Meal Object\n let originalMealObject;\n let newMealObject;\n\n // If Editing an existing meal\n if(entryType == 'edit-meal'){\n mealsReferenceData.forEach(meal => {\n meal.name == selection ? originalMealObject = meal : '';\n });\n }else{\n originalMealObject = {\n name: '',\n type: '',\n link: '',\n season: ''\n }\n }\n\n // *** Popup Creation\n // Overlay\n const editMealOverlay = document.createElement('div');\n editMealOverlay.classList.add('overlay');\n // Modal\n const editMealModal = document.createElement('div');\n editMealModal.classList.add('modal');\n\n // ** Heading\n const editMealModalHeading = document.createElement('h2');\n const editMealModalHeadingText = entryType == 'edit-meal' ? document.createTextNode(`Editing Meal: ${originalMealObject.name}`) : document.createTextNode(`Adding New Meal`);\n editMealModalHeading.appendChild(editMealModalHeadingText);\n editMealModal.appendChild(editMealModalHeading);\n\n // ** Labels & Inputs\n // * Meal Name - Text\n const editMealModalNameContainer = document.createElement('div');\n // Label\n const editMealModalNameLabel = document.createElement('label');\n const editMealModalNameLabelText = document.createTextNode('Meal Name: ');\n editMealModalNameLabel.appendChild(editMealModalNameLabelText);\n editMealModalNameContainer.appendChild(editMealModalNameLabel);\n // Text Input\n const editMealModalNameInput = document.createElement('input');\n editMealModalNameInput.setAttribute('type', 'text');\n editMealModalNameInput.value = originalMealObject.name;\n editMealModalNameContainer.appendChild(editMealModalNameInput);\n // Append name container to main container\n editMealModal.appendChild(editMealModalNameContainer);\n\n // * Meal Type - Select\n const editMealModalTypeContainer = document.createElement('div');\n // Label\n const editMealModalTypeLabel = document.createElement('label');\n const editMealModalTypeLabelText = document.createTextNode('Meal Type: ');\n editMealModalTypeLabel.appendChild(editMealModalTypeLabelText);\n editMealModalTypeContainer.appendChild(editMealModalTypeLabel);\n const editMealModalTypeSelect = document.createElement('select');\n // Select Input\n settingsData.mealTypes.forEach(type => {\n const option = document.createElement('option');\n option.value = type;\n const optionText = document.createTextNode(type);\n option.appendChild(optionText);\n editMealModalTypeSelect.appendChild(option)\n })\n // Set select input to original meal's type\n for (let i = 0; i < editMealModalTypeSelect.options.length; i++){\n editMealModalTypeSelect.options[i].value == originalMealObject.type ? editMealModalTypeSelect.selectedIndex = i : '';\n }\n editMealModalTypeContainer.appendChild(editMealModalTypeSelect);\n editMealModal.appendChild(editMealModalTypeContainer);\n\n // * Meal Link - URL\n const editMealModalLinkContainer = document.createElement('div');\n // Label\n const editMealModalLinkLabel = document.createElement('label');\n const editMealModalLinkLabelText = document.createTextNode('Meal Link: ');\n editMealModalLinkLabel.appendChild(editMealModalLinkLabelText);\n editMealModalLinkContainer.appendChild(editMealModalLinkLabel);\n // Text Input\n const editMealModalLinkInput = document.createElement('input');\n editMealModalLinkInput.setAttribute('type', 'url');\n editMealModalLinkInput.value = originalMealObject.link;\n editMealModalLinkContainer.appendChild(editMealModalLinkInput);\n // Append name container to main container\n editMealModal.appendChild(editMealModalLinkContainer);\n\n // * Meal Season - Select\n const editMealModalSeasonContainer = document.createElement('div');\n // Label\n const editMealModalSeasonLabel = document.createElement('label');\n const editMealModalSeasonLabelText = document.createTextNode('Meal Season: ');\n editMealModalSeasonLabel.appendChild(editMealModalSeasonLabelText);\n editMealModalSeasonContainer.appendChild(editMealModalSeasonLabel);\n const editMealModalSeasonSelect = document.createElement('select');\n // Select Input\n settingsData.mealSeasons.forEach(season => {\n const option = document.createElement('option');\n option.value = season;\n const optionText = document.createTextNode(season);\n option.appendChild(optionText);\n editMealModalSeasonSelect.appendChild(option)\n })\n // Set select input to original meal's type\n for (let i = 0; i < editMealModalSeasonSelect.options.length; i++) {\n editMealModalSeasonSelect.options[i].value == originalMealObject.season ? editMealModalSeasonSelect.selectedIndex = i : '';\n }\n editMealModalSeasonContainer.appendChild(editMealModalSeasonSelect);\n editMealModal.appendChild(editMealModalSeasonContainer);\n\n // Finish & Cancel Buttons\n const editMealModalButtonContainer = document.createElement('div');\n const editMealModalFinishButton = document.createElement('button');\n editMealModalFinishButton.textContent = 'Finish';\n editMealModalFinishButton.addEventListener('click', () => {\n // Grag input field entries\n const mealName = editMealModalNameInput.value;\n const mealType = editMealModalTypeSelect.value;\n const mealLink = editMealModalLinkInput.value;\n const mealSeason = editMealModalSeasonSelect.value\n \n // Create new meal object\n newMealObject = {\n name: mealName,\n type: mealType,\n link: mealLink,\n season: mealSeason\n }\n \n // If Editing Exisiting Meal\n if (entryType == 'edit-meal') {\n mealsReferenceData.forEach(meal => {\n if(originalMealObject.name == meal.name){\n meal.name = mealName;\n meal.type = mealType;\n meal.link = mealLink;\n meal.season = mealSeason;\n };\n })\n }\n\n // If adding a new meal\n if(entryType == 'add-meal'){\n mealsReferenceData.push(newMealObject);\n }\n\n // Set local storage to updated dataset\n localStorage.setItem('mealsReferenceData', JSON.stringify(mealsReferenceData));\n \n // Close Overlay/Modal\n document.querySelector('.overlay').remove();\n\n // Reload Meals Reference Section\n loadMealsReference(e)\n })\n editMealModalButtonContainer.appendChild(editMealModalFinishButton);\n const editMealModalCancelButton = document .createElement('button');\n editMealModalCancelButton.textContent = 'Cancel';\n editMealModalCancelButton.addEventListener('click', () => {\n document.querySelector('.overlay').remove();\n });\n // \n editMealModalButtonContainer.appendChild(editMealModalCancelButton);\n editMealModal.appendChild(editMealModalButtonContainer);\n\n // Append Modal to Overlay\n editMealOverlay.appendChild(editMealModal);\n editMealOverlay.classList.add('show')\n // Append Overlay to Container\n document.body.appendChild(editMealOverlay);\n\n }", "function addAssocRow( table ){\n\tvar r = table.getElementsByTagName( 'tr' ).length;\n\tvar startName = 'wp' + table.id;\n\tvar tr = document.createElement( 'tr' );\n\n\tvar td1 = document.createElement( 'td' );\n\tvar key = document.createElement( 'input' );\n\tkey.type = 'text';\n\tkey.name = startName + '-key-' + (r - 1);\n\ttd1.appendChild( key );\n\n\tvar td2 = document.createElement( 'td' );\n\tvar val = document.createElement( 'input' );\n\tval.type = 'text';\n\tval.name = startName + '-val-' + (r - 1);\n\ttd2.appendChild( val );\n\n\tvar td3 = document.createElement( 'td' );\n\ttd3.className = 'button';\n\tvar button = document.createElement( 'input' );\n\tbutton.type = 'button';\n\tbutton.className = 'button-add';\n\tbutton.value = wgConfigureRemoveRow;\n\tbutton.onclick = removeAssocCallback( table, r );\n\ttd3.appendChild( button );\n\n\ttr.appendChild( td1 );\n\ttr.appendChild( td2 );\n\ttr.appendChild( td3 );\n\ttable.appendChild( tr );\n}", "function addNewRow(container, key, entry) {\n const entryLink = newDiagramLink(entry.Title, `/viewsvg.htm#*${key}`);\n container.appendChild(entryLink);\n\n const entryRename = newRenameButton();\n container.appendChild(entryRename);\n\n const entryDelete = newDeleteButton();\n container.appendChild(entryDelete);\n\n const entrySvgButton = newSvgButton();\n container.appendChild(entrySvgButton);\n\n const entryPngButton = newPngButton();\n container.appendChild(entryPngButton);\n\n const thisDivider = newDivider();\n container.appendChild(thisDivider);\n\n entryRename.addEventListener('click', function renameClick() {\n showModalDialog('Rename saved diagram:', true, entryLink.textContent,\n 'OK', function renameOK() {\n const newName = getModalInputText();\n if (!newName) return;\n entry.Title = newName;\n const entryJSON = JSON.stringify(entry);\n localStorage.setItem(key, entryJSON);\n entryLink.textContent = newName;\n },\n undefined, undefined,\n 'Cancel', undefined);\n });\n\n entryDelete.addEventListener('click', function deleteClick() {\n showModalDialog(\n `Are you sure you want to delete \"${entryLink.textContent}\"?`,\n false, undefined,\n 'Yes', function deleteYes() {\n localStorage.removeItem(key);\n\n container.removeChild(entryLink);\n container.removeChild(entryRename);\n container.removeChild(entryDelete);\n container.removeChild(entrySvgButton);\n container.removeChild(entryPngButton);\n container.removeChild(thisDivider);\n\n if (container.getElementsByClassName('diagram').length === 0) {\n container.innerHTML = '';\n container.appendChild(newDivider());\n addEmptyMessage(container);\n container.appendChild(newDivider());\n }\n },\n undefined, undefined,\n 'No', undefined);\n });\n\n entrySvgButton.addEventListener('click',\n function svgLinkClick(event) {\n event.preventDefault();\n exportSvg(entry.Title + '.svg', entry.SvgXml);\n }\n );\n\n entryPngButton.addEventListener('click',\n function pngLinkClick() {\n const background =\n window.getComputedStyle(document.body).backgroundColor;\n exportPng(entry.Title + '.png', entry.SvgXml, background);\n }\n );\n}", "function addNormalizedEntry (entry, entries) { // Private function\n return {\n ...entries,\n [entry.id] : entry\n }\n }", "function click_related_entry_btn(e) {\n let key = $(e.data.target).attr(\"key\");\n let url = $(\"#\" + key).attr(\"url\");\n\n // disabled\n if ($(e.data.target).hasClass(\"disabled\"))\n return;\n\n $.blockUI({ message: \"正在取得相關條目...\" });\n window.get_all_links(url, function(result) {\n if (result.status) {\n create_related_entry_dialog(result.data);\n } else {\n $.blockUI({message: \"找不到相關條目<br>原因:\" + result.data});\n setTimeout($.unblockUI, 3000);\n }\n });\n}", "function associate(objAssociated, objAssociate, strReverseProperty) {\n\t//if this association is known in both directions\n\t//put the objAssociate object into the reverse property.\n\t//then return objAssociated.\n\tif (strReverseProperty != undefined) {eval(\"objAssociated.\" + strReverseProperty + \" = objAssociate;\");}\n\treturn objAssociated;\n} //end function associate", "function init() {\n // Get all entries\n LEDGER.GETALL().then(function successCallback(res) {\n $scope.entries = res.data;\n if (res.data.length > 0) {\n $scope.entriesExist = true;\n } else {\n $scope.entriesExist = false;\n }\n }, function errorCallback(res) {\n console.log(res.data.status);\n });\n\n // Get all categories\n CATEGORY.GETALL().then(function successCallback(res) {\n // Category options\n $scope.categoryOptions = [];\n res.data.forEach(function(element) {\n $scope.categoryOptions.push(element.name);\n }, this);\n $scope.categoryOptions.push('category');\n $scope.categoryOptions.push('transfer to savings');\n $scope.categoryOptions.push('transfer to checking');\n // Sort category options\n $scope.categoryOptions = $scope.categoryOptions.sort();\n }, function errorCallback(res) {\n console.log(res.data.status);\n });\n\n // Initialize new entry fields\n $scope.newEntry = {\n category: 'category',\n type: 'type'\n };\n\n \n }", "function addEntry(entry, mode) {\n console.log('addEntry entry = ' + angular.toJson(entry));\n //console.log('addItemToList listOpenEntries = ' + angular.toJson(entries.listOpenEntries));\n console.log('addEntry global.currentList = ' + angular.toJson(global.currentList));\n var defer = $q.defer();\n //search the item in the listOpen Entries\n var insertFlag = false;\n if (mode == 'S') {\n insertFlag = true;\n } else {\n var openIdx = itemExitInList(entry.itemLocalId, global.currentListEntries.listOpenEntries.entries);\n if (openIdx == -1) {\n insertFlag = true;\n }\n }\n console.log('addEntry insertFlag = ' + angular.toJson(insertFlag));\n if (insertFlag) {\n entry.origin = mode == 'L' ? 'L' : 'S';\n if (mode == 'S') {\n checkEntryExists(entry.entryServerId).then(function (exists) {\n if (!exists) {\n insertEntry2(entry,'FE_CREATED').then(function (res) {\n defer.resolve();\n }, function (err) {\n console.error('addEntry insertEntry err = ' + angular.toJson(err));\n defer.reject();\n });\n }\n else {\n console.log('addEntry ALREADY EXISTS ');\n defer.resolve();\n }\n }, function (err) {\n console.error('addEntry checkEntryExists err = ' + angular.toJson(err));\n defer.reject();\n })\n }\n else {\n entry.entryServerId = '';\n entry.userServerId = global.userServerId;\n insertEntry2(entry,'CREATED').then(function (res) {\n defer.resolve();\n }, function (err) {\n console.error('addEntry insertEntry err = ' + angular.toJson(err));\n defer.reject();\n });\n }\n }\n return defer.promise;\n }", "function linkToProv( wfEntry, actId, resultId ) {\n\n // the respective activity\n wfEntry[ symbols.linkedActivity ] = actId;\n\n wfEntry[ symbols.linkedResult ] = resultId;\n }", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(\n elementEntry.token.tagName,\n ns,\n elementEntry.token.attrs,\n );\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n }", "function RelationEditor(args) {\n SelectElementEditor.call(this, args);\n\n this.source = this.column.editor.source || this.column.source || 'name';\n this.addOptionText = 'Add new Option';\n this.arrOptions = [];\n this.relationColumn = (this.column.type === 'has_and_belongs_to_many') || (this.column.type === 'has_many');\n\n this.isValueChanged = function() {\n // return true if the value(s) being edited by the user has/have been changed\n var selectedValue = this.select.val();\n if (this.relationColumn) {\n if (selectedValue) {\n if (selectedValue.length != this.defaultValue.length) {\n return true;\n } else {\n return $.difference(this.defaultValue, selectedValue).length !== 0;\n }\n } else {\n return this.defaultValue.length > 0;\n }\n } else {\n return (selectedValue != this.defaultValue);\n }\n };\n\n this.serializeValue = function() {\n // return the value(s) being edited by the user in a serialized form\n // can be an arbitrary object\n // the only restriction is that it must be a simple object that can be passed around even\n // when the editor itself has been destroyed\n var obj = {};\n obj[\"id\"] = this.select.val();\n obj[this.source] = $('option:selected', this.select).text();\n\n // special case for has_and_belongs_to_many\n if (this.column.type === 'has_and_belongs_to_many') {\n obj[this.source] = $.map($('option:selected', this.select), function(n) {\n return $(n).text();\n }).join();\n }\n return obj;\n };\n\n this.loadValue = function(item) {\n // load the value(s) from the data item and update the UI\n // this method will be called immediately after the editor is initialized\n // it may also be called by the grid if if the row/cell being edited is updated via grid.updateRow/updateCell\n this.defaultValue = item[this.column.field].id\n this.select.val(this.defaultValue);\n this.select.select();\n };\n\n this.applyValue = function(item, state) {\n // deserialize the value(s) saved to \"state\" and apply them to the data item\n // this method may get called after the editor itself has been destroyed\n // treat it as an equivalent of a Java/C# \"static\" method - no instance variables should be accessed\n item[this.column.field].id = state.id;\n item[this.column.field][this.source] = state[this.source];\n };\n\n this.getOptions = function() {\n // dynamic filter by other relational column\n if (this.args.column.depend_column) {\n var relation_id = this.args.item[this.args.column.depend_column].id;\n this.choices += '&master_model=' + this.args.column.depend_column + '&master_id=' + relation_id;\n }\n\n this.args.grid.onRelationCellEdit.notify({relationEditor: this});\n\n $.getJSON(this.choices, function(itemdata) {\n this.setOptions(itemdata);\n }.bind(this));\n };\n\n this.setOptions = function(dateset) {\n $.each(dateset, function(index, value) {\n if (!this.field || this.field.id != value.id) {\n this.arrOptions.push(\n `<option value=\"${value.id}\">${value[this.source]}</option>`\n );\n }\n }.bind(this));\n this.select.append(this.arrOptions.join(''));\n this.setAllowSingleDeselect();\n };\n\n this.appendOptions = function(target, value) {\n target.append(\n `<option value=\"${value.id}\">${value[this.source]}</option>`\n );\n };\n }", "function prepairEntries(container, opt) {\n\n container.find('>.mega-entry').each(function () {\n var ent = $(this);\n ent.removeClass('tp-layout-first-item').removeClass('tp-layout-last-item').removeClass('very-last-item');\n ent.addClass(\"tp-notordered\").addClass(\"mega-entry-added\");\n ent.wrapInner('<div class=\"mega-entry-innerwrap\"></div>');\n //ent.find('.mega-socialbar').appendTo(ent)\n var iw = ent.find('.mega-entry-innerwrap')\n /*if (opt.ie) {\n iw.append('<img class=\"ieimg\" src='+ent.data(\"src\")+'>');\n } else {*/\n iw.css({\n 'background': 'url(' + ent.data(\"src\") + ')',\n 'backgroundPosition': '50% 49%',\n 'backgroundSize': 'cover',\n 'background-repeat': 'no-repeat'\n });\n//\t\t\t\t}\n\n // LET ACT ON THE CLICK ON ITEM SOMEWAY\n ent.find('.mega-show-more').each(function () {\n var msm = $(this);\n\n // SAVE THE ID OF THE mega-entry WHICH IS CORRESPONDING ON THE BUTTON\n msm.data('entid', ent.attr('id'));\n\n // HANDLING OF THE CLICK\n msm.click(function () {\n var msm = $(this);\n var ent = container.find('#' + msm.data('entid'));\n ent.addClass(\"mega-in-detailview\");\n opt.detailview = \"on\";\n });\n\n });\n });\n\n\n }", "function _createNewChannelEntry(isTemplate){\n\t\t\t_checkState(CONST_STATE_ADD_SELECT_TYPE);\n\t\t\t_removeAddEntrySelectTypeIfRequired();\n\t\t\tvar newId = _generateNewId();\n\t\t\tvar options = {\n\t\t\t\tkey: newId,\n\t\t\t\tisTemplate: isTemplate,\n\t\t\t\ttitle: \"\"\n\t\t\t};\n\t\t\t\n\t\t\tvar itemToInsertChannel = _findItemToInsertChannel(isTemplate);\n\t\t\tvar renderedInsertTitle = $.tmpl($(\"#render-add-channel-insert-title-template\"), options);\n\t\t\tif(itemToInsertChannel == null || itemToInsertChannel.domElement == null){\n\t\t\t\tvar innerUL = _domElement.find(\"> ul\");\n\t\t\t\tinnerUL.append(renderedInsertTitle);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(itemToInsertChannel.after)\n\t\t\t\t\titemToInsertChannel.domElement.after(renderedInsertTitle);\n\t\t\t\telse\n\t\t\t\t\titemToInsertChannel.domElement.before(renderedInsertTitle);\n\t\t\t}\n\t\t\t\n\t\t\t$(\"#new-item-title-\"+newId).focus();\n\t\t\t\n\t\t\t_state = isTemplate ? CONST_STATE_ADD_CHANNEL_TEMPLATE_SET_TITLE : CONST_STATE_ADD_CHANNEL_SET_TITLE;\n\t\t\t\n\t\t\tvar jsonCreator = {\n\t\t\t\t\tcreate: function(newId, title, isTemplate, id){\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tisTemplate: isTemplate,\n\t\t\t\t\t\t\tisFolder: true,\n\t\t\t\t\t\t\tkey: newId,\n\t\t\t\t\t\t\ttitle: title,\n\t\t\t\t\t\t\ttype: \"channel\",\n\t\t\t\t\t\t\tparentId: id\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t};\n\t\t\t\n\t\t\t// add the handles to create the new channel\n\t\t\t$(\"#new-item-title-\"+newId).keypress(function (e){\n\t\t\t\tswitch(e.which){\n\t\t\t\tcase CONST_VK_CONFIRM: //enter\n\t\t\t\t\t_confirmObjectCreation(newId, jsonCreator, \"#render-channel-template\", itemToInsertChannel, isTemplate);\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t$(\".insert-title > span.title-entry\").click(function(e){\n\t\t\t\te.stopPropagation();\n\t\t\t\treturn false;\n\t\t\t});\n\t\t\t\n\t\t\t$(\".insert-title > span.actions > span.ok\").click(function(e){\n\t\t\t\t_confirmObjectCreation(newId, jsonCreator, \"#render-channel-template\", itemToInsertChannel, isTemplate);\n\t\t\t\te.stopPropagation();\n\t\t\t\treturn false;\n\t\t\t});\n\t\t}", "static associate(models) {\n // define association here\n Reimbursment.belongsTo(models.Employee, {foreignKey: 'employee_id', targetKey: 'id'})\n }", "function constructNewItemMirror() {\n console.log(\"Now Creating new itemMirror\");\n new ItemMirror(itemMirrorOptions[3], function (error, itemMirror) {\n if (error) { throw error; }\n console.log(\"Created new itemMirror\");\n listAssociations(itemMirror);\n });\n }", "static associate(models) {\n // define association here\n Entreprise.belongsTo(models.Client)\n Entreprise.belongsToMany(models.Paper, {through: models.PaperAdvancement})\n }", "replaceEntry(window, url = window.location.href, pushState = undefined) {\n const entry = new Entry(window, url, pushState);\n if (this.current === this.first) {\n if (this.current) this.current.destroy(window);\n this.first = entry;\n this.current = entry;\n } else {\n this.current.prev.append(entry, window);\n this.current = entry;\n }\n this.focus(window);\n }", "function addParent(e, object) {\n var currentObjectKey = object.part.data.key;\n var currentNode = findNode(currentObjectKey, globalLogicData);\n\n var dad = getDefaultLogicUnitData(uuidv4(), \"male\");\n var mom = getDefaultLogicUnitData(uuidv4(), \"female\");\n currentNode.left = dad;\n currentNode.right = mom;\n currentNode.marriageStatus = \"married\";\n reRender(currentObjectKey);\n}", "function newForeignClickHandler() {\n\n $(\"#newForeign\").on(\"click\", function (event) {\n\n event.preventDefault();\n openModel();\n })\n}", "function createEntry(listTitle, entryName, urlStr, entryID, backGroundColor){\r\n let entry = mySubWindow.document.createElement(\"div\");\r\n let userList = mySubWindow.document.getElementById(\"userList\");\r\n entry.id = \"container\";\r\n let entryImage = mySubWindow.document.createElement(\"img\");\r\n if (urlStr == null || urlStr == \"null\") {\r\n entryImage.src = \"https://i.imgur.com/wiUoT13.png\"\r\n }else{\r\n entryImage.src = basePosterURL + \"w92\" + urlStr;\r\n }\r\n entryImage.className = \"center-img\";\r\n entry.appendChild(entryImage);\r\n \r\n let dText = mySubWindow.document.createElement(\"div\");\r\n let title = mySubWindow.document.createElement(\"h2\");\r\n entry.style.backgroundColor=backGroundColor\r\n let removeBtn = mySubWindow.document.createElement(\"button\");\r\n removeBtn.className = \"btn btn-outline-danger\"\r\n removeBtn.innerHTML = \"remove\"\r\n removeBtn.onclick = function() {\r\n removeEntry(listTitle, entryName, entryID)\r\n }\r\n\r\n let upArrCon = mySubWindow.document.createElement(\"p\");\r\n \r\n let downArrCon = mySubWindow.document.createElement(\"p\")\r\n let upArr = mySubWindow.document.createElement(\"i\")\r\n let downArr = mySubWindow.document.createElement(\"i\")\r\n let upBtn = mySubWindow.document.createElement(\"button\");\r\n let downBtn = mySubWindow.document.createElement(\"button\");\r\n\r\n \r\n upArrCon.id = \"arrOffset\";\r\n downArrCon.id = \"arrOffset\";\r\n upBtn.id = \"upArrow\"\r\n downBtn.id =\"downArrow\"\r\n\r\n upArr.className = \"arrow up\";\r\n \r\n upBtn.onclick = function() {\r\n changeOrder(listTitle, entryName, entryID,\"up\")\r\n }\r\n downBtn.onclick = function() {\r\n changeOrder(listTitle, entryName, entryID,\"down\")\r\n }\r\n\r\n downArr.className = \"arrow down\";\r\n upBtn.appendChild(upArr);\r\n downBtn.appendChild(downArr);\r\n upArrCon.appendChild(upBtn);\r\n downArrCon.appendChild(downBtn);\r\n\r\n dText.className = \"center-txt\";\r\n title.textContent = entryName;\r\n dText.appendChild(title);\r\n dText.append(removeBtn);\r\n dText.appendChild(upArrCon);\r\n dText.appendChild(downArrCon);\r\n \r\n entry.appendChild(dText);\r\n\r\n let tableRow = mySubWindow.document.createElement(\"tr\");\r\n let tableOrder = mySubWindow.document.createElement(\"td\");\r\n let orderText = mySubWindow.document.createElement(\"h1\");\r\n orderText.style.textAlign = \"center\";\r\n orderText.innerHTML = totalEntryCount + 1;\r\n orderText.className=\"tableElement\"\r\n tableOrder.appendChild(orderText);\r\n let tableTitle = mySubWindow.document.createElement(\"td\");\r\n tableTitle.appendChild(entry)\r\n tableTitle.style.width=\"100%\"\r\n tableRow.appendChild(tableOrder);\r\n tableRow.appendChild(tableTitle);\r\n userList.appendChild(tableRow);\r\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function fetchAndUpdateStoryEntry() {\n isSelected = true;\n idFilter.setAttribute('readonly', 'readonly');\n idDropdown.innerHTML = '';\n\n cormorant.retrieveAssociations(baseUrl, selectedIdSignature, false,\n function(associations) {\n selectButton.setAttribute('disabled', 'disabled');\n selectButton.textContent = 'Selected';\n\n if(associations && associations.hasOwnProperty('url')) {\n cormorant.retrieveStory(associations.url, function(story) {\n txStoryJson.textContent = JSON.stringify(story, null, 2);\n cuttlefish.render(story, txStoryVis);\n });\n }\n });\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\r\n var ns = p.treeAdapter.getNamespaceURI(elementEntry.element),\r\n newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\r\n\r\n p.openElements.replace(elementEntry.element, newElement);\r\n elementEntry.element = newElement;\r\n\r\n return newElement;\r\n}", "function gotoRelated(changerecordid) {\n boolRelated = true;\n populateRecord(changerecordid);\n}", "addEntry(window, url = window.location.href, pushState = undefined) {\n const entry = new Entry(window, url, pushState);\n if (this.current) {\n this.current.append(entry);\n this.current = entry;\n } else {\n this.first = entry;\n this.current = entry;\n }\n this.focus(window);\n }", "function createReference(initialValues) {\n var referenceType = entityManager.metadataStore.getEntityType('Reference');\n // create a new reference entity\n var entity = entityManager.createEntity(referenceType, initialValues);\n entity.Type = 'SP.Data.Research_x0020_ReferencesListItem';\n entity['odata.type'] = 'SpResourceTracker.Models.Reference';\n return entity;\n }", "function enterParentAbsence(elementNr) {\nactiveElement = elementNr;\n$('#markabsent').modal();\n$('#markabsent').modal('open');\n$('#actionTitle').html('<h4>Abwesenheit melden</h4>');\ndocument.getElementById('comment').innerHTML = \"\";\n$('#absenceName').html('<h5>' + studentList.find(result => result.id == activeElement )['name'] + ' (' + studentList.find(result => result.id == activeElement )['klasse'] + ')</h5>');\n//get absences one day before\ncheckPreviousDayAbsence();\ninitDatepick();\t\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n const ns = p.treeAdapter.getNamespaceURI(elementEntry.element);\n const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n const ns = p.treeAdapter.getNamespaceURI(elementEntry.element);\n const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n const ns = p.treeAdapter.getNamespaceURI(elementEntry.element);\n const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n const ns = p.treeAdapter.getNamespaceURI(elementEntry.element);\n const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n\n return newElement;\n}", "function addReaction()\n{\n getCurrentReactionInfo();\n displayModelInfo();\n if(currentReactionNumber == 1)\n { //if there is at least one reaction allow user to add pathway to database\n document.getElementById('login-button').style.display = 'block';\n }\n}", "function addEntityClick(event) {\n var baseGroupDOM = event.currentTarget.parentNode; // Limits the add entity event from adding more if the maximum entity count\n // by default is reached.\n\n if (baseGroupDOM.children.length - 1 >= defaultEntityCountMaximum) {\n notifier.queueMessage('warning', \"Maximum number of entities (\".concat(defaultEntityCountMaximum, \") has been reached.\"), 500);\n return;\n } else if (stableMarriageVisualizationRunning) {\n notifier.queueMessage('warning', 'Use stop button to edit configuration.');\n return;\n }\n\n var gender = baseGroupDOM == maleDOM ? 'male' : 'female';\n var otherGroupDOM = gender == 'male' ? femaleDOM : maleDOM;\n var entityDOM = createSMEntityElement();\n var nameIndex = getDOMNameIndexMap();\n var randomName;\n var preferences = []; // This loop gets a random name that is currently \n // not used in the configuration.\n\n do {\n randomName = getRandomName(gender);\n } while (Object.keys(nameIndex).indexOf(randomName) != -1);\n\n nameIndex[randomName] = baseGroupDOM.children.length - 1; // This iteration adds the new entity on the preference list of the\n // opposite group.\n\n var _iterator13 = _createForOfIteratorHelper(otherGroupDOM.children),\n _step13;\n\n try {\n for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {\n var otherEntityDOM = _step13.value;\n // Skip the add-entity element.\n if (otherEntityDOM.classList.contains('add-entity')) continue;\n var otherPreferenceListDOM = otherEntityDOM.querySelector('.preference');\n var newPreferenceDOM = document.createElement('div');\n newPreferenceDOM.draggable = true;\n newPreferenceDOM.dataset.index = nameIndex[randomName];\n newPreferenceDOM.innerHTML = randomName;\n newPreferenceDOM.addEventListener('drag', preferenceDrag);\n newPreferenceDOM.addEventListener('dragend', preferenceDragEnd);\n otherPreferenceListDOM.appendChild(newPreferenceDOM);\n var otherBaseEntityDOM = otherPreferenceListDOM.parentNode;\n\n if (otherBaseEntityDOM.classList.contains('edit-preference')) {\n otherBaseEntityDOM.style.minHeight = calculateOpenEntityHeight(otherBaseEntityDOM) + 'px';\n }\n\n preferences.push(otherEntityDOM.querySelector('.name input').value);\n }\n } catch (err) {\n _iterator13.e(err);\n } finally {\n _iterator13.f();\n }\n\n initializeEntityElement(entityDOM, nameIndex, randomName, shuffleArray(preferences));\n baseGroupDOM.insertBefore(entityDOM, event.currentTarget);\n}", "function cloneEntry(entry) {\n const result = {};\n if (entry.forward) {\n result.forward = cloneTree(entry.forward);\n }\n if (entry.reverse) {\n result.reverse = cloneTree(entry.reverse);\n }\n if (entry.lookup) {\n result.lookup = {\n contextRange: entry.lookup.contextRange.slice(),\n index: entry.lookup.index,\n length: entry.lookup.length,\n subIndex: entry.lookup.subIndex,\n substitutions: entry.lookup.substitutions.slice()\n };\n }\n return result;\n}", "function addOwner() {\n var resolvedData = {\n entity: 'Content',\n thisRecord: $scope.data.thisContent\n }\n\n var addOwnerModal = modalManager.openModal('addOwner', resolvedData)\n\n //after result - add / remove from UI\n\n addOwnerModal.result.then(function(results){\n console.log(results);\n //update this opp\n //comes back as array so need to loop through to push in properly\n _.forEach(results, function(value){\n $scope.data.thisContent.ownerLinks.push(value);\n })\n\n })\n}", "static associate(models) {\n Menu.hasMany(models.Menu_Ingredient, {foreignKey: 'menu_id'})\n }", "function add_related(event, ui) {\n $('#detailsmessage').loading();\n var relatedid = ui.item.value;\n var relatedname = ui.item.label;\n\n $.getJSON('qc/project/add_related/'+projectid+'/'+relatedid, function(data) {\n print_edit_message('details', $.toJSON(data));\n if (data.type == 'success') {\n $('#relatedproducts').append(make_related_item(relatedid, relatedname));\n redraw_saverevision_button();\n }\n });\n\n}", "function createAndLink(fromResource, useProperty, type, dataCallback) {\n RDFAUTHOR_START_FIX = \"linkAndCreate\";\n var serviceUri = urlBase + 'service/rdfauthorinit';\n\n // check if an resource is in editing mode\n if (typeof RDFAUTHOR_STATUS != 'undefined') {\n if(RDFAUTHOR_STATUS === 'active') {\n alert(\"Please finish all other editing actions before creating a new instance.\");\n return;\n }\n }\n\n // remove resource menus\n removeResourceMenus();\n\n loadRDFauthor(function() {\n $.getJSON(serviceUri, {\n mode: 'class',\n uri: type\n }, function(data) {\n if (data.hasOwnProperty('propertyOrder')) {\n var propertyOrder = data.propertyOrder;\n delete data.propertyOrder;\n }\n else {\n var propertyOrder = null;\n }\n // pass data through callback\n if (typeof dataCallback == 'function') {\n data = dataCallback(data);\n }\n var addPropertyValues = data['addPropertyValues'];\n var addOptionalPropertyValues = data['addOptionalPropertyValues'];\n RDFAUTHOR_DISPLAY_FIX = data['displayProperties'];\n RDFAUTHOR_DATATYPES_FIX_ADDITIONAL_DATA = data['additionalData'];\n delete data['addPropertyValues'];\n delete data['addOptionalPropertyValues'];\n delete data.additionalData;\n delete data.displayProperties;\n\n // get default resource uri for subjects in added statements (issue 673)\n // grab first object key\n for (var subjectUri in data) {break;};\n // add statements to RDFauthor\n var graphURI = selectedGraph.URI;\n populateRDFauthor(data, true, subjectUri, graphURI, 'class');\n RDFauthor.setOptions({\n saveButtonTitle: 'Create Resource',\n cancelButtonTitle: 'Cancel',\n title: ['createNewInstanceOf', type],\n autoParse: false,\n showPropertyButton: true,\n loadOwStylesheet: false,\n addPropertyValues: addPropertyValues,\n addOptionalPropertyValues: addOptionalPropertyValues,\n onSubmitSuccess: function (responseData) {\n newObjectSpec = resourceURL(responseData.changed);\n if (responseData && responseData.changed) {\n var objectUri = resourceURL(responseData.changed);\n var pos = objectUri.indexOf('=', objectUri);\n objectUri = objectUri.substring(pos+1,objectUri.length);\n $.ajax({\n type: \"POST\",\n url: urlBase + 'linkandcreate/linktriple',\n data: {subject: fromResource, predicate: useProperty, object: objectUri }\n });\n // HACK: reload whole page after 500 ms\n window.setTimeout(function () {\n window.location.href = window.location.href;\n }, 500);\n }\n },\n onCancel: function () {\n // everything fine\n }\n });\n\n var options = {};\n if (propertyOrder != null) {\n options.propertyOrder = propertyOrder;\n }\n options.workingMode = 'class';\n RDFauthor.start(null, options);\n })\n });\n}", "function InsertAnchorLink() {\r\n var selectedField = RTE.Canvas.currentEditableRegion();\r\n var anchorTags = selectedField.getElementsByTagName(\"ins\");\r\n var anchorList = \"\";\r\n //This loop creates an Array that we pass into the dialog window\r\n for (i = 0; i < anchorTags.length; i++) {\r\n if (anchorTags[i].id && (anchorTags[i].id.length > 0))\r\n anchorList = anchorList + anchorTags[i].id + \",\";\r\n }\r\n anchorList = anchorList.substring(0, anchorList.length - 1);\r\n var options = SP.UI.$create_DialogOptions();\r\n var selectedText = getSelectedText();\r\n\r\n options.title = \"Please select an anchor\";\r\n options.width = 400;\r\n options.height = 200;\r\n options.y = getTop(200);\r\n\r\n options.args =\r\n {\r\n selectedText: selectedText,\r\n anchorList: anchorList\r\n };\r\n options.url = \"/_layouts/BeenJammin.SharePoint.CustomRibbonActions/AnchorLinkDialog.aspx\";\r\n options.dialogReturnValueCallback = Function.createDelegate(null, AnchorLinkCloseCallback);\r\n SP.UI.ModalDialog.showModalDialog(options);\r\n\r\n}", "createNewTrialEntry(rArgs) {\n let args = {};\n if (rArgs.ezid != null)\n args = rArgs;\n else\n args = {ezid: this.state.trialbookFSData[this.state.trialbookSelectedIndex].EZID};\n this.fetchData({type: \"CREATE_NEW_TRAILENTRY\", data: args});\n }", "function initHasOne(tab, data) {\n var associationHref = buildAssociationHref(tab);\n // Set new content\n tab.find('.ajax-content').html(data.empty == true ? EMPTY+'<br><br>' : $(data.content).find(\"#home\").length?$(data.content).find(\"#home\"):data.content);\n // Delete buttons from original view\n tab.find('.quicklinks').remove();\n\n var newButton, href= '/'+data.option.target.substring(2);\n // EMPTY: Set empty text, add create button\n if (data.empty) {\n newButton = $(CREATE_BUTTON);\n newButton.attr('data-href', href+'/create_form'+associationHref);\n }\n // NOT EMPTY: Set content, add update/delete button\n else {\n tab.find('a:not(.status)').each(function() {\n if (typeof $(this).data('href') !== \"undefined\" && $(this).data('href').indexOf('/set_status/') != -1)\n $(this).addClass('ajax');\n });\n var updBtn = $(UPDATE_BUTTON);\n updBtn.attr('data-href', href+'/update_form'+associationHref+'&id='+data.data);\n updBtn.attr('data-id', data.data);\n\n var delForm = $(DELETE_FORM);\n delForm.attr('action', '/'+data.option.target.substring(2)+'/delete');\n delForm.find('input[name=id]').val(data.data);\n\n delForm.prepend(updBtn);\n newButton = $('<div class=\"quicklinks\"></div>');\n newButton.append(delForm);\n }\n tab.find('.ajax-content').append(newButton);\n}", "function createContextMenus(){\n chrome.contextMenus.removeAll();\n // Add parent context menus\n chrome.contextMenus.create({\n title: \"Mazii - Notification Action\",\n id: \"parent\",\n contexts:[\"link\", \"selection\"]\n });\n // Add child context menu\n chrome.contextMenus.create({\n title: \"Follow this post\",\n parentId: \"parent\",\n contexts:[\"link\", \"selection\"],\n onclick: function(info, tab) {\n let linkUrl = info.linkUrl;\n saveNewLinkUrl(linkUrl);\n }\n });\n}", "function aaRecreateElementFromEntry(p, elementEntry) {\n const ns = p.treeAdapter.getNamespaceURI(elementEntry.element);\n const newElement = p.treeAdapter.createElement(elementEntry.token.tagName, ns, elementEntry.token.attrs);\n p.openElements.replace(elementEntry.element, newElement);\n elementEntry.element = newElement;\n return newElement;\n}", "function NewEntryForm() {\n $(\"#addCancel\").click(this.clearForm);\n $(\"#addButton\").click(this.submitForm);\n }", "static associate(models) {\n // define association here\n //ONE TO MANY (A USER CAN HAVE MANY REACTIONS) BUT (REACTION ONLY BELONG TO ONE USER)\n this.belongsTo(models.Message, {foreignKey:'messageId'})\n this.belongsTo(models.User , {foreignKey:'userId'})\n }", "function addEntryCallback(e) {\n var link = e.target.closest(\"a\");\n var span = link.querySelector(\"span\");\n var resourceName;\n if(span) {\n if(span.classList.contains(\"fp-icon\")) {\n // special case for mod_folder\n resourceName = span.parentElement.textContent.trim();\n } else {\n resourceName = span.firstChild.textContent.trim();\n }\n } else {\n resourceName = link.textContent.trim();\n }\n\n var entry = {\n resourceName: resourceName,\n courseTitle: document.querySelector(\"#page-header\")\n .querySelector(\"h1\").textContent,\n courseID: courseID,\n timestamp: (new Date()).getTime(),\n URL: link.href,\n };\n addEntryToRecentItems(entry);\n }", "function deleteReciprocalAssociation(field, recip_obj_id) {\n var type = jQuery('#entry_form input[name=_type]').val();\n jQuery.get(\n CMSScriptURI + '?__mode=unlink_reciprocal',\n {\n 'recip_field_basename': field,\n 'recip_entry_id': recip_obj_id,\n 'cur_entry_id': jQuery('input[name=id]').val(),\n 'recip_obj_type': type\n },\n function(data) {\n jQuery('#'+field+'_status').html(data.message).show(500);\n\n // The association was successfully deleted from the database,\n // so delete the visible data.\n if (data.status == 1) {\n jQuery('input#'+field).val('');\n jQuery('ul#custom-field-reciprocal-'+field).children().remove();\n setTimeout(function() {\n jQuery('#'+field+'_status').hide(1000)\n }, 7000);\n }\n },\n 'json'\n );\n}", "function setEntryDefaultValues(e) {\n //e.set(FIELD_EDITOR, arrEditors);\n //e.set(FIELD_IS_NEW, true);\n }", "function handleAdeLinkEvent(thisObj) {\n var i, n, a, r, c, ret, exclude, url, html, editId, deleteId;\n var args, dataElement, value;\n var h = thisObj.getHtmlIds();\n var m = thisObj.getMeta();\n\tvar v = thisObj.values;\n \n // If all of the values have been selected, then inform the user that there are no more values\n // to select instead of showing the ADE popup. Only do this if the data element does not have \n // an other value, since the user can select as many others as desired.\n if (!m.otherCui && v && v.length == m.broadVsLeafCount) {\n alert(\"There are no more values to select for this data element.\");\n return;\n }\n \n\t// Create a parameter list for the URL for the ADE popup. Add the system name of the\n\t// data element and the form definition id.\n\tvar p = $H();\n\tp.dataElementSystemName = thisObj.systemName;\n p.formDefinitionId = GSBIO.kc.data.FormInstances.getFormInstance(_formId).formDefinitionId;\n\n\t// Append the list of CUIs of values to exclude. Never include the other CUI as an excluded\n\t// CUI since the user can enter as many others as desired.\n if (m.isDatatypeCv && v) {\n\t exclude = [];\n for (i = 0, n = v.length; i < n; i++) {\n if (v[i].value != m.otherCui) {\n exclude.push(v[i].value);\n }\n }\n if (exclude.length > 0) {\n p.excludedValues = exclude;\n }\n }\n\n // Build the argument for the popup, which is our ARTS object, which the popup will use to \n // merge its ARTS concepts into.\n args = [GSBIO.ARTS];\n\n\t// Build the URL and use it to show the modal popup. If the user does not cancel the popup\n\t// a GSBIO.kc.data.DataElement will be returned with a new value for this data element and \n\t// values that were entered for all of the value's ADE elements.\n\turl = m.adePopup + '?' + p.toQueryString();\n\tret = window.showModalDialog(url, args, \"dialogWidth:700px;dialogHeight:700px;\");\n\tif (ret) {\n\t _changed = true;\n\t dataElement = ret.evalJSON();\n value = dataElement.values[0];\n a = $(h.adeTable);\n\n // If there is only a single row in the ADE table then it is the heading row, and\n // therefore this is the first data element value to be added. In this case, clear\n // any existing values of this object. One situation in which this object might \n // contain a value is when the saved value is one of the system standard values.\n if (a.rows.length == 1) {\n\t thisObj.values = null;\n }\n \n // If either the user selected the NOVAL, or the user selected a value other than the \n \t // NOVAL and the current value of this data element is the NOVAL, first delete all \n // existing values from this object and delete all rows from the ADE summary table. We \n // do this since the NOVAL is mutually exclusive with all other values. The first case \n\t // (user selected the NOVAL) is fairly obvious, and in the second case if the current value\n\t // of this data element is the NOVAL it must be the first (and only) value, so in either\n\t // case we can delete all values. Note also that the first row of the ADE table is the \n\t // heading row, so don't delete that row.\n\t if (m.noCui && ((m.noCui == value.value) || (thisObj.getValue(0) && m.noCui == thisObj.getValue(0).value))) {\n\t thisObj.values = null;\n\t h.adeEdit = null;\n\t h.adeDelete = null;\n \t for (i = a.rows.length - 1; i > 0; i--) {\n\t a.deleteRow(i);\n\t }\n }\n\n // Add the value that the user entered to this data element.\n\t v = GSBIO.kc.data.DataElementValue(value);\n\t thisObj.addValue(v);\n\t \n\t // Add a new row to the ADE summary table, and add the value of the data element in the\n\t // first cell.\n\t r = a.insertRow(a.rows.length);\n\t r.insertCell().innerHTML = thisObj.getDisplayForAdeSummaryTable(thisObj.values.length-1);\n\n // Add the value of each ADE element to subsequent cells.\n\t if (v.ade && v.ade.elements) {\n\t\tfor (i = 0, n = v.ade.elements.length; i < n; i++) {\n\t\t r.insertCell().innerHTML = v.ade.elements[i].getDisplayForAdeSummaryTable();\n\t\t}\n\t }\n\n // Add the Edit and Delete button in the last cell. We'll generate their ids here and\n // add them to this object for proper event handling when they are clicked.\n editId = GSBIO.UniqueIdGenerator.getUniqueId();\n deleteId = GSBIO.UniqueIdGenerator.getUniqueId();\n thisObj.addAdeEditId(editId);\n thisObj.addAdeDeleteId(deleteId);\n\t c = r.insertCell();\n\t c.className = 'kcElementAdeButtons';\n\t html = '<input id=\"';\n\t html += editId;\n\t html += '\" type=\"button\" class=\"kcButton\" value=\"Edit\"/>&nbsp;';\n\t html += '<input id=\"';\n\t html += deleteId;\n\t html += '\" type=\"button\" class=\"kcButton\" value=\"Delete\"/>';\n\t c.innerHTML = html;\n\n // Make sure the standard values are all cleared.\n thisObj.clearStandardValues();\n\t\t\n\t // Make sure the ADE summary table is showing.\n\t thisObj.showAde();\n\t} \n }", "addNewEntry(entryDetails) {\n this.props.addEntryCallback(entryDetails);\n }", "static createAnIngredient(e) {\n e.preventDefault()\n fetch(`${BASE_URL}/${recipe2.id}`, {\n method: 'PATCH',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(recipe2) \n })\n .then(resp => resp.json())\n .then(recipe => {\n let ingredient = recipe.ingredients[recipe.ingredients.length - 1 ]\n let i = new Ingredient(ingredient.id, ingredient.name, ingredient.measurement);\n i.renderIngredient(recipe);\n Recipe.mostIngs()\n })\n let newIngForm = document.getElementById(\"new-ing-frm\");\n newIngForm.reset(); \n }", "function add_rm_entry(field,m_rm_area){\n\n\t///// create header /////\n\tvar area_header=$(\"<div></div>\");\n\tarea_header.addClass(\"sidebar_area_entry\");\n\tarea_header.addClass(\"inline_block\");\n\tfield.append(area_header);\n\n\t// create area div\n\tvar area_icon_name=$(\"<div></div>\");\n\tarea_icon_name.addClass(\"float_left\");\n\tarea_icon_name.addClass(\"inline_block\");\n\tarea_header.append(area_icon_name);\t\t\t\t\n\n\t// add icon\n\tvar area_icon=$(\"<i></i>\");\n\tarea_icon.addClass(\"material-icons\");\n\tarea_icon.addClass(\"float_left\");\n\tarea_icon.text(\"home\");\n\tarea_icon_name.append(area_icon);\n\t\t\t\n\t// first the name\n\tvar area_name=$(\"<div></div>\");\n\tarea_name.text(m_rm_area[\"area\"]);\n\tarea_name.addClass(\"float_right\");\n\tarea_name.addClass(\"sidebar_area_name\");\n\tarea_icon_name.append(area_name);\n\t///// create header /////\n\n\t///// now the ruels /////\n\tvar nobody_at_my_geo_area_active=false;\n\tfor(var b=0;b<m_rm_area[\"rules\"].length;b++){\n\t\tvar rm_rule=$(\"<div></div>\");\n\t\tif(m_rm_area[\"rules\"][b][1]==\"nobody_at_my_geo_area\"){\n\t\t\tnobody_at_my_geo_area_active=true;\n\t\t} else {\n\t\t\trm_rule.text(m_rm_area[\"rules\"][b][1]+\",\"+m_rm_area[\"rules\"][b][2]+\",\"+m_rm_area[\"rules\"][b][3]);\n\t\t};\n\t\t//rm_header.append(rm_rule);\n\t};\n\n\t///////// GPS /////////\n\tvar geo_select=$(\"<select></select>\");\n\tgeo_select.attr({\n\t\t\"id\": m_rm_area[\"area\"]+\"_geo_area\",\n\t\t\"class\":\"sidebar_select\"\n\t});\n\tgeo_select.append($('<option></option>').val(\"1\").html(\"geofencing active\").prop('selected', nobody_at_my_geo_area_active));\n\tgeo_select.append($('<option></option>').val(\"0\").html(\"no geofencing\").prop('selected', !nobody_at_my_geo_area_active));\n\tgeo_select.change(function(){\n\t\tvar int_id=m_rm_area[\"area\"];\n\t\treturn function(){\n\t\t\tvar geo_fencing=$(\"#\"+int_id+\"_geo_area\");\n\t\t\tif(geo_fencing.length){\n\t\t\t\tupdate_rule_geo(int_id,geo_fencing.val());\n\t\t\t};\n\t\t}\n\t}());\n\tfield.append(geo_select);\n\t///////// GPS /////////\n}", "function prefListAdd(event, ui){\n $.post( \"/people/addpreference/\"+ $($('.highlight').find(\"td:nth-child(1)\")).attr('data-id'),{pub: $(ui.item).attr('data-id')});\n}", "static associate() {\n \n }", "function _createNewPageEntry(isTemplate){\n\t\t\t_checkState(CONST_STATE_ADD_SELECT_TYPE);\n\t\t\t_removeAddEntrySelectTypeIfRequired();\n\t\t\tvar newId = _generateNewId();\n\t\t\tvar options = {\n\t\t\t\tkey: newId,\n\t\t\t\tisTemplate: isTemplate,\n\t\t\t\ttitle: \"\"\n\t\t\t};\n\t\t\t\n\t\t\tvar itemToInsertPage = _findItemToInsertPage(isTemplate);\n\t\t\tvar renderedInsertTitle = $.tmpl($(\"#render-add-page-insert-title-template\"), options);\n\t\t\tif(itemToInsertPage == null || itemToInsertPage.domElement == null){\n\t\t\t\tvar innerUL = _domElement.find(\"> ul\");\n\t\t\t\tinnerUL.append(renderedInsertTitle);\n\t\t\t}\n\t\t\telse{\n\t\t\t\tif(itemToInsertPage.after)\n\t\t\t\t\titemToInsertPage.domElement.after(renderedInsertTitle);\n\t\t\t\telse\n\t\t\t\t\titemToInsertPage.domElement.before(renderedInsertTitle);\n\t\t\t}\n\t\t\t\n\t\t\t$(\"#new-item-title-\"+newId).focus();\n\t\t\t\n\t\t\t_state = isTemplate ? CONST_STATE_ADD_PAGE_TEMPLATE_SET_TITLE : CONST_STATE_ADD_PAGE_SET_TITLE;\n\t\t\t\n\t\t\tvar jsonCreator = {\n\t\t\t\t\tcreate: function(newId, title, isTemplate, id){\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tisTemplate: isTemplate,\n\t\t\t\t\t\t\tkey: newId,\n\t\t\t\t\t\t\ttitle: title,\n\t\t\t\t\t\t\ttype: \"page\",\n\t\t\t\t\t\t\tparentId: id\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t};\n\t\t\t\n\t\t\t// add the handles to create the new channel\n\t\t\t$(\"#new-item-title-\"+newId).keypress(function (e){\n\t\t\t\tswitch(e.which){\n\t\t\t\tcase CONST_VK_CONFIRM: //enter\n\t\t\t\t\t_confirmObjectCreation(newId, jsonCreator, \"#render-page-template\", itemToInsertPage, isTemplate);\n\t\t\t\t\te.stopPropagation();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t\t\n\t\t\t$(\".insert-title > span.title-entry\").click(function(e){\n\t\t\t\te.stopPropagation();\n\t\t\t\treturn false;\n\t\t\t});\n\t\t\t\n\t\t\t$(\".insert-title > span.actions > span.ok\").click(function(e){\n\t\t\t\t_confirmObjectCreation(newId, jsonCreator, \"#render-page-template\", itemToInsertPage, isTemplate);\n\t\t\t\te.stopPropagation();\n\t\t\t\treturn false;\n\t\t\t});\n\t\t}", "function recordCreate( client, record, results ){\n var owner_id, parent_id, repo_alloc, alias_key;\n\n //console.log(\"Create new data\");\n\n if ( record.parent ) {\n parent_id = g_lib.resolveCollID( record.parent, client );\n owner_id = g_db.owner.firstExample({_from:parent_id})._to;\n if ( owner_id != client._id ){\n if ( !g_lib.hasManagerPermProj( client, owner_id )){\n var parent_coll = g_db.c.document( parent_id );\n if ( !g_lib.hasPermissions( client, parent_coll, g_lib.PERM_CREATE )){\n throw g_lib.ERR_PERM_DENIED;\n }\n }\n }\n }else{\n parent_id = g_lib.getRootID(client._id);\n owner_id = client._id;\n }\n\n // TODO This need to be updated when allocations can be assigned to collections\n\n // If repo is specified, verify it; otherwise assign one (aware of default)\n if ( record.repo ) {\n repo_alloc = g_lib.verifyRepo( owner_id, record.repo );\n } else {\n repo_alloc = g_lib.assignRepo( owner_id );\n }\n\n if ( !repo_alloc )\n throw [g_lib.ERR_NO_ALLOCATION,\"No allocation available\"];\n\n var time = Math.floor( Date.now()/1000 );\n var obj = { size: 0, ct: time, ut: time, owner: owner_id, creator: client._id };\n\n g_lib.procInputParam( record, \"title\", false, obj );\n g_lib.procInputParam( record, \"desc\", false, obj );\n g_lib.procInputParam( record, \"keyw\", false, obj );\n g_lib.procInputParam( record, \"alias\", false, obj );\n g_lib.procInputParam( record, \"doi\", false, obj );\n g_lib.procInputParam( record, \"data_url\", false, obj );\n\n if ( record.md ){\n obj.md = record.md;\n if ( Array.isArray( obj.md ))\n throw [g_lib.ERR_INVALID_PARAM,\"Metadata cannot be an array\"];\n }\n\n if ( obj.doi || obj.data_url ){\n if ( !obj.doi || !obj.data_url )\n throw [g_lib.ERR_INVALID_PARAM,\"DOI number and Data URL must specified together.\"];\n\n alias_key = (obj.doi.split(\"/\").join(\"_\"));\n console.log(\"alias:\",alias_key);\n }else{\n if ( record.ext_auto !== undefined )\n obj.ext_auto = record.ext_auto;\n else\n obj.ext_auto = true;\n\n if ( !obj.ext_auto && record.ext ){\n obj.ext = record.ext;\n if ( obj.ext.length && obj.ext.charAt(0) != \".\" )\n obj.ext = \".\" + obj.ext;\n }\n\n if ( obj.alias ) {\n alias_key = owner_id[0] + \":\" + owner_id.substr(2) + \":\" + obj.alias;\n }\n }\n\n var data = g_db.d.save( obj, { returnNew: true });\n g_db.owner.save({ _from: data.new._id, _to: owner_id });\n\n g_lib.makeTitleUnique( parent_id, data.new );\n\n // Create data location edge and update allocation and stats\n var loc = { _from: data.new._id, _to: repo_alloc._to, uid: owner_id };\n g_db.loc.save( loc );\n g_db.alloc.update( repo_alloc._id, { rec_count: repo_alloc.rec_count + 1 });\n\n if ( alias_key ) {\n if ( g_db.a.exists({ _key: alias_key }))\n throw [g_lib.ERR_INVALID_PARAM,\"Alias, \"+alias_key+\", already in use\"];\n\n g_db.a.save({ _key: alias_key });\n g_db.alias.save({ _from: data.new._id, _to: \"a/\" + alias_key });\n g_db.owner.save({ _from: \"a/\" + alias_key, _to: owner_id });\n }\n\n // Handle specified dependencies\n if ( record.deps != undefined ){\n var dep,id,dep_data;\n data.new.deps = [];\n\n for ( var i in record.deps ) {\n dep = record.deps[i];\n id = g_lib.resolveDataID( dep.id, client );\n dep_data = g_db.d.document( id );\n if ( g_db.dep.firstExample({ _from: data._id, _to: id }))\n throw [g_lib.ERR_INVALID_PARAM,\"Only one dependency can be defined between any two data records.\"];\n g_db.dep.save({ _from: data._id, _to: id, type: dep.type });\n data.new.deps.push({id:id,alias:dep_data.alias,type:dep.type,dir:g_lib.DEP_OUT});\n }\n }\n\n g_db.item.save({ _from: parent_id, _to: data.new._id });\n\n data.new.id = data.new._id;\n data.new.parent_id = parent_id;\n data.new.repo_id = repo_alloc._to;\n\n delete data.new._id;\n delete data.new._key;\n delete data.new._rev;\n\n results.push( data.new );\n}", "function postEntry() {\n var entry = cfg.defaultEntry(),\n useLocation = $(cfg.select.ids.formLocation).prop('checked');\n\n entry.entryID = cfg.counter + 1;\n entry.title = $(cfg.select.ids.formTitle).val();\n entry.description = $(cfg.select.ids.formDesc).val();\n\n if (!entry.title || !entry.description) {\n return;\n }\n\n addEntryToDOM([entry]);\n storeEntry(entry);\n addMarker(entry);\n notifyUser('Your entry was posted successfully!');\n\n if (true === useLocation) {\n updateLocation(entry.entryID);\n }\n }" ]
[ "0.5368761", "0.5305341", "0.5257124", "0.5232171", "0.51533616", "0.51533616", "0.51533616", "0.51533616", "0.5139111", "0.51008296", "0.50781304", "0.5073649", "0.5039997", "0.5020927", "0.5015054", "0.496429", "0.4951728", "0.4947675", "0.49365643", "0.49352273", "0.48883557", "0.4879358", "0.48743466", "0.4869813", "0.4853531", "0.4848582", "0.4836825", "0.48355597", "0.48325005", "0.48260257", "0.48249507", "0.48139507", "0.47945625", "0.47932294", "0.47917935", "0.47885567", "0.47844228", "0.47383994", "0.47150484", "0.47146058", "0.46867332", "0.46864557", "0.46848866", "0.46727446", "0.4671878", "0.4660916", "0.46594533", "0.46512777", "0.4649474", "0.46412793", "0.46388182", "0.46388182", "0.46388182", "0.46388182", "0.46388182", "0.46388182", "0.46388182", "0.46388182", "0.46388182", "0.46388182", "0.46388182", "0.46388182", "0.46388182", "0.46388182", "0.4620374", "0.46190915", "0.46118155", "0.46061143", "0.46033224", "0.46002004", "0.4598715", "0.4598715", "0.4598715", "0.4598715", "0.45967788", "0.45952922", "0.45851338", "0.45842534", "0.45814386", "0.45783937", "0.45773906", "0.4576444", "0.45761213", "0.456504", "0.4561728", "0.4559744", "0.4557236", "0.4550206", "0.45495236", "0.4541697", "0.45410693", "0.4536508", "0.45317328", "0.4529892", "0.45279717", "0.45246646", "0.45208704", "0.45176095", "0.45135212", "0.45133817" ]
0.6117439
0